|
Last change
on this file since 14 was
12,
checked in by markus, 7 years ago
|
|
Update: OT_Data conversion
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #ifndef _OT_SLAVE_H |
|---|
| 2 | #define _OT_SLAVE_H |
|---|
| 3 | |
|---|
| 4 | #include "Arduino.h" |
|---|
| 5 | #include <opentherm.h> |
|---|
| 6 | |
|---|
| 7 | struct OT_Action { |
|---|
| 8 | |
|---|
| 9 | OpenthermData request; |
|---|
| 10 | OpenthermData response; |
|---|
| 11 | |
|---|
| 12 | uint32_t GetRequestValue () const { return OTD2uint32(request); } |
|---|
| 13 | uint32_t GetResponseValue () const { return OTD2uint32(response); } |
|---|
| 14 | |
|---|
| 15 | static uint32_t OTD2uint32 (const OpenthermData&); |
|---|
| 16 | }; |
|---|
| 17 | |
|---|
| 18 | typedef void (*OT_Action_CB)(const OT_Action&); |
|---|
| 19 | |
|---|
| 20 | class OT_Slave { |
|---|
| 21 | |
|---|
| 22 | protected: |
|---|
| 23 | static OT_Action action; |
|---|
| 24 | OT_Action_CB cbAction; |
|---|
| 25 | bool chEnable; // ch : Central Heating |
|---|
| 26 | bool chActive; |
|---|
| 27 | float chTemperature; |
|---|
| 28 | bool dhwEnable; // dhw : Domain Hot Water |
|---|
| 29 | bool dhwActive; |
|---|
| 30 | float dhwTemperature; |
|---|
| 31 | |
|---|
| 32 | public: |
|---|
| 33 | OT_Slave (); |
|---|
| 34 | |
|---|
| 35 | virtual void begin (OT_Action_CB cbAction = 0); |
|---|
| 36 | virtual void maintain (); |
|---|
| 37 | |
|---|
| 38 | virtual void HandleRequest (OT_Action& action); |
|---|
| 39 | virtual void ConfigReq (OT_Action& action); |
|---|
| 40 | virtual void StatusReq (OT_Action& action); |
|---|
| 41 | virtual void FaultReq (OT_Action& action); |
|---|
| 42 | |
|---|
| 43 | virtual bool CH_Enable (bool enable = true); |
|---|
| 44 | virtual bool CH_Disable (); |
|---|
| 45 | virtual void CH_Temperature (float); |
|---|
| 46 | virtual bool DHW_Enable (bool enable = true); |
|---|
| 47 | virtual bool DHW_Disable (); |
|---|
| 48 | virtual void DHW_Temperature (float); |
|---|
| 49 | |
|---|
| 50 | private: |
|---|
| 51 | static void ListenAfterResponse (); |
|---|
| 52 | |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | #endif // _OT_SLAVE_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.