Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
SyncPluginImpl.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 * SyncPluginImpl.h
17 * The synchronous implementation of the USB DMX plugin.
18 * Copyright (C) 2010 Simon Newton
19 */
20
21#ifndef PLUGINS_USBDMX_SYNCPLUGINIMPL_H_
22#define PLUGINS_USBDMX_SYNCPLUGINIMPL_H_
23
24#include <libusb.h>
25#include <map>
26#include <set>
27#include <string>
28#include <utility>
29#include <vector>
30
31#include "libs/usb/LibUsbAdaptor.h"
32#include "ola/base/Macro.h"
33#include "olad/Preferences.h"
34#include "plugins/usbdmx/PluginImplInterface.h"
35#include "plugins/usbdmx/Widget.h"
36#include "plugins/usbdmx/WidgetFactory.h"
37
38namespace ola {
39
40class Device;
41
42namespace plugin {
43namespace usbdmx {
44
54 public:
64 SyncPluginImpl(PluginAdaptor *plugin_adaptor,
65 Plugin *plugin,
66 unsigned int debug_level,
67 Preferences *preferences);
68
70
71 bool Start();
72 bool Stop();
73
74 bool NewWidget(class AnymauDMX *widget);
75 bool NewWidget(class DMXCProjectsNodleU1 *widget);
76 bool NewWidget(class EurolitePro *widget);
78 bool NewWidget(class ScanlimeFadecandy *widget);
79 bool NewWidget(class Sunlite *widget);
80 bool NewWidget(class VellemanK8062 *widget);
81
82 void WidgetRemoved(OLA_UNUSED class AnymauDMX *widget) {}
83 void WidgetRemoved(OLA_UNUSED class DMXCProjectsNodleU1 *widget) {}
84 void WidgetRemoved(OLA_UNUSED class EurolitePro *widget) {}
85 void WidgetRemoved(OLA_UNUSED ola::usb::JaRuleWidget *widget) {}
86 void WidgetRemoved(OLA_UNUSED class ScanlimeFadecandy *widget) {}
87 void WidgetRemoved(OLA_UNUSED class Sunlite *widget) {}
88 void WidgetRemoved(OLA_UNUSED class VellemanK8062 *widget) {}
89
90 private:
91 typedef std::vector<class WidgetFactory*> WidgetFactories;
92 typedef std::map<class WidgetInterface*, Device*> WidgetToDeviceMap;
93
94 PluginAdaptor* const m_plugin_adaptor;
95 Plugin* const m_plugin;
96 const unsigned int m_debug_level;
98 Preferences* const m_preferences;
99 WidgetFactories m_widget_factories;
100
101 libusb_context *m_context;
102
103 WidgetToDeviceMap m_devices;
104 std::set<std::pair<uint8_t, uint8_t> > m_registered_devices;
105
106 unsigned int ScanForDevices();
107 void ReScanForDevices();
108 bool CheckDevice(libusb_device *device);
109
110 bool StartAndRegisterDevice(class WidgetInterface *widget, Device *device);
111
112 SyncPluginImpl(const SyncPluginImpl &) = delete;
113 const SyncPluginImpl &operator=(const SyncPluginImpl &) = delete;
114};
115} // namespace usbdmx
116} // namespace plugin
117} // namespace ola
118#endif // PLUGINS_USBDMX_SYNCPLUGINIMPL_H_
Helper macros.
#define OLA_UNUSED
Mark unused arguments & types.
Definition Macro.h:63
Definition Device.h:89
Definition PluginAdaptor.h:41
Definition Plugin.h:118
Definition Preferences.h:148
The base class for Anyma Widgets.
Definition AnymauDMX.h:41
The interface for the Nodle Widgets.
Definition DMXCProjectsNodleU1.h:43
The EurolitePro Widget.
Definition EurolitePro.h:42
The interface for an implementation of the USB DMX plugin.
Definition PluginImplInterface.h:40
The interface for the Fadecandy Widgets.
Definition ScanlimeFadecandy.h:49
The interface for the Sunlite Widgets.
Definition Sunlite.h:40
The legacy implementation.
Definition SyncPluginImpl.h:53
bool Stop()
Stop the implementation.
Definition SyncPluginImpl.cpp:107
SyncPluginImpl(PluginAdaptor *plugin_adaptor, Plugin *plugin, unsigned int debug_level, Preferences *preferences)
Create a new SyncPluginImpl.
Definition SyncPluginImpl.cpp:60
bool Start()
Start the implementation.
Definition SyncPluginImpl.cpp:82
bool NewWidget(class AnymauDMX *widget)
Called when a new AnymauDMX is added.
Definition SyncPluginImpl.cpp:123
The interface for the Velleman Widgets.
Definition VellemanK8062.h:41
The interface for a simple widget that supports a single universe of DMX.
Definition Widget.h:36
Receives notifications when Widgets are added or removed.
Definition WidgetFactory.h:49
A Ja Rule hardware device (widget).
Definition JaRuleWidget.h:57
A LibUsbAdaptor for use with Syncronous widgets.
Definition LibUsbAdaptor.h:540
The namespace containing all OLA symbols.
Definition Credentials.cpp:44