Open Lighting Architecture: include/ola/client/OlaClient.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
OlaClient.h
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library 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 GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * OlaClient.h
17 * This is the main client API to OLA.
18 * Copyright (C) 2010 Simon Newton
19 */
20
21#ifndef INCLUDE_OLA_CLIENT_OLACLIENT_H_
22#define INCLUDE_OLA_CLIENT_OLACLIENT_H_
23
24#include <ola/DmxBuffer.h>
25#include <ola/client/CallbackTypes.h>
26#include <ola/client/ClientArgs.h>
27#include <ola/client/ClientTypes.h>
28#include <ola/base/Macro.h>
29#include <ola/io/Descriptor.h>
30#include <ola/plugin_id.h>
31#include <ola/rdm/UID.h>
32#include <ola/rdm/UIDSet.h>
33#include <ola/timecode/TimeCode.h>
34
35#include <memory>
36#include <string>
37
38namespace ola {
39namespace client {
40
45 class OlaClient {
46 public:
47 explicit OlaClient(ola::io::ConnectedDescriptor *descriptor);
48 ~OlaClient();
49
50 /*
51 * @brief Setup this client.
52 * @returns true on success, false on failure
53 */
54 bool Setup();
55
56 /*
57 * @brief Close the ola connection.
58 * @return true on success, false on failure
59 */
60 bool Stop();
61
65 void SetCloseHandler(ola::SingleUseCallback0<void> *callback);
66
74 void SetDMXCallback(RepeatableDMXCallback *callback);
75
80 void ReloadPlugins(SetCallback *callback);
81
86 void FetchPluginList(PluginListCallback *callback);
87
94 void FetchPluginDescription(ola_plugin_id plugin_id,
95 PluginDescriptionCallback *callback);
96
104 void FetchPluginState(ola_plugin_id plugin_id,
105 PluginStateCallback *callback);
106
113 void FetchDeviceInfo(ola_plugin_id plugin_filter,
114 DeviceInfoCallback *callback);
115
120 void FetchCandidatePorts(CandidatePortsCallback *callback);
121
129 void FetchCandidatePorts(unsigned int universe_id,
130 CandidatePortsCallback *callback);
131
138 void SetPluginState(ola_plugin_id plugin_id,
139 bool state,
140 SetCallback *callback);
141
148 void ConfigureDevice(unsigned int device_alias,
149 const std::string &msg,
150 ConfigureDeviceCallback *callback);
151
159 void SetPortPriorityInherit(unsigned int device_alias,
160 unsigned int port,
161 PortDirection port_direction,
162 SetCallback *callback);
163
172 void SetPortPriorityOverride(unsigned int device_alias,
173 unsigned int port,
174 PortDirection port_direction,
175 uint8_t value,
176 SetCallback *callback);
177
182 void FetchUniverseList(UniverseListCallback *callback);
183
189 void FetchUniverseInfo(unsigned int universe,
190 UniverseInfoCallback *callback);
191
198 void SetUniverseName(unsigned int universe,
199 const std::string &name,
200 SetCallback *callback);
201
208 void SetUniverseMergeMode(unsigned int universe,
209 OlaUniverse::merge_mode mode,
210 SetCallback *callback);
211
221 void Patch(unsigned int device_alias,
222 unsigned int port,
223 PortDirection port_direction,
224 PatchAction action,
225 unsigned int universe,
226 SetCallback *callback);
227
237 void RegisterUniverse(unsigned int universe,
238 RegisterAction register_action,
239 SetCallback *callback);
240
247 void SendDMX(unsigned int universe,
248 const DmxBuffer &data,
249 const SendDMXArgs &args);
250
256 void FetchDMX(unsigned int universe, DMXCallback *callback);
257
264 void RunDiscovery(unsigned int universe,
265 DiscoveryType discovery_type,
266 DiscoveryCallback *callback);
267
273 void SetSourceUID(const ola::rdm::UID &uid, SetCallback *callback);
274
285 void RDMGet(unsigned int universe,
286 const ola::rdm::UID &uid,
287 uint16_t sub_device,
288 uint16_t pid,
289 const uint8_t *data,
290 unsigned int data_length,
291 const SendRDMArgs& args);
292
303 void RDMSet(unsigned int universe,
304 const ola::rdm::UID &uid,
305 uint16_t sub_device,
306 uint16_t pid,
307 const uint8_t *data,
308 unsigned int data_length,
309 const SendRDMArgs& args);
310
316 void SendTimeCode(const ola::timecode::TimeCode &timecode,
317 SetCallback *callback);
318
319 private:
320 std::auto_ptr<class OlaClientCore> m_core;
321
322 OlaClient(const OlaClient &) = delete;
323 const OlaClient &operator=(const OlaClient &) = delete;
324};
325} // namespace client
326} // namespace ola
327#endif // INCLUDE_OLA_CLIENT_OLACLIENT_H_
CallbackTypes.h
The various callbacks used with the OLA Client.
ClientArgs.h
Types used as arguments for the OLA Client.
ClientTypes.h
Types used as return values from the OLA Client.
DmxBuffer.h
A class used to hold a single universe of DMX data.
Macro.h
Helper macros.
UID.h
A RDM unique identifier (UID).
UIDSet.h
A set of UIDs.
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::SingleUseCallback0
A 0 argument callback which deletes itself after it's run.
Definition Callback.h:141
ola::client::OlaClient::SendTimeCode
void SendTimeCode(const ola::timecode::TimeCode &timecode, SetCallback *callback)
Send TimeCode data.
Definition OlaClient.cpp:182
ola::client::OlaClient::ReloadPlugins
void ReloadPlugins(SetCallback *callback)
Trigger a plugin reload.
Definition OlaClient.cpp:65
ola::client::OlaClient::FetchDMX
void FetchDMX(unsigned int universe, DMXCallback *callback)
Fetch the latest DMX data for a universe.
Definition OlaClient.cpp:167
ola::client::OlaClient::FetchDeviceInfo
void FetchDeviceInfo(ola_plugin_id plugin_filter, DeviceInfoCallback *callback)
Request a list of the available devices.
Definition OlaClient.cpp:83
ola::client::OlaClient::FetchPluginList
void FetchPluginList(PluginListCallback *callback)
Fetch the list of plugins loaded.
Definition OlaClient.cpp:69
ola::client::OlaClient::SetPluginState
void SetPluginState(ola_plugin_id plugin_id, bool state, SetCallback *callback)
Set the state of a plugin.
Definition OlaClient.cpp:103
ola::client::OlaClient::FetchCandidatePorts
void FetchCandidatePorts(CandidatePortsCallback *callback)
Request a list of ports that could be patched to new universe.
Definition OlaClient.cpp:88
ola::client::OlaClient::ConfigureDevice
void ConfigureDevice(unsigned int device_alias, const std::string &msg, ConfigureDeviceCallback *callback)
Send a device config request.
Definition OlaClient.cpp:97
ola::client::OlaClient::FetchUniverseList
void FetchUniverseList(UniverseListCallback *callback)
Request a list of universes.
Definition OlaClient.cpp:125
ola::client::OlaClient::SendDMX
void SendDMX(unsigned int universe, const DmxBuffer &data, const SendDMXArgs &args)
Send DMX data.
Definition OlaClient.cpp:161
ola::client::OlaClient::RunDiscovery
void RunDiscovery(unsigned int universe, DiscoveryType discovery_type, DiscoveryCallback *callback)
Trigger discovery for a universe.
Definition OlaClient.cpp:171
ola::client::OlaClient::SetPortPriorityOverride
void SetPortPriorityOverride(unsigned int device_alias, unsigned int port, PortDirection port_direction, uint8_t value, SetCallback *callback)
Set the priority for a port to override mode.
Definition OlaClient.cpp:116
ola::client::OlaClient::SetCloseHandler
void SetCloseHandler(ola::SingleUseCallback0< void > *callback)
Set the close handler.
Definition OlaClient.cpp:57
ola::client::OlaClient::FetchPluginState
void FetchPluginState(ola_plugin_id plugin_id, PluginStateCallback *callback)
Fetch the state of a plugin.
Definition OlaClient.cpp:78
ola::client::OlaClient::RegisterUniverse
void RegisterUniverse(unsigned int universe, RegisterAction register_action, SetCallback *callback)
Register our interest in a universe.
Definition OlaClient.cpp:155
ola::client::OlaClient::RDMSet
void RDMSet(unsigned int universe, const ola::rdm::UID &uid, uint16_t sub_device, uint16_t pid, const uint8_t *data, unsigned int data_length, const SendRDMArgs &args)
Send an RDM Set Command.
Definition OlaClient.cpp:197
ola::client::OlaClient::Patch
void Patch(unsigned int device_alias, unsigned int port, PortDirection port_direction, PatchAction action, unsigned int universe, SetCallback *callback)
Patch or unpatch a port from a universe.
Definition OlaClient.cpp:146
ola::client::OlaClient::RDMGet
void RDMGet(unsigned int universe, const ola::rdm::UID &uid, uint16_t sub_device, uint16_t pid, const uint8_t *data, unsigned int data_length, const SendRDMArgs &args)
Send an RDM Get Command.
Definition OlaClient.cpp:187
ola::client::OlaClient::SetSourceUID
void SetSourceUID(const ola::rdm::UID &uid, SetCallback *callback)
Set the source UID for this client.
Definition OlaClient.cpp:177
ola::client::OlaClient::FetchPluginDescription
void FetchPluginDescription(ola_plugin_id plugin_id, PluginDescriptionCallback *callback)
Fetch the description for a plugin.
Definition OlaClient.cpp:73
ola::client::OlaClient::SetDMXCallback
void SetDMXCallback(RepeatableDMXCallback *callback)
Set the callback to be run when new DMX data arrives.
Definition OlaClient.cpp:61
ola::client::OlaClient::SetUniverseName
void SetUniverseName(unsigned int universe, const std::string &name, SetCallback *callback)
Set the name of a universe.
Definition OlaClient.cpp:134
ola::client::OlaClient::SetUniverseMergeMode
void SetUniverseMergeMode(unsigned int universe, OlaUniverse::merge_mode mode, SetCallback *callback)
Set the merge mode of a universe.
Definition OlaClient.cpp:140
ola::client::OlaClient::SetPortPriorityInherit
void SetPortPriorityInherit(unsigned int device_alias, unsigned int port, PortDirection port_direction, SetCallback *callback)
Set the priority for a port to inherit mode.
Definition OlaClient.cpp:109
ola::client::OlaClient::FetchUniverseInfo
void FetchUniverseInfo(unsigned int universe, UniverseInfoCallback *callback)
Fetch the information for a given universe.
Definition OlaClient.cpp:129
ola::io::ConnectedDescriptor
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition Descriptor.h:283
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::timecode::TimeCode
Definition TimeCode.h:33
Descriptor.h
ola::client
OLA C++ API.
ola::client::PluginListCallback
SingleUseCallback2< void, const Result &, const std::vector< OlaPlugin > & > PluginListCallback
Invoked when OlaClient::FetchPluginList() completes.
Definition CallbackTypes.h:47
ola::client::DiscoveryCallback
SingleUseCallback2< void, const Result &, const ola::rdm::UIDSet & > DiscoveryCallback
Invoked when OlaClient::RunDiscovery() completes.
Definition CallbackTypes.h:124
ola::client::DiscoveryType
DiscoveryType
The type of discovery to run with OlaClient::RunDiscovery().
Definition ClientArgs.h:62
ola::client::UniverseInfoCallback
SingleUseCallback2< void, const Result &, const OlaUniverse & > UniverseInfoCallback
Invoked when OlaClient::FetchUniverseInfo() completes.
Definition CallbackTypes.h:107
ola::client::DeviceInfoCallback
SingleUseCallback2< void, const Result &, const std::vector< OlaDevice > & > DeviceInfoCallback
Invoked when OlaClient::FetchDeviceInfo() completes.
Definition CallbackTypes.h:71
ola::client::PluginDescriptionCallback
SingleUseCallback2< void, const Result &, const std::string & > PluginDescriptionCallback
Invoked when OlaClient::FetchPluginDescription() completes.
Definition CallbackTypes.h:55
ola::client::PatchAction
PatchAction
The patch action, used with OlaClient::Patch().
Definition ClientArgs.h:38
ola::client::RepeatableDMXCallback
Callback2< void, const DMXMetadata &, const DmxBuffer & > RepeatableDMXCallback
Called when new DMX data arrives.
Definition CallbackTypes.h:142
ola::client::SetCallback
SingleUseCallback1< void, const Result & > SetCallback
Invoked when an operation completes.
Definition CallbackTypes.h:85
ola::client::PortDirection
PortDirection
The port direction.
Definition ClientArgs.h:54
ola::client::UniverseListCallback
SingleUseCallback2< void, const Result &, const std::vector< OlaUniverse > & > UniverseListCallback
Invoked when OlaClient::FetchUniverseList() completes.
Definition CallbackTypes.h:99
ola::client::RegisterAction
RegisterAction
The register action, used with OlaClient::RegisterUniverse().
Definition ClientArgs.h:46
ola::client::PluginStateCallback
SingleUseCallback2< void, const Result &, const PluginState & > PluginStateCallback
Invoked when OlaClient::FetchPluginState() completes.
Definition CallbackTypes.h:63
ola::client::CandidatePortsCallback
SingleUseCallback2< void, const Result &, const std::vector< OlaDevice > & > CandidatePortsCallback
Invoked when OlaClient::FetchDeviceInfo() completes.
Definition CallbackTypes.h:79
ola::client::ConfigureDeviceCallback
SingleUseCallback2< void, const Result &, const std::string & > ConfigureDeviceCallback
Invoked when OlaClient::ConfigureDevice() completes.
Definition CallbackTypes.h:115
ola::client::DMXCallback
SingleUseCallback3< void, const Result &, const DMXMetadata &, const DmxBuffer & > DMXCallback
Called once when OlaClient::FetchDMX() completes.
Definition CallbackTypes.h:134
ola::timecode
Timecode.
Definition TimeCode.cpp:30
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::client::SendDMXArgs
Arguments passed to the SendDMX() method.
Definition ClientArgs.h:71
ola::client::SendRDMArgs
Arguments used with OlaClient::RDMGet() and OlaClient::RDMSet() methods.
Definition ClientArgs.h:103