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

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
ResponderPersonality.h
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 * ResponderPersonality.h
17 * Manages personalities for a RDM responder.
18 * Copyright (C) 2013 Simon Newton
19 */
20
21#ifndef INCLUDE_OLA_RDM_RESPONDERPERSONALITY_H_
22#define INCLUDE_OLA_RDM_RESPONDERPERSONALITY_H_
23
24#include <ola/Logging.h>
25#include <ola/base/Macro.h>
26#include <ola/rdm/ResponderSlotData.h>
27
28#include <stdint.h>
29#include <string>
30#include <vector>
31
32namespace ola {
33namespace rdm {
34
38 class Personality {
39 public:
40 Personality(uint16_t footprint, const std::string &description);
41 Personality(uint16_t footprint, const std::string &description,
42 const SlotDataCollection &slot_data);
43
44 uint16_t Footprint() const { return m_footprint; }
45 std::string Description() const { return m_description; }
46
47 const SlotDataCollection* GetSlotData() const { return &m_slot_data; }
48
49 const SlotData *GetSlotData(uint16_t slot_number) const {
50 return m_slot_data.Lookup(slot_number);
51 }
52
53 private:
54 uint16_t m_footprint;
55 std::string m_description;
56 SlotDataCollection m_slot_data;
57};
58
59
65 class PersonalityCollection {
66 public:
68 typedef std::vector<Personality> PersonalityList;
69
70 explicit PersonalityCollection(const PersonalityList &personalities);
71 virtual ~PersonalityCollection();
72
73 uint8_t PersonalityCount() const;
74
75 const Personality *Lookup(uint8_t personality) const;
76
77 protected:
78 PersonalityCollection() {}
79
80 private:
81 const PersonalityList m_personalities;
82
83 PersonalityCollection(const PersonalityCollection &) = delete;
84 const PersonalityCollection &operator=(const PersonalityCollection &) = delete;
85};
86
87
91 class PersonalityManager {
92 public:
93 PersonalityManager() : m_active_personality(0) {}
94 explicit PersonalityManager(const PersonalityCollection *personalities);
95
96 uint8_t PersonalityCount() const;
97 bool SetActivePersonality(uint8_t personality);
98 uint8_t ActivePersonalityNumber() const { return m_active_personality; }
99 const Personality *ActivePersonality() const;
100 uint16_t ActivePersonalityFootprint() const;
101 std::string ActivePersonalityDescription() const;
102 const Personality *Lookup(uint8_t personality) const;
103
104 private:
105 const PersonalityCollection *m_personalities;
106 uint8_t m_active_personality;
107
108 PersonalityManager(const PersonalityManager &) = delete;
109 const PersonalityManager &operator=(const PersonalityManager &) = delete;
110};
111} // namespace rdm
112} // namespace ola
113#endif // INCLUDE_OLA_RDM_RESPONDERPERSONALITY_H_
Logging.h
Header file for OLA Logging.
Macro.h
Helper macros.
ResponderSlotData.h
Holds the information about DMX slots.
ola::plugin::spi::PersonalityCollection::PersonalityCollection
PersonalityCollection(const PersonalityList &personalities)
Definition ResponderPersonality.cpp:55
ola::plugin::spi::Personality::Personality
Personality(uint16_t footprint, const std::string &description)
Definition ResponderPersonality.cpp:40
ola::rdm::PersonalityCollection
Definition ResponderPersonality.h:65
ola::rdm::PersonalityCollection::PersonalityCount
uint8_t PersonalityCount() const
Definition ResponderPersonality.cpp:69
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::PersonalityCollection::~PersonalityCollection
virtual ~PersonalityCollection()
Definition ResponderPersonality.cpp:63
ola::rdm::PersonalityCollection::Lookup
const Personality * Lookup(uint8_t personality) const
Definition ResponderPersonality.cpp:76
ola::rdm::Personality
Definition ResponderPersonality.h:38
ola::rdm::Personality::Personality
Personality(uint16_t footprint, const std::string &description)
Definition ResponderPersonality.cpp:40
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44