|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Custom plug-in implementations offer their own API documentation |
|
15 * where detailed characteristics about how methods declared in this |
|
16 * class are implemented. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #ifndef SEN_HOSTLET_CONNECTION_IMPL_H |
|
31 #define SEN_HOSTLET_CONNECTION_IMPL_H |
|
32 |
|
33 // INCLUDES |
|
34 #include <e32property.h> |
|
35 #include <flogger.h> |
|
36 |
|
37 #include "SenHostletConnection.h" // public |
|
38 |
|
39 #include "rsenhostletconnection.h" |
|
40 #include "senpointermap.h" |
|
41 #include "senlogger.h" |
|
42 #include "sendebug.h" |
|
43 |
|
44 #include "senregistrationtimer.h" |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 class MSenHostlet; |
|
48 class MSenHostletRequest; |
|
49 class MSenHostletResponse; |
|
50 //class MSenServiceDescription; |
|
51 class CSenChunk; |
|
52 class CSenAsyncOperation; |
|
53 class CSenHostletTransaction; |
|
54 class CSenIdentifier; |
|
55 class CSenHostletRequest; |
|
56 class CSenHostletResponse; |
|
57 class CSenFileProgressObserver; |
|
58 |
|
59 // TYPEDEFS |
|
60 typedef RSenPointerMap<TInt, CSenHostletTransaction> RHostletTransactionMap; |
|
61 |
|
62 |
|
63 // CLASS DECLARATION |
|
64 |
|
65 /** |
|
66 * Custom plug-in implementations offer their own API documentation |
|
67 * where detailed characteristics about how methods declared in this |
|
68 * class are implemented. |
|
69 */ |
|
70 class CSenHostletConnectionImpl : public CSenHostletConnection, MSenRegistrationActor |
|
71 { |
|
72 friend class CSenAsyncOperation; |
|
73 public: |
|
74 |
|
75 // Constructors and destructor: |
|
76 static CSenHostletConnectionImpl* NewL(MSenHostlet& aProvider); |
|
77 |
|
78 static CSenHostletConnectionImpl* NewLC(MSenHostlet& aProvider); |
|
79 |
|
80 virtual ~CSenHostletConnectionImpl(); |
|
81 |
|
82 // New functions: |
|
83 virtual TInt RespondL(MSenHostletResponse& aResponse); |
|
84 |
|
85 virtual TInt Identifier(); |
|
86 |
|
87 |
|
88 protected: // Functions from base classes |
|
89 |
|
90 // from CActive |
|
91 void RunL(); |
|
92 void DoCancel(); |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * C++ default constructor. |
|
98 */ |
|
99 CSenHostletConnectionImpl(MSenHostlet& aProvider); |
|
100 |
|
101 /** |
|
102 * By default Symbian 2nd phase constructor is private. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 // New functions |
|
107 TInt EstablishConnectionL(MSenHostlet& aProvider); |
|
108 TInt RegisterAndSubscribeFileProgressObserversL(); |
|
109 |
|
110 // Utility functions: |
|
111 RHostletTransactionMap& HostletTransactionMapL(); |
|
112 TPtrC SessionID(); |
|
113 RPointerArray<CSenAsyncOperation>& AsyncOpsArrayL(); |
|
114 void HandleErrorFromChildAOL(TInt aError, TInt aTxnId, const TDesC8& aDesc, CSenAsyncOperation& aChild); |
|
115 void HandleMessageFromChildAOL(TInt aStatus, CSenAsyncOperation& aChild); |
|
116 |
|
117 TInt RegisterFilesObserver(); |
|
118 private: // Data |
|
119 RSenHostletConnection iConnection; // owned |
|
120 MSenHostlet& iProvider; // not owned |
|
121 |
|
122 TInt iResponseLength; |
|
123 TInt iErrorNumber; |
|
124 TPtr8 iErrorNumberBuffer; |
|
125 TInt iTxnId; |
|
126 TPtr8 iTxnIdBuffer; |
|
127 |
|
128 RHostletTransactionMap* iHostletTransactionMap; |
|
129 |
|
130 HBufC* ipSessionId; |
|
131 TPtr iSessionIdBuffer; |
|
132 TInt iChunkNameNumber; |
|
133 HBufC* ipChunkName; |
|
134 TBool iAlive; |
|
135 |
|
136 TBool iTransactionIdKnown; |
|
137 TUint iAsyncOpsCount; |
|
138 RPointerArray<CSenAsyncOperation>* iAsyncOpsArray; |
|
139 TInt iConnectionID; |
|
140 MSenFilesObserver* iFilesObserver; |
|
141 TInt iTlsLogChannel; |
|
142 TAny* ipInterface; |
|
143 TBool iCancelSession; |
|
144 CSenFileProgressObserver* ipFileProgressObserver; // owned |
|
145 TBool iRegisterFileObserverDone; |
|
146 CSenRegistrationTimer* ipRegistrationTimer; |
|
147 }; |
|
148 |
|
149 #ifdef EKA2 |
|
150 NONSHARABLE_CLASS(CSenAsyncOperation) : public CActive |
|
151 #else |
|
152 class CSenAsyncOperation : public CActive |
|
153 #endif |
|
154 { |
|
155 public: // Constructors and destructor |
|
156 static CSenAsyncOperation* NewL(CSenHostletConnectionImpl* aActive); |
|
157 static CSenAsyncOperation* NewLC(CSenHostletConnectionImpl* aActive); |
|
158 virtual ~CSenAsyncOperation(); |
|
159 |
|
160 protected: // Functions from base classes |
|
161 // from CActive |
|
162 void RunL(); |
|
163 void DoCancel(); |
|
164 TInt RunError(TInt aError); |
|
165 |
|
166 private: |
|
167 /** |
|
168 * By default Symbian 2nd phase constructor is private. |
|
169 */ |
|
170 void ConstructL(); |
|
171 CSenAsyncOperation(CSenHostletConnectionImpl* iActive); |
|
172 |
|
173 public: // Data |
|
174 CSenHostletConnectionImpl* iActive; |
|
175 TInt iErrorNumber; |
|
176 TPtr8 iErrorNumberBuffer; |
|
177 TInt iTxnId; |
|
178 TPtr8 iTxnIdBuffer; |
|
179 }; |
|
180 |
|
181 #ifdef EKA2 |
|
182 NONSHARABLE_CLASS(CSenHostletTransaction) : public CBase |
|
183 #else |
|
184 class CSenHostletTransaction : public CBase |
|
185 #endif |
|
186 { |
|
187 public: // Constructors and destructor |
|
188 static CSenHostletTransaction* NewL(CSenChunk* aSenChunk); |
|
189 static CSenHostletTransaction* NewLC(CSenChunk* aSenChunk); |
|
190 virtual ~CSenHostletTransaction(); |
|
191 |
|
192 void SetChunk(CSenChunk* aChunk); |
|
193 CSenChunk* Chunk(); |
|
194 |
|
195 void SetIdentifier(CSenIdentifier* aIdentifier); |
|
196 CSenIdentifier* Identifier(); |
|
197 |
|
198 void SetRequest(CSenHostletRequest* aRequest); |
|
199 CSenHostletRequest* Request(); |
|
200 |
|
201 void SetResponse(CSenHostletResponse* aResponse); |
|
202 CSenHostletResponse* Response(); |
|
203 |
|
204 private: |
|
205 CSenHostletTransaction(CSenChunk* aSenChunk); |
|
206 |
|
207 private: // Data |
|
208 CSenChunk* iSenChunk; |
|
209 CSenIdentifier* iIdentifier; |
|
210 CSenHostletRequest* iRequest; |
|
211 CSenHostletResponse* iResponse; |
|
212 }; |
|
213 |
|
214 #ifdef EKA2 |
|
215 NONSHARABLE_CLASS(CSenFileProgressObserver) : public CActive |
|
216 #else |
|
217 class CSenFileProgressObserver : public CActive |
|
218 #endif |
|
219 { |
|
220 public: |
|
221 static CSenFileProgressObserver* NewL( MSenFilesObserver& aObserver, |
|
222 TInt aConnectionID ); |
|
223 |
|
224 static CSenFileProgressObserver* NewLC( MSenFilesObserver& aObserver, |
|
225 TInt aConnectionID ); |
|
226 ~CSenFileProgressObserver(); |
|
227 |
|
228 private: |
|
229 CSenFileProgressObserver( MSenFilesObserver& aObserver, |
|
230 TInt aConnectionID ); |
|
231 void ConstructL(); |
|
232 /* |
|
233 * Method update the consumer about the file progress transfer info |
|
234 */ |
|
235 void RunL(); |
|
236 void DoCancel(); |
|
237 TInt RunError(TInt aError); |
|
238 |
|
239 private: |
|
240 RProperty iFileProgressProperty; |
|
241 MSenFilesObserver* iFileProgressObserver; // not owned |
|
242 TInt iConnectionID; |
|
243 }; |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 #endif //SEN_HOSTLET_CONNECTION_IMPL_H |
|
249 |
|
250 // End of File |