Open Lighting Architecture: plugins/e131/E131Port.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
E131Port.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program 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
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * E131Port.h
17 * The E1.31 port for OLA
18 * Copyright (C) 2007 Simon Newton
19 */
20
21#ifndef PLUGINS_E131_E131PORT_H_
22#define PLUGINS_E131_E131PORT_H_
23
24#include <string>
25#include "olad/Port.h"
26#include "plugins/e131/E131Device.h"
27#include "libs/acn/E131Node.h"
28
29namespace ola {
30namespace plugin {
31namespace e131 {
32
33 class E131PortHelper {
34 public:
35 bool PreSetUniverse(Universe *old_universe, Universe *new_universe);
36 std::string Description(Universe *universe) const;
37 private:
38 static const unsigned int MAX_E131_UNIVERSE = 63999;
39};
40
41
42 class E131InputPort: public BasicInputPort {
43 public:
44 E131InputPort(E131Device *parent, int id, ola::acn::E131Node *node,
45 class PluginAdaptor *plugin_adaptor)
46 : BasicInputPort(parent, id, plugin_adaptor),
47 m_node(node),
48 m_priority(ola::dmx::SOURCE_PRIORITY_DEFAULT) {
49 SetPriorityMode(PRIORITY_MODE_INHERIT);
50 }
51
52 bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
53 return m_helper.PreSetUniverse(old_universe, new_universe);
54 }
55 void PostSetUniverse(Universe *old_universe, Universe *new_universe);
56 std::string Description() const {
57 return m_helper.Description(GetUniverse());
58 }
59 const ola::DmxBuffer &ReadDMX() const { return m_buffer; }
60 bool SupportsPriorities() const { return true; }
61 uint8_t InheritedPriority() const { return m_priority; }
62
63 private:
64 ola::DmxBuffer m_buffer;
65 ola::acn::E131Node *m_node;
66 E131PortHelper m_helper;
67 uint8_t m_priority;
68};
69
70
71 class E131OutputPort: public BasicOutputPort {
72 public:
73 E131OutputPort(E131Device *parent, int id, ola::acn::E131Node *node)
74 : BasicOutputPort(parent, id),
75 m_preview_on(false),
76 m_node(node) {
77 m_last_priority = GetPriority();
78 }
79
80 ~E131OutputPort();
81
82 bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
83 return m_helper.PreSetUniverse(old_universe, new_universe);
84 }
85 void PostSetUniverse(Universe *old_universe, Universe *new_universe);
86 std::string Description() const {
87 return m_helper.Description(GetUniverse());
88 }
89
90 bool WriteDMX(const ola::DmxBuffer &buffer, uint8_t priority);
91
92 void SetPreviewMode(bool preview_mode) { m_preview_on = preview_mode; }
93 bool PreviewMode() const { return m_preview_on; }
94 bool SupportsPriorities() const { return true; }
95
96 private:
97 bool m_preview_on;
98 uint8_t m_last_priority;
99 ola::DmxBuffer m_buffer;
100 ola::acn::E131Node *m_node;
101 E131PortHelper m_helper;
102};
103} // namespace e131
104} // namespace plugin
105} // namespace ola
106#endif // PLUGINS_E131_E131PORT_H_
ola::BasicInputPort::SetPriorityMode
void SetPriorityMode(port_priority_mode mode)
Set the Priority Mode for this Port.
Definition Port.h:216
ola::BasicInputPort::BasicInputPort
BasicInputPort(AbstractDevice *parent, unsigned int port_id, const PluginAdaptor *plugin_adaptor, bool supports_rdm=false)
Create a new basic input port.
Definition Port.cpp:38
ola::BasicInputPort::GetUniverse
Universe * GetUniverse() const
Fetch the universe this Port is bound to.
Definition Port.h:212
ola::BasicOutputPort::BasicOutputPort
BasicOutputPort(AbstractDevice *parent, unsigned int port_id, bool start_rdm_discovery_on_patch=false, bool supports_rdm=false)
Create a new BasicOutputPort.
Definition Port.cpp:120
ola::BasicOutputPort::GetPriority
uint8_t GetPriority() const
Get the numeric priority for this Port.
Definition Port.h:299
ola::BasicOutputPort::GetUniverse
Universe * GetUniverse() const
Fetch the universe this Port is bound to.
Definition Port.h:296
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::Universe
Definition Universe.h:46
ola::acn::E131Node
Definition E131Node.h:50
ola::plugin::e131::E131Device
Definition E131Device.h:40
ola::plugin::e131::E131InputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition E131Port.h:56
ola::plugin::e131::E131OutputPort::WriteDMX
bool WriteDMX(const ola::DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition E131Port.cpp:95
ola::plugin::e131::E131OutputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition E131Port.h:86
ola::plugin::e131::E131PortHelper
Definition E131Port.h:33
ola::PRIORITY_MODE_INHERIT
@ PRIORITY_MODE_INHERIT
Definition PortConstants.h:46
ola::dmx::SOURCE_PRIORITY_DEFAULT
static const uint8_t SOURCE_PRIORITY_DEFAULT
The default priority for a source.
Definition SourcePriorities.h:41
ola::plugin::e131
The E1.31 (sACN) plugin.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44