Open Lighting Architecture  Latest Git
UsbDmxPlugin.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  * UsbDmxPlugin.h
17  * A plugin that uses libusb to communicate with USB devices.
18  * Copyright (C) 2010 Simon Newton
19  */
20 
21 #ifndef PLUGINS_USBDMX_USBDMXPLUGIN_H_
22 #define PLUGINS_USBDMX_USBDMXPLUGIN_H_
23 
24 #include <memory>
25 #include <set>
26 #include <string>
27 #include "ola/base/Macro.h"
28 #include "ola/plugin_id.h"
29 #include "olad/Plugin.h"
30 
31 namespace ola {
32 namespace plugin {
33 namespace usbdmx {
34 
49 class UsbDmxPlugin: public ola::Plugin {
50  public:
56  explicit UsbDmxPlugin(PluginAdaptor *plugin_adaptor);
57  ~UsbDmxPlugin();
58 
59  std::string Name() const { return PLUGIN_NAME; }
60  std::string Description() const;
61  ola_plugin_id Id() const { return OLA_PLUGIN_USBDMX; }
62  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
63 
64  void ConflictsWith(
65  std::set<ola_plugin_id>* conflicting_plugins) const;
66 
67  private:
68  std::auto_ptr<class PluginImplInterface> m_impl;
69 
70  bool StartHook();
71  bool StopHook();
72  bool SetDefaultPreferences();
73 
74  static const char PLUGIN_NAME[];
75  static const char PLUGIN_PREFIX[];
76  static const char LIBUSB_DEBUG_LEVEL_KEY[];
77  static int LIBUSB_DEFAULT_DEBUG_LEVEL;
78  static int LIBUSB_MAX_DEBUG_LEVEL;
79 
80  DISALLOW_COPY_AND_ASSIGN(UsbDmxPlugin);
81 };
82 } // namespace usbdmx
83 } // namespace plugin
84 } // namespace ola
85 #endif // PLUGINS_USBDMX_USBDMXPLUGIN_H_
Definition: Plugin.h:118
UsbDmxPlugin(PluginAdaptor *plugin_adaptor)
Create a new UsbDmxPlugin.
Definition: UsbDmxPlugin.cpp:49
Definition: PluginAdaptor.h:41
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition: UsbDmxPlugin.h:61
A plugin that uses libusb to communicate with USB devices.
Definition: UsbDmxPlugin.h:49
Helper macros.
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
std::string Name() const
Get the plugin name.
Definition: UsbDmxPlugin.h:59
std::string Description() const
Definition: UsbDmxPlugin.cpp:91
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition: UsbDmxPlugin.h:62