Open Lighting Architecture  Latest Git
UsbSerialPlugin.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  * UsbSerialPlugin.h
17  * Interface for the usbpro plugin class
18  * Copyright (C) 2006 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBPRO_USBSERIALPLUGIN_H_
22 #define PLUGINS_USBPRO_USBSERIALPLUGIN_H_
23 
24 #include <string>
25 #include <vector>
26 #include "ola/io/Descriptor.h"
27 #include "ola/plugin_id.h"
28 #include "olad/Plugin.h"
29 #include "plugins/usbpro/UsbSerialDevice.h"
30 #include "plugins/usbpro/WidgetDetectorThread.h"
31 
32 namespace ola {
33 namespace plugin {
34 namespace usbpro {
35 
37  public:
38  explicit UsbSerialPlugin(PluginAdaptor *plugin_adaptor);
39 
40  std::string Name() const { return PLUGIN_NAME; }
41  std::string Description() const;
42  ola_plugin_id Id() const { return OLA_PLUGIN_USBPRO; }
43  void DeviceRemoved(UsbSerialDevice *device);
44  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
45 
46  void NewWidget(ArduinoWidget *widget,
47  const UsbProWidgetInformation &information);
48  void NewWidget(EnttecUsbProWidget *widget,
49  const UsbProWidgetInformation &information);
50  void NewWidget(DmxTriWidget *widget,
51  const UsbProWidgetInformation &information);
52  void NewWidget(DmxterWidget *widget,
53  const UsbProWidgetInformation &information);
54  void NewWidget(RobeWidget *widget,
55  const RobeWidgetInformation &information);
56  void NewWidget(UltraDMXProWidget *widget,
57  const UsbProWidgetInformation &information);
58 
59  private:
60  void AddDevice(UsbSerialDevice *device);
61  bool StartHook();
62  bool StopHook();
63  bool SetDefaultPreferences();
64  void DeleteDevice(UsbSerialDevice *device);
65  std::string GetDeviceName(const UsbProWidgetInformation &information);
66  unsigned int GetProFrameLimit();
67  unsigned int GetDmxTriFrameLimit();
68  unsigned int GetUltraDMXProFrameLimit();
69 
70  std::vector<UsbSerialDevice*> m_devices; // list of our devices
71  WidgetDetectorThread m_detector_thread;
72 
73  static const char DEFAULT_DEVICE_DIR[];
74  static const char DEVICE_DIR_KEY[];
75  static const char DEVICE_PREFIX_KEY[];
76  static const char IGNORED_DEVICES_KEY[];
77  static const char LINUX_DEVICE_PREFIX[];
78  static const char BSD_DEVICE_PREFIX[];
79  static const char MAC_DEVICE_PREFIX[];
80  static const char PLUGIN_NAME[];
81  static const char PLUGIN_PREFIX[];
82  static const char ROBE_DEVICE_NAME[];
83  static const char TRI_USE_RAW_RDM_KEY[];
84  static const char USBPRO_DEVICE_NAME[];
85  static const char USB_PRO_FPS_LIMIT_KEY[];
86  static const char ULTRA_FPS_LIMIT_KEY[];
87 
88  static const uint8_t DEFAULT_PRO_FPS_LIMIT = 190;
89  static const uint8_t DEFAULT_ULTRA_FPS_LIMIT = 40;
90  static const unsigned int MAX_PRO_FPS_LIMIT = 1000;
91  static const unsigned int MAX_ULTRA_FPS_LIMIT = 1000;
92 };
93 } // namespace usbpro
94 } // namespace plugin
95 } // namespace ola
96 #endif // PLUGINS_USBPRO_USBSERIALPLUGIN_H_
std::string Name() const
Get the plugin name.
Definition: UsbSerialPlugin.h:40
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition: UsbSerialPlugin.h:44
Definition: RobeWidget.h:115
void NewWidget(ArduinoWidget *widget, const UsbProWidgetInformation &information)
Definition: UsbSerialPlugin.cpp:108
Definition: UsbSerialPlugin.h:36
Definition: RobeWidgetDetector.h:40
Definition: Plugin.h:118
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition: UsbSerialPlugin.h:42
Definition: PluginAdaptor.h:41
Definition: UltraDMXProWidget.h:38
Definition: DmxterWidget.h:130
Definition: ArduinoWidget.h:89
Definition: UsbSerialDevice.h:36
std::string Description() const
Definition: UsbSerialPlugin.cpp:78
Definition: WidgetDetectorThread.h:74
Definition: EnttecUsbProWidget.h:83
Definition: DmxTriWidget.h:217
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: UsbProWidgetDetector.h:41
Definition: WidgetDetectorThread.h:52