Open Lighting Architecture  0.9.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 "ola/DmxBuffer.h"
29 #include "ola/base/Macro.h"
30 #include "ola/thread/Mutex.h"
31 #include "plugins/usbdmx/Widget.h"
32 
33 namespace ola {
34 namespace plugin {
35 namespace usbdmx {
36 
40 class VellemanK8062: public BaseWidget {
41  public:
42  explicit VellemanK8062(LibUsbAdaptor *adaptor)
43  : BaseWidget(adaptor) {
44  }
45 };
46 
53  public:
60  libusb_device *usb_device);
61 
62  bool Init();
63 
64  bool SendDMX(const DmxBuffer &buffer);
65 
66  private:
67  libusb_device* const m_usb_device;
68  std::auto_ptr<class VellemanThreadedSender> m_sender;
69 
70  DISALLOW_COPY_AND_ASSIGN(SynchronousVellemanK8062);
71 };
72 
77  public:
84  libusb_device *usb_device);
85 
86  bool Init();
87 
88  bool SendDMX(const DmxBuffer &buffer);
89 
90  private:
91  std::auto_ptr<class VellemanAsyncUsbSender> m_sender;
92 
93  DISALLOW_COPY_AND_ASSIGN(AsynchronousVellemanK8062);
94 };
95 } // namespace usbdmx
96 } // namespace plugin
97 } // namespace ola
98 #endif // PLUGINS_USBDMX_VELLEMANK8062_H_