Readded x10 as receiving protocol
This commit is contained in:
parent
61b193ad2d
commit
b179835fc3
3 changed files with 13 additions and 5 deletions
|
@ -85,6 +85,7 @@ bool Protocol::checkBit(int data, int bitno) {
|
|||
return ((data>>bitno)&0x01);
|
||||
}
|
||||
|
||||
|
||||
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname){
|
||||
|
||||
if(TelldusCore::comparei(protocolname, L"arctech")){
|
||||
|
@ -186,10 +187,10 @@ std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &pr
|
|||
|
||||
} else if (TelldusCore::comparei(protocolName, L"yidong")) {
|
||||
parameters.push_back("unit");
|
||||
|
||||
|
||||
} else if (TelldusCore::comparei(protocolName, L"group")) {
|
||||
parameters.push_back("devices");
|
||||
|
||||
|
||||
} else if (TelldusCore::comparei(protocolName, L"scene")) {
|
||||
parameters.push_back("devices");
|
||||
}
|
||||
|
@ -222,6 +223,12 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
|
|||
retval.push_back(decoded);
|
||||
}
|
||||
}
|
||||
else if(TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
|
||||
decoded = ProtocolX10::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -107,10 +107,10 @@ std::string ProtocolX10::getStringForMethod(int method, unsigned char data, Cont
|
|||
|
||||
}
|
||||
|
||||
std::string ProtocolX10::decodeData(const std::string& data) {
|
||||
std::string ProtocolX10::decodeData(ControllerMessage& dataMsg) {
|
||||
int intData = 0, currentBit = 31;
|
||||
bool method=0;
|
||||
sscanf(data.c_str(), "%X", &intData);
|
||||
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
||||
|
||||
int unit = 0;
|
||||
int rawHouse = 0;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define PROTOCOLX10_H
|
||||
|
||||
#include "Protocol.h"
|
||||
#include "ControllerMessage.h"
|
||||
|
||||
class ProtocolX10 : public Protocol
|
||||
{
|
||||
|
@ -9,7 +10,7 @@ public:
|
|||
int methods() const;
|
||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||
|
||||
static std::string decodeData(const std::string& data);
|
||||
static std::string decodeData(ControllerMessage& dataMsg);
|
||||
};
|
||||
|
||||
#endif //PROTOCOLX10_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue