Open Lighting Architecture
 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 
30 #include <string>
32 #include "ola/rdm/RDMEnums.h"
33 #include "ola/rdm/ResponderOps.h"
34 #include "ola/rdm/ResponderPersonality.h"
35 #include "ola/rdm/UID.h"
36 
37 namespace ola {
38 namespace rdm {
39 
41  public:
42  explicit DummyResponder(const UID &uid);
43 
44  void SendRDMRequest(const RDMRequest *request, RDMCallback *callback);
45 
46  uint16_t StartAddress() const { return m_start_address; }
47  uint16_t Footprint() const {
48  return m_personality_manager.ActivePersonalityFootprint();
49  }
50 
51  private:
55  class RDMOps : public ResponderOps<DummyResponder> {
56  public:
57  static RDMOps *Instance() {
58  if (!instance)
59  instance = new RDMOps();
60  return instance;
61  }
62 
63  private:
64  RDMOps() : ResponderOps<DummyResponder>(PARAM_HANDLERS) {}
65 
66  static RDMOps *instance;
67  };
68 
72  class Personalities : public PersonalityCollection {
73  public:
74  static const Personalities *Instance();
75 
76  private:
77  explicit Personalities(const PersonalityList &personalities) :
78  PersonalityCollection(personalities) {
79  }
80 
81  static Personalities *instance;
82  };
83 
84  const UID m_uid;
85  uint16_t m_start_address;
86  bool m_identify_mode;
87  uint32_t m_lamp_strikes;
88  PersonalityManager m_personality_manager;
89 
90  const RDMResponse *GetParamDescription(const RDMRequest *request);
91  const RDMResponse *GetDeviceInfo(const RDMRequest *request);
92  const RDMResponse *GetFactoryDefaults(const RDMRequest *request);
93  const RDMResponse *SetFactoryDefaults(const RDMRequest *request);
94  const RDMResponse *GetProductDetailList(const RDMRequest *request);
95  const RDMResponse *GetPersonality(const RDMRequest *request);
96  const RDMResponse *SetPersonality(const RDMRequest *request);
97  const RDMResponse *GetPersonalityDescription(const RDMRequest *request);
98  const RDMResponse *GetDmxStartAddress(const RDMRequest *request);
99  const RDMResponse *SetDmxStartAddress(const RDMRequest *request);
100  const RDMResponse *GetLampStrikes(const RDMRequest *request);
101  const RDMResponse *SetLampStrikes(const RDMRequest *request);
102  const RDMResponse *GetIdentify(const RDMRequest *request);
103  const RDMResponse *SetIdentify(const RDMRequest *request);
104  const RDMResponse *GetRealTimeClock(const RDMRequest *request);
105  const RDMResponse *GetManufacturerLabel(const RDMRequest *request);
106  const RDMResponse *GetDeviceLabel(const RDMRequest *request);
107  const RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
108  const RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
109  const RDMResponse *GetOlaCodeVersion(const RDMRequest *request);
110 
111  static const ResponderOps<DummyResponder>::ParamHandler PARAM_HANDLERS[];
112  static const uint8_t DEFAULT_PERSONALITY = 2;
113 };
114 } // namespace rdm
115 } // namespace ola
116 #endif // INCLUDE_OLA_RDM_DUMMYRESPONDER_H_