|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: Symbian client side implementation for APA SERVER IPC |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef C_XQSERVICEIPC_APASYMBIAN_H |
|
23 #define C_XQSERVICEIPC_APASYMBIAN_H |
|
24 |
|
25 #include <xqserviceipc_p.h> |
|
26 #include <xqsharablefile.h> |
|
27 #include "xqserviceipc_apasymbiansession.h" |
|
28 |
|
29 namespace QtService { |
|
30 |
|
31 // Sharable file utility |
|
32 bool TransferSharableFile(TIpcArgs *args, const XQSharableFile *file); |
|
33 |
|
34 class CApaSymbianIPC : public CActive, public ServiceFwIPCPrivate, |
|
35 public MApaServerAppExitObserver |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 virtual ~CApaSymbianIPC(); |
|
41 |
|
42 static CApaSymbianIPC* NewL(); |
|
43 |
|
44 // From ServiceFwIPCPrivate |
|
45 protected: |
|
46 |
|
47 bool connect(const QString& aServerName); |
|
48 |
|
49 void disconnect(); |
|
50 |
|
51 bool startServer(const QString& aServerName, const QString& aExeName, quint64& processId, int options = 0); |
|
52 |
|
53 bool sendSync(const QString& aRequestType, const QByteArray& aData); |
|
54 |
|
55 void sendAsync(const QString& aRequestType, const QByteArray& aData); |
|
56 |
|
57 void readAll(QByteArray& aArray); |
|
58 |
|
59 QByteArray readAll(); |
|
60 |
|
61 bool waitForRead(); |
|
62 |
|
63 // From CActive |
|
64 protected: |
|
65 |
|
66 void RunL(); |
|
67 |
|
68 TInt RunError(TInt err); |
|
69 |
|
70 void DoCancel(); |
|
71 |
|
72 // From MApaServerAppExitObserver |
|
73 protected: |
|
74 /** |
|
75 * HandleServerAppExit |
|
76 * Gets called when server application exits |
|
77 */ |
|
78 void HandleServerAppExit( int aReason ); |
|
79 |
|
80 private: |
|
81 |
|
82 enum TState |
|
83 { |
|
84 ESend, |
|
85 ERead, |
|
86 EDone |
|
87 }; |
|
88 |
|
89 void doReadAllL(QByteArray& aArray); |
|
90 |
|
91 QByteArray doReadAllL(); |
|
92 |
|
93 int doMapErrors( TInt aError ); |
|
94 |
|
95 private: |
|
96 |
|
97 CApaSymbianIPC(); |
|
98 |
|
99 void ConstructL(); |
|
100 |
|
101 void StartExitMonitor(); |
|
102 |
|
103 private: |
|
104 RApaIPCSession iSession; |
|
105 HBufC8* iAsyncData; // member variable to keep alive any data for async ops |
|
106 TPtrC8 iAsyncDataPtr; |
|
107 HBufC* iRequestData; |
|
108 TPtrC iRequestDataPtr; |
|
109 TInt iDataSize; |
|
110 TState iState; |
|
111 /** |
|
112 * Exit monitor |
|
113 */ |
|
114 CApaServerAppExitMonitor* iServerExitMonitor; |
|
115 QByteArray* iArray; //not owed |
|
116 RBuf8 iBuf; |
|
117 }; |
|
118 } |
|
119 #endif // C_XQSERVICEIPC_APASYMBIAN_H |