Open Lighting Architecture: include/ola/rdm/ResponderOps.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
ResponderOps.h
Go to the documentation of this file.
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * ResponderOps.h
17 * A framework for building RDM responders.
18 * Copyright (C) 2013 Simon Newton
19 */
20
28
29#ifndef INCLUDE_OLA_RDM_RESPONDEROPS_H_
30#define INCLUDE_OLA_RDM_RESPONDEROPS_H_
31
32#include <ola/rdm/RDMCommand.h>
33#include <ola/rdm/RDMControllerInterface.h>
34#include <ola/rdm/RDMResponseCodes.h>
35
36#include <map>
37
38namespace ola {
39namespace rdm {
40
59template <class Target>
60 class ResponderOps {
61 public:
68 typedef RDMResponse *(Target::*RDMHandler)(const RDMRequest *request);
69
76 struct ParamHandler {
77 uint16_t pid;
78 RDMHandler get_handler;
79 RDMHandler set_handler;
80 };
81
90 explicit ResponderOps(const ParamHandler param_handlers[],
91 bool include_required_pids = false);
92
101 void HandleRDMRequest(Target *target,
102 const UID &target_uid,
103 uint16_t sub_device,
104 const RDMRequest *request,
105 RDMCallback *on_complete);
106
107 private:
108 struct InternalParamHandler {
109 RDMHandler get_handler;
110 RDMHandler set_handler;
111 };
112 typedef std::map<uint16_t, InternalParamHandler> RDMHandlers;
113
114 bool m_include_required_pids;
115 RDMHandlers m_handlers;
116
117 RDMResponse *HandleSupportedParams(const RDMRequest *request);
118};
119
120} // namespace rdm
121} // namespace ola
122#include <ola/rdm/ResponderOpsPrivate.h> // NOLINT(build/include_order)
123#endif // INCLUDE_OLA_RDM_RESPONDEROPS_H_
RDMCommand.h
Classes that represent RDM commands.
RDMControllerInterface.h
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
RDMResponseCodes.h
Enums representing the states of a response. This is generated from the proto file.
ResponderOpsPrivate.h
Private helper functions for building RDM responders.
ola::rdm::RDMRequest
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
ola::rdm::RDMResponse
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition RDMCommand.h:457
ola::rdm::ResponderOps::ResponderOps
ResponderOps(const ParamHandler param_handlers[], bool include_required_pids=false)
Construct a new ResponderOps object.
Definition ResponderOpsPrivate.h:49
ola::rdm::ResponderOps::HandleRDMRequest
void HandleRDMRequest(Target *target, const UID &target_uid, uint16_t sub_device, const RDMRequest *request, RDMCallback *on_complete)
Handle a RDMRequest.
Definition ResponderOpsPrivate.h:68
ola::rdm::ResponderOps::RDMHandler
RDMResponse *(Target::* RDMHandler)(const RDMRequest *request)
The member function to call on the target to handle a request.
Definition ResponderOps.h:68
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola::rdm::RDMCallback
ola::BaseCallback1< void, RDMReply * > RDMCallback
The callback run when a RDM request completes.
Definition RDMControllerInterface.h:52
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::rdm::ResponderOps::ParamHandler
the structure that defines the behaviour for a specific PID.o
Definition ResponderOps.h:76
ola::rdm::ResponderOps::ParamHandler::pid
uint16_t pid
Definition ResponderOps.h:77
ola::rdm::ResponderOps::ParamHandler::get_handler
RDMHandler get_handler
Definition ResponderOps.h:78
ola::rdm::ResponderOps::ParamHandler::set_handler
RDMHandler set_handler
Definition ResponderOps.h:79