adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp
changeset 5 8ccc39f9d787
child 7 fa67e03b87df
equal deleted inserted replaced
4:510c70acdbf6 5:8ccc39f9d787
       
     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 
       
    19 // INCLUDE FILES
       
    20 #include <etelmm.h>
       
    21 #include <tisi.h>
       
    22 #include <pn_const.h>
       
    23 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    24 #include "cmmmessagerouter.h"
       
    25 #include "cmmphonebookoperationcache.h"
       
    26 #include "osttracedefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "cmmphonebookoperationcachetraces.h"
       
    29 #endif
       
    30 
       
    31 // EXTERNAL DATA STRUCTURES
       
    32     // None
       
    33 
       
    34 // EXTERNAL FUNCTION PROTOTYPES
       
    35     // None
       
    36 
       
    37 // CONSTANTS
       
    38 
       
    39 // MACROS
       
    40     // None
       
    41 
       
    42 // LOCAL CONSTANTS AND MACROS
       
    43     // None
       
    44 
       
    45 // MODULE DATA STRUCTURES
       
    46     // None
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49     // None
       
    50 
       
    51 // ==================== LOCAL FUNCTIONS =====================================
       
    52     // None
       
    53 
       
    54 
       
    55 // ================= MEMBER FUNCTIONS =======================================
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CMmPhoneBookOperationCache::CMmPhoneBookOperationCache
       
    59 // C++ default constructor can NOT contain any code, that
       
    60 // might leave.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CMmPhoneBookOperationCache::CMmPhoneBookOperationCache
       
    64     (
       
    65     // None
       
    66     )
       
    67     {
       
    68 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CMmPhoneBookOperationCache");
       
    69 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CMMPHONEBOOKOPERATIONCACHE, "CMmPhoneBookOperationCache::CMmPhoneBookOperationCache" );
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache
       
    74 // C++ destructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache
       
    78     (
       
    79     // None
       
    80     )
       
    81     {
       
    82 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache");
       
    83 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_CMMPHONEBOOKOPERATIONCACHE, "CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache" );
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMmPhoneBookOperationCache::NewL
       
    88 // Two-phased constructor.
       
    89 // Creates a new CmmPhonebookOperatorInit object instance.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 CMmPhoneBookOperationCache* CMmPhoneBookOperationCache::NewL
       
    93     (
       
    94     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
       
    95     CMmUiccMessHandler* /*aUiccMessHandler*/,
       
    96     TInt /*aIpc*/,
       
    97     const CMmDataPackage* aDataPackage // Data
       
    98     )
       
    99     {
       
   100 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::NewL");
       
   101 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_NEWL, "CMmPhoneBookOperationCache::NewL" );
       
   102 
       
   103     TName phonebookTypeName ;
       
   104 
       
   105     CMmPhoneBookOperationCache* mmPhoneBookOperationCache =
       
   106             new( ELeave ) CMmPhoneBookOperationCache();
       
   107 
       
   108     const CPhoneBookDataPackage* phoneBookData =
       
   109         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
       
   110 
       
   111     phoneBookData->GetPhoneBookName( phonebookTypeName );
       
   112 
       
   113     mmPhoneBookOperationCache->iPhoneBookTypeName = phonebookTypeName;
       
   114 
       
   115     mmPhoneBookOperationCache->iMmPhoneBookStoreMessHandler =
       
   116         aMmPhoneBookStoreMessHandler;
       
   117 
       
   118     return mmPhoneBookOperationCache;
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CMmPhoneBookOperationCache::UiccCreateReq
       
   123 // Separate request
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 TInt CMmPhoneBookOperationCache::UICCCreateReq
       
   127     (
       
   128     TInt aIpc,
       
   129     const CMmDataPackage* aDataPackage,
       
   130     TUint8 aTransId
       
   131     )
       
   132     {
       
   133 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CreateReq");
       
   134 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CREATEREQ, "CMmPhoneBookOperationCache::CreateReq" );
       
   135 
       
   136     TInt ret( KErrNotSupported );
       
   137 
       
   138     switch( aIpc )
       
   139         {
       
   140         case EMmTsyPhoneBookStoreGetInfoIPC:
       
   141             {
       
   142             iNumOfUsedSDNEntries = 0;
       
   143             iNumOfUsedVMBXEntries = 0;
       
   144             break;
       
   145             }
       
   146         case EMmTsyPhoneBookStoreCacheIPC:
       
   147             {
       
   148             const CPhoneBookDataPackage* phoneBookData(
       
   149                 static_cast<const CPhoneBookDataPackage*>( aDataPackage ) );
       
   150 
       
   151             CArrayPtrSeg<CPhoneBookStoreEntry>* prtToCacheArray;
       
   152             phoneBookData->UnPackData( prtToCacheArray );
       
   153 
       
   154             if ( prtToCacheArray )
       
   155                 {
       
   156                 iPhoneBookStoreCacheArray = prtToCacheArray;
       
   157                 ret = KErrNone;
       
   158                 iIndexToRead = 1 ; // Strat from 1st Record to read
       
   159                 // Start Reading records from 1st record
       
   160                 ret = USimPbReqRead( iIndexToRead, aTransId );
       
   161                 }
       
   162             else
       
   163                 {
       
   164                 ret = KErrArgument;
       
   165                 }
       
   166 
       
   167             break;
       
   168             }
       
   169         default:
       
   170             {
       
   171             // Nothing to do here
       
   172 TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::CreateReq - Unknown IPC: %d", aIpc);
       
   173 OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_UICCCREATEREQ, "CMmPhoneBookOperationCache::UiccCreateReq; Unknown IPC =%hd", aIpc );
       
   174             break;
       
   175             }
       
   176         }//switch-case
       
   177     return ret;
       
   178     }
       
   179 
       
   180 
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CMmPhoneBookOperationCache::HandleUICCPbRespL
       
   184 // Handle response
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 TBool CMmPhoneBookOperationCache::HandleUICCPbRespL (
       
   188       TInt aStatus,
       
   189       TUint8 /*aDetails*/,
       
   190       const TDesC8 &aFileData,
       
   191       TInt aTransId )
       
   192     {
       
   193 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL");
       
   194 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL,"CMmPhoneBookOperationCache::HandleUICCPbRespL" );
       
   195 
       
   196     TInt ret( KErrNone );
       
   197     TInt retExt( KErrNone );
       
   198     TBool complete ( EFalse );
       
   199 
       
   200 // IF UICC Serever response is not OK
       
   201     if ( ( UICC_STATUS_OK != aStatus ) && ( !iExtensionToRead) )
       
   202         {
       
   203 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleSimPbResp:Unsuccessfully completed by UICC");
       
   204 OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL - Unsuceesfully completed by UICC" );
       
   205 
       
   206         ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
       
   207         }
       
   208 
       
   209 
       
   210     if( !iCancelOperation )
       
   211         {
       
   212         // Convert Phone Book name to file id
       
   213         TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
       
   214         TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
       
   215         TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
       
   216         
       
   217         switch(pbFileId)
       
   218             {
       
   219             case PB_ADN_FID:
       
   220             case PB_FDN_FID:
       
   221             case PB_SDN_FID:
       
   222                 {
       
   223                 // Start Caching for ADN Phone Book
       
   224                 if(!iExtensionToRead)
       
   225                     {
       
   226                     // Check for UICC_SERVER_OK 
       
   227                     if( UICC_STATUS_OK == aStatus)
       
   228                         {
       
   229                         iStoreEntry = new ( ELeave ) TPBEntry();
       
   230                         // update Entry Data
       
   231                         iStoreEntry->iEntryIndex = iIndexToRead;
       
   232 
       
   233                         // check if Entry is valid Entry or Empty Entry
       
   234                         TInt retval = EmptyEntryCheck(aFileData);
       
   235                         
       
   236                         // if Entry is not empty
       
   237                         if( KErrNone == retval)
       
   238                             {
       
   239                             // Update Entry Status 
       
   240                             iStoreEntry->iEntryPresent = ETrue;
       
   241                             // Seperate Entry data form UICC Server response message
       
   242                             // Case: <Data available to be filled into array>
       
   243                             iMmPhoneBookStoreMessHandler->
       
   244                             iPBStoreConf[EPhonebookTypeAdn].
       
   245                             GetPBEntryFromUICCData( 
       
   246                                 aFileData,
       
   247                                 iNumberBuf,
       
   248                                 iNameBuf);
       
   249                                 
       
   250                             // Check for Is there any extension data
       
   251                             // And the Extension data record number is valid
       
   252                             // Index to read Extension file Data is Alpha string
       
   253                             // Length + 14 , minus 1 is for Array index Calculation 
       
   254                             //(it starts from 0)
       
   255                             if ( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
       
   256                                          iPBStoreConf[EPhonebookTypeAdn].
       
   257                                          iAlphaStringlength + 13]  )
       
   258                                 {
       
   259                                 // Append Entry to list
       
   260                                 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
       
   261                                               iStoreEntry,
       
   262                                               pbArrayIndex );
       
   263 
       
   264                                 // the there is no extension data
       
   265                                 CPhoneBookStoreEntry* phoneBookStoreMsg =
       
   266                                 new( ELeave ) CPhoneBookStoreEntry;
       
   267                                 CleanupStack::PushL( phoneBookStoreMsg );
       
   268                                 phoneBookStoreMsg->ConstructL();
       
   269                                 
       
   270                                 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
       
   271                                     iNameBuf,
       
   272                                     iNumberBuf,
       
   273                                     *phoneBookStoreMsg,
       
   274                                     pbFileId,
       
   275                                     iIndexToRead,
       
   276                                     EFalse );
       
   277                                 TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
       
   278                                 iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
       
   279                                 CleanupStack::Pop( phoneBookStoreMsg );
       
   280                                 iNumOfEntriesFilled++;
       
   281 TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL - Append entries into array %d",iNumOfEntriesFilled);
       
   282 OstTraceExt1( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL;iNumOfEntriesFilled=%hd", iNumOfEntriesFilled );
       
   283                                 
       
   284                                 } // End of if Ext Data is not Present
       
   285                             else
       
   286                                 {
       
   287                                 iExtensionToRead = ETrue;
       
   288                                 // Record no to be read from EXT File
       
   289                                 TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler->
       
   290                                                iPBStoreConf[EPhonebookTypeAdn].
       
   291                                                iAlphaStringlength + 13];
       
   292                                 
       
   293                                 // Append EXT record no.
       
   294                                 iStoreEntry->PBEntryExtRecord.Append( recordNo );
       
   295 
       
   296                                 retExt = USimPbReqRead( recordNo, aTransId );
       
   297                                 // if while reading EXT error comes 
       
   298                                 //(for invalid Entry)than read next entry
       
   299                                 if(( KErrNone != retExt ))
       
   300                                     {
       
   301                                     iExtensionToRead = EFalse;
       
   302                                     }
       
   303                                 } // End for EXT File data present
       
   304                             } // end for case when entry is not empty
       
   305                         else
       
   306                             {
       
   307                             //Update Entry Status
       
   308                             iStoreEntry->iEntryPresent = EFalse;
       
   309                             // Reset Entry andd Append to the List 
       
   310                             iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
       
   311                                  iStoreEntry,
       
   312                                  pbArrayIndex );
       
   313                             }
       
   314 
       
   315                         // to read next record
       
   316                         iIndexToRead++;
       
   317 
       
   318                         } // end of check for UICC status
       
   319                     } // End of without EXT File Data Case
       
   320                 else  // Handling for Extension Numbers
       
   321                     {
       
   322                     if( UICC_STATUS_OK == aStatus )
       
   323                         {
       
   324                         // Check for next extension data record
       
   325                         if(0xFF != aFileData[UICC_EXT_REC_NO_OFFSET])    
       
   326                             {
       
   327                             // Again Append the EXT no to Array
       
   328                             iStoreEntry->PBEntryExtRecord.Append(
       
   329                                   aFileData[UICC_EXT_REC_NO_OFFSET] );
       
   330 
       
   331                             // Store Number upto last byte
       
   332                             iNumberBuf.Append(aFileData.Mid(1,UICC_EF_EXT_REC_NUM_LEN ));
       
   333                             // Again Send request to read next record number 
       
   334                             //and append it in number 
       
   335                             retExt = USimPbReqRead( 
       
   336                                 aFileData[UICC_EXT_REC_NO_OFFSET], aTransId );
       
   337                             if( KErrNone != retExt)
       
   338                                 {
       
   339                                 iExtensionToRead = EFalse;
       
   340                                 }
       
   341                             }  // end for checking next record number in EXT
       
   342                         else
       
   343                             {
       
   344                             // Append Entry to list and reset all the EXT data
       
   345                             iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
       
   346                                                           iStoreEntry,
       
   347                                                           pbArrayIndex );
       
   348                             // Reset Extension File record
       
   349                             iExtensionToRead = EFalse;
       
   350                             
       
   351                             // Check for Extended Data is Addition number 
       
   352                             if( 0x02 == aFileData[0])
       
   353                                 {
       
   354                                 // Check for length upto which no is stored
       
   355                                 TInt offset = aFileData.Find(&KTagUnusedbyte,1);
       
   356                                 // store Data
       
   357                                 iNumberBuf.Append(aFileData.Mid(1,( offset - 1 )));
       
   358                                 
       
   359                                 // the there is extension data
       
   360                                 CPhoneBookStoreEntry* phoneBookStoreMsg =
       
   361                                 new( ELeave ) CPhoneBookStoreEntry;
       
   362                                 CleanupStack::PushL( phoneBookStoreMsg );
       
   363                                 phoneBookStoreMsg->ConstructL();
       
   364                                 
       
   365                                 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
       
   366                                                               iNameBuf,
       
   367                                                               iNumberBuf,
       
   368                                                               *phoneBookStoreMsg,
       
   369                                                               pbFileId,
       
   370                                                               iIndexToRead,
       
   371                                                               EFalse );
       
   372                                 TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
       
   373                                 iPhoneBookStoreCacheArray->AppendL( 
       
   374                                                            phoneBookStoreMsg );
       
   375                                 CleanupStack::Pop( phoneBookStoreMsg );
       
   376                                 iNumOfEntriesFilled++;
       
   377 TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUSimPbRespL - Append entries into array %d",iNumOfEntriesFilled);
       
   378 OstTraceExt1( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL;iNumOfEntriesFilled=%hd", iNumOfEntriesFilled );
       
   379                                 } // end for checking Data type in EXT
       
   380                             } // end for Entry store
       
   381                         }
       
   382                     else
       
   383                         {
       
   384                         // To read next Entry
       
   385                         iExtensionToRead = EFalse;
       
   386                         }
       
   387                     } // end for EXT file handling
       
   388                 break;
       
   389                 } // end for ADN phone book cache
       
   390             default:
       
   391                 {
       
   392 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL. PhoneBook operation not supported ");
       
   393 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL. PhoneBook Operation not supported" );
       
   394                 break;
       
   395                 }
       
   396             } // End of switch case
       
   397         
       
   398         // Check for next location be read when its not for EXT Data
       
   399         
       
   400         if( ( !iExtensionToRead ) &&( iIndexToRead <= 
       
   401               iMmPhoneBookStoreMessHandler->iPBStoreConf[pbArrayIndex].iNoOfRecords ) )
       
   402             {
       
   403             // Send request to read next Entry
       
   404             USimPbReqRead( iIndexToRead, aTransId );
       
   405             }
       
   406 
       
   407         // Complete IPC if error is there OR all Entries are read
       
   408         if( ((KErrNone != ret) || 
       
   409              ( iIndexToRead > iMmPhoneBookStoreMessHandler->
       
   410                               iPBStoreConf[pbArrayIndex].iNoOfRecords )) 
       
   411              && ( !iExtensionToRead ))
       
   412             {
       
   413             // Check if any entries are filled in commonTSY Array
       
   414             if( 0 == iNumOfEntriesFilled )
       
   415                 {
       
   416                 ret = KErrNotFound;
       
   417                 }
       
   418             // Complete
       
   419             CPhoneBookDataPackage phoneBookData;
       
   420             phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
       
   421 
       
   422             iPhoneBookStoreCacheArray = NULL;
       
   423 
       
   424             iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
       
   425                 EMmTsyPhoneBookStoreCacheIPC,
       
   426                 &phoneBookData,
       
   427                 ret );
       
   428             // Set flag to indicate that we can remove this operation from array
       
   429             complete = ETrue;
       
   430             }
       
   431         }
       
   432     else
       
   433         { // Operation has been canceled
       
   434         complete = ETrue;
       
   435 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL; operation was canceled");
       
   436 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL; operation was canceled" );
       
   437         }
       
   438     return complete;
       
   439 
       
   440     }
       
   441 
       
   442 
       
   443 // -----------------------------------------------------------------------------
       
   444 // CMmPhoneBookOperationRead::USimPbReqRead
       
   445 // Constructs Data to read entry from SIM
       
   446 // -----------------------------------------------------------------------------
       
   447 //
       
   448 TInt CMmPhoneBookOperationCache::USimPbReqRead
       
   449     (
       
   450     TInt aRecordNo,
       
   451     TUint8 aTransId
       
   452     )
       
   453     {
       
   454 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead");
       
   455 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead" );
       
   456 
       
   457 
       
   458     TInt ret( KErrNone );
       
   459     TInt appFileID ( APPL_FILE_ID );   // Application File id for DFphonebook
       
   460     // get the index to be read from phonebook
       
   461     TInt index( iIndexToRead );
       
   462 
       
   463     TUiccReadLinearFixed cmdParams;
       
   464     cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
       
   465                                ( iMmPhoneBookStoreMessHandler );
       
   466 
       
   467     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
       
   468     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
       
   469     cmdParams.filePath.Append( appFileID>>8);
       
   470     cmdParams.filePath.Append( appFileID);
       
   471     cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
       
   472     cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
       
   473     
       
   474     // Convert Phone Book name to file id
       
   475     TUint16 fileIdExt ( 0x0000 );
       
   476     TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
       
   477     
       
   478     // get the corect Location to be read from phone book
       
   479     if( PB_MBDN_FID == pbFileId)
       
   480         {
       
   481         // Index to be read contains two types of information.
       
   482         // The least significant byte contains the profile number
       
   483         // and the most significant byte contains the type.
       
   484         index = index || 0x0100; // Only subscriber profile number 1 is supported
       
   485         }
       
   486 
       
   487         switch( pbFileId )
       
   488             {
       
   489             case PB_ADN_FID:
       
   490                 {
       
   491                 // For 2G ADN Phonebook EXT1 will be the extension number store
       
   492                 cmdParams.trId = static_cast<TUiccTrId> ( aTransId );
       
   493                 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   494                 cmdParams.record = aRecordNo;
       
   495                 
       
   496                 // Check for Extension Data is Present or not
       
   497                 if(!iExtensionToRead)
       
   498                     {
       
   499                     // Check for the record Number to be 
       
   500                     //read is valid record number
       
   501                     if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
       
   502                                    iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords)
       
   503                         {
       
   504                         // Start from first location and Search for First Valid 
       
   505                         //Entry in the Stored List And if some Entry is invalid
       
   506                         // then Read From Sim and Check the Staus its Free 
       
   507                         // or not till end of the records
       
   508                         
       
   509                         cmdParams.fileId = PB_ADN_FID;
       
   510                         cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   511                         cmdParams.record = aRecordNo;
       
   512                         // till End of Record
       
   513                         cmdParams.dataAmount = 0;
       
   514                         // Start from begining of record
       
   515                         cmdParams.dataOffset = 0;
       
   516                         }
       
   517                     else
       
   518                         {
       
   519                         ret = KErrNotFound;
       
   520                         }
       
   521                     } // end of if case for checking extension data
       
   522                 else
       
   523                     {
       
   524                     // Send Request to Read Extension Data
       
   525                     // Check for UST Table supports for EXT File
       
   526                     if( iMmPhoneBookStoreMessHandler->
       
   527                         iPBStoreConf[EPhonebookTypeAdn].iExtension )
       
   528                         {
       
   529                         // Check for Extension data record in valid
       
   530                         if(iMmPhoneBookStoreMessHandler->
       
   531                            iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec > aRecordNo)
       
   532                             {
       
   533                             // Read Request to read that index
       
   534                             cmdParams.fileId = PB_EXT1_FID;
       
   535                             cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   536                             cmdParams.record = aRecordNo;
       
   537                             // till End of Record
       
   538                             cmdParams.dataAmount = 0;
       
   539                             // Start from begining of record
       
   540                             cmdParams.dataOffset = 0;
       
   541                             }
       
   542                         else
       
   543                             {
       
   544                             ret = KErrGeneral;
       
   545                             }
       
   546                         }
       
   547                     else
       
   548                         {
       
   549                         ret = KErrGeneral;
       
   550                         }
       
   551                     }
       
   552                 break;
       
   553                 }
       
   554             case PB_FDN_FID:
       
   555                 {
       
   556                 // For FDN Phonebook EXT2 will be the extension number store
       
   557                 cmdParams.trId = ETrIdPbReadFdn;
       
   558                 cmdParams.fileId = PB_EXT2_FID;
       
   559 
       
   560                 cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
       
   561                 cmdParams.record = aRecordNo;
       
   562                 break;
       
   563                 }
       
   564             default:
       
   565                 {
       
   566 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead - PhoenBook Not supported");
       
   567 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead - PhoneBook not supported" );
       
   568                 break;
       
   569                 }
       
   570             }
       
   571         
       
   572 
       
   573         if( KErrNone == ret )
       
   574             {
       
   575             ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
       
   576                 CreateUiccApplCmdReq( cmdParams );
       
   577 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
       
   578 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead;ret=%hd", ret );
       
   579             }
       
   580     return ret;
       
   581     }
       
   582 
       
   583 
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CMmPhoneBookOperationCache::CancelReq
       
   587 // Cancels cacheing request
       
   588 // -----------------------------------------------------------------------------
       
   589 //
       
   590 void CMmPhoneBookOperationCache::CancelReq( TName& aPhoneBook )
       
   591     {
       
   592 TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CancelReq");
       
   593 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CANCELREQ, "CMmPhoneBookOperationCache::CancelReq" );
       
   594     if( iPhoneBookTypeName == aPhoneBook )
       
   595         {
       
   596         iPhoneBookStoreCacheArray = NULL;
       
   597         iCancelOperation = ETrue;
       
   598         }
       
   599     }
       
   600 
       
   601 // End of file