Open Lighting Architecture: plugins/usbdmx/AnymauDMX.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
AnymauDMX.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 * AnymauDMX.h
17 * The synchronous and asynchronous Anyma uDMX widgets.
18 * Copyright (C) 2014 Simon Newton
19 */
20
21#ifndef PLUGINS_USBDMX_ANYMAUDMX_H_
22#define PLUGINS_USBDMX_ANYMAUDMX_H_
23
24#include <libusb.h>
25#include <memory>
26#include <string>
27
28#include "libs/usb/LibUsbAdaptor.h"
29#include "ola/DmxBuffer.h"
30#include "ola/base/Macro.h"
31#include "ola/thread/Mutex.h"
32#include "plugins/usbdmx/Widget.h"
33
34namespace ola {
35namespace plugin {
36namespace usbdmx {
37
41 class AnymauDMX: public SimpleWidget {
42 public:
49 AnymauDMX(ola::usb::LibUsbAdaptor *adaptor,
50 libusb_device *usb_device,
51 const std::string &serial)
52 : SimpleWidget(adaptor, usb_device),
53 m_serial(serial) {}
54
55 virtual ~AnymauDMX() {}
56
61 std::string SerialNumber() const {
62 return m_serial;
63 }
64
65 private:
66 std::string m_serial;
67};
68
74 class SynchronousAnymauDMX: public AnymauDMX {
75 public:
82 SynchronousAnymauDMX(ola::usb::LibUsbAdaptor *adaptor,
83 libusb_device *usb_device,
84 const std::string &serial);
85
86 bool Init();
87
88 bool SendDMX(const DmxBuffer &buffer);
89
90 private:
91 std::auto_ptr<class AnymaThreadedSender> m_sender;
92
93 SynchronousAnymauDMX(const SynchronousAnymauDMX &) = delete;
94 const SynchronousAnymauDMX &operator=(const SynchronousAnymauDMX &) = delete;
95};
96
100 class AsynchronousAnymauDMX : public AnymauDMX {
101 public:
108 AsynchronousAnymauDMX(ola::usb::LibUsbAdaptor *adaptor,
109 libusb_device *usb_device,
110 const std::string &serial);
111
112 bool Init();
113
114 bool SendDMX(const DmxBuffer &buffer);
115
116 private:
117 std::auto_ptr<class AnymaAsyncUsbSender> m_sender;
118
119 AsynchronousAnymauDMX(const AsynchronousAnymauDMX &) = delete;
120 const AsynchronousAnymauDMX &operator=(const AsynchronousAnymauDMX &) = delete;
121};
122} // namespace usbdmx
123} // namespace plugin
124} // namespace ola
125#endif // PLUGINS_USBDMX_ANYMAUDMX_H_
DmxBuffer.h
A class used to hold a single universe of DMX data.
Macro.h
Helper macros.
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::plugin::usbdmx::AnymauDMX
The base class for Anyma Widgets.
Definition AnymauDMX.h:41
ola::plugin::usbdmx::AnymauDMX::AnymauDMX
AnymauDMX(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new AnymauDMX.
Definition AnymauDMX.h:49
ola::plugin::usbdmx::AnymauDMX::SerialNumber
std::string SerialNumber() const
Get the serial number of this widget.
Definition AnymauDMX.h:61
ola::plugin::usbdmx::AsynchronousAnymauDMX::Init
bool Init()
Initialize the widget.
Definition AnymauDMX.cpp:173
ola::plugin::usbdmx::AsynchronousAnymauDMX::SendDMX
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition AnymauDMX.cpp:177
ola::plugin::usbdmx::AsynchronousAnymauDMX::AsynchronousAnymauDMX
AsynchronousAnymauDMX(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new AsynchronousAnymauDMX.
Definition AnymauDMX.cpp:165
ola::plugin::usbdmx::SimpleWidget::SimpleWidget
SimpleWidget(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device)
Create a new SimpleWidget.
Definition Widget.h:73
ola::plugin::usbdmx::SynchronousAnymauDMX::Init
bool Init()
Initialize the widget.
Definition AnymauDMX.cpp:94
ola::plugin::usbdmx::SynchronousAnymauDMX::SynchronousAnymauDMX
SynchronousAnymauDMX(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new SynchronousAnymauDMX.
Definition AnymauDMX.cpp:88
ola::plugin::usbdmx::SynchronousAnymauDMX::SendDMX
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition AnymauDMX.cpp:112
ola::usb::LibUsbAdaptor
Wraps calls to libusb so we can test the code.
Definition LibUsbAdaptor.h:36
ola::plugin::usbdmx
The plugin for hardware using libusb.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44