33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2010 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: Handles LaunchBrowser command
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <MSatShellController.h>
|
|
21 |
#include <cmmanager.h>
|
|
22 |
#include <cmconnectionmethod.h>
|
|
23 |
#include <cmconnectionmethoddef.h>
|
|
24 |
#include <cmpluginpacketdatadef.h>
|
|
25 |
#include <cmdestination.h>
|
|
26 |
|
|
27 |
#include "MSatApi.h"
|
|
28 |
#include "MSatUtils.h"
|
|
29 |
#include "MSatUiSession.h"
|
|
30 |
#include "SatSOpcodes.h"
|
|
31 |
#include "MSatSUiClientHandler.h"
|
|
32 |
#include "CLaunchBrowserHandler.h"
|
|
33 |
#include "SatLog.h"
|
|
34 |
#include "MSatSystemState.h"
|
|
35 |
|
|
36 |
// The pause constant for checking if BrowserApp has exited.
|
|
37 |
// This value may be adjusted to ensure the time sequence
|
|
38 |
const TInt KSatSShortLoopTimeout = 800000; //0.8 sec
|
|
39 |
|
|
40 |
// How many times the browser status is checked, when waiting for
|
|
41 |
// browser shutdown. Total time
|
|
42 |
// used to check the exiting of browser app is
|
|
43 |
// KSatSWaitCount * KSatSShortLoopTimeout.
|
|
44 |
const TInt KSatSWaitCount = 10;
|
|
45 |
|
|
46 |
// Invalid PDP type
|
|
47 |
const TInt KSatInvalidPdpType = -1;
|
|
48 |
|
|
49 |
#ifdef _DEBUG
|
|
50 |
// Class name for error information.
|
|
51 |
//lint -e752 Accessed in __ASSERT_DEBUG, but lint will not notice it.
|
|
52 |
_LIT( KLaunchBrowserHandlerName, "CLaunchBrowserHandler" );
|
|
53 |
#endif
|
|
54 |
|
|
55 |
const TInt KSatMaxIPv4AddressLength( 15 );
|
|
56 |
const TInt KSatMaxIPv6AddressLength( 39 );
|
|
57 |
const TInt KSatMinIPv4AddressLength( 7 );
|
|
58 |
const TInt KSatMinIPv6AddressLength( 7 );
|
|
59 |
const TInt KSatMaxIPv4SegmentCounter( 3 );
|
|
60 |
const TInt KSatMaxIPv4SegmentLength( 3 );
|
|
61 |
const TInt KSatIPv4Broadcast( 255 );
|
|
62 |
const TInt KSatIPv4Network( 0 );
|
|
63 |
const TInt KSatMaxIPv6SegmentCounter( 7 );
|
|
64 |
const TInt KSatMaxIPv6SegmentLength( 4 );
|
|
65 |
const TUint32 KSatLaunchBrowserProxyPortNumber( 80 );
|
|
66 |
const TUint32 KSatMaxProxyPortNumber( 9999 );
|
|
67 |
const TUint32 KSatMinProxyPortNumber( 0 );
|
|
68 |
// Granularity for getting connection methods from CM session
|
|
69 |
const TUint32 KSatCMGranularity( 5 );
|
|
70 |
|
|
71 |
_LIT( KSatAccessPointName, "SAT Launch Browser" );
|
|
72 |
_LIT( KSatGprsAccessPointName, "internet" );
|
|
73 |
_LIT( KSatIPv4Delimiter, "." );
|
|
74 |
_LIT( KSatIPv6Delimiter, ":" );
|
|
75 |
|
|
76 |
// ======== MEMBER FUNCTIONS ========
|
|
77 |
// -----------------------------------------------------------------------------
|
|
78 |
// Two-phased constructor.
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
CLaunchBrowserHandler* CLaunchBrowserHandler::NewL( MSatUtils* aUtils )
|
|
82 |
{
|
|
83 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::NewL calling" )
|
|
84 |
|
|
85 |
CLaunchBrowserHandler* self = new( ELeave ) CLaunchBrowserHandler;
|
|
86 |
|
|
87 |
CleanupStack::PushL( self );
|
|
88 |
self->BaseConstructL( aUtils );
|
|
89 |
self->ConstructL();
|
|
90 |
CleanupStack::Pop( self );
|
|
91 |
|
|
92 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::NewL exiting" )
|
|
93 |
return self;
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
// Destructor.
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
CLaunchBrowserHandler::~CLaunchBrowserHandler()
|
|
102 |
{
|
|
103 |
LOG( SIMPLE,
|
|
104 |
"LAUNCHBROWSER: CLaunchBrowserHandler::~CSatSLaunchBrowserHandler \
|
|
105 |
calling" )
|
|
106 |
|
|
107 |
if ( iAfterWait.IsStarted() )
|
|
108 |
{
|
|
109 |
iAfterWait.AsyncStop();
|
|
110 |
}
|
|
111 |
|
|
112 |
if ( iAfterTimer )
|
|
113 |
{
|
|
114 |
iAfterTimer->Cancel();
|
|
115 |
delete iAfterTimer;
|
|
116 |
iAfterTimer = NULL;
|
|
117 |
}
|
|
118 |
|
|
119 |
iWsSession.Close();
|
|
120 |
|
|
121 |
Cancel();
|
|
122 |
|
|
123 |
LOG( SIMPLE,
|
|
124 |
"LAUNCHBROWSER: CLaunchBrowserHandler::~CSatSLaunchBrowserHandler \
|
|
125 |
exiting" )
|
|
126 |
}
|
|
127 |
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
// From class MSatCommand.
|
|
130 |
// Response from the client.
|
|
131 |
// -----------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CLaunchBrowserHandler::ClientResponse()
|
|
134 |
{
|
|
135 |
LOG( SIMPLE,
|
|
136 |
"LAUNCHBROWSER: CLaunchBrowserHandler::ClientResponse calling" )
|
|
137 |
|
|
138 |
// TPCmdResult
|
|
139 |
iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
|
|
140 |
|
|
141 |
// TAdditionalInfoType
|
|
142 |
iLaunchBrowserRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
143 |
iLaunchBrowserRsp.iAdditionalInfo.Zero();
|
|
144 |
iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
|
|
145 |
|
|
146 |
// Perform the action that we just queried the user for.
|
|
147 |
if ( iQueryRsp.iAccepted )
|
|
148 |
{
|
|
149 |
// Launch the Browser.
|
|
150 |
TRAPD( err, LaunchBrowserL() );
|
|
151 |
if ( KErrNone != err )
|
|
152 |
{
|
|
153 |
iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
154 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
155 |
CLaunchBrowserHandler::ClientResponse error: %i", err )
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
LOG( SIMPLE,
|
|
160 |
"LAUNCHBROWSER: CLBH::CR ESetUpMenuRequested registered" )
|
|
161 |
TRAP_IGNORE( iUtils->RegisterL(
|
|
162 |
this, MSatUtils::ESetUpMenuRequested ) )
|
|
163 |
}
|
|
164 |
}
|
|
165 |
else // User denied this action
|
|
166 |
{
|
|
167 |
iLaunchBrowserRsp.iGeneralResult = RSat::KPCmdNotAcceptedByUser;
|
|
168 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
169 |
CLaunchBrowserHandler::ClientResponse not accepted" )
|
|
170 |
if ( iQueryRsp.iSessionTerminatedByUser )
|
|
171 |
{
|
|
172 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
173 |
CLaunchBrowserHandler::ClientResponse close ui session" )
|
|
174 |
// Next SimSession end will close the ui session
|
|
175 |
iUtils->NotifyEvent( MSatUtils::ESessionTerminatedByUser );
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
// If command had icon data and was done succesfully, report that icon
|
|
180 |
// was not shown
|
|
181 |
// To be removed when icons are allowed in this command
|
|
182 |
if ( ( RSat::KSuccess == iLaunchBrowserRsp.iGeneralResult ) &&
|
|
183 |
iIconCommand )
|
|
184 |
{
|
|
185 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
186 |
CLaunchBrowserHandler::ClientResponse icon not display" )
|
|
187 |
iLaunchBrowserRsp.iGeneralResult =
|
|
188 |
RSat::KSuccessRequestedIconNotDisplayed;
|
|
189 |
}
|
|
190 |
|
|
191 |
TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
|
|
192 |
|
|
193 |
LOG( SIMPLE,
|
|
194 |
"LAUNCHBROWSER: CLaunchBrowserHandler::ClientResponse exiting" )
|
|
195 |
}
|
|
196 |
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
// From class CSatCommandHandler.
|
|
199 |
// Event notification
|
|
200 |
// -----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
void CLaunchBrowserHandler::Event( TInt aEvent )
|
|
203 |
{
|
|
204 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::Event calling" )
|
|
205 |
|
|
206 |
switch ( aEvent )
|
|
207 |
{
|
|
208 |
// SetUpMenu is listening by SAT Client.
|
|
209 |
case MSatUtils::ESetUpMenuRequested:
|
|
210 |
{
|
|
211 |
LOG( NORMAL,
|
|
212 |
"LAUNCHBROWSER::Event ESetUpMenuRequested catched and unreg" )
|
|
213 |
iUtils->UnregisterEvent( this, MSatUtils::ESetUpMenuRequested );
|
|
214 |
// Browser is brought to the top after short period of time.
|
|
215 |
//iUtils->SatUiHandler().ShellController().
|
|
216 |
// BringBrowserToForegroundAfterPeriod();
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
|
|
220 |
default:
|
|
221 |
{
|
|
222 |
LOG2( NORMAL, "LAUNCHBROWSER: Unexpected event: %i", aEvent )
|
|
223 |
CSatCommandHandler::Event( aEvent );
|
|
224 |
}
|
|
225 |
}
|
|
226 |
|
|
227 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::Event exiting" )
|
|
228 |
}
|
|
229 |
|
|
230 |
// -----------------------------------------------------------------------------
|
|
231 |
// From class CActive.
|
|
232 |
// Cancels the sat request.
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
void CLaunchBrowserHandler::DoCancel()
|
|
236 |
{
|
|
237 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DoCancel calling" )
|
|
238 |
|
|
239 |
iUtils->USatAPI().NotifyLaunchBrowserCancel();
|
|
240 |
|
|
241 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DoCancel exiting" )
|
|
242 |
}
|
|
243 |
|
|
244 |
// -----------------------------------------------------------------------------
|
|
245 |
// From class CSatCommandHandler.
|
|
246 |
// Requests the command notification.
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
void CLaunchBrowserHandler::IssueUSATRequest( TRequestStatus& aStatus )
|
|
250 |
{
|
|
251 |
LOG( SIMPLE,
|
|
252 |
"LAUNCHBROWSER: CLaunchBrowserHandler::IssueUSATRequest calling" )
|
|
253 |
|
|
254 |
// Clear the IPC package.
|
|
255 |
new (&iLaunchBrowserData) RSat::TLaunchBrowserV2();
|
|
256 |
iQueryRsp.iAccepted = EFalse; // default
|
|
257 |
|
|
258 |
iUtils->USatAPI().NotifyLaunchBrowser( aStatus, iLaunchBrowserPckg );
|
|
259 |
|
|
260 |
LOG( SIMPLE,
|
|
261 |
"LAUNCHBROWSER: CLaunchBrowserHandler::IssueUSATRequest exiting" )
|
|
262 |
}
|
|
263 |
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
// From class CSatCommandHandler.
|
|
266 |
// Precheck before executing the command.
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
TBool CLaunchBrowserHandler::CommandAllowed()
|
|
270 |
{
|
|
271 |
LOG( SIMPLE,
|
|
272 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed calling" )
|
|
273 |
|
|
274 |
iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
|
|
275 |
iLaunchBrowserRsp.iInfoType = RSat::KNoAdditionalInfo;
|
|
276 |
iLaunchBrowserRsp.iAdditionalInfo.Zero();
|
|
277 |
|
|
278 |
RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
|
|
279 |
iUtils->SystemState().GetNetworkRegistrationStatus() );
|
|
280 |
|
|
281 |
TBool commandAllowed( ETrue );
|
|
282 |
|
|
283 |
if ( RSat::EBrowserIdNotSpecified == iLaunchBrowserData.iBrowserId )
|
|
284 |
{
|
|
285 |
// When get unknown browser id, such as RFU value, return
|
|
286 |
// terminal response of command not understood.
|
|
287 |
iLaunchBrowserRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
288 |
commandAllowed = EFalse;
|
|
289 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
290 |
CLaunchBrowserHandler::CommandAllowed unknown browser id" )
|
|
291 |
}
|
|
292 |
else if ( ( RSat::EAlphaIdProvided !=
|
|
293 |
iLaunchBrowserData.iAlphaId.iStatus ) &&
|
|
294 |
( RSat::ESelfExplanatory ==
|
|
295 |
iLaunchBrowserData.iIconId.iQualifier ||
|
|
296 |
RSat::ENotSelfExplanatory ==
|
|
297 |
iLaunchBrowserData.iIconId.iQualifier ) )
|
|
298 |
{
|
|
299 |
iLaunchBrowserRsp.iGeneralResult = RSat::KCmdDataNotUnderstood;
|
|
300 |
commandAllowed = EFalse;
|
|
301 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
302 |
CLaunchBrowserHandler::CommandAllowed icon without alpha id" )
|
|
303 |
}
|
|
304 |
else if (
|
|
305 |
( RMobilePhone::ERegisteredOnHomeNetwork != registrationStatus ) &&
|
|
306 |
( RMobilePhone::ERegisteredRoaming != registrationStatus ) )
|
|
307 |
{
|
|
308 |
iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
309 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
310 |
iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
|
|
311 |
iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoService;
|
|
312 |
commandAllowed = EFalse;
|
|
313 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed\
|
|
314 |
MS is out of service (Net. Reg. status wrong)" )
|
|
315 |
}
|
|
316 |
else if ( RSat::EBrowserSelectionNotSet == iLaunchBrowserData.iBrowserSel )
|
|
317 |
{
|
|
318 |
iLaunchBrowserRsp.iGeneralResult = RSat::KCmdTypeNotUnderstood;
|
|
319 |
commandAllowed = EFalse;
|
|
320 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
321 |
CLaunchBrowserHandler::CommandAllowed selection not set" )
|
|
322 |
}
|
|
323 |
else if ( RSat::ELaunchBrowserIfNotAlreadyLaunched ==
|
|
324 |
iLaunchBrowserData.iBrowserSel )
|
|
325 |
{
|
|
326 |
if ( BrowserExists() )
|
|
327 |
{
|
|
328 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
329 |
iLaunchBrowserRsp.iAdditionalInfo.Append(
|
|
330 |
RSat::KBrowserUnavailable );
|
|
331 |
commandAllowed = EFalse;
|
|
332 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
333 |
CLaunchBrowserHandler::CommandAllowed not launched" )
|
|
334 |
}
|
|
335 |
}
|
|
336 |
else
|
|
337 |
{
|
|
338 |
LOG( SIMPLE,
|
|
339 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed ok" )
|
|
340 |
}
|
|
341 |
|
|
342 |
if ( !commandAllowed )
|
|
343 |
{
|
|
344 |
LOG( SIMPLE,
|
|
345 |
"CLaunchBrowserHandler::CommandAllowed commandAllowed false" )
|
|
346 |
iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
|
|
347 |
TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
|
|
348 |
}
|
|
349 |
// Set icon command flag whether icon data was received and set qualifier
|
|
350 |
// to no icon id
|
|
351 |
// To be removed when icons are allowed in this command
|
|
352 |
else if ( ( RSat::ESelfExplanatory ==
|
|
353 |
iLaunchBrowserData.iIconId.iQualifier ) ||
|
|
354 |
( RSat::ENotSelfExplanatory ==
|
|
355 |
iLaunchBrowserData.iIconId.iQualifier ) )
|
|
356 |
{
|
|
357 |
LOG( SIMPLE,
|
|
358 |
"CLaunchBrowserHandler::CommandAllowed commandAllowed ENoIconId" )
|
|
359 |
iIconCommand = ETrue;
|
|
360 |
iLaunchBrowserData.iIconId.iQualifier = RSat::ENoIconId;
|
|
361 |
}
|
|
362 |
else
|
|
363 |
{
|
|
364 |
iIconCommand = EFalse;
|
|
365 |
}
|
|
366 |
|
|
367 |
LOG2( SIMPLE,
|
|
368 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CommandAllowed exiting, \
|
|
369 |
commandAllowed: %d", commandAllowed )
|
|
370 |
return commandAllowed;
|
|
371 |
}
|
|
372 |
|
|
373 |
// -----------------------------------------------------------------------------
|
|
374 |
// From class CSatCommandHandler.
|
|
375 |
// Answers for need of UI session.
|
|
376 |
// -----------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
TBool CLaunchBrowserHandler::NeedUiSession()
|
|
379 |
{
|
|
380 |
LOG( SIMPLE,
|
|
381 |
"LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession calling" )
|
|
382 |
|
|
383 |
const RSat::TAlphaId alphaId( iLaunchBrowserData.iAlphaId );
|
|
384 |
|
|
385 |
iNeedUiSession = ETrue;
|
|
386 |
|
|
387 |
if ( ( ( alphaId.iStatus == RSat::EAlphaIdProvided &&
|
|
388 |
alphaId.iAlphaId.Length() == 0 ) ||
|
|
389 |
alphaId.iStatus == RSat::EAlphaIdNull ) &&
|
|
390 |
( !iUtils->SystemState().IsConfirmSatOperationsOn() ) )
|
|
391 |
{
|
|
392 |
iNeedUiSession = EFalse;
|
|
393 |
LOG( NORMAL,
|
|
394 |
"LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession no \
|
|
395 |
Ui session needed" )
|
|
396 |
}
|
|
397 |
|
|
398 |
if ( iUtils->CoverUiSupported() && iNeedUiSession )
|
|
399 |
{
|
|
400 |
LOG( NORMAL,
|
|
401 |
"LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession Ui session \
|
|
402 |
needed" )
|
|
403 |
TSatCommandData medEventData;
|
|
404 |
medEventData.iPCmdNumber = RSat::ELaunchBrowser;
|
|
405 |
medEventData.iAlphaId = iLaunchBrowserData.iAlphaId;
|
|
406 |
|
|
407 |
if ( iUtils->SystemState().IsConfirmSatOperationsOn() )
|
|
408 |
{
|
|
409 |
LOG( NORMAL,
|
|
410 |
"LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession \
|
|
411 |
KSatLongDuration" )
|
|
412 |
medEventData.iDuration.iNumOfUnits = KSatLongDuration;
|
|
413 |
}
|
|
414 |
else
|
|
415 |
{
|
|
416 |
medEventData.iDuration.iNumOfUnits = KSatDefaultDuration;
|
|
417 |
}
|
|
418 |
|
|
419 |
medEventData.iDuration.iTimeUnit = RSat::ESeconds;
|
|
420 |
medEventData.iIconID = iLaunchBrowserData.iIconId;
|
|
421 |
TSatCommandPckg tPckg( medEventData );
|
|
422 |
iUtils->RaiseSatEvent( tPckg );
|
|
423 |
}
|
|
424 |
|
|
425 |
LOG2( SIMPLE,
|
|
426 |
"LAUNCHBROWSER: CLaunchBrowserHandler::NeedUiSession exiting, \
|
|
427 |
iNeedUiSession: %d", iNeedUiSession )
|
|
428 |
return iNeedUiSession;
|
|
429 |
}
|
|
430 |
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
// From class CSatCommandHandler.
|
|
433 |
// Called when USAT API notifies that command.
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
void CLaunchBrowserHandler::HandleCommand()
|
|
437 |
{
|
|
438 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand calling" )
|
|
439 |
|
|
440 |
// Register service request handler for LaunchBrowser command,
|
|
441 |
// If there is already service request for query, registering
|
|
442 |
// updates command handler, so client responses comes to this
|
|
443 |
// command handler
|
|
444 |
TRAPD( err, iUtils->RegisterServiceRequestL(
|
|
445 |
ESatSProactiveQuery,
|
|
446 |
ESatSProactiveQueryResponse,
|
|
447 |
this ) );
|
|
448 |
|
|
449 |
if ( KErrNone != err )
|
|
450 |
{
|
|
451 |
iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
452 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
453 |
iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
|
|
454 |
iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
455 |
iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
|
|
456 |
TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
|
|
457 |
|
|
458 |
LOG2( SIMPLE,
|
|
459 |
"LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand error: %i", err )
|
|
460 |
}
|
|
461 |
else if ( iNeedUiSession )
|
|
462 |
{
|
|
463 |
iQueryData.iCommand = ESatSLaunchBrowserQuery;
|
|
464 |
iQueryData.iQueryText = iLaunchBrowserData.iAlphaId.iAlphaId;
|
|
465 |
iQueryData.iIconId.iIdentifier =
|
|
466 |
iLaunchBrowserData.iIconId.iIdentifier;
|
|
467 |
LOG2( SIMPLE, "CLaunchBrowserHandler::HandleCommand \
|
|
468 |
iLaunchBrowserData.iIconId.iQualifier: %i",
|
|
469 |
iLaunchBrowserData.iIconId.iQualifier )
|
|
470 |
switch ( iLaunchBrowserData.iIconId.iQualifier )
|
|
471 |
{
|
|
472 |
case RSat::ESelfExplanatory:
|
|
473 |
{
|
|
474 |
// Icon qualifier is self explanatory (to display instead
|
|
475 |
// of the alpha id or text string).
|
|
476 |
iQueryData.iIconId.iIconQualifier = ESatSelfExplanatory;
|
|
477 |
break;
|
|
478 |
}
|
|
479 |
|
|
480 |
case RSat::ENotSelfExplanatory:
|
|
481 |
{
|
|
482 |
// Icon qualifier is not self explanatory.
|
|
483 |
iQueryData.iIconId.iIconQualifier = ESatNotSelfExplanatory;
|
|
484 |
break;
|
|
485 |
}
|
|
486 |
|
|
487 |
default:
|
|
488 |
{
|
|
489 |
// Icon qualifier not present
|
|
490 |
iQueryData.iIconId.iIconQualifier = ESatENoIconId;
|
|
491 |
break;
|
|
492 |
}
|
|
493 |
}
|
|
494 |
|
|
495 |
if ( RSat::EAlphaIdNotPresent == iLaunchBrowserData.iAlphaId.iStatus )
|
|
496 |
{
|
|
497 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand \
|
|
498 |
EAlphaIdNotPresent" )
|
|
499 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNotProvided;
|
|
500 |
}
|
|
501 |
else if ( RSat::EAlphaIdProvided ==
|
|
502 |
iLaunchBrowserData.iAlphaId.iStatus )
|
|
503 |
{
|
|
504 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand \
|
|
505 |
EAlphaIdProvided" )
|
|
506 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNotNull;
|
|
507 |
}
|
|
508 |
else
|
|
509 |
{
|
|
510 |
iQueryData.iAlphaIdStatus = ESatAlphaIdNull;
|
|
511 |
}
|
|
512 |
|
|
513 |
iQueryData.iSimApplicationName = iUtils->SatAppName();
|
|
514 |
|
|
515 |
// Ask the user permission to launch browser. Reply will come
|
|
516 |
// to ClientResponse() method.
|
|
517 |
iUtils->SatUiHandler().UiSession()->SendCommand(
|
|
518 |
&iQueryPckg,
|
|
519 |
&iQueryRspPckg,
|
|
520 |
ESatSProactiveQuery );
|
|
521 |
}
|
|
522 |
else // transparent launch
|
|
523 |
{
|
|
524 |
// Launch the Browser.
|
|
525 |
TRAP( err, LaunchBrowserL() );
|
|
526 |
|
|
527 |
if ( KErrNone != err )
|
|
528 |
{
|
|
529 |
iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
530 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
531 |
CLaunchBrowserHandler::HandleCommand error: %i", err )
|
|
532 |
}
|
|
533 |
else
|
|
534 |
{
|
|
535 |
LOG( SIMPLE,
|
|
536 |
"LAUNCHBROWSER: CLBH::CR ESetUpMenuRequested registered" )
|
|
537 |
TRAP_IGNORE( iUtils->RegisterL(
|
|
538 |
this, MSatUtils::ESetUpMenuRequested ) )
|
|
539 |
}
|
|
540 |
|
|
541 |
TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
|
|
542 |
}
|
|
543 |
|
|
544 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::HandleCommand exiting" )
|
|
545 |
}
|
|
546 |
|
|
547 |
// -----------------------------------------------------------------------------
|
|
548 |
// From class CSatCommandHandler.
|
|
549 |
// Indicates the failure of launching ui client.
|
|
550 |
// -----------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
void CLaunchBrowserHandler::UiLaunchFailed()
|
|
553 |
{
|
|
554 |
LOG( SIMPLE,
|
|
555 |
"LAUNCHBROWSER: CLaunchBrowserHandler::UiLaunchFailed calling" )
|
|
556 |
|
|
557 |
iLaunchBrowserRsp.iGeneralResult = RSat::KMeUnableToProcessCmd;
|
|
558 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
559 |
iLaunchBrowserRsp.iAdditionalInfo.SetLength( 1 );
|
|
560 |
iLaunchBrowserRsp.iAdditionalInfo[0] = RSat::KNoSpecificMeProblem;
|
|
561 |
iLaunchBrowserRsp.SetPCmdNumber( iLaunchBrowserData.PCmdNumber() );
|
|
562 |
TerminalRsp( RSat::ELaunchBrowser, iLaunchBrowserRspPckg );
|
|
563 |
|
|
564 |
LOG( SIMPLE,
|
|
565 |
"LAUNCHBROWSER: CLaunchBrowserHandler::UiLaunchFailed exiting" )
|
|
566 |
}
|
|
567 |
|
|
568 |
// -----------------------------------------------------------------------------
|
|
569 |
// C++ default constructor can NOT contain any code, that
|
|
570 |
// might leave.
|
|
571 |
// -----------------------------------------------------------------------------
|
|
572 |
//
|
|
573 |
//lint -e{1403, 1769} Can not be initialized, harmless.
|
|
574 |
CLaunchBrowserHandler::CLaunchBrowserHandler() :
|
|
575 |
CSatCommandHandler(),
|
|
576 |
iLaunchBrowserData(),
|
|
577 |
iLaunchBrowserPckg( iLaunchBrowserData ),
|
|
578 |
iLaunchBrowserRsp(),
|
|
579 |
iLaunchBrowserRspPckg( iLaunchBrowserRsp ),
|
|
580 |
iQueryData(),
|
|
581 |
iQueryPckg( iQueryData ),
|
|
582 |
iQueryRsp(),
|
|
583 |
iQueryRspPckg( iQueryRsp ),
|
|
584 |
iUidWmlBrowser( TUid::Uid( KWmlcHandler ) ),
|
|
585 |
iAfterTimer( NULL ),
|
|
586 |
// To be removed when icons are allowed in this command
|
|
587 |
iIconCommand( EFalse )
|
|
588 |
{
|
|
589 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::CLaunchBrowserHandler \
|
|
590 |
calling - exiting" )
|
|
591 |
}
|
|
592 |
|
|
593 |
// -----------------------------------------------------------------------------
|
|
594 |
// Symbian 2nd phase constructor can leave.
|
|
595 |
// -----------------------------------------------------------------------------
|
|
596 |
//
|
|
597 |
void CLaunchBrowserHandler::ConstructL()
|
|
598 |
{
|
|
599 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::ConstructL calling" )
|
|
600 |
|
|
601 |
// Open the Window server session.
|
|
602 |
User::LeaveIfError( iWsSession.Connect() );
|
|
603 |
|
|
604 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::ConstructL exiting" )
|
|
605 |
}
|
|
606 |
|
|
607 |
|
|
608 |
// -----------------------------------------------------------------------------
|
|
609 |
// Checks if Browser application is launched.
|
|
610 |
// -----------------------------------------------------------------------------
|
|
611 |
//
|
|
612 |
TBool CLaunchBrowserHandler::BrowserExists()
|
|
613 |
{
|
|
614 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::BrowserExists calling" )
|
|
615 |
TBool browserExists( EFalse );
|
|
616 |
|
|
617 |
TApaTaskList taskList( iWsSession );
|
|
618 |
TApaTask task = taskList.FindApp( iUidWmlBrowser );
|
|
619 |
browserExists = task.Exists();
|
|
620 |
|
|
621 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::BrowserExists exiting" )
|
|
622 |
return browserExists;
|
|
623 |
}
|
|
624 |
|
|
625 |
// -----------------------------------------------------------------------------
|
|
626 |
// The Launch Browser handler.
|
|
627 |
// -----------------------------------------------------------------------------
|
|
628 |
//
|
|
629 |
void CLaunchBrowserHandler::LaunchBrowserL()
|
|
630 |
{
|
|
631 |
LOG( SIMPLE,
|
|
632 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL calling" )
|
|
633 |
|
|
634 |
// Check the URL length.
|
|
635 |
const TInt urlLen( iLaunchBrowserData.iUrl.Length() );
|
|
636 |
|
|
637 |
// ID of the accesspoint in the communications database.
|
|
638 |
TUid accesspointID( TUid::Uid( KErrNotFound ) );
|
|
639 |
|
|
640 |
// If apId is given by SIM card, then we use that, otherwise,
|
|
641 |
// get default apId from default connection method.
|
|
642 |
TUint32 apId( 0 );
|
|
643 |
// GCF is supported since S60 5.0
|
|
644 |
apId = GetAccessPointByGatewayAddressL();
|
|
645 |
if ( apId )
|
|
646 |
{
|
|
647 |
LOG2( SIMPLE,
|
|
648 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
|
|
649 |
Get gcf AP id = %d", apId )
|
|
650 |
accesspointID.iUid = static_cast<TInt32>( apId );
|
|
651 |
}
|
|
652 |
|
|
653 |
// Get default AP if GCF ap not found
|
|
654 |
if ( KErrNotFound == accesspointID.iUid )
|
|
655 |
{
|
|
656 |
LOG( SIMPLE,
|
|
657 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
|
|
658 |
no gcf AP id" )
|
|
659 |
apId = GetAccessPointByDefaultL();
|
|
660 |
if ( apId )
|
|
661 |
{
|
|
662 |
LOG2( SIMPLE,
|
|
663 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
|
|
664 |
default AP id = %d", apId )
|
|
665 |
accesspointID.iUid = static_cast<TInt32>( apId );
|
|
666 |
}
|
|
667 |
}
|
|
668 |
|
|
669 |
LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL, \
|
|
670 |
accesspointID.iUid=%d", accesspointID.iUid )
|
|
671 |
|
|
672 |
HBufC* param = NULL;
|
|
673 |
// If the URL is given by SIM, then we use that
|
|
674 |
if ( urlLen )
|
|
675 |
{
|
|
676 |
// Url is given by SIM, and we use that.
|
|
677 |
param = HBufC::NewLC( urlLen );
|
|
678 |
param->Des().Copy( iLaunchBrowserData.iUrl );
|
|
679 |
LOG3( SIMPLE,
|
|
680 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL,\
|
|
681 |
url is given by SIM, url=%s, length=%d",
|
|
682 |
param, param->Des().Length() )
|
|
683 |
}
|
|
684 |
// If no url from SIM, get default URL by selected access point.
|
|
685 |
else if ( !param && accesspointID.iUid > 0 )
|
|
686 |
{
|
|
687 |
param = GetDefaultUrlByAccessPointLC(
|
|
688 |
static_cast<TUint32>( accesspointID.iUid) );
|
|
689 |
LOG3( SIMPLE,
|
|
690 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL,\
|
|
691 |
url is given by IAP, url=%s, length=%d",
|
|
692 |
param, param->Des().Length() )
|
|
693 |
}
|
|
694 |
else
|
|
695 |
{
|
|
696 |
param = KNullDesC().AllocLC();
|
|
697 |
LOG( SIMPLE,
|
|
698 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL no url" )
|
|
699 |
}
|
|
700 |
|
|
701 |
switch ( iLaunchBrowserData.iBrowserSel )
|
|
702 |
{
|
|
703 |
case RSat::ECloseExistingLaunchNewBrowserSession:
|
|
704 |
{
|
|
705 |
LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
706 |
LaunchBrowserL, ECloseExistingLaunchNewBrowserSession" )
|
|
707 |
CloseBrowser(); // Close Browser Session if it exists.
|
|
708 |
LaunchWithUrlL( param->Des(), accesspointID );
|
|
709 |
break;
|
|
710 |
}
|
|
711 |
|
|
712 |
case RSat::ELaunchBrowserIfNotAlreadyLaunched:
|
|
713 |
{
|
|
714 |
LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
715 |
LaunchBrowserL, ELaunchBrowserIfNotAlreadyLaunched" )
|
|
716 |
if ( BrowserExists() )
|
|
717 |
{
|
|
718 |
LOG( SIMPLE,"CLaunchBrowserHandler::LaunchBrowserL \
|
|
719 |
BrowserExists" )
|
|
720 |
// Browser exists, error response returned.
|
|
721 |
iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
|
|
722 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
723 |
iLaunchBrowserRsp.iAdditionalInfo.Append(
|
|
724 |
RSat::KBrowserUnavailable );
|
|
725 |
}
|
|
726 |
else
|
|
727 |
{
|
|
728 |
LaunchWithUrlL( param->Des(), accesspointID );
|
|
729 |
}
|
|
730 |
break;
|
|
731 |
}
|
|
732 |
|
|
733 |
case RSat::EUseExistingBrowser:
|
|
734 |
{
|
|
735 |
// SAT Shell Controller looks if browser already exists.
|
|
736 |
LOG( NORMAL, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
737 |
LaunchBrowserL,EUseExistingBrowser" )
|
|
738 |
LaunchWithUrlL( param->Des(), accesspointID );
|
|
739 |
break;
|
|
740 |
}
|
|
741 |
|
|
742 |
case RSat::EBrowserSelectionNotSet:
|
|
743 |
default:
|
|
744 |
__ASSERT_DEBUG( EFalse,
|
|
745 |
Panic( KLaunchBrowserHandlerName, KErrBadName ) );
|
|
746 |
break;
|
|
747 |
}
|
|
748 |
|
|
749 |
CleanupStack::PopAndDestroy( param );
|
|
750 |
|
|
751 |
LOG( SIMPLE,
|
|
752 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchBrowserL exiting" )
|
|
753 |
}
|
|
754 |
|
|
755 |
// --------------------------------------------------------------------------
|
|
756 |
// Closes the Browser application if it is active and waits until
|
|
757 |
// closing is complete.
|
|
758 |
// --------------------------------------------------------------------------
|
|
759 |
//
|
|
760 |
void CLaunchBrowserHandler::CloseBrowser()
|
|
761 |
{
|
|
762 |
LOG( SIMPLE,
|
|
763 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CloseBrowser calling" )
|
|
764 |
TApaTaskList taskList( iWsSession );
|
|
765 |
TApaTask task = taskList.FindApp( iUidWmlBrowser );
|
|
766 |
|
|
767 |
if ( task.Exists() )
|
|
768 |
{
|
|
769 |
task.SendSystemEvent( EApaSystemEventShutdown );
|
|
770 |
|
|
771 |
TBool browserExists( ETrue );
|
|
772 |
TInt waitCount( 0 );
|
|
773 |
LOG2( SIMPLE,
|
|
774 |
"CLaunchBrowserHandler::CloseBrowser browserExists: %d",
|
|
775 |
browserExists )
|
|
776 |
// Make sure that closing is completed.
|
|
777 |
while ( browserExists )
|
|
778 |
{
|
|
779 |
After( KSatSShortLoopTimeout );
|
|
780 |
++waitCount;
|
|
781 |
|
|
782 |
TApaTask newTask = taskList.FindApp( iUidWmlBrowser );
|
|
783 |
browserExists = newTask.Exists();
|
|
784 |
|
|
785 |
if ( KSatSWaitCount <= waitCount )
|
|
786 |
{
|
|
787 |
newTask.KillTask();
|
|
788 |
browserExists = EFalse;
|
|
789 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
790 |
CloseBrowser force kill task" )
|
|
791 |
}
|
|
792 |
}
|
|
793 |
}
|
|
794 |
|
|
795 |
LOG( SIMPLE,
|
|
796 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CloseBrowser exiting" )
|
|
797 |
}
|
|
798 |
|
|
799 |
// --------------------------------------------------------------------------
|
|
800 |
// Launches The Browser with URL.
|
|
801 |
// --------------------------------------------------------------------------
|
|
802 |
//
|
53
|
803 |
void CLaunchBrowserHandler::LaunchWithUrlL( const TDesC& aParam,
|
|
804 |
const TUid& aAccessPointUid )
|
33
|
805 |
{
|
|
806 |
LOG( SIMPLE,
|
|
807 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL calling" )
|
53
|
808 |
LOG3( SIMPLE,
|
|
809 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL\
|
|
810 |
url=%s, IAP=%d", &aParam, aAccessPointUid.iUid )
|
33
|
811 |
|
|
812 |
// Browser launching called.
|
53
|
813 |
TInt err = iUtils->SatUiHandler().ShellController().LaunchBrowserL(
|
|
814 |
aParam, aAccessPointUid );
|
33
|
815 |
|
|
816 |
if ( KErrNone == err )
|
|
817 |
{
|
|
818 |
if ( !iQueryRsp.iRequestedIconDisplayed &&
|
|
819 |
( ( RSat::ESelfExplanatory ==
|
|
820 |
iLaunchBrowserData.iIconId.iQualifier ) ||
|
|
821 |
( RSat::ENotSelfExplanatory ==
|
|
822 |
iLaunchBrowserData.iIconId.iQualifier ) ) )
|
|
823 |
{
|
|
824 |
iLaunchBrowserRsp.iGeneralResult =
|
|
825 |
RSat::KSuccessRequestedIconNotDisplayed;
|
|
826 |
LOG( SIMPLE,
|
|
827 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL \
|
|
828 |
no icon shown" )
|
|
829 |
}
|
|
830 |
else
|
|
831 |
{
|
|
832 |
iLaunchBrowserRsp.iGeneralResult = RSat::KSuccess;
|
|
833 |
LOG( SIMPLE,
|
|
834 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL \
|
|
835 |
command ok" )
|
|
836 |
}
|
|
837 |
}
|
|
838 |
else
|
|
839 |
{
|
|
840 |
iLaunchBrowserRsp.iGeneralResult = RSat::KLaunchBrowserError;
|
|
841 |
iLaunchBrowserRsp.iInfoType = RSat::KMeProblem;
|
|
842 |
iLaunchBrowserRsp.iAdditionalInfo.Append(
|
|
843 |
RSat::KBrowserUnavailable );
|
|
844 |
LOG2( SIMPLE,
|
|
845 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL error: %i",
|
|
846 |
err )
|
|
847 |
}
|
|
848 |
|
|
849 |
LOG( SIMPLE,
|
|
850 |
"LAUNCHBROWSER: CLaunchBrowserHandler::LaunchWithUrlL exiting" )
|
|
851 |
}
|
|
852 |
|
|
853 |
// --------------------------------------------------------------------------
|
|
854 |
// Starts timer. Function returns as the given time has elapsed or
|
|
855 |
// timer is cancelled.
|
|
856 |
// --------------------------------------------------------------------------
|
|
857 |
void CLaunchBrowserHandler::After(
|
|
858 |
const TTimeIntervalMicroSeconds32& aDelay,
|
|
859 |
const TTimeIntervalMicroSeconds32& aInterval )
|
|
860 |
{
|
|
861 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::After calling" )
|
|
862 |
|
|
863 |
if ( !iAfterWait.IsStarted() )
|
|
864 |
{
|
|
865 |
TRAPD( err, iAfterTimer = CPeriodic::NewL( EPriorityStandard ) )
|
|
866 |
LOG2( SIMPLE,
|
|
867 |
"LAUNCHBROWSER: CLaunchBrowserHandler::After err: %i", err )
|
|
868 |
if ( ( KErrNone == err ) && iAfterTimer )
|
|
869 |
{
|
|
870 |
iAfterTimer->Start(
|
|
871 |
aDelay, aInterval, TCallBack( DelayCallBack, this ) );
|
|
872 |
iAfterWait.Start();
|
|
873 |
|
|
874 |
delete iAfterTimer;
|
|
875 |
iAfterTimer = NULL;
|
|
876 |
}
|
|
877 |
}
|
|
878 |
|
|
879 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::After exiting" )
|
|
880 |
}
|
|
881 |
|
|
882 |
// --------------------------------------------------------------------------
|
|
883 |
// Timer call back function
|
|
884 |
// --------------------------------------------------------------------------
|
|
885 |
TInt CLaunchBrowserHandler::DelayCallBack( TAny* aPtr )
|
|
886 |
{
|
|
887 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
|
|
888 |
calling" )
|
|
889 |
CLaunchBrowserHandler* ptrThis =
|
|
890 |
static_cast<CLaunchBrowserHandler*>( aPtr );
|
|
891 |
|
|
892 |
if ( ptrThis && ( ptrThis->iAfterWait.IsStarted() ) )
|
|
893 |
{
|
|
894 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
|
|
895 |
stop iAfterWait" )
|
|
896 |
ptrThis->iAfterWait.AsyncStop();
|
|
897 |
}
|
|
898 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::DelayCallBack \
|
|
899 |
exiting" )
|
|
900 |
return ( EFalse );
|
|
901 |
}
|
|
902 |
|
|
903 |
// --------------------------------------------------------------------------
|
|
904 |
// Create a new access point using the Access Point Engine.
|
|
905 |
// --------------------------------------------------------------------------
|
|
906 |
//
|
|
907 |
TUint32 CLaunchBrowserHandler::CreateAccessPointL(
|
|
908 |
const TDesC16& aApName,
|
|
909 |
const TDesC16& aProxyServerAddr,
|
|
910 |
const TUint32 aProxyPortNumber,
|
|
911 |
const RPacketContext::TProtocolType& aIPvType )
|
|
912 |
{
|
|
913 |
LOG( SIMPLE,
|
|
914 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL calling" )
|
|
915 |
|
|
916 |
// Connection method interface.
|
|
917 |
RCmConnectionMethod cm;
|
|
918 |
// Connection method manager interface.
|
|
919 |
RCmManager cmManager;
|
|
920 |
// Used to exit connection methods go through loop
|
|
921 |
TBool exitConnectionMethodsLoop( EFalse );
|
|
922 |
|
|
923 |
cmManager.OpenLC();
|
|
924 |
|
|
925 |
// Find if the access point with the same name is already exist.
|
|
926 |
// If such access point exists, delete it and then create a new one.
|
|
927 |
|
|
928 |
// Get the Connection Methods does not belogns to any destination
|
|
929 |
RArray<TUint32> array = RArray<TUint32>( KSatCMGranularity );
|
|
930 |
CleanupClosePushL( array );
|
|
931 |
|
|
932 |
cmManager.ConnectionMethodL( array );
|
|
933 |
|
|
934 |
// Go through the Connection Method list to find if there is matched one
|
|
935 |
|
|
936 |
for( TInt i = 0;
|
|
937 |
( i < array.Count() ) && !exitConnectionMethodsLoop; ++i)
|
|
938 |
{
|
|
939 |
cm = cmManager.ConnectionMethodL( array[i] );
|
|
940 |
CleanupClosePushL( cm );
|
|
941 |
|
|
942 |
// query the access point name
|
|
943 |
HBufC * pa = NULL;
|
|
944 |
pa = cm.GetStringAttributeL( CMManager::ECmName );
|
|
945 |
CleanupStack::PushL(pa);
|
|
946 |
|
|
947 |
if ( *pa == aApName )
|
|
948 |
{
|
|
949 |
// Find the matched connection method
|
|
950 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
951 |
CreateAccessPointL, find the existing ap" )
|
|
952 |
cm.DeleteL();
|
|
953 |
exitConnectionMethodsLoop = ETrue;
|
|
954 |
}
|
|
955 |
CleanupStack::PopAndDestroy( pa );
|
|
956 |
CleanupStack::PopAndDestroy( &cm );
|
|
957 |
}
|
|
958 |
CleanupStack::PopAndDestroy( &array );
|
|
959 |
|
|
960 |
// Create a connection method without destination.
|
|
961 |
cm = cmManager.CreateConnectionMethodL( KUidPacketDataBearerType );
|
|
962 |
CleanupClosePushL( cm );
|
|
963 |
|
|
964 |
// Fulfill connection method params with default setting from OCC.
|
|
965 |
// We use trap to continue following operations even if leaving from
|
|
966 |
// FulfillConnnectionMethodL.
|
|
967 |
TRAPD( errCode, FulfillConnnectionMethodL( cmManager, cm ) );
|
51
|
968 |
if ( errCode != KErrNone )
|
|
969 |
{
|
|
970 |
LOG3( SIMPLE, "SATENGINE: CLaunchBrowserHandler::CreateAccessPointL"
|
|
971 |
" error %d at line %d", errCode, __LINE__ )
|
|
972 |
}
|
33
|
973 |
// Set attributes of the connection method.
|
|
974 |
cm.SetStringAttributeL( CMManager::ECmName, aApName );
|
|
975 |
cm.SetIntAttributeL( CMManager::EPacketDataPDPType, aIPvType );
|
|
976 |
cm.SetStringAttributeL( CMManager::ECmWapIPGatewayAddress,
|
|
977 |
TPtrC( aProxyServerAddr ) );
|
|
978 |
cm.SetStringAttributeL( CMManager::ECmProxyServerName,
|
|
979 |
TPtrC( aProxyServerAddr ) );
|
|
980 |
cm.SetIntAttributeL( CMManager::ECmProxyPortNumber, aProxyPortNumber );
|
|
981 |
|
|
982 |
// Update the access point ID for use later.
|
|
983 |
cm.UpdateL();
|
|
984 |
|
|
985 |
TUint32 apId = cm.GetIntAttributeL( CMManager::ECmIapId );
|
|
986 |
LOG2( SIMPLE,
|
|
987 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL apId=%d",
|
|
988 |
apId )
|
|
989 |
|
|
990 |
CleanupStack::PopAndDestroy( &cm );
|
|
991 |
CleanupStack::PopAndDestroy( &cmManager );
|
|
992 |
|
|
993 |
LOG( SIMPLE,
|
|
994 |
"LAUNCHBROWSER: CLaunchBrowserHandler::CreateAccessPointL exiting" )
|
|
995 |
|
|
996 |
return apId;
|
|
997 |
}
|
|
998 |
|
|
999 |
// --------------------------------------------------------------------------
|
|
1000 |
// Get a AP from the Connection Method Manager.
|
|
1001 |
// --------------------------------------------------------------------------
|
|
1002 |
TUint32 CLaunchBrowserHandler::GetAccessPointByGatewayAddressL()
|
|
1003 |
{
|
|
1004 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1005 |
CLaunchBrowserHandler::GetAccessPointByGatewayAddressL calling" )
|
|
1006 |
// Access Point ID.
|
|
1007 |
TUint32 apId( 0 );
|
|
1008 |
// Unknown IP address type.
|
|
1009 |
TInt ipvType( 0 );
|
|
1010 |
// Get the gateway address.
|
|
1011 |
TPtrC gatewayAddrPtr( iLaunchBrowserData.iText );
|
|
1012 |
// Get the bearer list.
|
|
1013 |
TPtrC8 bearerListPtr( iLaunchBrowserData.iBearerList );
|
|
1014 |
|
|
1015 |
// Proxy address.
|
|
1016 |
HBufC* proxyAddress = NULL;
|
|
1017 |
// Proxy port number.
|
|
1018 |
TUint32 proxyPortNumber( 0 );
|
|
1019 |
HBufC* pa = NULL;
|
|
1020 |
TUint32 pn( 0 );
|
|
1021 |
|
|
1022 |
// Used to exit the connection method go through loop
|
|
1023 |
TBool exitConnectionMethodsLoop( EFalse );
|
|
1024 |
|
|
1025 |
// SAT access point name.
|
|
1026 |
TPtrC satAPN( KNullDesC );
|
|
1027 |
|
|
1028 |
// Use SAT application name as SAT APN.
|
|
1029 |
satAPN.Set( iUtils->SatAppName() );
|
|
1030 |
// Use default SAT APN if SAT application name is not available.
|
|
1031 |
if ( satAPN == KNullDesC )
|
|
1032 |
{
|
|
1033 |
LOG( SIMPLE,
|
|
1034 |
"CLaunchBrowserHandler::GetAccessPointByGatewayAddressL\
|
|
1035 |
satAPN == KNullDesC" )
|
|
1036 |
satAPN.Set( KSatAccessPointName );
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
// Get the proxy address and port number
|
|
1040 |
proxyAddress = HBufC::NewLC( gatewayAddrPtr.Length() );
|
|
1041 |
TPtr proxyAddrPtr( proxyAddress->Des() );
|
|
1042 |
SeparatePortNumberFromAddress( gatewayAddrPtr, proxyAddrPtr,
|
|
1043 |
proxyPortNumber );
|
|
1044 |
proxyAddrPtr.TrimAll();
|
|
1045 |
|
|
1046 |
// Check the launch browser package for gateway setting.
|
|
1047 |
ipvType = ValidateGatewayAddress( proxyAddrPtr );
|
|
1048 |
|
|
1049 |
if ( RPacketContext::EPdpTypeIPv4 == ipvType || \
|
|
1050 |
RPacketContext::EPdpTypeIPv6 == ipvType )
|
|
1051 |
{
|
|
1052 |
LOG2( SIMPLE,
|
|
1053 |
"CLaunchBrowserHandler::GetAccessPointByGatewayAddressL \
|
|
1054 |
gatewayAddrPtr.Length(): %d", gatewayAddrPtr.Length() )
|
|
1055 |
// Check the launch browser package for bearer setting if the gateway
|
|
1056 |
// address is valid.
|
|
1057 |
LOG2( SIMPLE,
|
|
1058 |
"LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
1059 |
GetAccessPointByGatewayAddressL, IPvType is %d",
|
|
1060 |
ipvType)
|
|
1061 |
if ( gatewayAddrPtr.Length() )
|
|
1062 |
{
|
|
1063 |
// The bearer is GPRS.
|
|
1064 |
if ( bearerListPtr != KNullDesC8 && bearerListPtr.Length() > 0
|
|
1065 |
&& RSat::KGprsBearer == bearerListPtr[0] )
|
|
1066 |
{
|
|
1067 |
|
|
1068 |
// Go through the candidate connection methods to find
|
|
1069 |
// the one matched the gateway address. If a matched one
|
|
1070 |
// is found,using it as the access point for SIM service,
|
|
1071 |
// else a new one is created.
|
|
1072 |
RCmManager cmManager;
|
|
1073 |
cmManager.OpenLC();
|
|
1074 |
|
|
1075 |
// Get the Connection Methods does not belongs to
|
|
1076 |
// any destination
|
|
1077 |
RArray<TUint32> array = RArray<TUint32>(
|
|
1078 |
KSatCMGranularity );
|
|
1079 |
CleanupClosePushL( array );
|
|
1080 |
|
|
1081 |
cmManager.ConnectionMethodL( array );
|
|
1082 |
|
|
1083 |
// Go through the Connection Method list to find
|
|
1084 |
// if there is matched one
|
|
1085 |
|
|
1086 |
for( TInt i = 0;
|
|
1087 |
( i < array.Count() ) && !exitConnectionMethodsLoop;
|
|
1088 |
++i )
|
|
1089 |
{
|
|
1090 |
RCmConnectionMethod cm = cmManager.ConnectionMethodL(
|
|
1091 |
array[i] );
|
|
1092 |
CleanupClosePushL( cm );
|
|
1093 |
|
|
1094 |
// query the Gateway proxy address
|
|
1095 |
// of the Connection Method
|
|
1096 |
pa = cm.GetStringAttributeL(
|
|
1097 |
CMManager::ECmWapIPGatewayAddress );
|
|
1098 |
CleanupStack::PushL(pa);
|
|
1099 |
|
|
1100 |
// query the Gateway proxy port number of the Connection
|
|
1101 |
// Method
|
|
1102 |
pn = cm.GetIntAttributeL(
|
|
1103 |
CMManager::ECmProxyPortNumber );
|
|
1104 |
|
|
1105 |
if (( pn == proxyPortNumber ) &&
|
|
1106 |
( *pa == *proxyAddress ))
|
|
1107 |
{
|
|
1108 |
// Find the matched connection method
|
|
1109 |
apId = cm.GetIntAttributeL( CMManager::ECmIapId );
|
|
1110 |
LOG2( SIMPLE,
|
|
1111 |
"LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1112 |
GetAccessPointByGatewayAddressL, apId=%d",
|
|
1113 |
apId )
|
|
1114 |
exitConnectionMethodsLoop = ETrue;
|
|
1115 |
}
|
|
1116 |
|
|
1117 |
CleanupStack::PopAndDestroy( pa );
|
|
1118 |
CleanupStack::PopAndDestroy( &cm );
|
|
1119 |
}
|
|
1120 |
|
|
1121 |
CleanupStack::PopAndDestroy( &array );
|
|
1122 |
CleanupStack::PopAndDestroy( &cmManager );
|
|
1123 |
|
|
1124 |
LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler:: \
|
|
1125 |
GetAccessPointByGatewayAddressL apId=%d", apId )
|
|
1126 |
|
|
1127 |
if ( !apId )
|
|
1128 |
{
|
|
1129 |
// Create a new AP if there is not a matched one.
|
|
1130 |
apId = CreateAccessPointL(
|
|
1131 |
satAPN,
|
|
1132 |
proxyAddrPtr,
|
|
1133 |
proxyPortNumber,
|
|
1134 |
static_cast<RPacketContext::TProtocolType>(
|
|
1135 |
ipvType ) );
|
|
1136 |
}
|
|
1137 |
}
|
|
1138 |
}
|
|
1139 |
}
|
|
1140 |
CleanupStack::PopAndDestroy( proxyAddress );
|
|
1141 |
|
|
1142 |
LOG2( SIMPLE,
|
|
1143 |
"LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1144 |
GetAccessPointByGatewayAddressL exiting, apId=%d", apId )
|
|
1145 |
|
|
1146 |
// return the AP.
|
|
1147 |
return apId;
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// --------------------------------------------------------------------------
|
|
1151 |
// Get an Access Point by default.
|
|
1152 |
// --------------------------------------------------------------------------
|
|
1153 |
TUint32 CLaunchBrowserHandler::GetAccessPointByDefaultL()
|
|
1154 |
{
|
|
1155 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1156 |
GetAccessPointByDefaultL calling" )
|
|
1157 |
|
|
1158 |
TUint32 apId ( KErrNone );
|
|
1159 |
RCmManager cmManager;
|
|
1160 |
cmManager.OpenLC();
|
|
1161 |
RCmConnectionMethod cm;
|
|
1162 |
CleanupClosePushL( cm );
|
|
1163 |
|
|
1164 |
// Get a default connection method
|
|
1165 |
TInt ret( KErrNotFound );
|
|
1166 |
GetDefConnMethodL( cmManager, cm, ret );
|
|
1167 |
if ( !ret )
|
|
1168 |
{
|
|
1169 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1170 |
GetAccessPointByDefaultL default connection found" )
|
|
1171 |
apId = cm.GetIntAttributeL( CMManager::ECmIapId );
|
|
1172 |
}
|
|
1173 |
|
|
1174 |
CleanupStack::PopAndDestroy( &cm );
|
|
1175 |
CleanupStack::PopAndDestroy( &cmManager );
|
|
1176 |
|
|
1177 |
LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1178 |
GetAccessPointByDefaultL exiting, apId=%d", apId )
|
|
1179 |
|
|
1180 |
return apId;
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
// --------------------------------------------------------------------------
|
|
1184 |
// Get default URL by access point
|
|
1185 |
// --------------------------------------------------------------------------
|
|
1186 |
HBufC* CLaunchBrowserHandler::GetDefaultUrlByAccessPointLC( TUint32 aApId )
|
|
1187 |
{
|
|
1188 |
LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1189 |
GetDefaultUrlByAccessPointLC calling, aApId=%d", aApId )
|
|
1190 |
|
|
1191 |
HBufC* url = NULL;
|
|
1192 |
if ( aApId > 0 )
|
|
1193 |
{
|
|
1194 |
// Create CMManager session
|
|
1195 |
RCmManager cmManager;
|
|
1196 |
cmManager.OpenLC();
|
|
1197 |
|
|
1198 |
// get the connection method by apId
|
|
1199 |
RCmConnectionMethod cm = cmManager.ConnectionMethodL( aApId );
|
|
1200 |
CleanupClosePushL( cm );
|
|
1201 |
|
|
1202 |
// Get the default URL from default accesspoint
|
|
1203 |
// If the access point doesn't include the default URL,
|
|
1204 |
// the empty string is returned.
|
|
1205 |
url = cm.GetStringAttributeL( CMManager::ECmStartPage );
|
|
1206 |
|
|
1207 |
CleanupStack::PopAndDestroy( &cm );
|
|
1208 |
CleanupStack::PopAndDestroy( &cmManager );
|
|
1209 |
|
|
1210 |
CleanupStack::PushL( url );
|
|
1211 |
}
|
|
1212 |
|
|
1213 |
if ( !url )
|
|
1214 |
{
|
|
1215 |
url = KNullDesC().AllocLC();
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
LOG2( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1219 |
GetDefaultUrlByAccessPointLC exiting, url=%s", url )
|
|
1220 |
return url;
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
// --------------------------------------------------------------------------
|
|
1224 |
// Convert a descriptor into a integer.
|
|
1225 |
// --------------------------------------------------------------------------
|
|
1226 |
TInt CLaunchBrowserHandler::ConvertDesToInt( const TDesC16& aDes )
|
|
1227 |
{
|
|
1228 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1229 |
CLaunchBrowserHandler::ConvertDesToInt calling,length of aDes:%d",
|
|
1230 |
aDes.Length() )
|
|
1231 |
|
|
1232 |
TLex converter;
|
|
1233 |
TInt intValue( KErrNotFound );
|
|
1234 |
TBool digital( ETrue );
|
|
1235 |
|
|
1236 |
if ( aDes != KNullDesC && aDes.Length() > 0 )
|
|
1237 |
{
|
|
1238 |
// The literal value of every element in the descriptor
|
|
1239 |
// should be numerical.
|
|
1240 |
for ( TInt i = 0; i < aDes.Length() && digital; i++ )
|
|
1241 |
{
|
|
1242 |
TChar ch( aDes[i] );
|
|
1243 |
|
|
1244 |
if ( !ch.IsDigit() )
|
|
1245 |
{
|
|
1246 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1247 |
CLaunchBrowserHandler::ConvertDesToInt not digit" )
|
|
1248 |
digital = EFalse;
|
|
1249 |
}
|
|
1250 |
}
|
|
1251 |
|
|
1252 |
if ( digital )
|
|
1253 |
{
|
|
1254 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1255 |
CLaunchBrowserHandler::ConvertDesToInt digit" )
|
|
1256 |
// Converting.
|
|
1257 |
converter.Assign( aDes );
|
|
1258 |
converter.Val( intValue );
|
|
1259 |
}
|
|
1260 |
}
|
|
1261 |
|
|
1262 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1263 |
CLaunchBrowserHandler::ConvertDesToInt exiting,intValue:%d",
|
|
1264 |
intValue )
|
|
1265 |
|
|
1266 |
return intValue;
|
|
1267 |
}
|
|
1268 |
|
|
1269 |
// --------------------------------------------------------------------------
|
|
1270 |
// Check the validity of a descriptor in hex.
|
|
1271 |
// --------------------------------------------------------------------------
|
|
1272 |
TBool CLaunchBrowserHandler::ValidateHexadecimal( const TDesC16& aHex )
|
|
1273 |
{
|
|
1274 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1275 |
CLaunchBrowserHandler::ValidateHexadecimal calling" )
|
|
1276 |
|
|
1277 |
// The hexadecimal descriptor can be null.
|
|
1278 |
TInt length( aHex.Length() );
|
|
1279 |
TBool retVal( ETrue );
|
|
1280 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1281 |
CLaunchBrowserHandler::ValidateHexadecimal length:%d", length )
|
|
1282 |
|
|
1283 |
// Validate characters one by one.
|
|
1284 |
for ( TInt i = 0; i < length && retVal; i++ )
|
|
1285 |
{
|
|
1286 |
TChar ch( aHex[i] );
|
|
1287 |
|
|
1288 |
if ( !ch.IsHexDigit() )
|
|
1289 |
{
|
|
1290 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1291 |
CLaunchBrowserHandler::ValidateHexadecimal hex digit,i: %d",
|
|
1292 |
i )
|
|
1293 |
retVal = EFalse;
|
|
1294 |
}
|
|
1295 |
}
|
|
1296 |
|
|
1297 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1298 |
CLaunchBrowserHandler::ValidateHexadecimal exiting, retVal:%d",
|
|
1299 |
retVal )
|
|
1300 |
|
|
1301 |
return retVal;
|
|
1302 |
}
|
|
1303 |
|
|
1304 |
// --------------------------------------------------------------------------
|
|
1305 |
// Check the validity of a IPv4 address. For example, 210.13.246.172.
|
|
1306 |
// --------------------------------------------------------------------------
|
|
1307 |
TBool CLaunchBrowserHandler::ValidateIPv4Address(
|
|
1308 |
const TDesC16& aAddress )
|
|
1309 |
{
|
|
1310 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1311 |
CLaunchBrowserHandler::ValidateIPv4Address calling,aAddress: %s",
|
|
1312 |
&aAddress )
|
|
1313 |
|
|
1314 |
// Separate the address to be three segments using dot and validate
|
|
1315 |
// each segment.
|
|
1316 |
TPtrC segPtr( aAddress );
|
|
1317 |
TBuf<KSatMaxIPv4SegmentLength> segment;
|
|
1318 |
TInt posInDes( KErrNone );
|
|
1319 |
TInt posInPtr( KErrNone );
|
|
1320 |
TInt segCounter( KErrNone );
|
|
1321 |
TBool first( ETrue );
|
|
1322 |
TBool retVal( ETrue );
|
|
1323 |
// Segment value in integer.
|
|
1324 |
TInt intValue( KErrNone );
|
|
1325 |
|
|
1326 |
// Convert each segment into integer.
|
|
1327 |
while ( KErrNotFound != ( posInPtr = segPtr.Find( KSatIPv4Delimiter ) )
|
|
1328 |
&& retVal )
|
|
1329 |
{
|
|
1330 |
|
|
1331 |
if ( KSatMaxIPv4SegmentLength >= posInPtr && 0 < posInPtr )
|
|
1332 |
{
|
|
1333 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1334 |
CLaunchBrowserHandler::ValidateIPv4Address posInPtr valid" )
|
|
1335 |
segCounter++;
|
|
1336 |
posInDes += posInPtr;
|
|
1337 |
segment = segPtr.Mid( 0, posInPtr );
|
|
1338 |
|
|
1339 |
// The first integer should be > 0 and < 255, others should be
|
|
1340 |
// >=0 and < 255.
|
|
1341 |
intValue = ConvertDesToInt( segment );
|
|
1342 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1343 |
CLaunchBrowserHandler::ValidateIPv4Address first:%d",first )
|
|
1344 |
if ( first )
|
|
1345 |
{
|
|
1346 |
first = EFalse;
|
|
1347 |
|
|
1348 |
if ( !( KSatIPv4Network < intValue &&
|
|
1349 |
KSatIPv4Broadcast > intValue ) )
|
|
1350 |
{
|
|
1351 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1352 |
ValidateIPv4Address intValue valid" )
|
|
1353 |
retVal = EFalse;
|
|
1354 |
}
|
|
1355 |
}
|
|
1356 |
else
|
|
1357 |
{
|
|
1358 |
|
|
1359 |
if ( !( KSatIPv4Network <= intValue &&
|
|
1360 |
KSatIPv4Broadcast > intValue ) )
|
|
1361 |
{
|
|
1362 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1363 |
ValidateIPv4Address intValue range" )
|
|
1364 |
retVal = EFalse;
|
|
1365 |
}
|
|
1366 |
}
|
|
1367 |
// Skip dot.
|
|
1368 |
posInDes++;
|
|
1369 |
segPtr.Set( aAddress.Mid( posInDes,
|
|
1370 |
aAddress.Length() - posInDes ) );
|
|
1371 |
}
|
|
1372 |
else
|
|
1373 |
{
|
|
1374 |
retVal = EFalse;
|
|
1375 |
}
|
|
1376 |
}
|
|
1377 |
|
|
1378 |
// IPv4 address is consist of 4 segment
|
|
1379 |
if ( KSatMaxIPv4SegmentCounter == segCounter && retVal )
|
|
1380 |
{
|
|
1381 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1382 |
CLaunchBrowserHandler::ValidateIPv4Address valid address" )
|
|
1383 |
// Validate the last segment.
|
|
1384 |
segment = segPtr;
|
|
1385 |
|
|
1386 |
if ( KSatMaxIPv4SegmentLength < segment.Length() )
|
|
1387 |
{
|
|
1388 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1389 |
CLaunchBrowserHandler::ValidateIPv4Address address invalid" )
|
|
1390 |
retVal = EFalse;
|
|
1391 |
}
|
|
1392 |
|
|
1393 |
intValue = ConvertDesToInt( segment );
|
|
1394 |
|
|
1395 |
if ( !( KSatIPv4Network < intValue &&
|
|
1396 |
KSatIPv4Broadcast > intValue ) )
|
|
1397 |
{
|
|
1398 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1399 |
CLaunchBrowserHandler::ValidateIPv4Address intValue range" )
|
|
1400 |
retVal = EFalse;
|
|
1401 |
}
|
|
1402 |
}
|
|
1403 |
else
|
|
1404 |
{
|
|
1405 |
retVal = EFalse;
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1409 |
CLaunchBrowserHandler::ValidateIPv4Address exiting,retVal:%d",
|
|
1410 |
retVal )
|
|
1411 |
|
|
1412 |
return retVal;
|
|
1413 |
}
|
|
1414 |
|
|
1415 |
// --------------------------------------------------------------------------
|
|
1416 |
// Check the validity of a IPv6 address. For example,
|
|
1417 |
// 3ffe:ffff:101::230:6eff:fe04:d9ff.
|
|
1418 |
// --------------------------------------------------------------------------
|
|
1419 |
TBool CLaunchBrowserHandler::ValidateIPv6Address(
|
|
1420 |
const TDesC16& aAddress )
|
|
1421 |
{
|
|
1422 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1423 |
CLaunchBrowserHandler::ValidateIPv6Address calling,aAddress: %s",
|
|
1424 |
&aAddress )
|
|
1425 |
|
|
1426 |
// Separate the address to be eight segments using colon and validate
|
|
1427 |
// each segment.
|
|
1428 |
TPtrC segPtr( aAddress );
|
|
1429 |
TBuf<KSatMaxIPv6SegmentLength> segment;
|
|
1430 |
TInt posInDes( KErrNone );
|
|
1431 |
TInt posInPtr( KErrNone );
|
|
1432 |
TInt segCounter( KErrNone );
|
|
1433 |
TBool first( ETrue );
|
|
1434 |
TBool retVal( ETrue );
|
|
1435 |
|
|
1436 |
while ( KErrNotFound != ( posInPtr = segPtr.Find( KSatIPv6Delimiter ) )
|
|
1437 |
&& retVal )
|
|
1438 |
{
|
|
1439 |
|
|
1440 |
if ( KSatMaxIPv6SegmentLength >= posInPtr && 0 <= posInPtr )
|
|
1441 |
{
|
|
1442 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1443 |
CLaunchBrowserHandler::ValidateIPv6Address posInPtr valid" )
|
|
1444 |
segCounter++;
|
|
1445 |
posInDes += posInPtr;
|
|
1446 |
segment = segPtr.Mid( 0, posInPtr );
|
|
1447 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1448 |
CLaunchBrowserHandler::ValidateIPv6Address first:%d",first )
|
|
1449 |
if ( first )
|
|
1450 |
{
|
|
1451 |
first = EFalse;
|
|
1452 |
|
|
1453 |
if ( 0 >= segment.Length() )
|
|
1454 |
{
|
|
1455 |
retVal = EFalse;
|
|
1456 |
}
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
if ( KSatMaxIPv6SegmentLength < segment.Length() )
|
|
1460 |
{
|
|
1461 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1462 |
CLaunchBrowserHandler::ValidateIPv6Address address invalid" )
|
|
1463 |
retVal = EFalse;
|
|
1464 |
}
|
|
1465 |
|
|
1466 |
if ( !ValidateHexadecimal( segment ) )
|
|
1467 |
{
|
|
1468 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1469 |
ValidateIPv6Address address invalid hex" )
|
|
1470 |
retVal = EFalse;
|
|
1471 |
}
|
|
1472 |
|
|
1473 |
// Skip colon.
|
|
1474 |
posInDes++;
|
|
1475 |
segPtr.Set( aAddress.Mid( posInDes,
|
|
1476 |
aAddress.Length() - posInDes ) );
|
|
1477 |
}
|
|
1478 |
else
|
|
1479 |
{
|
|
1480 |
retVal = EFalse;
|
|
1481 |
}
|
|
1482 |
}
|
|
1483 |
|
|
1484 |
// IPv6 address is consist of 8 segment
|
|
1485 |
if ( KSatMaxIPv6SegmentCounter == segCounter && retVal )
|
|
1486 |
{
|
|
1487 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1488 |
CLaunchBrowserHandler::ValidateIPv6Address valid address" )
|
|
1489 |
// Validate the last segment.
|
|
1490 |
segment = segPtr;
|
|
1491 |
|
|
1492 |
if ( KSatMaxIPv6SegmentLength < segment.Length() )
|
|
1493 |
{
|
|
1494 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1495 |
CLaunchBrowserHandler::ValidateIPv6Address address invalid" )
|
|
1496 |
retVal = EFalse;
|
|
1497 |
}
|
|
1498 |
|
|
1499 |
if ( !ValidateHexadecimal( segment ) )
|
|
1500 |
{
|
|
1501 |
LOG( SIMPLE, "LAUNCHBROWSER: CLaunchBrowserHandler::\
|
|
1502 |
ValidateIPv6Address address invalid hex" )
|
|
1503 |
retVal = EFalse;
|
|
1504 |
}
|
|
1505 |
}
|
|
1506 |
else
|
|
1507 |
{
|
|
1508 |
retVal = EFalse;
|
|
1509 |
}
|
|
1510 |
|
|
1511 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1512 |
CLaunchBrowserHandler::ValidateIPv6Address exiting,retVal:%d",
|
|
1513 |
retVal )
|
|
1514 |
|
|
1515 |
return retVal;
|
|
1516 |
}
|
|
1517 |
|
|
1518 |
// --------------------------------------------------------------------------
|
|
1519 |
// Check the validity of a gateway IP address. Either it is IPv4 or IPv6.
|
|
1520 |
// For example, 210.13.246.172 or 3ffe:ffff:101::230:6eff:fe04:d9ff.
|
|
1521 |
// --------------------------------------------------------------------------
|
|
1522 |
TInt CLaunchBrowserHandler::ValidateGatewayAddress(
|
|
1523 |
const TDesC16& aAddress )
|
|
1524 |
{
|
|
1525 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1526 |
CLaunchBrowserHandler::ValidateGatewayAddress calling,length of \
|
|
1527 |
aAddress: %d", aAddress.Length() )
|
|
1528 |
|
|
1529 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1530 |
CLaunchBrowserHandler::ValidateGatewayAddress aAddress: %s", &aAddress )
|
|
1531 |
TInt ipvType( KSatInvalidPdpType );
|
|
1532 |
TInt length( aAddress.Length() );
|
|
1533 |
|
|
1534 |
if ( length )
|
|
1535 |
{
|
|
1536 |
// The maximum length of a IP address is less than 39.
|
|
1537 |
if ( KSatMaxIPv4AddressLength >= length &&
|
|
1538 |
KSatMinIPv4AddressLength <= length )
|
|
1539 |
{
|
|
1540 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1541 |
CLaunchBrowserHandler::ValidateGatewayAddress IPV4 address" )
|
|
1542 |
// aAddress is a IPv4 address.
|
|
1543 |
if ( ValidateIPv4Address( aAddress ) )
|
|
1544 |
{
|
|
1545 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1546 |
CLaunchBrowserHandler::ValidateGatewayAddress valid IPV4 \
|
|
1547 |
address" )
|
|
1548 |
ipvType = RPacketContext::EPdpTypeIPv4;
|
|
1549 |
}
|
|
1550 |
}
|
|
1551 |
else if ( KSatMaxIPv6AddressLength >= length &&
|
|
1552 |
KSatMinIPv6AddressLength <= length )
|
|
1553 |
{
|
|
1554 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1555 |
CLaunchBrowserHandler::ValidateGatewayAddress IPV6 address" )
|
|
1556 |
// aAddress is a IPv6 address.
|
|
1557 |
if ( ValidateIPv6Address( aAddress ) )
|
|
1558 |
{
|
|
1559 |
LOG( SIMPLE, "LAUNCHBROWSER: \
|
|
1560 |
CLaunchBrowserHandler::ValidateGatewayAddress valid IPV6 \
|
|
1561 |
address" )
|
|
1562 |
ipvType = RPacketContext::EPdpTypeIPv6;
|
|
1563 |
}
|
|
1564 |
}
|
|
1565 |
}
|
|
1566 |
|
|
1567 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1568 |
CLaunchBrowserHandler::ValidateGatewayAddress exiting,ipvType:%d",
|
|
1569 |
ipvType )
|
|
1570 |
|
|
1571 |
// Returned IP address.
|
|
1572 |
return ipvType;
|
|
1573 |
}
|
|
1574 |
|
|
1575 |
// --------------------------------------------------------------------------
|
|
1576 |
// Separate the port number from a address if it is existing. For example,
|
|
1577 |
// 210.13.246.172:8080.
|
|
1578 |
// --------------------------------------------------------------------------
|
|
1579 |
void CLaunchBrowserHandler::SeparatePortNumberFromAddress(
|
|
1580 |
const TDesC16& aAddress,
|
|
1581 |
TDes16& aPureAddr,
|
|
1582 |
TUint32& aPortNumber )
|
|
1583 |
{
|
|
1584 |
LOG2( SIMPLE, "LAUNCHBROWSER: \
|
|
1585 |
CLaunchBrowserHandler::SeparatePortNumberFromAddress calling,\
|
|
1586 |
aAddress: %s", &aAddress )
|
|
1587 |
|
|
1588 |
// The following three variables are used to locate the port number.
|
|
1589 |
TBool isSeparator( EFalse );
|
|
1590 |
TBool portNumberBegin( EFalse );
|
|
1591 |
TBool portNumberEnd( EFalse );
|
|
1592 |
TBool pureAddrEnd( EFalse );
|
|
1593 |
// Count delimiters in the address.
|
|
1594 |
TInt delimiterCounter( 0 );
|
|
1595 |
// Count symbols in a segment of the address.
|
|
1596 |
TInt symbolCounter( 0 );
|
|
1597 |
// Currsent position of the address descriptor.
|
|
1598 |
TInt curPos( 0 );
|
|
1599 |
TInt posOffset( 0 );
|
|
1600 |
// The position of the last valid character.
|
|
1601 |
TInt rightBound( 0 );
|
|
1602 |
// Digital port number.
|
|
1603 |
TUint32 portNumber( KSatLaunchBrowserProxyPortNumber );
|
|
1604 |
// The descriptor pointer for the address.
|
|
1605 |
TPtrC addrPtr;
|
|
1606 |
// The length of the address.
|
|
1607 |
TInt addrLen( 0 );
|
|
1608 |
|
|
1609 |
// The address is a valid descriptor.
|
|
1610 |
if ( NULL != &aAddress &&
|
|
1611 |
KSatMinIPv4AddressLength <= aAddress.Length() )
|
|
1612 |
{
|
|
1613 |
addrPtr.Set( aAddress );
|
|
1614 |
addrLen = aAddress.Length();
|
|
1615 |
curPos = addrPtr.Find( KSatIPv4Delimiter );
|
|
1616 |
|
|
1617 |
LOG2( SIMPLE, "CLaunchBrowserHandler::\
|
|
1618 |
SeparatePortNumberFromAddress curPos: %i", curPos )
|
|
1619 |
if ( KErrNotFound != curPos )
|
|
1620 |
{
|
|
1621 |
// Skip three delimiters in the IPv4 address.
|
|
1622 |
delimiterCounter++;
|
|
1623 |
|
|
1624 |
while ( KSatMaxIPv4SegmentCounter > delimiterCounter
|
|
1625 |
&& curPos < addrLen )
|
|
1626 |
{
|
|
1627 |
curPos++;
|
|
1628 |
posOffset = addrPtr.Right( addrLen - curPos ).Find(
|
|
1629 |
KSatIPv4Delimiter );
|
|
1630 |
LOG2( SIMPLE, "CLaunchBrowserHandler::\
|
|
1631 |
SeparatePortNumberFromAddress posOffset: %i", posOffset )
|
|
1632 |
if ( KErrNotFound != posOffset )
|
|
1633 |
{
|
|
1634 |
delimiterCounter++;
|
|
1635 |
curPos += posOffset;
|
|
1636 |
}
|
|
1637 |
else
|
|
1638 |
{
|
|
1639 |
delimiterCounter = KSatMaxIPv4SegmentCounter;
|
|
1640 |
}
|
|
1641 |
}
|
|
1642 |
|
|
1643 |
// Locate the separator between the pure address and
|
|
1644 |
// the port number.
|
|
1645 |
curPos++;
|
|
1646 |
|
|
1647 |
while ( curPos < addrLen
|
|
1648 |
&& KSatMaxIPv4SegmentLength > symbolCounter
|
|
1649 |
&& !isSeparator )
|
|
1650 |
{
|
|
1651 |
TChar ch( addrPtr[curPos] );
|
|
1652 |
|
|
1653 |
if ( ch.IsAlphaDigit() )
|
|
1654 |
{
|
|
1655 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1656 |
SeparatePortNumberFromAddress AlphaDigit" )
|
|
1657 |
symbolCounter++;
|
|
1658 |
}
|
|
1659 |
else
|
|
1660 |
{
|
|
1661 |
isSeparator = ETrue;
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
curPos++;
|
|
1665 |
}
|
|
1666 |
}
|
|
1667 |
else
|
|
1668 |
{
|
|
1669 |
curPos = addrPtr.Find( KSatIPv6Delimiter );
|
|
1670 |
LOG2( SIMPLE, "CLaunchBrowserHandler::\
|
|
1671 |
SeparatePortNumberFromAddress curPos: %i", curPos )
|
|
1672 |
if ( KErrNotFound != curPos )
|
|
1673 |
{
|
|
1674 |
// Skip seven delimiters in the IPv6 address.
|
|
1675 |
delimiterCounter++;
|
|
1676 |
|
|
1677 |
while ( KSatMaxIPv6SegmentCounter > delimiterCounter
|
|
1678 |
&& curPos < addrLen )
|
|
1679 |
{
|
|
1680 |
curPos++;
|
|
1681 |
posOffset = addrPtr.Right( addrLen - curPos ).Find(
|
|
1682 |
KSatIPv6Delimiter );
|
|
1683 |
LOG2( SIMPLE, "CLaunchBrowserHandler::\
|
|
1684 |
SeparatePortNumberFromAddress posOffset: %i", posOffset )
|
|
1685 |
if ( KErrNotFound != posOffset )
|
|
1686 |
{
|
|
1687 |
delimiterCounter++;
|
|
1688 |
curPos += posOffset;
|
|
1689 |
}
|
|
1690 |
}
|
|
1691 |
|
|
1692 |
// Locate the separator between the pure address and
|
|
1693 |
// the port number.
|
|
1694 |
curPos++;
|
|
1695 |
|
|
1696 |
while ( curPos < addrLen &&
|
|
1697 |
KSatMaxIPv6SegmentLength > symbolCounter &&
|
|
1698 |
!isSeparator )
|
|
1699 |
{
|
|
1700 |
TChar ch( addrPtr[curPos] );
|
|
1701 |
|
|
1702 |
if ( ch.IsAlphaDigit() )
|
|
1703 |
{
|
|
1704 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1705 |
SeparatePortNumberFromAddress AlphaDigit" )
|
|
1706 |
symbolCounter++;
|
|
1707 |
}
|
|
1708 |
else
|
|
1709 |
{
|
|
1710 |
isSeparator = ETrue;
|
|
1711 |
}
|
|
1712 |
|
|
1713 |
curPos++;
|
|
1714 |
}
|
|
1715 |
}
|
|
1716 |
}
|
|
1717 |
|
|
1718 |
// Extract the pure address.
|
|
1719 |
while ( curPos < addrLen && KSatMinIPv4AddressLength < curPos
|
|
1720 |
&& !pureAddrEnd )
|
|
1721 |
{
|
|
1722 |
TChar ch( addrPtr[curPos] );
|
|
1723 |
|
|
1724 |
if ( !ch.IsAlphaDigit() )
|
|
1725 |
{
|
|
1726 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1727 |
SeparatePortNumberFromAddress not AlphaDigit" )
|
|
1728 |
curPos--;
|
|
1729 |
}
|
|
1730 |
else
|
|
1731 |
{
|
|
1732 |
pureAddrEnd = ETrue;
|
|
1733 |
}
|
|
1734 |
}
|
|
1735 |
|
|
1736 |
if ( curPos <= addrLen )
|
|
1737 |
{
|
|
1738 |
aPureAddr.Copy( addrPtr.Left( curPos + 1 ) );
|
|
1739 |
}
|
|
1740 |
|
|
1741 |
// Extract the port number.
|
|
1742 |
// Locate the beginning of the port number.
|
|
1743 |
curPos++;
|
|
1744 |
|
|
1745 |
while ( curPos < addrLen && !portNumberBegin)
|
|
1746 |
{
|
|
1747 |
TChar ch( addrPtr[curPos] );
|
|
1748 |
|
|
1749 |
if ( ch.IsDigit() )
|
|
1750 |
{
|
|
1751 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1752 |
SeparatePortNumberFromAddress Digit" )
|
|
1753 |
portNumberBegin = ETrue;
|
|
1754 |
}
|
|
1755 |
else
|
|
1756 |
{
|
|
1757 |
curPos++;
|
|
1758 |
}
|
|
1759 |
}
|
|
1760 |
|
|
1761 |
// Locate the end of the port number.
|
|
1762 |
rightBound = addrLen;
|
|
1763 |
rightBound--;
|
|
1764 |
|
|
1765 |
while ( rightBound > curPos && !portNumberEnd )
|
|
1766 |
{
|
|
1767 |
TChar ch( addrPtr[rightBound] );
|
|
1768 |
|
|
1769 |
if ( ch.IsDigit() )
|
|
1770 |
{
|
|
1771 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1772 |
SeparatePortNumberFromAddress Digit" )
|
|
1773 |
portNumberEnd = ETrue;
|
|
1774 |
}
|
|
1775 |
else
|
|
1776 |
{
|
|
1777 |
rightBound--;
|
|
1778 |
}
|
|
1779 |
}
|
|
1780 |
|
|
1781 |
// Convert the port number and validate it.
|
|
1782 |
// Set the port number to default port number
|
|
1783 |
aPortNumber = portNumber;
|
|
1784 |
if ( curPos < rightBound && rightBound < addrLen )
|
|
1785 |
{
|
|
1786 |
portNumber = ConvertDesToInt(
|
|
1787 |
addrPtr.Mid( curPos, rightBound - curPos + 1 ) );
|
|
1788 |
|
|
1789 |
if ( KSatMaxProxyPortNumber > portNumber &&
|
|
1790 |
KSatMinProxyPortNumber < portNumber )
|
|
1791 |
{
|
|
1792 |
LOG( SIMPLE, "CLaunchBrowserHandler::\
|
|
1793 |
SeparatePortNumberFromAddress valid portNumber" )
|
|
1794 |
aPortNumber = portNumber;
|
|
1795 |
}
|
|
1796 |
}
|
|
1797 |
}
|
|
1798 |
|
|
1799 |
LOG( SIMPLE,
|
|
1800 |
"LAUNCHBROWSER: CLaunchBrowserHandler::SeparatePortNumberFromAddress \
|
|
1801 |
exiting" )
|
|
1802 |
}
|
|
1803 |
|
|
1804 |
// --------------------------------------------------------------------------
|
|
1805 |
// Fulfill connecion method params with default params.
|
|
1806 |
// --------------------------------------------------------------------------
|
|
1807 |
void CLaunchBrowserHandler::FulfillConnnectionMethodL(
|
|
1808 |
RCmManager& aCmManager,
|
|
1809 |
RCmConnectionMethod& aCm )
|
|
1810 |
{
|
|
1811 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1812 |
FulfillConnnectionMethodL calling" )
|
|
1813 |
|
|
1814 |
// The following 3 lines are used to preset the default parameters
|
|
1815 |
// to avoid doing nothing for them if leaving.
|
|
1816 |
aCm.SetStringAttributeL( CMManager::EPacketDataAPName,
|
|
1817 |
KSatGprsAccessPointName );
|
|
1818 |
aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, EFalse );
|
|
1819 |
aCm.SetBoolAttributeL( CMManager::ECmDisablePlainTextAuth, EFalse );
|
|
1820 |
|
|
1821 |
// Get default access point ID.
|
|
1822 |
RCmConnectionMethod defCm;
|
|
1823 |
CleanupClosePushL( defCm );
|
|
1824 |
|
|
1825 |
TInt ret ( KErrNotFound );
|
|
1826 |
GetDefConnMethodL( aCmManager, defCm, ret );
|
|
1827 |
|
|
1828 |
if ( !ret )
|
|
1829 |
{
|
|
1830 |
// Default AP found! Copy parameters from
|
|
1831 |
// default AP to new created AP.
|
|
1832 |
|
|
1833 |
// Copy AP name.
|
|
1834 |
HBufC* strValue = defCm.GetStringAttributeL(
|
|
1835 |
CMManager::EPacketDataAPName );
|
|
1836 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1837 |
FulfillConnnectionMethodL AP Name is %s", strValue )
|
|
1838 |
CleanupStack::PushL( strValue );
|
|
1839 |
aCm.SetStringAttributeL( CMManager::EPacketDataAPName, *strValue );
|
|
1840 |
CleanupStack::PopAndDestroy( strValue );
|
|
1841 |
|
|
1842 |
// Copy authentic name
|
|
1843 |
strValue = defCm.GetStringAttributeL( CMManager::ECmIFAuthName );
|
|
1844 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1845 |
FulfillConnnectionMethodL Auch name is %s", strValue )
|
|
1846 |
CleanupStack::PushL( strValue );
|
|
1847 |
aCm.SetStringAttributeL( CMManager::ECmIFAuthName, *strValue );
|
|
1848 |
CleanupStack::PopAndDestroy( strValue );
|
|
1849 |
|
|
1850 |
// Copy authentic pass
|
|
1851 |
strValue = defCm.GetStringAttributeL( CMManager::ECmIFAuthPass );
|
|
1852 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1853 |
FulfillConnnectionMethodL Auch pass is %s", strValue )
|
|
1854 |
CleanupStack::PushL( strValue );
|
|
1855 |
aCm.SetStringAttributeL( CMManager::ECmIFAuthPass, *strValue );
|
|
1856 |
CleanupStack::PopAndDestroy( strValue );
|
|
1857 |
|
|
1858 |
// Copy default URL
|
|
1859 |
strValue = defCm.GetStringAttributeL( CMManager::ECmStartPage );
|
|
1860 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1861 |
FulfillConnnectionMethodL Start page pass is %s", strValue )
|
|
1862 |
CleanupStack::PushL( strValue );
|
|
1863 |
aCm.SetStringAttributeL( CMManager::ECmStartPage, *strValue );
|
|
1864 |
CleanupStack::PopAndDestroy( strValue );
|
|
1865 |
|
|
1866 |
// Copy status if prompt for auth
|
|
1867 |
TBool bValue = defCm.GetBoolAttributeL(
|
|
1868 |
CMManager::ECmIFPromptForAuth );
|
|
1869 |
aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, bValue );
|
|
1870 |
|
|
1871 |
// Copy security status.
|
|
1872 |
bValue = defCm.GetBoolAttributeL(
|
|
1873 |
CMManager::ECmDisablePlainTextAuth );
|
|
1874 |
aCm.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, bValue );
|
|
1875 |
}
|
|
1876 |
|
|
1877 |
CleanupStack::PopAndDestroy( &defCm );
|
|
1878 |
|
|
1879 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1880 |
FulfillConnnectionMethodL exiting" )
|
|
1881 |
}
|
|
1882 |
|
|
1883 |
// --------------------------------------------------------------------------
|
|
1884 |
// Check the validity of offered bearer type
|
|
1885 |
// --------------------------------------------------------------------------
|
|
1886 |
void CLaunchBrowserHandler::ValidateBearerTypeL( RCmConnectionMethod& aCm,
|
|
1887 |
TInt& aIsValid )
|
|
1888 |
{
|
|
1889 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1890 |
ValidateBearerTypeL calling" )
|
|
1891 |
|
|
1892 |
TUint32 bearerType = aCm.GetIntAttributeL(
|
|
1893 |
CMManager::ECmBearerType );
|
|
1894 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1895 |
ValidateBearerTypeL bearerType=0x%x", bearerType )
|
|
1896 |
|
|
1897 |
if ( KUidPacketDataBearerType == bearerType )
|
|
1898 |
{
|
|
1899 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1900 |
ValidateBearerTypeL bearer type is GPRS" )
|
|
1901 |
aIsValid = KErrNone;
|
|
1902 |
}
|
|
1903 |
|
|
1904 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1905 |
ValidateBearerTypeL exiting, aIsValid=%d", aIsValid )
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
// --------------------------------------------------------------------------
|
|
1909 |
// Get default connection method
|
|
1910 |
// --------------------------------------------------------------------------
|
|
1911 |
void CLaunchBrowserHandler::GetDefConnMethodL( RCmManager& aCmManager,
|
|
1912 |
RCmConnectionMethod& aDefCm,
|
|
1913 |
TInt& aIsValid )
|
|
1914 |
{
|
|
1915 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1916 |
GetDefConnMethodL calling" )
|
|
1917 |
|
|
1918 |
// Go through the default connection methods to find
|
|
1919 |
// the one valid connection method.
|
|
1920 |
TCmDefConnValue defConn;
|
|
1921 |
aCmManager.ReadDefConnL( defConn );
|
|
1922 |
|
|
1923 |
LOG3( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1924 |
GetDefConnMethodL DefConn type=%d, id=%d",
|
|
1925 |
defConn.iType, defConn.iId )
|
|
1926 |
|
|
1927 |
// Mark aIsFound as KErrNone if there is one valid
|
|
1928 |
// connection method, otherwise KErrNotFound.
|
|
1929 |
aIsValid = KErrNotFound;
|
|
1930 |
|
|
1931 |
// Default setting is a connection method
|
|
1932 |
if ( ECmDefConnConnectionMethod == defConn.iType )
|
|
1933 |
{
|
|
1934 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1935 |
GetDefConnMethodL ECmDefConnConnectionMethod" )
|
|
1936 |
aDefCm = aCmManager.ConnectionMethodL( defConn.iId );
|
|
1937 |
// Check bearer type, leave if not GPRS
|
|
1938 |
ValidateBearerTypeL( aDefCm, aIsValid );
|
|
1939 |
}
|
|
1940 |
|
|
1941 |
// Default setting is a destination
|
|
1942 |
else if ( ECmDefConnDestination == defConn.iType )
|
|
1943 |
{
|
|
1944 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1945 |
GetDefConnMethodL ECmDefConnDestination" )
|
|
1946 |
RCmDestination defDes = aCmManager.DestinationL( defConn.iId );
|
|
1947 |
|
|
1948 |
TInt desCount = defDes.ConnectionMethodCount();
|
|
1949 |
|
|
1950 |
LOG2( SIMPLE, "SATENGINE: CLaunchBrowserHandler::\
|
|
1951 |
GetDefConnMethodL ECmDefConnDestination count=%d",
|
|
1952 |
desCount )
|
|
1953 |
|
|
1954 |
for ( TInt i = 0;
|
|
1955 |
desCount > 0 && aIsValid != KErrNone && i < desCount; i++ )
|
|
1956 |
{
|
|
1957 |
// Go through all the connection methods,
|
|
1958 |
// until find a valid one.
|
|
1959 |
aDefCm = defDes.ConnectionMethodL( i );
|
|
1960 |
ValidateBearerTypeL( aDefCm, aIsValid );
|
|
1961 |
}
|
|
1962 |
}
|
|
1963 |
else
|
|
1964 |
{
|
|
1965 |
aIsValid = KErrNotFound;
|
|
1966 |
}
|
|
1967 |
LOG( SIMPLE, "SATENGINE: CLaunchBrowserHandler::GetDefConnMethodL exit" )
|
|
1968 |
}
|
|
1969 |
// End Of File
|