Added function Protocol::checkBit()
This commit is contained in:
parent
99f0b133a8
commit
c7d51b249f
2 changed files with 10 additions and 4 deletions
|
@ -80,6 +80,10 @@ int Protocol::getIntParameter(const std::wstring &name, int min, int max) const
|
||||||
return intValue;
|
return intValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Protocol::checkBit(int data, int bitno) {
|
||||||
|
return ((data>>bitno)&0x01);
|
||||||
|
}
|
||||||
|
|
||||||
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname){
|
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname){
|
||||||
|
|
||||||
if(TelldusCore::comparei(protocolname, L"arctech")){
|
if(TelldusCore::comparei(protocolname, L"arctech")){
|
||||||
|
@ -181,10 +185,10 @@ std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &pr
|
||||||
|
|
||||||
} else if (TelldusCore::comparei(protocolName, L"yidong")) {
|
} else if (TelldusCore::comparei(protocolName, L"yidong")) {
|
||||||
parameters.push_back("unit");
|
parameters.push_back("unit");
|
||||||
|
|
||||||
} else if (TelldusCore::comparei(protocolName, L"group")) {
|
} else if (TelldusCore::comparei(protocolName, L"group")) {
|
||||||
parameters.push_back("devices");
|
parameters.push_back("devices");
|
||||||
|
|
||||||
} else if (TelldusCore::comparei(protocolName, L"scene")) {
|
} else if (TelldusCore::comparei(protocolName, L"scene")) {
|
||||||
parameters.push_back("devices");
|
parameters.push_back("devices");
|
||||||
}
|
}
|
||||||
|
@ -195,13 +199,13 @@ std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &pr
|
||||||
std::list<std::string> Protocol::decodeData(const std::wstring &protocolName, const std::string &data) {
|
std::list<std::string> Protocol::decodeData(const std::wstring &protocolName, const std::string &data) {
|
||||||
std::list<std::string> retval;
|
std::list<std::string> retval;
|
||||||
std::string decoded = "";
|
std::string decoded = "";
|
||||||
|
|
||||||
if( protocolName == L"everflourish" ) {
|
if( protocolName == L"everflourish" ) {
|
||||||
decoded = ProtocolEverflourish::decodeData(data);
|
decoded = ProtocolEverflourish::decodeData(data);
|
||||||
if (decoded != "") {
|
if (decoded != "") {
|
||||||
retval.push_back(decoded);
|
retval.push_back(decoded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ protected:
|
||||||
std::wstring getStringParameter(const std::wstring &name, const std::wstring &defaultValue = L"") const;
|
std::wstring getStringParameter(const std::wstring &name, const std::wstring &defaultValue = L"") const;
|
||||||
int getIntParameter(const std::wstring &name, int min, int max) const;
|
int getIntParameter(const std::wstring &name, int min, int max) const;
|
||||||
|
|
||||||
|
static bool checkBit(int data, int bit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PrivateData;
|
class PrivateData;
|
||||||
PrivateData *d;
|
PrivateData *d;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue