Open Lighting Architecture: plugins/usbpro/UsbSerialPlugin.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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
32namespace ola {
33namespace plugin {
34namespace usbpro {
35
36 class UsbSerialPlugin: public ola::Plugin, public NewWidgetHandler {
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_
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::Plugin
Definition Plugin.h:118
ola::Plugin::SetDefaultPreferences
virtual bool SetDefaultPreferences()
Definition Plugin.h:159
ola::plugin::usbpro::ArduinoWidget
Definition ArduinoWidget.h:90
ola::plugin::usbpro::DmxTriWidget
Definition DmxTriWidget.h:218
ola::plugin::usbpro::DmxterWidget
Definition DmxterWidget.h:131
ola::plugin::usbpro::EnttecUsbProWidget
Definition EnttecUsbProWidget.h:83
ola::plugin::usbpro::NewWidgetHandler
Definition WidgetDetectorThread.h:52
ola::plugin::usbpro::RobeWidget
Definition RobeWidget.h:116
ola::plugin::usbpro::RobeWidgetInformation
Definition RobeWidgetDetector.h:40
ola::plugin::usbpro::UltraDMXProWidget
Definition UltraDMXProWidget.h:38
ola::plugin::usbpro::UsbProWidgetInformation
Definition UsbProWidgetDetector.h:41
ola::plugin::usbpro::UsbSerialDevice
Definition UsbSerialDevice.h:36
ola::plugin::usbpro::UsbSerialPlugin::NewWidget
void NewWidget(ArduinoWidget *widget, const UsbProWidgetInformation &information)
Definition UsbSerialPlugin.cpp:142
ola::plugin::usbpro::UsbSerialPlugin::PluginPrefix
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition UsbSerialPlugin.h:44
ola::plugin::usbpro::UsbSerialPlugin::Name
std::string Name() const
Get the plugin name.
Definition UsbSerialPlugin.h:40
ola::plugin::usbpro::UsbSerialPlugin::Description
std::string Description() const
Definition UsbSerialPlugin.cpp:77
ola::plugin::usbpro::UsbSerialPlugin::Id
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition UsbSerialPlugin.h:42
ola::plugin::usbpro::WidgetDetectorThread
Definition WidgetDetectorThread.h:74
Descriptor.h
ola::plugin::usbpro
Code for Enttec USB Pro devices and others using the same protocol.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44