Open Lighting Architecture  Latest Git
DimmerSubDevice.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  * DimmerSubDevice.h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
28 #ifndef INCLUDE_OLA_RDM_DIMMERSUBDEVICE_H_
29 #define INCLUDE_OLA_RDM_DIMMERSUBDEVICE_H_
30 
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 #include <string>
38 
39 namespace ola {
40 namespace rdm {
41 
46  public:
52  DimmerSubDevice(const UID &uid, uint16_t sub_device_number,
53  uint16_t total_sub_devices);
54 
55  void SendRDMRequest(RDMRequest *request, RDMCallback *callback);
56 
57  uint16_t Footprint() const {
58  return m_personality_manager.ActivePersonalityFootprint();
59  }
60 
61  bool SetDmxStartAddress(uint16_t start_address);
62 
63  uint16_t GetDmxStartAddress() const {
64  return m_start_address;
65  }
66 
67  private:
71  class RDMOps : public ResponderOps<DimmerSubDevice> {
72  public:
73  static RDMOps *Instance() {
74  if (!instance)
75  instance = new RDMOps();
76  return instance;
77  }
78 
79  private:
80  RDMOps() : ResponderOps<DimmerSubDevice>(PARAM_HANDLERS, true) {}
81 
82  static RDMOps *instance;
83  };
84 
88  class Personalities : public PersonalityCollection {
89  public:
90  static const Personalities *Instance();
91 
92  private:
93  explicit Personalities(const PersonalityList &personalities) :
94  PersonalityCollection(personalities) {
95  }
96 
97  static Personalities *instance;
98  };
99 
100  const UID m_uid;
101  const uint16_t m_sub_device_number;
102  const uint16_t m_sub_device_count;
103  uint16_t m_start_address;
104  bool m_identify_on;
105  uint8_t m_identify_mode;
106  PersonalityManager m_personality_manager;
107 
108  RDMResponse *GetDeviceInfo(const RDMRequest *request);
109  RDMResponse *GetProductDetailList(const RDMRequest *request);
110  RDMResponse *GetPersonality(const RDMRequest *request);
111  RDMResponse *SetPersonality(const RDMRequest *request);
112  RDMResponse *GetPersonalityDescription(const RDMRequest *request);
113  RDMResponse *GetDmxStartAddress(const RDMRequest *request);
114  RDMResponse *SetDmxStartAddress(const RDMRequest *request);
115  RDMResponse *GetIdentify(const RDMRequest *request);
116  RDMResponse *SetIdentify(const RDMRequest *request);
117  RDMResponse *SetIdentifyMode(const RDMRequest *request);
118  RDMResponse *GetIdentifyMode(const RDMRequest *request);
119  RDMResponse *GetRealTimeClock(const RDMRequest *request);
120  RDMResponse *GetManufacturerLabel(const RDMRequest *request);
121  RDMResponse *GetDeviceLabel(const RDMRequest *request);
122  RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
123  RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
124 
125  static const ResponderOps<DimmerSubDevice>::ParamHandler PARAM_HANDLERS[];
126 };
127 } // namespace rdm
128 } // namespace ola
129 #endif // INCLUDE_OLA_RDM_DIMMERSUBDEVICE_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
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition: RDMCommand.h:234
A RDM unique identifier (UID).
DimmerSubDevice(const UID &uid, uint16_t sub_device_number, uint16_t total_sub_devices)
Definition: DimmerSubDevice.cpp:98
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition: DimmerSubDevice.cpp:113
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
Definition: DimmerSubDevice.h:45