Open Lighting Architecture: plugins/uartdmx/UartDmxPlugin.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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
34namespace ola {
35namespace plugin {
36namespace 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 UartDmxPlugin(const UartDmxPlugin &) = delete;
69 const UartDmxPlugin &operator=(const UartDmxPlugin &) = delete;
70};
71} // namespace uartdmx
72} // namespace plugin
73} // namespace ola
74#endif // PLUGINS_UARTDMX_UARTDMXPLUGIN_H_
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::Plugin::SetDefaultPreferences
virtual bool SetDefaultPreferences()
Definition Plugin.h:159
ola::plugin::uartdmx::UartDmxPlugin::Name
std::string Name() const
Get the plugin name.
Definition UartDmxPlugin.h:45
ola::plugin::uartdmx::UartDmxPlugin::Description
std::string Description() const
Definition UartDmxPlugin.cpp:117
ola::plugin::uartdmx::UartDmxPlugin::PluginPrefix
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition UartDmxPlugin.h:46
ola::plugin::uartdmx::UartDmxPlugin::Id
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition UartDmxPlugin.h:44
ola::plugin::uartdmx
Code for UART DMX devices.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44