|
1 /** |
|
2 This file is part of CWRT package ** |
|
3 |
|
4 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** |
|
5 |
|
6 This program is free software: you can redistribute it and/or modify |
|
7 it under the terms of the GNU (Lesser) General Public License as |
|
8 published by the Free Software Foundation, version 2.1 of the License. |
|
9 This program is distributed in the hope that it will be useful, but |
|
10 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 (Lesser) General Public License for more details. You should have |
|
13 received a copy of the GNU (Lesser) General Public License along |
|
14 with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef serviceipcserversession_h |
|
19 #define serviceipcserversession_h |
|
20 |
|
21 #include <QtCore> |
|
22 #include "clientinfo.h" |
|
23 |
|
24 namespace WRT { |
|
25 |
|
26 class MServiceIPCObserver; |
|
27 class ServiceIPCRequest; |
|
28 |
|
29 class ServiceIPCSession : public QObject |
|
30 { |
|
31 Q_OBJECT |
|
32 public: |
|
33 |
|
34 ServiceIPCSession(MServiceIPCObserver* aObserver); |
|
35 |
|
36 virtual ~ServiceIPCSession(); |
|
37 |
|
38 virtual bool write(const QByteArray& aData) = 0; |
|
39 |
|
40 virtual bool completeRequest() = 0; |
|
41 |
|
42 virtual void close() = 0; |
|
43 |
|
44 virtual void releaseSessionId(int aSessionId) = 0; |
|
45 |
|
46 virtual void appendBroadcastList(int aSessionId, ServiceIPCSession * aSession) = 0; |
|
47 |
|
48 inline void setClientInfo(ClientInfo* aClientInfo) |
|
49 { |
|
50 m_clientInfo = aClientInfo; |
|
51 }; |
|
52 inline bool getReadyToSend() const |
|
53 { |
|
54 return m_readyToSend; |
|
55 }; |
|
56 inline void setReadyToSend(bool readyToSend) |
|
57 { |
|
58 m_readyToSend = readyToSend; |
|
59 }; |
|
60 inline void appendMessageList(const QByteArray& aMessage) |
|
61 { |
|
62 m_messageList.append(aMessage); |
|
63 }; |
|
64 inline bool messageListIsEmpty() const |
|
65 { |
|
66 return m_messageList.isEmpty(); |
|
67 }; |
|
68 protected: |
|
69 void handleReq(); |
|
70 protected: |
|
71 // data |
|
72 bool m_isPendingRequest; |
|
73 MServiceIPCObserver* m_observer; |
|
74 ServiceIPCRequest* m_curRequest; |
|
75 ClientInfo* m_clientInfo; |
|
76 bool m_appendToBList; |
|
77 private: |
|
78 QList<QByteArray> m_messageList; |
|
79 bool m_readyToSend; |
|
80 }; |
|
81 |
|
82 } |
|
83 #endif // Q_SERVICE_IPC_SESSION_H |