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

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
AckTimerResponder.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 * AckTimerResponder.h
17 * Copyright (C) 2013 Simon Newton
18 */
19
27
28#ifndef INCLUDE_OLA_RDM_ACKTIMERRESPONDER_H_
29#define INCLUDE_OLA_RDM_ACKTIMERRESPONDER_H_
30
31#include <ola/Clock.h>
32#include <ola/rdm/RDMControllerInterface.h>
33#include <ola/rdm/RDMEnums.h>
34#include <ola/rdm/ResponderOps.h>
35#include <ola/rdm/ResponderPersonality.h>
36#include <ola/rdm/UID.h>
37
38#include <queue>
39#include <string>
40#include <vector>
41
42namespace ola {
43namespace rdm {
44
48 class AckTimerResponder: public RDMControllerInterface {
49 public:
50 explicit AckTimerResponder(const UID &uid);
51 ~AckTimerResponder();
52
53 void SendRDMRequest(RDMRequest *request, RDMCallback *callback);
54
55 private:
59 class RDMOps : public ResponderOps<AckTimerResponder> {
60 public:
61 static RDMOps *Instance() {
62 if (!instance)
63 instance = new RDMOps();
64 return instance;
65 }
66
67 private:
68 RDMOps() : ResponderOps<AckTimerResponder>(PARAM_HANDLERS) {}
69
70 static RDMOps *instance;
71 };
72
76 class Personalities : public PersonalityCollection {
77 public:
78 static const Personalities *Instance();
79
80 private:
81 explicit Personalities(const PersonalityList &personalities) :
82 PersonalityCollection(personalities) {
83 }
84
85 static Personalities *instance;
86 };
87
88 // The actual queue of messages to be collected.
89 typedef std::queue<class QueuedResponse*> ResponseQueue;
90
91 // The list of responses which aren't available yet. When they become
92 // valid they are moved to the ResponseQueue,
93 typedef std::vector<class QueuedResponse*> PendingResponses;
94
95 const UID m_uid;
96 uint16_t m_start_address;
97 bool m_identify_mode;
98 PersonalityManager m_personality_manager;
99
100 ResponseQueue m_queued_messages;
101 PendingResponses m_upcoming_queued_messages;
102 std::auto_ptr<class QueuedResponse> m_last_queued_message;
103 ola::Clock m_clock;
104
105 uint16_t Footprint() const {
106 return m_personality_manager.ActivePersonalityFootprint();
107 }
108
109 uint8_t QueuedMessageCount() const;
110 void QueueAnyNewMessages();
111
112 RDMResponse *ResponseFromQueuedMessage(
113 const RDMRequest *request,
114 const class QueuedResponse *queued_response);
115 RDMResponse *EmptyStatusMessage(const RDMRequest *request);
116 RDMResponse *GetQueuedMessage(const RDMRequest *request);
117 RDMResponse *GetDeviceInfo(const RDMRequest *request);
118 RDMResponse *GetPersonality(const RDMRequest *request);
119 RDMResponse *SetPersonality(const RDMRequest *request);
120 RDMResponse *GetPersonalityDescription(const RDMRequest *request);
121 RDMResponse *GetDmxStartAddress(const RDMRequest *request);
122 RDMResponse *SetDmxStartAddress(const RDMRequest *request);
123 RDMResponse *GetIdentify(const RDMRequest *request);
124 RDMResponse *SetIdentify(const RDMRequest *request);
125 RDMResponse *GetManufacturerLabel(const RDMRequest *request);
126 RDMResponse *GetDeviceLabel(const RDMRequest *request);
127 RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
128 RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
129
130 static const ResponderOps<AckTimerResponder>::ParamHandler PARAM_HANDLERS[];
131 static const uint16_t ACK_TIMER_MS;
132};
133} // namespace rdm
134} // namespace ola
135#endif // INCLUDE_OLA_RDM_ACKTIMERRESPONDER_H_
RDMControllerInterface.h
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
RDMEnums.h
Various constants used in RDM.
ResponderOps.h
A framework for building RDM responders.
UID.h
A RDM unique identifier (UID).
ola::Clock
Used to get the current time.
Definition Clock.h:230
ola::rdm::AckTimerResponder::~AckTimerResponder
~AckTimerResponder()
Definition AckTimerResponder.cpp:158
ola::rdm::AckTimerResponder::AckTimerResponder
AckTimerResponder(const UID &uid)
Definition AckTimerResponder.cpp:148
ola::rdm::AckTimerResponder::SendRDMRequest
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition AckTimerResponder.cpp:169
ola::rdm::PersonalityCollection
Definition ResponderPersonality.h:65
ola::rdm::PersonalityCollection::PersonalityCollection
PersonalityCollection(const PersonalityList &personalities)
Definition ResponderPersonality.cpp:55
ola::rdm::PersonalityCollection::PersonalityList
std::vector< Personality > PersonalityList
Definition ResponderPersonality.h:68
ola::rdm::PersonalityManager
Definition ResponderPersonality.h:91
ola::rdm::QueuedResponse
Definition AckTimerResponder.cpp:103
ola::rdm::RDMControllerInterface
The interface that can send RDMRequest.
Definition RDMControllerInterface.h:73
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
A class which dispatches RDM requests to registered PID handlers.
Definition ResponderOps.h:60
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