Open Lighting Architecture: plugins/openpixelcontrol/OPCPort.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
OPCPort.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 * OPCPort.h
17 * Ports for the Open Pixel Control plugin.
18 * Copyright (C) 2014 Simon Newton
19 */
20
21#ifndef PLUGINS_OPENPIXELCONTROL_OPCPORT_H_
22#define PLUGINS_OPENPIXELCONTROL_OPCPORT_H_
23
24#include <string>
25#include "ola/DmxBuffer.h"
26#include "olad/Port.h"
27#include "plugins/openpixelcontrol/OPCDevice.h"
28
29namespace ola {
30namespace plugin {
31namespace openpixelcontrol {
32
38 class OPCInputPort: public BasicInputPort {
39 public:
47 OPCInputPort(OPCServerDevice *parent,
48 uint8_t channel,
49 class PluginAdaptor *plugin_adaptor,
50 class OPCServer *server);
51
52 const DmxBuffer &ReadDMX() const { return m_buffer; }
53
54 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
55
56 std::string Description() const;
57
58 private:
59 const uint8_t m_channel;
60 class OPCServer* const m_server;
61 DmxBuffer m_buffer;
62
63 void NewData(uint8_t command, const uint8_t *data, unsigned int length);
64
65 OPCInputPort(const OPCInputPort &) = delete;
66 const OPCInputPort &operator=(const OPCInputPort &) = delete;
67};
68
72 class OPCOutputPort: public BasicOutputPort {
73 public:
81 OPCOutputPort(OPCClientDevice *parent,
82 uint8_t channel,
83 class OPCClient *client);
84
85 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
86
87 std::string Description() const;
88
89 private:
90 class OPCClient* const m_client;
91 const uint8_t m_channel;
92
93 OPCOutputPort(const OPCOutputPort &) = delete;
94 const OPCOutputPort &operator=(const OPCOutputPort &) = delete;
95};
96} // namespace openpixelcontrol
97} // namespace plugin
98} // namespace ola
99#endif // PLUGINS_OPENPIXELCONTROL_OPCPORT_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::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::openpixelcontrol::OPCClientDevice
Definition OPCDevice.h:70
ola::plugin::openpixelcontrol::OPCClient
An Open Pixel Control client.
Definition OPCClient.h:49
ola::plugin::openpixelcontrol::OPCInputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition OPCPort.cpp:58
ola::plugin::openpixelcontrol::OPCInputPort::OPCInputPort
OPCInputPort(OPCServerDevice *parent, uint8_t channel, class PluginAdaptor *plugin_adaptor, class OPCServer *server)
Create a new OPC Input Port.
Definition OPCPort.cpp:36
ola::plugin::openpixelcontrol::OPCOutputPort::OPCOutputPort
OPCOutputPort(OPCClientDevice *parent, uint8_t channel, class OPCClient *client)
Create a new OPC Output Port.
Definition OPCPort.cpp:65
ola::plugin::openpixelcontrol::OPCOutputPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition OPCPort.cpp:78
ola::plugin::openpixelcontrol::OPCOutputPort::WriteDMX
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition OPCPort.cpp:73
ola::plugin::openpixelcontrol::OPCServerDevice
Definition OPCDevice.h:39
ola::plugin::openpixelcontrol::OPCServer
An Open Pixel Control server.
Definition OPCServer.h:44
ola::client
OLA C++ API.
ola::plugin::openpixelcontrol
The Open Pixel Control (OPC) plugin.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44