RDK Documentation (Open Sourced RDK Components)
Server.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup trm
23 * @{
24 * @defgroup qtapp
25 * @{
26 **/
27 
28 
29 #ifndef _TRM_SERVER_H
30 #define _TRM_SERVER_H
31 #include <QObject>
32 #include <QtCore>
33 #include <QTcpServer>
34 #include <QList>
35 #include <QMap>
36 #include <QThreadPool>
37 
38 #include "Connection.h"
39 
40 namespace TRM {
41 
42 class Server : public QObject
43 {
44  Q_OBJECT
45 public:
46  Server(const QHostAddress &address, quint16 port);
47  virtual ~Server(void);
48  void close(void);
49  const Connection & getConnection(uint32_t clientId) const;
50  void getConnections(std::list<const Connection *> &) const;
51 
52 private slots:
53  void onDisconnected(Connection *connection);
54  void onMessageReceived(const Connection &fromConnection);
55  void onHasMessageToSend(const std::vector<uint8_t> out);
56  void onReservationUpdated(void);
57  void onNewConnection(void);
58 
59 // void onTunerReservationExpired(const TunerReservation, QString reason);
60 
61 private:
62 
63 private:
64  void sendResponseObject(const std::vector<uint8_t> &out, const Connection &connection);
65  QList<const Connection *>connections;
66  QMap<uint32_t, const Connection *> connectionClientMap;
67  QTcpServer *tcpServer;
68 
69 };
70 
71 }
72 #endif
73 
74 
75 /** @} */
76 /** @} */
TRM::Server
Definition: Server.h:42
TRM::Connection
Definition: Connection.h:43