|
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 serviceipc_h |
|
19 #define serviceipc_h |
|
20 |
|
21 #include "serviceipcdefs.h" |
|
22 #include <QtCore> |
|
23 |
|
24 namespace WRT { |
|
25 |
|
26 class ServiceFwIPCPrivate; |
|
27 |
|
28 class SFWIPC_EXPORT ServiceFwIPC : public QObject |
|
29 { |
|
30 Q_OBJECT |
|
31 public: |
|
32 |
|
33 //! ServiceFwIPC::ServiceIPCErrors |
|
34 /*! |
|
35 This enum describes the errors that may be returned by the IPC. |
|
36 */ |
|
37 enum ServiceIPCErrors |
|
38 { |
|
39 EConnectionError = -5000, /*!< Error in IPC Connection */ |
|
40 EConnectionClosed, /*!< IPC Connection is closed */ |
|
41 EServerNotFound, /*!< Can not find server */ |
|
42 EIPCError, /*!< Known IPC error defined by SDK */ |
|
43 EUnknownError /*!< Unknown IPC error */ |
|
44 }; |
|
45 |
|
46 public: |
|
47 virtual ~ServiceFwIPC(); |
|
48 |
|
49 explicit ServiceFwIPC(QObject* aParent, TServiceIPCBackends aBackend = EDefaultIPC); |
|
50 |
|
51 public: |
|
52 bool connect(const QString& aServerName); |
|
53 |
|
54 void disconnect(); |
|
55 |
|
56 bool startServer(const QString& aServerName, const QString& aExeName); |
|
57 |
|
58 bool sendSync(const QString& aRequestType, const QByteArray& aData); |
|
59 |
|
60 void sendAsync(const QString& aRequestType, const QByteArray& aData); |
|
61 |
|
62 QByteArray readAll(); |
|
63 |
|
64 bool requestPending(); |
|
65 |
|
66 bool getSessionId(int& aSessionId); |
|
67 |
|
68 bool setSessionId(int aSessionId); |
|
69 private: |
|
70 bool waitForRead(); |
|
71 |
|
72 signals: |
|
73 |
|
74 void error(int aError); |
|
75 |
|
76 void readyRead(); |
|
77 |
|
78 // Member Variables |
|
79 protected: |
|
80 bool m_AsyncRequestPending; |
|
81 |
|
82 friend class ServiceFwIPCPrivate; |
|
83 ServiceFwIPCPrivate* d; |
|
84 }; |
|
85 |
|
86 } |
|
87 #endif // serviceipc_h |