Open Lighting Architecture  0.9.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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 
38 namespace ola {
39 namespace 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 sucess, false on failure
59  */
60  bool Stop();
61 
66 
73  void SetDMXCallback(RepeatableDMXCallback *callback);
74 
79  void ReloadPlugins(SetCallback *callback);
80 
85  void FetchPluginList(PluginListCallback *callback);
86 
93  void FetchPluginDescription(ola_plugin_id plugin_id,
94  PluginDescriptionCallback *callback);
95 
102  void FetchPluginState(ola_plugin_id plugin_id,
103  PluginStateCallback *callback);
104 
111  void FetchDeviceInfo(ola_plugin_id plugin_filter,
112  DeviceInfoCallback *callback);
113 
119 
127  void FetchCandidatePorts(unsigned int universe_id,
128  CandidatePortsCallback *callback);
129 
136  void ConfigureDevice(unsigned int device_alias,
137  const std::string &msg,
138  ConfigureDeviceCallback *callback);
139 
147  void SetPortPriorityInherit(unsigned int device_alias,
148  unsigned int port,
149  PortDirection port_direction,
150  SetCallback *callback);
151 
160  void SetPortPriorityOverride(unsigned int device_alias,
161  unsigned int port,
162  PortDirection port_direction,
163  uint8_t value,
164  SetCallback *callback);
165 
170  void FetchUniverseList(UniverseListCallback *callback);
171 
177  void FetchUniverseInfo(unsigned int universe,
178  UniverseInfoCallback *callback);
179 
186  void SetUniverseName(unsigned int universe,
187  const std::string &name,
188  SetCallback *callback);
189 
196  void SetUniverseMergeMode(unsigned int universe,
197  OlaUniverse::merge_mode mode,
198  SetCallback *callback);
199 
209  void Patch(unsigned int device_alias,
210  unsigned int port,
211  PortDirection port_direction,
212  PatchAction action,
213  unsigned int universe,
214  SetCallback *callback);
215 
223  void RegisterUniverse(unsigned int universe,
224  RegisterAction register_action,
225  SetCallback *callback);
226 
233  void SendDMX(unsigned int universe,
234  const DmxBuffer &data,
235  const SendDMXArgs &args);
236 
242  void FetchDMX(unsigned int universe, DMXCallback *callback);
243 
250  void RunDiscovery(unsigned int universe,
251  DiscoveryType discovery_type,
252  DiscoveryCallback *callback);
253 
259  void SetSourceUID(const ola::rdm::UID &uid, SetCallback *callback);
260 
271  void RDMGet(unsigned int universe,
272  const ola::rdm::UID &uid,
273  uint16_t sub_device,
274  uint16_t pid,
275  const uint8_t *data,
276  unsigned int data_length,
277  const SendRDMArgs& args);
278 
289  void RDMSet(unsigned int universe,
290  const ola::rdm::UID &uid,
291  uint16_t sub_device,
292  uint16_t pid,
293  const uint8_t *data,
294  unsigned int data_length,
295  const SendRDMArgs& args);
296 
302  void SendTimeCode(const ola::timecode::TimeCode &timecode,
303  SetCallback *callback);
304 
305  private:
306  std::auto_ptr<class OlaClientCore> m_core;
307 
308  DISALLOW_COPY_AND_ASSIGN(OlaClient);
309 };
310 } // namespace client
311 } // namespace ola
312 #endif // INCLUDE_OLA_CLIENT_OLACLIENT_H_