Implement protocol Comen by hardcoding the last to bits in the housecode
This commit is contained in:
parent
d6dcd11973
commit
61d0b2ac09
2 changed files with 13 additions and 7 deletions
|
@ -8,12 +8,16 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int ProtocolComen::methods() const {
|
int ProtocolComen::methods() const {
|
||||||
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF);
|
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_LEARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ProtocolComen::getStringForMethod(int method, unsigned char level, Controller *) {
|
int ProtocolComen::getIntParameter(const std::wstring &name, int min, int max) const {
|
||||||
int intHouse = getIntParameter(L"house", 1, 33554431);
|
if (name.compare(L"house") == 0) {
|
||||||
intHouse <<= 1; // They seem to only accept even codes?
|
int intHouse = Protocol::getIntParameter(L"house", 1, 16777215);
|
||||||
int intCode = getIntParameter(L"unit", 1, 16)-1;
|
// The last two bits must be hardcoded
|
||||||
return getStringSelflearningForCode(intHouse, intCode, method, level);
|
intHouse <<= 2;
|
||||||
|
intHouse += 2;
|
||||||
|
return intHouse;
|
||||||
|
}
|
||||||
|
return Protocol::getIntParameter(name, min, max);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
class ProtocolComen : public ProtocolNexa {
|
class ProtocolComen : public ProtocolNexa {
|
||||||
public:
|
public:
|
||||||
virtual int methods() const;
|
virtual int methods() const;
|
||||||
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
|
||||||
|
protected:
|
||||||
|
virtual int getIntParameter(const std::wstring &name, int min, int max) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TELLDUS_CORE_SERVICE_PROTOCOLCOMEN_H_
|
#endif // TELLDUS_CORE_SERVICE_PROTOCOLCOMEN_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue