Open Lighting Architecture: olad/OlaServerServiceImpl.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
OlaServerServiceImpl.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program 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
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * OlaServerServiceImpl.h
17 * Implementation of the OlaService interface
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#include <memory>
22#include <string>
23#include <vector>
24#include "common/protocol/Ola.pb.h"
25#include "common/protocol/OlaService.pb.h"
26#include "ola/Callback.h"
27#include "ola/rdm/RDMCommand.h"
28#include "ola/rdm/RDMControllerInterface.h"
29#include "ola/rdm/UID.h"
30#include "ola/rdm/UIDSet.h"
31
32#ifndef OLAD_OLASERVERSERVICEIMPL_H_
33#define OLAD_OLASERVERSERVICEIMPL_H_
34
35namespace ola {
36
37class Universe;
38
50 class OlaServerServiceImpl : public ola::proto::OlaServerService {
51 public:
55 typedef Callback0<void> ReloadPluginsCallback;
56
60 OlaServerServiceImpl(class UniverseStore *universe_store,
61 class DeviceManager *device_manager,
62 class PluginManager *plugin_manager,
63 class PortManager *port_manager,
64 class ClientBroker *broker,
65 const class TimeStamp *wake_up_time,
66 ReloadPluginsCallback *reload_plugins_callback);
67
68 ~OlaServerServiceImpl() {}
69
73 void GetDmx(ola::rpc::RpcController* controller,
74 const ola::proto::UniverseRequest* request,
75 ola::proto::DmxData* response,
76 ola::rpc::RpcService::CompletionCallback* done);
77
78
82 void RegisterForDmx(ola::rpc::RpcController* controller,
83 const ola::proto::RegisterDmxRequest* request,
84 ola::proto::Ack* response,
85 ola::rpc::RpcService::CompletionCallback* done);
86
90 void UpdateDmxData(ola::rpc::RpcController* controller,
91 const ola::proto::DmxData* request,
92 ola::proto::Ack* response,
93 ola::rpc::RpcService::CompletionCallback* done);
97 void StreamDmxData(ola::rpc::RpcController* controller,
98 const ::ola::proto::DmxData* request,
99 ::ola::proto::STREAMING_NO_RESPONSE* response,
100 ola::rpc::RpcService::CompletionCallback* done);
101
102
106 void SetUniverseName(ola::rpc::RpcController* controller,
107 const ola::proto::UniverseNameRequest* request,
108 ola::proto::Ack* response,
109 ola::rpc::RpcService::CompletionCallback* done);
110
114 void SetMergeMode(ola::rpc::RpcController* controller,
115 const ola::proto::MergeModeRequest* request,
116 ola::proto::Ack* response,
117 ola::rpc::RpcService::CompletionCallback* done);
118
122 void PatchPort(ola::rpc::RpcController* controller,
123 const ola::proto::PatchPortRequest* request,
124 ola::proto::Ack* response,
125 ola::rpc::RpcService::CompletionCallback* done);
126
130 void SetPortPriority(ola::rpc::RpcController* controller,
131 const ola::proto::PortPriorityRequest* request,
132 ola::proto::Ack* response,
133 ola::rpc::RpcService::CompletionCallback* done);
134
138 void GetUniverseInfo(ola::rpc::RpcController* controller,
139 const ola::proto::OptionalUniverseRequest* request,
140 ola::proto::UniverseInfoReply* response,
141 ola::rpc::RpcService::CompletionCallback* done);
142
146 void GetPlugins(ola::rpc::RpcController* controller,
147 const ola::proto::PluginListRequest* request,
148 ola::proto::PluginListReply* response,
149 ola::rpc::RpcService::CompletionCallback* done);
150
154 void ReloadPlugins(ola::rpc::RpcController* controller,
155 const ola::proto::PluginReloadRequest* request,
156 ola::proto::Ack* response,
157 ola::rpc::RpcService::CompletionCallback* done);
158
162 void GetPluginDescription(
163 ola::rpc::RpcController* controller,
164 const ola::proto::PluginDescriptionRequest* request,
165 ola::proto::PluginDescriptionReply* response,
166 ola::rpc::RpcService::CompletionCallback* done);
167
171 void GetPluginState(
172 ola::rpc::RpcController* controller,
173 const ola::proto::PluginStateRequest* request,
174 ola::proto::PluginStateReply* response,
175 ola::rpc::RpcService::CompletionCallback* done);
176
180 void SetPluginState(
181 ola::rpc::RpcController* controller,
182 const ola::proto::PluginStateChangeRequest* request,
183 ola::proto::Ack* response,
184 ola::rpc::RpcService::CompletionCallback* done);
185
189 void GetDeviceInfo(ola::rpc::RpcController* controller,
190 const ola::proto::DeviceInfoRequest* request,
191 ola::proto::DeviceInfoReply* response,
192 ola::rpc::RpcService::CompletionCallback* done);
193
197 void GetCandidatePorts(ola::rpc::RpcController* controller,
198 const ola::proto::OptionalUniverseRequest* request,
199 ola::proto::DeviceInfoReply* response,
200 ola::rpc::RpcService::CompletionCallback* done);
201
205 void ConfigureDevice(ola::rpc::RpcController* controller,
206 const ola::proto::DeviceConfigRequest* request,
207 ola::proto::DeviceConfigReply* response,
208 ola::rpc::RpcService::CompletionCallback* done);
209
213 void GetUIDs(ola::rpc::RpcController* controller,
214 const ola::proto::UniverseRequest* request,
215 ola::proto::UIDListReply* response,
216 ola::rpc::RpcService::CompletionCallback* done);
217
221 void ForceDiscovery(ola::rpc::RpcController* controller,
222 const ola::proto::DiscoveryRequest* request,
223 ola::proto::UIDListReply* response,
224 ola::rpc::RpcService::CompletionCallback* done);
225
229 void RDMCommand(ola::rpc::RpcController* controller,
230 const ::ola::proto::RDMRequest* request,
231 ola::proto::RDMResponse* response,
232 ola::rpc::RpcService::CompletionCallback* done);
233
234
241 void RDMDiscoveryCommand(ola::rpc::RpcController* controller,
242 const ::ola::proto::RDMDiscoveryRequest* request,
243 ola::proto::RDMResponse* response,
244 ola::rpc::RpcService::CompletionCallback* done);
245
249 void SetSourceUID(ola::rpc::RpcController* controller,
250 const ::ola::proto::UID* request,
251 ola::proto::Ack* response,
252 ola::rpc::RpcService::CompletionCallback* done);
253
257 void SendTimeCode(ola::rpc::RpcController* controller,
258 const ::ola::proto::TimeCode* request,
259 ::ola::proto::Ack* response,
260 ola::rpc::RpcService::CompletionCallback* done);
261
262 private:
263 void HandleRDMResponse(ola::proto::RDMResponse* response,
264 ola::rpc::RpcService::CompletionCallback* done,
265 bool include_raw_packets,
266 ola::rdm::RDMReply *reply);
267 void RDMDiscoveryComplete(unsigned int universe,
268 ola::rpc::RpcService::CompletionCallback* done,
269 ola::proto::UIDListReply *response,
270 const ola::rdm::UIDSet &uids);
271
272 void MissingUniverseError(ola::rpc::RpcController* controller);
273 void MissingPluginError(ola::rpc::RpcController* controller);
274 void MissingDeviceError(ola::rpc::RpcController* controller);
275 void MissingPortError(ola::rpc::RpcController* controller);
276
277 void AddPlugin(class AbstractPlugin *plugin,
278 ola::proto::PluginInfo *plugin_info) const;
279 void AddDevice(class AbstractDevice *device,
280 unsigned int alias,
281 ola::proto::DeviceInfoReply* response) const;
282 void AddUniverse(const Universe *universe,
283 ola::proto::UniverseInfoReply *universe_info_reply) const;
284
285 template <class PortClass>
286 void PopulatePort(const PortClass &port,
287 ola::proto::PortInfo *port_info) const;
288
289 void SetProtoUID(const ola::rdm::UID &uid, ola::proto::UID *pb_uid);
290
291 class Client* GetClient(ola::rpc::RpcController *controller);
292
293 UniverseStore *m_universe_store;
294 DeviceManager *m_device_manager;
295 class PluginManager *m_plugin_manager;
296 class PortManager *m_port_manager;
297 class ClientBroker *m_broker;
298 const class TimeStamp *m_wake_up_time;
299 std::auto_ptr<ReloadPluginsCallback> m_reload_plugins_callback;
300};
301} // namespace ola
302#endif // OLAD_OLASERVERSERVICEIMPL_H_
Callback.h
RDMCommand.h
Classes that represent RDM commands.
RDMControllerInterface.h
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
UID.h
A RDM unique identifier (UID).
UIDSet.h
A set of UIDs.
ola::AbstractDevice
Definition Device.h:44
ola::AbstractPlugin
Definition Plugin.h:38
ola::Callback0
A 0 argument callback which can be called multiple times.
Definition Callback.h:129
ola::ClientBroker
Handles async client operations.
Definition ClientBroker.h:52
ola::Client
Represents a connected OLA client on the OLA server side.
Definition Client.h:46
ola::DeviceManager
Keeps track of OLA's devices.
Definition DeviceManager.h:61
ola::OlaServerServiceImpl::RDMDiscoveryCommand
void RDMDiscoveryCommand(ola::rpc::RpcController *controller, const ::ola::proto::RDMDiscoveryRequest *request, ola::proto::RDMResponse *response, ola::rpc::RpcService::CompletionCallback *done)
Handle an RDM Discovery Command.
Definition OlaServerServiceImpl.cpp:767
ola::OlaServerServiceImpl::SendTimeCode
void SendTimeCode(ola::rpc::RpcController *controller, const ::ola::proto::TimeCode *request, ::ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Send Timecode.
Definition OlaServerServiceImpl.cpp:820
ola::OlaServerServiceImpl::SetMergeMode
void SetMergeMode(ola::rpc::RpcController *controller, const ola::proto::MergeModeRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Set the merge mode for a universe.
Definition OlaServerServiceImpl.cpp:236
ola::OlaServerServiceImpl::GetDeviceInfo
void GetDeviceInfo(ola::rpc::RpcController *controller, const ola::proto::DeviceInfoRequest *request, ola::proto::DeviceInfoReply *response, ola::rpc::RpcService::CompletionCallback *done)
Return information on available devices.
Definition OlaServerServiceImpl.cpp:509
ola::OlaServerServiceImpl::GetCandidatePorts
void GetCandidatePorts(ola::rpc::RpcController *controller, const ola::proto::OptionalUniverseRequest *request, ola::proto::DeviceInfoReply *response, ola::rpc::RpcService::CompletionCallback *done)
Handle a GetCandidatePorts request.
Definition OlaServerServiceImpl.cpp:530
ola::OlaServerServiceImpl::SetPluginState
void SetPluginState(ola::rpc::RpcController *controller, const ola::proto::PluginStateChangeRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Change the state of plugins.
Definition OlaServerServiceImpl.cpp:487
ola::OlaServerServiceImpl::PatchPort
void PatchPort(ola::rpc::RpcController *controller, const ola::proto::PatchPortRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Patch a port to a universe.
Definition OlaServerServiceImpl.cpp:252
ola::OlaServerServiceImpl::StreamDmxData
void StreamDmxData(ola::rpc::RpcController *controller, const ::ola::proto::DmxData *request, ::ola::proto::STREAMING_NO_RESPONSE *response, ola::rpc::RpcService::CompletionCallback *done)
Handle a streaming DMX update, no response is sent.
Definition OlaServerServiceImpl.cpp:194
ola::OlaServerServiceImpl::RDMCommand
void RDMCommand(ola::rpc::RpcController *controller, const ::ola::proto::RDMRequest *request, ola::proto::RDMResponse *response, ola::rpc::RpcService::CompletionCallback *done)
Handle an RDM Command.
Definition OlaServerServiceImpl.cpp:711
ola::OlaServerServiceImpl::GetUniverseInfo
void GetUniverseInfo(ola::rpc::RpcController *controller, const ola::proto::OptionalUniverseRequest *request, ola::proto::UniverseInfoReply *response, ola::rpc::RpcService::CompletionCallback *done)
Returns information on the active universes.
Definition OlaServerServiceImpl.cpp:388
ola::OlaServerServiceImpl::GetPluginState
void GetPluginState(ola::rpc::RpcController *controller, const ola::proto::PluginStateRequest *request, ola::proto::PluginStateReply *response, ola::rpc::RpcService::CompletionCallback *done)
Return the state for a plugin.
Definition OlaServerServiceImpl.cpp:461
ola::OlaServerServiceImpl::GetPlugins
void GetPlugins(ola::rpc::RpcController *controller, const ola::proto::PluginListRequest *request, ola::proto::PluginListReply *response, ola::rpc::RpcService::CompletionCallback *done)
Return info on available plugins.
Definition OlaServerServiceImpl.cpp:415
ola::OlaServerServiceImpl::SetPortPriority
void SetPortPriority(ola::rpc::RpcController *controller, const ola::proto::PortPriorityRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Set the priority of one or more ports.
Definition OlaServerServiceImpl.cpp:295
ola::OlaServerServiceImpl::GetPluginDescription
void GetPluginDescription(ola::rpc::RpcController *controller, const ola::proto::PluginDescriptionRequest *request, ola::proto::PluginDescriptionReply *response, ola::rpc::RpcService::CompletionCallback *done)
Return the description for a plugin.
Definition OlaServerServiceImpl.cpp:444
ola::OlaServerServiceImpl::GetDmx
void GetDmx(ola::rpc::RpcController *controller, const ola::proto::UniverseRequest *request, ola::proto::DmxData *response, ola::rpc::RpcService::CompletionCallback *done)
Returns the current DMX values for a particular universe.
Definition OlaServerServiceImpl.cpp:130
ola::OlaServerServiceImpl::SetSourceUID
void SetSourceUID(ola::rpc::RpcController *controller, const ::ola::proto::UID *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Set this client's source UID.
Definition OlaServerServiceImpl.cpp:809
ola::OlaServerServiceImpl::ReloadPlugins
void ReloadPlugins(ola::rpc::RpcController *controller, const ola::proto::PluginReloadRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Reload the plugins.
Definition OlaServerServiceImpl.cpp:431
ola::OlaServerServiceImpl::ReloadPluginsCallback
Callback0< void > ReloadPluginsCallback
A Callback used to reload all the plugins.
Definition OlaServerServiceImpl.h:55
ola::OlaServerServiceImpl::RegisterForDmx
void RegisterForDmx(ola::rpc::RpcController *controller, const ola::proto::RegisterDmxRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Register a client to receive DMX data.
Definition OlaServerServiceImpl.cpp:146
ola::OlaServerServiceImpl::UpdateDmxData
void UpdateDmxData(ola::rpc::RpcController *controller, const ola::proto::DmxData *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Update the DMX values for a single universe.
Definition OlaServerServiceImpl.cpp:166
ola::OlaServerServiceImpl::ForceDiscovery
void ForceDiscovery(ola::rpc::RpcController *controller, const ola::proto::DiscoveryRequest *request, ola::proto::UIDListReply *response, ola::rpc::RpcService::CompletionCallback *done)
Force RDM discovery for a universe.
Definition OlaServerServiceImpl.cpp:687
ola::OlaServerServiceImpl::OlaServerServiceImpl
OlaServerServiceImpl(class UniverseStore *universe_store, class DeviceManager *device_manager, class PluginManager *plugin_manager, class PortManager *port_manager, class ClientBroker *broker, const class TimeStamp *wake_up_time, ReloadPluginsCallback *reload_plugins_callback)
Create a new OlaServerServiceImpl.
Definition OlaServerServiceImpl.cpp:113
ola::OlaServerServiceImpl::SetUniverseName
void SetUniverseName(ola::rpc::RpcController *controller, const ola::proto::UniverseNameRequest *request, ola::proto::Ack *response, ola::rpc::RpcService::CompletionCallback *done)
Sets the name of a universe.
Definition OlaServerServiceImpl.cpp:222
ola::OlaServerServiceImpl::ConfigureDevice
void ConfigureDevice(ola::rpc::RpcController *controller, const ola::proto::DeviceConfigRequest *request, ola::proto::DeviceConfigReply *response, ola::rpc::RpcService::CompletionCallback *done)
Handle a ConfigureDevice request.
Definition OlaServerServiceImpl.cpp:648
ola::OlaServerServiceImpl::GetUIDs
void GetUIDs(ola::rpc::RpcController *controller, const ola::proto::UniverseRequest *request, ola::proto::UIDListReply *response, ola::rpc::RpcService::CompletionCallback *done)
Fetch the UID list for a universe.
Definition OlaServerServiceImpl.cpp:665
ola::PluginManager
The manager of plugins.
Definition PluginManager.h:52
ola::PortManager
Responsible for performing Port operations.
Definition PortManager.h:37
ola::TimeStamp
Definition Clock.h:179
ola::Universe
Definition Universe.h:46
ola::UniverseStore
Maintains a collection of Universe objects.
Definition UniverseStore.h:39
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::rdm::UIDSet
Represents a set of RDM UIDs.
Definition UIDSet.h:48
ola::rpc::RpcController
A RpcController object is passed every time an RPC is invoked and is used to indicate the success or ...
Definition RpcController.h:42
ola::plugin
Code for supported devices and protocols.
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::rdm::RDMReply
Holds the final state of an RDM request.
Definition RDMReply.h:43