Open Lighting Architecture: include/ola/rdm/DimmerSubDevice.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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
27
28#ifndef INCLUDE_OLA_RDM_DIMMERSUBDEVICE_H_
29#define INCLUDE_OLA_RDM_DIMMERSUBDEVICE_H_
30
31#include <ola/rdm/RDMControllerInterface.h>
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
39namespace ola {
40namespace rdm {
41
45 class DimmerSubDevice: public RDMControllerInterface {
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_
RDMControllerInterface.h
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
RDMEnums.h
Various constants used in RDM.
ResponderOps.h
A framework for building RDM responders.
UID.h
A RDM unique identifier (UID).
ola::rdm::DimmerSubDevice::DimmerSubDevice
DimmerSubDevice(const UID &uid, uint16_t sub_device_number, uint16_t total_sub_devices)
Definition DimmerSubDevice.cpp:98
ola::rdm::DimmerSubDevice::SendRDMRequest
void SendRDMRequest(RDMRequest *request, RDMCallback *callback)
Send a RDM command.
Definition DimmerSubDevice.cpp:113
ola::rdm::PersonalityCollection
Definition ResponderPersonality.h:65
ola::rdm::PersonalityCollection::PersonalityCollection
PersonalityCollection(const PersonalityList &personalities)
Definition ResponderPersonality.cpp:55
ola::rdm::PersonalityCollection::PersonalityList
std::vector< Personality > PersonalityList
Definition ResponderPersonality.h:68
ola::rdm::PersonalityManager
Definition ResponderPersonality.h:91
ola::rdm::RDMControllerInterface
The interface that can send RDMRequest.
Definition RDMControllerInterface.h:73
ola::rdm::RDMRequest
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
ola::rdm::RDMResponse
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition RDMCommand.h:457
ola::rdm::ResponderOps
A class which dispatches RDM requests to registered PID handlers.
Definition ResponderOps.h:60
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola::rdm::RDMCallback
ola::BaseCallback1< void, RDMReply * > RDMCallback
The callback run when a RDM request completes.
Definition RDMControllerInterface.h:52
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::rdm::ResponderOps::ParamHandler
the structure that defines the behaviour for a specific PID.o
Definition ResponderOps.h:76