Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
Client.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 * Client.h
17 * Header file for the olad Client class.
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef OLAD_PLUGIN_API_CLIENT_H_
22#define OLAD_PLUGIN_API_CLIENT_H_
23
24#include <map>
25#include <memory>
26#include "common/rpc/RpcController.h"
27#include "ola/base/Macro.h"
28#include "ola/rdm/UID.h"
29#include "olad/DmxSource.h"
30
31namespace ola {
32namespace proto {
33class OlaClientService_Stub;
34class Ack;
35}
36}
37
38namespace ola {
39
46class Client {
47 public :
55 Client(ola::proto::OlaClientService_Stub *client_stub,
56 const ola::rdm::UID &uid);
57
58 virtual ~Client();
59
67 virtual bool SendDMX(unsigned int universe_id, uint8_t priority,
68 const DmxBuffer &buffer);
69
75 void DMXReceived(unsigned int universe, const DmxSource &source);
76
81 const DmxSource SourceData(unsigned int universe) const;
82
90 ola::rdm::UID GetUID() const;
91
96 void SetUID(const ola::rdm::UID &uid);
97
98 private:
99 void SendDMXCallback(ola::rpc::RpcController *controller,
100 ola::proto::Ack *ack);
101
102 std::auto_ptr<class ola::proto::OlaClientService_Stub> m_client_stub;
103 std::map<unsigned int, DmxSource> m_data_map;
104 ola::rdm::UID m_uid;
105
106 Client(const Client &) = delete;
107 const Client &operator=(const Client &) = delete;
108};
109} // namespace ola
110#endif // OLAD_PLUGIN_API_CLIENT_H_
Helper macros.
A RDM unique identifier (UID).
Represents a connected OLA client on the OLA server side.
Definition Client.h:46
virtual bool SendDMX(unsigned int universe_id, uint8_t priority, const DmxBuffer &buffer)
Push a DMX update to this client.
Definition Client.cpp:47
const DmxSource SourceData(unsigned int universe) const
Get the most recent DMX data received from this client.
Definition Client.cpp:75
void DMXReceived(unsigned int universe, const DmxSource &source)
Called when this client sends us new data.
Definition Client.cpp:71
void SetUID(const ola::rdm::UID &uid)
Set the UID for the client.
Definition Client.cpp:91
Client(ola::proto::OlaClientService_Stub *client_stub, const ola::rdm::UID &uid)
Create a new client.
Definition Client.cpp:37
ola::rdm::UID GetUID() const
Return the UID associated with this client.
Definition Client.cpp:87
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
Definition DmxSource.h:36
Represents a RDM UID.
Definition UID.h:57
A RpcController object is passed every time an RPC is invoked and is used to indicate the success or ...
Definition RpcController.h:42
The namespace containing all OLA symbols.
Definition Credentials.cpp:44