Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | List of all members
ola::rdm::ResponderOps< Target > Class Template Reference

Detailed Description

template<class Target>
class ola::rdm::ResponderOps< Target >

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.

Template Parameters
Targetthe 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. More...
 

Public Member Functions

 ResponderOps (const ParamHandler param_handlers[], bool include_required_pids=false)
 Construct a new ResponderOps object. More...
 
void HandleRDMRequest (Target *target, const UID &target_uid, uint16_t sub_device, const RDMRequest *request, RDMCallback *on_complete)
 Handle a RDMRequest. More...
 

Member Typedef Documentation

template<class Target>
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.

Constructor & Destructor Documentation

template<class Target >
ola::rdm::ResponderOps< Target >::ResponderOps ( const ParamHandler  param_handlers[],
bool  include_required_pids = false 
)
explicit

Construct a new ResponderOps object.

Parameters
param_handlersan array of ParamHandlers. Must be terminated with {0, NULL, NULL}
include_required_pidsif 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.

Member Function Documentation

template<class Target>
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.

Parameters
targetthe target object to invoke the registered handler on
target_uidthe UID of the target
sub_devicethe sub_device of the target
requestthe RDM request object
on_completethe callback to run when the request completes.

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