Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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(const 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  const RDMResponse *GetParamDescription(const RDMRequest *request);
110  const RDMResponse *GetDeviceInfo(const RDMRequest *request);
111  const RDMResponse *GetFactoryDefaults(const RDMRequest *request);
112  const RDMResponse *SetFactoryDefaults(const RDMRequest *request);
113  const RDMResponse *GetLanguageCapabilities(const RDMRequest *request);
114  const RDMResponse *GetLanguage(const RDMRequest *request);
115  const RDMResponse *SetLanguage(const RDMRequest *request);
116  const RDMResponse *GetProductDetailList(const RDMRequest *request);
117  const RDMResponse *GetPersonality(const RDMRequest *request);
118  const RDMResponse *SetPersonality(const RDMRequest *request);
119  const RDMResponse *GetPersonalityDescription(const RDMRequest *request);
120  const RDMResponse *GetSlotInfo(const RDMRequest *request);
121  const RDMResponse *GetSlotDescription(const RDMRequest *request);
122  const RDMResponse *GetSlotDefaultValues(const RDMRequest *request);
123  const RDMResponse *GetDmxStartAddress(const RDMRequest *request);
124  const RDMResponse *SetDmxStartAddress(const RDMRequest *request);
125  const RDMResponse *GetDeviceHours(const RDMRequest *request);
126  const RDMResponse *SetDeviceHours(const RDMRequest *request);
127  const RDMResponse *GetLampHours(const RDMRequest *request);
128  const RDMResponse *SetLampHours(const RDMRequest *request);
129  const RDMResponse *GetLampStrikes(const RDMRequest *request);
130  const RDMResponse *SetLampStrikes(const RDMRequest *request);
131  const RDMResponse *GetLampState(const RDMRequest *request);
132  const RDMResponse *SetLampState(const RDMRequest *request);
133  const RDMResponse *GetLampOnMode(const RDMRequest *request);
134  const RDMResponse *SetLampOnMode(const RDMRequest *request);
135  const RDMResponse *GetDevicePowerCycles(const RDMRequest *request);
136  const RDMResponse *SetDevicePowerCycles(const RDMRequest *request);
137  const RDMResponse *GetIdentify(const RDMRequest *request);
138  const RDMResponse *SetIdentify(const RDMRequest *request);
139  const RDMResponse *GetDisplayInvert(const RDMRequest *request);
140  const RDMResponse *SetDisplayInvert(const RDMRequest *request);
141  const RDMResponse *GetDisplayLevel(const RDMRequest *request);
142  const RDMResponse *SetDisplayLevel(const RDMRequest *request);
143  const RDMResponse *GetPanInvert(const RDMRequest *request);
144  const RDMResponse *SetPanInvert(const RDMRequest *request);
145  const RDMResponse *GetTiltInvert(const RDMRequest *request);
146  const RDMResponse *SetTiltInvert(const RDMRequest *request);
147  const RDMResponse *GetPanTiltSwap(const RDMRequest *request);
148  const RDMResponse *SetPanTiltSwap(const RDMRequest *request);
149  const RDMResponse *GetRealTimeClock(const RDMRequest *request);
150  const RDMResponse *SetResetDevice(const RDMRequest *request);
151  const RDMResponse *GetPowerState(const RDMRequest *request);
152  const RDMResponse *SetPowerState(const RDMRequest *request);
153  const RDMResponse *GetManufacturerLabel(const RDMRequest *request);
154  const RDMResponse *GetDeviceLabel(const RDMRequest *request);
155  const RDMResponse *SetDeviceLabel(const RDMRequest *request);
156  const RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
157  const RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
158  const RDMResponse *GetOlaCodeVersion(const RDMRequest *request);
159 
161  PARAM_HANDLERS[];
162 };
163 } // namespace rdm
164 } // namespace ola
165 #endif // INCLUDE_OLA_RDM_MOVINGLIGHTRESPONDER_H_