Open Lighting Architecture  0.9.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DummyResponder.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  * DummyResponder.h
17  * Copyright (C) 2009 Simon Newton
18  */
19 
27 #ifndef INCLUDE_OLA_RDM_DUMMYRESPONDER_H_
28 #define INCLUDE_OLA_RDM_DUMMYRESPONDER_H_
29 
32 #include <ola/rdm/RDMEnums.h>
33 #include <ola/rdm/ResponderOps.h>
34 #include <ola/rdm/ResponderPersonality.h>
36 #include <ola/rdm/UID.h>
37 
38 #include <memory>
39 #include <string>
40 
41 namespace ola {
42 namespace rdm {
43 
45  public:
46  explicit DummyResponder(const UID &uid);
47  ~DummyResponder();
48 
49  void SendRDMRequest(const RDMRequest *request, RDMCallback *callback);
50 
51  uint16_t StartAddress() const { return m_start_address; }
52  uint16_t Footprint() const {
53  return m_personality_manager.ActivePersonalityFootprint();
54  }
55 
56  private:
60  class RDMOps : public ResponderOps<DummyResponder> {
61  public:
62  static RDMOps *Instance() {
63  if (!instance)
64  instance = new RDMOps();
65  return instance;
66  }
67 
68  private:
69  RDMOps() : ResponderOps<DummyResponder>(PARAM_HANDLERS) {}
70 
71  static RDMOps *instance;
72  };
73 
77  class Personalities : public PersonalityCollection {
78  public:
79  static const Personalities *Instance();
80 
81  private:
82  explicit Personalities(const PersonalityList &personalities) :
83  PersonalityCollection(personalities) {
84  }
85 
86  static Personalities *instance;
87  };
88 
89  const UID m_uid;
90  uint16_t m_start_address;
91  bool m_identify_mode;
92  uint32_t m_lamp_strikes;
93  PersonalityManager m_personality_manager;
94  Sensors m_sensors;
95  std::auto_ptr<NetworkManagerInterface> m_network_manager;
96 
97  const RDMResponse *GetParamDescription(const RDMRequest *request);
98  const RDMResponse *GetDeviceInfo(const RDMRequest *request);
99  const RDMResponse *GetFactoryDefaults(const RDMRequest *request);
100  const RDMResponse *SetFactoryDefaults(const RDMRequest *request);
101  const RDMResponse *GetProductDetailList(const RDMRequest *request);
102  const RDMResponse *GetPersonality(const RDMRequest *request);
103  const RDMResponse *SetPersonality(const RDMRequest *request);
104  const RDMResponse *GetPersonalityDescription(const RDMRequest *request);
105  const RDMResponse *GetSlotInfo(const RDMRequest *request);
106  const RDMResponse *GetSlotDescription(const RDMRequest *request);
107  const RDMResponse *GetSlotDefaultValues(const RDMRequest *request);
108  const RDMResponse *GetDmxStartAddress(const RDMRequest *request);
109  const RDMResponse *SetDmxStartAddress(const RDMRequest *request);
110  const RDMResponse *GetLampStrikes(const RDMRequest *request);
111  const RDMResponse *SetLampStrikes(const RDMRequest *request);
112  const RDMResponse *GetIdentify(const RDMRequest *request);
113  const RDMResponse *SetIdentify(const RDMRequest *request);
114  const RDMResponse *GetRealTimeClock(const RDMRequest *request);
115  const RDMResponse *GetManufacturerLabel(const RDMRequest *request);
116  const RDMResponse *GetDeviceLabel(const RDMRequest *request);
117  const RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
118  const RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
119  const RDMResponse *GetOlaCodeVersion(const RDMRequest *request);
120  const RDMResponse *GetSensorDefinition(const RDMRequest *request);
121  const RDMResponse *GetSensorValue(const RDMRequest *request);
122  const RDMResponse *SetSensorValue(const RDMRequest *request);
123  const RDMResponse *RecordSensor(const RDMRequest *request);
124  const RDMResponse *GetListInterfaces(const RDMRequest *request);
125  const RDMResponse *GetInterfaceLabel(const RDMRequest *request);
126  const RDMResponse *GetInterfaceHardwareAddressType1(
127  const RDMRequest *request);
128  const RDMResponse *GetIPV4CurrentAddress(const RDMRequest *request);
129  const RDMResponse *GetIPV4DefaultRoute(const RDMRequest *request);
130  const RDMResponse *GetDNSHostname(const RDMRequest *request);
131  const RDMResponse *GetDNSDomainName(const RDMRequest *request);
132  const RDMResponse *GetDNSNameServer(const RDMRequest *request);
133 
134  static const ResponderOps<DummyResponder>::ParamHandler PARAM_HANDLERS[];
135  static const uint8_t DEFAULT_PERSONALITY = 2;
136 };
137 } // namespace rdm
138 } // namespace ola
139 #endif // INCLUDE_OLA_RDM_DUMMYRESPONDER_H_