adaptationlayer/tsy/nokiatsy_dll/internal/test/nokiatsy_test_tool/sim/src/simblocks.cpp
changeset 4 510c70acdbf6
parent 3 1972d8c2e329
child 5 8ccc39f9d787
equal deleted inserted replaced
3:1972d8c2e329 4:510c70acdbf6
     1 /*
       
     2 * Copyright (c) 2002-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:   Specific class for SIM tests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32svr.h>
       
    23 #include <stifparser.h>
       
    24 #include <stiftestinterface.h>
       
    25 #include "sim.h"
       
    26 
       
    27 
       
    28 // CONSTANTS
       
    29 _LIT8( KLine, "---------------------------------" );
       
    30 
       
    31 _LIT8( KAdnPhoneBook, "AdnPhoneBook" );
       
    32 _LIT8( KBdnPhoneBook, "BdnPhoneBook" );
       
    33 _LIT8( KSdnPhoneBook, "SdnPhoneBook" );
       
    34 _LIT8( KFdnPhoneBook, "FdnPhoneBook" );
       
    35 _LIT8( KMBDN, "MBDN" );
       
    36 _LIT8( KVoiceMailBox, "VoiceMailBox" );
       
    37 
       
    38 _LIT( KViagInactive, "Inactive" );
       
    39 _LIT( KViagCZActive, "CZActive" );
       
    40 _LIT( KViagHZActive, "HZActive" );
       
    41 
       
    42 const TPtrC PhoneALSLine[] =
       
    43     {
       
    44     _L("EAlternateLinePrimary"),
       
    45     _L("EAlternateLineAuxiliary"),
       
    46     _L("EAlternateLineUnknown"),
       
    47     _L("EAlternateLineNotAvailable")
       
    48     };
       
    49 
       
    50 // Indicator what kind of test is on going.
       
    51 enum TAuthenticationTestPurpose
       
    52     {
       
    53     EGbaBootOk = 1,
       
    54     EGbaBootAuthFail,
       
    55     EGbaBootVerificationFail,
       
    56     EGbaNafDerOk,
       
    57     EGbaNafDerAuthFail,
       
    58     EGbaBootUpdateOk,
       
    59     EGbaBootUpdateError,
       
    60     EGbaBootError,
       
    61     EGbaBootNafError,
       
    62     EMgvMskUpdateOk = 11,
       
    63     EMgvMskUpdateNull,
       
    64     EMgvMskUpdateError,
       
    65     EMgvMtkGenerationOk,
       
    66     EMgvMtkGenerationError,
       
    67     EMgvMskDeletionOk,
       
    68     EMgvMskDeletionError,
       
    69     EMgvMskDeletionAuthFail,
       
    70     EMgvMskUpdateWithOmaBCastExtension,
       
    71     EMgvMtkGenerationWithBcastManagementData,
       
    72     EMgvMtkGenerationWithBCastParentalControlData,
       
    73     };
       
    74 
       
    75 // ============================ MEMBER FUNCTIONS ===============================
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CSIM::Delete
       
    79 // Delete here all resources allocated and opened from test methods.
       
    80 // Called from destructor.
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CSIM::Delete()
       
    84     {
       
    85 
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CSIM::RunMethodL
       
    90 // Run specified method. Contains also table of test mothods and their names.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 TInt CSIM::RunMethodL(
       
    94     CStifItemParser& aItem )
       
    95     {
       
    96    _LIT8 (KLog, "SIM: RunMethodL" );
       
    97    iSIMLog->Log((TDesC8)KLog);
       
    98 
       
    99     static TStifFunctionInfo const KFunctions[] =
       
   100         {
       
   101         // Copy this line for every implemented function.
       
   102         // First string is the function name used in TestScripter script file.
       
   103         // Second is the actual implementation member function.
       
   104         ENTRY( "PbInit",                  CSIM::PbInitL ),
       
   105         ENTRY( "PbStoreCache",            CSIM::PbStoreCacheL ),
       
   106         ENTRY( "PbStoreCacheCancel",      CSIM::PbStoreCacheCancelL ),
       
   107         ENTRY( "ReadEntries",             CSIM::ReadEntriesL ),
       
   108         ENTRY( "WriteEntries",            CSIM::WriteEntriesL ),
       
   109         ENTRY( "DeleteEntry",             CSIM::DeleteEntryL ),
       
   110         ENTRY( "DeleteAllEntries",        CSIM::DeleteAllEntriesL ),
       
   111         ENTRY( "GetPbStoreInfo",          CSIM::GetPbStoreInfoL ),
       
   112         ENTRY( "ReadENStore",             CSIM::ReadENStore ),
       
   113         ENTRY( "ReadENStoreAll",          CSIM::ReadENStoreAll ),
       
   114         ENTRY( "GetENStoreInfo",          CSIM::GetENStoreInfo ),
       
   115         ENTRY( "ReadONStore",             CSIM::ReadONStore ),
       
   116         ENTRY( "ReadONStoreEntry",        CSIM::ReadONStoreEntry ),
       
   117         ENTRY( "GetONStoreInfo",          CSIM::GetONStoreInfo ),
       
   118         ENTRY( "DeleteONStoreEntry",      CSIM::DeleteONStoreEntry ),
       
   119         ENTRY( "DeleteAllONStoreEntries", CSIM::DeleteAllONStoreEntries ),
       
   120         ENTRY( "WriteONStore",            CSIM::WriteONStore ),
       
   121         ENTRY( "ReadONStoreSize",         CSIM::ReadONStoreSize ),
       
   122         ENTRY( "GetMailboxNumbers",       CSIM::GetMailboxNumbers ),
       
   123         ENTRY( "WriteONStoreAll",         CSIM::WriteONStoreAll ),
       
   124         ENTRY( "OnStoreWriteSize",        CSIM::OnStoreWriteSize ),
       
   125         ENTRY( "GetServiceTable",         CSIM::GetServiceTable ),
       
   126         ENTRY( "GetALSLine",              CSIM::GetALSLine ),
       
   127         ENTRY( "SetALSLine",              CSIM::SetALSLine ),
       
   128         ENTRY( "GetCustomerServiceProfile", CSIM::GetCustomerServiceProfile ),
       
   129         ENTRY( "GetPin1DisableSupported", CSIM::GetPin1DisableSupported ),
       
   130         ENTRY( "SimRefreshRegister",      CSIM::SimRefreshRegister ),
       
   131         ENTRY( "SimRefreshDone",          CSIM::SimRefreshDone ),
       
   132         ENTRY( "GetSubscriberId",         CSIM::GetSubscriberId ),
       
   133         ENTRY( "GetServiceProviderName",  CSIM::GetServiceProviderName ),
       
   134         ENTRY( "ReadSimFile",             CSIM::ReadSimFile ),
       
   135         ENTRY( "GetNetworkProviderName",  CSIM::GetNetworkProviderName ),
       
   136         ENTRY( "GetSimAuthenticationData",CSIM::GetSimAuthenticationData ),
       
   137         ENTRY( "AuthenticateIMSData",     CSIM::AuthenticateIMSData ),
       
   138         ENTRY( "GetIMSAuthorizationInfo", CSIM::GetIMSAuthorizationInfo ),
       
   139         ENTRY( "GetALSBlockedStatus",     CSIM::GetALSBlockedStatus ),
       
   140         ENTRY( "SetALSBlockedStatus",     CSIM::SetALSBlockedStatus ),
       
   141         ENTRY( "SendSIMRefreshNtf",       CSIM::SendSIMRefreshNtf),
       
   142         ENTRY( "CheckAlsPpSupport",       CSIM::CheckAlsPpSupport),
       
   143         ENTRY( "FdnDataSizesReq",         CSIM::FdnDataSizesReq),
       
   144         ENTRY( "GetServiceSupport",       CSIM::CheckServiceSupport),
       
   145         ENTRY( "SetExpectedNumberOfPbEntries", CSIM::SetExpectedNumberOfPbEntries),
       
   146         ENTRY( "ViagHomeZoneReadParam",   CSIM::ViagHomeZoneReadParamL),
       
   147         ENTRY( "ViagHomeZoneReadCache",   CSIM::ViagHomeZoneReadCacheL),
       
   148         ENTRY( "ViagHomeZoneWriteSettings", CSIM::ViagHomeZoneWriteSettingsL),
       
   149         ENTRY( "ViagHomeZoneWriteCache",  CSIM::ViagHomeZoneWriteCacheL),
       
   150         ENTRY( "InvalidReadEntries",      CSIM::InvalidReadEntries),
       
   151         ENTRY( "InvalidWriteEntries",     CSIM::InvalidWriteEntries),
       
   152         ENTRY( "InvalidPbStoreCache",     CSIM::InvalidPbStoreCache),
       
   153 
       
   154 
       
   155 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   156         ENTRY( "WriteAlphaString",        CSIM::WriteAlphaString),
       
   157         ENTRY( "ReadAlphaString",         CSIM::ReadAlphaString),
       
   158         ENTRY( "DeleteAlphaString",       CSIM::DeleteAlphaString),
       
   159 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   160 
       
   161         ENTRY( "HandleSpecifiedRequests", CCore::HandleSpecifiedRequests),
       
   162         ENTRY( "InitializeIPCRequestTable", CCore::InitializeIPCRequestTable),
       
   163         ENTRY( "SetExpectedCompleteIPC",  CCore::SetExpectedCompleteIPC),
       
   164         ENTRY( "SetTestOngoingFlag",      CSIM::SetTestOngoingFlag),
       
   165         ENTRY( "HandleSpecifiedRequests", CCore::HandleSpecifiedRequests),
       
   166         ENTRY( "SetOperInfoAPAC",         CCore::SetOperInfoAPAC ),
       
   167         ENTRY( "RunIscTestCase",          CCore::RunIscTestCase),
       
   168         ENTRY( "SyncIscTestCase",         CCore::SyncIscTestCase),
       
   169         ENTRY( "RunIscTestCaseStartNTSYAfterTestToolStart",
       
   170                 CCore::RunIscTestCaseStartNTSYAfterTestToolStart),
       
   171         ENTRY( "SyncIscTestCaseStartNTSYAfterTestToolStart",
       
   172                 CCore::SyncIscTestCaseStartNTSYAfterTestToolStart),
       
   173         };
       
   174 
       
   175 
       
   176     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
       
   177 
       
   178     return RunInternalL( KFunctions, count, aItem );
       
   179 
       
   180     }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CSIM::PbInitL
       
   184 // Phonebook initialization
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 TInt CSIM::PbInitL( CStifItemParser& aItem )
       
   188     {
       
   189     _LIT8(KPbInit, "SIM::PbInit");
       
   190     iSIMLog->Log((TDesC8)KPbInit);
       
   191 
       
   192     TInt ret( KErrNotFound );
       
   193     TBool supported( ETrue );
       
   194     TPtrC string;
       
   195     aItem.GetNextString( string );
       
   196 
       
   197     if ( _L("Adn") == string )
       
   198         {
       
   199         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
   200         iPhoneBookName = KETelIccAdnPhoneBook;
       
   201         if ( iHandleSpecifiedRequests )
       
   202             {
       
   203             // Check for card Type 
       
   204             TInt value;
       
   205             aItem.GetNextString( string );
       
   206 
       
   207             if ( _L("UICC") == string )
       
   208                 {
       
   209                 iCardType = _L("UICC");
       
   210                 aItem.GetNextInt( value );
       
   211                 iStorageDataAnr.iXXXTextLengthMax = value;
       
   212                 aItem.GetNextInt( value );
       
   213                 iStorageDataAnr.iXXXNumOfEntriesPerEntry = value;
       
   214                 aItem.GetNextInt( value );
       
   215                 iStorageDataAnr.iXXXNumOfEntries = value;
       
   216 
       
   217                 aItem.GetNextInt( value );
       
   218                 iStorageDataSne.iXXXNumOfEntries = value;
       
   219                 aItem.GetNextInt( value );
       
   220                 iStorageDataSne.iXXXNumOfEntriesPerEntry = value;
       
   221                 aItem.GetNextInt( value );
       
   222                 iStorageDataSne.iXXXTextLengthMax = value;
       
   223                 
       
   224                 aItem.GetNextInt( value );
       
   225                 iStorageDataEmail.iXXXNumOfEntries = value;
       
   226                 aItem.GetNextInt( value );
       
   227                 iStorageDataEmail.iXXXNumOfEntriesPerEntry = value;
       
   228                 aItem.GetNextInt( value );
       
   229                 iStorageDataEmail.iXXXTextLengthMax = value;
       
   230                 }
       
   231             // store phonebook info
       
   232             aItem.GetNextInt( value );
       
   233             iPbStorageDataAdn.iIsPhonebookInitialized = ( TBool )value;
       
   234             aItem.GetNextInt( value );
       
   235             iPbStorageDataAdn.iIsPhonebookInitializeFailed = ( TBool )value;
       
   236             aItem.GetNextInt( value );
       
   237             iPbStorageDataAdn.iXXXNumOfEntries = value;
       
   238             aItem.GetNextInt( value );
       
   239             iPbStorageDataAdn.iXXXTextLengthMax = value;
       
   240             aItem.GetNextInt( value );
       
   241             iPbStorageDataAdn.iXXXNumberLengthMax = value;
       
   242             
       
   243             aItem.GetNextInt( value );
       
   244             iPbStorageDataFdn.iXXXNumOfEntries = value;
       
   245             aItem.GetNextInt( value );
       
   246             iPbStorageDataFdn.iXXXTextLengthMax = value;
       
   247             aItem.GetNextInt( value );
       
   248             iPbStorageDataFdn.iXXXNumberLengthMax = value;
       
   249             aItem.GetNextInt( value );
       
   250             iPbStorageDataSdn.iXXXNumOfEntries = value;
       
   251             aItem.GetNextInt( value );
       
   252             iPbStorageDataSdn.iXXXTextLengthMax = value;
       
   253             aItem.GetNextInt( value );
       
   254             iPbStorageDataSdn.iXXXNumberLengthMax = value;
       
   255             aItem.GetNextInt( value );
       
   256             iPbStorageDataMbdn.iXXXNumOfEntries = value;
       
   257             aItem.GetNextInt( value );
       
   258             iPbStorageDataMbdn.iXXXTextLengthMax = value;
       
   259             aItem.GetNextInt( value );
       
   260             iPbStorageDataMbdn.iXXXNumberLengthMax = value;
       
   261             aItem.GetNextInt( value );
       
   262             iPbStorageDataMsisdn.iXXXNumOfEntries = value;
       
   263             aItem.GetNextInt( value );
       
   264             iPbStorageDataMsisdn.iXXXTextLengthMax = value;
       
   265             aItem.GetNextInt( value );
       
   266             iPbStorageDataMsisdn.iXXXNumberLengthMax = value;
       
   267             
       
   268             if( _L("ICC") == string )
       
   269                 {
       
   270                 iCardType = _L("ICC");
       
   271 
       
   272                 aItem.GetNextInt( value );
       
   273                 iPbStorageDataVmbx.iXXXNumOfEntries = value;
       
   274                 aItem.GetNextInt( value );
       
   275                 iPbStorageDataVmbx.iXXXTextLengthMax = value;
       
   276                 aItem.GetNextInt( value );
       
   277                 iPbStorageDataVmbx.iXXXNumberLengthMax = value;
       
   278                 }
       
   279             aItem.GetNextInt( value );
       
   280             iPbType[value] = TPhoneBookTypeAdn;
       
   281             }
       
   282         }
       
   283     else if ( _L("Bdn") == string )
       
   284         {
       
   285         iSIMLog->Log((TDesC8)KBdnPhoneBook);
       
   286         iPhoneBookName = KETelIccBdnPhoneBook;
       
   287         }
       
   288     else if ( _L("Sdn") == string )
       
   289         {
       
   290         iSIMLog->Log((TDesC8)KSdnPhoneBook);
       
   291         iPhoneBookName = KETelIccSdnPhoneBook;
       
   292         if ( iHandleSpecifiedRequests )
       
   293             {
       
   294             // store phonebook info
       
   295             TInt value;
       
   296             aItem.GetNextInt( value );
       
   297             iPbStorageDataSdn.iIsPhonebookInitialized = ( TBool )value;
       
   298             aItem.GetNextInt( value );
       
   299             iPbStorageDataSdn.iIsPhonebookInitializeFailed = ( TBool )value;
       
   300             aItem.GetNextInt( value );
       
   301             iPbStorageDataSdn.iXXXNumOfEntries = value;
       
   302             aItem.GetNextInt( value );
       
   303             iPbStorageDataSdn.iXXXTextLengthMax = value;
       
   304             aItem.GetNextInt( value );
       
   305             iPbStorageDataSdn.iXXXNumberLengthMax = value;
       
   306             aItem.GetNextInt( value );
       
   307             iPbType[value] = TPhoneBookTypeSdn;
       
   308             }
       
   309         }
       
   310     else if ( _L("Fdn") == string )
       
   311         {
       
   312         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
   313         iPhoneBookName = KETelIccFdnPhoneBook;
       
   314         if ( iHandleSpecifiedRequests )
       
   315             {
       
   316             // store phonebook info
       
   317             TInt value;
       
   318             aItem.GetNextInt( value );
       
   319             iPbStorageDataFdn.iIsPhonebookInitialized = ( TBool )value;
       
   320             aItem.GetNextInt( value );
       
   321             iPbStorageDataFdn.iIsPhonebookInitializeFailed = ( TBool )value;
       
   322             aItem.GetNextInt( value );
       
   323             iPbStorageDataFdn.iXXXNumOfEntries = value;
       
   324             aItem.GetNextInt( value );
       
   325             iPbStorageDataFdn.iXXXTextLengthMax = value;
       
   326             aItem.GetNextInt( value );
       
   327             iPbStorageDataFdn.iXXXNumberLengthMax = value;
       
   328             aItem.GetNextInt( value );
       
   329             iPbType[value] = TPhoneBookTypeFdn;
       
   330             }
       
   331         }
       
   332     else if ( _L("VoiceMailBox") == string )
       
   333         {
       
   334         iSIMLog->Log((TDesC8)KVoiceMailBox);
       
   335         iPhoneBookName = KETelIccVoiceMailBox;
       
   336         }
       
   337     else
       
   338         {
       
   339         _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
   340         iSIMLog->Log((TDesC8)KNotSupp);
       
   341         supported = EFalse;
       
   342         }
       
   343 
       
   344     if ( supported )
       
   345         {
       
   346         //Create package
       
   347         CPhoneBookDataPackage package;
       
   348         // Set package data
       
   349         package.SetPhoneBookName( iPhoneBookName );
       
   350 
       
   351         ret = HandleRequestL( EMmTsyPhoneBookStoreInitIPC,
       
   352                              &package );
       
   353 
       
   354         if ( KErrNone == ret )
       
   355             {
       
   356             _LIT8( KSendOk, "PbInit request send ok" );
       
   357             iSIMLog->Log((TDesC8)KSendOk );
       
   358             }
       
   359         else
       
   360             {
       
   361              _LIT8( KSendFailed, "PbInit request send failed: %d" );
       
   362             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
   363             }
       
   364         }
       
   365     else
       
   366         {
       
   367         ret = KErrNotSupported;
       
   368         }
       
   369 
       
   370     return ret;
       
   371     }
       
   372 
       
   373 // -----------------------------------------------------------------------------
       
   374 // CSIM::CompletePbInit
       
   375 // Complete PbInit method function.
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 void CSIM::CompletePbInit
       
   379         (
       
   380         TInt aResult,
       
   381         CMmDataPackage* aDataPackage
       
   382         )
       
   383     {
       
   384     _LIT8( KResult, "CompletePbInit result: %d" );
       
   385     iSIMLog->Log((TDesC8)KResult, aResult );
       
   386     // Response information
       
   387     CStorageInfoData* pbInitResp;
       
   388     TInt i;
       
   389 
       
   390     if ( KErrNone == aResult )
       
   391         {
       
   392         aDataPackage->UnPackData ( &pbInitResp );
       
   393         PrintPbInitInfo( pbInitResp );
       
   394 
       
   395         if ( iHandleSpecifiedRequests )
       
   396             {
       
   397             // select used phonebook type for data validation
       
   398             TPhoneBookType pbType( TPhoneBookTypeUnknown );
       
   399             for ( i = 0; i < 2; i++)
       
   400                 {
       
   401                 if ( iPbType[i] != TPhoneBookTypeUnknown )
       
   402                     {
       
   403                     pbType = iPbType[i];
       
   404                     break;
       
   405                     }
       
   406                 }
       
   407             aResult = CheckPbData( pbInitResp, pbType );
       
   408             // reset phonebook type
       
   409             iPbType[i] = TPhoneBookTypeUnknown;
       
   410             }
       
   411         }
       
   412     else
       
   413         {
       
   414         _LIT8( KFail, "CompletePbInit Failed: %d" );
       
   415         iSIMLog->Log((TDesC8)KFail, aResult );
       
   416         }
       
   417 
       
   418     // in case of failure, send result immediately
       
   419     if( KErrNone != aResult )
       
   420         {
       
   421         Signal( aResult );
       
   422         }
       
   423 
       
   424     // in successful case, send result if test is not ongoing
       
   425     else if( ! iTestOngoing )
       
   426         {
       
   427         Signal( aResult );
       
   428         }
       
   429 
       
   430     iTestOngoing = EFalse;
       
   431     }
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // CSIM::PrintPbInitInfo
       
   435 // Prints Pb info
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 void CSIM::PrintPbInitInfo
       
   439         (
       
   440         CStorageInfoData* aPbInitInfo
       
   441         )
       
   442     {
       
   443     iSIMLog->Log((TDesC8)KLine );
       
   444     _LIT8( KText, "Pb Init Info" );
       
   445     iSIMLog->Log((TDesC8)KText );
       
   446 
       
   447     _LIT8( KADNNumOfEntries, "ADNNumOfEntries: %d" );
       
   448     iSIMLog->Log((TDesC8)KADNNumOfEntries, aPbInitInfo->iADNNumOfEntries );
       
   449 
       
   450     _LIT8( KADNTextLengthMax, "ADNTextLengthMax: %d" );
       
   451     iSIMLog->Log((TDesC8)KADNTextLengthMax, aPbInitInfo->iADNTextLengthMax );
       
   452 
       
   453     _LIT8( KADNNumberLengthMax, "ADNNumberLengthMax: %d" );
       
   454     iSIMLog->Log((TDesC8)KADNNumberLengthMax, aPbInitInfo->iADNNumberLengthMax );
       
   455 
       
   456     _LIT8( KFDNNumOfEntries, "FDNNumOfEntries: %d" );
       
   457     iSIMLog->Log((TDesC8)KFDNNumOfEntries, aPbInitInfo->iFDNNumOfEntries );
       
   458 
       
   459     _LIT8( KFDNTextLengthMax, "FDNTextLengthMax: %d" );
       
   460     iSIMLog->Log((TDesC8)KFDNTextLengthMax, aPbInitInfo->iFDNTextLengthMax );
       
   461 
       
   462     _LIT8( KFDNNumberLengthMax, "FDNNumberLengthMax: %d" );
       
   463     iSIMLog->Log((TDesC8)KFDNNumberLengthMax, aPbInitInfo->iFDNNumberLengthMax );
       
   464 
       
   465     _LIT8( KSDNNumOfEntries, "SDNNumOfEntries: %d" );
       
   466     iSIMLog->Log((TDesC8)KSDNNumOfEntries, aPbInitInfo->iSDNNumOfEntries );
       
   467 
       
   468     _LIT8( KSDNTextLengthMax, "SDNTextLengthMax: %d" );
       
   469     iSIMLog->Log((TDesC8)KSDNTextLengthMax, aPbInitInfo->iSDNTextLengthMax );
       
   470 
       
   471     _LIT8( KSDNNumberLengthMax, "SDNNumberLengthMax: %d" );
       
   472     iSIMLog->Log((TDesC8)KSDNNumberLengthMax, aPbInitInfo->iSDNNumberLengthMax );
       
   473 
       
   474     _LIT8( KVMBXNumOfEntries, "VMBXNumOfEntries: %d" );
       
   475     iSIMLog->Log((TDesC8)KVMBXNumOfEntries, aPbInitInfo->iVMBXNumOfEntries );
       
   476 
       
   477     _LIT8( KVMBXTextLengthMax, "VMBXTextLengthMax: %d" );
       
   478     iSIMLog->Log((TDesC8)KVMBXTextLengthMax, aPbInitInfo->iVMBXTextLengthMax );
       
   479 
       
   480     _LIT8( KVMBXNumberLengthMax, "VMBXNumberLengthMax: %d" );
       
   481     iSIMLog->Log((TDesC8)KVMBXNumberLengthMax, aPbInitInfo->iVMBXNumberLengthMax );
       
   482 
       
   483     _LIT8( KGRPNumOfEntriesPerEntry, "GRPNumOfEntriesPerEntry: %d" );
       
   484     iSIMLog->Log((TDesC8)KGRPNumOfEntriesPerEntry, aPbInitInfo->iGRPNumOfEntriesPerEntry );
       
   485 
       
   486     _LIT8( KANRNumOfEntries, "ANRNumOfEntries: %d" );
       
   487     iSIMLog->Log((TDesC8)KANRNumOfEntries, aPbInitInfo->iANRNumOfEntries );
       
   488 
       
   489     _LIT8( KANRNumOfEntriesPerEntry, "ANRNumOfEntriesPerEntry: %d" );
       
   490     iSIMLog->Log((TDesC8)KANRNumOfEntriesPerEntry, aPbInitInfo->iANRNumOfEntriesPerEntry );
       
   491 
       
   492     _LIT8( KANRNumLengthMax, "ANRNumLengthMax: %d" );
       
   493     iSIMLog->Log((TDesC8)KANRNumLengthMax, aPbInitInfo->iANRNumLengthMax );
       
   494 
       
   495 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   496     _LIT8( KANRTextLengthMax, "ANRTextLengthMax (AAS): %d" );
       
   497     iSIMLog->Log((TDesC8)KANRTextLengthMax, aPbInitInfo->iANRTextLengthMax );
       
   498 
       
   499     _LIT8( KNumOfAasMax, "NumOfAasMax: %d" );
       
   500     iSIMLog->Log((TDesC8)KNumOfAasMax, aPbInitInfo->iNumOfAasMax );
       
   501 
       
   502     _LIT8( KGRPTextLengthMax, "GRPTextLengthMax: %d" );
       
   503     iSIMLog->Log((TDesC8)KGRPTextLengthMax, aPbInitInfo->iGRPTextLengthMax );
       
   504 
       
   505     _LIT8( KNumOfGasMax, "NumOfGasMax: %d" );
       
   506     iSIMLog->Log((TDesC8)KNumOfGasMax, aPbInitInfo->iNumOfGasMax );
       
   507 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   508     }
       
   509 
       
   510 
       
   511 // -----------------------------------------------------------------------------
       
   512 // CSIM::PbStoreCacheL
       
   513 // Phonebook-cache (ADN & FDN)
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 TInt CSIM::PbStoreCacheL( CStifItemParser& aItem )
       
   517     {
       
   518     _LIT8(KPbStoreCache, "SIM::PbStoreCache");
       
   519     iSIMLog->Log((TDesC8)KPbStoreCache);
       
   520 
       
   521     TInt ret( KErrNotFound );
       
   522     TBool supported( ETrue );
       
   523     TPtrC string;
       
   524     aItem.GetNextString( string );
       
   525     CPhoneBookDataPackage package;
       
   526 
       
   527     if ( _L("Adn") == string )
       
   528         {
       
   529         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
   530         iPhoneBookName = KETelIccAdnPhoneBook;
       
   531         // Set package data
       
   532         package.SetPhoneBookName( iPhoneBookName );
       
   533         package.PackData( &iPBStoreCacheAdn );
       
   534         }
       
   535     else if ( _L("Fdn") == string )
       
   536         {
       
   537         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
   538         iPhoneBookName = KETelIccFdnPhoneBook;
       
   539 
       
   540         // Set package data
       
   541         package.SetPhoneBookName( iPhoneBookName );
       
   542         package.PackData( &iPBStoreCacheFdn );
       
   543         }
       
   544     else if ( _L("Sdn") == string )
       
   545         {
       
   546         iSIMLog->Log((TDesC8)KSdnPhoneBook);
       
   547         iPhoneBookName = KETelIccSdnPhoneBook;
       
   548 
       
   549         // Set package data
       
   550         package.SetPhoneBookName( iPhoneBookName );
       
   551         package.PackData( &iPBStoreCacheSdn );
       
   552         }
       
   553     else
       
   554         {
       
   555          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
   556         iSIMLog->Log((TDesC8)KNotSupp);
       
   557         supported = EFalse;
       
   558         }
       
   559 
       
   560     if ( supported )
       
   561         {
       
   562         ret = HandleRequestL( EMmTsyPhoneBookStoreCacheIPC,
       
   563                              &package );
       
   564 
       
   565         if ( KErrNone == ret )
       
   566             {
       
   567             _LIT8( KSendOk, "PbStoreCache request send ok" );
       
   568             iSIMLog->Log((TDesC8)KSendOk );
       
   569             }
       
   570         else
       
   571             {
       
   572              _LIT8( KSendFailed, "PbStoreCache request send failed: %d" );
       
   573             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
   574             }
       
   575         }
       
   576     else
       
   577         {
       
   578         ret = KErrNotSupported;
       
   579         }
       
   580 
       
   581     return ret;
       
   582 
       
   583     }
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CSIM::PbStoreCacheCancelL
       
   587 // Phonebook-cacheing cancel (ADN, FDN, SDN)
       
   588 // -----------------------------------------------------------------------------
       
   589 //
       
   590 TInt CSIM::PbStoreCacheCancelL( CStifItemParser& aItem )
       
   591     {
       
   592     _LIT8(KPbStoreCacheCancel, "SIM::PbStoreCacheCancel");
       
   593     iSIMLog->Log((TDesC8)KPbStoreCacheCancel);
       
   594 
       
   595     TInt ret( KErrNotFound );
       
   596     TBool supported( ETrue );
       
   597     TPtrC string;
       
   598     aItem.GetNextString( string );
       
   599     CPhoneBookDataPackage package;
       
   600 
       
   601     if ( _L("Adn") == string )
       
   602         {
       
   603         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
   604         iPhoneBookName = KETelIccAdnPhoneBook;
       
   605         // Set package data
       
   606         package.SetPhoneBookName( iPhoneBookName );
       
   607         package.PackData( &iPBStoreCacheAdn );
       
   608         // Reallocating ADN phonebook store array to simulate error case
       
   609         delete iPBStoreCacheAdn;
       
   610         iPBStoreCacheAdn = NULL;
       
   611         iPBStoreCacheAdn = new ( ELeave )
       
   612                            CArrayPtrSeg<CPhoneBookStoreEntry>( 1 );
       
   613         _LIT8(KAdnPBReallocation, "ADN PB entries array reallocated");
       
   614         iSIMLog->Log((TDesC8)KAdnPBReallocation);
       
   615         }
       
   616     else if ( _L("Fdn") == string )
       
   617         {
       
   618         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
   619         iPhoneBookName = KETelIccFdnPhoneBook;
       
   620         // Set package data
       
   621         package.SetPhoneBookName( iPhoneBookName );
       
   622         package.PackData( &iPBStoreCacheFdn );
       
   623         // Reallocating FDN phonebook store array to simulate error case
       
   624         delete iPBStoreCacheFdn;
       
   625         iPBStoreCacheFdn = NULL;
       
   626         iPBStoreCacheFdn = new ( ELeave )
       
   627                            CArrayPtrSeg<CPhoneBookStoreEntry>( 1 );
       
   628         _LIT8(KFdnPBReallocation, "FDN PB entries array reallocated");
       
   629         iSIMLog->Log((TDesC8)KFdnPBReallocation);
       
   630         }
       
   631     else if ( _L("Sdn") == string )
       
   632         {
       
   633         iSIMLog->Log((TDesC8)KSdnPhoneBook);
       
   634         iPhoneBookName = KETelIccSdnPhoneBook;
       
   635         // Set package data
       
   636         package.SetPhoneBookName( iPhoneBookName );
       
   637         package.PackData( &iPBStoreCacheSdn );
       
   638         // Reallocating SDN phonebook store array to simulate error case
       
   639         delete iPBStoreCacheSdn;
       
   640         iPBStoreCacheSdn = NULL;
       
   641         iPBStoreCacheSdn = new ( ELeave )
       
   642                            CArrayPtrSeg<CPhoneBookStoreEntry>( 1 );
       
   643         _LIT8(KSdnPBReallocation, "SDN PB entries array reallocated");
       
   644         iSIMLog->Log((TDesC8)KSdnPBReallocation);
       
   645         }
       
   646     else
       
   647         {
       
   648          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
   649         iSIMLog->Log((TDesC8)KNotSupp);
       
   650         supported = EFalse;
       
   651         }
       
   652 
       
   653     if ( supported )
       
   654         {
       
   655         ret = HandleRequestL( EMmTsyPhoneBookStoreCacheCancelIPC,
       
   656                              &package );
       
   657         if ( KErrNone == ret )
       
   658             {
       
   659             _LIT8( KSendOk, "PbStoreCacheCancel request send ok" );
       
   660             iSIMLog->Log((TDesC8)KSendOk );
       
   661             }
       
   662         else
       
   663             {
       
   664              _LIT8( KSendFailed, "PbStoreCacheCancel request send failed: %d" );
       
   665             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
   666             }
       
   667         }
       
   668     else
       
   669         {
       
   670         ret = KErrNotSupported;
       
   671         }
       
   672 
       
   673     return ret;
       
   674     }
       
   675 
       
   676 // -----------------------------------------------------------------------------
       
   677 // CSIM::CompletePbStoreCache
       
   678 // Complete PbStoreCache method function.
       
   679 // -----------------------------------------------------------------------------
       
   680 //
       
   681 void CSIM::CompletePbStoreCache
       
   682         (
       
   683         TInt aResult,
       
   684         CMmDataPackage* aDataPackage
       
   685         )
       
   686     {
       
   687     _LIT8( KResult, "CompletePbStoreCache result: %d" );
       
   688     iSIMLog->Log((TDesC8)KResult, aResult );
       
   689 
       
   690     if ( KErrNone == aResult )
       
   691         {
       
   692         const CPhoneBookDataPackage* phoneBookData =
       
   693             static_cast<const CPhoneBookDataPackage*>(aDataPackage);
       
   694 
       
   695         TName pbName;
       
   696         phoneBookData->GetPhoneBookName( pbName );
       
   697 
       
   698         // Later return value will be set as a value for aResult if
       
   699         // response data is checked for this case in function called below
       
   700         ( void ) ReadEntriesFromArray( EPBStoreCacheArray, pbName );
       
   701 
       
   702         // check phonebook name
       
   703         if( iHandleSpecifiedRequests )
       
   704             {
       
   705             if( iPhoneBookName != pbName )
       
   706                 {
       
   707                 aResult = KErrGeneral;
       
   708                 }
       
   709             }
       
   710 
       
   711         // Check number of cached phonebook entries
       
   712         if ( -1 != iSavedPbEntriesCount )
       
   713             {
       
   714             aResult = CheckNumberOfPbEntries( EPBStoreCacheArray, pbName );
       
   715             }
       
   716         }
       
   717     else
       
   718         {
       
   719         _LIT8( KFail, "CompletePbStoreCache Failed: %d" );
       
   720         iSIMLog->Log((TDesC8)KFail, aResult );
       
   721         }
       
   722 
       
   723     // complete if failure
       
   724     if( KErrNone != aResult )
       
   725         {
       
   726         Signal( aResult );
       
   727         }
       
   728     // complete if test is not ongoing
       
   729     else if( ! iTestOngoing )
       
   730         {
       
   731         Signal( aResult );
       
   732         }
       
   733     iTestOngoing = EFalse;
       
   734     }
       
   735 
       
   736 // -----------------------------------------------------------------------------
       
   737 // CSIM::ReadEntriesL
       
   738 // Read phone book entries
       
   739 // -----------------------------------------------------------------------------
       
   740 //
       
   741 TInt CSIM::ReadEntriesL( CStifItemParser& aItem )
       
   742     {
       
   743     _LIT8(KReadEntries, "SIM::ReadEntries");
       
   744     iSIMLog->Log((TDesC8)KReadEntries);
       
   745 
       
   746     TInt ret( KErrNotFound );
       
   747     TBool supported( ETrue );
       
   748     TPtrC string;
       
   749     TPtrC string2;
       
   750     TInt indexToRead;
       
   751     TInt numEntriesToRead;
       
   752 
       
   753     // 1. parameter = phonebook name
       
   754     aItem.GetNextString( string );
       
   755     // 2. parameter = index to be read
       
   756     aItem.GetNextInt( indexToRead );
       
   757     // 3. parameter = number of entries to be read
       
   758     aItem.GetNextInt( numEntriesToRead );
       
   759 
       
   760     // for checking the validity of response data
       
   761 
       
   762     // 4. parameter = name
       
   763     aItem.GetNextString( string2 );
       
   764     iSavedNameForComparison[0].Zero();
       
   765     iSavedNameForComparison[0].Append( string2 );
       
   766 
       
   767     // 5. parameter = number
       
   768     aItem.GetNextString( string2 );
       
   769     iSavedNumberForComparison[0].Zero();
       
   770     iSavedNumberForComparison[0].Append( string2 );
       
   771 
       
   772     // 6. parameter = email
       
   773     aItem.GetNextString( string2 );
       
   774     iSavedEmailForComparison[0].Zero();
       
   775     iSavedEmailForComparison[0].Append( string2 );
       
   776 
       
   777     // 7. parameter = SNE
       
   778     aItem.GetNextString( string2 );
       
   779     iSavedSneForComparison[0].Zero();
       
   780     iSavedSneForComparison[0].Append( string2 );
       
   781 
       
   782     // 8.parameter = ANR
       
   783     aItem.GetNextString( string2 );
       
   784     iSavedAnrForComparison[0].Zero();
       
   785     iSavedAnrForComparison[0].Append( string2 );
       
   786 
       
   787     // if there is second entry to be read, use index 1
       
   788     // 9. parameter = name
       
   789     aItem.GetNextString( string2 );
       
   790     iSavedNameForComparison[1].Zero();
       
   791     iSavedNameForComparison[1].Append( string2 );
       
   792 
       
   793     // 10. parameter = number
       
   794     aItem.GetNextString( string2 );
       
   795     iSavedNumberForComparison[1].Zero();
       
   796     iSavedNumberForComparison[1].Append( string2 );
       
   797 
       
   798     // 11. parameter = email
       
   799     aItem.GetNextString( string2 );
       
   800     iSavedEmailForComparison[1].Zero();
       
   801     iSavedEmailForComparison[1].Append( string2 );
       
   802 
       
   803     // 12. parameter = SNE
       
   804     aItem.GetNextString( string2 );
       
   805     iSavedSneForComparison[1].Zero();
       
   806     iSavedSneForComparison[1].Append( string2 );
       
   807 
       
   808     // 13.parameter = ANR
       
   809     aItem.GetNextString( string2 );
       
   810     iSavedAnrForComparison[1].Zero();
       
   811     iSavedAnrForComparison[1].Append( string2 );
       
   812 
       
   813 
       
   814     if ( _L("Adn") == string )
       
   815         {
       
   816         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
   817         iPhoneBookName = KETelIccAdnPhoneBook;
       
   818         }
       
   819     else if ( _L("Fdn") == string )
       
   820         {
       
   821         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
   822         iPhoneBookName = KETelIccFdnPhoneBook;
       
   823         }
       
   824     else if ( _L("MBDN") == string )
       
   825         {
       
   826         iSIMLog->Log((TDesC8)KMBDN);
       
   827         iPhoneBookName = KETelIccMbdnPhoneBook;
       
   828         }
       
   829     else
       
   830         {
       
   831          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
   832         iSIMLog->Log((TDesC8)KNotSupp);
       
   833         supported = EFalse;
       
   834         }
       
   835 
       
   836     if ( supported )
       
   837         {
       
   838         iIndexAndEntries->iIndex = indexToRead;
       
   839         iIndexAndEntries->iNumSlots = numEntriesToRead;
       
   840 
       
   841         //Create package
       
   842         CPhoneBookDataPackage package;
       
   843         // Set package data
       
   844         package.SetPhoneBookName( iPhoneBookName );
       
   845         package.PackData( &iIndexAndEntries, &iPBStoreReadEntries );
       
   846 
       
   847         ret = HandleRequestL( EMmTsyPhoneBookStoreReadIPC,
       
   848                              &package );
       
   849 
       
   850         if ( KErrNone == ret )
       
   851             {
       
   852             _LIT8( KSendOk, "ReadEntries request send ok" );
       
   853             iSIMLog->Log((TDesC8)KSendOk );
       
   854             }
       
   855         else
       
   856             {
       
   857              _LIT8( KSendFailed, "ReadEntries request send failed: %d" );
       
   858             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
   859             }
       
   860         }
       
   861     else
       
   862         {
       
   863         ret = KErrNotSupported;
       
   864         }
       
   865 
       
   866     return ret;
       
   867 
       
   868     }
       
   869 
       
   870 // -----------------------------------------------------------------------------
       
   871 // CSIM::CompleteReadEntries
       
   872 // Complete ReadEntries method function.
       
   873 // -----------------------------------------------------------------------------
       
   874 //
       
   875 void CSIM::CompleteReadEntries
       
   876         (
       
   877         TInt aResult
       
   878         )
       
   879     {
       
   880     _LIT8( KResult, "CompleteReadEntries result: %d" );
       
   881     iSIMLog->Log((TDesC8)KResult, aResult );
       
   882 
       
   883     if( KErrNone == aResult )
       
   884         {
       
   885         aResult = ReadEntriesFromArray( EPBStoreReadEntriesArray, iPhoneBookName );
       
   886         }
       
   887     else
       
   888         {
       
   889         _LIT8( KFail, "CompleteReadEntries Failed: %d" );
       
   890         iSIMLog->Log((TDesC8)KFail, aResult );
       
   891         }
       
   892 
       
   893     Signal( aResult );
       
   894     }
       
   895 
       
   896 // -----------------------------------------------------------------------------
       
   897 // CSIM::ReadEntriesFromArray
       
   898 // Prints Pb entries
       
   899 // -----------------------------------------------------------------------------
       
   900 //
       
   901 TInt CSIM::ReadEntriesFromArray(
       
   902     TPBArrayTypeToRead aArrayType,
       
   903     TDesC16& aPbName )
       
   904 
       
   905     {
       
   906     TInt result = KErrNone;
       
   907     TInt num;
       
   908 
       
   909     _LIT8(KReadEntriesFromArray, "SIM::ReadEntriesFromArray");
       
   910     iSIMLog->Log((TDesC8)KReadEntriesFromArray);
       
   911 
       
   912     CArrayPtrSeg<CPhoneBookStoreEntry>* ptrToArray = NULL;
       
   913 
       
   914     if ( EPBStoreCacheArray == aArrayType )
       
   915         {
       
   916         if ( 0 == aPbName.CompareF( KETelIccAdnPhoneBook ) )
       
   917             {
       
   918             ptrToArray = iPBStoreCacheAdn;
       
   919             _LIT8(KADN, "ADN entries: ");
       
   920             iSIMLog->Log((TDesC8)KADN);
       
   921             }
       
   922         else if ( 0 == aPbName.CompareF( KETelIccFdnPhoneBook ) )
       
   923             {
       
   924             ptrToArray = iPBStoreCacheFdn;
       
   925             _LIT8(KFDN, "FDN entries: ");
       
   926             iSIMLog->Log((TDesC8)KFDN);
       
   927             }
       
   928         else if ( 0 == aPbName.CompareF( KETelIccSdnPhoneBook ) )
       
   929             {
       
   930             ptrToArray = iPBStoreCacheSdn;
       
   931             _LIT8(KSDN, "SDN entries: ");
       
   932             iSIMLog->Log((TDesC8)KSDN);
       
   933             }
       
   934         }
       
   935     else if ( EPBStoreReadEntriesArray == aArrayType )
       
   936         {
       
   937         ptrToArray = iPBStoreReadEntries;
       
   938         }
       
   939 
       
   940     for ( TInt locationIndex = 0; locationIndex < ptrToArray->Count();
       
   941           locationIndex++ )
       
   942         {
       
   943         CPhoneBookStoreEntry* ptr;
       
   944         ptr = ptrToArray->At( locationIndex );
       
   945 
       
   946         iSIMLog->Log((TDesC8)KLine);
       
   947         _LIT8( KLocation, "Location: %d" );
       
   948         iSIMLog->Log((TDesC8)KLocation, ptr->iLocation );
       
   949 
       
   950         // Name
       
   951         if ( ptr->iText && ( 0 < ptr->iText->Size() ) )
       
   952             {
       
   953             _LIT8( KName, "Name:" );
       
   954             iSIMLog->Log((TDesC8)KName);
       
   955             iSIMLog->Log( *(ptr->iText ));
       
   956 
       
   957             if ( ( 0 != iSavedNameForComparison[locationIndex].Compare ( _L ( "DONTCARE" ) ) ) &&
       
   958                  ( KErrNone == result ) )
       
   959                 {
       
   960                 if ( iSavedNameForComparison[locationIndex] != *(ptr->iText ) )
       
   961                     {
       
   962                     result = KErrGeneral;
       
   963                     }
       
   964                 }
       
   965             }
       
   966 
       
   967         // Number
       
   968         if ( ptr->iNumber && ( 0 < ptr->iNumber->Size() ) )
       
   969             {
       
   970             _LIT8( KNumber, "Number:" );
       
   971             iSIMLog->Log((TDesC8)KNumber);
       
   972             iSIMLog->Log( *(ptr->iNumber ));
       
   973 
       
   974             if ( ( 0 != iSavedNumberForComparison[locationIndex].Compare ( _L ( "DONTCARE" ) ) ) &&
       
   975                  ( KErrNone == result ) )
       
   976                 {
       
   977                 if ( iSavedNumberForComparison[locationIndex] != *(ptr->iNumber ) )
       
   978                     {
       
   979                     result = KErrGeneral;
       
   980                     }
       
   981                 }
       
   982             }
       
   983 
       
   984         // Email
       
   985         if (ptr->iEmail && (0 < ptr->iEmail->MdcaCount()))
       
   986             {
       
   987             for( num = 0; num < ptr->iEmail->MdcaCount(); num++)
       
   988                 {
       
   989                 _LIT8( KEmail, "Email:" );
       
   990                 iSIMLog->Log((TDesC8)KEmail);
       
   991                 iSIMLog->Log( (ptr->iEmail->MdcaPoint( num ) ));
       
   992 
       
   993                 if ( ( 0 != iSavedEmailForComparison[locationIndex].Compare ( _L ( "DONTCARE" ) ) ) &&
       
   994                         ( KErrNone == result ) )
       
   995                     {
       
   996                     TBuf<100> tempBuffer( ptr->iEmail->MdcaPoint( num ) );
       
   997                     if ( iSavedEmailForComparison[locationIndex] != tempBuffer )
       
   998                         {
       
   999                         result = KErrGeneral;
       
  1000                         }
       
  1001                     }
       
  1002                 }
       
  1003             }
       
  1004 
       
  1005         // Sne
       
  1006         if (ptr->iSne && (0 < ptr->iSne->MdcaCount()))
       
  1007             {
       
  1008             for( num = 0; num < ptr->iSne->MdcaCount(); num++)
       
  1009                 {
       
  1010                 _LIT8( KSne, "Sne:" );
       
  1011                 iSIMLog->Log((TDesC8)KSne);
       
  1012                 iSIMLog->Log( (ptr->iSne->MdcaPoint( num ) ));
       
  1013 
       
  1014                 if ( ( 0 != iSavedSneForComparison[locationIndex].Compare ( _L ( "DONTCARE" ) ) ) &&
       
  1015                         ( KErrNone == result ) )
       
  1016                     {
       
  1017                     TBuf<100> tempBuffer( ptr->iSne->MdcaPoint( num ) );
       
  1018                     if ( iSavedSneForComparison[locationIndex] != tempBuffer )
       
  1019                         {
       
  1020                         result = KErrGeneral;
       
  1021                         }
       
  1022                     }
       
  1023                 }
       
  1024             }
       
  1025 
       
  1026 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1027         if (ptr->iGrp && (0 < ptr->iGrp->MdcaCount()))
       
  1028             {
       
  1029             for(TInt num = 0; num < ptr->iGrp->MdcaCount(); num++)
       
  1030                 {
       
  1031                 _LIT8( KGrp, "Grp:" );
       
  1032                 iSIMLog->Log((TDesC8)KGrp);
       
  1033                 iSIMLog->Log( (ptr->iGrp->MdcaPoint( num ) ));
       
  1034                 }
       
  1035             }
       
  1036         if (ptr->iAnr && (0 < ptr->iAnr->Count()))
       
  1037             {
       
  1038             for(TInt num = 0; num < ptr->iAnr->Count(); num++)
       
  1039                 {
       
  1040                 TPhBkAdditionalEntry entry = ptr->iAnr->At(num);
       
  1041                 _LIT8( KAnrNum, "AnrNum:" );
       
  1042                 iSIMLog->Log((TDesC8)KAnrNum);
       
  1043                 iSIMLog->Log( entry.iTelNum );
       
  1044 
       
  1045                 if ( entry.iAlphaTag.Length())
       
  1046                     {
       
  1047                     _LIT8( KAas, "Aas:" );
       
  1048                     iSIMLog->Log((TDesC8)KAas);
       
  1049                     iSIMLog->Log( entry.iAlphaTag );
       
  1050                     }
       
  1051                 }
       
  1052             }
       
  1053 #else
       
  1054 
       
  1055         // Anr
       
  1056         if ( ptr->iAnr && (0 < ptr->iAnr->MdcaCount()))
       
  1057             {
       
  1058             for( num = 0; num < ptr->iAnr->MdcaCount(); num++)
       
  1059                 {
       
  1060                 _LIT8( KAnr, "Anr:" );
       
  1061                 iSIMLog->Log((TDesC8)KAnr);
       
  1062                 iSIMLog->Log( (ptr->iAnr->MdcaPoint( num ) ));
       
  1063                 if ( ( 0 != iSavedAnrForComparison[locationIndex].Compare ( _L ( "DONTCARE" ) ) ) &&
       
  1064                         ( KErrNone == result ) )
       
  1065                     {
       
  1066                     TBuf<100> tempBuffer( ptr->iAnr->MdcaPoint( num )  );
       
  1067                     if ( iSavedAnrForComparison[locationIndex] != tempBuffer )
       
  1068                         {
       
  1069                         result = KErrGeneral;
       
  1070                         }
       
  1071                     }
       
  1072                 }
       
  1073              }
       
  1074 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1075 
       
  1076         iSIMLog->Log((TDesC8)KLine);
       
  1077         }
       
  1078     return result;
       
  1079     }
       
  1080 
       
  1081 // -----------------------------------------------------------------------------
       
  1082 // CSIM::WriteEntriesL
       
  1083 // Checks number of PB entries in the cache
       
  1084 // -----------------------------------------------------------------------------
       
  1085 //
       
  1086 TInt CSIM::CheckNumberOfPbEntries( TPBArrayTypeToRead aArrayType,
       
  1087         TDesC16& aPbName )
       
  1088     {
       
  1089     TInt result( KErrNone );
       
  1090 
       
  1091     _LIT8(KCheckNumberOfPbEntries, "SIM::CheckNumberOfPbEntries");
       
  1092     iSIMLog->Log((TDesC8)KCheckNumberOfPbEntries);
       
  1093 
       
  1094     CArrayPtrSeg<CPhoneBookStoreEntry>* ptrToArray = NULL;
       
  1095 
       
  1096     if ( EPBStoreCacheArray == aArrayType )
       
  1097         {
       
  1098         if ( 0 == aPbName.CompareF( KETelIccAdnPhoneBook ) )
       
  1099             {
       
  1100             ptrToArray = iPBStoreCacheAdn;
       
  1101             _LIT8(KADN, "Checking number of ADN entries: ");
       
  1102             iSIMLog->Log((TDesC8)KADN);
       
  1103             }
       
  1104         else if ( 0 == aPbName.CompareF( KETelIccFdnPhoneBook ) )
       
  1105             {
       
  1106             ptrToArray = iPBStoreCacheFdn;
       
  1107             _LIT8(KFDN, "Checking number of FDN entries: ");
       
  1108             iSIMLog->Log((TDesC8)KFDN);
       
  1109             }
       
  1110         else if ( 0 == aPbName.CompareF( KETelIccSdnPhoneBook ) )
       
  1111             {
       
  1112             ptrToArray = iPBStoreCacheSdn;
       
  1113             _LIT8(KSDN, "Checking number of SDN entries: ");
       
  1114             iSIMLog->Log((TDesC8)KSDN);
       
  1115             }
       
  1116         }
       
  1117     else if ( EPBStoreReadEntriesArray == aArrayType )
       
  1118         {
       
  1119         ptrToArray = iPBStoreReadEntries;
       
  1120         }
       
  1121 
       
  1122     if ( ptrToArray->Count() != iSavedPbEntriesCount )
       
  1123         {
       
  1124         _LIT8(KEntriesNumberDoesNotMatch, "PB entries number does not match: \
       
  1125                 exp=%d, act=%d");
       
  1126         iSIMLog->Log((TDesC8)KEntriesNumberDoesNotMatch,
       
  1127                 iSavedPbEntriesCount, ptrToArray->Count());
       
  1128         result = KErrGeneral;
       
  1129         }
       
  1130 
       
  1131     return result;
       
  1132     }
       
  1133 
       
  1134 // -----------------------------------------------------------------------------
       
  1135 // CSIM::WriteEntriesL
       
  1136 // Writes a PB entry
       
  1137 // -----------------------------------------------------------------------------
       
  1138 //
       
  1139 TInt CSIM::WriteEntriesL( CStifItemParser& aItem )
       
  1140     {
       
  1141     _LIT8(KReadEntries, "SIM::WriteEntriesL");
       
  1142     iSIMLog->Log((TDesC8)KReadEntries);
       
  1143 
       
  1144     TInt ret( KErrNotFound );
       
  1145     TBool supported( ETrue );
       
  1146     TPtrC string;
       
  1147     TInt index;
       
  1148     TPtrC16 name;
       
  1149     TPtrC16 number;
       
  1150     TPtrC16 email;
       
  1151     TPtrC16 sne;
       
  1152     TPtrC16 anr;
       
  1153 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1154     TPtrC16 aas;
       
  1155     TPtrC16 grp;
       
  1156 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1157 
       
  1158     // store given parameters for checking validity of completed data
       
  1159     if ( iHandleSpecifiedRequests )
       
  1160         {
       
  1161         aItem.GetNextInt( index );
       
  1162         iPbEntryInfo.iLocation = ( TUint16 )index;
       
  1163         aItem.GetNextInt( index );
       
  1164         iPbEntryInfo.iMaxNumLength = index;
       
  1165         }
       
  1166 
       
  1167     aItem.GetNextString( string );
       
  1168     aItem.GetNextInt( index );
       
  1169 
       
  1170     if ( _L("Adn") == string )
       
  1171         {
       
  1172         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  1173         iPhoneBookName = KETelIccAdnPhoneBook;
       
  1174         }
       
  1175     else if( _L("Fdn") == string )
       
  1176         {
       
  1177         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  1178         iPhoneBookName = KETelIccFdnPhoneBook;
       
  1179         }
       
  1180     else if( _L("MBDN") == string )
       
  1181         {
       
  1182         iSIMLog->Log((TDesC8)KMBDN);
       
  1183         iPhoneBookName = KETelIccMbdnPhoneBook;
       
  1184         }
       
  1185     else
       
  1186         {
       
  1187          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  1188         iSIMLog->Log((TDesC8)KNotSupp);
       
  1189         supported = EFalse;
       
  1190         }
       
  1191 
       
  1192     if ( supported )
       
  1193         {
       
  1194         // NOTE: when this entry is created, it is always
       
  1195         // put on the cache in succesful case.
       
  1196         iPhoneBookEntry = new ( ELeave ) CPhoneBookStoreEntry();
       
  1197         iPhoneBookEntry->ConstructL();
       
  1198 
       
  1199         if ( KErrNone == aItem.GetNextString( name ) )
       
  1200             {
       
  1201             iPhoneBookEntry->iText =
       
  1202                 HBufC::NewLC( name.Length() );
       
  1203             iPhoneBookEntry->iText->Des() = name;
       
  1204             CleanupStack::Pop( iPhoneBookEntry->iText );
       
  1205             }
       
  1206         if ( KErrNone == aItem.GetNextString( number ) )
       
  1207             {
       
  1208             iPhoneBookEntry->iNumber = HBufC::NewLC( number.Length() );
       
  1209             iPhoneBookEntry->iNumber->Des() = number;
       
  1210             CleanupStack::Pop( iPhoneBookEntry->iNumber );
       
  1211             }
       
  1212         if ( KErrNone == aItem.GetNextString( email ) )
       
  1213             {
       
  1214             iPhoneBookEntry->iEmail->AppendL( email );
       
  1215             }
       
  1216         if ( KErrNone == aItem.GetNextString( sne ) )
       
  1217             {
       
  1218             iPhoneBookEntry->iSne->AppendL( sne );
       
  1219             }
       
  1220         if ( KErrNone == aItem.GetNextString( anr ) )
       
  1221             {
       
  1222 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1223             TPhBkAdditionalEntry entry;
       
  1224             entry.iTelNum.Copy(anr);
       
  1225             if( KErrNone == aItem.GetNextString( aas ) )
       
  1226                 {
       
  1227                 entry.iAlphaTag.Copy(aas);
       
  1228                 }
       
  1229             iPhoneBookEntry->iAnr->AppendL( entry );
       
  1230 #else // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1231             iPhoneBookEntry->iAnr->AppendL( anr );
       
  1232 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1233             }
       
  1234 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1235         if ( KErrNone == aItem.GetNextString( grp ) )
       
  1236             {
       
  1237             iPhoneBookEntry->iGrp->AppendL( grp );
       
  1238             }
       
  1239 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  1240 
       
  1241         //Create package
       
  1242         CPhoneBookDataPackage package;
       
  1243         // Set package data
       
  1244         package.SetPhoneBookName( iPhoneBookName );
       
  1245         package.PackData( &index, &iPhoneBookEntry );
       
  1246 
       
  1247         ret = HandleRequestL( EMmTsyPhoneBookStoreWriteIPC,
       
  1248                              &package );
       
  1249 
       
  1250         if ( KErrNone == ret )
       
  1251             {
       
  1252             _LIT8( KSendOk, "WriteEntries request send ok" );
       
  1253             iSIMLog->Log((TDesC8)KSendOk );
       
  1254             }
       
  1255         else
       
  1256             {
       
  1257              _LIT8( KSendFailed, "WriteEntries request send failed: %d" );
       
  1258             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1259 
       
  1260             // Delete phonebook write entry
       
  1261             if ( iPhoneBookEntry )
       
  1262                 {
       
  1263                 delete iPhoneBookEntry;
       
  1264                 iPhoneBookEntry = NULL;
       
  1265                 }
       
  1266             }
       
  1267         }
       
  1268     else
       
  1269         {
       
  1270         ret = KErrNotSupported;
       
  1271         }
       
  1272 
       
  1273     return ret;
       
  1274 
       
  1275     }
       
  1276 
       
  1277 // -----------------------------------------------------------------------------
       
  1278 // CSIM::CompleteWriteEntries
       
  1279 // Complete PbInit method function.
       
  1280 // -----------------------------------------------------------------------------
       
  1281 //
       
  1282 void CSIM::CompleteWriteEntries
       
  1283         (
       
  1284         TInt aResult,
       
  1285         CMmDataPackage* aDataPackage
       
  1286         )
       
  1287     {
       
  1288     _LIT8( KResult, "CompleteWriteEntries result: %d" );
       
  1289     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1290 
       
  1291     if( KErrNone == aResult )
       
  1292         {
       
  1293         // Response information
       
  1294         TPBEntryInfo entryInfo;
       
  1295         //unpack data
       
  1296         aDataPackage->UnPackData( entryInfo );
       
  1297 
       
  1298         // check data validity
       
  1299         if( iHandleSpecifiedRequests )
       
  1300             {
       
  1301             if( entryInfo.iLocation != iPbEntryInfo.iLocation ||
       
  1302                  entryInfo.iMaxNumLength != iPbEntryInfo.iMaxNumLength )
       
  1303                 {
       
  1304                 aResult = KErrArgument;
       
  1305                 }
       
  1306             }
       
  1307 
       
  1308         _LIT8( KEntryInfo, "EntryInfo: MaxNumLength = %d, Location = %d" );
       
  1309         iSIMLog->Log((TDesC8)KEntryInfo, entryInfo.iMaxNumLength, entryInfo.iLocation );
       
  1310         }
       
  1311     else
       
  1312         {
       
  1313         _LIT8( KFail, "CompleteWriteEntries Failed: %d" );
       
  1314         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1315         }
       
  1316 
       
  1317     Signal( aResult );
       
  1318     }
       
  1319 
       
  1320 // -----------------------------------------------------------------------------
       
  1321 // CSIM::DeleteEntryL
       
  1322 // Deletes antry from sim phone book
       
  1323 // -----------------------------------------------------------------------------
       
  1324 //
       
  1325 TInt CSIM::DeleteEntryL( CStifItemParser& aItem )
       
  1326     {
       
  1327     _LIT8(KDeleteEntry, "SIM::DeleteEntry");
       
  1328     iSIMLog->Log((TDesC8)KDeleteEntry);
       
  1329 
       
  1330     TInt ret( KErrNotFound );
       
  1331     TBool supported( ETrue );
       
  1332     TPtrC string;
       
  1333     TInt index;
       
  1334 
       
  1335     // store given parameters for checking validity of completed data
       
  1336     if( iHandleSpecifiedRequests )
       
  1337         {
       
  1338         aItem.GetNextInt( index );
       
  1339         iPbEntryInfo.iLocation = ( TUint16 )index;
       
  1340         aItem.GetNextInt( index );
       
  1341         iPbEntryInfo.iMaxNumLength = index;
       
  1342         }
       
  1343 
       
  1344     aItem.GetNextString ( string );
       
  1345     aItem.GetNextInt( index );
       
  1346 
       
  1347     if ( _L("Adn") == string )
       
  1348         {
       
  1349         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  1350         iPhoneBookName = KETelIccAdnPhoneBook;
       
  1351         }
       
  1352     else if( _L("Fdn") == string )
       
  1353         {
       
  1354         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  1355         iPhoneBookName = KETelIccFdnPhoneBook;
       
  1356         }
       
  1357     else if( _L("MBDN") == string )
       
  1358         {
       
  1359         iSIMLog->Log((TDesC8)KMBDN);
       
  1360         iPhoneBookName = KETelIccMbdnPhoneBook;
       
  1361         }
       
  1362     else
       
  1363         {
       
  1364          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  1365         iSIMLog->Log((TDesC8)KNotSupp);
       
  1366         supported = EFalse;
       
  1367         }
       
  1368 
       
  1369     if( supported )
       
  1370         {
       
  1371         //Create package
       
  1372         CPhoneBookDataPackage package;
       
  1373         // Set package data
       
  1374         package.SetPhoneBookName( iPhoneBookName );
       
  1375         package.PackData( &index );
       
  1376 
       
  1377         ret = HandleRequestL( EMmTsyPhoneBookStoreDeleteIPC,
       
  1378                              &package );
       
  1379 
       
  1380         if ( KErrNone == ret )
       
  1381             {
       
  1382             _LIT8( KSendOk, "DeleteEntry request send ok" );
       
  1383             iSIMLog->Log((TDesC8)KSendOk );
       
  1384             }
       
  1385         else
       
  1386             {
       
  1387              _LIT8( KSendFailed, "DeleteEntry request send failed: %d" );
       
  1388             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1389 
       
  1390             }
       
  1391         }
       
  1392     else
       
  1393         {
       
  1394         ret = KErrNotSupported;
       
  1395         }
       
  1396 
       
  1397     return ret;
       
  1398 
       
  1399     }
       
  1400 
       
  1401 // -----------------------------------------------------------------------------
       
  1402 // CSIM::CompleteDelete
       
  1403 // Complete DeleteEntry method function.
       
  1404 // -----------------------------------------------------------------------------
       
  1405 //
       
  1406 void CSIM::CompleteDelete
       
  1407         (
       
  1408         TInt aResult,
       
  1409         CMmDataPackage* aDataPackage
       
  1410         )
       
  1411     {
       
  1412     _LIT8( KResult, "CompleteDelete result: %d" );
       
  1413     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1414 
       
  1415     if( KErrNone == aResult )
       
  1416         {
       
  1417         // Response information
       
  1418         TPBEntryInfo entryInfo;
       
  1419         //unpack data
       
  1420         aDataPackage->UnPackData( entryInfo );
       
  1421 
       
  1422         // check data validity
       
  1423         if( iHandleSpecifiedRequests )
       
  1424             {
       
  1425             if( entryInfo.iLocation != iPbEntryInfo.iLocation ||
       
  1426                  entryInfo.iMaxNumLength != iPbEntryInfo.iMaxNumLength )
       
  1427                 {
       
  1428                 aResult = KErrGeneral;
       
  1429                 }
       
  1430             }
       
  1431 
       
  1432         _LIT8( KEntryInfo, "EntryInfo: MaxNumLength = %d" );
       
  1433         iSIMLog->Log((TDesC8)KEntryInfo, entryInfo.iMaxNumLength  );
       
  1434         }
       
  1435     else
       
  1436         {
       
  1437         _LIT8( KFail, "CompleteDelete Failed: %d" );
       
  1438         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1439         }
       
  1440 
       
  1441     Signal( aResult );
       
  1442     }
       
  1443 
       
  1444 // -----------------------------------------------------------------------------
       
  1445 // CSIM::DeleteAllEntriesL
       
  1446 // Deletes all entries from sim phone book
       
  1447 // -----------------------------------------------------------------------------
       
  1448 //
       
  1449 TInt CSIM::DeleteAllEntriesL( CStifItemParser& aItem )
       
  1450     {
       
  1451     _LIT8(KDeleteEntry, "SIM::DeleteAllEntries");
       
  1452     iSIMLog->Log((TDesC8)KDeleteEntry);
       
  1453 
       
  1454     TInt ret( KErrNotFound );
       
  1455     TInt index;
       
  1456     TBool supported( ETrue );
       
  1457     TPtrC string;
       
  1458 
       
  1459     // store given parameters for checking validity of completed data
       
  1460     if ( iHandleSpecifiedRequests )
       
  1461         {
       
  1462         aItem.GetNextInt( index );
       
  1463         iPbEntryInfo.iLocation = ( TUint16 )index;
       
  1464         aItem.GetNextInt( index );
       
  1465         iPbEntryInfo.iMaxNumLength = index;
       
  1466         }
       
  1467 
       
  1468     aItem.GetNextString ( string );
       
  1469 
       
  1470     if ( _L("Adn") == string )
       
  1471         {
       
  1472         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  1473         iPhoneBookName = KETelIccAdnPhoneBook;
       
  1474         }
       
  1475     else if( _L("Fdn") == string )
       
  1476         {
       
  1477         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  1478         iPhoneBookName = KETelIccFdnPhoneBook;
       
  1479         }
       
  1480     else
       
  1481         {
       
  1482          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  1483         iSIMLog->Log((TDesC8)KNotSupp);
       
  1484         supported = EFalse;
       
  1485         }
       
  1486 
       
  1487     if( supported )
       
  1488         {
       
  1489         //Create package
       
  1490         CPhoneBookDataPackage package;
       
  1491         // Set package data
       
  1492         package.SetPhoneBookName( iPhoneBookName );
       
  1493 
       
  1494         ret = HandleRequestL( EMmTsyPhoneBookStoreDeleteAllIPC,
       
  1495                              &package );
       
  1496 
       
  1497         if ( KErrNone == ret )
       
  1498             {
       
  1499             _LIT8( KSendOk, "DeleteAllEntries request send ok" );
       
  1500             iSIMLog->Log((TDesC8)KSendOk );
       
  1501             }
       
  1502         else
       
  1503             {
       
  1504              _LIT8( KSendFailed, "DeleteAllEntries request send failed: %d" );
       
  1505             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1506 
       
  1507             }
       
  1508         }
       
  1509     else
       
  1510         {
       
  1511         ret = KErrNotSupported;
       
  1512         }
       
  1513 
       
  1514     return ret;
       
  1515 
       
  1516     }
       
  1517 
       
  1518 // -----------------------------------------------------------------------------
       
  1519 // CSIM::GetPbStoreInfoL
       
  1520 // Get phone book store info
       
  1521 // -----------------------------------------------------------------------------
       
  1522 //
       
  1523 TInt CSIM::GetPbStoreInfoL( CStifItemParser& aItem )
       
  1524     {
       
  1525     _LIT8(KDeleteEntry, "SIM::GetPbStoreInfo");
       
  1526     iSIMLog->Log((TDesC8)KDeleteEntry);
       
  1527 
       
  1528     TInt ret( KErrNotFound );
       
  1529     TBool supported( ETrue );
       
  1530     TPtrC string;
       
  1531     aItem.GetNextString ( string );
       
  1532 
       
  1533     // for checking the validity of response data
       
  1534     if( iHandleSpecifiedRequests )
       
  1535         {
       
  1536         aItem.GetNextInt( iNumOfUsedPbEntries );
       
  1537         }
       
  1538 
       
  1539 
       
  1540     if ( _L("Adn") == string )
       
  1541         {
       
  1542         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  1543         iPhoneBookName = KETelIccAdnPhoneBook;
       
  1544         }
       
  1545     else if( _L("Fdn") == string )
       
  1546         {
       
  1547         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  1548         iPhoneBookName = KETelIccFdnPhoneBook;
       
  1549         }
       
  1550     else if ( _L("VoiceMailBox") == string )
       
  1551         {
       
  1552         iSIMLog->Log((TDesC8)KVoiceMailBox);
       
  1553         iPhoneBookName = KETelIccVoiceMailBox;
       
  1554         }
       
  1555     else
       
  1556         {
       
  1557          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  1558         iSIMLog->Log((TDesC8)KNotSupp);
       
  1559         supported = EFalse;
       
  1560         }
       
  1561 
       
  1562     if( supported )
       
  1563         {
       
  1564         //Create package
       
  1565         CPhoneBookDataPackage package;
       
  1566         // Set package data
       
  1567         package.SetPhoneBookName( iPhoneBookName );
       
  1568 
       
  1569         ret = HandleRequestL( EMmTsyPhoneBookStoreGetInfoIPC,
       
  1570                              &package );
       
  1571 
       
  1572         if ( KErrNone == ret )
       
  1573             {
       
  1574             _LIT8( KSendOk, "GetPbStoreInfo request send ok" );
       
  1575             iSIMLog->Log((TDesC8)KSendOk );
       
  1576             }
       
  1577         else
       
  1578             {
       
  1579              _LIT8( KSendFailed, "GetPbStoreInfo request send failed: %d" );
       
  1580             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1581 
       
  1582             }
       
  1583         }
       
  1584     else
       
  1585         {
       
  1586         ret = KErrNotSupported;
       
  1587         }
       
  1588 
       
  1589     return ret;
       
  1590 
       
  1591     }
       
  1592 // -----------------------------------------------------------------------------
       
  1593 // CSIM::CompleteGetPbStoreInfo
       
  1594 // Complete GetPbStoreInfo method function.
       
  1595 // -----------------------------------------------------------------------------
       
  1596 //
       
  1597 void CSIM::CompleteGetPbStoreInfo
       
  1598         (
       
  1599         TInt aResult,
       
  1600         CMmDataPackage* aDataPackage
       
  1601         )
       
  1602     {
       
  1603     _LIT8( KResult, "CompleteGetPbStoreInfo result: %d" );
       
  1604     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1605 
       
  1606     if( KErrNone == aResult )
       
  1607         {
       
  1608         // Response information
       
  1609         TInt numberOfusedPbEntries;
       
  1610         //unpack data
       
  1611         aDataPackage->UnPackData( numberOfusedPbEntries );
       
  1612 
       
  1613         if( iHandleSpecifiedRequests )
       
  1614             {
       
  1615             if( iNumOfUsedPbEntries != numberOfusedPbEntries )
       
  1616                 {
       
  1617                 aResult = KErrGeneral;
       
  1618                 }
       
  1619             }
       
  1620 
       
  1621         _LIT8( KPbStoreInfo, "PbStoreInfo: numberOfusedPbEntries = %d" );
       
  1622         iSIMLog->Log((TDesC8)KPbStoreInfo, numberOfusedPbEntries  );
       
  1623         }
       
  1624     else
       
  1625         {
       
  1626         _LIT8( KFail, "CompleteGetPbStoreInfo Failed: %d" );
       
  1627         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1628         }
       
  1629 
       
  1630     Signal( aResult );
       
  1631     }
       
  1632 
       
  1633 // -----------------------------------------------------------------------------
       
  1634 // CSIM::ReadENStore
       
  1635 // Read emergency number Store Info
       
  1636 // -----------------------------------------------------------------------------
       
  1637 //
       
  1638 TInt CSIM::ReadENStore( CStifItemParser& aItem )
       
  1639     {
       
  1640     _LIT8(KReadENStore, "SIM::ReadENStore");
       
  1641     iSIMLog->Log((TDesC8)KReadENStore);
       
  1642 
       
  1643     TInt ret( KErrNotFound );
       
  1644     aItem.GetNextInt( iIndex );
       
  1645 
       
  1646     // store given parameter for validity checking
       
  1647     if( iHandleSpecifiedRequests )
       
  1648         {
       
  1649         TPtrC string;
       
  1650         aItem.GetNextString( string );
       
  1651         iNumber.Append( string );
       
  1652         }
       
  1653     //Create package
       
  1654     CPhoneBookDataPackage package;
       
  1655     package.PackData( &iIndex );
       
  1656 
       
  1657     ret = HandleRequestL( EMmTsyENStoreReadIPC,
       
  1658                          &package );
       
  1659 
       
  1660     if ( KErrNone == ret )
       
  1661         {
       
  1662         _LIT8( KSendOk, "ReadENStore request send ok" );
       
  1663         iSIMLog->Log((TDesC8)KSendOk );
       
  1664         }
       
  1665     else
       
  1666         {
       
  1667          _LIT8( KSendFailed, "ReadENStore request send failed: %d" );
       
  1668         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1669 
       
  1670         }
       
  1671 
       
  1672     return ret;
       
  1673 
       
  1674     }
       
  1675 // -----------------------------------------------------------------------------
       
  1676 // CSIM::CompleteReadENStore
       
  1677 // Complete ReadENStore method function.
       
  1678 // -----------------------------------------------------------------------------
       
  1679 //
       
  1680 void CSIM::CompleteReadENStore
       
  1681         (
       
  1682         TInt aResult,
       
  1683         CMmDataPackage* aDataPackage
       
  1684         )
       
  1685     {
       
  1686     _LIT8( KResult, "CompleteReadENStore result: %d" );
       
  1687     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1688 
       
  1689     if( KErrNone == aResult )
       
  1690         {
       
  1691         // Response information
       
  1692         TENStoreResponse enStoreResp;
       
  1693         //unpack data
       
  1694         aDataPackage->UnPackData( enStoreResp );
       
  1695 
       
  1696         iSIMLog->Log((TDesC8)KLine );
       
  1697         _LIT8( KPbStoreInfo, "ENStore Location: %d " );
       
  1698         iSIMLog->Log((TDesC8)KPbStoreInfo, enStoreResp.iLocation );
       
  1699 
       
  1700         _LIT8( KNumber, "ENStore Number:" );
       
  1701         iSIMLog->Log((TDesC8)KNumber);
       
  1702         iSIMLog->Log( enStoreResp.iECCNumber);
       
  1703         iSIMLog->Log((TDesC8)KLine );
       
  1704 
       
  1705         // check data
       
  1706         if( iHandleSpecifiedRequests )
       
  1707             {
       
  1708             if( iIndex != enStoreResp.iLocation ||
       
  1709                 iNumber != enStoreResp.iECCNumber )
       
  1710                 {
       
  1711                 aResult = KErrGeneral;
       
  1712                 }
       
  1713             }
       
  1714         }
       
  1715     else
       
  1716         {
       
  1717         _LIT8( KFail, "CompleteReadENStore Failed: %d" );
       
  1718         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1719         }
       
  1720 
       
  1721     Signal( aResult );
       
  1722     }
       
  1723 
       
  1724 // -----------------------------------------------------------------------------
       
  1725 // CSIM::ReadENStoreAll
       
  1726 // Read emergency number Stotre Info
       
  1727 // -----------------------------------------------------------------------------
       
  1728 //
       
  1729 TInt CSIM::ReadENStoreAll( CStifItemParser& aItem )
       
  1730     {
       
  1731     _LIT8(KReadENStore, "SIM::ReadENStore");
       
  1732     iSIMLog->Log((TDesC8)KReadENStore);
       
  1733 
       
  1734     TInt ret( KErrNotFound );
       
  1735     TInt index;
       
  1736     aItem.GetNextInt( index );
       
  1737 
       
  1738     //Create package
       
  1739     CPhoneBookDataPackage package;
       
  1740     package.PackData( &index );
       
  1741 
       
  1742     // store given parameters for validity checking
       
  1743     if( iHandleSpecifiedRequests )
       
  1744         {
       
  1745         for ( TInt i = 0; i < 3; i++)
       
  1746             {
       
  1747             TPtrC string;
       
  1748             aItem.GetNextInt( iIndexTable[i] );
       
  1749             aItem.GetNextString( string );
       
  1750             iNumberTable[i].Append( string );
       
  1751             }
       
  1752         }
       
  1753 
       
  1754     ret = HandleRequestL( EMmTsyENStoreReadAllPhase1IPC,
       
  1755                          &package );
       
  1756 
       
  1757     if ( KErrNone == ret )
       
  1758         {
       
  1759         _LIT8( KSendOk, "ReadENStoreAll request send ok" );
       
  1760         iSIMLog->Log((TDesC8)KSendOk );
       
  1761         }
       
  1762     else
       
  1763         {
       
  1764          _LIT8( KSendFailed, "ReadENStoreAll request send failed: %d" );
       
  1765         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1766 
       
  1767         }
       
  1768 
       
  1769     return ret;
       
  1770 
       
  1771     }
       
  1772 // -----------------------------------------------------------------------------
       
  1773 // CSIM::CompleteReadENStoreAll
       
  1774 // Complete ReadENStore method function.
       
  1775 // -----------------------------------------------------------------------------
       
  1776 //
       
  1777 void CSIM::CompleteReadENStoreAll
       
  1778         (
       
  1779         TInt aResult,
       
  1780         CMmDataPackage* aDataPackage
       
  1781         )
       
  1782     {
       
  1783     _LIT8( KResult, "CompleteReadENStoreAll result: %d" );
       
  1784     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1785 
       
  1786     if( KErrNone == aResult )
       
  1787         {
       
  1788         //unpack data
       
  1789         aDataPackage->UnPackData( iENStoreArray );
       
  1790 
       
  1791         iSIMLog->Log((TDesC8)KLine );
       
  1792 
       
  1793         // check data validity
       
  1794         if( iHandleSpecifiedRequests )
       
  1795             {
       
  1796             for ( TInt i = 0; i < 3; i++)
       
  1797                 {
       
  1798                 TENStoreResponse* enStoreResp = iENStoreArray->At( i );
       
  1799                 if ( enStoreResp->iLocation != iIndexTable[i] ||
       
  1800                      enStoreResp->iECCNumber != iNumberTable[i] )
       
  1801                     {
       
  1802                     aResult = KErrGeneral;
       
  1803                     break;
       
  1804                     }
       
  1805                 }
       
  1806             }
       
  1807 
       
  1808         // Loop until TSY's internal ENStorage is empty
       
  1809         while ( !( 0 == iENStoreArray->Count() ) )
       
  1810             {
       
  1811             TENStoreResponse* enStoreResp = iENStoreArray->At( 0 );
       
  1812 
       
  1813             _LIT8( KPbStoreInfo, "ENStore Location: %d " );
       
  1814             iSIMLog->Log((TDesC8)KPbStoreInfo, enStoreResp->iLocation );
       
  1815 
       
  1816             _LIT8( KNumber, "ENStore Number:" );
       
  1817             iSIMLog->Log((TDesC8)KNumber);
       
  1818             iSIMLog->Log( enStoreResp->iECCNumber);
       
  1819 
       
  1820             // Delete internal list member
       
  1821             delete enStoreResp;
       
  1822             iENStoreArray->Delete( 0 );
       
  1823             iENStoreArray->Compress();
       
  1824             }
       
  1825 
       
  1826 
       
  1827         iSIMLog->Log((TDesC8)KLine );
       
  1828         }
       
  1829     else
       
  1830         {
       
  1831         _LIT8( KFail, "CompleteReadENStoreAll Failed: %d" );
       
  1832         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1833         }
       
  1834 
       
  1835     Signal( aResult );
       
  1836     }
       
  1837 
       
  1838 // -----------------------------------------------------------------------------
       
  1839 // CSIM::GetENStoreInfo
       
  1840 // Get emergency number Store Info
       
  1841 // -----------------------------------------------------------------------------
       
  1842 //
       
  1843 TInt CSIM::GetENStoreInfo( CStifItemParser& aItem )
       
  1844     {
       
  1845     _LIT8(KGetENStoreInfo, "SIM::GetENStoreInfo");
       
  1846     iSIMLog->Log((TDesC8)KGetENStoreInfo);
       
  1847 
       
  1848     TInt ret( KErrNotFound );
       
  1849     TInt index;
       
  1850     aItem.GetNextInt( index );
       
  1851 
       
  1852     //Create package
       
  1853     CPhoneBookDataPackage package;
       
  1854     package.PackData( &index );
       
  1855 
       
  1856     // store given parameter for validity checking
       
  1857     if( iHandleSpecifiedRequests )
       
  1858         {
       
  1859         aItem.GetNextInt( iNumOfUsedPbEntries );
       
  1860         }
       
  1861 
       
  1862     ret = HandleRequestL( EMmTsyENStoreGetInfoIPC,
       
  1863                          &package );
       
  1864 
       
  1865     if ( KErrNone == ret )
       
  1866         {
       
  1867         _LIT8( KSendOk, "GetENStoreInfo request send ok" );
       
  1868         iSIMLog->Log((TDesC8)KSendOk );
       
  1869         }
       
  1870     else
       
  1871         {
       
  1872          _LIT8( KSendFailed, "GetENStoreInfo request send failed: %d" );
       
  1873         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1874 
       
  1875         }
       
  1876 
       
  1877     return ret;
       
  1878 
       
  1879     }
       
  1880 
       
  1881 // -----------------------------------------------------------------------------
       
  1882 // CSIM::CompleteGetENStoreInfo
       
  1883 // Complete GetENStoreInfo method function.
       
  1884 // -----------------------------------------------------------------------------
       
  1885 //
       
  1886 void CSIM::CompleteGetENStoreInfo
       
  1887         (
       
  1888         TInt aResult,
       
  1889         CMmDataPackage* aDataPackage
       
  1890         )
       
  1891     {
       
  1892     _LIT8( KResult, "CompleteGetENStoreInfo result: %d" );
       
  1893     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1894 
       
  1895     if( KErrNone == aResult )
       
  1896         {
       
  1897         // Response information
       
  1898         TInt numberOfusedENEntries;
       
  1899         //unpack data
       
  1900         aDataPackage->UnPackData( numberOfusedENEntries );
       
  1901 
       
  1902         // validity checking
       
  1903         if( iHandleSpecifiedRequests )
       
  1904             {
       
  1905             if ( iNumOfUsedPbEntries != numberOfusedENEntries )
       
  1906                 {
       
  1907                 aResult = KErrGeneral;
       
  1908                 }
       
  1909             }
       
  1910 
       
  1911         _LIT8( KENStoreInfo, "ENStoreInfo: numberOfusedENEntries = %d" );
       
  1912         iSIMLog->Log((TDesC8)KENStoreInfo, numberOfusedENEntries  );
       
  1913         }
       
  1914     else
       
  1915         {
       
  1916         _LIT8( KFail, "CompleteGetENStoreInfo Failed: %d" );
       
  1917         iSIMLog->Log((TDesC8)KFail, aResult );
       
  1918         }
       
  1919 
       
  1920     Signal( aResult );
       
  1921     }
       
  1922 
       
  1923 // -----------------------------------------------------------------------------
       
  1924 // CSIM::ReadONStore
       
  1925 // Read own number Store Info
       
  1926 // -----------------------------------------------------------------------------
       
  1927 //
       
  1928 TInt CSIM::ReadONStore( CStifItemParser& aItem )
       
  1929     {
       
  1930     _LIT8(KReadONStore, "SIM::ReadONStore");
       
  1931     iSIMLog->Log((TDesC8)KReadONStore);
       
  1932 
       
  1933     TInt ret( KErrNotFound );
       
  1934     aItem.GetNextInt( iIndex );
       
  1935 
       
  1936     //Create package
       
  1937     CPhoneBookDataPackage package;
       
  1938     package.PackData( &iIndex );
       
  1939 
       
  1940     // store given parameter for validity checking
       
  1941     if( iHandleSpecifiedRequests )
       
  1942         {
       
  1943         TPtrC string;
       
  1944         aItem.GetNextString( string );
       
  1945         iName.Append( string );
       
  1946         aItem.GetNextString( string );
       
  1947         iNumber.Append( string );
       
  1948         }
       
  1949 
       
  1950     ret = HandleRequestL( EMmTsyONStoreReadIPC,
       
  1951                          &package );
       
  1952 
       
  1953     if ( KErrNone == ret )
       
  1954         {
       
  1955         _LIT8( KSendOk, "ReadONStore request send ok" );
       
  1956         iSIMLog->Log((TDesC8)KSendOk );
       
  1957         }
       
  1958     else
       
  1959         {
       
  1960          _LIT8( KSendFailed, "ReadONStore request send failed: %d" );
       
  1961         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  1962 
       
  1963         }
       
  1964 
       
  1965     return ret;
       
  1966 
       
  1967     }
       
  1968 
       
  1969 // -----------------------------------------------------------------------------
       
  1970 // CSIM::CompleteReadONStore
       
  1971 // Complete ReadONStore method function.
       
  1972 // -----------------------------------------------------------------------------
       
  1973 //
       
  1974 void CSIM::CompleteReadONStore
       
  1975         (
       
  1976         TInt aResult,
       
  1977         CMmDataPackage* aDataPackage
       
  1978         )
       
  1979     {
       
  1980     _LIT8( KResult, "CompleteReadONStore result: %d" );
       
  1981     iSIMLog->Log((TDesC8)KResult, aResult );
       
  1982 
       
  1983     if( KErrNone == aResult )
       
  1984         {
       
  1985         // Response information
       
  1986         TONStoreMsg* onStoreMsg;
       
  1987         //unpack data
       
  1988         aDataPackage->UnPackData( onStoreMsg );
       
  1989 
       
  1990         iSIMLog->Log((TDesC8)KLine );
       
  1991         _LIT8( KONStoreInfo, "ONStore Location: %d " );
       
  1992         iSIMLog->Log((TDesC8)KONStoreInfo, onStoreMsg->iLocation );
       
  1993 
       
  1994         _LIT8( KName, "ONStore Name:" );
       
  1995         iSIMLog->Log((TDesC8)KName);
       
  1996         iSIMLog->Log( onStoreMsg->iName);
       
  1997 
       
  1998         _LIT8( KNumber, "ONStore Number:" );
       
  1999         iSIMLog->Log((TDesC8)KNumber);
       
  2000         iSIMLog->Log( onStoreMsg->iTelNumber );
       
  2001         iSIMLog->Log((TDesC8)KLine );
       
  2002 
       
  2003         // validity checking
       
  2004         if( iHandleSpecifiedRequests )
       
  2005             {
       
  2006             if ( iIndex != onStoreMsg->iLocation ||
       
  2007                  iName != onStoreMsg->iName ||
       
  2008                  iNumber != onStoreMsg->iTelNumber )
       
  2009                 {
       
  2010                 aResult = KErrGeneral;
       
  2011                 }
       
  2012             }
       
  2013         }
       
  2014     else
       
  2015         {
       
  2016         _LIT8( KFail, "CompleteReadONStore Failed: %d" );
       
  2017         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2018         }
       
  2019 
       
  2020     Signal( aResult );
       
  2021     }
       
  2022 
       
  2023 // -----------------------------------------------------------------------------
       
  2024 // CSIM::ReadONStoreEntry
       
  2025 // Read own number Store Info
       
  2026 // -----------------------------------------------------------------------------
       
  2027 //
       
  2028 TInt CSIM::ReadONStoreEntry( CStifItemParser& aItem )
       
  2029     {
       
  2030     _LIT8(KReadONStore, "SIM::ReadONStoreEntry");
       
  2031     iSIMLog->Log((TDesC8)KReadONStore);
       
  2032 
       
  2033     TInt ret( KErrNotFound );
       
  2034     aItem.GetNextInt( iIndex );
       
  2035 
       
  2036     //Create package
       
  2037     CPhoneBookDataPackage package;
       
  2038     package.PackData( &iIndex );
       
  2039 
       
  2040     // store given parameter for validity checking
       
  2041     if( iHandleSpecifiedRequests )
       
  2042         {
       
  2043         TPtrC string;
       
  2044         aItem.GetNextString( string );
       
  2045         iName.Append( string );
       
  2046         aItem.GetNextString( string );
       
  2047         iNumber.Append( string );
       
  2048         }
       
  2049 
       
  2050     ret = HandleRequestL( EMmTsyONStoreReadEntryIPC,
       
  2051                          &package );
       
  2052 
       
  2053     if ( KErrNone == ret )
       
  2054         {
       
  2055         _LIT8( KSendOk, "ReadONStoreEntry request send ok" );
       
  2056         iSIMLog->Log((TDesC8)KSendOk );
       
  2057         }
       
  2058     else
       
  2059         {
       
  2060          _LIT8( KSendFailed, "ReadONStoreEntry request send failed: %d" );
       
  2061         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2062 
       
  2063         }
       
  2064 
       
  2065     return ret;
       
  2066 
       
  2067     }
       
  2068 
       
  2069 // -----------------------------------------------------------------------------
       
  2070 // CSIM::CompleteReadONStoreEntry
       
  2071 // Complete ReadONStoreEntry method function.
       
  2072 // -----------------------------------------------------------------------------
       
  2073 //
       
  2074 void CSIM::CompleteReadONStoreEntry
       
  2075         (
       
  2076         TInt aResult,
       
  2077         CMmDataPackage* aDataPackage
       
  2078         )
       
  2079     {
       
  2080     _LIT8( KResult, "CompleteReadONStoreEntry result: %d" );
       
  2081     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2082 
       
  2083     if( KErrNone == aResult )
       
  2084         {
       
  2085         // Response information
       
  2086         TONStoreMsg onStoreMsg;
       
  2087         //unpack data
       
  2088         aDataPackage->UnPackData( onStoreMsg );
       
  2089 
       
  2090         iSIMLog->Log((TDesC8)KLine );
       
  2091         _LIT8( KONStoreInfo, "ONStoreEntry Location: %d " );
       
  2092         iSIMLog->Log((TDesC8)KONStoreInfo, onStoreMsg.iLocation );
       
  2093 
       
  2094         _LIT8( KName, "ONStoreEntry Name:" );
       
  2095         iSIMLog->Log((TDesC8)KName);
       
  2096         iSIMLog->Log( onStoreMsg.iName);
       
  2097 
       
  2098         _LIT8( KNumber, "ONStoreEntry Number:" );
       
  2099         iSIMLog->Log((TDesC8)KNumber);
       
  2100         iSIMLog->Log( onStoreMsg.iTelNumber );
       
  2101         iSIMLog->Log((TDesC8)KLine );
       
  2102 
       
  2103         // validity checking
       
  2104         if( iHandleSpecifiedRequests )
       
  2105             {
       
  2106             if ( iIndex != onStoreMsg.iLocation ||
       
  2107                  iName != onStoreMsg.iName ||
       
  2108                  iNumber != onStoreMsg.iTelNumber )
       
  2109                 {
       
  2110                 aResult = KErrGeneral;
       
  2111                 }
       
  2112             }
       
  2113         }
       
  2114     else
       
  2115         {
       
  2116         _LIT8( KFail, "CompleteReadONStoreEntry Failed: %d" );
       
  2117         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2118         }
       
  2119 
       
  2120     Signal( aResult );
       
  2121     }
       
  2122 
       
  2123 // -----------------------------------------------------------------------------
       
  2124 // CSIM::GetONStoreInfo
       
  2125 // Get own number Store Info
       
  2126 // -----------------------------------------------------------------------------
       
  2127 //
       
  2128 TInt CSIM::GetONStoreInfo( CStifItemParser& aItem )
       
  2129     {
       
  2130     _LIT8(KGetENStoreInfo, "SIM::GetONStoreInfo");
       
  2131     iSIMLog->Log((TDesC8)KGetENStoreInfo);
       
  2132 
       
  2133     TInt ret( KErrNotFound );
       
  2134     TInt index;
       
  2135     aItem.GetNextInt( index );
       
  2136 
       
  2137     //Create package
       
  2138     CPhoneBookDataPackage package;
       
  2139     package.PackData( &index );
       
  2140 
       
  2141     // store given parameters for validity checking
       
  2142     if( iHandleSpecifiedRequests )
       
  2143         {
       
  2144         aItem.GetNextInt( iServiceType.iNumOfEntries );
       
  2145         aItem.GetNextInt( iServiceType.iUsedEntries );
       
  2146         aItem.GetNextInt( iServiceType.iNameLen );
       
  2147         aItem.GetNextInt( iServiceType.iNumLen );
       
  2148         }
       
  2149 
       
  2150     ret = HandleRequestL( EMmTsyONStoreGetInfoIPC,
       
  2151                          &package );
       
  2152 
       
  2153     if ( KErrNone == ret )
       
  2154         {
       
  2155         _LIT8( KSendOk, "GetONStoreInfo request send ok" );
       
  2156         iSIMLog->Log((TDesC8)KSendOk );
       
  2157         }
       
  2158     else
       
  2159         {
       
  2160          _LIT8( KSendFailed, "GetONStoreInfo request send failed: %d" );
       
  2161         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2162 
       
  2163         }
       
  2164 
       
  2165     return ret;
       
  2166 
       
  2167     }
       
  2168 
       
  2169 // -----------------------------------------------------------------------------
       
  2170 // CSIM::CompleteGetONStoreInfo
       
  2171 // Complete GetONStoreInfo method function.
       
  2172 // -----------------------------------------------------------------------------
       
  2173 //
       
  2174 void CSIM::CompleteGetONStoreInfo
       
  2175         (
       
  2176         TInt aResult,
       
  2177         CMmDataPackage* aDataPackage
       
  2178         )
       
  2179     {
       
  2180     _LIT8( KResult, "CompleteGetONStoreInfo result: %d" );
       
  2181     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2182 
       
  2183     if( KErrNone == aResult )
       
  2184         {
       
  2185         // Response information
       
  2186         TServiceType serviceType;
       
  2187         //unpack data
       
  2188         aDataPackage->UnPackData( serviceType );
       
  2189 
       
  2190         iSIMLog->Log((TDesC8)KLine );
       
  2191         _LIT8( KONStoreInfo, "ONStoreInfo:" );
       
  2192         iSIMLog->Log((TDesC8)KONStoreInfo );
       
  2193         _LIT8( KNumOfEntries, "Number of entries = %d" );
       
  2194         iSIMLog->Log((TDesC8)KNumOfEntries, serviceType.iNumOfEntries  );
       
  2195         _LIT8( KUsedEntries, "Used entries = %d" );
       
  2196         iSIMLog->Log((TDesC8)KUsedEntries, serviceType.iUsedEntries  );
       
  2197         _LIT8( KNameLen, "Name Length = %d" );
       
  2198         iSIMLog->Log((TDesC8)KNameLen, serviceType.iNameLen  );
       
  2199         _LIT8( KNumLen, "Num Length = %d" );
       
  2200         iSIMLog->Log((TDesC8)KNumLen, serviceType.iNumLen  );
       
  2201         iSIMLog->Log((TDesC8)KLine );
       
  2202 
       
  2203         // validity checking
       
  2204         if( iHandleSpecifiedRequests )
       
  2205             {
       
  2206             if( iServiceType.iNumOfEntries != serviceType.iNumOfEntries ||
       
  2207                 iServiceType.iUsedEntries != serviceType.iUsedEntries ||
       
  2208                 iServiceType.iNameLen != serviceType.iNameLen ||
       
  2209                 iServiceType.iNumLen != serviceType.iNumLen )
       
  2210                 {
       
  2211                 aResult = KErrGeneral;
       
  2212                 }
       
  2213             }
       
  2214         }
       
  2215     else
       
  2216         {
       
  2217         _LIT8( KFail, "CompleteGetONStoreInfo Failed: %d" );
       
  2218         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2219         }
       
  2220 
       
  2221     Signal( aResult );
       
  2222     }
       
  2223 
       
  2224 // -----------------------------------------------------------------------------
       
  2225 // CSIM::DeleteONStoreEntry
       
  2226 // Delete own number Store Entry
       
  2227 // -----------------------------------------------------------------------------
       
  2228 //
       
  2229 TInt CSIM::DeleteONStoreEntry( CStifItemParser& aItem )
       
  2230     {
       
  2231     _LIT8(KDeleteONStoreEntry, "SIM::DeleteONStoreEntry");
       
  2232     iSIMLog->Log((TDesC8)KDeleteONStoreEntry);
       
  2233 
       
  2234     TInt ret( KErrNotFound );
       
  2235     TInt index;
       
  2236     aItem.GetNextInt( index );
       
  2237 
       
  2238     //Create package
       
  2239     CPhoneBookDataPackage package;
       
  2240     package.PackData( &index );
       
  2241 
       
  2242     ret = HandleRequestL( EMmTsyONStoreDeleteIPC,
       
  2243                          &package );
       
  2244 
       
  2245     if ( KErrNone == ret )
       
  2246         {
       
  2247         _LIT8( KSendOk, "DeleteONStoreEntry request send ok" );
       
  2248         iSIMLog->Log((TDesC8)KSendOk );
       
  2249         }
       
  2250     else
       
  2251         {
       
  2252          _LIT8( KSendFailed, "DeleteONStoreEntry request send failed: %d" );
       
  2253         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2254 
       
  2255         }
       
  2256 
       
  2257     return ret;
       
  2258 
       
  2259     }
       
  2260 
       
  2261 // -----------------------------------------------------------------------------
       
  2262 // CSIM::CompleteGetONStoreInfo
       
  2263 // Complete GetONStoreInfo method function.
       
  2264 // -----------------------------------------------------------------------------
       
  2265 //
       
  2266 void CSIM::CompleteDeleteONStoreEntry
       
  2267         (
       
  2268         TInt aResult,
       
  2269         CMmDataPackage* /*aDataPackage*/
       
  2270         )
       
  2271     {
       
  2272     _LIT8( KResult, "CompleteDeleteONStoreEntry result: %d" );
       
  2273     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2274 
       
  2275     if( KErrNone != aResult )
       
  2276         {
       
  2277         _LIT8( KFail, "CompleteGetONStoreInfo Failed" );
       
  2278         iSIMLog->Log((TDesC8)KFail  );
       
  2279         }
       
  2280 
       
  2281     Signal( aResult );
       
  2282     }
       
  2283 
       
  2284 // -----------------------------------------------------------------------------
       
  2285 // CSIM::DeleteAllONStoreEntries
       
  2286 // Delete own number Store Entry
       
  2287 // -----------------------------------------------------------------------------
       
  2288 //
       
  2289 TInt CSIM::DeleteAllONStoreEntries( CStifItemParser& /*aItem*/ )
       
  2290     {
       
  2291     _LIT8(KDeleteONStoreEntry, "SIM::DeleteAllONStoreEntries");
       
  2292     iSIMLog->Log((TDesC8)KDeleteONStoreEntry);
       
  2293 
       
  2294     TInt ret( KErrNotFound );
       
  2295 
       
  2296     //Create package
       
  2297     CPhoneBookDataPackage package;
       
  2298 
       
  2299     ret = HandleRequestL( EMmTsyONStoreDeleteAllIPC,
       
  2300                          &package );
       
  2301 
       
  2302     if ( KErrNone == ret )
       
  2303         {
       
  2304         _LIT8( KSendOk, "DeleteAllONStoreEntries request send ok" );
       
  2305         iSIMLog->Log((TDesC8)KSendOk );
       
  2306         }
       
  2307     else
       
  2308         {
       
  2309          _LIT8( KSendFailed, "DeleteAllONStoreEntries request send failed: %d" );
       
  2310         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2311         }
       
  2312 
       
  2313     return ret;
       
  2314 
       
  2315     }
       
  2316 
       
  2317 // -----------------------------------------------------------------------------
       
  2318 // CSIM::WriteONStore
       
  2319 // Write entry to own number store
       
  2320 // -----------------------------------------------------------------------------
       
  2321 //
       
  2322 TInt CSIM::WriteONStore( CStifItemParser& aItem )
       
  2323     {
       
  2324     _LIT8(KWriteONStore, "SIM::WriteONStore");
       
  2325     iSIMLog->Log((TDesC8)KWriteONStore);
       
  2326 
       
  2327     TInt ret( KErrNotFound );
       
  2328     TInt mode;
       
  2329     TInt service;
       
  2330     TInt type;
       
  2331     TInt numberPlan;
       
  2332     TPtrC16 number;
       
  2333     TPtrC16 text;
       
  2334 
       
  2335     RMobileONStore::TMobileONEntryV1 entry;
       
  2336     RMobileONStore::TMobileONEntryV1Pckg entryPckg( entry );
       
  2337 
       
  2338     if( KErrNone == aItem.GetNextInt( iIndex ) )
       
  2339         {
       
  2340         entry.iIndex = iIndex;
       
  2341         }
       
  2342     if( KErrNone == aItem.GetNextInt( mode ) )
       
  2343         {
       
  2344         entry.iMode = static_cast<RMobilePhone::TMobilePhoneNetworkMode>(mode);
       
  2345         }
       
  2346     if( KErrNone == aItem.GetNextInt( service ))
       
  2347         {
       
  2348         entry.iService = static_cast<RMobilePhone::TMobileService>(service);
       
  2349         }
       
  2350     if( KErrNone == aItem.GetNextInt( type ) )
       
  2351         {
       
  2352         entry.iNumber.iTypeOfNumber = static_cast<RMobilePhone::TMobileTON>(type);
       
  2353         }
       
  2354     if( KErrNone == aItem.GetNextInt( numberPlan ) )
       
  2355         {
       
  2356         entry.iNumber.iNumberPlan =
       
  2357                         static_cast<RMobilePhone::TMobileNPI>(numberPlan);
       
  2358         }
       
  2359     if( KErrNone == aItem.GetNextString( number ) )
       
  2360         {
       
  2361         entry.iNumber.iTelNumber.Copy(number);
       
  2362         }
       
  2363      if( KErrNone == aItem.GetNextString( text ) )
       
  2364         {
       
  2365         entry.iText.Copy(text);
       
  2366         }
       
  2367 
       
  2368     //Create package
       
  2369     CPhoneBookDataPackage package;
       
  2370     RMobileONStore::TMobileONEntryV1Pckg* entryPckgPtr = &entryPckg;
       
  2371     package.PackData( &entryPckgPtr );
       
  2372 
       
  2373     ret = HandleRequestL( EMmTsyONStoreWriteIPC,
       
  2374                          &package );
       
  2375 
       
  2376     if ( KErrNone == ret )
       
  2377         {
       
  2378         _LIT8( KSendOk, "WriteONStore request send ok" );
       
  2379         iSIMLog->Log((TDesC8)KSendOk );
       
  2380         }
       
  2381     else
       
  2382         {
       
  2383          _LIT8( KSendFailed, "WriteONStore request send failed: %d" );
       
  2384         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2385         }
       
  2386 
       
  2387     return ret;
       
  2388 
       
  2389     }
       
  2390 
       
  2391 // -----------------------------------------------------------------------------
       
  2392 // CSIM::CompleteWriteONStore
       
  2393 // Complete WriteONStore method function.
       
  2394 // -----------------------------------------------------------------------------
       
  2395 //
       
  2396 void CSIM::CompleteWriteONStore
       
  2397         (
       
  2398         TInt aResult,
       
  2399         CMmDataPackage* aDataPackage
       
  2400         )
       
  2401     {
       
  2402     _LIT8( KResult, "CompleteWriteONStore result: %d" );
       
  2403     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2404 
       
  2405     if( KErrNone == aResult )
       
  2406         {
       
  2407          TInt location = 0;
       
  2408 
       
  2409          if ( aDataPackage )
       
  2410             {
       
  2411             aDataPackage->UnPackData( location );
       
  2412             _LIT8( KLocation, "Location: %d" );
       
  2413             iSIMLog->Log((TDesC8)KLocation, location );
       
  2414             // validity checking
       
  2415             if( iHandleSpecifiedRequests )
       
  2416                 {
       
  2417                 if ( iIndex != location )
       
  2418                     {
       
  2419                     aResult = KErrArgument;
       
  2420                     }
       
  2421                 }
       
  2422             }
       
  2423         }
       
  2424     else
       
  2425         {
       
  2426         _LIT8( KFail, "CompleteWriteONStore Failed: %d" );
       
  2427         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2428         }
       
  2429 
       
  2430     Signal( aResult );
       
  2431     }
       
  2432 
       
  2433 // -----------------------------------------------------------------------------
       
  2434 // CSIM::ReadONStoreSize
       
  2435 // Read size of on store
       
  2436 // -----------------------------------------------------------------------------
       
  2437 //
       
  2438 TInt CSIM::ReadONStoreSize( CStifItemParser& aItem )
       
  2439     {
       
  2440     _LIT8(KReadONStoreSize, "SIM::ReadONStoreSize");
       
  2441     iSIMLog->Log((TDesC8)KReadONStoreSize);
       
  2442 
       
  2443     TInt ret( KErrNotFound );
       
  2444 
       
  2445     // store given parameter for validity checking
       
  2446     if( iHandleSpecifiedRequests )
       
  2447         {
       
  2448         aItem.GetNextInt( iNumOfUsedPbEntries );
       
  2449         }
       
  2450 
       
  2451     ret = HandleRequestL( EMmTsyONStoreReadSizeIPC );
       
  2452 
       
  2453     if ( KErrNone == ret )
       
  2454         {
       
  2455         _LIT8( KSendOk, "ReadONStoreSize request send ok" );
       
  2456         iSIMLog->Log((TDesC8)KSendOk );
       
  2457         }
       
  2458     else
       
  2459         {
       
  2460          _LIT8( KSendFailed, "ReadONStoreSize request send failed: %d" );
       
  2461         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2462         }
       
  2463 
       
  2464     return ret;
       
  2465 
       
  2466     }
       
  2467 
       
  2468 // -----------------------------------------------------------------------------
       
  2469 // CSIM::ViagHomeZoneReadParam
       
  2470 // Read ViagHomeZone param
       
  2471 // {smsc, scp, hzver, {x, y, r2, id, status, tag}[4]}
       
  2472 // -----------------------------------------------------------------------------
       
  2473 //
       
  2474 TInt CSIM::ViagHomeZoneReadParamL( CStifItemParser& aItem )
       
  2475     {
       
  2476     _LIT8( KViagHomeZoneReadParam, "CSIM::ViagHomeZoneReadParam" );
       
  2477     iSIMLog->Log((TDesC8)KViagHomeZoneReadParam);
       
  2478 
       
  2479     // filling parameters
       
  2480     // smsc
       
  2481     TPtrC ptrSmsC;
       
  2482     User::LeaveIfError(
       
  2483         aItem.GetNextString( ptrSmsC ) );
       
  2484     iSavedViagParamsForComparison.iSmsC = ptrSmsC;
       
  2485 
       
  2486     // scp
       
  2487     TPtrC ptrScp;
       
  2488     User::LeaveIfError(
       
  2489         aItem.GetNextString( ptrScp ) );
       
  2490     iSavedViagParamsForComparison.iScp = ptrScp;
       
  2491 
       
  2492     // subscribed zone and version
       
  2493     TUint zoneAndVersion( 0 );
       
  2494     User::LeaveIfError(
       
  2495         aItem.GetNextInt( zoneAndVersion, EHex ) );
       
  2496     iSavedViagParamsForComparison.iSubscribedZoneAndVersion = zoneAndVersion;
       
  2497 
       
  2498     // creating elements
       
  2499     iSavedViagElementsForComparison =
       
  2500         new(ELeave) RMmCustomAPI::TViagElements(
       
  2501             RMmCustomAPI::KViagElementCount );
       
  2502 
       
  2503     // filling elements
       
  2504     TPtrC homezoneFlag;
       
  2505     for ( TInt i = 0; i < RMmCustomAPI::KViagElementCount; i++ )
       
  2506         {
       
  2507         RMmCustomAPI::TViagElement element;
       
  2508 
       
  2509         // fetching X coordinate
       
  2510         TUint xCoord( 0 );
       
  2511         User::LeaveIfError(
       
  2512             aItem.GetNextInt( xCoord, EHex ) );
       
  2513         element.iCoordinates.iX = xCoord;
       
  2514         // fetching Y coordinate
       
  2515         TUint yCoord( 0 );
       
  2516         User::LeaveIfError(
       
  2517             aItem.GetNextInt( yCoord, EHex ) );
       
  2518         element.iCoordinates.iY = yCoord;
       
  2519         // fetching R2
       
  2520         TUint r2;
       
  2521         User::LeaveIfError(
       
  2522             aItem.GetNextInt( r2, EHex ) );
       
  2523         element.iCoordinates.iR2 = r2;
       
  2524 
       
  2525         // fetching zone id
       
  2526         TUint zoneId( 0 );
       
  2527         User::LeaveIfError(
       
  2528             aItem.GetNextInt( zoneId, EHex ) );
       
  2529         element.iCoordinates.iZoneId = zoneId;
       
  2530 
       
  2531         // fetching homezone status flag
       
  2532         User::LeaveIfError( aItem.GetNextString( homezoneFlag ) );
       
  2533         if ( 0 == homezoneFlag.Compare( KViagInactive ) )
       
  2534             {
       
  2535             element.iActiveFlag = RMmCustomAPI::ENotActive;
       
  2536             }
       
  2537         else if ( 0 == homezoneFlag.Compare( KViagHZActive ) )
       
  2538             {
       
  2539             element.iActiveFlag = RMmCustomAPI::EHomeZone;
       
  2540             }
       
  2541         else if ( 0 == homezoneFlag.Compare( KViagCZActive ) )
       
  2542             {
       
  2543             element.iActiveFlag = RMmCustomAPI::ECityZone;
       
  2544             }
       
  2545         else
       
  2546             {
       
  2547             User::Leave( KErrArgument );
       
  2548             }
       
  2549 
       
  2550         // fetching tag
       
  2551         TPtrC name;
       
  2552         User::LeaveIfError(
       
  2553             aItem.GetNextString( name ) );
       
  2554         element.iName = name;
       
  2555 
       
  2556         iSavedViagElementsForComparison->AppendL( element );
       
  2557         }
       
  2558 
       
  2559     TInt ret( HandleRequestL( EReadViagHomeZoneParamsIPC ) );
       
  2560 
       
  2561     if ( KErrNone == ret )
       
  2562         {
       
  2563         _LIT8( KRequestOk, "EReadViagHomeZoneParamsIPC request send ok" );
       
  2564         iSIMLog->Log( (TDesC8)KRequestOk );
       
  2565         }
       
  2566     else
       
  2567         {
       
  2568          _LIT8( KRequestFailed, "EReadViagHomeZoneParamsIPC request send failed: %d" );
       
  2569         iSIMLog->Log( (TDesC8)KRequestFailed, ret );
       
  2570         }
       
  2571 
       
  2572     return ret;
       
  2573 
       
  2574     }
       
  2575 
       
  2576 // -----------------------------------------------------------------------------
       
  2577 // CSIM::ViagHomeZoneReadCache
       
  2578 // Read ViagHomeZone cache
       
  2579 // {cacheid, recnum, lac, cellid}
       
  2580 // -----------------------------------------------------------------------------
       
  2581 //
       
  2582 TInt CSIM::ViagHomeZoneReadCacheL( CStifItemParser& aItem )
       
  2583     {
       
  2584     _LIT8(KViagHomeZoneReadCache, "CSIM::ViagHomeZoneReadCache");
       
  2585     iSIMLog->Log((TDesC8)KViagHomeZoneReadCache);
       
  2586 
       
  2587     RMmCustomAPI::TViagCacheRecordId record;
       
  2588 
       
  2589     // fetching cacheid for request
       
  2590     TUint cacheid;
       
  2591     User::LeaveIfError(
       
  2592         aItem.GetNextInt( cacheid, EHex ) );
       
  2593     record.iCacheId = cacheid;
       
  2594     // fetching recnum for request
       
  2595     TUint recnum;
       
  2596     User::LeaveIfError(
       
  2597         aItem.GetNextInt( recnum, EHex ) );
       
  2598     // XML data and CFG data should match
       
  2599     record.iRecordId = recnum - 1;
       
  2600 
       
  2601 
       
  2602     // fetching LAC for response
       
  2603     TUint lac( 0 );
       
  2604     User::LeaveIfError(
       
  2605         aItem.GetNextInt( lac, EHex ) );
       
  2606     iSavedRecordForComparison.iLac = lac;
       
  2607     // fetching CellId for response
       
  2608     TUint cellId( 0 );
       
  2609     User::LeaveIfError(
       
  2610         aItem.GetNextInt( cellId, EHex ) );
       
  2611     iSavedRecordForComparison.iCellId = cellId;
       
  2612 
       
  2613     CMmDataPackage package;
       
  2614     package.PackData( &record );
       
  2615     TInt ret( HandleRequestL( EReadViagHomeZoneCacheIPC, &package ) );
       
  2616 
       
  2617     if ( KErrNone == ret )
       
  2618         {
       
  2619         _LIT8( KRequestOk, "EReadViagHomeZoneCacheIPC request send ok" );
       
  2620         iSIMLog->Log( (TDesC8)KRequestOk );
       
  2621         }
       
  2622     else
       
  2623         {
       
  2624          _LIT8( KRequestFailed, "EReadViagHomeZoneCacheIPC request send failed: %d" );
       
  2625         iSIMLog->Log( (TDesC8)KRequestFailed, ret );
       
  2626         }
       
  2627 
       
  2628     return ret;
       
  2629 
       
  2630     }
       
  2631 
       
  2632 // -----------------------------------------------------------------------------
       
  2633 // CSIM::ViagHomeZoneWriteSettings
       
  2634 // Write ViagHomeZone settings
       
  2635 // {settings, version}
       
  2636 // -----------------------------------------------------------------------------
       
  2637 //
       
  2638 TInt CSIM::ViagHomeZoneWriteSettingsL( CStifItemParser& aItem )
       
  2639     {
       
  2640     _LIT8( KViagHomeZoneWriteSettings, "CSIM::ViagHomeZoneWriteSettings" );
       
  2641     iSIMLog->Log((TDesC8)KViagHomeZoneWriteSettings);
       
  2642 
       
  2643     CMmDataPackage package;
       
  2644     RMmCustomAPI::TViagUHZIUESettings settings;
       
  2645 
       
  2646     // fetching settings
       
  2647     TUint set( 0 );
       
  2648     User::LeaveIfError( aItem.GetNextInt( set, EHex ) );
       
  2649     settings.iSettings = set;
       
  2650 
       
  2651     // fetching version
       
  2652     TUint ver( 0 );
       
  2653     User::LeaveIfError( aItem.GetNextInt( ver, EHex ) );
       
  2654     settings.iVersion = ver;
       
  2655 
       
  2656     package.PackData( &settings );
       
  2657     TInt ret( HandleRequestL( EWriteViagHomeZoneUHZIUESettingsIPC, &package ) );
       
  2658 
       
  2659     if ( KErrNone == ret )
       
  2660         {
       
  2661         _LIT8( KRequestOk, "EWriteViagHomeZoneUHZIUESettingsIPC request send ok" );
       
  2662         iSIMLog->Log( (TDesC8)KRequestOk );
       
  2663         }
       
  2664     else
       
  2665         {
       
  2666          _LIT8( KRequestFailed, "EWriteViagHomeZoneUHZIUESettingsIPC request send failed: %d" );
       
  2667         iSIMLog->Log( (TDesC8)KRequestFailed, ret );
       
  2668         }
       
  2669 
       
  2670     return ret;
       
  2671 
       
  2672     }
       
  2673 
       
  2674 // -----------------------------------------------------------------------------
       
  2675 // CSIM::ViagHomeZoneWriteCache
       
  2676 // Write ViagHomeZone cache
       
  2677 // {cacheid, recnum, lac, cellid}
       
  2678 // -----------------------------------------------------------------------------
       
  2679 //
       
  2680 TInt CSIM::ViagHomeZoneWriteCacheL( CStifItemParser& aItem )
       
  2681     {
       
  2682     _LIT8( KViagHomeZoneWriteCache, "CSIM::ViagHomeZoneWriteCache" );
       
  2683     iSIMLog->Log( (TDesC8)KViagHomeZoneWriteCache );
       
  2684 
       
  2685     CMmDataPackage package;
       
  2686     RMmCustomAPI::TViagCacheRecordId recordId;
       
  2687     RMmCustomAPI::TViagCacheRecordContent recordContent;
       
  2688 
       
  2689     // fetching cacheId
       
  2690     TUint cacheid( 0 );
       
  2691     User::LeaveIfError( aItem.GetNextInt( cacheid, EHex ) );
       
  2692     recordId.iCacheId = cacheid;
       
  2693 
       
  2694     // fetching record number
       
  2695     TUint recnum( 0 );
       
  2696     User::LeaveIfError( aItem.GetNextInt( recnum, EHex ) );
       
  2697     // XML and CFG should match
       
  2698     recordId.iRecordId = recnum - 1;
       
  2699 
       
  2700     // fetching lac
       
  2701     TUint lac( 0 );
       
  2702     User::LeaveIfError( aItem.GetNextInt( lac, EHex ) );
       
  2703     recordContent.iLac = lac;
       
  2704 
       
  2705     // fetching CellId
       
  2706     TUint cellid( 0 );
       
  2707     User::LeaveIfError( aItem.GetNextInt( cellid, EHex ) );
       
  2708     recordContent.iCellId = cellid;
       
  2709 
       
  2710     package.PackData( &recordId, &recordContent );
       
  2711     TInt ret( HandleRequestL( EWriteViagHomeZoneCacheIPC, &package) );
       
  2712 
       
  2713     if ( KErrNone == ret )
       
  2714         {
       
  2715         _LIT8( KRequestOk, "EWriteViagHomeZoneCacheIPC request send ok" );
       
  2716         iSIMLog->Log( (TDesC8)KRequestOk );
       
  2717         }
       
  2718     else
       
  2719         {
       
  2720          _LIT8( KRequestFailed, "EWriteViagHomeZoneCacheIPC request send failed: %d" );
       
  2721         iSIMLog->Log( (TDesC8)KRequestFailed, ret );
       
  2722         }
       
  2723 
       
  2724     return ret;
       
  2725 
       
  2726     }
       
  2727 
       
  2728 // -----------------------------------------------------------------------------
       
  2729 // CSIM::CompleteReadONStoreSize
       
  2730 // Complete ReadONStoreSize method function.
       
  2731 // -----------------------------------------------------------------------------
       
  2732 //
       
  2733 void CSIM::CompleteReadONStoreSize
       
  2734         (
       
  2735         TInt aResult,
       
  2736         CMmDataPackage* aDataPackage
       
  2737         )
       
  2738     {
       
  2739     _LIT8( KResult, "CompleteReadONStoreSize result: %d" );
       
  2740     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2741 
       
  2742     if( KErrNone == aResult )
       
  2743         {
       
  2744         TInt size = 0;
       
  2745         if ( aDataPackage )
       
  2746             {
       
  2747             aDataPackage->UnPackData( size );
       
  2748             _LIT8( KSize, "Size: %d" );
       
  2749             iSIMLog->Log((TDesC8)KSize, size );
       
  2750             // validity checking
       
  2751             if( iHandleSpecifiedRequests )
       
  2752                 {
       
  2753                 if ( iNumOfUsedPbEntries != size )
       
  2754                     {
       
  2755                     aResult = KErrGeneral;
       
  2756                     }
       
  2757                 }
       
  2758             }
       
  2759         }
       
  2760     else
       
  2761         {
       
  2762         _LIT8( KFail, "CompleteReadONStoreSize Failed: %d" );
       
  2763         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2764         }
       
  2765 
       
  2766     Signal( aResult );
       
  2767     }
       
  2768 
       
  2769 // -----------------------------------------------------------------------------
       
  2770 // CSIM::OnStoreWriteSize
       
  2771 // Write size of on store
       
  2772 // -----------------------------------------------------------------------------
       
  2773 //
       
  2774 TInt CSIM::OnStoreWriteSize( CStifItemParser& aItem )
       
  2775     {
       
  2776     _LIT8(KReadONStoreWriteSize, "SIM::OnStoreWriteSize");
       
  2777     iSIMLog->Log((TDesC8)KReadONStoreWriteSize);
       
  2778 
       
  2779     TInt ret( KErrNotFound );
       
  2780 
       
  2781     // store given parameter for validity checking
       
  2782     if( iHandleSpecifiedRequests )
       
  2783         {
       
  2784         aItem.GetNextInt( iNumOfUsedPbEntries );
       
  2785         }
       
  2786 
       
  2787     ret = HandleRequestL( EMmTsyONStoreWriteSizeIPC );
       
  2788 
       
  2789     if ( KErrNone == ret )
       
  2790         {
       
  2791         _LIT8( KSendOk, "OnStoreWriteSize request send ok" );
       
  2792         iSIMLog->Log((TDesC8)KSendOk );
       
  2793         }
       
  2794     else
       
  2795         {
       
  2796          _LIT8( KSendFailed, "OnStoreWriteSize request send failed: %d" );
       
  2797         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2798         }
       
  2799 
       
  2800     return ret;
       
  2801 
       
  2802     }
       
  2803 
       
  2804 // -----------------------------------------------------------------------------
       
  2805 // CSIM::CompleteOnStoreWriteSize
       
  2806 // Complete OnStoreWriteSize method function.
       
  2807 // -----------------------------------------------------------------------------
       
  2808 //
       
  2809 void CSIM::CompleteOnStoreWriteSize
       
  2810         (
       
  2811         TInt aResult,
       
  2812         CMmDataPackage* aDataPackage
       
  2813         )
       
  2814     {
       
  2815     _LIT8( KResult, "CompleteOnStoreWriteSize result: %d" );
       
  2816     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2817 
       
  2818     if( KErrNone == aResult )
       
  2819         {
       
  2820         TInt size = 0;
       
  2821         if ( aDataPackage )
       
  2822             {
       
  2823             aDataPackage->UnPackData( size );
       
  2824             _LIT8( KSize, "Size: %d" );
       
  2825             iSIMLog->Log((TDesC8)KSize, size );
       
  2826             // validity checking
       
  2827             if( iHandleSpecifiedRequests )
       
  2828                 {
       
  2829                 if ( iNumOfUsedPbEntries != size )
       
  2830                     {
       
  2831                     aResult = KErrGeneral;
       
  2832                     }
       
  2833                 }
       
  2834             }
       
  2835         }
       
  2836     else
       
  2837         {
       
  2838         _LIT8( KFail, "CompleteOnStoreWriteSize Failed: %d" );
       
  2839         iSIMLog->Log((TDesC8)KFail, aResult );
       
  2840         }
       
  2841 
       
  2842     Signal( aResult );
       
  2843     }
       
  2844 
       
  2845 // -----------------------------------------------------------------------------
       
  2846 // CSIM::GetMailboxNumbers
       
  2847 // Get mailbox numbers
       
  2848 // -----------------------------------------------------------------------------
       
  2849 //
       
  2850 TInt CSIM::GetMailboxNumbers( CStifItemParser& /*aItem*/ )
       
  2851     {
       
  2852     _LIT8(KGetMailboxNumbers, "SIM::GetMailboxNumbers");
       
  2853     iSIMLog->Log((TDesC8)KGetMailboxNumbers);
       
  2854 
       
  2855     TInt ret( KErrNotFound );
       
  2856     ret = HandleRequestL( EMobilePhoneGetMailboxNumbers );
       
  2857 
       
  2858     if ( KErrNone == ret )
       
  2859         {
       
  2860         _LIT8( KSendOk, "GetMailboxNumbers request send ok" );
       
  2861         iSIMLog->Log((TDesC8)KSendOk );
       
  2862         }
       
  2863     else
       
  2864         {
       
  2865          _LIT8( KSendFailed, "GetMailboxNumbers request send failed: %d" );
       
  2866         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2867 
       
  2868         }
       
  2869 
       
  2870     return ret;
       
  2871 
       
  2872     }
       
  2873 
       
  2874 // -----------------------------------------------------------------------------
       
  2875 // CSIM::CompleteGetMailboxNumbers
       
  2876 // Complete GetMailboxNumbers method function.
       
  2877 // -----------------------------------------------------------------------------
       
  2878 //
       
  2879 void CSIM::CompleteGetMailboxNumbers
       
  2880         (
       
  2881         TInt aResult,
       
  2882         CMmDataPackage* aDataPackage
       
  2883         )
       
  2884     {
       
  2885     _LIT8( KResult, "CompleteGetMailboxNumbers result: %d" );
       
  2886     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2887 
       
  2888     if( KErrNone != aResult )
       
  2889         {
       
  2890         _LIT8( KFail, "CompleteGetMailboxNumbers Failed" );
       
  2891         iSIMLog->Log((TDesC8)KFail  );
       
  2892         }
       
  2893     else
       
  2894         {
       
  2895         RMobilePhone::TMobilePhoneVoicemailIdsV3* voicemailIds;
       
  2896         aDataPackage->UnPackData( &voicemailIds );
       
  2897 
       
  2898         _LIT8( KVoice, "VoicemailIds: Voice = %d" );
       
  2899         iSIMLog->Log((TDesC8)KVoice, voicemailIds->iVoice  );
       
  2900         _LIT8( KFax, "VoicemailIds: Fax = %d" );
       
  2901         iSIMLog->Log((TDesC8)KFax, voicemailIds->iFax  );
       
  2902             _LIT8( KData, "VoicemailIds: Data = %d" );
       
  2903         iSIMLog->Log((TDesC8)KData, voicemailIds->iData  );
       
  2904         _LIT8( KOther, "VoicemailIds: Other = %d" );
       
  2905         iSIMLog->Log((TDesC8)KOther, voicemailIds->iOther  );
       
  2906         }
       
  2907 
       
  2908     Signal( aResult );
       
  2909     }
       
  2910 
       
  2911 // -----------------------------------------------------------------------------
       
  2912 // CSIM::WriteONStoreAll
       
  2913 // Write entry to own number store
       
  2914 // -----------------------------------------------------------------------------
       
  2915 //
       
  2916 TInt CSIM::WriteONStoreAll( CStifItemParser& aItem )
       
  2917     {
       
  2918     _LIT8(KWriteONStore, "SIM::WriteONStoreAll");
       
  2919     iSIMLog->Log((TDesC8)KWriteONStore);
       
  2920 
       
  2921     TInt ret( KErrNotFound );
       
  2922     TInt mode;
       
  2923     TInt service;
       
  2924     TInt type;
       
  2925     TInt numberPlan;
       
  2926     TPtrC16 number;
       
  2927     TPtrC16 text;
       
  2928 
       
  2929     RMobileONStore::TMobileONEntryV1 entry;
       
  2930 
       
  2931     if( KErrNone == aItem.GetNextInt( iIndex ) )
       
  2932         {
       
  2933         entry.iIndex = iIndex;
       
  2934         }
       
  2935     if( KErrNone == aItem.GetNextInt( mode ) )
       
  2936         {
       
  2937         entry.iMode = static_cast<RMobilePhone::TMobilePhoneNetworkMode>(mode);
       
  2938         }
       
  2939     if( KErrNone == aItem.GetNextInt( service ))
       
  2940         {
       
  2941         entry.iService = static_cast<RMobilePhone::TMobileService>(service);
       
  2942         }
       
  2943     if( KErrNone == aItem.GetNextInt( type ) )
       
  2944         {
       
  2945         entry.iNumber.iTypeOfNumber = static_cast<RMobilePhone::TMobileTON>(type);
       
  2946         }
       
  2947     if( KErrNone == aItem.GetNextInt( numberPlan ) )
       
  2948         {
       
  2949         entry.iNumber.iNumberPlan =
       
  2950                 static_cast<RMobilePhone::TMobileNPI>(numberPlan);
       
  2951         }
       
  2952     if( KErrNone == aItem.GetNextString( number ) )
       
  2953         {
       
  2954         entry.iNumber.iTelNumber.Copy(number);
       
  2955         }
       
  2956      if( KErrNone == aItem.GetNextString( text ) )
       
  2957         {
       
  2958         entry.iText.Copy(text);
       
  2959         }
       
  2960 
       
  2961     //Create package
       
  2962     CMmDataPackage package;
       
  2963     package.PackData( &entry );
       
  2964 
       
  2965     ret = HandleRequestL( EMmTsyONStoreWriteEntryIPC,
       
  2966                          &package );
       
  2967 
       
  2968     if ( KErrNone == ret )
       
  2969         {
       
  2970         _LIT8( KSendOk, "WriteONStoreAll request send ok" );
       
  2971         iSIMLog->Log((TDesC8)KSendOk );
       
  2972         }
       
  2973     else
       
  2974         {
       
  2975          _LIT8( KSendFailed, "WriteONStoreAll request send failed: %d" );
       
  2976         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  2977         }
       
  2978 
       
  2979     return ret;
       
  2980 
       
  2981     }
       
  2982 
       
  2983 // -----------------------------------------------------------------------------
       
  2984 // CSIM::CompleteWriteONStoreAll
       
  2985 // Complete WriteONStore method function.
       
  2986 // -----------------------------------------------------------------------------
       
  2987 //
       
  2988 void CSIM::CompleteWriteONStoreAll
       
  2989         (
       
  2990         TInt aResult,
       
  2991         CMmDataPackage* /*aDataPackage*/
       
  2992         )
       
  2993     {
       
  2994     _LIT8( KResult, "CompleteWriteONStoreAll result: %d" );
       
  2995     iSIMLog->Log((TDesC8)KResult, aResult );
       
  2996 
       
  2997     if( KErrNone != aResult )
       
  2998         {
       
  2999         _LIT8( KFail, "CompleteWriteONStoreAll Failed: %d" );
       
  3000         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3001         }
       
  3002 
       
  3003     Signal( aResult );
       
  3004     }
       
  3005 
       
  3006 // -----------------------------------------------------------------------------
       
  3007 // CSIM::GetServiceTable
       
  3008 // Get service table
       
  3009 // -----------------------------------------------------------------------------
       
  3010 //
       
  3011 TInt CSIM::GetServiceTable( CStifItemParser& aItem )
       
  3012     {
       
  3013     _LIT8(KWriteONStore, "SIM::GetServiceTable");
       
  3014     iSIMLog->Log((TDesC8)KWriteONStore);
       
  3015 
       
  3016     TInt ret( KErrNotFound );
       
  3017     TBool supported( ETrue );
       
  3018     TPtrC string;
       
  3019 
       
  3020     RMobilePhone::TMobilePhoneServiceTable table;
       
  3021 
       
  3022     aItem.GetNextString ( string );
       
  3023 
       
  3024     if ( _L("SIM") == string )
       
  3025         {
       
  3026         table = RMobilePhone::ESIMServiceTable;
       
  3027         }
       
  3028     else if( _L("USIM") == string )
       
  3029         {
       
  3030         table = RMobilePhone::EUSIMServiceTable;
       
  3031         }
       
  3032     else
       
  3033         {
       
  3034          _LIT8(KNotSupp, "SIM:: not supported");
       
  3035         iSIMLog->Log((TDesC8)KNotSupp);
       
  3036         supported = EFalse;
       
  3037         }
       
  3038 
       
  3039     if( supported )
       
  3040         {
       
  3041         //Create package
       
  3042         CMmDataPackage package;
       
  3043         package.PackData( &table );
       
  3044 
       
  3045         ret = HandleRequestL( EMobilePhoneGetServiceTable,
       
  3046                              &package );
       
  3047 
       
  3048         if ( KErrNone == ret )
       
  3049             {
       
  3050             _LIT8( KSendOk, "GetServiceTable request send ok" );
       
  3051             iSIMLog->Log((TDesC8)KSendOk );
       
  3052             }
       
  3053         else
       
  3054             {
       
  3055              _LIT8( KSendFailed, "GetServiceTable request send failed: %d" );
       
  3056             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3057             }
       
  3058         }
       
  3059 
       
  3060 
       
  3061     return ret;
       
  3062 
       
  3063     }
       
  3064 
       
  3065 // -----------------------------------------------------------------------------
       
  3066 // CSIM::CompleteGetServiceTable
       
  3067 // Complete GetServiceTable function.
       
  3068 // -----------------------------------------------------------------------------
       
  3069 //
       
  3070 void CSIM::CompleteGetServiceTable
       
  3071         (
       
  3072         TInt aResult,
       
  3073         CMmDataPackage* /*aDataPackage*/
       
  3074         )
       
  3075     {
       
  3076     _LIT8( KResult, "CompleteGetServiceTable result: %d" );
       
  3077     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3078 
       
  3079     if( KErrNone == aResult )
       
  3080         {
       
  3081 
       
  3082         }
       
  3083     else
       
  3084         {
       
  3085         _LIT8( KFail, "CompleteGetServiceTable Failed: %d" );
       
  3086         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3087         }
       
  3088 
       
  3089     Signal( aResult );
       
  3090     }
       
  3091 
       
  3092 // -----------------------------------------------------------------------------
       
  3093 // CSIM::GetALSLine
       
  3094 // Get ALS Line
       
  3095 // -----------------------------------------------------------------------------
       
  3096 //
       
  3097 TInt CSIM::GetALSLine( CStifItemParser& aItem )
       
  3098     {
       
  3099     _LIT8(KGetALSLine, "SIM::GetALSLine");
       
  3100     iSIMLog->Log((TDesC8)KGetALSLine);
       
  3101 
       
  3102     TInt ret( KErrNotFound );
       
  3103 
       
  3104     // store given parameter for validity checking
       
  3105     if( iHandleSpecifiedRequests )
       
  3106         {
       
  3107         TInt temp;
       
  3108         aItem.GetNextInt( temp );
       
  3109         iAlsLine = (RMobilePhone::TMobilePhoneALSLine) temp;
       
  3110         }
       
  3111 
       
  3112     ret = HandleRequestL( EMobilePhoneGetALSLine );
       
  3113 
       
  3114     if ( KErrNone == ret )
       
  3115         {
       
  3116         _LIT8( KSendOk, "GetALSLine request send ok" );
       
  3117         iSIMLog->Log((TDesC8)KSendOk );
       
  3118         }
       
  3119     else
       
  3120         {
       
  3121          _LIT8( KSendFailed, "GetALSLine request send failed: %d" );
       
  3122         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3123         }
       
  3124 
       
  3125     return ret;
       
  3126     }
       
  3127 
       
  3128 // -----------------------------------------------------------------------------
       
  3129 // CSIM::CompleteGetALSLine
       
  3130 // Complete GetALSLine method function.
       
  3131 // -----------------------------------------------------------------------------
       
  3132 //
       
  3133 void CSIM::CompleteGetALSLine
       
  3134         (
       
  3135         TInt aResult,
       
  3136         CMmDataPackage* aDataPackage
       
  3137         )
       
  3138     {
       
  3139     _LIT8( KResult, "CompleteGetALSLine result: %d" );
       
  3140     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3141 
       
  3142     if( KErrNone == aResult )
       
  3143         {
       
  3144         RMobilePhone::TMobilePhoneALSLine alsLine;
       
  3145 
       
  3146          if( aDataPackage )
       
  3147             {
       
  3148             aDataPackage->UnPackData( alsLine );
       
  3149             _LIT8( KLine, "ALS Line:" );
       
  3150             iSIMLog->Log((TDesC8)KLine );
       
  3151             iSIMLog->Log( PhoneALSLine[alsLine] );
       
  3152             // validity checking
       
  3153             if( iHandleSpecifiedRequests )
       
  3154                 {
       
  3155                 if ( iAlsLine != alsLine)
       
  3156                     {
       
  3157                     aResult = KErrGeneral;
       
  3158                     }
       
  3159                 }
       
  3160             }
       
  3161         }
       
  3162     else
       
  3163         {
       
  3164         _LIT8( KFail, "CompleteGetALSLine Failed: %d" );
       
  3165         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3166         }
       
  3167 
       
  3168     Signal( aResult );
       
  3169     }
       
  3170 
       
  3171 // -----------------------------------------------------------------------------
       
  3172 // CSIM::SetALSLine
       
  3173 // Set ALS Line
       
  3174 // -----------------------------------------------------------------------------
       
  3175 //
       
  3176 TInt CSIM::SetALSLine( CStifItemParser& aItem )
       
  3177     {
       
  3178     _LIT8(KSetALSLine, "SIM::SetALSLine");
       
  3179     iSIMLog->Log((TDesC8)KSetALSLine);
       
  3180 
       
  3181     TInt ret( KErrNotFound );
       
  3182 
       
  3183     TInt alsLine;
       
  3184     aItem.GetNextInt( alsLine );
       
  3185 
       
  3186     //Create package
       
  3187     CMmDataPackage package;
       
  3188     package.PackData( &alsLine );
       
  3189 
       
  3190     ret = HandleRequestL( EMobilePhoneSetALSLine, &package );
       
  3191 
       
  3192     if ( KErrNone == ret )
       
  3193         {
       
  3194         _LIT8( KSendOk, "SetALSLine request send ok" );
       
  3195         iSIMLog->Log((TDesC8)KSendOk );
       
  3196         }
       
  3197     else
       
  3198         {
       
  3199          _LIT8( KSendFailed, "SetALSLine request send failed: %d" );
       
  3200         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3201 
       
  3202         }
       
  3203 
       
  3204     return ret;
       
  3205     }
       
  3206 
       
  3207 // -----------------------------------------------------------------------------
       
  3208 // CSIM::CompleteSetALSLine
       
  3209 // Complete SetALSLine method function.
       
  3210 // -----------------------------------------------------------------------------
       
  3211 //
       
  3212 void CSIM::CompleteSetALSLine
       
  3213         (
       
  3214         TInt aResult
       
  3215         )
       
  3216     {
       
  3217     _LIT8( KResult, "CompleteSetALSLine result: %d" );
       
  3218     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3219 
       
  3220     if( KErrNone != aResult )
       
  3221         {
       
  3222         _LIT8( KFail, "CompleteGetALSLine Failed: %d" );
       
  3223         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3224         }
       
  3225 
       
  3226     Signal( aResult );
       
  3227     }
       
  3228 
       
  3229 // -----------------------------------------------------------------------------
       
  3230 // CSIM::GetCustomerServiceProfile
       
  3231 // Get Customer Service Profile
       
  3232 // -----------------------------------------------------------------------------
       
  3233 //
       
  3234 TInt CSIM::GetCustomerServiceProfile( CStifItemParser& aItem )
       
  3235     {
       
  3236     _LIT8(KGetCSP, "SIM::GetCustomerServiceProfile");
       
  3237     iSIMLog->Log((TDesC8)KGetCSP);
       
  3238 
       
  3239     TInt ret( KErrNotFound );
       
  3240 
       
  3241     // store given parameters for validity checking
       
  3242     if( iHandleSpecifiedRequests )
       
  3243         {
       
  3244         TInt temp;
       
  3245         aItem.GetNextInt( temp );
       
  3246         iCspFile.iCallOfferingServices = temp;
       
  3247         aItem.GetNextInt( temp );
       
  3248         iCspFile.iCallRestrictionServices = temp;
       
  3249         aItem.GetNextInt( temp );
       
  3250         iCspFile.iOtherSuppServices = temp;
       
  3251         aItem.GetNextInt( temp );
       
  3252         iCspFile.iCallCompletionServices = temp;
       
  3253         aItem.GetNextInt( temp );
       
  3254         iCspFile.iTeleservices = temp;
       
  3255         aItem.GetNextInt( temp );
       
  3256         iCspFile.iCphsTeleservices = temp;
       
  3257         aItem.GetNextInt( temp );
       
  3258         iCspFile.iCphsFeatures = temp;
       
  3259         aItem.GetNextInt( temp );
       
  3260         iCspFile.iNumberIdentServices = temp;
       
  3261         aItem.GetNextInt( temp );
       
  3262         iCspFile.iPhase2PlusServices = temp;
       
  3263         aItem.GetNextInt( temp );
       
  3264         iCspFile.iValueAddedServices = temp;
       
  3265         }
       
  3266 
       
  3267     ret = HandleRequestL( EMobilePhoneGetCustomerServiceProfile );
       
  3268 
       
  3269     if ( KErrNone == ret )
       
  3270         {
       
  3271         _LIT8( KSendOk, "GetCustomerServiceProfile request send ok" );
       
  3272         iSIMLog->Log((TDesC8)KSendOk );
       
  3273         }
       
  3274     else
       
  3275         {
       
  3276          _LIT8( KSendFailed, "GetCustomerServiceProfile request send failed: %d" );
       
  3277         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3278 
       
  3279         }
       
  3280 
       
  3281     return ret;
       
  3282     }
       
  3283 
       
  3284 // -----------------------------------------------------------------------------
       
  3285 // CSIM::CompleteGetALSLine
       
  3286 // Complete GetALSLine method function.
       
  3287 // -----------------------------------------------------------------------------
       
  3288 //
       
  3289 void CSIM::CompleteGetCustomerServiceProfile
       
  3290         (
       
  3291         TInt aResult,
       
  3292         CMmDataPackage* aDataPackage
       
  3293         )
       
  3294     {
       
  3295     _LIT8( KResult, "CompleteGetCustomerServiceProfile result: %d" );
       
  3296     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3297 
       
  3298     if( KErrNone == aResult )
       
  3299         {
       
  3300         RMobilePhone::TMobilePhoneCspFileV1 cspFile;
       
  3301 
       
  3302          if( aDataPackage )
       
  3303             {
       
  3304             aDataPackage->UnPackData( cspFile );
       
  3305 
       
  3306             _LIT8( KCOS, "CallOfferingServices: %d" );
       
  3307             iSIMLog->Log((TDesC8)KCOS, cspFile.iCallOfferingServices );
       
  3308             _LIT8( KCRS, "CallRestrictionServices: %d" );
       
  3309             iSIMLog->Log((TDesC8)KCRS, cspFile.iCallRestrictionServices );
       
  3310             _LIT8( KOSS, "OtherSuppServices: %d" );
       
  3311             iSIMLog->Log((TDesC8)KOSS, cspFile.iOtherSuppServices );
       
  3312             _LIT8( KCCS, "CallCompletionServices: %d" );
       
  3313             iSIMLog->Log((TDesC8)KCCS, cspFile.iCallCompletionServices );
       
  3314             _LIT8( KTS, "Teleservices: %d" );
       
  3315             iSIMLog->Log((TDesC8)KTS, cspFile.iTeleservices );
       
  3316             _LIT8( KCTS, "CphsTeleservices: %d" );
       
  3317             iSIMLog->Log((TDesC8)KCTS, cspFile.iCphsTeleservices );
       
  3318             _LIT8( KCF, "CphsFeatures: %d" );
       
  3319             iSIMLog->Log((TDesC8)KCF, cspFile.iCphsFeatures );
       
  3320             _LIT8( KNIS, "NumberIdentServices: %d" );
       
  3321             iSIMLog->Log((TDesC8)KNIS, cspFile.iNumberIdentServices );
       
  3322             _LIT8( KPPS, "Phase2PlusServices: %d" );
       
  3323             iSIMLog->Log((TDesC8)KPPS, cspFile.iPhase2PlusServices );
       
  3324             _LIT8( KVAS, "ValueAddedServices: %d" );
       
  3325             iSIMLog->Log((TDesC8)KVAS, cspFile.iValueAddedServices );
       
  3326 
       
  3327             // validity checking
       
  3328             if( iHandleSpecifiedRequests )
       
  3329                 {
       
  3330                 if( iCspFile.iCallOfferingServices != cspFile.iCallOfferingServices ||
       
  3331                     iCspFile.iCallRestrictionServices != cspFile.iCallRestrictionServices ||
       
  3332                     iCspFile.iOtherSuppServices != cspFile.iOtherSuppServices ||
       
  3333                     iCspFile.iCallCompletionServices != cspFile.iCallCompletionServices ||
       
  3334                     iCspFile.iTeleservices != cspFile.iTeleservices ||
       
  3335                     iCspFile.iCphsTeleservices != cspFile.iCphsTeleservices ||
       
  3336                     iCspFile.iCphsFeatures != cspFile.iCphsFeatures ||
       
  3337                     iCspFile.iNumberIdentServices != cspFile.iNumberIdentServices ||
       
  3338                     iCspFile.iPhase2PlusServices != cspFile.iPhase2PlusServices ||
       
  3339                     iCspFile.iValueAddedServices != cspFile.iValueAddedServices )
       
  3340                     {
       
  3341                     aResult = KErrGeneral;
       
  3342                     }
       
  3343                 }
       
  3344             }
       
  3345         }
       
  3346     else
       
  3347         {
       
  3348         _LIT8( KFail, "CompleteGetCustomerServiceProfile Failed: %d" );
       
  3349         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3350         }
       
  3351 
       
  3352     Signal( aResult );
       
  3353     }
       
  3354 
       
  3355 
       
  3356 // -----------------------------------------------------------------------------
       
  3357 // CSIM::GetPin1DisableSupported
       
  3358 // Get Customer Service Profile
       
  3359 // -----------------------------------------------------------------------------
       
  3360 //
       
  3361 TInt CSIM::GetPin1DisableSupported( CStifItemParser& /*aItem*/ )
       
  3362     {
       
  3363     _LIT8(KGetCSP, "SIM::GetCustomerServiceProfile");
       
  3364     iSIMLog->Log((TDesC8)KGetCSP);
       
  3365 
       
  3366     TInt ret( KErrNotFound );
       
  3367     ret = HandleRequestL( EMmTsyPhoneGetPin1DisableSupportedIPC );
       
  3368 
       
  3369     if ( KErrNone == ret )
       
  3370         {
       
  3371         _LIT8( KSendOk, "GetPin1DisableSupported request send ok" );
       
  3372         iSIMLog->Log((TDesC8)KSendOk );
       
  3373         }
       
  3374     else
       
  3375         {
       
  3376          _LIT8( KSendFailed, "GetPin1DisableSupported request send failed: %d" );
       
  3377         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3378 
       
  3379         }
       
  3380 
       
  3381     return ret;
       
  3382     }
       
  3383 
       
  3384 // -----------------------------------------------------------------------------
       
  3385 // CSIM::CompleteGetPin1DisableSupported
       
  3386 // Complete GetPin1DisableSupported method function.
       
  3387 // -----------------------------------------------------------------------------
       
  3388 //
       
  3389 void CSIM::CompleteGetPin1DisableSupported
       
  3390         (
       
  3391         TInt aResult,
       
  3392         CMmDataPackage* /*aDataPackage*/
       
  3393         )
       
  3394     {
       
  3395     _LIT8( KResult, "CompleteGetPin1DisableSupported result: %d" );
       
  3396     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3397 
       
  3398     if( KErrNone == aResult )
       
  3399         {
       
  3400 
       
  3401         }
       
  3402     else
       
  3403         {
       
  3404         _LIT8( KFail, "CompleteGetPin1DisableSupported Failed: %d" );
       
  3405         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3406         }
       
  3407 
       
  3408     Signal( aResult );
       
  3409     }
       
  3410 // -----------------------------------------------------------------------------
       
  3411 // CSIM::SimRefreshRegister
       
  3412 // Sim Refresh Register
       
  3413 // -----------------------------------------------------------------------------
       
  3414 //
       
  3415 TInt CSIM::SimRefreshRegister( CStifItemParser& aItem )
       
  3416     {
       
  3417     _LIT8(KSimRefresh, "SIM::SimRefreshRegister");
       
  3418     iSIMLog->Log((TDesC8)KSimRefresh);
       
  3419 
       
  3420     TUint filesToRegister;
       
  3421     aItem.GetNextInt( filesToRegister );
       
  3422 
       
  3423     //Create package
       
  3424     CMmDataPackage package;
       
  3425     package.PackData( &filesToRegister );
       
  3426 
       
  3427     TInt ret( KErrNotFound );
       
  3428     ret = HandleRequestL( EMmTsySimRefreshRegisterIPC, &package );
       
  3429 
       
  3430     if ( KErrNone == ret )
       
  3431         {
       
  3432         _LIT8( KSendOk, "SimRefreshRegister request send ok" );
       
  3433         iSIMLog->Log((TDesC8)KSendOk );
       
  3434         }
       
  3435     else
       
  3436         {
       
  3437          _LIT8( KSendFailed, "SimRefreshRegister request send failed: %d" );
       
  3438         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3439 
       
  3440         }
       
  3441 
       
  3442     return ret;
       
  3443     }
       
  3444 // -----------------------------------------------------------------------------
       
  3445 // CSIM::CompleteSimRefreshRegister
       
  3446 // Complete SimRefreshRegister method function.
       
  3447 // -----------------------------------------------------------------------------
       
  3448 //
       
  3449 void CSIM::CompleteSimRefreshRegister
       
  3450         (
       
  3451         TInt aResult
       
  3452         )
       
  3453     {
       
  3454     _LIT8( KResult, "CompleteSimRefreshRegister result: %d" );
       
  3455     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3456 
       
  3457     if( KErrNone == aResult )
       
  3458         {
       
  3459 
       
  3460         }
       
  3461     else
       
  3462         {
       
  3463         _LIT8( KFail, "CompleteSimRefreshRegister Failed: %d" );
       
  3464         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3465         }
       
  3466 
       
  3467     Signal( aResult );
       
  3468     }
       
  3469 
       
  3470 // -----------------------------------------------------------------------------
       
  3471 // CSIM::SimRefreshDone
       
  3472 // Sim Refresh Done
       
  3473 // -----------------------------------------------------------------------------
       
  3474 //
       
  3475 TInt CSIM::SimRefreshDone( CStifItemParser& aItem )
       
  3476     {
       
  3477     _LIT8(KSimRefresh, "SIM::SimRefreshDone");
       
  3478     iSIMLog->Log((TDesC8)KSimRefresh);
       
  3479 
       
  3480     TUint error;
       
  3481     aItem.GetNextInt( error );
       
  3482 
       
  3483     //Create package
       
  3484     CMmDataPackage package;
       
  3485     package.PackData( &error );
       
  3486 
       
  3487     TInt ret( KErrNotFound );
       
  3488     ret = HandleRequestL( EMmTsySimRefreshDoneIPC, &package );
       
  3489 
       
  3490     if ( KErrNone == ret )
       
  3491         {
       
  3492         _LIT8( KSendOk, "SimRefreshDone request send ok" );
       
  3493         iSIMLog->Log((TDesC8)KSendOk );
       
  3494         }
       
  3495     else
       
  3496         {
       
  3497          _LIT8( KSendFailed, "SimRefreshDone request send failed: %d" );
       
  3498         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3499 
       
  3500         }
       
  3501 
       
  3502     return ret;
       
  3503     }
       
  3504 // -----------------------------------------------------------------------------
       
  3505 // CSIM::CompleteSimRefreshDone
       
  3506 // Complete SimRefreshRegister method function.
       
  3507 // -----------------------------------------------------------------------------
       
  3508 //
       
  3509 void CSIM::CompleteSimRefreshDone
       
  3510         (
       
  3511         TInt aResult
       
  3512         )
       
  3513     {
       
  3514     _LIT8( KResult, "CompleteSimRefreshDone result: %d" );
       
  3515     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3516 
       
  3517     if( KErrNone == aResult )
       
  3518         {
       
  3519 
       
  3520         }
       
  3521     else
       
  3522         {
       
  3523         _LIT8( KFail, "CompleteSimRefreshDone Failed: %d" );
       
  3524         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3525         }
       
  3526 
       
  3527     Signal( aResult );
       
  3528     }
       
  3529 
       
  3530 // -----------------------------------------------------------------------------
       
  3531 // CSIM::GetSubscriberId
       
  3532 // Get Subscriber Id (IMSI)
       
  3533 // -----------------------------------------------------------------------------
       
  3534 //
       
  3535 TInt CSIM::GetSubscriberId( CStifItemParser& aItem )
       
  3536     {
       
  3537     _LIT8(KIMSI, "SIM::GetSubscriberId");
       
  3538     iSIMLog->Log((TDesC8)KIMSI);
       
  3539 
       
  3540     TInt ret( KErrNotFound );
       
  3541 
       
  3542     // store given parameters for validity checking
       
  3543     if ( iHandleSpecifiedRequests )
       
  3544         {
       
  3545         TPtrC temp;
       
  3546         aItem.GetNextString( temp );
       
  3547         iImsi.Append(temp);
       
  3548         }
       
  3549 
       
  3550     ret = HandleRequestL( EMobilePhoneGetSubscriberId );
       
  3551 
       
  3552     if ( KErrNone == ret )
       
  3553         {
       
  3554         _LIT8( KSendOk, "GetSubscriberId request send ok" );
       
  3555         iSIMLog->Log((TDesC8)KSendOk );
       
  3556         }
       
  3557     else
       
  3558         {
       
  3559          _LIT8( KSendFailed, "GetSubscriberId request send failed: %d" );
       
  3560         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3561         }
       
  3562 
       
  3563     return ret;
       
  3564     }
       
  3565 // -----------------------------------------------------------------------------
       
  3566 // CSIM::CompleteGetSubscriberId
       
  3567 // Complete GetSubscriberId method function.
       
  3568 // -----------------------------------------------------------------------------
       
  3569 //
       
  3570 void CSIM::CompleteGetSubscriberId
       
  3571         (
       
  3572         TInt aResult,
       
  3573         CMmDataPackage* aDataPackage
       
  3574         )
       
  3575     {
       
  3576     _LIT8( KResult, "CompleteGetSubscriberId result: %d" );
       
  3577     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3578 
       
  3579     if( KErrNone == aResult )
       
  3580         {
       
  3581         TBuf8<RMobilePhone::KIMSISize> imsi;
       
  3582         aDataPackage->UnPackData( imsi );
       
  3583         iSIMLog->Log((TDesC8)KLine );
       
  3584         _LIT8( KIMSI, "IMSI:" );
       
  3585         for( TInt i( 0 ); i < RMobilePhone::KIMSISize; i++)
       
  3586             {
       
  3587             iSIMLog->Log((TDesC8)KIMSI );
       
  3588             _LIT8( KIMSI2, " %d" );
       
  3589             iSIMLog->Log((TDesC8)KIMSI2, imsi[i] );
       
  3590             }
       
  3591         iSIMLog->Log((TDesC8)KLine );
       
  3592 
       
  3593         // validity checking
       
  3594         if ( iHandleSpecifiedRequests )
       
  3595             {
       
  3596             if( imsi != iImsi )
       
  3597                 {
       
  3598                 aResult = KErrGeneral;
       
  3599                 }
       
  3600             }
       
  3601         }
       
  3602     else
       
  3603         {
       
  3604         _LIT8( KFail, "CompleteGetSubscriberId Failed: %d" );
       
  3605         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3606         }
       
  3607 
       
  3608     Signal( aResult );
       
  3609     }
       
  3610 // -----------------------------------------------------------------------------
       
  3611 // CSIM::GetServiceProviderName
       
  3612 // GetServiceProviderName
       
  3613 // -----------------------------------------------------------------------------
       
  3614 //
       
  3615 TInt CSIM::GetServiceProviderName( CStifItemParser& aItem )
       
  3616     {
       
  3617     _LIT8(KIMSI, "SIM::GetSubscriberId");
       
  3618     iSIMLog->Log((TDesC8)KIMSI);
       
  3619 
       
  3620     TInt ret( KErrNotFound );
       
  3621 
       
  3622     if( iHandleSpecifiedRequests )
       
  3623         {
       
  3624         aItem.GetNextInt( iDisplayReq );
       
  3625         }
       
  3626 
       
  3627     ret = HandleRequestL( EMobilePhoneGetServiceProviderName );
       
  3628 
       
  3629     if ( KErrNone == ret )
       
  3630         {
       
  3631         _LIT8( KSendOk, "GetServiceProviderName request send ok" );
       
  3632         iSIMLog->Log((TDesC8)KSendOk );
       
  3633         }
       
  3634     else
       
  3635         {
       
  3636          _LIT8( KSendFailed, "GetServiceProviderName request send failed: %d" );
       
  3637         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3638         }
       
  3639 
       
  3640     return ret;
       
  3641     }
       
  3642 // -----------------------------------------------------------------------------
       
  3643 // CSIM::CompleteGetServiceProviderName
       
  3644 // Complete GetServiceProviderName method function.
       
  3645 // -----------------------------------------------------------------------------
       
  3646 //
       
  3647 void CSIM::CompleteGetServiceProviderName
       
  3648         (
       
  3649         TInt aResult,
       
  3650         CMmDataPackage* aDataPackage
       
  3651         )
       
  3652     {
       
  3653     _LIT8( KResult, "CompleteGetServiceProviderName result: %d" );
       
  3654     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3655 
       
  3656     if( KErrNone == aResult )
       
  3657         {
       
  3658         RMobilePhone::TMobilePhoneServiceProviderNameV2 serviceProviderName;
       
  3659         aDataPackage->UnPackData( serviceProviderName );
       
  3660 
       
  3661         TBuf8<255> drBuffer;
       
  3662         _LIT8(KRowFormatter1, "Display req: %d");
       
  3663         drBuffer.Format(KRowFormatter1, &serviceProviderName.iDisplayReq);
       
  3664         iSIMLog->Log(drBuffer);
       
  3665 
       
  3666         TBuf8<255> nameBuffer;
       
  3667         _LIT8(KRowFormatter2, "Service provider name: %S");
       
  3668         nameBuffer.Format(KRowFormatter2, &serviceProviderName.iSPName);
       
  3669         iSIMLog->Log(nameBuffer);
       
  3670 
       
  3671         TBuf8<255> plmnBuffer;
       
  3672         _LIT8(KRowFormatter3, "PLMN field: %S");
       
  3673         plmnBuffer.Format(KRowFormatter3, &serviceProviderName.iPLMNField);
       
  3674         iSIMLog->Log(plmnBuffer);
       
  3675 
       
  3676         if( iHandleSpecifiedRequests )
       
  3677             {
       
  3678             if(serviceProviderName.iDisplayReq != iDisplayReq )
       
  3679                 {
       
  3680                 aResult = KErrGeneral;
       
  3681                 }
       
  3682             }
       
  3683         }
       
  3684     else
       
  3685         {
       
  3686         _LIT8( KFail, "CompleteGetServiceProviderName Failed: %d" );
       
  3687         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3688         }
       
  3689 
       
  3690     Signal( aResult );
       
  3691     }
       
  3692 
       
  3693 
       
  3694 // -----------------------------------------------------------------------------
       
  3695 // CSIM::ReadSimFile
       
  3696 // ReadSimFile
       
  3697 // -----------------------------------------------------------------------------
       
  3698 //
       
  3699 TInt CSIM::ReadSimFile( CStifItemParser& aItem )
       
  3700     {
       
  3701     _LIT8(KReadSimFile, "SIM::ReadSimFile");
       
  3702     iSIMLog->Log((TDesC8)KReadSimFile);
       
  3703 
       
  3704     TInt ret( KErrNotFound );
       
  3705     TBool supported( ETrue );
       
  3706     TPtrC string;
       
  3707 
       
  3708     RMmCustomAPI::TSimFileInfo simFileInfo;
       
  3709 
       
  3710     // File ID
       
  3711     TBuf8<8> path; // File path in SIM where file is read
       
  3712     TInt offSet; // Offset from beginning of the file
       
  3713     TInt size; // Amount of data to read
       
  3714 
       
  3715     TInt masterFile;  // Master File
       
  3716     TInt dedicatedFile1;  // Dedicated File
       
  3717     TInt dedicatedFile2;  // Dedicated File
       
  3718     TInt elementaryFile;  // Elementary File
       
  3719 
       
  3720     aItem.GetNextInt( masterFile );
       
  3721     aItem.GetNextInt( dedicatedFile1 );
       
  3722     aItem.GetNextInt( dedicatedFile2 );
       
  3723     aItem.GetNextInt( elementaryFile );
       
  3724     aItem.GetNextInt( offSet );
       
  3725     aItem.GetNextInt( size );
       
  3726 
       
  3727     path.Append(masterFile>>8);
       
  3728     path.Append(masterFile);
       
  3729     path.Append(dedicatedFile1>>8);
       
  3730     path.Append(dedicatedFile1);
       
  3731     path.Append(dedicatedFile2>>8);
       
  3732     path.Append(dedicatedFile2);
       
  3733     path.Append(elementaryFile>>8);
       
  3734     path.Append(elementaryFile);
       
  3735 
       
  3736     simFileInfo.iPath = path;
       
  3737     simFileInfo.iOffSet = (TUint16)offSet;
       
  3738     simFileInfo.iSize = (TUint16)size;
       
  3739 
       
  3740     //Create package
       
  3741     CMmDataPackage dataPackage;
       
  3742     dataPackage.PackData( &simFileInfo );
       
  3743 
       
  3744     ret = HandleRequestL( ECustomReadSimFileIPC,
       
  3745                          &dataPackage );
       
  3746 
       
  3747     if ( KErrNone == ret )
       
  3748         {
       
  3749         _LIT8( KSendOk, "ReadSimFile request send ok" );
       
  3750         iSIMLog->Log((TDesC8)KSendOk );
       
  3751         }
       
  3752     else
       
  3753         {
       
  3754          _LIT8( KSendFailed, "ReadSimFile request send failed: %d" );
       
  3755         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3756         }
       
  3757 
       
  3758     return ret;
       
  3759 
       
  3760     }
       
  3761 
       
  3762 // -----------------------------------------------------------------------------
       
  3763 // CSIM::CompleteReadSimFile
       
  3764 // Complete ReadSimFile method function.
       
  3765 // -----------------------------------------------------------------------------
       
  3766 //
       
  3767 void CSIM::CompleteReadSimFile
       
  3768         (
       
  3769         TInt aResult,
       
  3770         CMmDataPackage* /*aDataPackage*/
       
  3771         )
       
  3772     {
       
  3773 
       
  3774 
       
  3775     _LIT8( KResult, "CompleteReadSimFile result: %d" );
       
  3776     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3777 
       
  3778     if( KErrNone == aResult )
       
  3779         {
       
  3780         _LIT8( KPass, "CompleteReadSimFile Passed: %d" );
       
  3781         iSIMLog->Log((TDesC8)KPass, aResult );
       
  3782         }
       
  3783     else
       
  3784         {
       
  3785         _LIT8( KFail, "CompleteReadSimFile Failed: %d" );
       
  3786         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3787         }
       
  3788 
       
  3789     Signal( aResult );
       
  3790     }
       
  3791 
       
  3792 
       
  3793 
       
  3794 // -----------------------------------------------------------------------------
       
  3795 // CSIM::GetNetworkProviderName
       
  3796 // GetNetworkProviderName
       
  3797 // -----------------------------------------------------------------------------
       
  3798 //
       
  3799 TInt CSIM::GetNetworkProviderName( CStifItemParser& aItem )
       
  3800     {
       
  3801     _LIT8(KWriteONStore, "SIM::GetNetworkProviderName");
       
  3802     iSIMLog->Log((TDesC8)KWriteONStore);
       
  3803 
       
  3804     TInt ret( KErrNotFound );
       
  3805 
       
  3806     // for validity checking
       
  3807     if( iHandleSpecifiedRequests )
       
  3808         {
       
  3809         TPtrC temp;
       
  3810         aItem.GetNextString( temp );
       
  3811         if ( temp == _L("Orange") )
       
  3812             {
       
  3813             iName.Append( _L(" Orange") );
       
  3814             }
       
  3815         }
       
  3816 
       
  3817     ret = HandleRequestL( ECustomGetNetworkProviderNameIPC );
       
  3818 
       
  3819     if ( KErrNone == ret )
       
  3820         {
       
  3821         _LIT8( KSendOk, "GetNetworkProviderName request send ok" );
       
  3822         iSIMLog->Log((TDesC8)KSendOk );
       
  3823         }
       
  3824     else
       
  3825         {
       
  3826          _LIT8( KSendFailed, "GetNetworkProviderName request send failed: %d" );
       
  3827         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  3828         }
       
  3829 
       
  3830     return ret;
       
  3831 
       
  3832     }
       
  3833 
       
  3834 // -----------------------------------------------------------------------------
       
  3835 // CSIM::CompleteGetNetworkProviderName
       
  3836 // Complete GetNetworkProviderName method function.
       
  3837 // -----------------------------------------------------------------------------
       
  3838 //
       
  3839 void CSIM::CompleteGetNetworkProviderName
       
  3840         (
       
  3841         TInt aResult,
       
  3842         CMmDataPackage* aDataPackage
       
  3843         )
       
  3844     {
       
  3845     _LIT8( KResult, "CompleteGetNetworkProviderName result: %d" );
       
  3846     iSIMLog->Log((TDesC8)KResult, aResult );
       
  3847 
       
  3848     if( KErrNone == aResult )
       
  3849         {
       
  3850         //network provider name
       
  3851         TDesC* name;
       
  3852 
       
  3853         aDataPackage->UnPackData( name );
       
  3854 
       
  3855         _LIT8( KName, "Name:" );
       
  3856         iSIMLog->Log((TDesC8)KName);
       
  3857         iSIMLog->Log( *name );
       
  3858 
       
  3859         // validity checking
       
  3860         if( iHandleSpecifiedRequests )
       
  3861             {
       
  3862             TBuf<20> tempName;
       
  3863             tempName.Append( *name );
       
  3864             if ( iName != tempName )
       
  3865                 {
       
  3866                 aResult = KErrGeneral;
       
  3867                 }
       
  3868             }
       
  3869         }
       
  3870     else
       
  3871         {
       
  3872         _LIT8( KFail, "CompleteGetNetworkProviderName Failed: %d" );
       
  3873         iSIMLog->Log((TDesC8)KFail, aResult );
       
  3874         }
       
  3875 
       
  3876     Signal( aResult );
       
  3877     }
       
  3878 
       
  3879 // -----------------------------------------------------------------------------
       
  3880 // CSIM::GetHexFromString
       
  3881 // Converts source string containing ascii characters 0-9, a-f, A-F to
       
  3882 // corresponding hex value.
       
  3883 // (other items was commented in header)
       
  3884 // -----------------------------------------------------------------------------
       
  3885 //
       
  3886 TInt CSIM::GetHexFromString( TPtrC aSource, TDes8& aDest ) const
       
  3887     {
       
  3888     TUint8 number( 0 );
       
  3889     TInt ret( 0 );
       
  3890 
       
  3891     TBuf<2> charBuf;
       
  3892     TPtrC ptr;
       
  3893     TLex lexChar;
       
  3894 
       
  3895     //It must be possible to divide source by two
       
  3896     if ( 0 == ( aSource.Length() % 2 ) )
       
  3897         {
       
  3898         for ( TUint i = 0;
       
  3899               (i < ( aDest.MaxLength() * 2 ) && i < aSource.Length() );
       
  3900               i = i + 2)
       
  3901             {
       
  3902             charBuf.Zero();
       
  3903             // Take two characters to be converted.
       
  3904             charBuf.Append( aSource[i] );
       
  3905             charBuf.Append( aSource[i+1] );
       
  3906             ptr.Set( charBuf );
       
  3907             lexChar = ptr;
       
  3908             ret = lexChar.Val( number, EHex );
       
  3909             aDest.Append( number );
       
  3910 
       
  3911             if ( KErrNone != ret)
       
  3912                 {
       
  3913                 break;
       
  3914                 }
       
  3915             } //for
       
  3916         } // if ( 0 == ( aSource.Length() % 2 ) )
       
  3917     else
       
  3918         {
       
  3919         ret = KErrArgument;
       
  3920         }
       
  3921 
       
  3922     return ret;
       
  3923     }
       
  3924 
       
  3925 // -----------------------------------------------------------------------------
       
  3926 // CSIM::GetSimAuthenticationData
       
  3927 //
       
  3928 // -----------------------------------------------------------------------------
       
  3929 //
       
  3930 TInt CSIM::GetSimAuthenticationData( CStifItemParser& aItem )
       
  3931     {
       
  3932     _LIT8(KWriteONStore, "SIM::GetSimAuthenticationData");
       
  3933     iSIMLog->Log((TDesC8)KWriteONStore);
       
  3934 
       
  3935     TInt ret( KErrNotFound );
       
  3936     TBool supported( ETrue );
       
  3937     TPtrC string;
       
  3938 
       
  3939     aItem.GetNextString ( string );
       
  3940 
       
  3941     if ( _L("SIM") == string )
       
  3942         {
       
  3943 
       
  3944         //Create package
       
  3945         CMmDataPackage package;
       
  3946         RMmCustomAPI::TSimAuthenticationEapSim::TSimAuthenticationEapSim();
       
  3947         RMmCustomAPI::TSimAuthenticationEapSim eapSim;
       
  3948 
       
  3949         TInt rfsState = 1; // ERfsActivated;
       
  3950 
       
  3951         //Fill iRandomParameters, used as data in SIM_SB_RAND_PARAMS sub block.
       
  3952         eapSim.iRandomParameters.Fill( 0x00, 16 );
       
  3953 
       
  3954         eapSim.iSRES.Append( 0 );
       
  3955         eapSim.iKC.Append( 0 );
       
  3956 
       
  3957         package.PackData( &eapSim, &rfsState );
       
  3958         ret = HandleRequestL( ECustomGetSimAuthenticationDataIPC, &package );
       
  3959         }
       
  3960     else if( _L("AKA") == string )
       
  3961         {
       
  3962         //Create package
       
  3963         CMmDataPackage package;
       
  3964         RMmCustomAPI::TSimAuthenticationEapAka::TSimAuthenticationEapAka();
       
  3965         RMmCustomAPI::TSimAuthenticationEapAka eapAka;
       
  3966 
       
  3967         TInt rfsState = 1; // ERfsActivated;
       
  3968 
       
  3969         //Fill iRandomParameters and iAUTN. They are used as data in
       
  3970         //SIM_SB_RAND_PARAMS  and SIM_SB_UTMS_AUTN_PARAMS sub blocks.
       
  3971         eapAka.iRandomParameters.Fill( 0x00, 16);
       
  3972         eapAka.iAUTN.Fill( 0x00, 16);
       
  3973 
       
  3974         eapAka.iRES.Append( 0 );
       
  3975         eapAka.iCK.Append( 0 );
       
  3976         eapAka.iIK.Append( 0 );
       
  3977         eapAka.iAUTS.Append( 0 );
       
  3978 
       
  3979         package.PackData( &eapAka, &rfsState );
       
  3980         ret = HandleRequestL( ECustomGetSimAuthenticationDataIPC, &package );
       
  3981         }
       
  3982     else if( _L("GBABOOT") == string
       
  3983         || _L("GBABOOTUPDATE") == string
       
  3984         || _L("GBABOOTNAFDER") == string )
       
  3985         {
       
  3986         if ( iHandleSpecifiedRequests )
       
  3987             {
       
  3988             ret = GenerateGbaAuthenticationReq( string, aItem );
       
  3989             }
       
  3990         else
       
  3991             {
       
  3992             _LIT8(KNotSupported, "SIM::GetSimAuthenticationData - GBA only supported with iHandleSpecifiedRequest");
       
  3993             iSIMLog->Log( ( TDesC8 )KNotSupported );
       
  3994             }
       
  3995         }
       
  3996 
       
  3997     else if( _L("MGVMTKGENERATION") == string
       
  3998         || _L("MGVMSKUPDATE") == string
       
  3999         || _L("MGVMSKDELETION") == string )
       
  4000         {
       
  4001         if ( iHandleSpecifiedRequests )
       
  4002             {
       
  4003             ret = GenerateMgvAuthenticationReq( string, aItem );
       
  4004             }
       
  4005         else
       
  4006             {
       
  4007             _LIT8(KNotSupported, "SIM::GetSimAuthenticationData - MGV only supported with iHandleSpecifiedRequest");
       
  4008             iSIMLog->Log( ( TDesC8 )KNotSupported);
       
  4009             }
       
  4010         }
       
  4011 
       
  4012     else
       
  4013     {
       
  4014      _LIT8(KNotSupp, "SIM::Not supported");
       
  4015     iSIMLog->Log( ( TDesC8 )KNotSupp);
       
  4016     supported = EFalse;
       
  4017     }
       
  4018 
       
  4019     if( supported )
       
  4020         {
       
  4021         if ( KErrNone == ret )
       
  4022             {
       
  4023             _LIT8( KSendOk, "GetSimAuthenticationData request send ok" );
       
  4024             iSIMLog->Log( ( TDesC8 )KSendOk );
       
  4025             }
       
  4026         else
       
  4027             {
       
  4028              _LIT8( KSendFailed, "GetSimAuthenticationData request send failed: %d" );
       
  4029             iSIMLog->Log( ( TDesC8 )KSendFailed, ret );
       
  4030             }
       
  4031         }
       
  4032 
       
  4033     return ret;
       
  4034     }
       
  4035 
       
  4036 // -----------------------------------------------------------------------------
       
  4037 // CSIM::CompleteGetSimAuthenticationData
       
  4038 // Complete WriteONStore method function.
       
  4039 // -----------------------------------------------------------------------------
       
  4040 //
       
  4041 void CSIM::CompleteGetSimAuthenticationData
       
  4042         (
       
  4043         TInt aResult,
       
  4044         CMmDataPackage* aDataPackage
       
  4045         )
       
  4046     {
       
  4047     _LIT8( KResult, "CompleteGetSimAuthenticationData result: %d" );
       
  4048     iSIMLog->Log( ( TDesC8 )KResult, aResult );
       
  4049 
       
  4050     if( KErrNone == aResult && !iHandleSpecifiedRequests )
       
  4051         {
       
  4052         RMmCustomAPI::TSimAuthenticationBase* basePtr;
       
  4053         aDataPackage->UnPackData( &basePtr );
       
  4054 
       
  4055         switch ( basePtr->ExtensionId() )
       
  4056             {
       
  4057             case RMmCustomAPI::TSimAuthenticationBase::EEapSim:
       
  4058                 {
       
  4059                 //2G authentication
       
  4060                 RMmCustomAPI::TSimAuthenticationEapSim* eapSim;
       
  4061                 aDataPackage->UnPackData( &eapSim );
       
  4062 
       
  4063                 _LIT8( KSRES, "2G: SRES:" );
       
  4064                 iSIMLog->Log( ( TDesC8 )KSRES );
       
  4065                 TInt i = 0;
       
  4066                 for ( i = 0; i < ( eapSim->iSRES ).Length(); i++ )
       
  4067                     {
       
  4068                     _LIT8( KSRES2, "%d" );
       
  4069                     iSIMLog->Log( ( TDesC8 )KSRES2, eapSim->iSRES[i] );
       
  4070                     }
       
  4071 
       
  4072                 _LIT8( KKC, "2G: KC:" );
       
  4073                 iSIMLog->Log( ( TDesC8)KKC );
       
  4074                 for ( i = 0; i < (eapSim->iKC).Length(); i++ )
       
  4075                     {
       
  4076                     _LIT8( KKC2, "%d" );
       
  4077                     iSIMLog->Log( ( TDesC8 )KKC2, eapSim->iKC[i] );
       
  4078                     }
       
  4079 
       
  4080                 break;
       
  4081                 }
       
  4082             case RMmCustomAPI::TSimAuthenticationBase::EEapAka:
       
  4083                 {
       
  4084                 //3G authentication
       
  4085                 RMmCustomAPI::TSimAuthenticationEapAka* eapAka;
       
  4086 
       
  4087                 aDataPackage->UnPackData( &eapAka );
       
  4088 
       
  4089                 _LIT8( KRES, "3G: RES:" );
       
  4090                 iSIMLog->Log( ( TDesC8 )KRES );
       
  4091                 TInt i = 0;
       
  4092                 for ( i = 0; i < ( eapAka->iRES ).Length(); i++ )
       
  4093                     {
       
  4094                     _LIT8( KRES2, "%d" );
       
  4095                     iSIMLog->Log( ( TDesC8 )KRES2, eapAka->iRES[i] );
       
  4096                     }
       
  4097 
       
  4098                 _LIT8( KCK, "3G: CK:" );
       
  4099                 iSIMLog->Log( ( TDesC8 )KCK );
       
  4100                 for ( i = 0; i < ( eapAka->iCK ).Length(); i++)
       
  4101                     {
       
  4102                     _LIT8( KCK2, "%d" );
       
  4103                     iSIMLog->Log( ( TDesC8 )KCK2, eapAka->iCK[i] );
       
  4104                     }
       
  4105                 _LIT8( KIK, "3G: IK:" );
       
  4106                 iSIMLog->Log((TDesC8)KIK );
       
  4107                 for ( i = 0; i < ( eapAka->iIK ).Length(); i++ )
       
  4108                     {
       
  4109                     _LIT8( KIK2, "%d" );
       
  4110                     iSIMLog->Log( ( TDesC8 )KIK2, eapAka->iIK[i] );
       
  4111                     }
       
  4112                 break;
       
  4113                 }
       
  4114             default:
       
  4115                 {
       
  4116                 _LIT8( KFail, "CompleteGetSimAuthenticationData - unknown extensionId: %d" );
       
  4117                 iSIMLog->Log( ( TDesC8 )KFail, basePtr->ExtensionId() );
       
  4118                 break;
       
  4119                 }
       
  4120             } // switch ( basePtr->ExtensionId() )
       
  4121         } // if( KErrNone == aResult && !iHandleSpecifiedRequests )
       
  4122     else if ( KErrNone != aResult && !iHandleSpecifiedRequests )
       
  4123         {
       
  4124         _LIT8( KFail, "CompleteGetSimAuthenticationData Failed: %d" );
       
  4125         iSIMLog->Log( ( TDesC8 )KFail, aResult );
       
  4126         
       
  4127         if( -3214 == aResult || // KErrMMEtelSqnVerificationFailed
       
  4128             -3213 == aResult )  // KErrMMEtelMacVerificationFailed
       
  4129             {
       
  4130                 RMmCustomAPI::TSimAuthenticationEapAka* eapAka;
       
  4131                 aDataPackage->UnPackData( &eapAka );
       
  4132                 
       
  4133                 _LIT8( KRES, "3G: AUTS:" );
       
  4134                 iSIMLog->Log( ( TDesC8 )KRES );
       
  4135                 
       
  4136                 TInt i = 0;
       
  4137                 for ( i = 0; i < ( eapAka->iAUTS ).Length(); i++ )
       
  4138                     {
       
  4139                     _LIT8( KRES2, "%d" );
       
  4140                     iSIMLog->Log( ( TDesC8 )KRES2, eapAka->iAUTS[i] );
       
  4141                     }
       
  4142             }
       
  4143         
       
  4144         }
       
  4145 
       
  4146     else if ( iHandleSpecifiedRequests )
       
  4147         {
       
  4148         // GBA related tests
       
  4149         if ( EGbaBootOk == iAuthenticationPurpose
       
  4150             || EGbaBootAuthFail == iAuthenticationPurpose
       
  4151             || EGbaBootVerificationFail == iAuthenticationPurpose
       
  4152             || EGbaBootError == iAuthenticationPurpose
       
  4153             || EGbaNafDerOk == iAuthenticationPurpose
       
  4154             || EGbaNafDerAuthFail == iAuthenticationPurpose
       
  4155             || EGbaBootNafError == iAuthenticationPurpose
       
  4156             || EGbaBootUpdateOk == iAuthenticationPurpose
       
  4157             || EGbaBootUpdateError == iAuthenticationPurpose )
       
  4158             {
       
  4159             HandleGbaCompletion( aResult, aDataPackage );
       
  4160             }
       
  4161 
       
  4162         // MGV relates tests
       
  4163         if ( EMgvMskUpdateOk == iAuthenticationPurpose
       
  4164             || EMgvMskUpdateNull == iAuthenticationPurpose
       
  4165             || EMgvMskUpdateError == iAuthenticationPurpose
       
  4166             || EMgvMskUpdateWithOmaBCastExtension == iAuthenticationPurpose
       
  4167             || EMgvMtkGenerationOk == iAuthenticationPurpose
       
  4168             || EMgvMtkGenerationError == iAuthenticationPurpose
       
  4169             || EMgvMskDeletionOk == iAuthenticationPurpose
       
  4170             || EMgvMskDeletionError == iAuthenticationPurpose
       
  4171             || EMgvMskDeletionAuthFail == iAuthenticationPurpose
       
  4172             || EMgvMtkGenerationWithBcastManagementData == iAuthenticationPurpose 
       
  4173             || EMgvMtkGenerationWithBCastParentalControlData == iAuthenticationPurpose)
       
  4174             {
       
  4175             HandleMgvCompletion( aResult, aDataPackage );
       
  4176             }
       
  4177         } // else if ( iHandleSpecifiedRequests )
       
  4178 
       
  4179     Signal( aResult );
       
  4180     }
       
  4181 
       
  4182 // -----------------------------------------------------------------------------
       
  4183 // CSIM::GenerateMgvAuthenticationReq
       
  4184 // Generates and sends SIM_AUTHENTICATION_REQ message related to MGV.
       
  4185 // (other items was commented in header)
       
  4186 // -----------------------------------------------------------------------------
       
  4187 //
       
  4188 TInt CSIM::GenerateMgvAuthenticationReq( TPtrC aString, CStifItemParser& aItem )
       
  4189     {
       
  4190     // String to describe that conversion from input parameter to hex has failed
       
  4191     _LIT8(KFail, "SIM::GenerateMgvAuthenticationReq - Hex getting from string failed: %d");
       
  4192     TInt ret( KErrNone );
       
  4193     CMmDataPackage package;
       
  4194 
       
  4195     // Read test case purpose
       
  4196     aItem.GetNextInt( iAuthenticationPurpose );
       
  4197 
       
  4198     if ( _L("MGVMSKUPDATE") == aString )
       
  4199         {
       
  4200         RMmCustomAPI::TSimAuthenticationMgvMskUpdate mgvMskUpdate;
       
  4201 
       
  4202         // Pointers to strings passed in from .cfg script
       
  4203         TPtrC mikey;
       
  4204         TPtrC retParam;
       
  4205 
       
  4206         // Read and convert parameters going to DOS
       
  4207         aItem.GetNextString( mikey );
       
  4208         ret = GetHexFromString( mikey, mgvMskUpdate.iMikey );
       
  4209 
       
  4210         // Read and convert string to hexadecimals and store them
       
  4211         // (data coming to SOS). Expected incoming data depends on test
       
  4212         // purpose (ok, null Mikey, authentication fail).
       
  4213         if ( KErrNone == ret )
       
  4214             {
       
  4215             if ( EMgvMskUpdateOk == iAuthenticationPurpose )
       
  4216                 {
       
  4217                 aItem.GetNextString( retParam );
       
  4218                 ret = GetHexFromString(
       
  4219                     retParam,
       
  4220                     iAuthenticationMgvMskUpdate.iMikey );
       
  4221                 }
       
  4222              else if( EMgvMskUpdateWithOmaBCastExtension == iAuthenticationPurpose )
       
  4223                 {
       
  4224                 aItem.GetNextString( retParam );
       
  4225                 ret = GetHexFromString(
       
  4226                     retParam,
       
  4227                     iAuthenticationMgvMskUpdate.iMikey );
       
  4228                     
       
  4229                 aItem.GetNextString( retParam );
       
  4230                 ret = GetHexFromString(
       
  4231                     retParam,
       
  4232                     iAuthenticationMgvMskUpdate.iBCASTManagement );
       
  4233                     
       
  4234                 aItem.GetNextString( retParam );
       
  4235                 ret = GetHexFromString(
       
  4236                     retParam,
       
  4237                     iAuthenticationMgvMskUpdate.iParentalRating );
       
  4238                     
       
  4239                 aItem.GetNextString( retParam );
       
  4240                 ret = GetHexFromString(
       
  4241                     retParam,
       
  4242                     iAuthenticationMgvMskUpdate.iSecurityPolicyExt );
       
  4243                 }
       
  4244             }
       
  4245             else if ( EMgvMskUpdateNull == iAuthenticationPurpose
       
  4246                 || EMgvMskUpdateError == iAuthenticationPurpose )
       
  4247                 {
       
  4248                 // nothing must be saved for comparision.
       
  4249                 }
       
  4250 
       
  4251         // If conversion ok, pack data
       
  4252         if ( KErrNone == ret )
       
  4253             {
       
  4254             TInt rfsState = 1; // ERfsActivated;
       
  4255             package.PackData( &mgvMskUpdate, &rfsState );
       
  4256             }
       
  4257         } // if ( _L("MGVMSKUPDATE") == aString )
       
  4258 
       
  4259     else if ( _L("MGVMTKGENERATION") == aString )
       
  4260         {
       
  4261         RMmCustomAPI::TSimAuthenticationMgvMtkGeneration mtkGen;
       
  4262 
       
  4263         // Pointers to strings passed in from .cfg script
       
  4264         TPtrC mikey;
       
  4265         TPtrC retParam;
       
  4266 
       
  4267         // Read and convert parameters going to DOS
       
  4268         aItem.GetNextString( mikey );
       
  4269         ret = GetHexFromString( mikey, mtkGen.iMikey );
       
  4270 
       
  4271         // Read and convert string to hexadecimals and store them
       
  4272         // (data coming to SOS). Expected incoming data depends on test
       
  4273         // purpose (ok, error).
       
  4274         if ( KErrNone == ret )
       
  4275             {
       
  4276             if ( EMgvMtkGenerationOk == iAuthenticationPurpose )
       
  4277                 {
       
  4278                 aItem.GetNextString( retParam );
       
  4279                 ret = GetHexFromString(
       
  4280                     retParam,
       
  4281                     iAuthenticationMgvMtkGeneration.iMtkSalt );
       
  4282                 }
       
  4283             else if ( EMgvMtkGenerationWithBcastManagementData == iAuthenticationPurpose )
       
  4284                 {
       
  4285                 aItem.GetNextString( retParam );
       
  4286                 ret = GetHexFromString(
       
  4287                     retParam,
       
  4288                     iAuthenticationMgvMtkGeneration.iBCASTManagement );
       
  4289                     
       
  4290                 aItem.GetNextString( retParam );
       
  4291                 ret = GetHexFromString(
       
  4292                     retParam,
       
  4293                     iAuthenticationMgvMtkGeneration.iTrafficEncryptionKey );
       
  4294                     
       
  4295                 aItem.GetNextString( retParam );
       
  4296                 ret = GetHexFromString(
       
  4297                     retParam,
       
  4298                     iAuthenticationMgvMtkGeneration.iMtkSalt );
       
  4299                 }    
       
  4300             else if( EMgvMtkGenerationWithBCastParentalControlData == iAuthenticationPurpose )
       
  4301                 {
       
  4302                 aItem.GetNextString( retParam );
       
  4303                 ret = GetHexFromString(
       
  4304                     retParam,
       
  4305                     iAuthenticationMgvMtkGeneration.iBCASTManagement );
       
  4306                     
       
  4307                 aItem.GetNextString( retParam );
       
  4308                 ret = GetHexFromString(
       
  4309                     retParam,
       
  4310                     iAuthenticationMgvMtkGeneration.iParentalControl );
       
  4311                 } 
       
  4312             }
       
  4313             else if ( EMgvMtkGenerationError == iAuthenticationPurpose )
       
  4314                 {
       
  4315                 // nothing must be saved for comparision.
       
  4316                 }
       
  4317 
       
  4318         // If conversion ok, pack data
       
  4319         if ( KErrNone == ret )
       
  4320             {
       
  4321             TInt rfsState = 1; // ERfsActivated;
       
  4322             package.PackData( &mtkGen, &rfsState );
       
  4323             }
       
  4324         } // else if ( _L("MGVMTKGENERATION") == aString )
       
  4325 
       
  4326     else if ( _L("MGVMSKDELETION") == aString )
       
  4327         {
       
  4328         RMmCustomAPI::TSimAuthenticationMgvMskDeletion mskDel;
       
  4329 
       
  4330         // Pointers to strings passed in from .cfg script
       
  4331         TPtrC domainId;
       
  4332         TPtrC groupId;
       
  4333 
       
  4334         // Read and convert parameters going to DOS
       
  4335         aItem.GetNextString( domainId );
       
  4336         ret = GetHexFromString( domainId, mskDel.iKeyDomainId );
       
  4337         if ( KErrNone == ret )
       
  4338             {
       
  4339             aItem.GetNextString( groupId );
       
  4340             ret = GetHexFromString( groupId, mskDel.iKeyGroupIdPart );
       
  4341             }
       
  4342 
       
  4343         // If conversion ok, pack data
       
  4344         if ( KErrNone == ret )
       
  4345             {
       
  4346             TInt rfsState = 1; // ERfsActivated;
       
  4347             package.PackData( &mskDel, &rfsState );
       
  4348             }
       
  4349         } //  else if ( _L("MGVMSKDELETION") == aString ) )
       
  4350 
       
  4351     // Send data
       
  4352     if ( KErrNone == ret )
       
  4353         {
       
  4354         ret = HandleRequestL( ECustomGetSimAuthenticationDataIPC, &package );
       
  4355         }
       
  4356     else
       
  4357         {
       
  4358         iSIMLog->Log( ( TDesC8 )KFail, ret);
       
  4359         }
       
  4360 
       
  4361     return ret;
       
  4362     }
       
  4363 
       
  4364 // -----------------------------------------------------------------------------
       
  4365 // CSIM::GenerateGbaAuthenticationReq
       
  4366 // Generates and sends SIM_AUTHENTICATION_REQ message related to GBA.
       
  4367 // (other items was commented in header)
       
  4368 // -----------------------------------------------------------------------------
       
  4369 //
       
  4370 TInt CSIM::GenerateGbaAuthenticationReq( TPtrC aString, CStifItemParser& aItem )
       
  4371     {
       
  4372     // String to describe that conversion from input parameter to hex has failed
       
  4373     _LIT8(KFail, "SIM::GenerateGbaAuthenticationReq - Hex getting from string failed: %d");
       
  4374     TInt ret( KErrNone );
       
  4375     CMmDataPackage package;
       
  4376 
       
  4377     // Read test case purpose
       
  4378     aItem.GetNextInt( iAuthenticationPurpose );
       
  4379 
       
  4380     if ( _L("GBABOOT") == aString )
       
  4381         {
       
  4382         RMmCustomAPI::TSimAuthenticationGbaBootstrap gbaBoot;
       
  4383 
       
  4384         // Pointers to strings passed in from .cfg script
       
  4385         TPtrC randParams;
       
  4386         TPtrC autn;
       
  4387         TPtrC retParam;
       
  4388 
       
  4389         // Read and convert parameters going to DOS
       
  4390         aItem.GetNextString( autn );
       
  4391         aItem.GetNextString( randParams );
       
  4392         ret = GetHexFromString( randParams, gbaBoot.iRandomParameters );
       
  4393         if ( KErrNone == ret )
       
  4394             {
       
  4395             ret = GetHexFromString( autn, gbaBoot.iAUTN );
       
  4396             }
       
  4397 
       
  4398         // Read and convert string to hexadecimals and store them
       
  4399         // (data coming to SOS). Expected incoming data depends on test
       
  4400         // purpose (ok, authentication fail, verification fail).
       
  4401         if ( KErrNone == ret )
       
  4402             {
       
  4403             if ( EGbaBootOk == iAuthenticationPurpose )
       
  4404                 {
       
  4405                 aItem.GetNextString( retParam );
       
  4406                 ret = GetHexFromString(
       
  4407                     retParam,
       
  4408                     iAuthenticationGbaBoot.iRES );
       
  4409                 }
       
  4410             else if ( ( EGbaBootAuthFail == iAuthenticationPurpose )
       
  4411                 || ( EGbaBootError == iAuthenticationPurpose ) )
       
  4412                 {
       
  4413                 // nothing is returned from DOS to SOS in these cases.
       
  4414                 }
       
  4415             else if ( EGbaBootVerificationFail == iAuthenticationPurpose )
       
  4416                 {
       
  4417                 aItem.GetNextString( retParam );
       
  4418                 ret = GetHexFromString(
       
  4419                     retParam,
       
  4420                     iAuthenticationGbaBoot.iAUTS );
       
  4421                 }
       
  4422             } // if ( KErrNone == ret )
       
  4423 
       
  4424         //Pack data
       
  4425         if ( KErrNone == ret )
       
  4426             {
       
  4427             TInt rfsState = 1; // ERfsActivated;
       
  4428             package.PackData( &gbaBoot, &rfsState );
       
  4429             }
       
  4430 
       
  4431         } //if ( _L("GBABOOT") == aString )
       
  4432 
       
  4433     else if ( _L("GBABOOTUPDATE") == aString )
       
  4434         {
       
  4435         RMmCustomAPI::TSimAuthenticationGbaBootstrapUpdate gbaUpdate;
       
  4436 
       
  4437         // Pointers to strings passed in from .cfg script
       
  4438         TPtrC bTid;
       
  4439         TPtrC keyLifetime;
       
  4440         TPtrC retParam;
       
  4441 
       
  4442         // Read and convert parameters going to DOS
       
  4443         aItem.GetNextString( bTid );
       
  4444         aItem.GetNextString( keyLifetime );
       
  4445         ret = GetHexFromString( bTid, gbaUpdate.iBTid );
       
  4446         if ( KErrNone == ret )
       
  4447             {
       
  4448             ret = GetHexFromString( keyLifetime, gbaUpdate.iKeyLifeTime );
       
  4449             }
       
  4450 
       
  4451         // Read and convert string to hexadecimals and store it
       
  4452         // (data coming to SOS).
       
  4453         if ( KErrNone == ret )
       
  4454             {
       
  4455             if ( EGbaBootUpdateOk == iAuthenticationPurpose )
       
  4456                 {
       
  4457                 aItem.GetNextString( retParam );
       
  4458                 ret = GetHexFromString(
       
  4459                     retParam,
       
  4460                     iAuthenticationGbaBootUpdate.iRandomParameters );
       
  4461                 }
       
  4462             else
       
  4463                 {
       
  4464                 // nothing to be compared
       
  4465                 }
       
  4466 
       
  4467             }
       
  4468 
       
  4469         //Pack data
       
  4470         if ( KErrNone == ret )
       
  4471             {
       
  4472             TInt rfsState = 1; // ERfsActivated;
       
  4473             package.PackData( &gbaUpdate, &rfsState );
       
  4474             }
       
  4475 
       
  4476         } // else if ( _L("GBABOOT") == aString )
       
  4477 
       
  4478     else if ( _L("GBABOOTNAFDER") == aString )
       
  4479         {
       
  4480         RMmCustomAPI::TSimAuthenticationGbaNafDerivation gbaNaf;
       
  4481 
       
  4482         // Pointers to strings passed in from .cfg script
       
  4483         TPtrC nafId;
       
  4484         TPtrC impi;
       
  4485         TPtrC retParam;
       
  4486 
       
  4487         // Read and convert parameters going to DOS
       
  4488         aItem.GetNextString( nafId );
       
  4489         aItem.GetNextString( impi );
       
  4490         ret = GetHexFromString( nafId, gbaNaf.iNafId );
       
  4491         if ( KErrNone == ret )
       
  4492             {
       
  4493             ret = GetHexFromString( impi, gbaNaf.iImpi );
       
  4494             }
       
  4495 
       
  4496         // Read and convert string to hexadecimals and store them
       
  4497         // (data coming to SOS). Expected incoming data depends on test
       
  4498         // purpose (ok, authentication fail).
       
  4499         if ( KErrNone == ret )
       
  4500             {
       
  4501             if ( EGbaNafDerOk == iAuthenticationPurpose )
       
  4502                 {
       
  4503                 aItem.GetNextString( retParam );
       
  4504                 ret = GetHexFromString(
       
  4505                     retParam,
       
  4506                     iAuthenticationGbaNafDerivation.iKsExtNaf );
       
  4507                 }
       
  4508             else if ( ( EGbaNafDerAuthFail == iAuthenticationPurpose )
       
  4509                 || ( EGbaBootNafError == iAuthenticationPurpose ) )
       
  4510                 {
       
  4511                 // nothing is returned from DOS to SOS in this case.
       
  4512                 }
       
  4513             }
       
  4514 
       
  4515         //Pack data
       
  4516         if ( KErrNone == ret )
       
  4517             {
       
  4518             TInt rfsState = 1; // ERfsActivated;
       
  4519             package.PackData( &gbaNaf, &rfsState );
       
  4520             }
       
  4521         } // else if ( _L("GBABOOTNADFER") == aString )
       
  4522 
       
  4523     // Send data
       
  4524     if ( KErrNone == ret )
       
  4525         {
       
  4526         ret = HandleRequestL( ECustomGetSimAuthenticationDataIPC, &package );
       
  4527         }
       
  4528     else
       
  4529         {
       
  4530         iSIMLog->Log( ( TDesC8 ) KFail, ret);
       
  4531         }
       
  4532 
       
  4533     return ret;
       
  4534     }
       
  4535 
       
  4536 
       
  4537 // -----------------------------------------------------------------------------
       
  4538 // CSIM::HandleMgvCompletion
       
  4539 // Handles MGV related SIM_AUTHENTICATION completions. Checks if completion data
       
  4540 // is as waited.
       
  4541 // (other items was commented in header)
       
  4542 // -----------------------------------------------------------------------------
       
  4543 //
       
  4544 void CSIM::HandleMgvCompletion( TInt& aResult, CMmDataPackage* aDataPackage )
       
  4545     {
       
  4546     _LIT8( KCompareOk, "CSIM::HandleMgvCompletion: Comparison OK between waited and completed data" );
       
  4547     _LIT8( KCompareFail, "CSIM::HandleMgvCompletion: Comparison failed between waited and completed data" );
       
  4548     _LIT8( KExtFail, "CSIM::HandleMgvCompletion: extension id of packet wrong!" );
       
  4549 
       
  4550     if ( EMgvMskUpdateOk == iAuthenticationPurpose )
       
  4551         {
       
  4552         RMmCustomAPI::TSimAuthenticationMgvMskUpdate* mgvMskUpdate;
       
  4553         aDataPackage->UnPackData( &mgvMskUpdate );
       
  4554 
       
  4555          // Check correctness of extension id
       
  4556         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMskUpdate
       
  4557             != mgvMskUpdate->ExtensionId() )
       
  4558             {
       
  4559             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4560             aResult = KErrGeneral;
       
  4561             }
       
  4562 
       
  4563         // Compare completion data to waited data (inputted from .cfg)
       
  4564         if ( 0 == iAuthenticationMgvMskUpdate.iMikey.Compare(
       
  4565             mgvMskUpdate->iMikey ) )
       
  4566             {
       
  4567             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4568             }
       
  4569         else
       
  4570             {
       
  4571             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4572             aResult = KErrGeneral;
       
  4573             }
       
  4574 
       
  4575         // Log completed data
       
  4576         _LIT8( KMikey, "MGV MSK update, received Mikey:" );
       
  4577         iSIMLog->Log( ( TDesC8 )KMikey );
       
  4578         for ( TInt i( 0 ); i < ( mgvMskUpdate->iMikey ).Length(); i++ )
       
  4579             {
       
  4580             _LIT8( KMikey2, "%d" );
       
  4581             iSIMLog->Log( ( TDesC8 )KMikey2, mgvMskUpdate->iMikey[i] );
       
  4582             }
       
  4583         } // if ( EMgvMskUpdateOk == iAuthenticationPurpose )
       
  4584 
       
  4585     else if ( EMgvMskUpdateNull == iAuthenticationPurpose )
       
  4586         {
       
  4587         RMmCustomAPI::TSimAuthenticationMgvMskUpdate* mgvMskUpdate;
       
  4588         aDataPackage->UnPackData( &mgvMskUpdate );
       
  4589 
       
  4590         // Check correctness of extension id
       
  4591         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMskUpdate
       
  4592             != mgvMskUpdate->ExtensionId() )
       
  4593             {
       
  4594             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4595             aResult = KErrGeneral;
       
  4596             }
       
  4597 
       
  4598         // Mikey sub block must be included to ISI message, but Mikey
       
  4599         // length must be zero.
       
  4600         if ( 0 == iAuthenticationMgvMskUpdate.iMikey.Length() )
       
  4601             {
       
  4602             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4603             }
       
  4604         else
       
  4605             {
       
  4606             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4607             aResult = KErrGeneral;
       
  4608             }
       
  4609         } // else if ( EMgvMskUpdateNull == iAuthenticationPurpose )
       
  4610         
       
  4611     else if ( EMgvMskUpdateWithOmaBCastExtension == iAuthenticationPurpose )
       
  4612         {
       
  4613         RMmCustomAPI::TSimAuthenticationMgvMskUpdate* mgvMskUpdate;
       
  4614         aDataPackage->UnPackData( &mgvMskUpdate );
       
  4615         
       
  4616                  // Check correctness of extension id
       
  4617         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMskUpdate
       
  4618             != mgvMskUpdate->ExtensionId() )
       
  4619             {
       
  4620             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4621             aResult = KErrGeneral;
       
  4622             }
       
  4623             
       
  4624         // Compare completion data to waited data (inputted from .cfg)
       
  4625         if ( 0 == iAuthenticationMgvMskUpdate.iMikey.Compare(
       
  4626             mgvMskUpdate->iMikey ) )
       
  4627             {
       
  4628             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4629             }
       
  4630         else
       
  4631             {
       
  4632             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4633             aResult = KErrGeneral;
       
  4634             }
       
  4635 
       
  4636         // Compare completion data to waited data (inputted from .cfg)
       
  4637         if ( 0 == iAuthenticationMgvMskUpdate.iBCASTManagement.Compare(
       
  4638             mgvMskUpdate->iBCASTManagement ) )
       
  4639             {
       
  4640             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4641             }
       
  4642         else
       
  4643             {
       
  4644             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4645             aResult = KErrGeneral;
       
  4646             }
       
  4647             
       
  4648         // Compare completion data to waited data (inputted from .cfg)
       
  4649         if ( 0 == iAuthenticationMgvMskUpdate.iParentalRating.Compare(
       
  4650             mgvMskUpdate->iParentalRating ) )
       
  4651             {
       
  4652             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4653             }
       
  4654         else
       
  4655             {
       
  4656             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4657             aResult = KErrGeneral;
       
  4658             }
       
  4659             
       
  4660         // Compare completion data to waited data (inputted from .cfg)
       
  4661         if ( 0 == iAuthenticationMgvMskUpdate.iSecurityPolicyExt.Compare(
       
  4662             mgvMskUpdate->iSecurityPolicyExt ) )
       
  4663             {
       
  4664             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4665             }
       
  4666         else
       
  4667             {
       
  4668             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4669             aResult = KErrGeneral;
       
  4670             }
       
  4671         
       
  4672         
       
  4673          // Log completed Mikey data
       
  4674         _LIT8( KMikey, "MGV MSK update with OMa Bcast extension, received Mikey:" );
       
  4675         iSIMLog->Log( ( TDesC8 )KMikey );
       
  4676         for ( TInt i( 0 ); i < ( mgvMskUpdate->iMikey ).Length(); i++ )
       
  4677             {
       
  4678             _LIT8( KMikey2, "%d" );
       
  4679             iSIMLog->Log( ( TDesC8 )KMikey2, mgvMskUpdate->iMikey[i] );
       
  4680             }
       
  4681             
       
  4682          // Log completed BCast Management data
       
  4683         _LIT8( KBCastManagement, "MGV MSK update with OMa Bcast extension, received BCast Management:" );
       
  4684         iSIMLog->Log( ( TDesC8 )KBCastManagement );
       
  4685         for ( TInt i( 0 ); i < ( mgvMskUpdate->iBCASTManagement ).Length(); i++ )
       
  4686             {
       
  4687             _LIT8( KBCastManagement2, "%d" );
       
  4688             iSIMLog->Log( ( TDesC8 )KBCastManagement2, mgvMskUpdate->iBCASTManagement[i] );
       
  4689             }
       
  4690             
       
  4691          // Log completed Parental Rating data
       
  4692         _LIT8( KParentalRating, "MGV MSK update with OMa Bcast extension, received Parental Rating:" );
       
  4693         iSIMLog->Log( ( TDesC8 )KParentalRating );
       
  4694         for ( TInt i( 0 ); i < ( mgvMskUpdate->iParentalRating ).Length(); i++ )
       
  4695             {
       
  4696             _LIT8( KParentalRating2, "%d" );
       
  4697             iSIMLog->Log( ( TDesC8 )KParentalRating2, mgvMskUpdate->iParentalRating[i] );
       
  4698             }
       
  4699             
       
  4700          // Log completed Security policy ext data
       
  4701         _LIT8( KSpe, "MGV MSK update with OMa Bcast extension, received SEcurity policy extension data:" );
       
  4702         iSIMLog->Log( ( TDesC8 )KSpe );
       
  4703         for ( TInt i( 0 ); i < ( mgvMskUpdate->iSecurityPolicyExt ).Length(); i++ )
       
  4704             {
       
  4705             _LIT8( KSpe2, "%d" );
       
  4706             iSIMLog->Log( ( TDesC8 )KSpe2, mgvMskUpdate->iSecurityPolicyExt[i] );
       
  4707             }
       
  4708         } // else if ( EMgvMskUpdateWithOmaBCastExtension == iAuthenticationPurpose )
       
  4709     
       
  4710     else if ( EMgvMskUpdateError == iAuthenticationPurpose )
       
  4711         {
       
  4712         // nothing to compare or to do in this case.
       
  4713         }
       
  4714 
       
  4715     else if ( EMgvMtkGenerationOk == iAuthenticationPurpose )
       
  4716         {
       
  4717         RMmCustomAPI::TSimAuthenticationMgvMtkGeneration* mtkGen;
       
  4718         aDataPackage->UnPackData( &mtkGen );
       
  4719 
       
  4720         // Check correctness of extension id
       
  4721         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMtkGeneration
       
  4722             != mtkGen->ExtensionId() )
       
  4723             {
       
  4724             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4725             aResult = KErrGeneral;
       
  4726             }
       
  4727 
       
  4728         // Compare completion data to waited data (inputted from .cfg)
       
  4729         if ( 0 == iAuthenticationMgvMtkGeneration.iMtkSalt.Compare(
       
  4730             mtkGen->iMtkSalt ) )
       
  4731             {
       
  4732             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4733             }
       
  4734         else
       
  4735             {
       
  4736             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4737             aResult = KErrGeneral;
       
  4738             }
       
  4739 
       
  4740         // Log completed data
       
  4741         _LIT8( KSalt, "MGV MTK generation, received MTK salt:" );
       
  4742         iSIMLog->Log( ( TDesC8 )KSalt );
       
  4743         for ( TInt i( 0 ); i < ( mtkGen->iMtkSalt ).Length(); i++ )
       
  4744             {
       
  4745             _LIT8( KSalt2, "%d" );
       
  4746             iSIMLog->Log( ( TDesC8 )KSalt2, mtkGen->iMtkSalt[i] );
       
  4747             }
       
  4748         } // if ( EMgvMtkGenerationOk == iAuthenticationPurpose )
       
  4749         
       
  4750     else if( EMgvMtkGenerationWithBcastManagementData == iAuthenticationPurpose )
       
  4751         {
       
  4752         RMmCustomAPI::TSimAuthenticationMgvMtkGeneration* mtkGen;
       
  4753         aDataPackage->UnPackData( &mtkGen );
       
  4754 
       
  4755         // Check correctness of extension id
       
  4756         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMtkGeneration
       
  4757             != mtkGen->ExtensionId() )
       
  4758             {
       
  4759             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4760             aResult = KErrGeneral;
       
  4761             }
       
  4762 
       
  4763         // Compare BCast management completion data to waited data (inputted from .cfg)
       
  4764         if ( 0 == iAuthenticationMgvMtkGeneration.iBCASTManagement.Compare(
       
  4765             mtkGen->iBCASTManagement ) )
       
  4766             {
       
  4767             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4768             }
       
  4769         else
       
  4770             {
       
  4771             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4772             aResult = KErrGeneral;
       
  4773             }
       
  4774             
       
  4775         // Compare TEK completion data to waited data (inputted from .cfg)
       
  4776         if ( 0 == iAuthenticationMgvMtkGeneration.iTrafficEncryptionKey.Compare(
       
  4777             mtkGen->iTrafficEncryptionKey ) )
       
  4778             {
       
  4779             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4780             }
       
  4781         else
       
  4782             {
       
  4783             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4784             aResult = KErrGeneral;
       
  4785             }
       
  4786             
       
  4787         // Compare SALT completion data to waited data (inputted from .cfg)
       
  4788         if ( 0 == iAuthenticationMgvMtkGeneration.iMtkSalt.Compare(
       
  4789             mtkGen->iMtkSalt ) )
       
  4790             {
       
  4791             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4792             }
       
  4793         else
       
  4794             {
       
  4795             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4796             aResult = KErrGeneral;
       
  4797             }
       
  4798             
       
  4799         if ( 0 == mtkGen->iMikey.Length() &&
       
  4800              0 == mtkGen->iParentalControl.Length() )
       
  4801             {
       
  4802             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4803             }
       
  4804         else
       
  4805             {
       
  4806             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4807             aResult = KErrGeneral;
       
  4808             }
       
  4809             
       
  4810         // Log completed BCast management data
       
  4811         _LIT8( KBCastManagementData, "MGV MTK generation with BCast management data operation, received BCast management data:" );
       
  4812         iSIMLog->Log( ( TDesC8 )KBCastManagementData );
       
  4813         for ( TInt i( 0 ); i < ( mtkGen->iBCASTManagement ).Length(); i++ )
       
  4814             {
       
  4815             _LIT8( KBCastManagementData2, "%d" );
       
  4816             iSIMLog->Log( ( TDesC8 )KBCastManagementData2, mtkGen->iBCASTManagement[i] );
       
  4817             }
       
  4818             
       
  4819         // Log completed TEK data
       
  4820         _LIT8( KTek, "MGV MTK generation with BCast management data operation, received TEK data:" );
       
  4821         iSIMLog->Log( ( TDesC8 )KTek );
       
  4822         for ( TInt i( 0 ); i < ( mtkGen->iTrafficEncryptionKey ).Length(); i++ )
       
  4823             {
       
  4824             _LIT8( KTek2, "%d" );
       
  4825             iSIMLog->Log( ( TDesC8 )KTek2, mtkGen->iTrafficEncryptionKey[i] );
       
  4826             }
       
  4827             
       
  4828         // Log completed TEK data
       
  4829         _LIT8( KSalt, "MGV MTK generation with BCast management data operation, received SALT data:" );
       
  4830         iSIMLog->Log( ( TDesC8 )KSalt );
       
  4831         for ( TInt i( 0 ); i < ( mtkGen->iMtkSalt ).Length(); i++ )
       
  4832             {
       
  4833             _LIT8( KSalt2, "%d" );
       
  4834             iSIMLog->Log( ( TDesC8 )KSalt2, mtkGen->iMtkSalt[i] );
       
  4835             }
       
  4836         } // else if( EMgvMtkGenerationWithBcastManagementData == iAuthentcationPurpose )
       
  4837         
       
  4838     else if(EMgvMtkGenerationWithBCastParentalControlData == iAuthenticationPurpose )
       
  4839         {
       
  4840         RMmCustomAPI::TSimAuthenticationMgvMtkGeneration* mtkGen;
       
  4841         aDataPackage->UnPackData( &mtkGen );
       
  4842 
       
  4843         // Check correctness of extension id
       
  4844         if ( RMmCustomAPI::TSimAuthenticationBase::EMgvMtkGeneration
       
  4845             != mtkGen->ExtensionId() )
       
  4846             {
       
  4847             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4848             aResult = KErrGeneral;
       
  4849             }
       
  4850 
       
  4851         // Compare BCast management completion data to waited data (inputted from .cfg)
       
  4852         if ( 0 == iAuthenticationMgvMtkGeneration.iBCASTManagement.Compare(
       
  4853             mtkGen->iBCASTManagement ) )
       
  4854             {
       
  4855             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4856             }
       
  4857         else
       
  4858             {
       
  4859             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4860             aResult = KErrGeneral;
       
  4861             }
       
  4862             
       
  4863         // Compare TEK completion data to waited data (inputted from .cfg)
       
  4864         if ( 0 == iAuthenticationMgvMtkGeneration.iParentalControl.Compare(
       
  4865             mtkGen->iParentalControl ) )
       
  4866             {
       
  4867             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4868             }
       
  4869         else
       
  4870             {
       
  4871             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4872             aResult = KErrGeneral;
       
  4873             }
       
  4874             
       
  4875         if ( 0 == mtkGen->iMikey.Length() &&
       
  4876              0 == mtkGen->iMtkSalt.Length() &&
       
  4877              0 == mtkGen->iTrafficEncryptionKey.Length() )
       
  4878             {
       
  4879             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4880             }
       
  4881         else
       
  4882             {
       
  4883             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4884             aResult = KErrGeneral;
       
  4885             }
       
  4886             
       
  4887         // Log completed BCast management data
       
  4888         _LIT8( KBCastManagementData, "MGV MTK generation with BCast parental control operation, received BCast management data:" );
       
  4889         iSIMLog->Log( ( TDesC8 )KBCastManagementData );
       
  4890         for ( TInt i( 0 ); i < ( mtkGen->iBCASTManagement ).Length(); i++ )
       
  4891             {
       
  4892             _LIT8( KBCastManagementData2, "%d" );
       
  4893             iSIMLog->Log( ( TDesC8 )KBCastManagementData2, mtkGen->iBCASTManagement[i] );
       
  4894             }
       
  4895             
       
  4896         // Log completed TEK data
       
  4897         _LIT8( KParentalControl, "MGV MTK generation with BCast parental control operation, received parental control data:" );
       
  4898         iSIMLog->Log( ( TDesC8 )KParentalControl );
       
  4899         for ( TInt i( 0 ); i < ( mtkGen->iParentalControl ).Length(); i++ )
       
  4900             {
       
  4901             _LIT8( KParentalControl2, "%d" );
       
  4902             iSIMLog->Log( ( TDesC8 )KParentalControl2, mtkGen->iParentalControl[i] );
       
  4903             }
       
  4904         } // else if(EMgvMtkGenerationWithBCastParentalControlData == iAuthenticationPurpose )
       
  4905         
       
  4906 
       
  4907     else if ( EMgvMtkGenerationError == iAuthenticationPurpose )
       
  4908         {
       
  4909         // nothing to compare or to do in this case.
       
  4910         }
       
  4911 
       
  4912     else if ( EMgvMskDeletionOk == iAuthenticationPurpose
       
  4913         || EMgvMskDeletionError == iAuthenticationPurpose
       
  4914         || EMgvMskDeletionAuthFail == iAuthenticationPurpose )
       
  4915         {
       
  4916         _LIT8( KOk, "MGV MSK deletion, completion received with error code: %d" );
       
  4917         iSIMLog->Log( ( TDesC8 )KOk, aResult );
       
  4918         }
       
  4919 
       
  4920     else
       
  4921         {
       
  4922          _LIT8( KDefault, "CSIM::HandleMgvCompletion: no matching auth purpose id" );
       
  4923         iSIMLog->Log( ( TDesC8 )KDefault );
       
  4924         aResult = KErrGeneral;
       
  4925         }
       
  4926     }
       
  4927 
       
  4928 
       
  4929 // -----------------------------------------------------------------------------
       
  4930 // CSIM::HandleGbaCompletion
       
  4931 // Handles GBA related SIM_AUTHENTICATION completions. Checks if completion data
       
  4932 // is as waited.
       
  4933 // (other items was commented in header)
       
  4934 // -----------------------------------------------------------------------------
       
  4935 //
       
  4936 void CSIM::HandleGbaCompletion( TInt& aResult, CMmDataPackage* aDataPackage )
       
  4937     {
       
  4938     _LIT8( KCompareOk, "CSIM::HandleGbaCompletion: Comparison OK between waited and completed data" );
       
  4939     _LIT8( KCompareFail, "CSIM::HandleGbaCompletion: Comparison failed between waited and completed data" );
       
  4940     _LIT8( KExtFail, "CSIM::HandleGbaCompletion: extension id of packet wrong!" );
       
  4941 
       
  4942     if ( EGbaBootOk == iAuthenticationPurpose )
       
  4943         {
       
  4944         RMmCustomAPI::TSimAuthenticationGbaBootstrap* gbaBoot;
       
  4945         aDataPackage->UnPackData( &gbaBoot );
       
  4946 
       
  4947         // Check correctness of extension id
       
  4948         if ( RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrap
       
  4949             != gbaBoot->ExtensionId() )
       
  4950             {
       
  4951             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4952             aResult = KErrGeneral;
       
  4953             }
       
  4954 
       
  4955         // Compare completion data to waited data (inputted from .cfg)
       
  4956         if ( 0 == iAuthenticationGbaBoot.iRES.Compare( gbaBoot->iRES ) )
       
  4957             {
       
  4958             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  4959             }
       
  4960         else
       
  4961             {
       
  4962             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  4963             aResult = KErrGeneral;
       
  4964             }
       
  4965 
       
  4966         // Log completed data
       
  4967         _LIT8( KRES, "GBA bootstrap, received RES:" );
       
  4968         iSIMLog->Log( ( TDesC8 )KRES );
       
  4969         for ( TInt i( 0 ); i < ( gbaBoot->iRES ).Length(); i++ )
       
  4970             {
       
  4971             _LIT8( KRES2, "%d" );
       
  4972             iSIMLog->Log( ( TDesC8 )KRES2, gbaBoot->iRES[i] );
       
  4973             }
       
  4974         }
       
  4975 
       
  4976     else if ( ( EGbaBootAuthFail == iAuthenticationPurpose )
       
  4977         || ( EGbaBootError == iAuthenticationPurpose ) )
       
  4978         {
       
  4979             // Nothing to do or compare in these cases.
       
  4980         }
       
  4981 
       
  4982     else if ( EGbaBootVerificationFail == iAuthenticationPurpose )
       
  4983         {
       
  4984         RMmCustomAPI::TSimAuthenticationGbaBootstrap* gbaBoot;
       
  4985         aDataPackage->UnPackData( &gbaBoot );
       
  4986 
       
  4987         // Check correctness of extension id
       
  4988         if ( RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrap
       
  4989             != gbaBoot->ExtensionId() )
       
  4990             {
       
  4991             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  4992             aResult = KErrGeneral;
       
  4993             }
       
  4994 
       
  4995         // Compare completion data to waited data (inputted from .cfg)
       
  4996         if ( 0 == iAuthenticationGbaBoot.iAUTS.Compare(
       
  4997             gbaBoot->iAUTS ) )
       
  4998             {
       
  4999             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  5000             }
       
  5001         else
       
  5002             {
       
  5003             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  5004             aResult = KErrGeneral;
       
  5005             }
       
  5006 
       
  5007         // Log completed data
       
  5008         _LIT8( KAUTS, "GBA bootstrap, received AUTS:" );
       
  5009         iSIMLog->Log( ( TDesC8 )KAUTS );
       
  5010         for ( TInt i( 0 ); i < ( gbaBoot->iAUTS ).Length(); i++ )
       
  5011             {
       
  5012             _LIT8( KAUTS2, "%d" );
       
  5013             iSIMLog->Log( ( TDesC8 )KAUTS2, gbaBoot->iAUTS[i] );
       
  5014             }
       
  5015         }
       
  5016 
       
  5017 
       
  5018     else if ( EGbaBootUpdateOk == iAuthenticationPurpose )
       
  5019         {
       
  5020         RMmCustomAPI::TSimAuthenticationGbaBootstrapUpdate* gbaUpdate;
       
  5021         aDataPackage->UnPackData( &gbaUpdate );
       
  5022 
       
  5023         // Check correctness of extension id
       
  5024         if ( RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrapUpdate
       
  5025             != gbaUpdate->ExtensionId() )
       
  5026             {
       
  5027             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  5028             aResult = KErrGeneral;
       
  5029             }
       
  5030 
       
  5031         // Compare completion data to waited data (inputted from .cfg)
       
  5032         if ( 0 == iAuthenticationGbaBootUpdate.iRandomParameters.Compare(
       
  5033             gbaUpdate->iRandomParameters ) )
       
  5034             {
       
  5035             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  5036             }
       
  5037         else
       
  5038             {
       
  5039             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  5040             aResult = KErrGeneral;
       
  5041             }
       
  5042 
       
  5043         // Log completed data
       
  5044         _LIT8( KRand, "GBA bootstrap update, received random params:" );
       
  5045         iSIMLog->Log( ( TDesC8 )KRand );
       
  5046         for ( TInt i( 0 ); i < ( gbaUpdate->iRandomParameters ).Length(); i++ )
       
  5047             {
       
  5048             _LIT8( KRand2, "%d" );
       
  5049             iSIMLog->Log(
       
  5050                 ( TDesC8 )KRand2,
       
  5051                 gbaUpdate->iRandomParameters[i] );
       
  5052             }
       
  5053         }
       
  5054 
       
  5055     else if ( EGbaBootUpdateError == iAuthenticationPurpose )
       
  5056         {
       
  5057         // nothing to compare or to do in this case.
       
  5058         }
       
  5059 
       
  5060     else if ( EGbaNafDerOk == iAuthenticationPurpose )
       
  5061         {
       
  5062         RMmCustomAPI::TSimAuthenticationGbaNafDerivation* gbaNaf;
       
  5063         aDataPackage->UnPackData( &gbaNaf );
       
  5064 
       
  5065         // Check correctness of extension id
       
  5066         if ( RMmCustomAPI::TSimAuthenticationBase::EGbaBootstrapNafDerivation
       
  5067             != gbaNaf->ExtensionId() )
       
  5068             {
       
  5069             iSIMLog->Log( ( TDesC8 )KExtFail );
       
  5070             aResult = KErrGeneral;
       
  5071             }
       
  5072 
       
  5073         // Compare completion data to waited data (inputted from .cfg)
       
  5074         if ( 0 == iAuthenticationGbaNafDerivation.iKsExtNaf.Compare(
       
  5075             gbaNaf->iKsExtNaf ) )
       
  5076             {
       
  5077             iSIMLog->Log( ( TDesC8 )KCompareOk );
       
  5078             }
       
  5079         else
       
  5080             {
       
  5081             iSIMLog->Log( ( TDesC8 )KCompareFail );
       
  5082             aResult = KErrGeneral;
       
  5083             }
       
  5084 
       
  5085         // Log completed data
       
  5086         _LIT8( KNAF, "GBA NAF derivation, received Ks Ext NAF:" );
       
  5087         iSIMLog->Log( ( TDesC8 )KNAF );
       
  5088         for ( TInt i( 0 ); i < ( gbaNaf->iKsExtNaf ).Length(); i++ )
       
  5089             {
       
  5090             _LIT8( KNAF2, "%d" );
       
  5091             iSIMLog->Log( ( TDesC8 )KNAF2, gbaNaf->iKsExtNaf[i] );
       
  5092             }
       
  5093         }
       
  5094 
       
  5095     else if ( ( EGbaNafDerAuthFail == iAuthenticationPurpose )
       
  5096         || ( EGbaBootNafError == iAuthenticationPurpose ) )
       
  5097         {
       
  5098             // No need for comparison or actions it these cases.
       
  5099         }
       
  5100 
       
  5101     else
       
  5102         {
       
  5103         _LIT8( KDefault, "CSIM::HandleGbaCompletion: no matching auth purpose" );
       
  5104         iSIMLog->Log( ( TDesC8 )KDefault );
       
  5105         aResult = KErrGeneral;
       
  5106         }
       
  5107     }
       
  5108 
       
  5109 // -----------------------------------------------------------------------------
       
  5110 // CSIM::AuthenticateIMSData
       
  5111 // Authenticating IMS Data
       
  5112 // -----------------------------------------------------------------------------
       
  5113 //
       
  5114 TInt CSIM::AuthenticateIMSData( CStifItemParser& aItem )
       
  5115     {
       
  5116     _LIT8(KWriteONStore, "SIM::AuthenticateIMSData");
       
  5117     iSIMLog->Log((TDesC8)KWriteONStore);
       
  5118 
       
  5119     TInt ret( KErrNotFound );
       
  5120     TBool supported( ETrue );
       
  5121     TPtrC16 rand;
       
  5122     TPtrC16 aunt;
       
  5123 
       
  5124     RMobilePhone::TImsAuthenticateDataV5 authenticationData;
       
  5125 
       
  5126     if ( KErrNone == aItem.GetNextString ( rand ))
       
  5127         {
       
  5128         authenticationData.iRAND.Copy( rand );
       
  5129         }
       
  5130     if ( KErrNone == aItem.GetNextString ( aunt ))
       
  5131         {
       
  5132         authenticationData.iAUTN.Copy( aunt );
       
  5133         }
       
  5134 
       
  5135     //Create package
       
  5136     CMmDataPackage package;
       
  5137     package.PackData( &authenticationData );
       
  5138 
       
  5139     ret = HandleRequestL( EMobilePhoneIMSAuthenticate, &package );
       
  5140 
       
  5141     if ( KErrNone == ret )
       
  5142         {
       
  5143         _LIT8( KSendOk, "AuthenticateIMSData request send ok" );
       
  5144         iSIMLog->Log((TDesC8)KSendOk );
       
  5145         }
       
  5146     else
       
  5147         {
       
  5148          _LIT8( KSendFailed, "AuthenticateIMSData request send failed: %d" );
       
  5149         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5150         }
       
  5151 
       
  5152 
       
  5153     return ret;
       
  5154 
       
  5155     }
       
  5156 
       
  5157 // -----------------------------------------------------------------------------
       
  5158 // CSIM::CompleteAuthenticateIMSData
       
  5159 // Complete AuthenticateIMSData function.
       
  5160 // -----------------------------------------------------------------------------
       
  5161 //
       
  5162 void CSIM::CompleteAuthenticateIMSData
       
  5163         (
       
  5164         TInt aResult,
       
  5165         CMmDataPackage* aDataPackage
       
  5166         )
       
  5167     {
       
  5168     _LIT8( KResult, "CompleteAuthenticateIMSData result: %d" );
       
  5169     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5170 
       
  5171     RMobilePhone::TImsAuthenticateDataV5 authenticationData;
       
  5172         aDataPackage->UnPackData( authenticationData );
       
  5173 
       
  5174     if( KErrNone == aResult )
       
  5175         {
       
  5176         _LIT8( KRES, "IMS: RES:" );
       
  5177          iSIMLog->Log((TDesC8)KRES );
       
  5178          TInt i = 0;
       
  5179          for( i = 0; i < (authenticationData.iRES).Length(); i++)
       
  5180             {
       
  5181             _LIT8( KRES2, "%d" );
       
  5182             iSIMLog->Log((TDesC8)KRES2, authenticationData.iRES[i] );
       
  5183             }
       
  5184 
       
  5185          _LIT8( KCK, "IMS: CK:" );
       
  5186          iSIMLog->Log((TDesC8)KCK );
       
  5187          for( i = 0; i < (authenticationData.iCK).Length(); i++)
       
  5188             {
       
  5189             _LIT8( KCK2, "%d" );
       
  5190             iSIMLog->Log((TDesC8)KCK2, authenticationData.iCK[i] );
       
  5191             }
       
  5192          _LIT8( KIK, "IMS: IK:" );
       
  5193          iSIMLog->Log((TDesC8)KIK );
       
  5194          for( i = 0; i < (authenticationData.iIK).Length(); i++)
       
  5195             {
       
  5196             _LIT8( KIK2, "%d" );
       
  5197             iSIMLog->Log((TDesC8)KIK2, authenticationData.iIK[i] );
       
  5198             }
       
  5199         }
       
  5200     else
       
  5201         {
       
  5202         _LIT8( KFail, "CompleteAuthenticateIMSData Failed: %d" );
       
  5203         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5204 
       
  5205         _LIT8( KAUTS, "IMS: AUTS:" );
       
  5206          iSIMLog->Log((TDesC8)KAUTS );
       
  5207          TInt i = 0;
       
  5208          for( i = 0; i < (authenticationData.iAUTS).Length(); i++)
       
  5209             {
       
  5210             _LIT8( KiAUTS2, "%d" );
       
  5211             iSIMLog->Log((TDesC8)KiAUTS2, authenticationData.iAUTS[i] );
       
  5212             }
       
  5213         }
       
  5214 
       
  5215     Signal( aResult );
       
  5216     }
       
  5217 
       
  5218 // -----------------------------------------------------------------------------
       
  5219 // CSIM::GetIMSAuthorizationInfo
       
  5220 // Getting IMS Authorization Info
       
  5221 // -----------------------------------------------------------------------------
       
  5222 //
       
  5223 TInt CSIM::GetIMSAuthorizationInfo( CStifItemParser& /*aItem*/ )
       
  5224     {
       
  5225     _LIT8(KWriteONStore, "SIM::GetIMSAuthorizationInfo");
       
  5226     iSIMLog->Log((TDesC8)KWriteONStore);
       
  5227 
       
  5228     TInt ret( KErrNotFound );
       
  5229     TBool supported( ETrue );
       
  5230 
       
  5231     ret = HandleRequestL( EMobilePhoneAuthorizationInfoPhase1 );
       
  5232 
       
  5233     if ( KErrNone == ret )
       
  5234         {
       
  5235         _LIT8( KSendOk, "GetIMSAuthorizationInfo request send ok" );
       
  5236         iSIMLog->Log((TDesC8)KSendOk );
       
  5237         }
       
  5238     else
       
  5239         {
       
  5240          _LIT8( KSendFailed, "GetIMSAuthorizationInfo request send failed: %d" );
       
  5241         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5242         }
       
  5243 
       
  5244 
       
  5245     return ret;
       
  5246 
       
  5247     }
       
  5248 
       
  5249 // -----------------------------------------------------------------------------
       
  5250 // CSIM::CompleteGetIMSAuthorizationInfo
       
  5251 // Complete GetIMSAuthorizationInfo function.
       
  5252 // -----------------------------------------------------------------------------
       
  5253 //
       
  5254 void CSIM::CompleteGetIMSAuthorizationInfo
       
  5255         (
       
  5256         TInt aResult,
       
  5257         CMmDataPackage* /*aDataPackage*/
       
  5258         )
       
  5259     {
       
  5260     _LIT8( KResult, "CompleteGetIMSAuthorizationInfo result: %d" );
       
  5261     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5262 
       
  5263     if( KErrNone == aResult )
       
  5264         {
       
  5265         _LIT8( KPass, "CompleteGetIMSAuthorizationInfo Passed: %d" );
       
  5266         iSIMLog->Log((TDesC8)KPass, aResult );
       
  5267         }
       
  5268     else
       
  5269         {
       
  5270         _LIT8( KFail, "CompleteGetIMSAuthorizationInfo Failed: %d" );
       
  5271         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5272         }
       
  5273 
       
  5274     Signal( aResult );
       
  5275     }
       
  5276 
       
  5277 
       
  5278 // -----------------------------------------------------------------------------
       
  5279 // CSIM::GetALSBlockedStatus
       
  5280 // Getting ALS Blocked Status
       
  5281 // -----------------------------------------------------------------------------
       
  5282 //
       
  5283 TInt CSIM::GetALSBlockedStatus( CStifItemParser& aItem )
       
  5284     {
       
  5285     _LIT8(KAlsBlock, "SIM::GetALSBlockedStatus");
       
  5286     iSIMLog->Log((TDesC8)KAlsBlock);
       
  5287 
       
  5288     TInt ret( KErrNotFound );
       
  5289 
       
  5290     // for validity checking
       
  5291     if ( iHandleSpecifiedRequests )
       
  5292         {
       
  5293         TInt temp;
       
  5294         aItem.GetNextInt( temp );
       
  5295         iAlsBlockedStatus = ( RMmCustomAPI::TGetAlsBlockStatus )temp;
       
  5296         }
       
  5297 
       
  5298 
       
  5299     ret = HandleRequestL( ECustomGetAlsBlockedIPC );
       
  5300 
       
  5301     if ( KErrNone == ret )
       
  5302         {
       
  5303         _LIT8( KSendOk, "GetALSBlockedStatus request send ok" );
       
  5304         iSIMLog->Log((TDesC8)KSendOk );
       
  5305         }
       
  5306     else
       
  5307         {
       
  5308          _LIT8( KSendFailed, "GetALSBlockedStatus request send failed: %d" );
       
  5309         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5310         }
       
  5311 
       
  5312     return ret;
       
  5313     }
       
  5314 
       
  5315 // -----------------------------------------------------------------------------
       
  5316 // CSIM::CompleteGetALSBlockedStatus
       
  5317 // Complete GetALSBlockedStatus function.
       
  5318 // -----------------------------------------------------------------------------
       
  5319 //
       
  5320 void CSIM::CompleteGetALSBlockedStatus
       
  5321         (
       
  5322         TInt aResult,
       
  5323         CMmDataPackage* aDataPackage
       
  5324         )
       
  5325     {
       
  5326     _LIT8( KResult, "CompleteGetALSBlockedStatus result: %d" );
       
  5327     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5328 
       
  5329     RMmCustomAPI::TGetAlsBlockStatus aBlockStatus;
       
  5330     aDataPackage->UnPackData ( aBlockStatus );
       
  5331 
       
  5332     if ( KErrNone == aResult )
       
  5333         {
       
  5334         if ( aBlockStatus == RMmCustomAPI::EBlockStatusActive )
       
  5335             {
       
  5336             _LIT8( KStatus, "Als Blocking status is - - - - EBlockStatusActive" );
       
  5337             iSIMLog->Log((TDesC8)KStatus );
       
  5338             }
       
  5339         else if ( aBlockStatus == RMmCustomAPI::EBlockStatusInactive )
       
  5340             {
       
  5341             _LIT8( KStatus, "Als Blocking status is - - - - EBlockStatusInactive" );
       
  5342             iSIMLog->Log((TDesC8)KStatus );
       
  5343             }
       
  5344 
       
  5345         _LIT8( KPass, "CompleteGetALSBlockedStatus Passed: %d" );
       
  5346         iSIMLog->Log((TDesC8)KPass, aResult );
       
  5347 
       
  5348         // for validity checking
       
  5349         if ( iHandleSpecifiedRequests )
       
  5350             {
       
  5351             if ( aBlockStatus != iAlsBlockedStatus )
       
  5352                 {
       
  5353                 aResult = KErrGeneral;
       
  5354                 }
       
  5355             }
       
  5356         }
       
  5357     else if ( KErrNotFound == aResult )
       
  5358         {
       
  5359         _LIT8( KStatus, "Als Blocking status is - - - - EBlockStatusNotSupported" );
       
  5360         iSIMLog->Log((TDesC8)KStatus);
       
  5361 
       
  5362         _LIT8( KPass, "CompleteGetALSBlockedStatus Passed: %d" );
       
  5363         iSIMLog->Log((TDesC8)KPass, aResult );
       
  5364         }
       
  5365     else
       
  5366         {
       
  5367         _LIT8( KFail, "CompleteGetALSBlockedStatus Failed: %d" );
       
  5368         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5369         }
       
  5370 
       
  5371     Signal( aResult );
       
  5372     }
       
  5373 
       
  5374 // -----------------------------------------------------------------------------
       
  5375 // CSIM::SetALSBlockedStatus
       
  5376 // Setting ALS Blocked Status
       
  5377 // -----------------------------------------------------------------------------
       
  5378 //
       
  5379 TInt CSIM::SetALSBlockedStatus( CStifItemParser& aItem )
       
  5380     {
       
  5381     _LIT8(KSetAlsBlock, "SIM::SetALSBlockedStatus");
       
  5382     iSIMLog->Log((TDesC8)KSetAlsBlock );
       
  5383 
       
  5384     TInt ret( KErrNotFound );
       
  5385     TBool supported( ETrue );
       
  5386 
       
  5387     TPtrC status;
       
  5388 
       
  5389     aItem.GetNextString ( status );
       
  5390 
       
  5391     RMmCustomAPI::TSetAlsBlock aBlockStatus;
       
  5392 
       
  5393     if ( _L("Activate") == status )
       
  5394         {
       
  5395         aBlockStatus = RMmCustomAPI::EActivateBlock;
       
  5396         _LIT8( KActivate, "SetALSBlockedStatus = = EActivateBlock" );
       
  5397         iSIMLog->Log((TDesC8)KActivate );
       
  5398         }
       
  5399     else if( _L("Deactivate") == status )
       
  5400         {
       
  5401         aBlockStatus = RMmCustomAPI::EDeactivateBlock;
       
  5402         _LIT8( KDeactivate, "SetALSBlockedStatus = = EDeactivateBlock" );
       
  5403         iSIMLog->Log((TDesC8)KDeactivate );
       
  5404         }
       
  5405     else
       
  5406         {
       
  5407          _LIT8(KNotSupp, "SIM::Selected status not supported");
       
  5408         iSIMLog->Log((TDesC8)KNotSupp);
       
  5409         supported = EFalse;
       
  5410         }
       
  5411 
       
  5412     //Create package
       
  5413     CMmDataPackage package;
       
  5414     package.PackData( &aBlockStatus );
       
  5415 
       
  5416     ret = HandleRequestL( ECustomSetAlsBlockedIPC, &package );
       
  5417 
       
  5418     if ( KErrNone == ret )
       
  5419         {
       
  5420         _LIT8( KSendOk, "SetALSBlockedStatus request send ok" );
       
  5421         iSIMLog->Log((TDesC8)KSendOk );
       
  5422         }
       
  5423     else
       
  5424         {
       
  5425          _LIT8( KSendFailed, "SetALSBlockedStatus request send failed: %d" );
       
  5426         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5427         }
       
  5428 
       
  5429     return ret;
       
  5430     }
       
  5431 
       
  5432 // -----------------------------------------------------------------------------
       
  5433 // CSIM::CompleteSetALSBlockedStatus
       
  5434 // Complete SetALSBlockedStatus function.
       
  5435 // -----------------------------------------------------------------------------
       
  5436 //
       
  5437 void CSIM::CompleteSetALSBlockedStatus
       
  5438         (
       
  5439         TInt aResult,
       
  5440         CMmDataPackage* /*aDataPackage*/
       
  5441         )
       
  5442     {
       
  5443     _LIT8( KResult, "CompleteSetALSBlockedStatus result: %d" );
       
  5444     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5445 
       
  5446     if( KErrNone == aResult )
       
  5447         {
       
  5448         _LIT8( KPass, "CompleteSetALSBlockedStatus Passed: %d" );
       
  5449         iSIMLog->Log((TDesC8)KPass, aResult );
       
  5450         }
       
  5451     else
       
  5452         {
       
  5453         _LIT8( KFail, "CompleteSetALSBlockedStatus Failed: %d" );
       
  5454         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5455 
       
  5456         }
       
  5457 
       
  5458     Signal( aResult );
       
  5459     }
       
  5460 
       
  5461 
       
  5462 // -----------------------------------------------------------------------------
       
  5463 // CSIM::SendSIMRefreshNtf
       
  5464 // -----------------------------------------------------------------------------
       
  5465 //
       
  5466 TInt CSIM::SendSIMRefreshNtf( CStifItemParser& /*aItem*/ )
       
  5467     {
       
  5468 
       
  5469     iSIMLog->Log(_L8("CSIM::SendSIMRefreshNtf"));
       
  5470     iSendOngoing = ETrue;
       
  5471     return KErrNone;
       
  5472     }
       
  5473 
       
  5474 // -----------------------------------------------------------------------------
       
  5475 // CSIM::CompleteSendSIMRefreshNtf
       
  5476 // -----------------------------------------------------------------------------
       
  5477 //
       
  5478 void CSIM::CompleteSendSIMRefreshNtf( TInt aResult )
       
  5479     {
       
  5480     iSIMLog->Log(_L8("CSIM::CompleteSendSIMRefreshNtf, err=%d"),aResult);
       
  5481 
       
  5482     if ( iSendOngoing )
       
  5483         {
       
  5484         iSendOngoing = EFalse;
       
  5485         iSIMLog->Log(_L8("CSIM::CompleteSendSIMRefreshNtf"));
       
  5486 
       
  5487         Signal( aResult );
       
  5488 
       
  5489         }
       
  5490     }
       
  5491 
       
  5492 // -----------------------------------------------------------------------------
       
  5493 // CSIM::CheckAlsPpSupport
       
  5494 // -----------------------------------------------------------------------------
       
  5495 //
       
  5496 TInt CSIM::CheckAlsPpSupport( CStifItemParser& aItem )
       
  5497     {
       
  5498 
       
  5499     TInt ret( KErrNotFound );
       
  5500 
       
  5501     ret = HandleRequestL( ECustomCheckAlsPpSupportIPC );
       
  5502 
       
  5503     // for validity checking
       
  5504     if ( iHandleSpecifiedRequests )
       
  5505         {
       
  5506         TInt temp;
       
  5507         aItem.GetNextInt( temp );
       
  5508         iAlsSupport = ( RMmCustomAPI::TAlsSupport )temp;
       
  5509         }
       
  5510 
       
  5511     if ( KErrNone == ret )
       
  5512         {
       
  5513         _LIT8( KSendOk, "CheckAlsPpSupport request send ok" );
       
  5514         iSIMLog->Log((TDesC8)KSendOk );
       
  5515         }
       
  5516     else
       
  5517         {
       
  5518         _LIT8( KSendFailed, "CheckAlsPpSupport request send failed: %d" );
       
  5519         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5520         }
       
  5521 
       
  5522     return ret;
       
  5523 
       
  5524     }
       
  5525 
       
  5526 
       
  5527 // -----------------------------------------------------------------------------
       
  5528 // CSIM::CompleteCheckAlsPpSupport
       
  5529 // -----------------------------------------------------------------------------
       
  5530 //
       
  5531 void CSIM::CompleteCheckAlsPpSupport( TInt aResult, CMmDataPackage* aDataPackage )
       
  5532     {
       
  5533 
       
  5534 
       
  5535     RMmCustomAPI::TAlsSupport alsSupport;
       
  5536 
       
  5537 
       
  5538     _LIT8( KResult, "CompleteCheckAlsPpSupport result: %d" );
       
  5539     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5540 
       
  5541     if( KErrNone == aResult )
       
  5542         {
       
  5543         _LIT8( KPass, "CompleteCheckAlsPpSupport Passed: %d" );
       
  5544         iSIMLog->Log((TDesC8)KPass, aResult );
       
  5545 
       
  5546         aDataPackage->UnPackData ( alsSupport );
       
  5547 
       
  5548         if( alsSupport == RMmCustomAPI::EAlsSupportOn )
       
  5549             {
       
  5550             iSIMLog->Log( _L8("ALS support on") );
       
  5551             }
       
  5552         else if( alsSupport == RMmCustomAPI::EAlsSupportOff )
       
  5553             {
       
  5554             iSIMLog->Log( _L8("ALS support off") );
       
  5555             }
       
  5556         // for validity checking
       
  5557         if ( iHandleSpecifiedRequests )
       
  5558             {
       
  5559             if ( alsSupport != iAlsSupport )
       
  5560                 {
       
  5561                 aResult = KErrGeneral;
       
  5562                 }
       
  5563             }
       
  5564         }
       
  5565     else
       
  5566         {
       
  5567         _LIT8( KFail, "CompleteCheckAlsPpSupport Failed: %d" );
       
  5568         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5569         }
       
  5570 
       
  5571     Signal( aResult );
       
  5572 
       
  5573     }
       
  5574 
       
  5575 // -----------------------------------------------------------------------------
       
  5576 // CSIM::SetTestOngoingFlag
       
  5577 // Sets flag iTestOngoing on
       
  5578 // -----------------------------------------------------------------------------
       
  5579 //
       
  5580 TInt CSIM::SetTestOngoingFlag()
       
  5581     {
       
  5582     iTestOngoing = ETrue;
       
  5583     return KErrNone;
       
  5584     }
       
  5585 
       
  5586 
       
  5587 // -----------------------------------------------------------------------------
       
  5588 // CSIM::CheckPbData
       
  5589 // Check that phonebook data is as expected
       
  5590 // -----------------------------------------------------------------------------
       
  5591 //
       
  5592 TInt CSIM::CheckPbData( CStorageInfoData* aPbData, TPhoneBookType aPbType )
       
  5593     {
       
  5594     TInt error( KErrNone );
       
  5595 
       
  5596     if ( TPhoneBookTypeAdn == aPbType )
       
  5597         {
       
  5598         if ( aPbData->iIsPhonebookInitialized != iPbStorageDataAdn.iIsPhonebookInitialized  ||
       
  5599              aPbData->iIsPhonebookInitializeFailed != iPbStorageDataAdn.iIsPhonebookInitializeFailed ||
       
  5600              aPbData->iADNNumOfEntries != iPbStorageDataAdn.iXXXNumOfEntries ||
       
  5601              aPbData->iADNTextLengthMax != iPbStorageDataAdn.iXXXTextLengthMax ||
       
  5602              aPbData->iADNNumberLengthMax != iPbStorageDataAdn.iXXXNumberLengthMax  ||
       
  5603              aPbData->iFDNNumOfEntries != iPbStorageDataFdn.iXXXNumOfEntries ||
       
  5604              aPbData->iFDNNumberLengthMax != iPbStorageDataFdn.iXXXNumberLengthMax ||
       
  5605              aPbData->iFDNTextLengthMax != iPbStorageDataFdn.iXXXTextLengthMax ||
       
  5606              aPbData->iSDNNumOfEntries != iPbStorageDataSdn.iXXXNumOfEntries ||
       
  5607              aPbData->iSDNNumberLengthMax != iPbStorageDataSdn.iXXXNumberLengthMax ||
       
  5608              aPbData->iSDNTextLengthMax != iPbStorageDataSdn.iXXXTextLengthMax ||
       
  5609              aPbData->iMBDNNumOfEntries != iPbStorageDataMbdn.iXXXNumOfEntries ||
       
  5610              aPbData->iMBDNNumberLengthMax != iPbStorageDataMbdn.iXXXNumberLengthMax ||
       
  5611              aPbData->iMBDNTextLengthMax != iPbStorageDataMbdn.iXXXTextLengthMax ||
       
  5612              aPbData->iMSISDNNumOfEntries != iPbStorageDataMsisdn.iXXXNumOfEntries ||
       
  5613              aPbData->iMSISDNNumberLengthMax != iPbStorageDataMsisdn.iXXXNumberLengthMax ||
       
  5614              aPbData->iMSISDNTextLengthMax != iPbStorageDataMsisdn.iXXXTextLengthMax
       
  5615              )
       
  5616             {
       
  5617             error = KErrGeneral;
       
  5618             }
       
  5619         if( _L("UICC") == iCardType )
       
  5620             {
       
  5621             if(
       
  5622                     aPbData->iANRNumLengthMax != iStorageDataAnr.iXXXTextLengthMax ||
       
  5623                     aPbData->iANRNumOfEntries != iStorageDataAnr.iXXXNumOfEntries ||
       
  5624                     aPbData->iANRNumOfEntriesPerEntry != iStorageDataAnr.iXXXNumOfEntriesPerEntry  ||
       
  5625                     aPbData->iEmailNumOfEntries != iStorageDataEmail.iXXXNumOfEntries ||
       
  5626                     aPbData->iEmailNumOfEntriesPerEntry != iStorageDataEmail.iXXXNumOfEntriesPerEntry ||
       
  5627                     aPbData->iEmailTextLengthMax != iStorageDataEmail.iXXXTextLengthMax ||
       
  5628                     aPbData->iSNENumOfEntries != iStorageDataSne.iXXXNumOfEntries ||
       
  5629                     aPbData->iSNENumOfEntriesPerEntry != iStorageDataSne.iXXXNumOfEntriesPerEntry ||
       
  5630                     aPbData->iSNETextLengthMax != iStorageDataSne.iXXXTextLengthMax
       
  5631             )
       
  5632                 {
       
  5633                 error = KErrGeneral;
       
  5634                 }
       
  5635             }
       
  5636         
       
  5637         if( _L("ICC") == iCardType )
       
  5638             {
       
  5639             if(
       
  5640                     aPbData->iVMBXNumOfEntries != iPbStorageDataVmbx.iXXXNumOfEntries ||
       
  5641                     aPbData->iVMBXNumberLengthMax != iPbStorageDataVmbx.iXXXNumberLengthMax ||
       
  5642                     aPbData->iVMBXTextLengthMax != iPbStorageDataVmbx.iXXXTextLengthMax 
       
  5643               )
       
  5644                 {
       
  5645                 error = KErrGeneral;
       
  5646                 }
       
  5647             }
       
  5648 
       
  5649         }
       
  5650     else if ( TPhoneBookTypeFdn == aPbType )
       
  5651         {
       
  5652         if ( aPbData->iIsPhonebookInitialized != iPbStorageDataFdn.iIsPhonebookInitialized  ||
       
  5653              aPbData->iIsPhonebookInitializeFailed != iPbStorageDataFdn.iIsPhonebookInitializeFailed ||
       
  5654              aPbData->iFDNNumOfEntries != iPbStorageDataFdn.iXXXNumOfEntries ||
       
  5655              aPbData->iFDNTextLengthMax != iPbStorageDataFdn.iXXXTextLengthMax ||
       
  5656              aPbData->iFDNNumberLengthMax != iPbStorageDataFdn.iXXXNumberLengthMax )
       
  5657             {
       
  5658             error = KErrGeneral;
       
  5659             }
       
  5660         }
       
  5661     else if ( TPhoneBookTypeSdn == aPbType )
       
  5662         {
       
  5663         if ( aPbData->iIsPhonebookInitialized != iPbStorageDataSdn.iIsPhonebookInitialized  ||
       
  5664              aPbData->iIsPhonebookInitializeFailed != iPbStorageDataSdn.iIsPhonebookInitializeFailed ||
       
  5665              aPbData->iFDNNumOfEntries != iPbStorageDataSdn.iXXXNumOfEntries ||
       
  5666              aPbData->iFDNTextLengthMax != iPbStorageDataSdn.iXXXTextLengthMax ||
       
  5667              aPbData->iFDNNumberLengthMax != iPbStorageDataSdn.iXXXNumberLengthMax )
       
  5668             {
       
  5669             error = KErrGeneral;
       
  5670             }
       
  5671         }
       
  5672     else if ( TPhoneBookTypeMbdn == aPbType )
       
  5673         {
       
  5674         if ( aPbData->iIsPhonebookInitialized != iPbStorageDataMbdn.iIsPhonebookInitialized  ||
       
  5675              aPbData->iIsPhonebookInitializeFailed != iPbStorageDataMbdn.iIsPhonebookInitializeFailed ||
       
  5676              aPbData->iFDNNumOfEntries != iPbStorageDataMbdn.iXXXNumOfEntries ||
       
  5677              aPbData->iFDNTextLengthMax != iPbStorageDataMbdn.iXXXTextLengthMax ||
       
  5678              aPbData->iFDNNumberLengthMax != iPbStorageDataMbdn.iXXXNumberLengthMax )
       
  5679             {
       
  5680             error = KErrGeneral;
       
  5681             }
       
  5682         }
       
  5683 
       
  5684     return error;
       
  5685     }
       
  5686 
       
  5687 // -----------------------------------------------------------------------------
       
  5688 // CSIM::FdnDataSizesReq
       
  5689 // Reads FDN information
       
  5690 // -----------------------------------------------------------------------------
       
  5691 //
       
  5692 TInt CSIM::FdnDataSizesReq( CStifItemParser& aItem )
       
  5693     {
       
  5694     _LIT8(KPbFdnDataSizeReq, "SIM::FdnDataSizesReq");
       
  5695     iSIMLog->Log((TDesC8)KPbFdnDataSizeReq);
       
  5696 
       
  5697     TInt ret( KErrNone );
       
  5698     // store phonebook info
       
  5699     TInt value;
       
  5700     aItem.GetNextInt( value );
       
  5701     iPbStorageDataFdn.iXXXNumOfEntries = value;
       
  5702     aItem.GetNextInt( value );
       
  5703     iPbStorageDataFdn.iXXXNumberLengthMax = value;
       
  5704     aItem.GetNextInt( value );
       
  5705     iPbStorageDataFdn.iXXXTextLengthMax = value;
       
  5706 
       
  5707     //Create package
       
  5708     CPhoneBookDataPackage package;
       
  5709     // Set package data
       
  5710     iPhoneBookName = KETelIccAdnPhoneBook;
       
  5711     package.SetPhoneBookName( iPhoneBookName );
       
  5712 
       
  5713     ret = HandleRequestL( EMmTsyPhoneBookStoreInitIPC,
       
  5714                          &package );
       
  5715 
       
  5716     if ( KErrNone == ret )
       
  5717         {
       
  5718         _LIT8( KSendOk, "PB init request send ok" );
       
  5719         iSIMLog->Log((TDesC8)KSendOk );
       
  5720         }
       
  5721     else
       
  5722         {
       
  5723         _LIT8( KSendFailed, "PB init request send failed: %d" );
       
  5724         iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  5725         }
       
  5726 
       
  5727     return ret;
       
  5728     }
       
  5729 
       
  5730 // -----------------------------------------------------------------------------
       
  5731 // CSIM::CompleteFdnDataSizesReq
       
  5732 // Completes FdnDataSizesReq function.
       
  5733 // -----------------------------------------------------------------------------
       
  5734 //
       
  5735 void CSIM::CompleteFdnDataSizesReq
       
  5736         (
       
  5737         TInt aResult,
       
  5738         CMmDataPackage* aDataPackage
       
  5739         )
       
  5740     {
       
  5741     _LIT8( KResult, "CompleteFdnDataSizesReq result: %d" );
       
  5742     iSIMLog->Log((TDesC8)KResult, aResult );
       
  5743 
       
  5744     if ( KErrNone == aResult )
       
  5745         {
       
  5746         // Response information
       
  5747         TPBFdnInfo pbFdnInfo;
       
  5748         aDataPackage->UnPackData( pbFdnInfo );
       
  5749 
       
  5750         if ( iHandleSpecifiedRequests )
       
  5751             {
       
  5752             if ( iPbStorageDataFdn.iXXXNumOfEntries != pbFdnInfo.iFDNNumOfEntries ||
       
  5753                  iPbStorageDataFdn.iXXXTextLengthMax != pbFdnInfo.iFDNTextLengthMax ||
       
  5754                  iPbStorageDataFdn.iXXXNumberLengthMax != pbFdnInfo.iFDNNumberLengthMax )
       
  5755                 {
       
  5756                 aResult = KErrGeneral;
       
  5757                 }
       
  5758 
       
  5759             _LIT8( KFDNNumOfEntries, "FDNNumOfEntries: %d" );
       
  5760             iSIMLog->Log((TDesC8)KFDNNumOfEntries, pbFdnInfo.iFDNNumOfEntries );
       
  5761             _LIT8( KFDNTextLengthMax, "FDNTextLengthMax: %d" );
       
  5762             iSIMLog->Log((TDesC8)KFDNTextLengthMax, pbFdnInfo.iFDNTextLengthMax );
       
  5763             _LIT8( KFDNNumberLengthMax, "FDNNumberLengthMax: %d" );
       
  5764             iSIMLog->Log((TDesC8)KFDNNumberLengthMax, pbFdnInfo.iFDNNumberLengthMax );
       
  5765             }
       
  5766         }
       
  5767     else
       
  5768         {
       
  5769         _LIT8( KFail, "CompleteFdnDataSizesReq Failed: %d" );
       
  5770         iSIMLog->Log((TDesC8)KFail, aResult );
       
  5771         }
       
  5772 
       
  5773     Signal( aResult );
       
  5774     }
       
  5775 
       
  5776 
       
  5777 // -----------------------------------------------------------------------------
       
  5778 // CSIM::CheckServiceSupport
       
  5779 // Checks if service is supported in UICC.
       
  5780 // (other items was commented in header)
       
  5781 // -----------------------------------------------------------------------------
       
  5782 //
       
  5783 TInt CSIM::CheckServiceSupport( CStifItemParser& aItem )
       
  5784     {
       
  5785     _LIT8( KLog, "CSIM::CheckServiceSupport" );
       
  5786     iSIMLog->Log( ( TDesC8 )KLog );
       
  5787 
       
  5788     TInt ret( KErrNone );
       
  5789     TInt application( 0 );
       
  5790     TInt appAvailable( 0 );
       
  5791 
       
  5792     aItem.GetNextInt( application );
       
  5793     aItem.GetNextInt( appAvailable );
       
  5794 
       
  5795     RMmCustomAPI::TAppSupport appSupport;
       
  5796     appSupport.iAppNum = application;
       
  5797 
       
  5798     if ( 0 == appAvailable )
       
  5799         {
       
  5800         iServiceAvailable = EFalse;
       
  5801         }
       
  5802     else if ( 1 == appAvailable )
       
  5803         {
       
  5804         iServiceAvailable = ETrue;
       
  5805         }
       
  5806     else
       
  5807         {
       
  5808         _LIT8( KLog, "CSIM::CheckServiceSupport: not supported availability %d" );
       
  5809         iSIMLog->Log( ( TDesC8 )KLog, appAvailable );
       
  5810         ret = KErrNotSupported;
       
  5811         }
       
  5812 
       
  5813     if ( KErrNone == ret )
       
  5814         {
       
  5815         // Create package
       
  5816         CMmDataPackage package;
       
  5817         package.PackData( &appSupport );
       
  5818 
       
  5819         ret = HandleRequestL(
       
  5820             ECustomGetServiceTableSupportbyApplicationIPC,
       
  5821             &package );
       
  5822         }
       
  5823 
       
  5824     return ret;
       
  5825     }
       
  5826 
       
  5827 // -----------------------------------------------------------------------------
       
  5828 // CSIM::CompleteCheckServiceSupport
       
  5829 // Completes service support check request.
       
  5830 // (other items was commented in header)
       
  5831 // -----------------------------------------------------------------------------
       
  5832 //
       
  5833 void CSIM::CompleteCheckServiceSupport
       
  5834         (
       
  5835         TInt aResult,
       
  5836         CMmDataPackage* aDataPackage
       
  5837         )
       
  5838     {
       
  5839     _LIT8( KLog, "CSIM::CompleteGetServiceSupport - result: %d" );
       
  5840     iSIMLog->Log( ( TDesC8 )KLog, aResult );
       
  5841 
       
  5842     RMmCustomAPI::TAppSupport appSupport;
       
  5843 
       
  5844     if( KErrNone == aResult )
       
  5845         {
       
  5846         aDataPackage->UnPackData( appSupport );
       
  5847 
       
  5848         if ( iServiceAvailable == appSupport.iSupported )
       
  5849             {
       
  5850             iSIMLog->Log( _L8("Service Support received correctly") );
       
  5851             }
       
  5852         else
       
  5853             {
       
  5854             iSIMLog->Log( _L8("Service Support received NOT correclty") );
       
  5855             }
       
  5856         }
       
  5857     else
       
  5858         {
       
  5859         _LIT8( KFail, "CompleteGetServiceSupport failed: %d" );
       
  5860         iSIMLog->Log( ( TDesC8 )KFail, aResult );
       
  5861         }
       
  5862 
       
  5863     Signal( aResult );
       
  5864     }
       
  5865 // -----------------------------------------------------------------------------
       
  5866 // CSIM::SetExpectedNumberOfPbEntries
       
  5867 // Sets expected number of phonebook entries checked on IPC completion
       
  5868 // -----------------------------------------------------------------------------
       
  5869 //
       
  5870 TInt CSIM::SetExpectedNumberOfPbEntries( CStifItemParser& aItem )
       
  5871     {
       
  5872     _LIT8( KLog, "CSIM::SetExpectedNumberOfPbEntries" );
       
  5873     iSIMLog->Log( ( TDesC8 )KLog );
       
  5874     aItem.GetNextInt( iSavedPbEntriesCount );
       
  5875     return KErrNone;
       
  5876     }
       
  5877 
       
  5878 // -----------------------------------------------------------------------------
       
  5879 // CSIM::CompleteViagHomeZoneReadParam
       
  5880 // Performs verification of the data returned when
       
  5881 // EReadViagHomeZoneParamsIPC is completed
       
  5882 // -----------------------------------------------------------------------------
       
  5883 //
       
  5884 void CSIM::CompleteViagHomeZoneReadParam(
       
  5885     TInt aResult,
       
  5886     CMmDataPackage* aDataPackage )
       
  5887     {
       
  5888     _LIT8( KLog, "CSIM::CompleteViagHomeZoneReadParam - result: %d" );
       
  5889     iSIMLog->Log( ( TDesC8 )KLog, aResult );
       
  5890 
       
  5891     if ( KErrNone == aResult )
       
  5892         {
       
  5893         RMmCustomAPI::TViagParams viagParams;
       
  5894         RMmCustomAPI::TViagElements* viagElements( NULL );
       
  5895 
       
  5896         aDataPackage->UnPackData( viagParams, viagElements );
       
  5897 
       
  5898         // match parameters
       
  5899         if ( viagParams.iScp != iSavedViagParamsForComparison.iScp
       
  5900             || viagParams.iSmsC != iSavedViagParamsForComparison.iSmsC
       
  5901             || viagParams.iSubscribedZoneAndVersion !=
       
  5902                 iSavedViagParamsForComparison.iSubscribedZoneAndVersion )
       
  5903             {
       
  5904             aResult = KErrGeneral;
       
  5905             }
       
  5906 
       
  5907         // match elements
       
  5908         for ( TInt i = 0;
       
  5909             i < RMmCustomAPI::KViagElementCount && KErrNone == aResult;
       
  5910             i++)
       
  5911             {
       
  5912             RMmCustomAPI::TViagElement& element =
       
  5913                 viagElements->At( i );
       
  5914             RMmCustomAPI::TViagElement& expected =
       
  5915                 iSavedViagElementsForComparison->At( i );
       
  5916 
       
  5917             if ( element.iCoordinates.iX != expected.iCoordinates.iX
       
  5918                 || element.iCoordinates.iY != expected.iCoordinates.iY
       
  5919                 || element.iCoordinates.iR2 != expected.iCoordinates.iR2
       
  5920                 || element.iCoordinates.iZoneId != expected.iCoordinates.iZoneId
       
  5921                 || element.iName != expected.iName
       
  5922                 || element.iActiveFlag != expected.iActiveFlag )
       
  5923                 {
       
  5924                 aResult = KErrGeneral;
       
  5925                 }
       
  5926             }
       
  5927         }
       
  5928     else
       
  5929         {
       
  5930         _LIT8( KFail, "CSIM::CompleteViagHomeZoneReadParam failed: %d" );
       
  5931         iSIMLog->Log( ( TDesC8 )KFail, aResult );
       
  5932         }
       
  5933 
       
  5934     if ( iHandleSpecifiedRequests )
       
  5935         {
       
  5936         Signal( aResult );
       
  5937         }
       
  5938     }
       
  5939 
       
  5940 // -----------------------------------------------------------------------------
       
  5941 // CSIM::CompleteViagHomeZoneReadCache
       
  5942 // Performs verification of the data returned when
       
  5943 // EReadViagHomeZoneCacheIPC is completed
       
  5944 // -----------------------------------------------------------------------------
       
  5945 //
       
  5946 void CSIM::CompleteViagHomeZoneReadCache(
       
  5947     TInt aResult,
       
  5948     CMmDataPackage* aDataPackage )
       
  5949     {
       
  5950     _LIT8( KLog, "CSIM::CompleteViagHomeZoneReadCache - result: %d" );
       
  5951     iSIMLog->Log( ( TDesC8 )KLog, aResult );
       
  5952 
       
  5953     if ( KErrNone == aResult )
       
  5954         {
       
  5955         RMmCustomAPI::TViagCacheRecordContent record;
       
  5956 
       
  5957         aDataPackage->UnPackData( record );
       
  5958 
       
  5959         if ( iSavedRecordForComparison.iLac != record.iLac
       
  5960             || iSavedRecordForComparison.iCellId != record.iCellId )
       
  5961             {
       
  5962             aResult = KErrGeneral;
       
  5963             }
       
  5964         }
       
  5965     else
       
  5966         {
       
  5967         _LIT8( KFail, "CSIM::CompleteViagHomeZoneReadCache failed: %d" );
       
  5968         iSIMLog->Log( ( TDesC8 )KFail, aResult );
       
  5969         }
       
  5970 
       
  5971     if ( iHandleSpecifiedRequests )
       
  5972         {
       
  5973         Signal( aResult );
       
  5974         }
       
  5975 
       
  5976     }
       
  5977 
       
  5978 // -----------------------------------------------------------------------------
       
  5979 // CSIM::InvalidReadEntries
       
  5980 // Requests reading phonebook entry with invalid input parameters
       
  5981 // -----------------------------------------------------------------------------
       
  5982 //
       
  5983 TInt CSIM::InvalidReadEntries( CStifItemParser& aItem )
       
  5984     {
       
  5985     _LIT8( KLog, "CSIM::InvalidReadEntries" );
       
  5986     iSIMLog->Log( ( TDesC8 )KLog );
       
  5987 
       
  5988     TInt ret( KErrNone );
       
  5989     TPtrC string;
       
  5990     TBool supported ( ETrue );
       
  5991 
       
  5992     aItem.GetNextString( string );
       
  5993 
       
  5994     if ( _L("Adn") == string )
       
  5995         {
       
  5996         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  5997         iPhoneBookName = KETelIccAdnPhoneBook;
       
  5998         }
       
  5999     else if ( _L("Fdn") == string )
       
  6000         {
       
  6001         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  6002         iPhoneBookName = KETelIccFdnPhoneBook;
       
  6003         }
       
  6004     else if ( _L("MBDN") == string )
       
  6005         {
       
  6006         iSIMLog->Log((TDesC8)KMBDN);
       
  6007         iPhoneBookName = KETelIccMbdnPhoneBook;
       
  6008         }
       
  6009     else
       
  6010         {
       
  6011          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  6012         iSIMLog->Log((TDesC8)KNotSupp);
       
  6013         supported = EFalse;
       
  6014         }
       
  6015 
       
  6016     if ( supported )
       
  6017         {
       
  6018         TAny* dummyPointer( NULL );
       
  6019         //Create package
       
  6020         CPhoneBookDataPackage package;
       
  6021         // Set package data
       
  6022         package.SetPhoneBookName( iPhoneBookName );
       
  6023         package.PackData( &dummyPointer, &dummyPointer );
       
  6024 
       
  6025         ret = HandleRequestL( EMmTsyPhoneBookStoreReadIPC,
       
  6026                              &package );
       
  6027 
       
  6028         // we expect error
       
  6029         Signal( ret );
       
  6030         // to prevent testcase from termination
       
  6031         ret = KErrNone;
       
  6032         }
       
  6033     else
       
  6034         {
       
  6035         ret = KErrNotSupported;
       
  6036         }
       
  6037 
       
  6038     return ret;
       
  6039     }
       
  6040 
       
  6041 // -----------------------------------------------------------------------------
       
  6042 // CSIM::InvalidWriteEntries
       
  6043 // Requests writing phonebook entry with invalid input parameters
       
  6044 // -----------------------------------------------------------------------------
       
  6045 //
       
  6046 TInt CSIM::InvalidWriteEntries( CStifItemParser& aItem )
       
  6047     {
       
  6048     _LIT8(KInvalidWriteEntries, "SIM::InvalidWriteEntries");
       
  6049     iSIMLog->Log((TDesC8)KInvalidWriteEntries);
       
  6050 
       
  6051     TInt ret( KErrNone );
       
  6052     TBool supported( ETrue );
       
  6053     TPtrC string;
       
  6054 
       
  6055     aItem.GetNextString( string );
       
  6056 
       
  6057     if ( _L("Adn") == string )
       
  6058         {
       
  6059         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  6060         iPhoneBookName = KETelIccAdnPhoneBook;
       
  6061         }
       
  6062     else if( _L("Fdn") == string )
       
  6063         {
       
  6064         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  6065         iPhoneBookName = KETelIccFdnPhoneBook;
       
  6066         }
       
  6067     else if( _L("MBDN") == string )
       
  6068         {
       
  6069         iSIMLog->Log((TDesC8)KMBDN);
       
  6070         iPhoneBookName = KETelIccMbdnPhoneBook;
       
  6071         }
       
  6072     else
       
  6073         {
       
  6074          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  6075         iSIMLog->Log((TDesC8)KNotSupp);
       
  6076         supported = EFalse;
       
  6077         }
       
  6078 
       
  6079     if ( supported )
       
  6080         {
       
  6081         TInt dummyIndex( 1 );
       
  6082         TAny* dummyPointer( NULL );
       
  6083 
       
  6084         //Create package
       
  6085         CPhoneBookDataPackage package;
       
  6086         // Set package data
       
  6087         package.SetPhoneBookName( iPhoneBookName );
       
  6088         package.PackData( &dummyIndex, &dummyPointer );
       
  6089 
       
  6090         ret = HandleRequestL( EMmTsyPhoneBookStoreWriteIPC,
       
  6091                              &package );
       
  6092 
       
  6093         // we expect error
       
  6094         Signal( ret );
       
  6095         // to prevent testcase from termination
       
  6096         ret = KErrNone;
       
  6097         }
       
  6098     else
       
  6099         {
       
  6100         ret = KErrNotSupported;
       
  6101         }
       
  6102 
       
  6103     return ret;
       
  6104     }
       
  6105 
       
  6106 // -----------------------------------------------------------------------------
       
  6107 // CSIM::InvalidPbStoreCache
       
  6108 // Requests cacheing phonebook entries with invalid input parameters
       
  6109 // -----------------------------------------------------------------------------
       
  6110 //
       
  6111 TInt CSIM::InvalidPbStoreCache( CStifItemParser& aItem )
       
  6112     {
       
  6113     _LIT8(KInvalidPbStoreCache, "SIM::InvalidPbStoreCache");
       
  6114     iSIMLog->Log((TDesC8)KInvalidPbStoreCache);
       
  6115 
       
  6116     TInt ret( KErrNone );
       
  6117     TBool supported( ETrue );
       
  6118     TPtrC string;
       
  6119     aItem.GetNextString( string );
       
  6120 
       
  6121     if ( _L("Adn") == string )
       
  6122         {
       
  6123         iSIMLog->Log((TDesC8)KAdnPhoneBook);
       
  6124         iPhoneBookName = KETelIccAdnPhoneBook;
       
  6125         }
       
  6126     else if ( _L("Fdn") == string )
       
  6127         {
       
  6128         iSIMLog->Log((TDesC8)KFdnPhoneBook);
       
  6129         iPhoneBookName = KETelIccFdnPhoneBook;
       
  6130         }
       
  6131     else if ( _L("Sdn") == string )
       
  6132         {
       
  6133         iSIMLog->Log((TDesC8)KSdnPhoneBook);
       
  6134         iPhoneBookName = KETelIccSdnPhoneBook;
       
  6135         }
       
  6136     else
       
  6137         {
       
  6138          _LIT8(KNotSupp, "SIM::Selected PB not supported");
       
  6139         iSIMLog->Log((TDesC8)KNotSupp);
       
  6140         supported = EFalse;
       
  6141         }
       
  6142 
       
  6143     if ( supported )
       
  6144         {
       
  6145         TAny* dummyPointer( NULL );
       
  6146 
       
  6147         CPhoneBookDataPackage package;
       
  6148         package.SetPhoneBookName( iPhoneBookName );
       
  6149         package.PackData( &dummyPointer );
       
  6150 
       
  6151         ret = HandleRequestL( EMmTsyPhoneBookStoreCacheIPC,
       
  6152                              &package );
       
  6153 
       
  6154         // we expect error
       
  6155         Signal( ret );
       
  6156         // to prevent testcase from termination
       
  6157         ret = KErrNone;
       
  6158         }
       
  6159     else
       
  6160         {
       
  6161         ret = KErrNotSupported;
       
  6162         }
       
  6163 
       
  6164     return ret;
       
  6165     }
       
  6166 
       
  6167 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  6168 // -----------------------------------------------------------------------------
       
  6169 // CSIM::DeleteAlphaString
       
  6170 // Delete AlphaString
       
  6171 // -----------------------------------------------------------------------------
       
  6172 //
       
  6173 TInt CSIM::DeleteAlphaString( CStifItemParser& aItem )
       
  6174     {
       
  6175     _LIT8(KSetAlsBlock, "SIM::DeleteAlphaString");
       
  6176     iSIMLog->Log((TDesC8)KSetAlsBlock );
       
  6177 
       
  6178     TInt ret( KErrNotFound );
       
  6179     TBool supported( ETrue );
       
  6180 
       
  6181     TPtrC fileType;
       
  6182     TInt index;
       
  6183 
       
  6184     aItem.GetNextString ( fileType );
       
  6185 
       
  6186     RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6187 
       
  6188     if ( _L("AAS") == fileType )
       
  6189         {
       
  6190         alphaStringParams.iFileType = RMmCustomAPI::EAas;
       
  6191         }
       
  6192     else if ( _L("GAS") == fileType )
       
  6193         {
       
  6194         alphaStringParams.iFileType = RMmCustomAPI::EGas;
       
  6195         }
       
  6196     else
       
  6197         {
       
  6198          _LIT8(KNotSupp, "SIM::Selected status not supported");
       
  6199         iSIMLog->Log((TDesC8)KNotSupp);
       
  6200         supported = EFalse;
       
  6201         }
       
  6202 
       
  6203     if( supported )
       
  6204         {
       
  6205         if( KErrNone == aItem.GetNextInt ( index ))
       
  6206             {
       
  6207             alphaStringParams.iIndex = index;
       
  6208             }
       
  6209 
       
  6210         //Create package
       
  6211         CMmDataPackage package;
       
  6212         package.PackData( &alphaStringParams );
       
  6213 
       
  6214         ret = HandleRequestL( ECustomDeleteAlphaStringIPC, &package );
       
  6215 
       
  6216         if ( KErrNone == ret )
       
  6217             {
       
  6218             _LIT8( KSendOk, "DeleteAlphaString request send ok" );
       
  6219             iSIMLog->Log((TDesC8)KSendOk );
       
  6220             }
       
  6221         else
       
  6222             {
       
  6223              _LIT8( KSendFailed, "DeleteAlphaString request send failed: %d" );
       
  6224             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  6225             }
       
  6226         }
       
  6227 
       
  6228     return ret;
       
  6229     }
       
  6230 
       
  6231 // -----------------------------------------------------------------------------
       
  6232 // CSIM::CompleteDeleteAlphaString
       
  6233 // Complete WriteAlphaString
       
  6234 // -----------------------------------------------------------------------------
       
  6235 //
       
  6236 void CSIM::CompleteDeleteAlphaString
       
  6237         (
       
  6238         TInt aResult,
       
  6239         CMmDataPackage* aDataPackage
       
  6240         )
       
  6241     {
       
  6242     _LIT8(KSetAlsBlock, "SIM::CompleteDeleteAlphaString");
       
  6243 
       
  6244     if( KErrNone == aResult )
       
  6245         {
       
  6246         RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6247         //Unpack package
       
  6248         aDataPackage->UnPackData( alphaStringParams );
       
  6249 
       
  6250         _LIT8( KLocation, "Deleted Location = %d" );
       
  6251         iSIMLog->Log((TDesC8)KLocation, alphaStringParams.iIndex  );
       
  6252 
       
  6253         if(RMmCustomAPI::EAas == alphaStringParams.iFileType)
       
  6254             {
       
  6255             _LIT8( KTypeAAS, "Type: AAS" );
       
  6256             iSIMLog->Log((TDesC8)KTypeAAS );
       
  6257             }
       
  6258         else
       
  6259             {
       
  6260             _LIT8( KTypeGAS, "Type: GAS" );
       
  6261             iSIMLog->Log((TDesC8)KTypeGAS );
       
  6262             }
       
  6263         }
       
  6264     else
       
  6265         {
       
  6266         _LIT8( KFail, "CompleteDeleteAlphaString Failed: %d" );
       
  6267         iSIMLog->Log((TDesC8)KFail, aResult );
       
  6268         }
       
  6269     Signal( aResult );
       
  6270     }
       
  6271 
       
  6272 // -----------------------------------------------------------------------------
       
  6273 // CSIM::WriteAlphaString
       
  6274 //
       
  6275 // -----------------------------------------------------------------------------
       
  6276 //
       
  6277 TInt CSIM::WriteAlphaString( CStifItemParser& aItem )
       
  6278     {
       
  6279     _LIT8(KSetAlsBlock, "SIM::WriteAlphaString");
       
  6280     iSIMLog->Log((TDesC8)KSetAlsBlock );
       
  6281 
       
  6282     TInt ret( KErrNotFound );
       
  6283     TBool supported( ETrue );
       
  6284 
       
  6285     TPtrC fileType;
       
  6286     TInt index;
       
  6287     TPtrC16 name;
       
  6288 
       
  6289     aItem.GetNextString ( fileType );
       
  6290 
       
  6291     RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6292 
       
  6293     if ( _L("AAS") == fileType )
       
  6294         {
       
  6295         alphaStringParams.iFileType = RMmCustomAPI::EAas;
       
  6296         }
       
  6297     else if ( _L("GAS") == fileType )
       
  6298         {
       
  6299         alphaStringParams.iFileType = RMmCustomAPI::EGas;
       
  6300         }
       
  6301     else
       
  6302         {
       
  6303          _LIT8(KNotSupp, "SIM::Selected status not supported");
       
  6304         iSIMLog->Log((TDesC8)KNotSupp);
       
  6305         supported = EFalse;
       
  6306         }
       
  6307 
       
  6308     if( supported )
       
  6309         {
       
  6310         if( KErrNone == aItem.GetNextInt ( index ))
       
  6311             {
       
  6312             alphaStringParams.iIndex = index;
       
  6313             }
       
  6314 
       
  6315         if( KErrNone == aItem.GetNextString ( name ))
       
  6316             {
       
  6317             alphaStringParams.iAlphaString.Copy( name );
       
  6318             }
       
  6319 
       
  6320         //Create package
       
  6321         CMmDataPackage package;
       
  6322         package.PackData( &alphaStringParams );
       
  6323 
       
  6324         ret = HandleRequestL( ECustomWriteAlphaStringIPC, &package );
       
  6325 
       
  6326         if ( KErrNone == ret )
       
  6327             {
       
  6328             _LIT8( KSendOk, "WriteAlphaString request send ok" );
       
  6329             iSIMLog->Log((TDesC8)KSendOk );
       
  6330             }
       
  6331         else
       
  6332             {
       
  6333              _LIT8( KSendFailed, "WriteAlphaString request send failed: %d" );
       
  6334             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  6335             }
       
  6336         }
       
  6337 
       
  6338     return ret;
       
  6339     }
       
  6340 
       
  6341 // -----------------------------------------------------------------------------
       
  6342 // CSIM::CompleteWriteAlphaString
       
  6343 // Complete WriteAlphaString
       
  6344 // -----------------------------------------------------------------------------
       
  6345 //
       
  6346 void CSIM::CompleteWriteAlphaString
       
  6347         (
       
  6348         TInt aResult,
       
  6349         CMmDataPackage* aDataPackage
       
  6350         )
       
  6351     {
       
  6352 
       
  6353     _LIT8(KSetAlsBlock, "SIM::CompleteWriteAlphaString");
       
  6354 
       
  6355     if( KErrNone == aResult )
       
  6356         {
       
  6357         RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6358         //Unpack package
       
  6359         aDataPackage->UnPackData( alphaStringParams );
       
  6360 
       
  6361         _LIT8( KLocation, "Location = %d" );
       
  6362         iSIMLog->Log((TDesC8)KLocation, alphaStringParams.iIndex  );
       
  6363 
       
  6364         if(RMmCustomAPI::EAas == alphaStringParams.iFileType)
       
  6365             {
       
  6366             _LIT8( KTypeAAS, "Type: AAS" );
       
  6367             iSIMLog->Log((TDesC8)KTypeAAS );
       
  6368             }
       
  6369         else
       
  6370             {
       
  6371             _LIT8( KTypeGAS, "Type: GAS" );
       
  6372             iSIMLog->Log((TDesC8)KTypeGAS );
       
  6373             }
       
  6374 
       
  6375         _LIT8( KAasString, "AasString:" );
       
  6376         iSIMLog->Log((TDesC8)KAasString  );
       
  6377         iSIMLog->Log( alphaStringParams.iAlphaString  );
       
  6378         }
       
  6379     else
       
  6380         {
       
  6381         _LIT8( KFail, "CompleteWriteAlphaString Failed: %d" );
       
  6382         iSIMLog->Log((TDesC8)KFail, aResult );
       
  6383         }
       
  6384 
       
  6385     Signal( aResult );
       
  6386     }
       
  6387 
       
  6388 
       
  6389 // -----------------------------------------------------------------------------
       
  6390 // CSIM::ReadAlphaString
       
  6391 //
       
  6392 // -----------------------------------------------------------------------------
       
  6393 //
       
  6394 TInt CSIM::ReadAlphaString( CStifItemParser& aItem )
       
  6395     {
       
  6396     _LIT8(KSetAlsBlock, "SIM::ReadAlphaString");
       
  6397     iSIMLog->Log((TDesC8)KSetAlsBlock );
       
  6398 
       
  6399     TInt ret( KErrNotFound );
       
  6400     TBool supported( ETrue );
       
  6401 
       
  6402     TPtrC fileType;
       
  6403     TInt index;
       
  6404 
       
  6405     aItem.GetNextString ( fileType );
       
  6406 
       
  6407     RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6408 
       
  6409     if ( _L("AAS") == fileType )
       
  6410         {
       
  6411         alphaStringParams.iFileType = RMmCustomAPI::EAas;
       
  6412         }
       
  6413     else if ( _L("GAS") == fileType )
       
  6414         {
       
  6415         alphaStringParams.iFileType = RMmCustomAPI::EGas;
       
  6416         }
       
  6417     else
       
  6418         {
       
  6419          _LIT8(KNotSupp, "SIM::Selected status not supported");
       
  6420         iSIMLog->Log((TDesC8)KNotSupp);
       
  6421         supported = EFalse;
       
  6422         }
       
  6423 
       
  6424     if( supported )
       
  6425         {
       
  6426         if( KErrNone == aItem.GetNextInt ( index ))
       
  6427             {
       
  6428             alphaStringParams.iIndex = index;
       
  6429             }
       
  6430 
       
  6431         //Create package
       
  6432         CMmDataPackage package;
       
  6433         package.PackData( &alphaStringParams );
       
  6434 
       
  6435         ret = HandleRequestL( ECustomReadAlphaStringIPC, &package );
       
  6436 
       
  6437         if ( KErrNone == ret )
       
  6438             {
       
  6439             _LIT8( KSendOk, "ReadAlphaString request send ok" );
       
  6440             iSIMLog->Log((TDesC8)KSendOk );
       
  6441             }
       
  6442         else
       
  6443             {
       
  6444              _LIT8( KSendFailed, "ReadAlphaString request send failed: %d" );
       
  6445             iSIMLog->Log((TDesC8)KSendFailed, ret );
       
  6446             }
       
  6447         }
       
  6448 
       
  6449     return ret;
       
  6450     }
       
  6451 
       
  6452 // -----------------------------------------------------------------------------
       
  6453 // CSIM::CompleteReadAlphaString
       
  6454 // Complete ReadAlphaString
       
  6455 // -----------------------------------------------------------------------------
       
  6456 //
       
  6457 void CSIM::CompleteReadAlphaString
       
  6458         (
       
  6459         TInt aResult,
       
  6460         CMmDataPackage* aDataPackage
       
  6461         )
       
  6462     {
       
  6463     _LIT8(KSetAlsBlock, "SIM::CompleteReadAlphaString");
       
  6464 
       
  6465     if( KErrNone == aResult )
       
  6466         {
       
  6467         RMmCustomAPI::TAlphaStringParams alphaStringParams;
       
  6468         //Unpack package
       
  6469         aDataPackage->UnPackData( alphaStringParams );
       
  6470 
       
  6471         _LIT8( KLocation, "Location = %d" );
       
  6472         iSIMLog->Log((TDesC8)KLocation, alphaStringParams.iIndex  );
       
  6473 
       
  6474         if(RMmCustomAPI::EAas == alphaStringParams.iFileType)
       
  6475             {
       
  6476             _LIT8( KTypeAAS, "Type: AAS" );
       
  6477             iSIMLog->Log((TDesC8)KTypeAAS );
       
  6478             }
       
  6479         else
       
  6480             {
       
  6481             _LIT8( KTypeGAS, "Type: GAS" );
       
  6482             iSIMLog->Log((TDesC8)KTypeGAS );
       
  6483             }
       
  6484 
       
  6485         _LIT8( KAasString, "AasString: " );
       
  6486         iSIMLog->Log((TDesC8)KAasString  );
       
  6487         iSIMLog->Log( alphaStringParams.iAlphaString  );
       
  6488         }
       
  6489     else
       
  6490         {
       
  6491         _LIT8( KFail, "CompleteReadAlphaString Failed: %d" );
       
  6492         iSIMLog->Log((TDesC8)KFail, aResult );
       
  6493         }
       
  6494 
       
  6495     Signal( aResult );
       
  6496     }
       
  6497 
       
  6498 
       
  6499 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
  6500 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  6501 // None
       
  6502 
       
  6503 //  End of File