24 #include <cmpluginpacketdata.mbg> // icons |
24 #include <cmpluginpacketdata.mbg> // icons |
25 #include <cmpacketdataui.rsg> |
25 #include <cmpacketdataui.rsg> |
26 #include <AknQueryDialog.h> |
26 #include <AknQueryDialog.h> |
27 #include <StringLoader.h> |
27 #include <StringLoader.h> |
28 #include <cmmanager.rsg> |
28 #include <cmmanager.rsg> |
|
29 #include <featmgr.h> // FeatureManager |
|
30 #include <centralrepository.h> // CRepository |
|
31 #include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, |
|
32 |
29 // User |
33 // User |
30 #include "cmpluginpacketdata.h" |
34 #include "cmpluginpacketdata.h" |
31 #include <cmpluginpacketdatadef.h> |
35 #include <cmpluginpacketdatadef.h> |
32 #include "cmpacketdatacommonconstants.h" |
36 #include "cmpacketdatacommonconstants.h" |
33 #include "cmlogger.h" |
37 #include "cmlogger.h" |
282 // CCmPDCoverageCheck::RunL |
283 // CCmPDCoverageCheck::RunL |
283 // ---------------------------------------------------------------------------- |
284 // ---------------------------------------------------------------------------- |
284 // |
285 // |
285 void CCmPDCoverageCheck::RunL() |
286 void CCmPDCoverageCheck::RunL() |
286 { |
287 { |
287 switch( iProgState ) |
288 if( !iStatus.Int() ) |
288 { |
289 { |
289 case EPDPAttach: |
290 CLOG_WRITE_1( "CCmPDCoverageCheck::RunL: iNwRegStatus: [%d]", iNwRegStatus ); |
290 { |
291 |
291 if( !iStatus.Int() ) |
292 if ( iNwRegStatus == RPacketService::ERegisteredOnHomeNetwork || |
292 // PDP context created -> there's a usable PD coverage. |
293 iNwRegStatus == RPacketService::ERegisteredRoaming || |
293 { |
294 iNwRegStatus == RPacketService::ENotRegisteredButAvailable ) |
294 iService.Detach( iStatus ); |
295 { |
295 SetActive(); |
296 iCoverage = ETrue; |
296 |
297 } |
297 iCoverage = ETrue; |
298 iWait.AsyncStop(); |
298 iProgState = EPDPDetach; |
299 } |
299 } |
300 else |
300 else |
301 // something went wrong -> no coverage. |
301 // something went wrong -> no coverage. |
302 { |
302 { |
303 CLOG_WRITE_1( "CCmPDCoverageCheck::RunL: FAILED: [%d]", iStatus.Int() ); |
303 iWait.AsyncStop(); |
304 iWait.AsyncStop(); |
304 } |
|
305 } |
|
306 break; |
|
307 |
|
308 case EPDPDetach: |
|
309 { |
|
310 iWait.AsyncStop(); |
|
311 } |
|
312 break; |
|
313 |
|
314 default: |
|
315 { |
|
316 User::Leave( KErrCorrupt ); |
|
317 } |
|
318 } |
305 } |
319 } |
306 } |
320 |
307 |
321 // ---------------------------------------------------------------------------- |
308 // ---------------------------------------------------------------------------- |
322 // CCmPDCoverageCheck::IsThereCoverageL |
309 // CCmPDCoverageCheck::IsThereCoverageL |
323 // ---------------------------------------------------------------------------- |
310 // ---------------------------------------------------------------------------- |
324 // |
311 // |
325 TBool CCmPDCoverageCheck::IsThereCoverageL() |
312 TBool CCmPDCoverageCheck::IsThereCoverageL() |
326 { |
313 { |
327 iProgState = EServiceStatus; |
|
328 iCoverage = EFalse; |
314 iCoverage = EFalse; |
329 |
315 |
330 User::LeaveIfError( iServer.Connect() ); |
316 if ( !IsPhoneOfflineL() ) |
331 CLOG_WRITE( "Server open" ); |
317 { |
332 |
318 User::LeaveIfError( iServer.Connect() ); |
333 RTelServer::TPhoneInfo info; |
319 CLOG_WRITE( "Server open" ); |
334 User::LeaveIfError( iServer.GetPhoneInfo( 0, info ) ); |
320 |
335 CLOG_WRITE( "Phone info ok" ); |
321 RTelServer::TPhoneInfo info; |
336 |
322 User::LeaveIfError( iServer.GetPhoneInfo( 0, info ) ); |
337 User::LeaveIfError( iPhone.Open(iServer, info.iName ) ); |
323 CLOG_WRITE( "Phone info ok" ); |
338 CLOG_WRITE( "Phone open" ); |
324 |
339 |
325 User::LeaveIfError( iPhone.Open(iServer, info.iName ) ); |
340 User::LeaveIfError( iService.Open( iPhone ) ); |
326 CLOG_WRITE( "Phone open" ); |
341 CLOG_WRITE( "service ok" ); |
327 |
342 |
328 User::LeaveIfError( iService.Open( iPhone ) ); |
343 RPacketService::TStatus status; |
329 CLOG_WRITE( "service ok" ); |
344 User::LeaveIfError( iService.GetStatus( status ) ); |
330 |
345 if( status == RPacketService::EStatusAttached || |
331 iService.GetNtwkRegStatus( iStatus, iNwRegStatus ); |
346 status == RPacketService::EStatusActive || |
|
347 status == RPacketService::EStatusSuspended ) |
|
348 // Attached/active/suspened, so there's a coverage |
|
349 { |
|
350 iCoverage = ETrue; |
|
351 } |
|
352 else if( status == RPacketService::EStatusUnattached ) |
|
353 { |
|
354 iProgState = EPDPAttach; |
|
355 iService.Attach( iStatus ); |
|
356 SetActive(); |
332 SetActive(); |
357 iWait.Start(); |
333 iWait.Start(); |
358 } |
334 |
359 else |
335 User::LeaveIfError( iStatus.Int() ); |
360 { |
336 } |
361 CLOG_WRITE( "Unknown state" ); |
|
362 } |
|
363 |
|
364 |
|
365 User::LeaveIfError( iStatus.Int() ); |
|
366 |
337 |
367 return iCoverage; |
338 return iCoverage; |
368 } |
339 } |
369 |
340 |
|
341 // ---------------------------------------------------------------------------- |
|
342 // CCmPDCoverageCheck::IsPhoneOfflineL |
|
343 // ---------------------------------------------------------------------------- |
|
344 // |
|
345 TBool CCmPDCoverageCheck::IsPhoneOfflineL() const |
|
346 { |
|
347 if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) |
|
348 { |
|
349 CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs ); |
|
350 TInt connAllowed( ECoreAppUIsNetworkConnectionAllowed ); |
|
351 |
|
352 repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed ); |
|
353 CleanupStack::PopAndDestroy( repository ); |
|
354 |
|
355 if ( !connAllowed ) |
|
356 { |
|
357 CLOG_WRITE( "Phone is in offline mode." ); |
|
358 return ETrue; |
|
359 } |
|
360 } |
|
361 |
|
362 CLOG_WRITE( "Phone is NOT in offline mode." ); |
|
363 return EFalse; |
|
364 } |
|
365 |
370 // ---------------------------------------------------------------------------- |
366 // ---------------------------------------------------------------------------- |
371 // CCmPluginPacketData::NewOutgoingL |
367 // CCmPluginPacketData::NewOutgoingL |
372 // ---------------------------------------------------------------------------- |
368 // ---------------------------------------------------------------------------- |
373 // |
369 // |
374 CCmPluginPacketData* CCmPluginPacketData::NewL( |
370 CCmPluginPacketData* CCmPluginPacketData::NewL( |