LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
abstractOut Class Referenceabstract

Base class of output driver modules (one per channel type). More...

#include <abstractout.h>

Inheritance diagram for abstractOut:

Public Member Functions

 abstractOut ()
virtual void link (Item *_item)
virtual int Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false)=0
 Execute a command on the hardware. Pure virtual - driver-specific.
virtual int isActive ()
virtual bool isAllowed (itemCmd cmd)
virtual itemCmd getDefaultOnVal ()
virtual int getChanType ()
virtual int Status () override
virtual void setStatus (uint8_t status) override
int Setup () override
Item * getItem ()
Public Member Functions inherited from abstractCh
 abstractCh ()
virtual ~abstractCh ()
virtual int Poll (short cause)
virtual int Stop ()

Protected Member Functions

int pubAction (bool state)
Protected Member Functions inherited from abstractCh
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)

Protected Attributes

Item * item
 Item currently linked to this driver.

Detailed Description

Base class of output driver modules (one per channel type).

abstractOut is the interface between the item core and a concrete device driver (out_dmx, out_relay, out_Modbus, ...). The driver is created by driverFactory, linked to the current item via link(), controls the hardware in Ctrl() and reports activity via isActive(). Drivers are shared between items of the same channel type, so all state must be derived from the linked item rather than stored per-instance.

Constructor & Destructor Documentation

◆ abstractOut()

abstractOut::abstractOut ( )
inline

Member Function Documentation

◆ Ctrl()

virtual int abstractOut::Ctrl ( itemCmd cmd,
char * subItem = NULL,
bool toExecute = true,
bool authorized = false )
pure virtual

Execute a command on the hardware. Pure virtual - driver-specific.

Parameters
cmd- command and/or value to execute
subItem- subchannel for multi-channel drivers
toExecute- false means bookkeeping only (e.g. channel already inactive)
authorized- true if the caller is authorized

Implemented in colorChannel, out_AC, out_counter, out_Modbus, out_Motor, out_Multivent, out_pid, and out_relay.

◆ getChanType()

virtual int abstractOut::getChanType ( )
inlinevirtual
Returns
the channel type (CH_*) handled by this driver.

Reimplemented in out_AC, out_counter, out_dmx, out_Modbus, out_Motor, out_Multivent, out_pid, out_pwm, out_relay, and out_SPILed.

◆ getDefaultOnVal()

virtual itemCmd abstractOut::getDefaultOnVal ( )
inlinevirtual
Returns
the value used when the channel is turned ON without an explicit value.

◆ getItem()

Item * abstractOut::getItem ( )
inline
Returns
the item currently linked to this driver, or NULL.

◆ isActive()

int abstractOut::isActive ( )
virtual
Returns
channel activity: 1 ON, 0 OFF, <0 unknown (core falls back to stored command).

Reimplemented in out_AC, out_Multivent, and out_pid.

◆ isAllowed()

virtual bool abstractOut::isAllowed ( itemCmd cmd)
inlinevirtual

Veto a command (driver-specific restrictions).

Returns
true if the command is allowed.

◆ link()

virtual void abstractOut::link ( Item * _item)
inlinevirtual

Attach (or detach with NULL) the item this driver currently operates on.

Reimplemented in colorChannel, out_AC, out_Modbus, out_Motor, out_Multivent, out_pid, out_relay, and out_SPILed.

◆ pubAction()

int abstractOut::pubAction ( bool state)
protected

Publish an on/off state change to the MQTT topics of the linked item.

◆ setStatus()

void abstractOut::setStatus ( uint8_t status)
overridevirtual

Set the CST_* status of the driver.

Reimplemented from abstractCh.

◆ Setup()

int abstractOut::Setup ( )
overridevirtual

Driver-level setup wrapper (validates the linked item before Setup of hardware).

Implements abstractCh.

Reimplemented in out_AC, out_counter, out_dmx, out_Modbus, out_Motor, out_Multivent, out_pid, out_pwm, out_relay, and out_SPILed.

◆ Status()

int abstractOut::Status ( )
overridevirtual
Returns
current CST_* status of the driver.

Reimplemented from abstractCh.

Member Data Documentation

◆ item

Item* abstractOut::item
protected

Item currently linked to this driver.


The documentation for this class was generated from the following files: