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
28#ifndef INCLUDE_OLA_RDM_ACKTIMERRESPONDER_H_
29#define INCLUDE_OLA_RDM_ACKTIMERRESPONDER_H_
30
31#include <ola/Clock.h>
33#include <ola/rdm/RDMEnums.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
49 public:
50 explicit AckTimerResponder(const UID &uid);
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_
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
Various constants used in RDM.
A framework for building RDM responders.
A RDM unique identifier (UID).
The base class for all 1 argument callbacks.
Definition Callback.h:982
Used to get the current time.
Definition Clock.h:230
Definition AckTimerResponder.h:48
~AckTimerResponder()
Definition AckTimerResponder.cpp:158
AckTimerResponder(const UID &uid)
Definition AckTimerResponder.cpp:148
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition AckTimerResponder.cpp:169
Definition ResponderPersonality.h:65
std::vector< Personality > PersonalityList
Definition ResponderPersonality.h:68
Definition ResponderPersonality.h:91
Definition AckTimerResponder.cpp:103
The interface that can send RDMRequest.
Definition RDMControllerInterface.h:73
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition RDMCommand.h:457
A class which dispatches RDM requests to registered PID handlers.
Definition ResponderOps.h:60
Represents a RDM UID.
Definition UID.h:57
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
the structure that defines the behaviour for a specific PID.o
Definition ResponderOps.h:76