21 #ifndef INCLUDE_OLAD_PORT_H_
22 #define INCLUDE_OLAD_PORT_H_
27 #include <ola/timecode/TimeCode.h>
28 #include <olad/DmxSource.h>
29 #include <olad/PluginAdaptor.h>
30 #include <olad/PortConstants.h>
31 #include <olad/Universe.h>
48 virtual unsigned int PortId()
const = 0;
54 virtual string Description()
const = 0;
57 virtual bool SetUniverse(
Universe *universe) = 0;
60 virtual Universe *GetUniverse()
const = 0;
64 virtual string UniqueId()
const = 0;
67 virtual port_priority_capability PriorityCapability()
const = 0;
69 virtual bool SetPriority(uint8_t priority) = 0;
70 virtual uint8_t GetPriority()
const = 0;
72 virtual void SetPriorityMode(port_priority_mode mode) = 0;
73 virtual port_priority_mode GetPriorityMode()
const = 0;
76 virtual bool SupportsRDM()
const = 0;
89 virtual void DmxChanged() = 0;
92 virtual const DmxSource &SourceData()
const = 0;
108 virtual bool WriteDMX(
const DmxBuffer &buffer, uint8_t priority) = 0;
111 virtual void UniverseNameChanged(
const string &new_name) = 0;
117 virtual void RunFullDiscovery(
119 virtual void RunIncrementalDiscovery(
123 virtual bool SupportsTimeCode()
const = 0;
135 unsigned int port_id,
137 bool supports_rdm =
false);
139 unsigned int PortId()
const {
return m_port_id; }
141 bool SetUniverse(
Universe *universe);
142 Universe *GetUniverse()
const {
return m_universe; }
143 virtual string UniqueId()
const;
144 bool SetPriority(uint8_t priority);
145 uint8_t GetPriority()
const {
return m_priority; }
146 void SetPriorityMode(port_priority_mode mode) { m_priority_mode = mode; }
147 port_priority_mode GetPriorityMode()
const {
return m_priority_mode; }
149 const DmxSource &SourceData()
const {
return m_dmx_source; }
157 port_priority_capability PriorityCapability()
const {
158 return SupportsPriorities() ? CAPABILITY_FULL : CAPABILITY_STATIC;
163 virtual const DmxBuffer &ReadDMX()
const = 0;
166 virtual uint8_t InheritedPriority()
const {
167 return DmxSource::PRIORITY_MIN;
175 virtual bool SupportsRDM()
const {
return m_supports_rdm; }
179 virtual bool SupportsPriorities()
const {
return false; }
182 const unsigned int m_port_id;
184 port_priority_mode m_priority_mode;
185 mutable string m_port_string;
203 unsigned int port_id,
204 bool start_rdm_discovery_on_patch =
false,
205 bool supports_rdm =
false);
207 unsigned int PortId()
const {
return m_port_id; }
209 bool SetUniverse(
Universe *universe);
210 Universe *GetUniverse()
const {
return m_universe; }
211 string UniqueId()
const;
212 bool SetPriority(uint8_t priority);
213 uint8_t GetPriority()
const {
return m_priority; }
214 void SetPriorityMode(port_priority_mode mode) { m_priority_mode = mode; }
215 port_priority_mode GetPriorityMode()
const {
return m_priority_mode; }
217 virtual void UniverseNameChanged(
const string &new_name) {
221 port_priority_capability PriorityCapability()
const {
222 return SupportsPriorities() ? CAPABILITY_FULL : CAPABILITY_NONE;
228 virtual void RunFullDiscovery(
230 virtual void RunIncrementalDiscovery(
234 virtual bool SupportsTimeCode()
const {
246 virtual bool SupportsRDM()
const {
return m_supports_rdm; }
250 virtual bool SupportsPriorities()
const {
return false; }
254 const unsigned int m_port_id;
255 const bool m_discover_on_patch;
257 port_priority_mode m_priority_mode;
258 mutable string m_port_string;
271 template<
class PortClass>
275 bool IsInputPort<OutputPort>();
277 #endif // INCLUDE_OLAD_PORT_H_