#ifndef _OT_SLAVE_H #define _OT_SLAVE_H #include "Arduino.h" #include struct OT_Action { OpenthermData request; OpenthermData response; uint32_t GetRequestValue () const { return OTD2uint32(request); } uint32_t GetResponseValue () const { return OTD2uint32(response); } static uint32_t OTD2uint32 (const OpenthermData&); }; typedef void (*OT_Action_CB)(const OT_Action&); class OT_Slave { protected: static OT_Action action; OT_Action_CB cbAction; bool chEnable; // ch : Central Heating bool chActive; float chTemperature; bool dhwEnable; // dhw : Domain Hot Water bool dhwActive; float dhwTemperature; public: OT_Slave (); virtual void begin (OT_Action_CB cbAction = 0); virtual void maintain (); virtual void HandleRequest (OT_Action& action); virtual void ConfigReq (OT_Action& action); virtual void StatusReq (OT_Action& action); virtual void FaultReq (OT_Action& action); virtual bool CH_Enable (bool enable = true); virtual bool CH_Disable (); virtual void CH_Temperature (float); virtual bool DHW_Enable (bool enable = true); virtual bool DHW_Disable (); virtual void DHW_Temperature (float); private: static void ListenAfterResponse (); }; #endif // _OT_SLAVE_H