Open Lighting Architecture  0.9.6
 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 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  DISALLOW_COPY_AND_ASSIGN(OlaClient);
323 };
324 } // namespace client
325 } // namespace ola
326 #endif // INCLUDE_OLA_CLIENT_OLACLIENT_H_