Open Lighting Architecture: include/ola/client/StreamingClient.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
StreamingClient.h
Go to the documentation of this file.
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 * StreamingClient.h
17 * Interface to the Streaming Client class.
18 * Copyright (C) 2005 Simon Newton
19 */
24
25#ifndef INCLUDE_OLA_CLIENT_STREAMINGCLIENT_H_
26#define INCLUDE_OLA_CLIENT_STREAMINGCLIENT_H_
27
28#include <ola/Constants.h>
29#include <ola/DmxBuffer.h>
30#include <ola/base/Macro.h>
31#include <ola/dmx/SourcePriorities.h>
32
33namespace ola {
34
35namespace io { class SelectServer; }
36namespace network { class TCPSocket; }
37namespace proto { class OlaServerService_Stub; }
38namespace rpc {
39class RpcChannel;
40class RpcSession;
41}
42
43namespace client {
44
49 class StreamingClientInterface {
50 public:
54 class SendArgs {
55 public:
61 uint8_t priority;
62
63 SendArgs() : priority(ola::dmx::SOURCE_PRIORITY_DEFAULT) {}
64 };
65
66 virtual ~StreamingClientInterface() {}
67
68 virtual bool Setup() = 0;
69
70 virtual void Stop() = 0;
71
72 virtual bool SendDmx(unsigned int universe, const DmxBuffer &data) = 0;
73
74 virtual bool SendDMX(unsigned int universe,
75 const DmxBuffer &data,
76 const SendArgs &args) = 0;
77};
78
89 class StreamingClient : public StreamingClientInterface {
90 public:
94 class Options {
95 public:
100 Options() : auto_start(true), server_port(OLA_DEFAULT_PORT) {}
101
106 bool auto_start;
107
111 uint16_t server_port;
112 };
113
120 explicit StreamingClient(bool auto_start = true);
121
126 explicit StreamingClient(const Options &options);
127
132 ~StreamingClient();
133
139 bool Setup();
140
146 void Stop();
147
155 bool SendDmx(unsigned int universe, const DmxBuffer &data);
156
163 bool SendDMX(unsigned int universe,
164 const DmxBuffer &data,
165 const SendArgs &args);
166
167 void ChannelClosed(ola::rpc::RpcSession *session);
168
169 private:
170 bool m_auto_start;
171 uint16_t m_server_port;
172 ola::network::TCPSocket *m_socket;
173 ola::io::SelectServer *m_ss;
174 class ola::rpc::RpcChannel *m_channel;
175 class ola::proto::OlaServerService_Stub *m_stub;
176 bool m_socket_closed;
177
178 bool Send(unsigned int universe, uint8_t priority, const DmxBuffer &data);
179
180 StreamingClient(const StreamingClient &) = delete;
181 const StreamingClient &operator=(const StreamingClient &) = delete;
182};
183} // namespace client
184} // namespace ola
185#endif // INCLUDE_OLA_CLIENT_STREAMINGCLIENT_H_
Constants.h
Constants used throughout OLA.
DmxBuffer.h
A class used to hold a single universe of DMX data.
Macro.h
Helper macros.
SourcePriorities.h
The constants for DMX source priorities.
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::client::StreamingClient::Options
Definition StreamingClient.h:94
ola::client::StreamingClient::Options::auto_start
bool auto_start
Definition StreamingClient.h:106
ola::client::StreamingClient::Options::server_port
uint16_t server_port
Definition StreamingClient.h:111
ola::client::StreamingClient::Options::Options
Options()
Definition StreamingClient.h:100
ola::client::StreamingClient::SendDMX
bool SendDMX(unsigned int universe, const DmxBuffer &data, const SendArgs &args)
Send DMX data.
Definition StreamingClient.cpp:135
ola::client::StreamingClient::SendDmx
bool SendDmx(unsigned int universe, const DmxBuffer &data)
Definition StreamingClient.cpp:130
ola::client::StreamingClient::Setup
bool Setup()
Definition StreamingClient.cpp:70
ola::client::StreamingClient::StreamingClient
StreamingClient(bool auto_start=true)
Definition StreamingClient.cpp:46
ola::client::StreamingClient::Stop
void Stop()
Definition StreamingClient.cpp:111
ola::client::StreamingClient::~StreamingClient
~StreamingClient()
Definition StreamingClient.cpp:66
ola::client::StreamingClientInterface::SendArgs
Definition StreamingClient.h:54
ola::client::StreamingClientInterface::SendArgs::priority
uint8_t priority
the priority of the data. This should be between ola::dmx::SOURCE_PRIORITY_MIN and ola::dmx::SOURCE_P...
Definition StreamingClient.h:61
ola::client::StreamingClientInterface
The interface for the StreamingClient class.
Definition StreamingClient.h:49
ola::io::SelectServer
A single threaded I/O event management system.
Definition SelectServer.h:63
ola::network::TCPSocket
Definition TCPSocket.h:43
ola::rpc::RpcChannel
The RPC channel used to communicate between the client and the server. This implementation runs over ...
Definition RpcChannel.h:51
ola::rpc::RpcSession
Represents the RPC session between a client and server.
Definition RpcSession.h:45
ola::client
OLA C++ API.
ola::dmx
DMX512 related code.
Definition RunLengthEncoder.cpp:25
ola::io
Classes for general I/O and event handling.
Definition Descriptor.cpp:49
ola::network
Code for network communication.
Definition AdvancedTCPConnector.cpp:28
ola::rpc
The RPC (Remote Procedure Call) system.
Definition RpcChannel.cpp:41
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::OLA_DEFAULT_PORT
static const int OLA_DEFAULT_PORT
The default port which olad listens on for incoming RPC connections.
Definition Constants.h:68