Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MovingLightResponder.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  * MovingLightResponder.h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
29 #ifndef INCLUDE_OLA_RDM_MOVINGLIGHTRESPONDER_H_
30 #define INCLUDE_OLA_RDM_MOVINGLIGHTRESPONDER_H_
31 
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 <string>
39 
40 namespace ola {
41 namespace rdm {
42 
47  public:
48  explicit MovingLightResponder(const UID &uid);
49 
50  void SendRDMRequest(RDMRequest *request, RDMCallback *callback);
51 
52  uint16_t StartAddress() const { return m_start_address; }
53  uint16_t Footprint() const {
54  return m_personality_manager.ActivePersonalityFootprint();
55  }
56 
57  private:
61  class RDMOps : public ResponderOps<MovingLightResponder> {
62  public:
63  static RDMOps *Instance() {
64  if (!instance)
65  instance = new RDMOps();
66  return instance;
67  }
68 
69  private:
70  RDMOps() : ResponderOps<MovingLightResponder>(PARAM_HANDLERS) {}
71 
72  static RDMOps *instance;
73  };
74 
78  class Personalities : public PersonalityCollection {
79  public:
80  static const Personalities *Instance();
81 
82  private:
83  explicit Personalities(const PersonalityList &personalities) :
84  PersonalityCollection(personalities) {
85  }
86 
87  static Personalities *instance;
88  };
89 
90  const UID m_uid;
91  uint16_t m_start_address;
92  std::string m_language;
93  bool m_identify_mode;
94  bool m_pan_invert;
95  bool m_tilt_invert;
96  uint32_t m_device_hours;
97  uint32_t m_lamp_hours;
98  uint32_t m_lamp_strikes;
99  rdm_lamp_state m_lamp_state;
100  rdm_lamp_mode m_lamp_on_mode;
101  uint32_t m_device_power_cycles;
102  rdm_display_invert m_display_invert;
103  uint8_t m_display_level;
104  bool m_pan_tilt_swap;
105  rdm_power_state m_power_state;
106  std::string m_device_label;
107  PersonalityManager m_personality_manager;
108 
109  RDMResponse *GetParamDescription(const RDMRequest *request);
110  RDMResponse *GetDeviceInfo(const RDMRequest *request);
111  RDMResponse *GetFactoryDefaults(const RDMRequest *request);
112  RDMResponse *SetFactoryDefaults(const RDMRequest *request);
113  RDMResponse *GetLanguageCapabilities(const RDMRequest *request);
114  RDMResponse *GetLanguage(const RDMRequest *request);
115  RDMResponse *SetLanguage(const RDMRequest *request);
116  RDMResponse *GetProductDetailList(const RDMRequest *request);
117  RDMResponse *GetPersonality(const RDMRequest *request);
118  RDMResponse *SetPersonality(const RDMRequest *request);
119  RDMResponse *GetPersonalityDescription(const RDMRequest *request);
120  RDMResponse *GetSlotInfo(const RDMRequest *request);
121  RDMResponse *GetSlotDescription(const RDMRequest *request);
122  RDMResponse *GetSlotDefaultValues(const RDMRequest *request);
123  RDMResponse *GetDmxStartAddress(const RDMRequest *request);
124  RDMResponse *SetDmxStartAddress(const RDMRequest *request);
125  RDMResponse *GetDeviceHours(const RDMRequest *request);
126  RDMResponse *SetDeviceHours(const RDMRequest *request);
127  RDMResponse *GetLampHours(const RDMRequest *request);
128  RDMResponse *SetLampHours(const RDMRequest *request);
129  RDMResponse *GetLampStrikes(const RDMRequest *request);
130  RDMResponse *SetLampStrikes(const RDMRequest *request);
131  RDMResponse *GetLampState(const RDMRequest *request);
132  RDMResponse *SetLampState(const RDMRequest *request);
133  RDMResponse *GetLampOnMode(const RDMRequest *request);
134  RDMResponse *SetLampOnMode(const RDMRequest *request);
135  RDMResponse *GetDevicePowerCycles(const RDMRequest *request);
136  RDMResponse *SetDevicePowerCycles(const RDMRequest *request);
137  RDMResponse *GetIdentify(const RDMRequest *request);
138  RDMResponse *SetIdentify(const RDMRequest *request);
139  RDMResponse *GetDisplayInvert(const RDMRequest *request);
140  RDMResponse *SetDisplayInvert(const RDMRequest *request);
141  RDMResponse *GetDisplayLevel(const RDMRequest *request);
142  RDMResponse *SetDisplayLevel(const RDMRequest *request);
143  RDMResponse *GetPanInvert(const RDMRequest *request);
144  RDMResponse *SetPanInvert(const RDMRequest *request);
145  RDMResponse *GetTiltInvert(const RDMRequest *request);
146  RDMResponse *SetTiltInvert(const RDMRequest *request);
147  RDMResponse *GetPanTiltSwap(const RDMRequest *request);
148  RDMResponse *SetPanTiltSwap(const RDMRequest *request);
149  RDMResponse *GetRealTimeClock(const RDMRequest *request);
150  RDMResponse *SetResetDevice(const RDMRequest *request);
151  RDMResponse *GetPowerState(const RDMRequest *request);
152  RDMResponse *SetPowerState(const RDMRequest *request);
153  RDMResponse *GetManufacturerLabel(const RDMRequest *request);
154  RDMResponse *GetDeviceLabel(const RDMRequest *request);
155  RDMResponse *SetDeviceLabel(const RDMRequest *request);
156  RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
157  RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
158  RDMResponse *GetOlaCodeVersion(const RDMRequest *request);
159 
161  PARAM_HANDLERS[];
162 };
163 } // namespace rdm
164 } // namespace ola
165 #endif // INCLUDE_OLA_RDM_MOVINGLIGHTRESPONDER_H_
Definitions and Interfaces to implement an RDMController that sends a single message at a time...
Definition: ResponderPersonality.h:65
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition: RDMCommand.h:456
Definition: MovingLightResponder.h:46
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition: MovingLightResponder.cpp:248
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition: RDMCommand.h:233
A RDM unique identifier (UID).
A class which dispatches RDM requests to registered PID handlers.
Definition: ResponderOps.h:60
Definition: ResponderPersonality.h:89
The base class for all 1 argument callbacks.
Definition: Callback.h:982
The interface that can send RDMRequest.
Definition: RDMControllerInterface.h:73
A framework for building RDM responders.
Various constants used in RDM.
Represents a RDM UID.
Definition: UID.h:57
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
MovingLightResponder(const UID &uid)
Definition: MovingLightResponder.cpp:224