1 #pragma once
2 
3 #include "DomoticzHardware.h"
4 
5 class CICYThermostat : public CDomoticzHardwareBase
6 {
7 	enum _eICYCompanyMode {
8 		CMODE_UNKNOWN=0,
9 		CMODE_PORTAL,
10 		CMODE_ENI,
11 		CMODE_SEC,
12 	};
13 public:
14 	CICYThermostat(const int ID, const std::string &Username, const std::string &Password);
15 	~CICYThermostat(void);
16 	bool WriteToHardware(const char *pdata, const unsigned char length) override;
17 	void SetSetpoint(const int idx, const float temp);
18 private:
19 	void Init();
20 	bool StartHardware() override;
21 	bool StopHardware() override;
22 	void Do_Work();
23 	void GetMeterDetails();
24 	void SendSetPointSensor(const unsigned char Idx, const float Temp, const std::string &defaultname);
25 	bool GetSerialAndToken();
26 private:
27 	std::string m_UserName;
28 	std::string m_Password;
29 	std::string m_SerialNumber;
30 	std::string m_Token;
31 	std::shared_ptr<std::thread> m_thread;
32 	_eICYCompanyMode m_companymode;
33 };
34 
35