Open Lighting Architecture  0.9.5
 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 
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 
121 
129  void FetchCandidatePorts(unsigned int universe_id,
130  CandidatePortsCallback *callback);
131 
138  void ConfigureDevice(unsigned int device_alias,
139  const std::string &msg,
140  ConfigureDeviceCallback *callback);
141 
149  void SetPortPriorityInherit(unsigned int device_alias,
150  unsigned int port,
151  PortDirection port_direction,
152  SetCallback *callback);
153 
162  void SetPortPriorityOverride(unsigned int device_alias,
163  unsigned int port,
164  PortDirection port_direction,
165  uint8_t value,
166  SetCallback *callback);
167 
172  void FetchUniverseList(UniverseListCallback *callback);
173 
179  void FetchUniverseInfo(unsigned int universe,
180  UniverseInfoCallback *callback);
181 
188  void SetUniverseName(unsigned int universe,
189  const std::string &name,
190  SetCallback *callback);
191 
198  void SetUniverseMergeMode(unsigned int universe,
199  OlaUniverse::merge_mode mode,
200  SetCallback *callback);
201 
211  void Patch(unsigned int device_alias,
212  unsigned int port,
213  PortDirection port_direction,
214  PatchAction action,
215  unsigned int universe,
216  SetCallback *callback);
217 
227  void RegisterUniverse(unsigned int universe,
228  RegisterAction register_action,
229  SetCallback *callback);
230 
237  void SendDMX(unsigned int universe,
238  const DmxBuffer &data,
239  const SendDMXArgs &args);
240 
246  void FetchDMX(unsigned int universe, DMXCallback *callback);
247 
254  void RunDiscovery(unsigned int universe,
255  DiscoveryType discovery_type,
256  DiscoveryCallback *callback);
257 
263  void SetSourceUID(const ola::rdm::UID &uid, SetCallback *callback);
264 
275  void RDMGet(unsigned int universe,
276  const ola::rdm::UID &uid,
277  uint16_t sub_device,
278  uint16_t pid,
279  const uint8_t *data,
280  unsigned int data_length,
281  const SendRDMArgs& args);
282 
293  void RDMSet(unsigned int universe,
294  const ola::rdm::UID &uid,
295  uint16_t sub_device,
296  uint16_t pid,
297  const uint8_t *data,
298  unsigned int data_length,
299  const SendRDMArgs& args);
300 
306  void SendTimeCode(const ola::timecode::TimeCode &timecode,
307  SetCallback *callback);
308 
309  private:
310  std::auto_ptr<class OlaClientCore> m_core;
311 
312  DISALLOW_COPY_AND_ASSIGN(OlaClient);
313 };
314 } // namespace client
315 } // namespace ola
316 #endif // INCLUDE_OLA_CLIENT_OLACLIENT_H_