Open Lighting Architecture: plugins/dmx4linux/Dmx4LinuxPort.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Dmx4LinuxPort.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 * Dmx4LinuxPort.h
17 * The Dmx4Linux plugin for ola
18 * Copyright (C) 2006 Simon Newton
19 */
20
21#ifndef PLUGINS_DMX4LINUX_DMX4LINUXPORT_H_
22#define PLUGINS_DMX4LINUX_DMX4LINUXPORT_H_
23
24#include <string>
25#include "ola/Constants.h"
26#include "ola/DmxBuffer.h"
27#include "plugins/dmx4linux/Dmx4LinuxDevice.h"
28#include "plugins/dmx4linux/Dmx4LinuxSocket.h"
29
30namespace ola {
31namespace plugin {
32namespace dmx4linux {
33
34
35/*
36 * A Dmx4Linux output port, we only have 1 port per device so the port id is
37 * always 0.
38 */
39 class Dmx4LinuxOutputPort: public BasicOutputPort {
40 public:
41 Dmx4LinuxOutputPort(Dmx4LinuxDevice *parent,
42 Dmx4LinuxSocket *socket,
43 int d4l_universe)
44 : BasicOutputPort(parent, 0),
45 m_socket(socket),
46 m_d4l_universe(d4l_universe) {
47 }
48
49 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
50 string Description() const { return ""; }
51
52 private:
53 Dmx4LinuxSocket *m_socket;
54 int m_d4l_universe; // dmx4linux universe that this maps to
55};
56
57
58/*
59 * A Dmx4Linux input port, we only have 1 port per device so the port id is
60 * always 0.
61 */
62 class Dmx4LinuxInputPort: public BasicInputPort {
63 public:
64 explicit Dmx4LinuxInputPort(Dmx4LinuxDevice *parent,
65 class PluginAdaptor *plugin_adaptor)
66 : BasicInputPort(parent, 0, plugin_adaptor) {
67 m_read_buffer.SetRangeToValue(0, 0, DMX_UNIVERSE_SIZE);
68 }
69
74 const DmxBuffer &ReadDMX() const;
75
79 bool UpdateData(const uint8_t *in_buffer, unsigned int length);
80 string Description() const { return ""; }
81
82 private:
83 DmxBuffer m_read_buffer;
84};
85} // namespace dmx4linux
86} // namespace plugin
87} // namespace ola
88#endif // PLUGINS_DMX4LINUX_DMX4LINUXPORT_H_
Constants.h
Constants used throughout OLA.
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::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::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::plugin::dmx4linux::Dmx4LinuxDevice
Definition Dmx4LinuxDevice.h:31
ola::plugin::dmx4linux::Dmx4LinuxInputPort::ReadDMX
const DmxBuffer & ReadDMX() const
Definition Dmx4LinuxPort.cpp:51
ola::plugin::dmx4linux::Dmx4LinuxInputPort::Description
string Description() const
Fetch the string description for a Port.
Definition Dmx4LinuxPort.h:80
ola::plugin::dmx4linux::Dmx4LinuxInputPort::UpdateData
bool UpdateData(const uint8_t *in_buffer, unsigned int length)
Definition Dmx4LinuxPort.cpp:55
ola::plugin::dmx4linux::Dmx4LinuxOutputPort::Description
string Description() const
Fetch the string description for a Port.
Definition Dmx4LinuxPort.h:50
ola::plugin::dmx4linux::Dmx4LinuxOutputPort::WriteDMX
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition Dmx4LinuxPort.cpp:34
ola::plugin::dmx4linux::Dmx4LinuxSocket
Definition Dmx4LinuxSocket.h:30
ola::plugin::dmx4linux
Code for DMX4Linux devices.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::DMX_UNIVERSE_SIZE
@ DMX_UNIVERSE_SIZE
Definition Constants.h:36