Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sunlite.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  * Sunlite.h
17  * The synchronous and asynchronous Sunlite widgets.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_SUNLITE_H_
22 #define PLUGINS_USBDMX_SUNLITE_H_
23 
24 #include <libusb.h>
25 #include <memory>
26 #include "ola/DmxBuffer.h"
27 #include "ola/base/Macro.h"
28 #include "ola/thread/Mutex.h"
29 #include "plugins/usbdmx/Widget.h"
30 
31 namespace ola {
32 namespace plugin {
33 namespace usbdmx {
34 
35 class SunliteThreadedSender;
36 
40 class Sunlite : public BaseWidget {
41  public:
42  explicit Sunlite(LibUsbAdaptor *adaptor)
43  : BaseWidget(adaptor) {
44  }
45 };
46 
47 
53 class SynchronousSunlite: public Sunlite {
54  public:
61  libusb_device *usb_device);
62 
63  bool Init();
64 
65  bool SendDMX(const DmxBuffer &buffer);
66 
67  private:
68  libusb_device* const m_usb_device;
69  std::auto_ptr<class SunliteThreadedSender> m_sender;
70 
71  DISALLOW_COPY_AND_ASSIGN(SynchronousSunlite);
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 SunliteAsyncUsbSender> m_sender;
93 
94  DISALLOW_COPY_AND_ASSIGN(AsynchronousSunlite);
95 };
96 } // namespace usbdmx
97 } // namespace plugin
98 } // namespace ola
99 #endif // PLUGINS_USBDMX_SUNLITE_H_