engines/vmbxengine/src/vmnumber.cpp
branchRCL_3
changeset 10 a19c8664496d
parent 8 1b9ee3c7442d
child 14 71e7b994dff4
equal deleted inserted replaced
8:1b9ee3c7442d 10:a19c8664496d
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   169                                 iVmNumOpts( EVmNumOptsBlank ),
   169                                 iVmNumOpts( EVmNumOptsBlank ),
   170                                 iVmUiOpts( 0 ), 
   170                                 iVmUiOpts( 0 ), 
   171                                 iSynchronize( EFalse ),
   171                                 iSynchronize( EFalse ),
   172                                 iType( EVmbxNone ),
   172                                 iType( EVmbxNone ),
   173                                 iVMSimQueryDialog( NULL ),
   173                                 iVMSimQueryDialog( NULL ),
   174                                 iUSimSupport( EFalse ),
       
   175                                 iVideoQuery( NULL ),
   174                                 iVideoQuery( NULL ),
   176                                 iTypeSelectionQuery( NULL ),
   175                                 iTypeSelectionQuery( NULL ),
   177                                 iAlphaStringFound( EFalse ),
   176                                 iAlphaStringFound( EFalse ),
   178                                 iAlphaStringFromSIM( NULL ),
   177                                 iAlphaStringFromSIM( NULL ),
   179                                 iNumberFound( EFalse ),
   178                                 iNumberFound( EFalse ),
   390 #ifdef VM_USE_TSY
   389 #ifdef VM_USE_TSY
   391 
   390 
   392     TInt nValue;
   391     TInt nValue;
   393     psErr = property.Get( nValue );
   392     psErr = property.Get( nValue );
   394     TBool simStatus = EFalse;
   393     TBool simStatus = EFalse;
   395     iUSimSupport = IsUsimSupport();
   394 
   396     VMBLOGSTRING2( "iUSimSupport = %d", iUSimSupport );
   395     // Sim aceess test on startup
   397         // Sim aceess test on startup
   396     iStartUpTest = ETrue;
   398         iStartUpTest = ETrue;
       
   399 #ifdef RD_STARTUP_CHANGE
   397 #ifdef RD_STARTUP_CHANGE
   400 
   398 
   401     if ( ( FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   399     if ( ( FeatureManager::FeatureSupported( KFeatureIdSimCard ) )
   402         && ( ESimNotPresent != nValue ) )
   400         && ( ESimNotPresent != nValue ) )
   403         {
   401         {
   410         && ( EPSCSimRemoved != nValue ) )
   408         && ( EPSCSimRemoved != nValue ) )
   411         {
   409         {
   412         simStatus = ETrue;
   410         simStatus = ETrue;
   413         }
   411         }
   414 #endif // RD_STARTUP_CHANGE
   412 #endif // RD_STARTUP_CHANGE
   415     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) )
       
   416         {
       
   417         if ( iUSimSupport )
       
   418             {
       
   419             simStatus = ETrue;
       
   420             }
       
   421         }
       
   422 
   413 
   423     VMBLOGSTRING2( "simStatus = %d", simStatus );
   414     VMBLOGSTRING2( "simStatus = %d", simStatus );
   424     if ( simStatus )//Is simCard supproted and it is not removed
   415     if ( simStatus )//Is simCard supproted and it is not removed
   425         {
   416         {
   426         iSimCardFound = ETrue;
   417         iSimCardFound = ETrue;
   427         // If UICC supported, then open USIM phone book.
   418 
   428         if ( iUSimSupport )
   419         // Get identifiers from MBI-file
   429             {
   420         if ( EAlsLine1 == alsline )
   430             iMbdnPhonebookOk = EFalse;
   421             {
   431             // Get identifiers from MBI-file
   422             result = MailboxNumbersIdentifiers();
   432             if ( EAlsLine1 == alsline )
   423             VMBLOGSTRING2( "Identifier result = %d", result );
   433                 {
   424             if ( KErrPathNotFound == result )
   434                 result = MailboxNumbersIdentifiers();
   425                 {
   435                 VMBLOGSTRING2( "Identifier result = %d", result );
   426                 // try open vmbx-phonebook next
   436                 if ( KErrPathNotFound == result )
   427                 iPhoneBookType = EVMBXPhoneBook;
       
   428                 }
       
   429             else
       
   430                 {
       
   431                 iPhoneBookType = EMBDNPhoneBook;
       
   432                 // set ALS line, if identifier reading returns -1
       
   433                 if ( KErrNotFound == result )
   437                     {
   434                     {
   438                     // try open vmbx-phonebook next
   435                     iPhoneVoicemailInfo.iVoice = alsline;
   439                     iPhoneBookType = EVMBXPhoneBook;
       
   440                     }
   436                     }
   441                 else
   437 
   442                     {
       
   443                     iPhoneBookType = EMBDNPhoneBook;
       
   444                     // set ALS line, if identifier reading returns -1
       
   445                     if ( KErrNotFound == result )
       
   446                         {
       
   447                         iPhoneVoicemailInfo.iVoice = alsline;
       
   448                         }
       
   449 
       
   450                     // try to open mbdn-type phonebook
       
   451                     result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook );
       
   452                     VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result );
       
   453                     if ( KErrNone == result )
       
   454                         {
       
   455                         // Get phonebook info
       
   456                         result = PhoneBookInfo();
       
   457                         }
       
   458                     // close phonebook when error in opening or GetInfo
       
   459                     if ( KErrNone != result )
       
   460                         {
       
   461                         VMBLOGSTRING( "Close MBDN phonebook" );
       
   462                         iPhoneBook.Close();
       
   463                         }
       
   464                     // close phonebook when no number founf to test vmbx-phonebook
       
   465                     else if ( ( KErrNone == result ) && iNoNumberFound )
       
   466                         {
       
   467                         VMBLOGSTRING( "mbdn close, number not found" );
       
   468                         iMbdnPhonebookOk = ETrue;
       
   469                         iPhoneBook.Close();
       
   470                         // try open vmbx-phonebook next
       
   471                         iPhoneBookType = EVMBXPhoneBook;
       
   472                         }
       
   473                     }
       
   474                 }
       
   475 
       
   476             if ( EAlsLine2 == alsline || EVMBXPhoneBook == iPhoneBookType )
       
   477                 {
       
   478                 // try to open vmbx-type phonebook
       
   479                 result = iPhoneBook.Open( iPhone, KETelIccVoiceMailBox );
       
   480                 VMBLOGSTRING2( "Vmbx phonebook opening result = %I ", result );
       
   481                 if ( KErrNone == result )
       
   482                     {
       
   483                     // check that this phonebook supports reading
       
   484                     result = PhoneBookInfo();
       
   485                     VMBLOGSTRING( "VmbxPhoneBook opened" );
       
   486                     }
       
   487                 }
       
   488              // reopen mbdn-phonebook when vmbx-phonebook has no number
       
   489              if ( iMbdnPhonebookOk && iNoNumberFound )
       
   490                 {
       
   491                 VMBLOGSTRING( "reopen mbdn" );
       
   492                 iPhoneBook.Close();
       
   493                 // try open vmbx-phonebook next
       
   494                 iPhoneBookType = EMBDNPhoneBook;
       
   495                 // try to open mbdn-type phonebook
   438                 // try to open mbdn-type phonebook
   496                 result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook );
   439                 result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook );
   497                 VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result );
   440                 VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result );
   498                 if ( KErrNone == result )
   441                 if ( KErrNone == result )
   499                     {
   442                     {
   500                     // Get phonebook info
   443                     // Get phonebook info
   501                     result = PhoneBookInfo();
   444                     result = PhoneBookInfo();
       
   445                     VMBLOGSTRING2( "Mbdn phonebook opening again \
       
   446                     result = %I ", result );
   502                     }
   447                     }
   503                 // close phonebook when error in opening or GetInfo
   448                 // close phonebook when error in opening or GetInfo
   504                 if ( KErrNone != result )
   449                 if ( KErrNone != result )
   505                     {
   450                     {
   506                     VMBLOGSTRING( "Close MBDN phonebook" );
   451                     VMBLOGSTRING( "Close MBDN phonebook" );
   507                     iPhoneBook.Close();
   452                     iPhoneBook.Close();
   508                     }
   453                     }
   509                 }
   454                 // close phonebook when no number founf to test vmbx-phonebook
   510             }
   455                 else if ( ( KErrNone == result ) && iNoNumberFound )
   511         // open SIM book
   456                     {
   512         else
   457                     VMBLOGSTRING( "mbdn close, number not found" );
   513             {
   458                     iMbdnPhonebookOk = ETrue;
   514             // No need to prevent for changing memory location
   459                     iPhoneBook.Close();
   515             iUSimFirstRoundTest = EFalse;
   460                     // try open vmbx-phonebook next 
       
   461                     iPhoneBookType = EVMBXPhoneBook;
       
   462                     }
       
   463                 }
       
   464             }
       
   465 
       
   466         if ( EAlsLine2 == alsline || EVMBXPhoneBook == iPhoneBookType )
       
   467             {
       
   468             // try to open vmbx-type phonebook
   516             result = iPhoneBook.Open( iPhone, KETelIccVoiceMailBox );
   469             result = iPhoneBook.Open( iPhone, KETelIccVoiceMailBox );
   517             iPhoneBookType = EVMBXPhoneBook;
   470             VMBLOGSTRING2( "Vmbx phonebook opening result = %I ", result );
   518             VMBLOGSTRING( "VmbxPhoneBook opened" );
       
   519 
       
   520             if ( KErrNone == result )
   471             if ( KErrNone == result )
   521                 {
   472                 {
       
   473                 // check that this phonebook supports reading
   522                 result = PhoneBookInfo();
   474                 result = PhoneBookInfo();
   523                 }
   475                 VMBLOGSTRING( "VmbxPhoneBook opened" );
   524             }
   476                 }
       
   477             }
       
   478         // reopen mbdn-phonebook when vmbx-phonebook has no number
       
   479         if ( iMbdnPhonebookOk && iNoNumberFound )
       
   480            {
       
   481            VMBLOGSTRING( "reopen mbdn" );
       
   482            iPhoneBook.Close();
       
   483            // try open vmbx-phonebook next
       
   484            iPhoneBookType = EMBDNPhoneBook;
       
   485            // try to open mbdn-type phonebook
       
   486            result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook );
       
   487            VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result );
       
   488            if ( KErrNone == result )
       
   489                {
       
   490                // Get phonebook info
       
   491                result = PhoneBookInfo();
       
   492                }
       
   493            // close phonebook when error in opening or GetInfo
       
   494            if ( KErrNone != result )
       
   495                {
       
   496                VMBLOGSTRING( "Close MBDN phonebook" );
       
   497                iPhoneBook.Close();
       
   498                }
       
   499            }
       
   500 
   525 
   501 
   526         // set readonly state if aquired
   502         // set readonly state if aquired
   527         if ( IsReadOnlySIM() )
   503         if ( IsReadOnlySIM() )
   528             {
   504             {
   529             iFlags &= ~KVmFlagSimWriteSupport;
   505             iFlags &= ~KVmFlagSimWriteSupport;
  3458     }
  3434     }
  3459 
  3435 
  3460 // -----------------------------------------------------------------------------
  3436 // -----------------------------------------------------------------------------
  3461 // RVmbxNumber::IsUsimSupport
  3437 // RVmbxNumber::IsUsimSupport
  3462 // -----------------------------------------------------------------------------
  3438 // -----------------------------------------------------------------------------
  3463 TBool RVmbxNumber::IsUsimSupport()
       
  3464     {
       
  3465     VMBLOGSTRING( "VMBX: RVmbxNumber::IsUsimSupport: =>" );
       
  3466     TBool ret( EFalse );
       
  3467     TInt alsline( EAlsLine1 );
       
  3468 
       
  3469     // get the current ALS line
       
  3470     if ( GetAlsLine( alsline ) != KErrNone )
       
  3471         {
       
  3472         alsline = EAlsLine1;  // if problems, assume primary line
       
  3473         }
       
  3474 
       
  3475     // SIM access not supported for ALS line2
       
  3476     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) &&
       
  3477         ( alsline == EAlsLine1 ) )
       
  3478         {
       
  3479         TUint32 capability;
       
  3480         TInt err = iPhone.GetIccAccessCaps( capability );
       
  3481         VMBLOGSTRING3( "VMBX: RVmbxNumber::IsUsimSupport: Err = %I,\
       
  3482         Capa = %I ", err, capability );
       
  3483 
       
  3484         if ( ( err == KErrNone ) &&
       
  3485                 ( capability & RMobilePhone::KCapsUSimAccessSupported ) )
       
  3486             {
       
  3487             VMBLOGSTRING( "USim access caps ok");
       
  3488             ret =  ETrue;
       
  3489             }
       
  3490         }
       
  3491     else
       
  3492         {
       
  3493         ret =  EFalse;
       
  3494         }
       
  3495     VMBLOGSTRING( "VMBX: RVmbxNumber::IsUsimSupport: <=" );
       
  3496     return ret;
       
  3497     }
       
  3498 
  3439 
  3499 // -----------------------------------------------------------------------------
  3440 // -----------------------------------------------------------------------------
  3500 //  Series 60 Customer / MSatRefreshOserver
  3441 //  Series 60 Customer / MSatRefreshOserver
  3501 //  Series 60 MSatRefreshObserver API
  3442 //  Series 60 MSatRefreshObserver API
  3502 // -----------------------------------------------------------------------------
  3443 // -----------------------------------------------------------------------------