Open Lighting Architecture  0.9.0
 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 FetchPluginList(PluginListCallback *callback);
80 
87  void FetchPluginDescription(ola_plugin_id plugin_id,
88  PluginDescriptionCallback *callback);
89 
96  void FetchPluginState(ola_plugin_id plugin_id,
97  PluginStateCallback *callback);
98 
105  void FetchDeviceInfo(ola_plugin_id plugin_filter,
106  DeviceInfoCallback *callback);
107 
113 
121  void FetchCandidatePorts(unsigned int universe_id,
122  CandidatePortsCallback *callback);
123 
130  void ConfigureDevice(unsigned int device_alias,
131  const std::string &msg,
132  ConfigureDeviceCallback *callback);
133 
141  void SetPortPriorityInherit(unsigned int device_alias,
142  unsigned int port,
143  PortDirection port_direction,
144  SetCallback *callback);
145 
154  void SetPortPriorityOverride(unsigned int device_alias,
155  unsigned int port,
156  PortDirection port_direction,
157  uint8_t value,
158  SetCallback *callback);
159 
164  void FetchUniverseList(UniverseListCallback *callback);
165 
171  void FetchUniverseInfo(unsigned int universe,
172  UniverseInfoCallback *callback);
173 
180  void SetUniverseName(unsigned int universe,
181  const std::string &name,
182  SetCallback *callback);
183 
190  void SetUniverseMergeMode(unsigned int universe,
191  OlaUniverse::merge_mode mode,
192  SetCallback *callback);
193 
203  void Patch(unsigned int device_alias,
204  unsigned int port,
205  PortDirection port_direction,
206  PatchAction action,
207  unsigned int universe,
208  SetCallback *callback);
209 
217  void RegisterUniverse(unsigned int universe,
218  RegisterAction register_action,
219  SetCallback *callback);
220 
227  void SendDMX(unsigned int universe,
228  const DmxBuffer &data,
229  const SendDMXArgs &args);
230 
236  void FetchDMX(unsigned int universe, DMXCallback *callback);
237 
244  void RunDiscovery(unsigned int universe,
245  DiscoveryType discovery_type,
246  DiscoveryCallback *callback);
247 
253  void SetSourceUID(const ola::rdm::UID &uid, SetCallback *callback);
254 
265  void RDMGet(unsigned int universe,
266  const ola::rdm::UID &uid,
267  uint16_t sub_device,
268  uint16_t pid,
269  const uint8_t *data,
270  unsigned int data_length,
271  const SendRDMArgs& args);
272 
283  void RDMSet(unsigned int universe,
284  const ola::rdm::UID &uid,
285  uint16_t sub_device,
286  uint16_t pid,
287  const uint8_t *data,
288  unsigned int data_length,
289  const SendRDMArgs& args);
290 
296  void SendTimeCode(const ola::timecode::TimeCode &timecode,
297  SetCallback *callback);
298 
299  private:
300  std::auto_ptr<class OlaClientCore> m_core;
301 
302  DISALLOW_COPY_AND_ASSIGN(OlaClient);
303 };
304 } // namespace client
305 } // namespace ola
306 #endif // INCLUDE_OLA_CLIENT_OLACLIENT_H_