Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
RobeDevice.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 * RobeDevice.h
17 * The Robe Universal Interface Device.
18 * Copyright (C) 2011 Simon Newton
19 */
20
21#ifndef PLUGINS_USBPRO_ROBEDEVICE_H_
22#define PLUGINS_USBPRO_ROBEDEVICE_H_
23
24#include <string>
25#include "ola/DmxBuffer.h"
26#include "plugins/usbpro/RobeWidget.h"
27#include "plugins/usbpro/UsbSerialDevice.h"
28
29namespace ola {
30namespace plugin {
31namespace usbpro {
32
33
34/*
35 * The device for a Robe Universe Interface.
36 */
38 public:
39 RobeDevice(ola::PluginAdaptor *plugin_adaptor,
41 const std::string &name,
42 RobeWidget *widget);
43
44 std::string DeviceId() const { return m_device_id; }
45
46 private:
47 std::string m_device_id;
48 class RobeOutputPort *m_output_port;
49 class RobeInputPort *m_input_port;
50};
51
52
53/*
54 * The Input port
55 */
57 public:
59 RobeWidget *widget,
60 ola::PluginAdaptor *plugin_adaptor)
61 : BasicInputPort(parent, 0, plugin_adaptor),
62 m_widget(widget) {
63 m_widget->SetDmxCallback(NewCallback(
64 static_cast<BasicInputPort*>(this),
66 }
67
68 const DmxBuffer &ReadDMX() const {
69 return m_widget->FetchDMX();
70 }
71
72 void PostSetUniverse(Universe*, Universe *new_universe) {
73 if (new_universe)
74 m_widget->ChangeToReceiveMode();
75 }
76
77 std::string Description() const { return ""; }
78
79 private:
80 std::string m_path;
81 RobeWidget *m_widget;
82};
83
84
85/*
86 * For now we just support a single port per device. Some devices may have two
87 * ports, but I haven't figured out how to use that yet.
88 */
90 public:
91 RobeOutputPort(RobeDevice *parent, RobeWidget *widget);
92
93 std::string Description() const { return ""; }
94 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
95
97 ola::rdm::RDMCallback *callback) {
98 m_widget->SendRDMRequest(request, callback);
99 }
100
102 m_widget->RunFullDiscovery(callback);
103 }
104
108
109 private:
110 RobeWidget *m_widget;
111};
112} // namespace usbpro
113} // namespace plugin
114} // namespace ola
115#endif // PLUGINS_USBPRO_ROBEDEVICE_H_
A class used to hold a single universe of DMX data.
Definition Plugin.h:38
The base class for all 1 argument callbacks.
Definition Callback.h:982
Definition Port.h:199
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
void DmxChanged()
Called when there is new data for this port.
Definition Port.cpp:83
Definition Port.h:283
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
Definition PluginAdaptor.h:41
Definition Universe.h:46
Definition RobeDevice.h:37
std::string DeviceId() const
The device ID.
Definition RobeDevice.h:44
Definition RobeDevice.h:56
std::string Description() const
Fetch the string description for a Port.
Definition RobeDevice.h:77
Definition RobeDevice.h:89
void SendRDMRequest(ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *callback)
Handle an RDMRequest, subclasses can implement this to support RDM.
Definition RobeDevice.h:96
RobeOutputPort(RobeDevice *parent, RobeWidget *widget)
Definition RobeDevice.cpp:57
void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition RobeDevice.h:105
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Definition RobeDevice.cpp:67
void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition RobeDevice.h:101
std::string Description() const
Fetch the string description for a Port.
Definition RobeDevice.h:93
Definition RobeWidget.h:116
void SendRDMRequest(ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *on_complete)
Send a RDM command.
Definition RobeWidget.h:133
void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
Start a full discovery operation.
Definition RobeWidget.h:138
void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
Start an incremental discovery operation.
Definition RobeWidget.h:142
Definition UsbSerialDevice.h:36
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
Callback0< ReturnType > * NewCallback(ReturnType(*callback)())
A helper function to create a new Callback with 0 create-time arguments and 0 execution time argument...
Definition Callback.h:211
The namespace containing all OLA symbols.
Definition Credentials.cpp:44