Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MilInstPlugin.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * MilInstPlugin.h
17  * Interface for the Milford Instruments plugin class
18  * Copyright (C) 2013 Peter Newman
19  */
20 
21 #ifndef PLUGINS_MILINST_MILINSTPLUGIN_H_
22 #define PLUGINS_MILINST_MILINSTPLUGIN_H_
23 
24 #include <string>
25 #include <vector>
26 
27 #include "ola/io/Descriptor.h"
28 #include "olad/Plugin.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace milinst {
33 
35 using std::string;
36 
37 class MilInstDevice;
38 
39 class MilInstPlugin: public Plugin {
40  public:
41  explicit MilInstPlugin(PluginAdaptor *plugin_adaptor):
42  Plugin(plugin_adaptor) {}
43  ~MilInstPlugin() {}
44 
45  string Name() const { return PLUGIN_NAME; }
46  ola_plugin_id Id() const { return OLA_PLUGIN_MILINST; }
47  string Description() const;
48  int SocketClosed(ConnectedDescriptor *socket);
49  string PluginPrefix() const { return PLUGIN_PREFIX; }
50 
51  private:
52  bool StartHook();
53  bool StopHook();
54  bool SetDefaultPreferences();
55  void DeleteDevice(MilInstDevice *device);
56 
57  std::vector<MilInstDevice*> m_devices; // list of our devices
58 
59  static const char MILINST_DEVICE_PATH[];
60  static const char MILINST_BASE_DEVICE_NAME[];
61  static const char MILINST_1463_DEVICE_NAME[];
62  static const char PLUGIN_NAME[];
63  static const char PLUGIN_PREFIX[];
64  static const char DEVICE_KEY[];
65 };
66 } // namespace milinst
67 } // namespace plugin
68 } // namespace ola
69 #endif // PLUGINS_MILINST_MILINSTPLUGIN_H_