![]() |
Open Lighting Architecture 0.10.9
|
A class which dispatches RDM requests to registered PID handlers.
ResponderOps is a stateless RDM request dispatcher. The constructor takes a list of parameter handlers in the form of pointers to member functions. When HandleRDMRequest is called, it invokes the registered handler after performing a common set of checks. If no handler is found, a response containing NR_UNKNOWN_PID is returned.
The stateless nature of ResponderOps means a single ResponderOps object can handle requests for all responders of the same type. This conserves memory when large numbers of responders are active.
ResponderOps handles SUPPORTED_PARAMETERS internally, however this can be overridden by registering a handler for SUPPORTED_PARAMETERS.
| Target | the object to invoke the PID handlers on. |
Classes | |
| struct | ParamHandler |
| the structure that defines the behaviour for a specific PID.o More... | |
Public Types | |
| typedef RDMResponse *(Target::* | RDMHandler) (const RDMRequest *request) |
| The member function to call on the target to handle a request. | |
Public Member Functions | |
| ResponderOps (const ParamHandler param_handlers[], bool include_required_pids=false) | |
| Construct a new ResponderOps object. | |
| void | HandleRDMRequest (Target *target, const UID &target_uid, uint16_t sub_device, const RDMRequest *request, RDMCallback *on_complete) |
| Handle a RDMRequest. | |
| typedef RDMResponse *(Target::* ola::rdm::ResponderOps< Target >::RDMHandler) (const RDMRequest *request) |
The member function to call on the target to handle a request.
The member function should return a RDMResponse object. If the request was broadcast, this object will be discarded.
|
explicit |
Construct a new ResponderOps object.
| param_handlers | an array of ParamHandlers. Must be terminated with {0, NULL, NULL} |
| include_required_pids | if true, the internal SUPPORTED_PARAMETERS handler includes those PIDs that are marked a required in E1.20. This is required for sub-devices, see Section 2 of E1.37. |
| void ola::rdm::ResponderOps< Target >::HandleRDMRequest | ( | Target * | target, |
| const UID & | target_uid, | ||
| uint16_t | sub_device, | ||
| const RDMRequest * | request, | ||
| RDMCallback * | on_complete ) |
Handle a RDMRequest.
| target | the target object to invoke the registered handler on |
| target_uid | the UID of the target |
| sub_device | the sub_device of the target |
| request | the RDM request object |
| on_complete | the callback to run when the request completes. |