Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OPCPlugin.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  * OPCPlugin.h
17  * The Open Pixel Control Plugin.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_OPENPIXELCONTROL_OPCPLUGIN_H_
22 #define PLUGINS_OPENPIXELCONTROL_OPCPLUGIN_H_
23 
24 #include <string>
25 #include <vector>
26 #include "ola/plugin_id.h"
27 #include "olad/Device.h"
28 #include "olad/Plugin.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace openpixelcontrol {
33 
34 class OPCPlugin: public Plugin {
35  public:
36  explicit OPCPlugin(PluginAdaptor *plugin_adaptor)
37  : Plugin(plugin_adaptor) {}
38  ~OPCPlugin();
39 
40  std::string Name() const { return PLUGIN_NAME; }
41  ola_plugin_id Id() const { return OLA_PLUGIN_OPENPIXELCONTROL; }
42  std::string Description() const;
43  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
44 
45  private:
46  typedef std::vector<ola::Device*> OPCDevices;
47  OPCDevices m_devices;
48 
49  bool StartHook();
50  bool StopHook();
51  bool SetDefaultPreferences();
52 
53  template <typename DeviceClass>
54  void AddDevices(const std::string &key);
55 
56  static const char LISTEN_KEY[];
57  static const char PLUGIN_NAME[];
58  static const char PLUGIN_PREFIX[];
59  static const char TARGET_KEY[];
60 };
61 } // namespace openpixelcontrol
62 } // namespace plugin
63 } // namespace ola
64 #endif // PLUGINS_OPENPIXELCONTROL_OPCPLUGIN_H_