Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StageProfiPlugin.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  * StageProfiPlugin.h
17  * Interface for the stageprofi plugin class
18  * Copyright (C) 2006 Simon Newton
19  */
20 
21 #ifndef PLUGINS_STAGEPROFI_STAGEPROFIPLUGIN_H_
22 #define PLUGINS_STAGEPROFI_STAGEPROFIPLUGIN_H_
23 
24 #include <memory>
25 #include <map>
26 #include <string>
27 #include "olad/Plugin.h"
28 #include "ola/network/Socket.h"
29 #include "ola/plugin_id.h"
30 #include "plugins/stageprofi/StageProfiDetector.h"
31 
32 namespace ola {
33 namespace plugin {
34 namespace stageprofi {
35 
36 class StageProfiDevice;
37 
38 class StageProfiPlugin: public Plugin {
39  public:
40  explicit StageProfiPlugin(PluginAdaptor *plugin_adaptor)
41  : Plugin(plugin_adaptor) {}
43 
44  std::string Name() const { return PLUGIN_NAME; }
45  ola_plugin_id Id() const { return OLA_PLUGIN_STAGEPROFI; }
46  std::string Description() const;
47  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
48 
49  private:
50  typedef std::map<std::string, StageProfiDevice*> DeviceMap;
51 
52  DeviceMap m_devices;
53  std::auto_ptr<class StageProfiDetector> m_detector;
54 
55  bool StartHook();
56  bool StopHook();
57  bool SetDefaultPreferences();
58  void NewWidget(const std::string &widget_path,
59  ola::io::ConnectedDescriptor *descriptor);
60 
61  void DeviceRemoved(std::string widget_path);
62  void DeleteDevice(StageProfiDevice *device);
63 
64  static const char STAGEPROFI_DEVICE_PATH[];
65  static const char STAGEPROFI_DEVICE_NAME[];
66  static const char PLUGIN_NAME[];
67  static const char PLUGIN_PREFIX[];
68  static const char DEVICE_KEY[];
69 };
70 } // namespace stageprofi
71 } // namespace plugin
72 } // namespace ola
73 #endif // PLUGINS_STAGEPROFI_STAGEPROFIPLUGIN_H_