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);
|
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")){
|
||||||
|
@ -222,6 +223,12 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
|
||||||
retval.push_back(decoded);
|
retval.push_back(decoded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
|
||||||
|
decoded = ProtocolX10::decodeData(dataMsg);
|
||||||
|
if (decoded != "") {
|
||||||
|
retval.push_back(decoded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
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;
|
int intData = 0, currentBit = 31;
|
||||||
bool method=0;
|
bool method=0;
|
||||||
sscanf(data.c_str(), "%X", &intData);
|
sscanf(dataMsg.getParameter("data").c_str(), "%X", &intData);
|
||||||
|
|
||||||
int unit = 0;
|
int unit = 0;
|
||||||
int rawHouse = 0;
|
int rawHouse = 0;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define PROTOCOLX10_H
|
#define PROTOCOLX10_H
|
||||||
|
|
||||||
#include "Protocol.h"
|
#include "Protocol.h"
|
||||||
|
#include "ControllerMessage.h"
|
||||||
|
|
||||||
class ProtocolX10 : public Protocol
|
class ProtocolX10 : public Protocol
|
||||||
{
|
{
|
||||||
|
@ -9,7 +10,7 @@ public:
|
||||||
int methods() const;
|
int methods() const;
|
||||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
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
|
#endif //PROTOCOLX10_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue