A Controller is responsible for serialising requests for a physical bus.
More...
#include <Controller.h>
A Controller is responsible for serialising requests for a physical bus.
◆ List
◆ Controller()
IO::Controller::Controller |
( |
uint8_t |
instance | ) |
|
|
inline |
Construct a controller instance.
- Parameters
-
instance | Instance number, must be unique for each class of controller |
◆ ~Controller()
virtual IO::Controller::~Controller |
( |
| ) |
|
|
inlinevirtual |
◆ canStop()
virtual bool IO::Controller::canStop |
( |
| ) |
const |
|
inlinevirtual |
Check if it's OK to stop this controller.
◆ checkDevices()
void IO::Controller::checkDevices |
( |
| ) |
|
|
protected |
◆ classname()
virtual const FlashString& IO::Controller::classname |
( |
| ) |
const |
|
pure virtual |
◆ createDevice() [1/2]
template<class DeviceClass >
ErrorCode IO::Controller::createDevice |
( |
const char * |
id, |
|
|
const typename DeviceClass::Config & |
config, |
|
|
DeviceClass *& |
device |
|
) |
| |
Create a new device as a concrete type.
- Parameters
-
id | Unique identifier for the device |
config | Device configuration |
device | (OUT) The constructed device, owned by this controller |
- Return values
-
ErrorCode | This method template is used to manually constructing device instances. |
◆ createDevice() [2/2]
ErrorCode IO::Controller::createDevice |
( |
const char * |
id, |
|
|
JsonObjectConst |
config, |
|
|
Device *& |
device |
|
) |
| |
Create a new devicce.
- Parameters
-
id | Unique identifier for the device |
config | Device configuration |
device | (OUT) The constructed device |
- Return values
-
- Note
- Created devices are owned by this controller. DO NOT delete them manually!
◆ findDevice()
Locate a device from its identifier.
◆ freeDevices()
void IO::Controller::freeDevices |
( |
| ) |
|
Destroy all devices for this controller.
◆ getDevices()
Get list of devices for this controller.
◆ getId()
const CString& IO::Controller::getId |
( |
| ) |
const |
|
inline |
Get the fully-qualified unique controller identifier.
◆ getInstance()
uint8_t IO::Controller::getInstance |
( |
| ) |
const |
|
inline |
Get the controller instance number.
◆ handleEvent()
virtual void IO::Controller::handleEvent |
( |
Request * |
request, |
|
|
Event |
event |
|
) |
| |
|
protectedvirtual |
◆ operator==()
bool IO::Controller::operator== |
( |
const String & |
id | ) |
const |
|
inline |
◆ registerDeviceClass()
static void IO::Controller::registerDeviceClass |
( |
const Device::Factory & |
factory | ) |
|
|
inlinestatic |
Register a device factory.
Each factory has a class name which allows the device manager to dynamically construct Device instances as directed by configuration.
◆ resetTransactionTime()
void IO::Controller::resetTransactionTime |
( |
| ) |
|
|
inlineprotected |
◆ start()
virtual void IO::Controller::start |
( |
| ) |
|
|
inlinevirtual |
Start the controller.
Controllers may now initiate communications with registered devices. Typically they'll query device status, etc.
Reimplemented in IO::RS485::Controller.
◆ stop()
virtual void IO::Controller::stop |
( |
| ) |
|
|
inlinevirtual |
Stop all controllers.
This method is called by the Device Manager, applications shouldn't need it.
- Note
- MUST call canStop() first to ensure it's safe to stop!
Reimplemented in IO::RS485::Controller.
◆ submit()
void IO::Controller::submit |
( |
Request * |
request | ) |
|
|
protected |
Queue a request.
The request is started immediately if the queue is empty.
◆ Device
◆ DeviceManager
The documentation for this class was generated from the following file: