The handler for RDM requests.
The RDM Handler manages dispatching the RDM requests to the correct model. This allows the physical device to simulate different types of RDM devices from LED drivers and moving lights to sensor-only devices and fog machines.
Only a single model can be active at once, the PID_DEVICE_MODEL parameter can be used to change models at run time. Note that PID_DEVICE_MODEL and PID_DEVICE_MODEL_LIST aren't included in SUPPORTED_PARAMETERS so they are 'hidden' PIDs.
typedef void(* RDMHandlerSendCallback)(bool include_break, const IOVec *data, unsigned int iov_count) |
The callback used to send RDM responses.
- Parameters
-
include_break | true if a break should be used for the response |
data | the raw data to send in the response |
iov_count | the number of IOVec that make up the response |
uint16_t RDMHandler_ActiveModel |
( |
| ) |
|
Get the active model id.
- Returns
- the active model id.
bool RDMHandler_AddModel |
( |
const ModelEntry * |
entry | ) |
|
Add a model to the list of available models.
model_entry The ModelEntry to add.
- Returns
- true if the model was added, false if there weren't enough slots or the model already existed.
This should be called after to RDMHandler_Initialize().
void RDMHandler_GetUID |
( |
uint8_t * |
uid | ) |
|
Get the UID of the responder.
- Parameters
-
[out] | uid | A pointer to copy the UID to; should be at least UID_LENGTH. |
If no model is active, the UID will be 0000:00000000.
void RDMHandler_HandleRequest |
( |
const RDMHeader * |
header, |
|
|
const uint8_t * |
param_data |
|
) |
| |
Handle a RDM Request.
- Precondition
- Sub-Start-Code is SUB_START_CODE.
-
message_length is valid.
-
The checksum of the command is correct
- Parameters
-
header | The RDM command header. |
param_data | the parameter data |
Initialize the RDM Handler sub-system.
- Parameters
-
settings | The settings for the handler. |
bool RDMHandler_SetActiveModel |
( |
uint16_t |
model_id | ) |
|
Change the active model of responder.
- Parameters
-
model_id | the new model to use. |
- Returns
- true if the new model was set, false if the new model doesn't exist.
void RDMHandler_Tasks |
( |
| ) |
|
Perform the periodic RDM Handler tasks.
This should be called in the main event loop, it delegates to calling the tasks_fn on the active model.