Open Lighting Architecture  Latest Git
FtdiDmxPlugin.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  * FtdiDmxPlugin.h
17  * The FTDI usb chipset DMX plugin for ola
18  * Copyright (C) 2011 Rui Barreiros
19  */
20 
21 #ifndef PLUGINS_FTDIDMX_FTDIDMXPLUGIN_H_
22 #define PLUGINS_FTDIDMX_FTDIDMXPLUGIN_H_
23 
24 #include <set>
25 #include <string>
26 #include <vector>
27 
28 #include "olad/Plugin.h"
29 #include "ola/plugin_id.h"
30 
31 #include "plugins/ftdidmx/FtdiDmxDevice.h"
32 
33 namespace ola {
34 namespace plugin {
35 namespace ftdidmx {
36 
37 
38 class FtdiDmxPlugin : public Plugin {
39  public:
40  explicit FtdiDmxPlugin(ola::PluginAdaptor *plugin_adaptor)
41  : Plugin(plugin_adaptor) {
42  }
43 
44  ola_plugin_id Id() const { return OLA_PLUGIN_FTDIDMX; }
45  std::string Name() const { return PLUGIN_NAME; }
46  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
47  // This plugin is disabled unless explicitly enabled by a user.
48  bool DefaultMode() const { return false; }
49 
50  void ConflictsWith(std::set<ola_plugin_id> *conflict_set) const {
51  conflict_set->insert(ola::OLA_PLUGIN_USBPRO);
52  conflict_set->insert(ola::OLA_PLUGIN_OPENDMX);
53  }
54 
55  std::string Description() const;
56 
57  private:
58  typedef std::vector<FtdiDmxDevice*> FtdiDeviceVector;
59  FtdiDeviceVector m_devices;
60 
61  void AddDevice(FtdiDmxDevice *device);
62  bool StartHook();
63  bool StopHook();
64  bool SetDefaultPreferences();
65 
66  static const uint8_t DEFAULT_FREQUENCY = 30;
67 
68  static const char K_FREQUENCY[];
69  static const char PLUGIN_NAME[];
70  static const char PLUGIN_PREFIX[];
71 };
72 } // namespace ftdidmx
73 } // namespace plugin
74 } // namespace ola
75 #endif // PLUGINS_FTDIDMX_FTDIDMXPLUGIN_H_
std::string Description() const
Return a description for this plugin.
Definition: FtdiDmxPlugin.cpp:102
Definition: Plugin.h:118
Definition: PluginAdaptor.h:41
Definition: FtdiDmxPlugin.h:38
Definition: FtdiDmxDevice.h:40
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition: FtdiDmxPlugin.h:46
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
std::string Name() const
Get the plugin name.
Definition: FtdiDmxPlugin.h:45
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition: FtdiDmxPlugin.h:44