Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DimmerRootDevice.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  * DimmerRootDevice_h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
29 #ifndef INCLUDE_OLA_RDM_DIMMERROOTDEVICE_H_
30 #define INCLUDE_OLA_RDM_DIMMERROOTDEVICE_H_
31 
34 #include <ola/rdm/ResponderOps.h>
35 #include <ola/rdm/UID.h>
36 
37 #include <string>
38 #include <map>
39 
40 namespace ola {
41 namespace rdm {
42 
47  public:
48  typedef const std::map<uint16_t, class DimmerSubDevice*> SubDeviceMap;
49 
50  DimmerRootDevice(const UID &uid, SubDeviceMap sub_devices);
51 
52  void SendRDMRequest(const RDMRequest *request, RDMCallback *callback);
53 
54  private:
58  class RDMOps : public ResponderOps<DimmerRootDevice> {
59  public:
60  static RDMOps *Instance() {
61  if (!instance)
62  instance = new RDMOps();
63  return instance;
64  }
65 
66  private:
67  RDMOps() : ResponderOps<DimmerRootDevice>(PARAM_HANDLERS) {}
68  static RDMOps *instance;
69  };
70 
71  const UID m_uid;
72  bool m_identify_on;
73  rdm_identify_mode m_identify_mode;
74  SubDeviceMap m_sub_devices;
75 
76  const RDMResponse *GetDeviceInfo(const RDMRequest *request);
77  const RDMResponse *GetProductDetailList(const RDMRequest *request);
78  const RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
79  const RDMResponse *GetManufacturerLabel(const RDMRequest *request);
80  const RDMResponse *GetDeviceLabel(const RDMRequest *request);
81  const RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
82  const RDMResponse *GetIdentify(const RDMRequest *request);
83  const RDMResponse *SetIdentify(const RDMRequest *request);
84  const RDMResponse *GetDmxBlockAddress(const RDMRequest *request);
85  const RDMResponse *SetDmxBlockAddress(const RDMRequest *request);
86  const RDMResponse *GetIdentifyMode(const RDMRequest *request);
87  const RDMResponse *SetIdentifyMode(const RDMRequest *request);
88 
89  static const ResponderOps<DimmerRootDevice>::ParamHandler PARAM_HANDLERS[];
90 };
91 } // namespace rdm
92 } // namespace ola
93 #endif // INCLUDE_OLA_RDM_DIMMERROOTDEVICE_H_