Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * client.h
17  * Header file for the client class
18  * Copyright (C) 2005 Simon Newton
19  */
20 
21 #ifndef OLAD_CLIENT_H_
22 #define OLAD_CLIENT_H_
23 
24 #include <map>
25 #include "common/rpc/SimpleRpcController.h"
26 #include "olad/DmxSource.h"
27 
28 namespace ola {
29 namespace proto {
30  class OlaClientService_Stub;
31  class Ack;
32 }
33 }
34 
35 namespace ola {
36 
37 using std::map;
38 using ola::proto::OlaClientService_Stub;
39 
40 class Client {
41  public :
42  explicit Client(OlaClientService_Stub *client_stub):
43  m_client_stub(client_stub) {}
44  virtual ~Client();
45  virtual bool SendDMX(unsigned int universe_id, uint8_t priority,
46  const DmxBuffer &buffer);
47 
48  void SendDMXCallback(ola::rpc::SimpleRpcController *controller,
49  ola::proto::Ack *ack);
50  void DMXRecieved(unsigned int universe, const DmxSource &source);
51  const DmxSource SourceData(unsigned int universe) const;
52  class OlaClientService_Stub *Stub() const { return m_client_stub; }
53 
54  private:
55  Client(const Client&);
56  Client& operator=(const Client&);
57 
58  class OlaClientService_Stub *m_client_stub;
59  map<unsigned int, DmxSource> m_data_map;
60 };
61 } // namespace ola
62 #endif // OLAD_CLIENT_H_