|
LightHub 4.6.0
Open-source smart home controller firmware
|
Base class of all abstract channels (input and output drivers). More...
#include <abstractch.h>
Public Member Functions | |
| abstractCh () | |
| virtual | ~abstractCh () |
| virtual int | Poll (short cause) |
| virtual int | Setup ()=0 |
| virtual int | Stop () |
| virtual int | Status () |
| virtual void | setStatus (uint8_t status) |
Protected Member Functions | |
| int | publishTopic (const char *topic, long value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, float value, const char *subtopic=NULL) |
| int | publishTopic (const char *topic, const char *value, const char *subtopic=NULL, const char *suffix=NULL) |
Base class of all abstract channels (input and output drivers).
abstractCh defines the lifecycle contract of a driver module: Setup() initializes the hardware and reserves resources, Poll() is called periodically with a cause (POLLING_SLOW/POLLING_FAST/...), Status()/setStatus() track the initialization state (CST_*) and Stop() releases the resources. The class also provides protected publishTopic() helpers that publish a value to a fixed MQTT topic as a retained message.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Periodic poll hook.
| cause | - POLLING_SLOW/POLLING_FAST/POLLING_INT/POLLING_1S |
Reimplemented in in_ccs811, in_hdc1080, out_AC, out_counter, out_Modbus, out_Motor, out_Multivent, out_pid, and out_relay.
|
protected |
Publish a string value to a topic as a retained MQTT message.
|
protected |
Publish a float value to a topic as a retained MQTT message.
|
protected |
Publish an integer value to a topic as a retained MQTT message.
| topic | - full topic or a name to be prefixed with the T_OUT topic |
| subtopic | - optional subtopic/suffix appended to the topic |
|
inlinevirtual |
Set the CST_* status of the channel.
Reimplemented in abstractOut.
|
pure virtual |
Initialize hardware and reserve resources.
Implemented in abstractOut, in_ccs811, in_hdc1080, out_AC, out_counter, out_dmx, out_Modbus, out_Motor, out_Multivent, out_pid, out_pwm, out_relay, and out_SPILed.
|
inlinevirtual |
Reimplemented in abstractOut.
|
inlinevirtual |
Free resources allocated in Setup().
Reimplemented in out_AC, out_counter, out_dmx, out_Modbus, out_Motor, out_Multivent, out_pid, out_pwm, out_relay, and out_SPILed.