Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
UartDmxPlugin.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  * UartDmxPlugin.h
17  * The DMX through a UART plugin for ola
18  * Copyright (C) 2011 Rui Barreiros
19  * Copyright (C) 2014 Richard Ash
20  */
21 
22 #ifndef PLUGINS_UARTDMX_UARTDMXPLUGIN_H_
23 #define PLUGINS_UARTDMX_UARTDMXPLUGIN_H_
24 
25 #include <set>
26 #include <string>
27 #include <vector>
28 
29 #include "olad/Plugin.h"
30 #include "ola/plugin_id.h"
31 
32 #include "plugins/uartdmx/UartDmxDevice.h"
33 
34 namespace ola {
35 namespace plugin {
36 namespace uartdmx {
37 
38 class UartDmxPlugin : public Plugin {
39  public:
40  explicit UartDmxPlugin(ola::PluginAdaptor *plugin_adaptor)
41  : Plugin(plugin_adaptor) {
42  }
43 
44  ola_plugin_id Id() const { return OLA_PLUGIN_UARTDMX; }
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  std::string Description() const;
51 
52  private:
53  typedef std::vector<UartDmxDevice*> UartDeviceVector;
54  UartDeviceVector m_devices;
55 
56  void AddDevice(UartDmxDevice *device);
57  bool StartHook();
58  bool StopHook();
59  bool SetDefaultPreferences();
60  unsigned int GetBreak();
61  unsigned int GetMalf();
62 
63  static const char PLUGIN_NAME[];
64  static const char PLUGIN_PREFIX[];
65  static const char K_DEVICE[];
66  static const char DEFAULT_DEVICE[];
67 
68  DISALLOW_COPY_AND_ASSIGN(UartDmxPlugin);
69 };
70 } // namespace uartdmx
71 } // namespace plugin
72 } // namespace ola
73 #endif // PLUGINS_UARTDMX_UARTDMXPLUGIN_H_
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition: UartDmxPlugin.h:44
Definition: UartDmxPlugin.h:38
Definition: Plugin.h:118
Definition: PluginAdaptor.h:41
std::string Name() const
Get the plugin name.
Definition: UartDmxPlugin.h:45
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition: UartDmxPlugin.h:46
std::string Description() const
Definition: UartDmxPlugin.cpp:118
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44