Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EurolitePro.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  * EurolitePro.h
17  * The synchronous and asynchronous EurolitePro widgets.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_EUROLITEPRO_H_
22 #define PLUGINS_USBDMX_EUROLITEPRO_H_
23 
24 #include <libusb.h>
25 #include <memory>
26 #include <string>
27 #include "ola/DmxBuffer.h"
28 #include "ola/base/Macro.h"
29 #include "ola/thread/Mutex.h"
30 #include "plugins/usbdmx/Widget.h"
31 
32 namespace ola {
33 namespace plugin {
34 namespace usbdmx {
35 
36 class EuroliteProThreadedSender;
37 
41 class EurolitePro : public BaseWidget {
42  public:
49  const std::string &serial)
50  : BaseWidget(adaptor),
51  m_serial(serial) {}
52 
57  std::string SerialNumber() const {
58  return m_serial;
59  }
60 
61  private:
62  std::string m_serial;
63 };
64 
65 
72  public:
80  libusb_device *usb_device,
81  const std::string &serial);
82 
83  bool Init();
84 
85  bool SendDMX(const DmxBuffer &buffer);
86 
87  private:
88  libusb_device* const m_usb_device;
89  std::auto_ptr<class EuroliteProThreadedSender> m_sender;
90 
91  DISALLOW_COPY_AND_ASSIGN(SynchronousEurolitePro);
92 };
93 
98  public:
105  AsynchronousEurolitePro(class LibUsbAdaptor *adaptor,
106  libusb_device *usb_device,
107  const std::string &serial);
108 
109  bool Init();
110 
111  bool SendDMX(const DmxBuffer &buffer);
112 
113  private:
114  std::auto_ptr<class EuroliteProAsyncUsbSender> m_sender;
115 
116  DISALLOW_COPY_AND_ASSIGN(AsynchronousEurolitePro);
117 };
118 } // namespace usbdmx
119 } // namespace plugin
120 } // namespace ola
121 #endif // PLUGINS_USBDMX_EUROLITEPRO_H_