Open Lighting Architecture: plugins/sandnet/SandNetPort.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
SandNetPort.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 * SandNetPort.h
17 * The SandNet plugin for ola
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef PLUGINS_SANDNET_SANDNETPORT_H_
22#define PLUGINS_SANDNET_SANDNETPORT_H_
23
24#include <string>
25#include "ola/DmxBuffer.h"
26#include "olad/Port.h"
27#include "plugins/sandnet/SandNetDevice.h"
28
29namespace ola {
30namespace plugin {
31namespace sandnet {
32
33 class SandNetPortHelper {
34 public:
35 SandNetPortHelper() {}
36 bool PreSetUniverse(Universe *old_universe, Universe *new_universe);
37 std::string Description(const Universe *universe) const;
38
44 uint8_t SandnetGroup(const Universe* universe) const;
45
53 uint8_t SandnetUniverse(const Universe *universe) const;
54};
55
56
57 class SandNetInputPort: public BasicInputPort {
58 public:
59 SandNetInputPort(SandNetDevice *parent,
60 unsigned int id,
61 class PluginAdaptor *plugin_adaptor,
62 SandNetNode *node)
63 : BasicInputPort(parent, id, plugin_adaptor),
64 m_node(node) {}
65 ~SandNetInputPort() {}
66
67 std::string Description() const {
68 return m_helper.Description(GetUniverse());
69 }
70 const DmxBuffer &ReadDMX() const { return m_buffer; }
71 bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
72 return m_helper.PreSetUniverse(old_universe, new_universe);
73 }
74 void PostSetUniverse(Universe *old_universe, Universe *new_universe);
75
76 private:
77 SandNetPortHelper m_helper;
78 SandNetNode *m_node;
79 DmxBuffer m_buffer;
80};
81
82
83 class SandNetOutputPort: public BasicOutputPort {
84 public:
85 SandNetOutputPort(SandNetDevice *parent,
86 unsigned int id,
87 SandNetNode *node)
88 : BasicOutputPort(parent, id),
89 m_node(node) {}
90 ~SandNetOutputPort() {}
91
92 std::string Description() const {
93 return m_helper.Description(GetUniverse());
94 }
95 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
96 bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
97 return m_helper.PreSetUniverse(old_universe, new_universe);
98 }
99 void PostSetUniverse(Universe *old_universe, Universe *new_universe);
100
101 private:
102 SandNetPortHelper m_helper;
103 SandNetNode *m_node;
104};
105} // namespace sandnet
106} // namespace plugin
107} // namespace ola
108#endif // PLUGINS_SANDNET_SANDNETPORT_H_
DmxBuffer.h
A class used to hold a single universe of DMX data.
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::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::plugin::sandnet::SandNetDevice
Definition SandNetDevice.h:35
ola::plugin::sandnet::SandNetInputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition SandNetPort.h:67
ola::plugin::sandnet::SandNetNode
Definition SandNetNode.h:41
ola::plugin::sandnet::SandNetOutputPort::WriteDMX
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition SandNetPort.cpp:88
ola::plugin::sandnet::SandNetOutputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition SandNetPort.h:92
ola::plugin::sandnet::SandNetPortHelper::SandnetUniverse
uint8_t SandnetUniverse(const Universe *universe) const
Return the SandNet universe that corresponds to a OLA Universe.
Definition SandNetPort.cpp:65
ola::plugin::sandnet::SandNetPortHelper::SandnetGroup
uint8_t SandnetGroup(const Universe *universe) const
Return the SandNet group that corresponds to a OLA Universe.
Definition SandNetPort.cpp:59
ola::plugin::sandnet
Code for the SandNet protocol.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44