Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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(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  RDMResponse *GetParamDescription(const RDMRequest *request);
98  RDMResponse *GetDeviceInfo(const RDMRequest *request);
99  RDMResponse *GetFactoryDefaults(const RDMRequest *request);
100  RDMResponse *SetFactoryDefaults(const RDMRequest *request);
101  RDMResponse *GetProductDetailList(const RDMRequest *request);
102  RDMResponse *GetPersonality(const RDMRequest *request);
103  RDMResponse *SetPersonality(const RDMRequest *request);
104  RDMResponse *GetPersonalityDescription(const RDMRequest *request);
105  RDMResponse *GetSlotInfo(const RDMRequest *request);
106  RDMResponse *GetSlotDescription(const RDMRequest *request);
107  RDMResponse *GetSlotDefaultValues(const RDMRequest *request);
108  RDMResponse *GetDmxStartAddress(const RDMRequest *request);
109  RDMResponse *SetDmxStartAddress(const RDMRequest *request);
110  RDMResponse *GetLampStrikes(const RDMRequest *request);
111  RDMResponse *SetLampStrikes(const RDMRequest *request);
112  RDMResponse *GetIdentify(const RDMRequest *request);
113  RDMResponse *SetIdentify(const RDMRequest *request);
114  RDMResponse *GetRealTimeClock(const RDMRequest *request);
115  RDMResponse *GetManufacturerLabel(const RDMRequest *request);
116  RDMResponse *GetDeviceLabel(const RDMRequest *request);
117  RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
118  RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
119  RDMResponse *GetOlaCodeVersion(const RDMRequest *request);
120  RDMResponse *GetSensorDefinition(const RDMRequest *request);
121  RDMResponse *GetSensorValue(const RDMRequest *request);
122  RDMResponse *SetSensorValue(const RDMRequest *request);
123  RDMResponse *RecordSensor(const RDMRequest *request);
124  RDMResponse *GetListInterfaces(const RDMRequest *request);
125  RDMResponse *GetInterfaceLabel(const RDMRequest *request);
126  RDMResponse *GetInterfaceHardwareAddressType1(
127  const RDMRequest *request);
128  RDMResponse *GetIPV4CurrentAddress(const RDMRequest *request);
129  RDMResponse *GetIPV4DefaultRoute(const RDMRequest *request);
130  RDMResponse *GetDNSHostname(const RDMRequest *request);
131  RDMResponse *GetDNSDomainName(const RDMRequest *request);
132  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_
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:457
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition: DummyResponder.cpp:197
Definition: DummyResponder.h:44
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition: RDMCommand.h:234
A RDM unique identifier (UID).
Holds the information about a sensor.
The interface for the NetworkManager.
A class which dispatches RDM requests to registered PID handlers.
Definition: ResponderOps.h:60
Definition: ResponderPersonality.h:90
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