33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2009 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: LaunchBrowser command handler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CLAUNCHBROWSERHANDLER_H
|
|
20 |
#define CLAUNCHBROWSERHANDLER_H
|
|
21 |
|
|
22 |
#include <etelsat.h>
|
|
23 |
#include <etelpckt.h>
|
|
24 |
#include <w32std.h> // WsSession
|
|
25 |
#include <apgtask.h> // TApaTask
|
53
|
26 |
// Legacy Symbian browser UID
|
|
27 |
const static TInt KWmlcHandler = 0x10008D39; // WML Browser
|
33
|
28 |
|
|
29 |
#include "CSatCommandHandler.h"
|
|
30 |
#include "SatSTypes.h" // TSatQuery
|
|
31 |
|
|
32 |
class MSatUtils;
|
|
33 |
class RCmManager;
|
|
34 |
class RCmConnectionMethod;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Command handler for LaunchBrowser command.
|
|
38 |
*
|
|
39 |
* @lib LaunchBrowserCmd.lib
|
|
40 |
* @since S60 v3.0
|
|
41 |
*/
|
|
42 |
class CLaunchBrowserHandler : public CSatCommandHandler
|
|
43 |
{
|
|
44 |
|
|
45 |
public:
|
|
46 |
|
|
47 |
static CLaunchBrowserHandler* NewL( MSatUtils* aUtils );
|
|
48 |
|
|
49 |
virtual ~CLaunchBrowserHandler();
|
|
50 |
|
|
51 |
// from base class MSatCommand
|
|
52 |
|
|
53 |
/**
|
|
54 |
* From MSatCommand.
|
|
55 |
* Response from the client.
|
|
56 |
*
|
|
57 |
*/
|
|
58 |
void ClientResponse();
|
|
59 |
|
|
60 |
// from base class CSatCommandHandler
|
|
61 |
|
|
62 |
/**
|
|
63 |
* From CSatCommandHandler.
|
|
64 |
* Event notification.
|
|
65 |
*
|
|
66 |
* @param aEvent An event that is occured.
|
|
67 |
*/
|
|
68 |
void Event( TInt aEvent );
|
|
69 |
|
|
70 |
protected:
|
|
71 |
|
|
72 |
// from base class CActive
|
|
73 |
|
|
74 |
/**
|
|
75 |
* From CActive.
|
|
76 |
* Cancels the usat request.
|
|
77 |
*
|
|
78 |
*/
|
|
79 |
void DoCancel();
|
|
80 |
|
|
81 |
// from base class CSatCommandHandler
|
|
82 |
|
|
83 |
/**
|
|
84 |
* From CSatCommandHandler.
|
|
85 |
* Requests the command notification.
|
|
86 |
*
|
|
87 |
* @param aStatus Request status
|
|
88 |
*/
|
|
89 |
void IssueUSATRequest( TRequestStatus& aStatus );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* From CSatCommandHandler.
|
|
93 |
* Precheck before executing the command.
|
|
94 |
*
|
|
95 |
* @return TBool indicating command is currently allowed.
|
|
96 |
*/
|
|
97 |
TBool CommandAllowed();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* From CSatCommandHandler.
|
|
101 |
* Need for ui session.
|
|
102 |
*
|
|
103 |
* @return TBool indicating need of ui session.
|
|
104 |
*/
|
|
105 |
TBool NeedUiSession();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* From CSatCommandHandler.
|
|
109 |
* Called when USAT API notifies that command.
|
|
110 |
*
|
|
111 |
*/
|
|
112 |
void HandleCommand();
|
|
113 |
|
|
114 |
/**
|
|
115 |
* From CSatCommandHandler.
|
|
116 |
* Indicates the failure of launching ui client.
|
|
117 |
*
|
|
118 |
*/
|
|
119 |
void UiLaunchFailed();
|
|
120 |
|
|
121 |
private:
|
|
122 |
|
|
123 |
CLaunchBrowserHandler();
|
|
124 |
|
|
125 |
void ConstructL();
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Checks if Browser application is launched.
|
|
129 |
*
|
|
130 |
* @return The result of the operation.
|
|
131 |
*/
|
|
132 |
TBool BrowserExists();
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Closes the Browser application if it is active.
|
|
136 |
*
|
|
137 |
* @return The result of the operation.
|
|
138 |
*/
|
|
139 |
void CloseBrowser();
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Launches The Browser with URL.
|
|
143 |
*
|
|
144 |
* @param aParam, Reference to the parameter for the Browser
|
|
145 |
* application.
|
|
146 |
* @param aAccessPointUid, Reference to the accesspoint uid.
|
|
147 |
*/
|
|
148 |
void LaunchWithUrlL(
|
|
149 |
const TDesC& aParam,
|
|
150 |
const TUid& aAccessPointUid );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Handle the Launch Browser command.
|
|
154 |
*
|
|
155 |
*/
|
|
156 |
void LaunchBrowserL();
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Starts timer. Function returns as the given time has elapsed or
|
|
160 |
* timer is cancelled.
|
|
161 |
*
|
|
162 |
* @param aDelay Delay from the function call to complete function in
|
|
163 |
* microseconds
|
|
164 |
* @param aInterval Interval to complete wait after aDelay, zero by
|
|
165 |
* default
|
|
166 |
*/
|
|
167 |
void After(
|
|
168 |
const TTimeIntervalMicroSeconds32& aDelay,
|
|
169 |
const TTimeIntervalMicroSeconds32& aInterval = 0 );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Called after given delay in After function.
|
|
173 |
* Causes the After function to complete
|
|
174 |
*
|
|
175 |
* @param aPtr Pointer to itself since this is static function
|
|
176 |
* @return whether to call function again after an interval
|
|
177 |
*/
|
|
178 |
static TInt DelayCallBack( TAny* aPtr );
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Create a new APN with given parameters using Access Point engine.
|
|
182 |
*
|
|
183 |
* @param aApName APN name.
|
|
184 |
* @param aProxyServerAddr Proxy/Gateway server address.
|
|
185 |
* @param aProxyPortNumber Proxy server port number.
|
|
186 |
* @param aIPvType Gateway address IP type.
|
|
187 |
*
|
|
188 |
* @return the ID for the new APN
|
|
189 |
*/
|
|
190 |
TUint32 CreateAccessPointL( const TDesC16& aApName,
|
|
191 |
const TDesC16& aProxyServerAddr,
|
|
192 |
const TUint32 aProxyPortNumber,
|
|
193 |
const RPacketContext::TProtocolType& aIPvType );
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Select an Access Point by the given gateway address. Create one if
|
|
197 |
* there is not a corresponding AP.
|
|
198 |
*
|
|
199 |
* @return IAP id from GCF connection method.
|
|
200 |
*/
|
|
201 |
TUint32 GetAccessPointByGatewayAddressL();
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Get an Access Point by default.
|
|
205 |
*
|
|
206 |
* @return IAP id from default connection method.
|
|
207 |
*/
|
|
208 |
TUint32 GetAccessPointByDefaultL();
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Get default Url by access point id.
|
|
212 |
*
|
|
213 |
* @param aApId Input IAP id by given connection method.
|
|
214 |
* @return Default Url by given connection method.
|
|
215 |
*/
|
|
216 |
HBufC* GetDefaultUrlByAccessPointLC( TUint32 aApId );
|
|
217 |
|
|
218 |
/**
|
|
219 |
* A gateway address is required to be a IP address in
|
|
220 |
* connection method, so it is necessary to check
|
|
221 |
* the validity of the gateway address to avioding leave in
|
|
222 |
* APE.
|
|
223 |
*
|
|
224 |
* @param aAddress A gateway address.
|
|
225 |
* @return EIPv4 if the gateway address is a valid IPv4 address.
|
|
226 |
* EIPv6 if the gateway address is a valid IPv6 address.
|
|
227 |
* otherwise return 0 to indicate a invalid IP address.
|
|
228 |
*/
|
|
229 |
TInt ValidateGatewayAddress( const TDesC16& aAddress );
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Check the validity of a IPv4 address.
|
|
233 |
*
|
|
234 |
* @param aAddress A IPv4 address.
|
|
235 |
* @return ETrue if the address is a valid IPv4 address.
|
|
236 |
*/
|
|
237 |
TBool ValidateIPv4Address( const TDesC16& aAddress );
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Check the validity of a IPv6 address.
|
|
241 |
*
|
|
242 |
* @param aAddress A IPv6 address.
|
|
243 |
* @return ETrue if the address is a valid IPv6 address.
|
|
244 |
*/
|
|
245 |
TBool ValidateIPv6Address( const TDesC16& aAddress );
|
|
246 |
|
|
247 |
/**
|
|
248 |
* Convert a descriptor to a integer.
|
|
249 |
*
|
|
250 |
* @param aAddress A descriptor.
|
|
251 |
* @return Integer value.
|
|
252 |
*/
|
|
253 |
TInt ConvertDesToInt( const TDesC16& aValue );
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Check the validity of a descriptor in hex.
|
|
257 |
*
|
|
258 |
* @param aAddress A descriptor.
|
|
259 |
* @return ETrue if each character in the descriptor is a valid
|
|
260 |
* hexadecimal.
|
|
261 |
*/
|
|
262 |
TBool ValidateHexadecimal( const TDesC16& aHex );
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Separate the port number from a address if it is existing. For example,
|
|
266 |
* 210.13.246.172:8080.
|
|
267 |
*
|
|
268 |
* @param aAddress A address.
|
|
269 |
* @param aPureAddr The pure address without any additional info.
|
|
270 |
* @param aPortNumber The port number.
|
|
271 |
* @return None.
|
|
272 |
*/
|
|
273 |
void SeparatePortNumberFromAddress( const TDesC16& aAddress,
|
|
274 |
TDes16& aPureAddr, TUint32& aPortNumber );
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Fulfill connecion method with default params.
|
|
278 |
*
|
|
279 |
* @param aCmManager Connection method manager.
|
|
280 |
* @param aCm Output reference to RCmConnectionMethod.
|
|
281 |
* @return None
|
|
282 |
*/
|
|
283 |
void FulfillConnnectionMethodL( RCmManager& aCmManager,
|
|
284 |
RCmConnectionMethod& aCm );
|
|
285 |
|
|
286 |
/**
|
|
287 |
* Check the validity of offered bearer type
|
|
288 |
*
|
|
289 |
* @param aCm reference to RCmConnectionMethod.
|
|
290 |
* @param aIsValid Output KErrNone if connection method is valid.
|
|
291 |
* @return None
|
|
292 |
*/
|
|
293 |
void ValidateBearerTypeL( RCmConnectionMethod& aCm, TInt& aIsValid );
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Get default connection method.
|
|
297 |
*
|
|
298 |
* @param aCmManager Input Connection method manager.
|
|
299 |
* @param aDefCm Output reference to RCmConnectionMethod.
|
|
300 |
* @param aIsValid Output KErrNone if found
|
|
301 |
* @return None
|
|
302 |
*/
|
|
303 |
void GetDefConnMethodL( RCmManager& aCmManager,
|
|
304 |
RCmConnectionMethod& aDefCm,
|
|
305 |
TInt& aIsValid );
|
|
306 |
|
|
307 |
private: // data
|
|
308 |
|
|
309 |
/**
|
|
310 |
* LaunchBrowser command data.
|
|
311 |
*/
|
|
312 |
RSat::TLaunchBrowserV2 iLaunchBrowserData;
|
|
313 |
|
|
314 |
/**
|
|
315 |
* LaunchBrowser command package.
|
|
316 |
*/
|
|
317 |
RSat::TLaunchBrowserV2Pckg iLaunchBrowserPckg;
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Response from client
|
|
321 |
*/
|
|
322 |
RSat::TLaunchBrowserRspV2 iLaunchBrowserRsp;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Response package.
|
|
326 |
*/
|
|
327 |
RSat::TLaunchBrowserRspV2Pckg iLaunchBrowserRspPckg;
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Query command data
|
|
331 |
*/
|
|
332 |
TSatQueryV1 iQueryData;
|
|
333 |
|
|
334 |
/**
|
|
335 |
* Query package
|
|
336 |
*/
|
|
337 |
TSatQueryV1Pckg iQueryPckg;
|
|
338 |
|
|
339 |
/**
|
|
340 |
* Query response
|
|
341 |
*/
|
|
342 |
TSatQueryRspV1 iQueryRsp;
|
|
343 |
|
|
344 |
/**
|
|
345 |
* Query response package
|
|
346 |
*/
|
|
347 |
TSatQueryRspV1Pckg iQueryRspPckg;
|
|
348 |
|
|
349 |
/**
|
|
350 |
* Window server session
|
|
351 |
*/
|
|
352 |
RWsSession iWsSession;
|
|
353 |
|
|
354 |
/**
|
|
355 |
* Application UID of the Browser.
|
|
356 |
*/
|
|
357 |
TUid iUidWmlBrowser;
|
|
358 |
|
|
359 |
/**
|
|
360 |
* Indicates does this command need UI session ot not
|
|
361 |
*/
|
|
362 |
TBool iNeedUiSession;
|
|
363 |
|
|
364 |
/**
|
|
365 |
* Blocker for After
|
|
366 |
*/
|
|
367 |
CActiveSchedulerWait iAfterWait;
|
|
368 |
|
|
369 |
/**
|
|
370 |
* Timer used in After
|
|
371 |
*/
|
|
372 |
CPeriodic* iAfterTimer;
|
|
373 |
|
|
374 |
/**
|
|
375 |
* Flag to signal that command has icon data
|
|
376 |
* To be removed when icons are allowed in this command
|
|
377 |
*/
|
|
378 |
TBool iIconCommand;
|
|
379 |
};
|
|
380 |
|
|
381 |
#endif // CLAUNCHBROWSERHANDLER_H
|
|
382 |
|