LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
driverFactory Class Reference

Creates and shares output drivers for items. More...

#include <item.h>

Public Member Functions

 driverFactory ()
Item * getItem (Item *item)
abstractOut * getDriver (Item *item)
abstractOut * findDriver (Item *item)
void freeDriver (Item *item)
abstractOut * newDriver (uint8_t itemType)

Detailed Description

Creates and shares output drivers for items.

One driver instance is kept per channel type; getDriver() links the driver to the current item (abstractOut::link) and creates it on demand. Items of the same type share the same driver, saving RAM.

Constructor & Destructor Documentation

◆ driverFactory()

driverFactory::driverFactory ( )
inline

Member Function Documentation

◆ findDriver()

abstractOut * driverFactory::findDriver ( Item * item)
Returns
driver for the item's channel type without creating it (RGB types map to CH_DIMMER).

◆ freeDriver()

void driverFactory::freeDriver ( Item * item)

Unlink the item from its driver; delete the driver if no item uses it.

◆ getDriver()

abstractOut * driverFactory::getDriver ( Item * item)
Returns
driver for the item's channel type (created on demand), linked to the item.

◆ getItem()

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

◆ newDriver()

abstractOut * driverFactory::newDriver ( uint8_t itemType)
Returns
a new driver instance for the given channel type, or NULL if unsupported.

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