Open Lighting Architecture: plugins/osc/OSCPlugin.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
OSCPlugin.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 * OSCPlugin.h
17 * Interface for the OSC plugin.
18 * Copyright (C) 2012 Simon Newton
19 */
20
21#ifndef PLUGINS_OSC_OSCPLUGIN_H_
22#define PLUGINS_OSC_OSCPLUGIN_H_
23
24#include <string>
25#include "olad/Plugin.h"
26#include "ola/plugin_id.h"
27#include "plugins/osc/OSCDevice.h"
28#include "plugins/osc/OSCTarget.h"
29
30namespace ola {
31namespace plugin {
32namespace osc {
33
34class OSCDevice;
35
36 class OSCPlugin: public ola::Plugin {
37 public:
38 explicit OSCPlugin(ola::PluginAdaptor *plugin_adaptor):
39 ola::Plugin(plugin_adaptor),
40 m_device(NULL) {}
41
42 std::string Name() const { return PLUGIN_NAME; }
43 std::string Description() const;
44 ola_plugin_id Id() const { return OLA_PLUGIN_OSC; }
45 std::string PluginPrefix() const { return PLUGIN_PREFIX; }
46
47 private:
48 bool StartHook();
49 bool StopHook();
50 bool SetDefaultPreferences();
51
52 unsigned int GetPortCount(const std::string &key) const;
53 bool ExtractOSCTarget(const std::string &str, OSCTarget *target);
54 void SetDataFormat(const std::string &format_option,
55 OSCDevice::PortConfig *port_config);
56
57 OSCDevice *m_device;
58 static const uint8_t DEFAULT_PORT_COUNT = 5;
59 static const uint16_t DEFAULT_UDP_PORT = 7770;
60
61 static const char DEFAULT_ADDRESS_TEMPLATE[];
62 static const char DEFAULT_TARGETS_TEMPLATE[];
63 static const char INPUT_PORT_COUNT_KEY[];
64 static const char OUTPUT_PORT_COUNT_KEY[];
65 static const char PLUGIN_NAME[];
66 static const char PLUGIN_PREFIX[];
67 static const char PORT_ADDRESS_TEMPLATE[];
68 static const char PORT_TARGETS_TEMPLATE[];
69 static const char PORT_FORMAT_TEMPLATE[];
70 static const char UDP_PORT_KEY[];
71
72 static const char BLOB_FORMAT[];
73 static const char FLOAT_ARRAY_FORMAT[];
74 static const char FLOAT_INDIVIDUAL_FORMAT[];
75 static const char INT_ARRAY_FORMAT[];
76 static const char INT_INDIVIDUAL_FORMAT[];
77};
78} // namespace osc
79} // namespace plugin
80} // namespace ola
81#endif // PLUGINS_OSC_OSCPLUGIN_H_
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::Plugin
Definition Plugin.h:118
ola::Plugin::SetDefaultPreferences
virtual bool SetDefaultPreferences()
Definition Plugin.h:159
ola::plugin::osc::OSCDevice
Definition OSCDevice.h:40
ola::plugin::osc::OSCPlugin::Name
std::string Name() const
Get the plugin name.
Definition OSCPlugin.h:42
ola::plugin::osc::OSCPlugin::Description
std::string Description() const
Definition OSCPlugin.cpp:131
ola::plugin::osc::OSCPlugin::Id
ola_plugin_id Id() const
Get the plugin ID of this plugin.
Definition OSCPlugin.h:44
ola::plugin::osc::OSCPlugin::PluginPrefix
std::string PluginPrefix() const
The prefix to use for storing configuration files.
Definition OSCPlugin.h:45
ola::plugin::osc
Code for the OSC protocol.
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::plugin::osc::OSCDevice::PortConfig
Definition OSCDevice.h:42
ola::plugin::osc::OSCTarget
Definition OSCTarget.h:31