RDK Documentation (Open Sourced RDK Components)
Client.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_CLIENT_H
30 #define _TRM_CLIENT_H
31 #include <QObject>
32 #include <QtCore>
33 #include <QTcpServer>
34 #include <QList>
35 #include <QApplication>
36 
37 #include "Connection.h"
38 #include "trm/MessageProcessor.h"
39 
40 namespace TRM {
41 
42 class Client : public QObject
43 {
44  Q_OBJECT
45 public:
46  Client (const char *ipaddress, int portNumber);
47  Client(const QHostAddress &address, quint16 port);
48  virtual ~Client(void);
49  const Connection & getConnection(void) const { return *connection;}
50 
51 private slots:
52  void onDisconnected(Connection *_connection);
53  void onMessageReceived(const Connection &fromConnection);
54  virtual MessageProcessor & getMessageProcessor(uint32_t inClientId) {
55  static MessageProcessor proc;
56  return proc;
57  }
58 protected:
59  QTcpSocket tcpSocket;
60  Connection *connection;
61 
62 };
63 
64 }
65 
66 #endif
67 
68 
69 /** @} */
70 /** @} */
TRM::MessageProcessor
Definition: MessageProcessor.h:39
TRM::Client
Definition: Client.h:42
TRM::Connection
Definition: Connection.h:43