Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * StreamingClient.h
17  * Interface to the Streaming Client class.
18  * Copyright (C) 2005-2010 Simon Newton
19  */
25 #ifndef OLA_STREAMINGCLIENT_H_
26 #define OLA_STREAMINGCLIENT_H_
27 
28 #include <ola/BaseTypes.h>
29 #include <ola/DmxBuffer.h>
30 #include <ola/io/SelectServer.h>
31 #include <ola/network/TCPSocket.h>
32 
33 namespace ola {
34 
35 namespace rpc {
36  class StreamRpcChannel;
37 }
38 
39 namespace proto {
40  class OlaServerService_Stub;
41 }
42 
45 
57  public:
61  class Options {
62  public:
68 
73  bool auto_start;
74 
78  uint16_t server_port;
79  };
80 
87  explicit StreamingClient(bool auto_start = true);
88 
93  explicit StreamingClient(const Options &options);
94 
100 
106  bool Setup();
107 
113  void Stop();
114 
120  bool SendDmx(unsigned int universe, const DmxBuffer &data);
121 
122  void ChannelClosed();
123 
124  private:
126  StreamingClient operator=(const StreamingClient&);
127 
128  bool m_auto_start;
129  uint16_t m_server_port;
130  TCPSocket *m_socket;
131  SelectServer *m_ss;
132  class ola::rpc::StreamRpcChannel *m_channel;
133  class ola::proto::OlaServerService_Stub *m_stub;
134  bool m_socket_closed;
135 };
136 } // namespace ola
137 #endif // OLA_STREAMINGCLIENT_H_