Open Lighting Architecture  Latest Git
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 "libs/usb/LibUsbAdaptor.h"
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 
37 class EuroliteProThreadedSender;
38 
42 class EurolitePro : public SimpleWidget {
43  public:
52  libusb_device *usb_device,
53  const std::string &serial,
54  bool is_mk2)
55  : SimpleWidget(adaptor, usb_device),
56  m_is_mk2(is_mk2),
57  m_serial(serial) {}
58 
63  std::string SerialNumber() const {
64  return m_serial;
65  }
66 
67  protected:
68  bool m_is_mk2;
69 
70  private:
71  std::string m_serial;
72 };
73 
74 
81  public:
90  libusb_device *usb_device,
91  const std::string &serial,
92  bool is_mk2);
93 
94  bool Init();
95 
96  bool SendDMX(const DmxBuffer &buffer);
97 
98  private:
99  std::auto_ptr<class EuroliteProThreadedSender> m_sender;
100 
102 };
103 
108  public:
117  libusb_device *usb_device,
118  const std::string &serial,
119  bool is_mk2);
120 
121  bool Init();
122 
123  bool SendDMX(const DmxBuffer &buffer);
124 
125  private:
126  std::auto_ptr<class EuroliteProAsyncUsbSender> m_sender;
127 
129 };
130 } // namespace usbdmx
131 } // namespace plugin
132 } // namespace ola
133 #endif // PLUGINS_USBDMX_EUROLITEPRO_H_
The EurolitePro Widget.
Definition: EurolitePro.h:42
EurolitePro(ola::usb::LibUsbAdaptor *adaptor, libusb_device *usb_device, const std::string &serial, bool is_mk2)
Create a new EurolitePro.
Definition: EurolitePro.h:51
virtual bool SendDMX(const DmxBuffer &buffer)=0
Send DMX data from this widget.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
virtual bool Init()=0
Initialize the widget.
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
A class used to hold a single universe of DMX data.
A base simple widget class.
Definition: Widget.h:66
Helper macros.
An EurolitePro widget that uses synchronous libusb operations.
Definition: EurolitePro.h:80
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
std::string SerialNumber() const
Get the serial number of this widget.
Definition: EurolitePro.h:63
An EurolitePro widget that uses asynchronous libusb operations.
Definition: EurolitePro.h:107
Wraps calls to libusb so we can test the code.
Definition: LibUsbAdaptor.h:36