connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
changeset 72 0c32cf868819
parent 71 9f263f780e41
equal deleted inserted replaced
71:9f263f780e41 72:0c32cf868819
  3837                  nwRegStatus != RPacketService::ENotRegisteredNotSearching &&
  3837                  nwRegStatus != RPacketService::ENotRegisteredNotSearching &&
  3838                  nwRegStatus != RPacketService::ENotRegisteredSearching    &&
  3838                  nwRegStatus != RPacketService::ENotRegisteredSearching    &&
  3839                  nwRegStatus != RPacketService::ERegistrationDenied        &&
  3839                  nwRegStatus != RPacketService::ERegistrationDenied        &&
  3840                  nwRegStatus != RPacketService::ENotRegisteredAndNotAvailable )
  3840                  nwRegStatus != RPacketService::ENotRegisteredAndNotAvailable )
  3841                 {
  3841                 {
  3842                 // Query the TSY for the attach mode
  3842                 aByCell = ETrue;    
  3843                 RPacketService::TAttachMode attachMode( RPacketService::EAttachWhenNeeded );
       
  3844                 err = iPacketService.GetAttachMode( attachMode );
       
  3845 
       
  3846                 LOGIT2("GetBearerSupportInfo: pckt service attach mode:       %d <%d>", attachMode, err)
       
  3847                 // Query packet network status (but only if the TSY is set to attach when possible)
       
  3848                 if ( KErrNone == err && attachMode == RPacketService::EAttachWhenPossible )
       
  3849                     {
       
  3850                     RPacketService::TStatus pcktStatus( RPacketService::EStatusUnattached );
       
  3851                     err = iPacketService.GetStatus( pcktStatus );
       
  3852 
       
  3853                     LOGIT2("GetBearerSupportInfo: pckt service status:            %d <%d>", pcktStatus, err)
       
  3854                     if ( KErrNone == err && pcktStatus != RPacketService::EStatusUnattached )
       
  3855                         {
       
  3856                         aByCell = ETrue;
       
  3857                         }
       
  3858                     }
       
  3859                 else
       
  3860                     {
       
  3861                     // Attach mode is 'EAttachWhenNeeded'
       
  3862                     aByCell = ETrue;
       
  3863                     }
       
  3864                 }
  3843                 }
  3865             }
  3844             }
  3866 
  3845 
  3867         // 2. Check the PHONE'S MODE if it is known
  3846         // 2. Check the PHONE'S MODE if it is known
  3868         TUint bearerId( 0 );
  3847         TUint bearerId( 0 );
  5484 
  5463 
  5485     LOGEXITFN1("CConnMonIAP::BearerIdForBearerAvailability()", err)
  5464     LOGEXITFN1("CConnMonIAP::BearerIdForBearerAvailability()", err)
  5486     return err;
  5465     return err;
  5487     }
  5466     }
  5488 
  5467 
       
  5468 // ---------------------------------------------------------------------------
       
  5469 // CConnMonIAP::RestoreAttachMode
       
  5470 // ---------------------------------------------------------------------------
       
  5471 //
       
  5472 void CConnMonIAP::RestoreAttachMode()
       
  5473     {
       
  5474     // AT command AT+CGATT=0 will detach phone from cellular network.
       
  5475     // Restore attach mode to cellmo when attach mode is set to EAttachWhenPossible.
       
  5476     //
       
  5477     RPacketService::TAttachMode attachMode( RPacketService::EAttachWhenNeeded );
       
  5478     TInt err = iPacketService.GetAttachMode( attachMode );
       
  5479     LOGIT2("CConnMonIAP::RestoreAttachMode: attach mode:       %d <%d>", attachMode, err)
       
  5480     
       
  5481     if ( err == KErrNone && attachMode == RPacketService::EAttachWhenPossible )
       
  5482         {
       
  5483         TRequestStatus status( KErrNone );
       
  5484 
       
  5485         iPacketService.SetAttachMode( status, RPacketService::EAttachWhenPossible );
       
  5486         User::WaitForRequest( status );
       
  5487         LOGIT1("CConnMonIAP::RestoreAttachMode: set --> EAttachWhenPossible, error <%d>", status.Int() )
       
  5488 
       
  5489         return;
       
  5490         }
       
  5491     LOGIT("No need to restore attach mode.")    
       
  5492     }
       
  5493 
  5489 // End-of-file
  5494 // End-of-file