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

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
ScanlimeFadecandy.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 * ScanlimeFadecandy.h
17 * The synchronous and asynchronous Fadecandy widgets.
18 * Copyright (C) 2014 Simon Newton
19 */
20
21#ifndef PLUGINS_USBDMX_SCANLIMEFADECANDY_H_
22#define PLUGINS_USBDMX_SCANLIMEFADECANDY_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
49 class ScanlimeFadecandy: public SimpleWidget {
50 public:
51 ScanlimeFadecandy(ola::usb::LibUsbAdaptor *adaptor,
52 libusb_device *usb_device,
53 const std::string &serial)
54 : SimpleWidget(adaptor, usb_device),
55 m_serial(serial) {
56 }
57
62 std::string SerialNumber() const {
63 return m_serial;
64 }
65
66 private:
67 std::string m_serial;
68};
69
75 class SynchronousScanlimeFadecandy: public ScanlimeFadecandy {
76 public:
83 SynchronousScanlimeFadecandy(ola::usb::LibUsbAdaptor *adaptor,
84 libusb_device *usb_device,
85 const std::string &serial);
86
87 bool Init();
88
89 bool SendDMX(const DmxBuffer &buffer);
90
91 private:
92 std::auto_ptr<class FadecandyThreadedSender> m_sender;
93
94 SynchronousScanlimeFadecandy(const SynchronousScanlimeFadecandy &) = delete;
95 const SynchronousScanlimeFadecandy &operator=(const SynchronousScanlimeFadecandy &) = delete;
96};
97
101 class AsynchronousScanlimeFadecandy : public ScanlimeFadecandy {
102 public:
109 AsynchronousScanlimeFadecandy(ola::usb::LibUsbAdaptor *adaptor,
110 libusb_device *usb_device,
111 const std::string &serial);
112
113 bool Init();
114
115 bool SendDMX(const DmxBuffer &buffer);
116
117 private:
118 std::auto_ptr<class FadecandyAsyncUsbSender> m_sender;
119
120 AsynchronousScanlimeFadecandy(const AsynchronousScanlimeFadecandy &) = delete;
121 const AsynchronousScanlimeFadecandy &operator=(const AsynchronousScanlimeFadecandy &) = delete;
122};
123} // namespace usbdmx
124} // namespace plugin
125} // namespace ola
126#endif // PLUGINS_USBDMX_SCANLIMEFADECANDY_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::AsynchronousScanlimeFadecandy::AsynchronousScanlimeFadecandy
AsynchronousScanlimeFadecandy(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new AsynchronousScanlimeFadecandy.
Definition ScanlimeFadecandy.cpp:330
ola::plugin::usbdmx::AsynchronousScanlimeFadecandy::SendDMX
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition ScanlimeFadecandy.cpp:342
ola::plugin::usbdmx::AsynchronousScanlimeFadecandy::Init
bool Init()
Initialize the widget.
Definition ScanlimeFadecandy.cpp:338
ola::plugin::usbdmx::ScanlimeFadecandy::SerialNumber
std::string SerialNumber() const
Get the serial number of this widget.
Definition ScanlimeFadecandy.h:62
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::SynchronousScanlimeFadecandy::SynchronousScanlimeFadecandy
SynchronousScanlimeFadecandy(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new SynchronousScanlimeFadecandy.
Definition ScanlimeFadecandy.cpp:248
ola::plugin::usbdmx::SynchronousScanlimeFadecandy::Init
bool Init()
Initialize the widget.
Definition ScanlimeFadecandy.cpp:255
ola::plugin::usbdmx::SynchronousScanlimeFadecandy::SendDMX
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition ScanlimeFadecandy.cpp:278
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