21 #ifndef INCLUDE_OLAD_UNIVERSE_H_
22 #define INCLUDE_OLAD_UNIVERSE_H_
24 #include <ola/Clock.h>
32 #include <olad/DmxSource.h>
58 std::string Name()
const {
return m_universe_name; }
59 unsigned int UniverseId()
const {
return m_universe_id; }
60 merge_mode MergeMode()
const {
return m_merge_mode; }
61 bool IsActive()
const;
62 uint8_t ActivePriority()
const {
return m_active_priority; }
70 return m_rdm_discovery_interval;
77 return m_last_discovery_time;
81 void SetName(
const std::string &name);
82 void SetMergeMode(merge_mode merge_mode);
88 m_rdm_discovery_interval = discovery_interval;
93 const DmxBuffer &GetDMX()
const {
return m_buffer; }
96 bool AddPort(InputPort *port);
97 bool AddPort(OutputPort *port);
98 bool RemovePort(InputPort *port);
99 bool RemovePort(OutputPort *port);
100 bool ContainsPort(InputPort *port)
const;
101 bool ContainsPort(OutputPort *port)
const;
102 unsigned int InputPortCount()
const {
return m_input_ports.size(); }
103 unsigned int OutputPortCount()
const {
return m_output_ports.size(); }
104 void InputPorts(std::vector<InputPort*> *ports)
const;
105 void OutputPorts(std::vector<OutputPort*> *ports)
const;
108 bool AddSourceClient(Client *client);
109 bool RemoveSourceClient(Client *client);
110 bool ContainsSourceClient(Client *client)
const;
111 unsigned int SourceClientCount()
const {
return m_source_clients.size(); }
114 bool AddSinkClient(Client *client);
115 bool RemoveSinkClient(Client *client);
116 bool ContainsSinkClient(Client *client)
const;
117 unsigned int SinkClientCount()
const {
return m_sink_clients.size(); }
120 bool PortDataChanged(InputPort *port);
121 bool SourceClientDataChanged(Client *client);
136 bool operator==(
const Universe &other) {
137 return m_universe_id == other.UniverseId();
140 static const char K_FPS_VAR[];
141 static const char K_MERGE_HTP_STR[];
142 static const char K_MERGE_LTP_STR[];
143 static const char K_UNIVERSE_INPUT_PORT_VAR[];
144 static const char K_UNIVERSE_MODE_VAR[];
145 static const char K_UNIVERSE_NAME_VAR[];
146 static const char K_UNIVERSE_OUTPUT_PORT_VAR[];
147 static const char K_UNIVERSE_RDM_REQUESTS[];
148 static const char K_UNIVERSE_SINK_CLIENTS_VAR[];
149 static const char K_UNIVERSE_SOURCE_CLIENTS_VAR[];
150 static const char K_UNIVERSE_UID_COUNT_VAR[];
154 unsigned int expected_count;
155 unsigned int current_count;
156 ola::rdm::RDMStatusCode status_code;
158 std::vector<rdm::RDMFrame> frames;
159 } broadcast_request_tracker;
161 typedef std::map<Client*, bool> SourceClientMap;
163 std::string m_universe_name;
164 unsigned int m_universe_id;
165 std::string m_universe_id_str;
166 uint8_t m_active_priority;
167 enum merge_mode m_merge_mode;
168 std::vector<InputPort*> m_input_ports;
169 std::vector<OutputPort*> m_output_ports;
170 std::set<Client*> m_sink_clients;
175 SourceClientMap m_source_clients;
176 class UniverseStore *m_universe_store;
178 ExportMap *m_export_map;
179 std::map<ola::rdm::UID, OutputPort*> m_output_uids;
181 TimeInterval m_rdm_discovery_interval;
182 TimeStamp m_last_discovery_time;
184 void HandleBroadcastAck(broadcast_request_tracker *tracker,
186 void HandleBroadcastDiscovery(broadcast_request_tracker *tracker,
188 bool UpdateDependants();
191 void HTPMergeSources(
const std::vector<DmxSource> &sources);
192 bool MergeAll(
const InputPort *port,
const Client *client);
193 void PortDiscoveryComplete(BaseCallback0<void> *on_complete,
194 OutputPort *output_port,
198 void SafeIncrement(
const std::string &name);
199 void SafeDecrement(
const std::string &name);
201 template<
class PortClass>
202 bool GenericAddPort(PortClass *port,
203 std::vector<PortClass*> *ports);
205 template<
class PortClass>
206 bool GenericRemovePort(PortClass *port,
207 std::vector<PortClass*> *ports,
208 std::map<ola::rdm::UID, PortClass*> *uid_map = NULL);
210 template<
class PortClass>
211 bool GenericContainsPort(PortClass *port,
212 const std::vector<PortClass*> &ports)
const;
217 #endif // INCLUDE_OLAD_UNIVERSE_H_
Represents a set of RDM UIDs.
Definition: UIDSet.h:48
Definitions and Interfaces to implement an RDMController that sends a single message at a time...
Definition: Universe.h:45
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
A container for the exported variables.
Definition: ExportMap.h:324
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition: RDMCommand.h:233
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
A RDM unique identifier (UID).
Export variables on the http server.
void SendRDMRequest(ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *callback)
Send a RDM command.
Definition: Universe.cpp:455
Maintains a collection of Universe objects.
Definition: UniverseStore.h:39
A class used to hold a single universe of DMX data.
void CleanStaleSourceClients()
Clean old source clients.
Definition: Universe.cpp:431
Used to get the current time.
Definition: Clock.h:221
The base class for all 1 argument callbacks.
Definition: Callback.h:982
Holds the final state of an RDM request.
Definition: RDMReply.h:43
void SetRDMDiscoveryInterval(const TimeInterval &discovery_interval)
Definition: Universe.h:87
The interface that can send RDMRequest.
Definition: RDMControllerInterface.h:73
const TimeInterval & RDMDiscoveryInterval() const
Return the time between RDM discovery operations.
Definition: Universe.h:69
const TimeStamp & LastRDMDiscovery() const
Get the time of the last discovery run.
Definition: Universe.h:76
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
unsigned int UIDCount() const
Definition: Universe.cpp:606
Classes that represent RDM commands.