Open Lighting Architecture  Latest Git
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 
34 class MilInstDevice;
35 
36 class MilInstPlugin: public Plugin {
37  public:
38  explicit MilInstPlugin(PluginAdaptor *plugin_adaptor)
39  : Plugin(plugin_adaptor) {}
40 
41  ~MilInstPlugin() {}
42 
43  std::string Name() const { return PLUGIN_NAME; }
44  ola_plugin_id Id() const { return OLA_PLUGIN_MILINST; }
45  std::string Description() const;
46  int SocketClosed(ola::io::ConnectedDescriptor *socket);
47  std::string PluginPrefix() const { return PLUGIN_PREFIX; }
48 
49  private:
50  bool StartHook();
51  bool StopHook();
52  bool SetDefaultPreferences();
53  void DeleteDevice(MilInstDevice *device);
54 
55  std::vector<MilInstDevice*> m_devices; // list of our devices
56 
57  static const char MILINST_DEVICE_PATH[];
58  static const char PLUGIN_NAME[];
59  static const char PLUGIN_PREFIX[];
60  static const char DEVICE_KEY[];
61 };
62 } // namespace milinst
63 } // namespace plugin
64 } // namespace ola
65 #endif // PLUGINS_MILINST_MILINSTPLUGIN_H_
std::string Description() const
Definition: MilInstPlugin.cpp:99
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition: Descriptor.h:282
Definition: MilInstPlugin.h:36
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition: MilInstPlugin.h:44
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition: MilInstPlugin.h:47
Definition: Plugin.h:118
Definition: PluginAdaptor.h:41
std::string Name() const
Get the plugin name.
Definition: MilInstPlugin.h:43
Definition: MilInstDevice.h:36
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44