Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
ResponderSlotData.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 * ResponderSlotData.h
17 * Manages slot data for a personality for a RDM responder.
18 * Copyright (C) 2013 Peter Newman
19 */
20
29#ifndef INCLUDE_OLA_RDM_RESPONDERSLOTDATA_H_
30#define INCLUDE_OLA_RDM_RESPONDERSLOTDATA_H_
31
32#include <ola/rdm/RDMEnums.h>
33
34#include <stdint.h>
35#include <string>
36#include <vector>
37
38namespace ola {
39namespace rdm {
40
44class SlotData {
45 public:
51 rdm_slot_type SlotType() const { return m_slot_type; }
52
60 uint16_t SlotIDDefinition() const { return m_slot_id; }
61
67 uint8_t DefaultSlotValue() const { return m_default_slot_value; }
68
73 bool HasDescription() const { return m_has_description; }
74
80 std::string Description() const { return m_description; }
81
88 static SlotData PrimarySlot(
89 rdm_slot_definition slot_definition,
90 uint8_t default_slot_value);
91
99 static SlotData PrimarySlot(
100 rdm_slot_definition slot_definition,
101 uint8_t default_slot_value,
102 const std::string &description);
103
111 static SlotData SecondarySlot(
112 rdm_slot_type slot_type,
113 uint16_t primary_slot,
114 uint8_t default_slot_value);
115
124 static SlotData SecondarySlot(
125 rdm_slot_type slot_type,
126 uint16_t primary_slot,
127 uint8_t default_slot_value,
128 const std::string &description);
129
130 private:
131 SlotData(rdm_slot_type slot_type,
132 uint16_t slot_id,
133 uint8_t default_slot_value);
134
135 SlotData(rdm_slot_type slot_type,
136 uint16_t slot_id,
137 uint8_t default_slot_value,
138 const std::string &description);
139
140 rdm_slot_type m_slot_type;
141 uint16_t m_slot_id;
142 uint8_t m_default_slot_value;
143 bool m_has_description;
144 std::string m_description;
145};
146
147
152 public:
153 typedef std::vector<SlotData> SlotDataList;
154
155 explicit SlotDataCollection(const SlotDataList &slot_data);
157
162 uint16_t SlotCount() const;
163
168 const SlotData *Lookup(uint16_t slot) const;
169
170 private:
171 SlotDataList m_slot_data;
172};
173} // namespace rdm
174} // namespace ola
175#endif // INCLUDE_OLA_RDM_RESPONDERSLOTDATA_H_
Various constants used in RDM.
Holds information about a set of slots.
Definition ResponderSlotData.h:151
const SlotData * Lookup(uint16_t slot) const
Lookup slot data based on the slot index.
Definition ResponderSlotData.cpp:99
uint16_t SlotCount() const
The number of slots we have information for.
Definition ResponderSlotData.cpp:95
Holds information about a single DMX slot.
Definition ResponderSlotData.h:44
uint16_t SlotIDDefinition() const
The Slot ID Definition. Used in the SLOT_INFO message. This can either be a rdm_slot_definition for a...
Definition ResponderSlotData.h:60
static SlotData PrimarySlot(rdm_slot_definition slot_definition, uint8_t default_slot_value)
Create a new Primary slot.
Definition ResponderSlotData.cpp:34
std::string Description() const
The slot description. Used in the SLOT_DESCRIPTION message.
Definition ResponderSlotData.h:80
uint8_t DefaultSlotValue() const
The default slot value. Used in the DEFAULT_SLOT_VALUE message.
Definition ResponderSlotData.h:67
rdm_slot_type SlotType() const
The Slot Type. Used in the SLOT_INFO message.
Definition ResponderSlotData.h:51
bool HasDescription() const
true if there is a description for this slot, false otherwise.
Definition ResponderSlotData.h:73
static SlotData SecondarySlot(rdm_slot_type slot_type, uint16_t primary_slot, uint8_t default_slot_value)
Create a new Secondary slot.
Definition ResponderSlotData.cpp:51
rdm_slot_definition
The RDM slot definitions, from table C-2 of the standard.
Definition RDMEnums.h:527
rdm_slot_type
The RDM slot types, from table C-1 of the standard.
Definition RDMEnums.h:511
The namespace containing all OLA symbols.
Definition Credentials.cpp:44