adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp
changeset 8 6295dc2169f3
parent 7 fa67e03b87df
child 9 8486d82aef45
equal deleted inserted replaced
7:fa67e03b87df 8:6295dc2169f3
    83     // None
    83     // None
    84     )
    84     )
    85     {
    85     {
    86 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
    86 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
    87 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit3G_adn" );
    87 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit3G_adn" );
    88 
       
    89     }
    88     }
    90 
    89 
    91 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    92 // CMmPhoneBookOperationInit3G_adn::NewL
    91 // CMmPhoneBookOperationInit3G_adn::NewL
    93 // Two-phased constructor.
    92 // Two-phased constructor.
   160     iPBStoreInfoData = new( ELeave ) CStorageInfoData();
   159     iPBStoreInfoData = new( ELeave ) CStorageInfoData();
   161 
   160 
   162     iIniPhase = 0;
   161     iIniPhase = 0;
   163     iServiceType = 0;
   162     iServiceType = 0;
   164     iNumOfPBRRecords = 0;
   163     iNumOfPBRRecords = 0;
   165 
       
   166 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   167     TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
       
   168         INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is ON.");
       
   169 
       
   170     iMmPhoneBookStoreMessHandler->SetMaxNumOfAasEntries( 0 );
       
   171     iMmPhoneBookStoreMessHandler->SetMaxNumberOfGAS( 0 );
       
   172 #else
       
   173     TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
       
   174         INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is OFF.");
       
   175 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   176     }
   164     }
   177 
   165 
   178 
   166 
   179 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   180 // CMmPhoneBookOperationInit3G_adn::UICCCreateReq
   168 // CMmPhoneBookOperationInit3G_adn::UICCCreateReq
   264 TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR " );
   252 TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR " );
   265 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR" );
   253 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR" );
   266 
   254 
   267             cmdParams.fileId = PB_PBR_FID;
   255             cmdParams.fileId = PB_PBR_FID;
   268             cmdParams.serviceType = iServiceType;
   256             cmdParams.serviceType = iServiceType;
   269             cmdParams.record = 0;
   257             cmdParams.record = KStartRecord;
   270             break;
   258             break;
   271             }
   259             }
   272         case EPBInitPhase_3GADN_Type1:
   260         case EPBInitPhase_3GADN_Type1:
   273             {
   261             {
   274             // read Type 1 Files File descriptor, File Data and Extension File
   262             // read Type 1 Files File descriptor, File Data and Extension File
   315 //Info or File Data
   303 //Info or File Data
   316 // -----------------------------------------------------------------------------
   304 // -----------------------------------------------------------------------------
   317 //
   305 //
   318 TInt CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile(
   306 TInt CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile(
   319     TUiccReadLinearFixed & aparams,
   307     TUiccReadLinearFixed & aparams,
   320     const TUint8 aFileType)
   308     const TUint8 aFileType )
   321     {
   309     {
   322 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile");
   310 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile");
   323 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile" );
   311 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile" );
   324 
   312 
   325     TInt ret( KErrNone );
   313     TInt ret( KErrNone );
   396         iIniPhase = EPBIniPhase_Unknown;
   384         iIniPhase = EPBIniPhase_Unknown;
   397 
   385 
   398         iInternalInit = EFalse;
   386         iInternalInit = EFalse;
   399         complete = ETrue;
   387         complete = ETrue;
   400         return KErrNone;
   388         return KErrNone;
   401         }
   389         }  // no else
   402 
   390 
   403     switch(iIniPhase)
   391     switch(iIniPhase)
   404         {
   392         {
   405         case EPBInitPhase_3GADN_PBR:
   393         case EPBInitPhase_3GADN_PBR:
   406         case EPBInitPhase_3GADN_Type1:
   394         case EPBInitPhase_3GADN_Type1:
   439          phoneBookData.PackData( iPBStoreInfoData );
   427          phoneBookData.PackData( iPBStoreInfoData );
   440 
   428 
   441          if ( UICC_STATUS_OK != aStatus )
   429          if ( UICC_STATUS_OK != aStatus )
   442              {
   430              {
   443              ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
   431              ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
   444              }
   432              }  // no else
   445 
   433 
   446          iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
   434          iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
   447                  EMmTsyPhoneBookStoreInitIPC,
   435                  EMmTsyPhoneBookStoreInitIPC,
   448                  &phoneBookData,
   436                  &phoneBookData,
   449                  ret );
   437                  ret );
   450 
   438 
   451          complete = ETrue;
   439          complete = ETrue;
   452          }
   440          }  // no else
   453     return complete;
   441     return complete;
   454     }
   442     }
   455 
   443 
   456 
   444 
   457 // -----------------------------------------------------------------------------
   445 // -----------------------------------------------------------------------------
   480                 // the total no of entries in 3G ADN phonebook
   468                 // the total no of entries in 3G ADN phonebook
   481                 if( UICC_APPL_FILE_INFO == iServiceType )
   469                 if( UICC_APPL_FILE_INFO == iServiceType )
   482                     {
   470                     {
   483                     TFci fci( aFileData );
   471                     TFci fci( aFileData );
   484                     iNumOfPBRRecords = fci.GetNumberOfRecords();
   472                     iNumOfPBRRecords = fci.GetNumberOfRecords();
       
   473                     // Store PBR record no in internal conf list
       
   474                     iMmPhoneBookStoreMessHandler->
       
   475                               iPBStoreConf[EPhonebookTypeAdn].
       
   476                                     iPBRNoOfRecords = iNumOfPBRRecords;
   485 
   477 
   486                     ret = KErrNone;
   478                     ret = KErrNone;
   487                     iServiceType = UICC_APPL_READ_LINEAR_FIXED;
   479                     iServiceType = UICC_APPL_READ_LINEAR_FIXED;
   488                     }
   480                     }
   489                 else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
   481                 else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
   515                     // type 2 or type3
   507                     // type 2 or type3
   516                     ret = CheckForSameType1AndType2Files();
   508                     ret = CheckForSameType1AndType2Files();
   517 
   509 
   518                     iServiceType = UICC_APPL_FILE_INFO;
   510                     iServiceType = UICC_APPL_FILE_INFO;
   519                     iIniPhase = EPBInitPhase_3GADN_Type1;
   511                     iIniPhase = EPBInitPhase_3GADN_Type1;
   520                     }
   512                     }  // no else ...
   521                 }
   513                 }
   522             else
   514             else
   523                 {
   515                 {
   524                 iADNPbInitilized = EFalse;
   516                 iADNPbInitilized = EFalse;
   525                 GetNextPhoneBookInitPhase(iIniPhase);
   517                 GetNextPhoneBookInitPhase( iIniPhase );
   526                 }
   518                 }
   527             break;
   519             break;
   528             }
   520             }
   529         case EPBInitPhase_3GADN_Type1:
   521         case EPBInitPhase_3GADN_Type1:
   530             {
   522             {
   569         else
   561         else
   570             {
   562             {
   571             // Call Create request for next phase
   563             // Call Create request for next phase
   572             ret = UICCInitializeReq3GADN( aTransId );
   564             ret = UICCInitializeReq3GADN( aTransId );
   573             }
   565             }
   574         }
   566         }  // no else
   575 
   567 
   576     return ret;
   568     return ret;
   577     }
   569     }
   578 
   570 
   579 // -----------------------------------------------------------------------------
   571 // -----------------------------------------------------------------------------
   604 
   596 
   605         // Check for No of records in Type 1 file
   597         // Check for No of records in Type 1 file
   606         if( UICC_EF_ADN_TAG != tagValue )
   598         if( UICC_EF_ADN_TAG != tagValue )
   607             {
   599             {
   608             ret = CheckForNoOfRecords( noOfRecords );
   600             ret = CheckForNoOfRecords( noOfRecords );
   609             }
   601             }  // no else
   610         }
   602         }  // no else
   611 
   603 
   612     if( iCurrentArrayCounter < iType1FileArray.Count() )
   604     if( iCurrentArrayCounter < iType1FileArray.Count() )
   613         {
   605         {
   614         if( UICC_STATUS_OK  == aStatus )
   606         if( UICC_STATUS_OK  == aStatus )
   615             {
   607             {
   644                     }
   636                     }
   645                 case UICC_EF_ANR_TAG:
   637                 case UICC_EF_ANR_TAG:
   646                     {
   638                     {
   647                     // Check for if No of records for this File is same as ADN
   639                     // Check for if No of records for this File is same as ADN
   648                     // phonebook no of records
   640                     // phonebook no of records
   649                     if(KErrNone == ret)
   641                     if( KErrNone == ret )
   650                         {
   642                         {
   651                         // Check for fixed size record length
   643                         // Check for fixed size record length
   652                         ret = CheckRecordSizeForFixedLength(
   644                         ret = CheckRecordSizeForFixedLength(
   653                             1,
   645                             1,
   654                             UICC_EF_ANR_TAG,
   646                             UICC_EF_ANR_TAG,
   668                             iType1ANRFiles++;
   660                             iType1ANRFiles++;
   669 
   661 
   670                             iMmPhoneBookStoreMessHandler->
   662                             iMmPhoneBookStoreMessHandler->
   671                                 iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords
   663                                 iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords
   672                                 = iPBStoreInfoData->iANRNumOfEntries;
   664                                 = iPBStoreInfoData->iANRNumOfEntries;
   673                             }
   665                             } // no else
   674                         }
   666                         }  // no else
   675                     break;
   667                     break;
   676                     }
   668                     }
   677                 case UICC_EF_EMAIL_TAG:
   669                 case UICC_EF_EMAIL_TAG:
   678                     {
   670                     {
   679                     if( KErrNone == ret )
   671                     if( KErrNone == ret )
   696                             iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
   688                             iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
   697                                 iPBStoreInfoData->iEmailNumOfEntries;
   689                                 iPBStoreInfoData->iEmailNumOfEntries;
   698                         iMmPhoneBookStoreMessHandler->
   690                         iMmPhoneBookStoreMessHandler->
   699                             iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength =
   691                             iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength =
   700                                 iPBStoreInfoData->iEmailTextLengthMax;
   692                                 iPBStoreInfoData->iEmailTextLengthMax;
   701                         }
   693                         }  // no else
   702                     break;
   694                     break;
   703                     }
   695                     }
   704 
   696 
   705                 case UICC_EF_GRP_TAG:
   697                 case UICC_EF_GRP_TAG:
   706                     {
   698                     {
   707                     if( KErrNone == ret )
   699                     if( KErrNone == ret )
   708                         {
   700                         {
   709                         // get the record record no from file info data
   701                         // get the record record no from file info data
   710                         iPBStoreInfoData->iGRPNumOfEntriesPerEntry =
   702                         iPBStoreInfoData->iGRPNumOfEntriesPerEntry =
   711                             noOfRecords;
   703                             noOfRecords;
   712                         }
   704                         }  // no else
   713                     break;
   705                     break;
   714                     }
   706                     }
   715                 case UICC_EF_IAP_TAG:
   707                 case UICC_EF_IAP_TAG:
   716                     {
   708                     {
   717                     // This File is mandatory only when there are Type 2 Files
   709                     // This File is mandatory only when there are Type 2 Files
   718                     if( iType2FileArray.Count()== 0 )
   710                     if( iType2FileArray.Count()== 0 )
   719                         {
   711                         {
   720                         ret = KErrGeneral;
   712                         ret = KErrGeneral;
   721                         }
   713                         }  // no else
   722                     if( KErrNone == ret )
   714                     if( KErrNone == ret )
   723                         {
   715                         {
   724                         // Store IAP record record length in internal buffer
   716                         // Store IAP record record length in internal buffer
   725                         iMmPhoneBookStoreMessHandler->
   717                         iMmPhoneBookStoreMessHandler->
   726                             iPBStoreConf[EPhonebookTypeAdn].iIAPRecordLength =
   718                             iPBStoreConf[EPhonebookTypeAdn].iIAPRecordLength =
   727                                 recordLength;
   719                                 recordLength;
   728                         }
   720                         } // no else
   729                     break;
   721                     break;
   730                     }
   722                     }
   731                 case UICC_EF_PBC_TAG:
   723                 case UICC_EF_PBC_TAG:
   732                     {
   724                     {
   733                     if( KErrNone == ret )
   725                     if( KErrNone == ret )
   738                             recordLength) )
   730                             recordLength) )
   739                             {
   731                             {
   740                             // remove this entry from Array
   732                             // remove this entry from Array
   741                             iType1FileArray[iCurrentArrayCounter].tagFID = 0x00;
   733                             iType1FileArray[iCurrentArrayCounter].tagFID = 0x00;
   742                             iType1FileArray[iCurrentArrayCounter].tagSFI = 0x00;
   734                             iType1FileArray[iCurrentArrayCounter].tagSFI = 0x00;
   743                             iType1FileArray[iCurrentArrayCounter].tagValue =
   735                             iType1FileArray[iCurrentArrayCounter].tagValue = 0x00;
   744                                 0x00;
   736                             }  // no else
   745                             }
   737                         }  // no else
   746                         }
       
   747                     break;
   738                     break;
   748                     }
   739                     }
   749                 case UICC_EF_SNE_TAG:
   740                 case UICC_EF_SNE_TAG:
   750                     {
   741                     {
   751                     if( KErrNone == ret )
   742                     if( KErrNone == ret )
   762                             iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
   753                             iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
   763                                 iPBStoreInfoData->iSNENumOfEntries;
   754                                 iPBStoreInfoData->iSNENumOfEntries;
   764                         iMmPhoneBookStoreMessHandler->
   755                         iMmPhoneBookStoreMessHandler->
   765                             iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
   756                             iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
   766                                 iPBStoreInfoData->iSNETextLengthMax;
   757                                 iPBStoreInfoData->iSNETextLengthMax;
   767                         }
   758                         }  // no else
   768                     break;
   759                     break;
   769                     }
   760                     }
   770                 case UICC_EF_UID_TAG:
   761                 case UICC_EF_UID_TAG:
   771                     {
   762                     {
   772                     break;
   763                     break;
   779 
   770 
   780             // Check if error is there then remove that file ID and tag from
   771             // Check if error is there then remove that file ID and tag from
   781             // iType1FileArray
   772             // iType1FileArray
   782             if( KErrNone != ret )
   773             if( KErrNone != ret )
   783                 {
   774                 {
   784                 iType1FileArray.Remove(iCurrentArrayCounter);
   775                 iType1FileArray.Remove( iCurrentArrayCounter );
   785                 }
   776                 }
   786             else
   777             else
   787                 {
   778                 {
   788                 iCurrentArrayCounter++;
   779                 iCurrentArrayCounter++;
   789                 }
   780                 }
   796                 iADNPbInitilized = EFalse;
   787                 iADNPbInitilized = EFalse;
   797                 // ADN phonebook is not valid and check for other phonebooks
   788                 // ADN phonebook is not valid and check for other phonebooks
   798                 // parameters
   789                 // parameters
   799                 iIniPhase = EPBIniPhase_3GADNDone;
   790                 iIniPhase = EPBIniPhase_3GADNDone;
   800                 return;
   791                 return;
   801                 }
   792                 }  // no else
   802             iCurrentArrayCounter++;
   793             iCurrentArrayCounter++;
   803             }
   794             }
   804 
   795 
   805         // Check for next Phase
   796         // Check for next Phase
   806         if( iCurrentArrayCounter == iType1FileArray.Count() )
   797         if( iCurrentArrayCounter == iType1FileArray.Count() )
   807             {
   798             {
   808             iCurrentArrayCounter = 0;
   799             iCurrentArrayCounter = 0;
   809 
   800 
   810             // Change Phase to read other Files
   801             // Change Phase to read other Files
   811             if( 0 != iType2FileArray.Count() )
   802             if( 0 != iType2FileArray.Count() )
       
   803                 {
   812                 iIniPhase = EPBInitPhase_3GADN_Type2;
   804                 iIniPhase = EPBInitPhase_3GADN_Type2;
       
   805                 }
   813 
   806 
   814             else if( 0 != iType3FileArray.Count() )
   807             else if( 0 != iType3FileArray.Count() )
   815                 {
   808                 {
   816                 iIniPhase = EPBInitPhase_3GADN_Type3;
   809                 iIniPhase = EPBInitPhase_3GADN_Type3;
   817                 }
   810                 }
   818             else
   811             else
   819                 {
   812                 {
   820                 iIniPhase = EPBIniPhase_3GADNDone;
   813                 iIniPhase = EPBIniPhase_3GADNDone;
   821                 }
   814                 }
   822             }
   815             }  // no else
   823         } // End of Type 1 file array handling
   816         } // End of Type 1 file array handling
   824     }
   817     }
   825 
   818 
   826 
   819 
   827 // -----------------------------------------------------------------------------
   820 // -----------------------------------------------------------------------------
   829 // HAndles Data for Type 2 file Response
   822 // HAndles Data for Type 2 file Response
   830 // -----------------------------------------------------------------------------
   823 // -----------------------------------------------------------------------------
   831 //
   824 //
   832 void CMmPhoneBookOperationInit3G_adn::HandleType2FileResp(
   825 void CMmPhoneBookOperationInit3G_adn::HandleType2FileResp(
   833     const TDesC8 &aFileData,
   826     const TDesC8 &aFileData,
   834     TInt aStatus)
   827     TInt aStatus )
   835     {
   828     {
   836 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType2FileResp");
   829 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType2FileResp");
   837 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE2FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType2FileResp" );
   830 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE2FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType2FileResp" );
   838 
   831 
   839     TInt ret(KErrNone);
   832     TInt ret(KErrNone);
   840     TInt recordLength( 0 );
   833     TInt recordLength( 0 );
   841     TInt noOfRecords(0);
   834     TInt noOfRecords( 0 );
   842 
   835 
   843     if( UICC_STATUS_OK  == aStatus )
   836     if( UICC_STATUS_OK  == aStatus )
   844         {
   837         {
   845         // Get the Record length for all linear fixed and circular EF's
   838         // Get the Record length for all linear fixed and circular EF's
   846         TFci fci( aFileData );
   839         TFci fci( aFileData );
   847         recordLength = fci.GetRecordLength();
   840         recordLength = fci.GetRecordLength();
   848         noOfRecords = fci.GetNumberOfRecords();
   841         noOfRecords = fci.GetNumberOfRecords();
   849         }
   842         }  // no else
   850 
   843 
   851     // Get the tag value for current File
   844     // Get the tag value for current File
   852     TUint tagValue = iType2FileArray[iCurrentArrayCounter].tagValue;
   845     TUint tagValue = iType2FileArray[iCurrentArrayCounter].tagValue;
   853 
   846 
   854     if( iCurrentArrayCounter < iType2FileArray.Count() )
   847     if( iCurrentArrayCounter < iType2FileArray.Count() )
   855         {
   848         {
   856         if( UICC_STATUS_OK  == aStatus )
   849         if( UICC_STATUS_OK  == aStatus )
   857             {
   850             {
   858             switch(tagValue)
   851             switch( tagValue )
   859                 {
   852                 {
   860                 case UICC_EF_ANR_TAG:
   853                 case UICC_EF_ANR_TAG:
   861                     {
   854                     {
   862                     ret = CheckRecordSizeForFixedLength(
   855                     ret = CheckRecordSizeForFixedLength(
   863                         UICC_TYPE2_FILE,
   856                         UICC_TYPE2_FILE,
   864                         UICC_EF_ANR_TAG,recordLength );
   857                         UICC_EF_ANR_TAG,recordLength );
   865 
   858 
   866                     if(KErrNone == ret)
   859                     if( KErrNone == ret )
   867                         {
   860                         {
   868                         // total no of entries in all ANR files
   861                         // total no of entries in all ANR files
   869                         iPBStoreInfoData->iANRNumOfEntries =
   862                         iPBStoreInfoData->iANRNumOfEntries =
   870                             noOfRecords* iNumOfPBRRecords;
   863                             noOfRecords* iNumOfPBRRecords;
   871                         // For this need to know about the ext files
   864                         // For this need to know about the ext files
   878                         iType2ANRFiles++;
   871                         iType2ANRFiles++;
   879 
   872 
   880                         iMmPhoneBookStoreMessHandler->
   873                         iMmPhoneBookStoreMessHandler->
   881                             iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords =
   874                             iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords =
   882                                 iPBStoreInfoData->iANRNumOfEntries;
   875                                 iPBStoreInfoData->iANRNumOfEntries;
   883                         }
   876                         }  // KErrNone
   884                     break;
   877                     break;
   885                     }
   878                     }
   886                 case UICC_EF_EMAIL_TAG:
   879                 case UICC_EF_EMAIL_TAG:
   887                     {
   880                     {
   888                     // get the total no of entries in all EF in PBR Files
   881                     // get the total no of entries in all EF in PBR Files
   899                     iType2EmailFiles++;
   892                     iType2EmailFiles++;
   900 
   893 
   901                     iMmPhoneBookStoreMessHandler->
   894                     iMmPhoneBookStoreMessHandler->
   902                         iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
   895                         iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
   903                             iPBStoreInfoData->iEmailNumOfEntries;
   896                             iPBStoreInfoData->iEmailNumOfEntries;
       
   897                     
       
   898                     iMmPhoneBookStoreMessHandler->
       
   899                         iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength = 
       
   900                             recordLength - 2;
   904                     break;
   901                     break;
   905                     }
   902                     }
   906                 case UICC_EF_SNE_TAG:
   903                 case UICC_EF_SNE_TAG:
   907                     {
   904                     {
   908                     iPBStoreInfoData->iSNENumOfEntries =
   905                     iPBStoreInfoData->iSNENumOfEntries =
   917                     iType2SNEFiles++;
   914                     iType2SNEFiles++;
   918 
   915 
   919                     iMmPhoneBookStoreMessHandler->
   916                     iMmPhoneBookStoreMessHandler->
   920                         iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
   917                         iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
   921                             iPBStoreInfoData->iSNENumOfEntries;
   918                             iPBStoreInfoData->iSNENumOfEntries;
       
   919                     
       
   920                     iMmPhoneBookStoreMessHandler->
       
   921                         iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
       
   922                             iPBStoreInfoData->iSNETextLengthMax;
       
   923                                         
   922                     break;
   924                     break;
   923                     }
   925                     }
   924                 default:
   926                 default:
   925                     {
   927                     {
   926                     break;
   928                     break;
   943         // Check for next Phase
   945         // Check for next Phase
   944         if( iCurrentArrayCounter == iType2FileArray.Count() )
   946         if( iCurrentArrayCounter == iType2FileArray.Count() )
   945             {
   947             {
   946             iCurrentArrayCounter = 0;
   948             iCurrentArrayCounter = 0;
   947             if( 0 != iType3FileArray.Count() )
   949             if( 0 != iType3FileArray.Count() )
       
   950                 {
   948                 iIniPhase = EPBInitPhase_3GADN_Type3;
   951                 iIniPhase = EPBInitPhase_3GADN_Type3;
       
   952                 }
   949             else
   953             else
       
   954                 {
   950                 iIniPhase = EPBIniPhase_3GADNDone;
   955                 iIniPhase = EPBIniPhase_3GADNDone;
   951             }
   956                 }
   952         }
   957             }  // no else
       
   958         }  // no else
   953     }
   959     }
   954 
   960 
   955 
   961 
   956 // -----------------------------------------------------------------------------
   962 // -----------------------------------------------------------------------------
   957 // CmmPhonebookOperationInit::HandleType3FileResp
   963 // CmmPhonebookOperationInit::HandleType3FileResp
   972     if( UICC_STATUS_OK  == aStatus )
   978     if( UICC_STATUS_OK  == aStatus )
   973         {
   979         {
   974         TFci fci( aFileData );
   980         TFci fci( aFileData );
   975         recordLength = fci.GetRecordLength();
   981         recordLength = fci.GetRecordLength();
   976         noOfRecords = fci.GetNumberOfRecords();
   982         noOfRecords = fci.GetNumberOfRecords();
   977         }
   983         }  // no else
   978 
   984 
   979     // Get the tag value for current File
   985     // Get the tag value for current File
   980     TUint tagValue ( iType3FileArray[iCurrentArrayCounter].tagValue );
   986     TUint tagValue ( iType3FileArray[iCurrentArrayCounter].tagValue );
   981 
   987 
   982     if( iCurrentArrayCounter < iType3FileArray.Count() )
   988     if( iCurrentArrayCounter < iType3FileArray.Count() )
   991                     }
   997                     }
   992                 case UICC_EF_EXT1_TAG:
   998                 case UICC_EF_EXT1_TAG:
   993                     {
   999                     {
   994                     // Check for Fixed record length
  1000                     // Check for Fixed record length
   995                     ret = CheckRecordSizeForFixedLength(
  1001                     ret = CheckRecordSizeForFixedLength(
   996                         3,
  1002                             UICC_TYPE3_FILE,
   997                         UICC_EF_EXT1_TAG,recordLength );
  1003                             UICC_EF_EXT1_TAG,recordLength );
   998 
  1004 
   999                     // check for Error if Length doesn'nt match
  1005                     // check for Error if Length doesn'nt match
  1000                     if( KErrNone == ret )
  1006                     if( KErrNone == ret )
  1001                         {
  1007                         {
  1002                         // Get the file file length for extension data only
  1008                         // Get the file file length for extension data only
  1003                         // (remove record type and Identifier 2 bytes)
  1009                         // (remove record type and Identifier 2 bytes)
  1004                         TInt fileLength ( ( recordLength - 2 ) * noOfRecords );
  1010                         TInt fileLength ( ( recordLength - 2 ) * noOfRecords );
  1005                             iPBStoreInfoData->iADNNumberLengthMax =
  1011                             iPBStoreInfoData->iADNNumberLengthMax =
  1006                                 UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
  1012                                 UICC_NO_EXT_MAX_NUM_LEN+( 2*fileLength );
  1007 
  1013 
  1008                         // Check file is not invalid
  1014                         // Check file is not invalid
  1009                         if( UICC_NO_EXT_MAX_NUM_LEN ==
  1015                         if( UICC_NO_EXT_MAX_NUM_LEN ==
  1010                             iPBStoreInfoData->iANRNumLengthMax )
  1016                             iPBStoreInfoData->iANRNumLengthMax )
  1011                             {
  1017                             {
  1012                             iPBStoreInfoData->iANRNumLengthMax =
  1018                             iPBStoreInfoData->iANRNumLengthMax =
  1013                                 UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
  1019                                 UICC_NO_EXT_MAX_NUM_LEN+( 2*fileLength );
  1014                             }
  1020                             }  // no else
  1015 
  1021 
  1016                         iMmPhoneBookStoreMessHandler->
  1022                         iMmPhoneBookStoreMessHandler->
  1017                             iPBStoreConf[EPhonebookTypeAdn].iNumlength =
  1023                             iPBStoreConf[EPhonebookTypeAdn].iNumlength =
  1018                                   iPBStoreInfoData->iADNNumberLengthMax;
  1024                                   iPBStoreInfoData->iADNNumberLengthMax;
  1019                         iMmPhoneBookStoreMessHandler->
  1025                         iMmPhoneBookStoreMessHandler->
  1020                             iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec =
  1026                             iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec =
  1021                                 ( noOfRecords * iNumOfPBRRecords );
  1027                                 ( noOfRecords * iNumOfPBRRecords );
  1022                         }
  1028                         }  // no else
  1023                     break;
  1029                     break;
  1024                     }
  1030                     }
  1025                 case UICC_EF_GAS_TAG:
  1031                 case UICC_EF_GAS_TAG:
  1026                     {
  1032                     {
  1027                     break;
  1033                     break;
  1033                 default:
  1039                 default:
  1034                     {
  1040                     {
  1035                     break;
  1041                     break;
  1036                     }
  1042                     }
  1037                 }
  1043                 }
  1038             }
  1044             }  // no else
  1039 
  1045 
  1040         if( KErrNone != ret )
  1046         if( KErrNone != ret )
  1041             {
  1047             {
  1042             // remove from teh Array
  1048             // remove from teh Array
  1043             iType3FileArray.Remove(iCurrentArrayCounter);
  1049             iType3FileArray.Remove( iCurrentArrayCounter );
  1044             }
  1050             }
  1045         else
  1051         else
  1046             {
  1052             {
  1047             iCurrentArrayCounter++;
  1053             iCurrentArrayCounter++;
  1048             }
  1054             }
  1050         // Check for next Phase
  1056         // Check for next Phase
  1051         if( iCurrentArrayCounter == iType3FileArray.Count() )
  1057         if( iCurrentArrayCounter == iType3FileArray.Count() )
  1052             {
  1058             {
  1053             iCurrentArrayCounter = 0;
  1059             iCurrentArrayCounter = 0;
  1054             iIniPhase = EPBIniPhase_3GADNDone;
  1060             iIniPhase = EPBIniPhase_3GADNDone;
  1055             }
  1061             }  // no else
  1056         }
  1062         }  // no else
  1057     }
  1063     }
  1058 
  1064 
  1059 
  1065 
  1060 
  1066 
  1061 // -----------------------------------------------------------------------------
  1067 // -----------------------------------------------------------------------------
  1074 
  1080 
  1075     // Check for Type1 File Id's with all Type1, Type2 and Type3 file Id's
  1081     // Check for Type1 File Id's with all Type1, Type2 and Type3 file Id's
  1076     for( TInt j=0; j < iType1FileArray.Count(); j++ )
  1082     for( TInt j=0; j < iType1FileArray.Count(); j++ )
  1077         {
  1083         {
  1078         // Check for Type 1 files
  1084         // Check for Type 1 files
  1079         for( TInt i = (j+1); i< (iType1FileArray.Count()-j); i++ )
  1085         for( TInt i = ( j+1 ); i< ( iType1FileArray.Count()-j ); i++ )
  1080             {
  1086             {
  1081             if( iType1FileArray[i].tagFID == iType1FileArray[j].tagFID )
  1087             if( iType1FileArray[i].tagFID == iType1FileArray[j].tagFID )
  1082                 {
  1088                 {
  1083                 // Check if it is a ADN EF then it will be a failure case
  1089                 // Check if it is a ADN EF then it will be a failure case
  1084                 if( iType1FileArray[i].tagValue == UICC_ADN_PRIM_TAG )
  1090                 if( iType1FileArray[i].tagValue == UICC_ADN_PRIM_TAG )
  1085                 ret = KErrGeneral;
  1091                     {
       
  1092                     ret = KErrGeneral;
       
  1093                     }
  1086                 else
  1094                 else
  1087                     {
  1095                     {
  1088                     // remove Entry
  1096                     // remove Entry
  1089                     iType1FileArray.Remove(i);
  1097                     iType1FileArray.Remove(i);
  1090                     iType1FileArray.Remove(j);
  1098                     iType1FileArray.Remove(j);
  1091                     }
  1099                     }
  1092                 }
  1100                 }  // no else
  1093             }
  1101             }
  1094         // Check for Type2 file id's
  1102         // Check for Type2 file id's
  1095         for(TInt i=0; i<iType2FileArray.Count(); i++)
  1103         for(TInt i=0; i<iType2FileArray.Count(); i++)
  1096             {
  1104             {
  1097             if( iType2FileArray[i].tagFID == iType1FileArray[j].tagFID )
  1105             if( iType2FileArray[i].tagFID == iType1FileArray[j].tagFID )
  1105                     {
  1113                     {
  1106                     // remove thise Entries
  1114                     // remove thise Entries
  1107                     iType1FileArray.Remove(j);
  1115                     iType1FileArray.Remove(j);
  1108                     iType2FileArray.Remove(i);
  1116                     iType2FileArray.Remove(i);
  1109                     }
  1117                     }
  1110                 }
  1118                 }  // no else
  1111             }
  1119             }
  1112         // Check for Type 3 File Id's
  1120         // Check for Type 3 File Id's
  1113         for( TInt i=0; i<iType3FileArray.Count(); i++ )
  1121         for( TInt i=0; i<iType3FileArray.Count(); i++ )
  1114             {
  1122             {
  1115             if( iType3FileArray[i].tagFID == iType1FileArray[j].tagFID )
  1123             if( iType3FileArray[i].tagFID == iType1FileArray[j].tagFID )
       
  1124                 {
  1116                 // Check for ADN file
  1125                 // Check for ADN file
  1117                 if( iType1FileArray[j].tagValue == UICC_ADN_PRIM_TAG )
  1126                 if( iType1FileArray[j].tagValue == UICC_ADN_PRIM_TAG )
       
  1127                     {
  1118                     ret = KErrGeneral;
  1128                     ret = KErrGeneral;
       
  1129                     }
  1119                 else
  1130                 else
  1120                     {
  1131                     {
  1121                     // remove those entries
  1132                     // remove those entries
  1122                     iType1FileArray.Remove(j);
  1133                     iType1FileArray.Remove( j );
  1123                     iType3FileArray.Remove(i);
  1134                     iType3FileArray.Remove( i );
  1124                     }
  1135                     }
  1125                 }
  1136                 }  // no else
  1126             }
  1137             }
  1127 
  1138         }
  1128         // Check for Type2 File Id's with all Type2 and Type3 file Id's
  1139 
  1129         for( TInt j=0; j< iType2FileArray.Count(); j++ )
  1140     // Check for Type2 File Id's with all Type2 and Type3 file Id's
  1130             {
  1141     for( TInt j=0; j< iType2FileArray.Count(); j++ )
  1131             // Check for Type 2 files
  1142         {
  1132             for( TInt i = (j+1); i< ( iType2FileArray.Count()-j ); i++ )
  1143         // Check for Type 2 files
  1133                 {
  1144         for( TInt i = (j+1); i< ( iType2FileArray.Count()-j ); i++ )
  1134                 if( iType2FileArray[i].tagFID == iType2FileArray[j].tagFID)
  1145             {
  1135                     {
  1146             if( iType2FileArray[i].tagFID == iType2FileArray[j].tagFID )
  1136                     iType2FileArray.Remove(j);
  1147                 {
  1137                     iType2FileArray.Remove(i);
  1148                 iType2FileArray.Remove( j );
  1138                     }
  1149                 iType2FileArray.Remove( i );
  1139                 }
  1150                 }  // no else
  1140             // Check for Type 3 File Id's
  1151             }
  1141             for( TInt i=0; i<iType3FileArray.Count(); i++ )
  1152         // Check for Type 3 File Id's
  1142                 {
  1153         for( TInt i=0; i<iType3FileArray.Count(); i++ )
  1143                 if( iType3FileArray[i].tagFID == iType2FileArray[j].tagFID )
  1154             {
  1144                     {
  1155             if( iType3FileArray[i].tagFID == iType2FileArray[j].tagFID )
  1145                     iType2FileArray.Remove(j);
  1156                 {
  1146                     iType3FileArray.Remove(i);
  1157                 iType2FileArray.Remove( j  );
  1147                     }
  1158                 iType3FileArray.Remove( i );
  1148                 }
  1159                 }  // no else
  1149             }
  1160             }
  1150 
  1161         }
  1151         //Check for Type3 File Id's with all other Type3 file Id's
  1162 
  1152         for( TInt j=0; j< iType3FileArray.Count(); j++ )
  1163     //Check for Type3 File Id's with all other Type3 file Id's
  1153             {
  1164     for( TInt j=0; j< iType3FileArray.Count(); j++ )
  1154             // Check for Type 2 files
  1165         {
  1155             for( TInt i = (j+1); i< (iType3FileArray.Count()-j); i++ )
  1166         // Check for Type 2 files
  1156                 {
  1167         for( TInt i = ( j+1 ); i< ( iType3FileArray.Count()-j ); i++ )
  1157                 if( iType3FileArray[i].tagFID == iType3FileArray[j].tagFID )
  1168             {
  1158                     {
  1169             if( iType3FileArray[i].tagFID == iType3FileArray[j].tagFID )
  1159                     iType3FileArray.Remove(j);
  1170                 {
  1160                     iType3FileArray.Remove(i);
  1171                 iType3FileArray.Remove( j );
  1161                     }
  1172                 iType3FileArray.Remove( i );
  1162                 }
  1173                 }  // no else
  1163             }
  1174             }
       
  1175         }
  1164 
  1176 
  1165     return ret;
  1177     return ret;
  1166     }
  1178     }
  1167 
  1179 
  1168 // -----------------------------------------------------------------------------
  1180 // -----------------------------------------------------------------------------
  1176 TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
  1188 TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
  1177 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORNOOFRECORDS, "CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
  1189 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORNOOFRECORDS, "CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
  1178 
  1190 
  1179     TInt ret( KErrNone );
  1191     TInt ret( KErrNone );
  1180 
  1192 
  1181     if( iPBStoreInfoData->iADNNumOfEntries != aNoOfRecord )
  1193     // get the no of records in one ADN Ef
       
  1194     TInt maxNoOfRecInOneAdnEf =  ( ( iMmPhoneBookStoreMessHandler->
       
  1195                                       iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords ) /  
       
  1196                                  ( iMmPhoneBookStoreMessHandler->
       
  1197                                       iPBStoreConf[EPhonebookTypeAdn].iPBRNoOfRecords ) ); 
       
  1198     if( maxNoOfRecInOneAdnEf != aNoOfRecord )
  1182         {
  1199         {
  1183         ret = KErrGeneral;
  1200         ret = KErrGeneral;
  1184         }
  1201         }  // no else
  1185     return ret;
  1202     return ret;
  1186     }
  1203     }
  1187 
  1204 
  1188 
  1205 
  1189 // -----------------------------------------------------------------------------
  1206 // -----------------------------------------------------------------------------
  1211                     {
  1228                     {
  1212                     ret = KErrGeneral;
  1229                     ret = KErrGeneral;
  1213                     }
  1230                     }
  1214                 else
  1231                 else
  1215                     {
  1232                     {
  1216                     iType1FileArray.Remove(i);
  1233                     iType1FileArray.Remove( i );
  1217                     iType2FileArray.Remove(j);
  1234                     iType2FileArray.Remove( j );
  1218                     }
  1235                     }
  1219                 }
  1236                 }  // no else
  1220             }
  1237             }
  1221         }
  1238         }
  1222     return ret;
  1239     return ret;
  1223     }
  1240     }
  1224 
  1241 
  1251                 else
  1268                 else
  1252                     {
  1269                     {
  1253                     if( ( 2== aFileType )&& ( 17!=aRecordLength ) )
  1270                     if( ( 2== aFileType )&& ( 17!=aRecordLength ) )
  1254                         {
  1271                         {
  1255                         ret =KErrNone;
  1272                         ret =KErrNone;
  1256                         }
  1273                         }  // no else
  1257                     }
  1274                     }
  1258             break;
  1275             break;
  1259             }
  1276             }
  1260         case UICC_EF_PBC_TAG:
  1277         case UICC_EF_PBC_TAG:
  1261             {
  1278             {
  1262             if( 2!=aRecordLength )
  1279             if( 2!=aRecordLength )
  1263                 {
  1280                 {
  1264                 ret = KErrGeneral;
  1281                 ret = KErrGeneral;
  1265                 }
  1282                 }  // no else
  1266             break;
  1283             break;
  1267             }
  1284             }
  1268         case UICC_EF_UID_TAG:
  1285         case UICC_EF_UID_TAG:
  1269             {
  1286             {
  1270             if( 2!= aRecordLength )
  1287             if( 2!= aRecordLength )
  1271                 {
  1288                 {
  1272                 ret = KErrGeneral;
  1289                 ret = KErrGeneral;
  1273                 }
  1290                 }  // no else
  1274             break;
  1291             break;
  1275             }
  1292             }
  1276         case UICC_EF_EXT1_TAG:
  1293         case UICC_EF_EXT1_TAG:
  1277             {
  1294             {
  1278             if( 13 != aRecordLength )
  1295             if( 13 != aRecordLength )
  1279                 {
  1296                 {
  1280                 ret = KErrGeneral;
  1297                 ret = KErrGeneral;
  1281                 }
  1298                 }  // no else
  1282             break;
  1299             break;
  1283             }
  1300             }
  1284         }
  1301         }
  1285     return ret;
  1302     return ret;
  1286     }
  1303     }