Open Lighting Architecture
 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 
32 #include <string>
33 #include <map>
36 #include "ola/rdm/ResponderOps.h"
37 #include "ola/rdm/UID.h"
38 
39 namespace ola {
40 namespace rdm {
41 
42 using std::vector;
43 
48  public:
49  typedef const map<uint16_t, class DimmerSubDevice*> SubDeviceMap;
50 
51  DimmerRootDevice(const UID &uid, SubDeviceMap sub_devices);
52 
53  void SendRDMRequest(const RDMRequest *request, RDMCallback *callback);
54 
55  private:
59  class RDMOps : public ResponderOps<DimmerRootDevice> {
60  public:
61  static RDMOps *Instance() {
62  if (!instance)
63  instance = new RDMOps();
64  return instance;
65  }
66 
67  private:
68  RDMOps() : ResponderOps<DimmerRootDevice>(PARAM_HANDLERS) {}
69  static RDMOps *instance;
70  };
71 
72  const UID m_uid;
73  bool m_identify_on;
74  rdm_identify_mode m_identify_mode;
75  SubDeviceMap m_sub_devices;
76 
77  const RDMResponse *GetDeviceInfo(const RDMRequest *request);
78  const RDMResponse *GetProductDetailList(const RDMRequest *request);
79  const RDMResponse *GetDeviceModelDescription(const RDMRequest *request);
80  const RDMResponse *GetManufacturerLabel(const RDMRequest *request);
81  const RDMResponse *GetDeviceLabel(const RDMRequest *request);
82  const RDMResponse *GetSoftwareVersionLabel(const RDMRequest *request);
83  const RDMResponse *GetIdentify(const RDMRequest *request);
84  const RDMResponse *SetIdentify(const RDMRequest *request);
85  const RDMResponse *GetDmxBlockAddress(const RDMRequest *request);
86  const RDMResponse *SetDmxBlockAddress(const RDMRequest *request);
87  const RDMResponse *GetIdentifyMode(const RDMRequest *request);
88  const RDMResponse *SetIdentifyMode(const RDMRequest *request);
89 
90  static const ResponderOps<DimmerRootDevice>::ParamHandler PARAM_HANDLERS[];
91 };
92 } // namespace rdm
93 } // namespace ola
94 #endif // INCLUDE_OLA_RDM_DIMMERROOTDEVICE_H_