Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DMXCreator512Basic.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  * DMXCreator512Basic.h
17  * The synchronous and asynchronous DMXCreator512Basic widgets.
18  * Copyright (C) 2016 Florian Edelmann
19  */
20 
21 #ifndef PLUGINS_USBDMX_DMXCREATOR512BASIC_H_
22 #define PLUGINS_USBDMX_DMXCREATOR512BASIC_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 
34 namespace ola {
35 namespace plugin {
36 namespace usbdmx {
37 
42  public:
50  libusb_device *usb_device,
51  const std::string &serial)
52  : SimpleWidget(adaptor, usb_device),
53  m_serial(serial) {}
54 
55  virtual ~DMXCreator512Basic() {}
56 
61  std::string SerialNumber() const {
62  return m_serial;
63  }
64 
65  private:
66  std::string m_serial;
67 };
68 
75  public:
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 DMXCreator512BasicThreadedSender> m_sender;
92 
93  DISALLOW_COPY_AND_ASSIGN(SynchronousDMXCreator512Basic);
94 };
95 
100  public:
108  libusb_device *usb_device,
109  const std::string &serial);
110 
111  bool Init();
112 
113  bool SendDMX(const DmxBuffer &buffer);
114 
115  private:
116  std::auto_ptr<class DMXCreator512BasicAsyncUsbSender> m_sender;
117 
118  DISALLOW_COPY_AND_ASSIGN(AsynchronousDMXCreator512Basic);
119 };
120 } // namespace usbdmx
121 } // namespace plugin
122 } // namespace ola
123 #endif // PLUGINS_USBDMX_DMXCREATOR512BASIC_H_
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
bool Init()
Initialize the widget.
Definition: DMXCreator512Basic.cpp:160
bool Init()
Initialize the widget.
Definition: DMXCreator512Basic.cpp:266
A class used to hold a single universe of DMX data.
SynchronousDMXCreator512Basic(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new SynchronousDMXCreator512Basic.
Definition: DMXCreator512Basic.cpp:153
A base simple widget class.
Definition: Widget.h:66
An DMXCreator512Basic widget that uses asynchronous libusb operations.
Definition: DMXCreator512Basic.h:99
AsynchronousDMXCreator512Basic(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new AsynchronousDMXCreator512Basic.
Definition: DMXCreator512Basic.cpp:258
Helper macros.
DMXCreator512Basic(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial)
Create a new DMXCreator512Basic.
Definition: DMXCreator512Basic.h:49
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition: DMXCreator512Basic.cpp:270
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
An DMXCreator512Basic widget that uses synchronous libusb operations.
Definition: DMXCreator512Basic.h:74
std::string SerialNumber() const
Get the serial number of this widget.
Definition: DMXCreator512Basic.h:61
The base class for DMXCreator512Basic Widgets.
Definition: DMXCreator512Basic.h:41
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition: DMXCreator512Basic.cpp:179
Wraps calls to libusb so we can test the code.
Definition: LibUsbAdaptor.h:36