Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VellemanK8062.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  * VellemanK8062.h
17  * The synchronous and asynchronous Velleman widgets.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_VELLEMANK8062_H_
22 #define PLUGINS_USBDMX_VELLEMANK8062_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 
41 class VellemanK8062: public SimpleWidget {
42  public:
43  explicit VellemanK8062(ola::usb::LibUsbAdaptor *adaptor,
44  libusb_device *usb_device)
45  : SimpleWidget(adaptor, usb_device) {
46  }
47 };
48 
55  public:
62  libusb_device *usb_device);
63 
64  bool Init();
65 
66  bool SendDMX(const DmxBuffer &buffer);
67 
68  private:
69  std::auto_ptr<class VellemanThreadedSender> m_sender;
70 
71  DISALLOW_COPY_AND_ASSIGN(SynchronousVellemanK8062);
72 };
73 
78  public:
85  libusb_device *usb_device);
86 
87  bool Init();
88 
89  bool SendDMX(const DmxBuffer &buffer);
90 
91  private:
92  std::auto_ptr<class VellemanAsyncUsbSender> m_sender;
93 
94  DISALLOW_COPY_AND_ASSIGN(AsynchronousVellemanK8062);
95 };
96 } // namespace usbdmx
97 } // namespace plugin
98 } // namespace ola
99 #endif // PLUGINS_USBDMX_VELLEMANK8062_H_
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition: VellemanK8062.cpp:323
bool SendDMX(const DmxBuffer &buffer)
Send DMX data from this widget.
Definition: VellemanK8062.cpp:511
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
bool Init()
Initialize the widget.
Definition: VellemanK8062.cpp:507
A class used to hold a single universe of DMX data.
A base simple widget class.
Definition: Widget.h:66
An Velleman widget that uses synchronous libusb operations.
Definition: VellemanK8062.h:54
bool Init()
Initialize the widget.
Definition: VellemanK8062.cpp:304
The interface for the Velleman Widgets.
Definition: VellemanK8062.h:41
Helper macros.
AsynchronousVellemanK8062(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device)
Create a new AsynchronousVellemanK8062.
Definition: VellemanK8062.cpp:500
SimpleWidget(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device)
Create a new SimpleWidget.
Definition: Widget.h:73
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
SynchronousVellemanK8062(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device)
Create a new SynchronousVellemanK8062.
Definition: VellemanK8062.cpp:298
An Velleman widget that uses asynchronous libusb operations.
Definition: VellemanK8062.h:77
Wraps calls to libusb so we can test the code.
Definition: LibUsbAdaptor.h:36