// // Created by xin on 25-4-2. // #ifndef TEMPERATUREREGULATOR_H #define TEMPERATUREREGULATOR_H #include "TG_Manager.h" #include "TemperaTureWoker.h" #include "QObject" #include "vector" #define INSIGHT_TEMPERATURE 0 #define OUTSIGHT_TEMPERATURE 1 /* * "PortName": "ttyS2", "BaudRate": 115200, "Pin": { "TG": { "Pin_H": 2, "Pin_L": 3 }, "Fan": { "Pin": 10 }, "HOT": { "Pin": 7 } }, "Constant_Temperature": { "CoolBegin_Temp_Insight": 20, "CoolBegin_Diff_Temp": 5, "HeatingBegin_Temp_Insight": 0, "IsCoolInDaylight": false }, "Location": { "latitude": 0, "longitude": 0 }, "IndexInfo": { "Insight": [{"x":7,"y":1},{"x":8,"y":1}], "Outside": [{"x":1,"y":1},{"x":2,"y":1}] } **/ struct indexofdata { int x; int y; }; class TemperatureRegulator :public QObject { Q_OBJECT public: TemperatureRegulator(); void setconfig(json j); void SetTartGetX_Y(int x,int y); void addTargetIndex(int x,int y,int Data_type=INSIGHT_TEMPERATURE); float GetMax_of_Vector(int Data_type=INSIGHT_TEMPERATURE); float GetMin_of_Vector(int Data_type=INSIGHT_TEMPERATURE); void init(); void loop(); static bool looptask(); void PanduanCooling(); private: TemperaTureWoker *m_TemperaTureWoker; TG_Manager *m_TG_Manager; float M_Targert_Max_Tempreature=35; float M_Targert_Min_Tempreature=25; float m_CoolBegin_Temp_Insight=20; float m_CoolBegin_Diff_Temp=5; float m_HeatingBegin_Temp_Insight=0; bool m_IsCoolInDaylight=false; int m_target_index=0; std::vector m_target_index_of_insight; std::vector m_target_index_of_outsight; int m_target_indey=0; bool isinit=false; float m_Latitude=39.9; float m_Longitude=116.4; }; #endif //TEMPERATUREREGULATOR_H