adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2009 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 the License "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:
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <etelmm.h>
       
    20 #include <tisi.h>
       
    21 #include <pn_const.h>
       
    22 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    23 #include "tsylogger.h"
       
    24 #include "cmmmessagerouter.h"
       
    25 #include "cmmphonebookoperationread.h"
       
    26 #include "cmmphonebookoperationread3g_adn.h"
       
    27 #include "osttracedefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "cmmphonebookoperationreadtraces.h"
       
    30 #endif
       
    31 
       
    32 // EXTERNAL DATA STRUCTURES
       
    33     // None
       
    34 
       
    35 // EXTERNAL FUNCTION PROTOTYPES
       
    36     // None
       
    37 
       
    38 // CONSTANTS
       
    39 //const TUint16 KSimPbLocationMBDN = 0x0100;
       
    40 
       
    41 // MACROS
       
    42     // None
       
    43 
       
    44 // LOCAL CONSTANTS AND MACROS
       
    45     // None
       
    46 
       
    47 // MODULE DATA STRUCTURES
       
    48     // None
       
    49 
       
    50 // LOCAL FUNCTION PROTOTYPES
       
    51     // None
       
    52 
       
    53 // ==================== LOCAL FUNCTIONS =====================================
       
    54     // None
       
    55 
       
    56 
       
    57 // ================= MEMBER FUNCTIONS =======================================
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CMmPhonebookOperationRead::CMmPhonebookOperationRead
       
    61 // C++ default constructor can NOT contain any code, that
       
    62 // might leave.
       
    63 // -----------------------------------------------------------------------------
       
    64 
       
    65 CMmPhoneBookOperationRead::CMmPhoneBookOperationRead()
       
    66     {
       
    67     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::CMmPhoneBookOperationRead");
       
    68 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_CMMPHONEBOOKOPERATIONREAD, "CMmPhoneBookOperationRead::CMmPhoneBookOperationRead" );
       
    69 
       
    70     iNumOfEntriesToRead = 0;
       
    71     iNumOfEntriesFilled = 0;
       
    72     iIndexToRead = 0;
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead
       
    77 // C++ destructor.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead
       
    81     (
       
    82     // None
       
    83     )
       
    84     {
       
    85     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead");
       
    86 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_CMMPHONEBOOKOPERATIONREAD, "CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead" );
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CMmPhoneBookOperationRead::NewL
       
    91 // Creates a new CMmPhonebookOperationRead object instance.
       
    92 // Two-phased constructor.
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 CMmPhoneBookOperationRead* CMmPhoneBookOperationRead::NewL
       
    96     (
       
    97     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
       
    98     const CMmDataPackage* aDataPackage // Data
       
    99     )
       
   100     {
       
   101     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::NewL");
       
   102 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_NEWL, "CMmPhoneBookOperationRead::NewL" );
       
   103 
       
   104     TName phonebookTypeName;
       
   105 
       
   106     CMmPhoneBookOperationRead* mmPhoneBookOperationRead =
       
   107         new( ELeave ) CMmPhoneBookOperationRead();
       
   108 
       
   109     const CPhoneBookDataPackage* phoneBookData =
       
   110         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
       
   111 
       
   112     phoneBookData->GetPhoneBookName( phonebookTypeName );
       
   113 
       
   114     mmPhoneBookOperationRead->iTransactionId = ETrIdPbRead;
       
   115 
       
   116     mmPhoneBookOperationRead->iMmPhoneBookStoreMessHandler =
       
   117         aMmPhoneBookStoreMessHandler;
       
   118 
       
   119     return mmPhoneBookOperationRead;
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CMmPhoneBookOperationRead::ConstructL
       
   124 // Initialises object attributes.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 void CMmPhoneBookOperationRead::ConstructL
       
   128     (
       
   129     // None
       
   130     )
       
   131     {
       
   132     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::ConstructL");
       
   133 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_CONSTRUCTL, "CMmPhoneBookOperationRead::ConstructL" );
       
   134     }
       
   135 
       
   136 
       
   137 
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CMmPhoneBookOperationRead::UICCCreateReq
       
   141 // Separate request for USIM
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 TInt CMmPhoneBookOperationRead::UICCCreateReq
       
   145     (
       
   146     TInt aIpc,
       
   147     const CMmDataPackage* aDataPackage
       
   148     )
       
   149     {
       
   150     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::UICCCreateReq");
       
   151 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_UICCCREATEREQ, "CMmPhoneBookOperationRead::UICCCreateReq" );
       
   152 
       
   153     TInt ret( KErrNotSupported );
       
   154 
       
   155     const CPhoneBookDataPackage* phoneBookData =
       
   156         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
       
   157 
       
   158     switch( aIpc )
       
   159         {
       
   160         case EMmTsyPhoneBookStoreReadIPC:
       
   161             {
       
   162             CArrayPtrSeg<CPhoneBookStoreEntry>* prtToReadEntriesArray;
       
   163             RMobilePhoneBookStore::TPBIndexAndNumEntries* ptrToIndexAndEntries;
       
   164             phoneBookData->UnPackData(
       
   165                 ptrToIndexAndEntries,
       
   166                 prtToReadEntriesArray );
       
   167 
       
   168             if ( prtToReadEntriesArray && ptrToIndexAndEntries )
       
   169                 {
       
   170                 iPhoneBookStoreCacheArray = prtToReadEntriesArray;
       
   171                 iNumOfEntriesToRead = ptrToIndexAndEntries->iNumSlots;
       
   172                 iNumOfEntriesFilled = 0;
       
   173                 iIndexToRead = ptrToIndexAndEntries->iIndex;
       
   174 
       
   175                 // get the Service type to be read
       
   176                 iServiceType = UICC_APPL_FILE_INFO;
       
   177 
       
   178 
       
   179                 // Handle ADN Phonebook
       
   180 
       
   181 
       
   182                     switch(iMmUiccMessHandler->GetCardType())
       
   183                         {
       
   184                         case UICC_CARD_TYPE_ICC:
       
   185                             {
       
   186                             ret = USimPbReqRead( 0 );
       
   187                             }
       
   188                             break;
       
   189                         case UICC_CARD_TYPE_UICC:
       
   190                             {
       
   191                             }
       
   192                             break;
       
   193                         case UICC_CARD_TYPE_UNKNOWN:
       
   194                             break;
       
   195                         default:
       
   196                             break;
       
   197                         }
       
   198                 }
       
   199 
       
   200             break;
       
   201             }
       
   202         default:
       
   203             {
       
   204             // Nothing to do here
       
   205             TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::UICCCreateReq - \
       
   206             Unknown IPC: %d", aIpc);
       
   207 OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_UICCCREATEREQ, "CMmPhoneBookOperationRead::UICCCreateReq;aIpc=%d", aIpc );
       
   208             break;
       
   209             }
       
   210         } // switch-case
       
   211     return ret;
       
   212     }
       
   213 
       
   214 
       
   215 
       
   216 // -----------------------------------------------------------------------------
       
   217 // CMmPhoneBookOperationRead::SimPbReqRead
       
   218 // Constructs Data to read entry from SIM
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 TInt CMmPhoneBookOperationRead::USimPbReqRead
       
   222     (
       
   223     TInt aRecordNo
       
   224     )
       
   225     {
       
   226 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead");
       
   227 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead" );
       
   228 
       
   229     TInt ret( KErrNone );
       
   230     // Get phonebook type from transactionId and convert it to USim pbtype
       
   231     TUint16 simPhonebookType( ConvertToSimPhoneBookType(
       
   232         iTransactionId & KMaskPhonebookType ) ); // Service type
       
   233 
       
   234     // get the index to be read from phonebook
       
   235     TInt index( iIndexToRead );
       
   236 
       
   237     TUiccReadLinearFixed cmdParams;
       
   238     //cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> iMmPhoneBookStoreMessHandler;
       
   239 
       
   240     cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE >> 8 ));
       
   241     cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE ));
       
   242     //cmdParams.filePath.Copy(aApplFieldId);
       
   243     cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
       
   244     cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK ));
       
   245 
       
   246     // get the corect Location to be read from phone book
       
   247     if( PB_MBDN_FID == simPhonebookType)
       
   248         {
       
   249         // Index to be read contains two types of information.
       
   250         // The least significant byte contains the profile number
       
   251         // and the most significant byte contains the type.
       
   252         index = index || 0x0100; // Only subscriber profile number 1 is supported
       
   253         }
       
   254 
       
   255     // Read phonebook elementary file to get the Entry information
       
   256     if( !iExtensionRead )
       
   257         {
       
   258         cmdParams.trId = ETrIdPbRead;
       
   259         cmdParams.fileId = simPhonebookType;
       
   260 
       
   261         if( iServiceType == UICC_APPL_READ_LINEAR_FIXED )
       
   262             {
       
   263             cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   264             // Least significant byte gives the actual record no. to be read
       
   265             cmdParams.record = aRecordNo;
       
   266             }
       
   267         else if(iServiceType == UICC_APPL_FILE_INFO)
       
   268             {
       
   269             cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   270             }
       
   271         }
       
   272     else
       
   273         {
       
   274         switch( simPhonebookType )
       
   275             {
       
   276             case PB_ADN_FID:
       
   277                 {
       
   278                 // For 2G ADN Phonebook EXT1 will be the extension number store
       
   279                 cmdParams.trId = ETrIdPbRead;
       
   280                 cmdParams.fileId = PB_EXT1_FID;
       
   281 
       
   282                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   283                     {
       
   284                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   285                     cmdParams.record = aRecordNo;
       
   286                     }
       
   287                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   288                     {
       
   289                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   290                     }
       
   291                 break;
       
   292                 }
       
   293             case PB_FDN_FID:
       
   294                 {
       
   295                 // For FDN Phonebook EXT2 will be the extension number store
       
   296                 cmdParams.trId = ETrIdPbRead;
       
   297                 cmdParams.fileId = PB_EXT2_FID;
       
   298 
       
   299                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   300                     {
       
   301                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   302                     cmdParams.record = aRecordNo;
       
   303                     }
       
   304                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   305                     {
       
   306                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   307                     }
       
   308                 break;
       
   309                 }
       
   310             case PB_SDN_FID:
       
   311                 {
       
   312                 // For SDN Phonebook EXT3 will be the extension number store
       
   313                 cmdParams.trId = ETrIdPbRead;
       
   314                 cmdParams.fileId = PB_EXT3_FID;
       
   315 
       
   316                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   317                     {
       
   318                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   319                     cmdParams.record = aRecordNo;
       
   320                     }
       
   321                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   322                     {
       
   323                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   324                     }
       
   325                 break;
       
   326                 }
       
   327             case PB_BDN_FID:
       
   328                 {
       
   329                 // For BDN Phonebook EXT4 will be the extension number store
       
   330                 cmdParams.trId = ETrIdPbRead;
       
   331                 cmdParams.fileId = PB_EXT4_FID;
       
   332 
       
   333                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   334                     {
       
   335                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   336                     cmdParams.record = aRecordNo;
       
   337                     }
       
   338                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   339                     {
       
   340                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   341                     }
       
   342                 break;
       
   343                 }
       
   344             case PB_MBDN_FID:
       
   345                 {
       
   346                 // For MBDN Phonebook EXT6 will be the extension number store
       
   347                 cmdParams.trId = ETrIdPbRead;
       
   348                 cmdParams.fileId = PB_EXT6_FID;
       
   349 
       
   350                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   351                     {
       
   352                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   353                     cmdParams.record = aRecordNo;
       
   354                     }
       
   355                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   356                     {
       
   357                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   358                     }
       
   359                 break;
       
   360                 }
       
   361             case PB_MSISDN_FID:
       
   362                 {
       
   363                 // For MSISDN Phonebook EXT5 will be the extension number store
       
   364                 cmdParams.trId = ETrIdPbRead;
       
   365                 cmdParams.fileId = PB_EXT5_FID;
       
   366 
       
   367                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   368                     {
       
   369                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   370                     cmdParams.record = aRecordNo;
       
   371                     }
       
   372                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   373                     {
       
   374                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   375                     }
       
   376                 break;
       
   377                 }
       
   378             case PB_VMBX_FID:
       
   379                 {
       
   380                 // For VMBX Phonebook EXT2 will be the extension number store
       
   381                 cmdParams.trId = ETrIdPbRead;
       
   382                 cmdParams.fileId = PB_EXT2_FID;
       
   383 
       
   384                 if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
       
   385                     {
       
   386                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   387                     cmdParams.record = aRecordNo;
       
   388                     }
       
   389                 else if( UICC_APPL_FILE_INFO == iServiceType )
       
   390                     {
       
   391                     cmdParams.serviceType = UICC_APPL_FILE_INFO;
       
   392                     }
       
   393                 break;
       
   394                 }
       
   395             }
       
   396         }
       
   397 
       
   398     ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
       
   399         CreateUiccApplCmdReq( cmdParams );
       
   400     TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
       
   401     return ret;
       
   402     }
       
   403 
       
   404 
       
   405 
       
   406 
       
   407 
       
   408 
       
   409 // -----------------------------------------------------------------------------
       
   410 // CMmPhoneBookOperationRead::CreateReq
       
   411 // Separate request
       
   412 // -----------------------------------------------------------------------------
       
   413 //
       
   414 TInt CMmPhoneBookOperationRead::HandleUICCPbRespL
       
   415     (
       
   416     TBool & /*aComplete*/,
       
   417     TInt aStatus,
       
   418     const TDesC8 &aFileData,
       
   419     TInt aTransId
       
   420     )
       
   421     {
       
   422     TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL");
       
   423     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL" );
       
   424 
       
   425     TInt ret(KErrNone);
       
   426     // Initialize Application file ID to send in next request
       
   427     TBuf8<2> applFieldId;
       
   428     applFieldId.Append(0x7F);
       
   429     applFieldId.Append(0x10);
       
   430 
       
   431     // Check for Error if returned from UICC Server
       
   432 
       
   433     // Handle possible error case
       
   434     if ( UICC_STATUS_OK != aStatus )
       
   435         {
       
   436         TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespRead-\
       
   437             Unsuccessfully completed by SIMSON");
       
   438 //OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL, Unsuccessfully completed by UICC Server" );
       
   439         ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus );
       
   440         }
       
   441 
       
   442 
       
   443     // Get phonebook type from transactionId and convert it to USim pbtype
       
   444     TUint16 simPhonebookType( ConvertToSimPhoneBookType(
       
   445         iTransactionId & KMaskPhonebookType ) ); // Service type
       
   446 
       
   447     if(UICC_STATUS_OK == aStatus)
       
   448         {
       
   449         switch(aTransId)
       
   450             {
       
   451             case ETrIdPbReadADN:
       
   452                 {
       
   453                 // handle USIM ADN phonebook read
       
   454                 //HandleUICC3gADNRespL(aStatus, aFileData, aTransId);
       
   455                 }
       
   456                 break;
       
   457             case ETrIdPbRead:   // Same Read for all phonebook Type extension EF's
       
   458                 {
       
   459                 if(!iExtensionRead)
       
   460                     {
       
   461                     if(iServiceType == UICC_APPL_FILE_INFO)
       
   462                         {
       
   463                         // Check for the record no. to read is valid or not
       
   464                         TInt offSet ( aFileData.Find(&KTagFCIFileDescriptor,1) );
       
   465                         if(KErrNotFound != offSet )
       
   466                             {
       
   467                             // Number of entries is 1 byte long
       
   468                             iNumOfPhoneBookRecords = aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR];
       
   469                             // Get the record length
       
   470                             // -14 is for data other than alpha string
       
   471                             //Get16bit(iRecordLength, aFileData, (offSet+4) );
       
   472 
       
   473                             if((iNumOfPhoneBookRecords*255) >= (iIndexToRead & 0x00FF))
       
   474                                 {
       
   475                                 // read that entry no
       
   476                                 iServiceType = UICC_APPL_UPDATE_LINEAR_FIXED;
       
   477                                 if(iNumOfEntriesToRead > 0)
       
   478                                   {
       
   479                                     // Mask iIndexToRead lower byte to get the entry no need to be read
       
   480                                     USimPbReqRead( iIndexToRead && 0x00FF );
       
   481                                   }
       
   482                                 else
       
   483                                   {
       
   484                                     ret = KErrNotSupported;
       
   485                                   }
       
   486                                 }
       
   487                             else
       
   488                                 {
       
   489                                 // invalid location to read
       
   490                                 ret = KErrGeneral;
       
   491                                 }
       
   492                             }
       
   493                         }
       
   494                     else if(iServiceType == UICC_APPL_UPDATE_LINEAR_FIXED)
       
   495                         {
       
   496                         // to read next record
       
   497                         iIndexToRead++;
       
   498                         iNumOfEntriesToRead--;
       
   499                         // Seperate Entry data form UICC Server response message
       
   500                         // Case: <Data available to be filled into array>
       
   501                         if ( UICC_STATUS_OK == aStatus )
       
   502                             {
       
   503                            TInt retval ( SeparatePhoneBookEntryFromUiccMsgL(
       
   504                                    aFileData,
       
   505                                    iNameBuf,
       
   506                                    simPhonebookType) );
       
   507 
       
   508                             if ( 0xFF == aFileData[iRecordLength] )  // Check for Is there any extension data
       
   509                                 {
       
   510                                 // the there is no extension data
       
   511                                 CPhoneBookStoreEntry* phoneBookStoreMsg =
       
   512                                     new( ELeave ) CPhoneBookStoreEntry;
       
   513                                 CleanupStack::PushL( phoneBookStoreMsg );
       
   514                                 phoneBookStoreMsg->ConstructL();
       
   515 
       
   516                                 if(KErrNone == retval)
       
   517                                     {
       
   518                                     StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg);
       
   519                                     TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
       
   520                                     iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
       
   521                                     CleanupStack::Pop( phoneBookStoreMsg );
       
   522                                     iNumOfEntriesFilled++;
       
   523                                     TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
       
   524                                     }
       
   525                                 else
       
   526                                 {
       
   527                                     CleanupStack::PopAndDestroy( phoneBookStoreMsg );
       
   528                                 }
       
   529 
       
   530                                 // Check for Extension number present or not
       
   531                                 }
       
   532                             else
       
   533                                 {
       
   534                                 USimPbReqRead( aFileData[iRecordLength] );
       
   535                                 iExtensionRead = ETrue;
       
   536                                 iServiceType = UICC_APPL_READ_LINEAR_FIXED;
       
   537                                 }
       
   538                             }
       
   539                         }
       
   540                     }
       
   541                 else  // Handling for Extension Numbers
       
   542                     {
       
   543                     if(UICC_APPL_UPDATE_LINEAR_FIXED == iServiceType)
       
   544                         {
       
   545                         if(0xFF != aFileData[13])    // Check for next extension data record
       
   546                             {
       
   547                             // Store Number upto last byte
       
   548                              iNumberBuf.Append(aFileData.Mid(1,11));
       
   549                             // Again Send request to read next record number and appenf it in number
       
   550                             iServiceType = UICC_APPL_READ_LINEAR_FIXED;
       
   551                             USimPbReqRead( aFileData[13] );
       
   552                            }
       
   553                         else
       
   554                             {
       
   555                             // Check for length upto which no is stored
       
   556                             TInt offset = aFileData.Find(&KTagUnusedbyte,1);
       
   557                             // store Data
       
   558                             iNumberBuf.Append(aFileData.Mid(1,offset));
       
   559 
       
   560                             // the there is no extension data
       
   561                             CPhoneBookStoreEntry* phoneBookStoreMsg =
       
   562                                 new( ELeave ) CPhoneBookStoreEntry;
       
   563                             CleanupStack::PushL( phoneBookStoreMsg );
       
   564                             phoneBookStoreMsg->ConstructL();
       
   565 
       
   566                             StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg);
       
   567 
       
   568                             TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
       
   569                             iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
       
   570                             CleanupStack::Pop( phoneBookStoreMsg );
       
   571                             iNumOfEntriesFilled++;
       
   572                             TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - \
       
   573                             Append entries into array %i",iNumOfEntriesFilled);
       
   574                 //OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUSIMPBRESPL, "CMmPhoneBookOperationRead::HandleUSimPbRespL;Append entries into array=%d", iNumOfEntriesFilled );
       
   575 
       
   576 
       
   577                             }
       
   578                         }
       
   579                     }
       
   580                 }
       
   581                 break;
       
   582             default:
       
   583                 // There is no such phonebook exist
       
   584                 ret = KErrGeneral;
       
   585                 break;
       
   586             }
       
   587         }
       
   588 
       
   589         // Case: <complete request>
       
   590         if ( KErrNone != ret || 0 == iNumOfEntriesToRead )
       
   591             {
       
   592             // If no entries found
       
   593             if ( 0 == iNumOfEntriesFilled )
       
   594                 {
       
   595                 ret = KErrNotFound;
       
   596                 }
       
   597 
       
   598             TName phoneBookName;
       
   599             CPhoneBookDataPackage phoneBookData;
       
   600 
       
   601             // Convert number of phonebook type to Sim pbtype
       
   602             ConvertToPBname( aTransId, phoneBookName );
       
   603             phoneBookData.SetPhoneBookName( phoneBookName );
       
   604             iNumOfEntriesFilled = 0;
       
   605             iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
       
   606                 EMmTsyPhoneBookStoreReadIPC,
       
   607                 &phoneBookData,
       
   608                 ret );
       
   609 
       
   610             iPhoneBookStoreCacheArray = NULL;
       
   611             // Set flag to indicate that we can remove this operation from array
       
   612             }
       
   613     return ret;
       
   614     }
       
   615 
       
   616 
       
   617 // End of File