Code reformatted.

Former-commit-id: 6f3688791602efb33389c3ba789e7a8a723ee290
This commit is contained in:
RickDB 2016-03-15 12:03:00 +01:00
parent dcc6a9b449
commit e5545eaac0
2 changed files with 187 additions and 186 deletions

View File

@ -31,16 +31,14 @@ LedDeviceAtmoOrb::LedDeviceAtmoOrb(const std::string& output, bool switchOffOnBl
int LedDeviceAtmoOrb::write(const std::vector <ColorRgb> &ledValues) {
// If not in multicast group return
if (!joinedMulticastgroup)
{
if (!joinedMulticastgroup) {
return 0;
}
// Iterate through colors and set Orb color
// Start off with idx 1 as 0 is reserved for controlling all orbs at once
unsigned int idx = 1;
for (const ColorRgb& color : ledValues)
{
for (const ColorRgb &color : ledValues) {
// Options parameter:
//
// 1 = force off
@ -51,18 +49,15 @@ int LedDeviceAtmoOrb::write(const std::vector<ColorRgb> & ledValues) {
if (switchOffOnBlack && color.red == 0 && color.green == 0 && color.blue == 0) {
// Force to black
for (unsigned int i = 0; i < orbIds.size(); i++) {
if (orbIds[i] == idx)
{
if (orbIds[i] == idx) {
setColor(idx, color, 1);
}
}
}
else
{
else {
// Default send color
for (unsigned int i = 0; i < orbIds.size(); i++) {
if (orbIds[i] == idx)
{
if (orbIds[i] == idx) {
setColor(idx, color, 4);
}
}

View File

@ -59,7 +59,11 @@ public:
/// @param array containing orb ids
///
LedDeviceAtmoOrb(const std::string &output, bool switchOffOnBlack =
false, int transitiontime = 0, int port = 49692, int numLeds = 24, std::vector<unsigned int> orbIds = std::vector<unsigned int>());
false, int transitiontime = 0, int port = 49692, int numLeds = 24,
std::vector<unsigned int> orbIds = std::vector < unsigned int
>());
///
/// Destructor of this device
///
@ -73,7 +77,9 @@ public:
/// @return Zero on success else negative
///
virtual int write(const std::vector <ColorRgb> &ledValues);
virtual int switchOff();
private:
/// QNetworkAccessManager object for sending requests.
QNetworkAccessManager *manager;