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>
27
28#include <stdint.h>
29#include <string>
30#include <vector>
31
32namespace ola {
33namespace rdm {
34
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
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:
79
80 private:
81 const PersonalityList m_personalities;
82
84 const PersonalityCollection &operator=(const PersonalityCollection &) = delete;
85};
86
87
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_
Header file for OLA Logging.
Helper macros.
Holds the information about DMX slots.
Definition ResponderPersonality.h:65
uint8_t PersonalityCount() const
Definition ResponderPersonality.cpp:69
std::vector< Personality > PersonalityList
Definition ResponderPersonality.h:68
virtual ~PersonalityCollection()
Definition ResponderPersonality.cpp:63
const Personality * Lookup(uint8_t personality) const
Definition ResponderPersonality.cpp:76
Definition ResponderPersonality.h:38
Personality(uint16_t footprint, const std::string &description)
Definition ResponderPersonality.cpp:40
Definition ResponderPersonality.h:91
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
Holds information about a single DMX slot.
Definition ResponderSlotData.h:44
The namespace containing all OLA symbols.
Definition Credentials.cpp:44