We need spaces surrounding operators according to Google style guidelines "whitespace/operators"
This commit is contained in:
parent
a01b42b4d7
commit
e7bb22cf34
10 changed files with 19 additions and 19 deletions
|
@ -151,7 +151,7 @@ int Device::doAction(int action, unsigned char data, Controller *controller) {
|
||||||
int methods = p->methods();
|
int methods = p->methods();
|
||||||
if ((action & methods) == 0) {
|
if ((action & methods) == 0) {
|
||||||
// Loop all methods an see if any method masks to this one
|
// Loop all methods an see if any method masks to this one
|
||||||
for(int i = 1; i <= methods; i<<=1) {
|
for(int i = 1; i <= methods; i <<= 1) {
|
||||||
if ((i & methods) == 0) {
|
if ((i & methods) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -658,7 +658,7 @@ void DeviceManager::handleControllerMessage(const ControllerEventData &eventData
|
||||||
if (!TelldusCore::comparei(it->second->getProtocolName(), msg.protocol())) {
|
if (!TelldusCore::comparei(it->second->getProtocolName(), msg.protocol())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (! (it->second->getMethods() & msg.method())) {
|
if ( !(it->second->getMethods() & msg.method()) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ int Protocol::getIntParameter(const std::wstring &name, int min, int max) const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Protocol::checkBit(int data, int bitno) {
|
bool Protocol::checkBit(int data, int bitno) {
|
||||||
return ((data>>bitno)&0x01);
|
return ((data >> bitno)&0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,14 @@ std::string ProtocolEverflourish::getStringForMethod(int method, unsigned char,
|
||||||
char preamble[] = {'R', 5, 'T', 114, 60, 1, 1, 105, ssss, ssss, 0};
|
char preamble[] = {'R', 5, 'T', 114, 60, 1, 1, 105, ssss, ssss, 0};
|
||||||
strCode.append(preamble);
|
strCode.append(preamble);
|
||||||
|
|
||||||
for(i=15;i>=0;i--) {
|
for(i = 15; i >= 0; i--) {
|
||||||
strCode.append(1, bits[(deviceCode>>i)&0x01]);
|
strCode.append(1, bits[(deviceCode >> i)&0x01]);
|
||||||
}
|
}
|
||||||
for(i=3;i>=0;i--) {
|
for(i = 3; i >= 0; i--) {
|
||||||
strCode.append(1, bits[(check>>i)&0x01]);
|
strCode.append(1, bits[(check >> i)&0x01]);
|
||||||
}
|
}
|
||||||
for(i=3;i>=0;i--) {
|
for(i = 3; i >= 0; i--) {
|
||||||
strCode.append(1, bits[(action>>i)&0x01]);
|
strCode.append(1, bits[(action >> i)&0x01]);
|
||||||
}
|
}
|
||||||
|
|
||||||
strCode.append(1, ssss);
|
strCode.append(1, ssss);
|
||||||
|
@ -74,7 +74,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int lo, hi;
|
unsigned int lo, hi;
|
||||||
|
|
||||||
if ((x&0x3)==3) {
|
if ((x&0x3) == 3) {
|
||||||
lo = x & 0x00ff;
|
lo = x & 0x00ff;
|
||||||
hi = x & 0xff00;
|
hi = x & 0xff00;
|
||||||
lo += 4;
|
lo += 4;
|
||||||
|
@ -84,7 +84,7 @@ unsigned int ProtocolEverflourish::calculateChecksum(unsigned int x) {
|
||||||
x = lo | hi;
|
x = lo | hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<16;i++) {
|
for(i = 0; i < 16; i++) {
|
||||||
if (x&bit) {
|
if (x&bit) {
|
||||||
res = res ^ bits[i];
|
res = res ^ bits[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ std::string ProtocolIkea::getStringForMethod(int method, unsigned char level, Co
|
||||||
int checksum1 = 0;
|
int checksum1 = 0;
|
||||||
int checksum2 = 0;
|
int checksum2 = 0;
|
||||||
for (int i = 13; i >= 0; --i) {
|
for (int i = 13; i >= 0; --i) {
|
||||||
if ((intCode>>i) & 1) {
|
if ((intCode >> i) & 1) {
|
||||||
strChannels.append("TT");
|
strChannels.append("TT");
|
||||||
if (i % 2 == 0)
|
if (i % 2 == 0)
|
||||||
checksum2++;
|
checksum2++;
|
||||||
|
@ -112,7 +112,7 @@ std::string ProtocolIkea::getStringForMethod(int method, unsigned char level, Co
|
||||||
checksum1 = 0;
|
checksum1 = 0;
|
||||||
checksum2 = 0;
|
checksum2 = 0;
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
if ((intCode>>i) & 1) {
|
if ((intCode >> i) & 1) {
|
||||||
strReturn.append("TT");
|
strReturn.append("TT");
|
||||||
if (i % 2 == 0)
|
if (i % 2 == 0)
|
||||||
checksum1++;
|
checksum1++;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "service/TellStick.h"
|
#include "service/TellStick.h"
|
||||||
#include "common/Strings.h"
|
#include "common/Strings.h"
|
||||||
|
|
||||||
int ProtocolNexa::lastArctecCodeSwitchWasTurnOff=0; // TODO, always removing first turnon now, make more flexible (waveman too)
|
int ProtocolNexa::lastArctecCodeSwitchWasTurnOff = 0; // TODO, always removing first turnon now, make more flexible (waveman too)
|
||||||
|
|
||||||
int ProtocolNexa::methods() const {
|
int ProtocolNexa::methods() const {
|
||||||
if (TelldusCore::comparei(model(), L"codeswitch")) {
|
if (TelldusCore::comparei(model(), L"codeswitch")) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ std::string ProtocolSartano::decodeData(ControllerMessage &dataMsg) {
|
||||||
sscanf(data.c_str(), "%X", &allDataIn);
|
sscanf(data.c_str(), "%X", &allDataIn);
|
||||||
|
|
||||||
unsigned long mask = (1<<11);
|
unsigned long mask = (1<<11);
|
||||||
for(int i=0;i<12;++i) {
|
for(int i = 0; i < 12; ++i) {
|
||||||
allData >>= 1;
|
allData >>= 1;
|
||||||
if((allDataIn & mask) == 0) {
|
if((allDataIn & mask) == 0) {
|
||||||
allData |= (1<<11);
|
allData |= (1<<11);
|
||||||
|
@ -86,7 +86,7 @@ std::string ProtocolSartano::decodeData(ControllerMessage &dataMsg) {
|
||||||
std::stringstream retString;
|
std::stringstream retString;
|
||||||
retString << "class:command;protocol:sartano;model:codeswitch;code:";
|
retString << "class:command;protocol:sartano;model:codeswitch;code:";
|
||||||
mask = (1<<9);
|
mask = (1<<9);
|
||||||
for(int i=0;i<10;i++) {
|
for(int i = 0; i < 10; i++) {
|
||||||
if((code & mask) != 0) {
|
if((code & mask) != 0) {
|
||||||
retString << 1;
|
retString << 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int ProtocolWaveman::lastArctecCodeSwitchWasTurnOff=0;
|
int ProtocolWaveman::lastArctecCodeSwitchWasTurnOff = 0;
|
||||||
|
|
||||||
int ProtocolWaveman::methods() const {
|
int ProtocolWaveman::methods() const {
|
||||||
return TELLSTICK_TURNON | TELLSTICK_TURNOFF;
|
return TELLSTICK_TURNON | TELLSTICK_TURNOFF;
|
||||||
|
|
|
@ -115,7 +115,7 @@ std::string ProtocolX10::getStringForMethod(int method, unsigned char data, Cont
|
||||||
|
|
||||||
std::string ProtocolX10::decodeData(ControllerMessage& dataMsg) {
|
std::string ProtocolX10::decodeData(ControllerMessage& dataMsg) {
|
||||||
int intData = 0, currentBit = 31;
|
int intData = 0, currentBit = 31;
|
||||||
bool method=0;
|
bool method = 0;
|
||||||
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
||||||
|
|
||||||
int unit = 0;
|
int unit = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ TellStick::TellStick(int controllerId, TelldusCore::EventRef event, TelldusCore:
|
||||||
d->running = false;
|
d->running = false;
|
||||||
|
|
||||||
Settings set;
|
Settings set;
|
||||||
d->ignoreControllerConfirmation = set.getSetting(L"ignoreControllerConfirmation")==L"true";
|
d->ignoreControllerConfirmation = set.getSetting(L"ignoreControllerConfirmation") == L"true";
|
||||||
|
|
||||||
ftdi_init(&d->ftHandle);
|
ftdi_init(&d->ftHandle);
|
||||||
ftdi_set_interface(&d->ftHandle, INTERFACE_ANY);
|
ftdi_set_interface(&d->ftHandle, INTERFACE_ANY);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue