Added protocol Yidong
This commit is contained in:
parent
ba56976c9f
commit
fce9214a71
4 changed files with 120 additions and 73 deletions
|
@ -40,6 +40,8 @@ SET( telldus-service_protocol_SRCS
|
||||||
ProtocolWaveman.cpp
|
ProtocolWaveman.cpp
|
||||||
ProtocolX10.h
|
ProtocolX10.h
|
||||||
ProtocolX10.cpp
|
ProtocolX10.cpp
|
||||||
|
ProtocolYidong.h
|
||||||
|
ProtocolYidong.cpp
|
||||||
)
|
)
|
||||||
SET( telldus-service_HDRS
|
SET( telldus-service_HDRS
|
||||||
ClientCommunicationHandler.h
|
ClientCommunicationHandler.h
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "ProtocolUpm.h"
|
#include "ProtocolUpm.h"
|
||||||
#include "ProtocolWaveman.h"
|
#include "ProtocolWaveman.h"
|
||||||
#include "ProtocolX10.h"
|
#include "ProtocolX10.h"
|
||||||
|
#include "ProtocolYidong.h"
|
||||||
|
|
||||||
#include "Strings.h"
|
#include "Strings.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -110,6 +111,9 @@ Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname){
|
||||||
|
|
||||||
} else if (TelldusCore::comparei(protocolname, L"x10")) {
|
} else if (TelldusCore::comparei(protocolname, L"x10")) {
|
||||||
return new ProtocolX10();
|
return new ProtocolX10();
|
||||||
|
|
||||||
|
} else if (TelldusCore::comparei(protocolname, L"yidong")) {
|
||||||
|
return new ProtocolYidong();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -158,6 +162,9 @@ std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &pr
|
||||||
} else if (TelldusCore::comparei(protocolName, L"x10")) {
|
} else if (TelldusCore::comparei(protocolName, L"x10")) {
|
||||||
parameters.push_back("house");
|
parameters.push_back("house");
|
||||||
parameters.push_back("unit");
|
parameters.push_back("unit");
|
||||||
|
|
||||||
|
} else if (TelldusCore::comparei(protocolName, L"yidong")) {
|
||||||
|
parameters.push_back("unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
|
|
26
telldus-core/service/ProtocolYidong.cpp
Normal file
26
telldus-core/service/ProtocolYidong.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "ProtocolYidong.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
std::string ProtocolYidong::getStringForMethod(int method, unsigned char, Controller *) {
|
||||||
|
int intCode = this->getIntParameter(L"unit", 1, 4);
|
||||||
|
std::wstring strCode = L"111";
|
||||||
|
|
||||||
|
switch(intCode) {
|
||||||
|
case 1:
|
||||||
|
strCode.append(L"0010");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strCode.append(L"0001");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strCode.append(L"0100");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
strCode.append(L"1000");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
strCode.append(L"110");
|
||||||
|
printf("Code: %s\n", std::string(strCode.begin(), strCode.end()).c_str());
|
||||||
|
return getStringForCode(strCode, method);
|
||||||
|
}
|
12
telldus-core/service/ProtocolYidong.h
Normal file
12
telldus-core/service/ProtocolYidong.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef PROTOCOLYIDONG_H
|
||||||
|
#define PROTOCOLYIDONG_H
|
||||||
|
|
||||||
|
#include "ProtocolSartano.h"
|
||||||
|
|
||||||
|
class ProtocolYidong : public ProtocolSartano
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual std::string getStringForMethod(int method, unsigned char data, Controller *controller);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //PROTOCOLYIDONG_H
|
Loading…
Add table
Add a link
Reference in a new issue