telephonyserverplugins/common_tsy/commontsy/src/mmstorage/cmmonstoretsy.cpp
branchRCL_3
changeset 19 630d2f34d719
parent 18 17af172ffa5f
child 20 07a122eea281
equal deleted inserted replaced
18:17af172ffa5f 19:630d2f34d719
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 //  INCLUDE FILES
    18 //  INCLUDE FILES
       
    19 
       
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "cmmonstoretsyTraces.h"
       
    23 #endif
       
    24 
    19 #include "cmmonstoretsy.h"
    25 #include "cmmonstoretsy.h"
    20 #include "cmmtsyreqhandlestore.h"
    26 #include "cmmtsyreqhandlestore.h"
    21 #include "CMmPrivateUtility.h"
    27 #include "CMmPrivateUtility.h"
    22 #include "MmTsy_numberOfSlots.h"
    28 #include "MmTsy_numberOfSlots.h"
    23 #include "MmTsy_timeoutdefs.h"
    29 #include "MmTsy_timeoutdefs.h"
    33     {
    39     {
    34     }
    40     }
    35 
    41 
    36 void CMmONStoreTsy::ConstructL()
    42 void CMmONStoreTsy::ConstructL()
    37     {
    43     {
    38 TFLOGSTRING("TSY: CMmONStoreTsy::ConstructL");
    44 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_CONSTRUCTL_1, "TSY: CMmONStoreTsy::ConstructL");
    39 
    45 
    40 #ifdef REQHANDLE_TIMER
    46 #ifdef REQHANDLE_TIMER
    41     // Create req handle store
    47     // Create req handle store
    42     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, 
    48     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, 
    43         EMmTsyNumOfONStoreRequests, iStorageReqHandles );
    49         EMmTsyNumOfONStoreRequests, iStorageReqHandles );
    96     return aMmONStoreTsy;
   102     return aMmONStoreTsy;
    97     }
   103     }
    98 
   104 
    99 CMmONStoreTsy::~CMmONStoreTsy()
   105 CMmONStoreTsy::~CMmONStoreTsy()
   100     {
   106     {
   101 TFLOGSTRING("TSY: CMmONStoreTsy::~CMmONStoreTsy");
   107 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DTOR_1, "TSY: CMmONStoreTsy::~CMmONStoreTsy");
   102 
   108 
   103     if (iMmPhone )
   109     if (iMmPhone )
   104         {
   110         {
   105         // deregister tsy object from message manager
   111         // deregister tsy object from message manager
   106         iMmPhone->MessageManager()->DeregisterTsyObject(this);
   112         iMmPhone->MessageManager()->DeregisterTsyObject(this);
   177 // ---------------------------------------------------------------------------
   183 // ---------------------------------------------------------------------------
   178 //
   184 //
   179 CTelObject::TReqMode CMmONStoreTsy::ReqModeL(
   185 CTelObject::TReqMode CMmONStoreTsy::ReqModeL(
   180     const TInt aIpc )
   186     const TInt aIpc )
   181     {
   187     {
   182 TFLOGSTRING2("TSY: CMmONStoreTsy::ReqModeL IPC %d", aIpc);
   188 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_REQMODEL_1, "TSY: CMmONStoreTsy::ReqModeL IPC %d", aIpc);
   183     CTelObject::TReqMode ret=0;
   189     CTelObject::TReqMode ret=0;
   184     switch ( aIpc )
   190     switch ( aIpc )
   185         {
   191         {
   186         // Flow Controlled Services
   192         // Flow Controlled Services
   187         case EMobilePhoneStoreRead:
   193         case EMobilePhoneStoreRead:
   289 TInt CMmONStoreTsy::ExtFunc(
   295 TInt CMmONStoreTsy::ExtFunc(
   290     const TTsyReqHandle aTsyReqHandle,
   296     const TTsyReqHandle aTsyReqHandle,
   291     const TInt aIpc,
   297     const TInt aIpc,
   292     const TDataPackage& aPackage )
   298     const TDataPackage& aPackage )
   293     {
   299     {
   294 TFLOGSTRING3("TSY: CMmONStoreTsy::ExtFunc - IPC:%d Handle:%d", aIpc, aTsyReqHandle);   
   300 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_EXTFUNC_1, "TSY: CMmONStoreTsy::ExtFunc - IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   295                
   301                
   296     TInt ret = KErrNone;
   302     TInt ret = KErrNone;
   297     TInt trapError = KErrNone;
   303     TInt trapError = KErrNone;
   298 
   304 
   299     // Reset last tsy request type
   305     // Reset last tsy request type
   332 TInt CMmONStoreTsy::DoExtFuncL(
   338 TInt CMmONStoreTsy::DoExtFuncL(
   333     const TTsyReqHandle aTsyReqHandle,
   339     const TTsyReqHandle aTsyReqHandle,
   334     const TInt aIpc,
   340     const TInt aIpc,
   335     const TDataPackage& aPackage )
   341     const TDataPackage& aPackage )
   336     {
   342     {
   337 TFLOGSTRING3("TSY: CMmONStoreTsy::DoExtFuncL - IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   343 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DOEXTFUNCL_1, "TSY: CMmONStoreTsy::DoExtFuncL - IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   338 
   344 
   339     TAny* dataPtr=aPackage.Ptr1();
   345     TAny* dataPtr=aPackage.Ptr1();
   340     TAny* dataPtr2=aPackage.Ptr2();
   346     TAny* dataPtr2=aPackage.Ptr2();
   341 
   347 
   342     // Create unique transaction id
   348     // Create unique transaction id
   457 // (other items were commented in a header).
   463 // (other items were commented in a header).
   458 // ---------------------------------------------------------------------------
   464 // ---------------------------------------------------------------------------
   459 //
   465 //
   460 TInt CMmONStoreTsy::ReadL( TDes8* aEntry )
   466 TInt CMmONStoreTsy::ReadL( TDes8* aEntry )
   461     {
   467     {
   462 TFLOGSTRING("TSY: CMmONStoreTsy::ReadL");
   468 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_READL_1, "TSY: CMmONStoreTsy::ReadL");
   463     // Initialize ret value
   469     // Initialize ret value
   464     TInt ret( KErrArgument );
   470     TInt ret( KErrArgument );
   465 
   471 
   466     if( sizeof( RMobileONStore::TMobileONEntryV1 ) <= aEntry->MaxLength() )
   472     if( sizeof( RMobileONStore::TMobileONEntryV1 ) <= aEntry->MaxLength() )
   467 	  	{
   473 	  	{
   500 //
   506 //
   501 void CMmONStoreTsy::CompleteRead(
   507 void CMmONStoreTsy::CompleteRead(
   502     TInt aResult,
   508     TInt aResult,
   503     CMmDataPackage* aDataPackage )
   509     CMmDataPackage* aDataPackage )
   504     {
   510     {
   505 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteRead");
   511 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEREAD_1, "TSY: CMmONStoreTsy::CompleteRead");
   506     // Response information
   512     // Response information
   507     TONStoreMsg* ONStoreResp = NULL;
   513     TONStoreMsg* ONStoreResp = NULL;
   508     // unpack data if exists
   514     // unpack data if exists
   509     if ( aDataPackage )
   515     if ( aDataPackage )
   510         {
   516         {
   511         //unpack data
   517         //unpack data
   512         aDataPackage->UnPackData( ONStoreResp );
   518         aDataPackage->UnPackData( ONStoreResp );
   513         }
   519         }
   514     else if ( KErrNone == aResult )
   520     else if ( KErrNone == aResult )
   515         {
   521         {
   516 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteRead result is KErrNone and aDataPackage is NULL!");
   522 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEREAD_2, "TSY: CMmONStoreTsy::CompleteRead result is KErrNone and aDataPackage is NULL!");
   517         aResult = KErrArgument;
   523         aResult = KErrArgument;
   518         }
   524         }
   519 
   525 
   520     // Reset req handle. Returns the deleted req handle
   526     // Reset req handle. Returns the deleted req handle
   521     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   527     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   577 // ---------------------------------------------------------------------------
   583 // ---------------------------------------------------------------------------
   578 //
   584 //
   579 TInt CMmONStoreTsy::ReadCancel(
   585 TInt CMmONStoreTsy::ReadCancel(
   580     const TTsyReqHandle aTsyReqHandle )
   586     const TTsyReqHandle aTsyReqHandle )
   581     {
   587     {
   582 TFLOGSTRING("TSY: CMmONStoreTsy::ReadCancel");
   588 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_READCANCEL_1, "TSY: CMmONStoreTsy::ReadCancel");
   583     // Reset req handle. Returns the deleted req handle
   589     // Reset req handle. Returns the deleted req handle
   584     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   590     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   585         EMultimodeONStoreRead );
   591         EMultimodeONStoreRead );
   586 
   592 
   587     // Check that request handle was valid
   593     // Check that request handle was valid
   602 //
   608 //
   603 TInt CMmONStoreTsy::WriteL(
   609 TInt CMmONStoreTsy::WriteL(
   604     const TTsyReqHandle aTsyReqHandle,
   610     const TTsyReqHandle aTsyReqHandle,
   605     TDesC8* aEntry )
   611     TDesC8* aEntry )
   606     {
   612     {
   607 TFLOGSTRING("TSY: CMmONStoreTsy::WriteL");
   613 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_WRITEL_1, "TSY: CMmONStoreTsy::WriteL");
   608 
   614 
   609     // Unpack entry param to get the location
   615     // Unpack entry param to get the location
   610     RMobileONStore::TMobileONEntryV1Pckg* entryPckg =
   616     RMobileONStore::TMobileONEntryV1Pckg* entryPckg =
   611         REINTERPRET_CAST
   617         REINTERPRET_CAST
   612         ( RMobileONStore::TMobileONEntryV1Pckg*, aEntry );
   618         ( RMobileONStore::TMobileONEntryV1Pckg*, aEntry );
   660 //
   666 //
   661 void CMmONStoreTsy::CompleteWrite(
   667 void CMmONStoreTsy::CompleteWrite(
   662     TInt aResult,
   668     TInt aResult,
   663     CMmDataPackage* aDataPackage )
   669     CMmDataPackage* aDataPackage )
   664     {
   670     {
   665 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteWrite");   
   671 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEWRITE_1, "TSY: CMmONStoreTsy::CompleteWrite");
   666     // Reset req handle. Returns the deleted req handle
   672     // Reset req handle. Returns the deleted req handle
   667     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   673     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   668         EMultimodeONStoreWrite );
   674         EMultimodeONStoreWrite );
   669 
   675 
   670     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   676     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   712 // ---------------------------------------------------------------------------
   718 // ---------------------------------------------------------------------------
   713 //
   719 //
   714 TInt CMmONStoreTsy::WriteCancel(
   720 TInt CMmONStoreTsy::WriteCancel(
   715     const TTsyReqHandle aTsyReqHandle )
   721     const TTsyReqHandle aTsyReqHandle )
   716     {
   722     {
   717 TFLOGSTRING("TSY: CMmONStoreTsy::WriteCancel");
   723 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_WRITECANCEL_1, "TSY: CMmONStoreTsy::WriteCancel");
   718     // Check if cancelling is possible. If not, return KErrNone
   724     // Check if cancelling is possible. If not, return KErrNone
   719     if ( iIsWriteCancellingPossible )
   725     if ( iIsWriteCancellingPossible )
   720         {
   726         {
   721         // Reset req handle. Returns the deleted req handle
   727         // Reset req handle. Returns the deleted req handle
   722         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   728         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   741 //
   747 //
   742 TInt CMmONStoreTsy::DeleteL(
   748 TInt CMmONStoreTsy::DeleteL(
   743     const TTsyReqHandle aTsyReqHandle,
   749     const TTsyReqHandle aTsyReqHandle,
   744     TInt* aIndex )
   750     TInt* aIndex )
   745     {
   751     {
   746 TFLOGSTRING("TSY: CMmONStoreTsy::DeleteL");
   752 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DELETEL_1, "TSY: CMmONStoreTsy::DeleteL");
   747     // Initialize ret value
   753     // Initialize ret value
   748     TInt ret( KErrGeneral );
   754     TInt ret( KErrGeneral );
   749 
   755 
   750     // Get index and decrease value (CS uses indexes '0' ->, SOS '1' ->)
   756     // Get index and decrease value (CS uses indexes '0' ->, SOS '1' ->)
   751     iDeleteONStoreIndex = *aIndex;
   757     iDeleteONStoreIndex = *aIndex;
   780 // ---------------------------------------------------------------------------
   786 // ---------------------------------------------------------------------------
   781 //
   787 //
   782 void CMmONStoreTsy::CompleteDelete(
   788 void CMmONStoreTsy::CompleteDelete(
   783     TInt aResult )
   789     TInt aResult )
   784     {
   790     {
   785 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteDelete");
   791 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEDELETE_1, "TSY: CMmONStoreTsy::CompleteDelete");
   786     // Reset req handle. Returns the deleted req handle
   792     // Reset req handle. Returns the deleted req handle
   787     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   793     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   788         EMultimodeONStoreDelete );
   794         EMultimodeONStoreDelete );
   789 
   795 
   790     // Check that request was valid
   796     // Check that request was valid
   810 // ---------------------------------------------------------------------------
   816 // ---------------------------------------------------------------------------
   811 //
   817 //
   812 TInt CMmONStoreTsy::DeleteAllL (
   818 TInt CMmONStoreTsy::DeleteAllL (
   813     const TTsyReqHandle aTsyReqHandle )
   819     const TTsyReqHandle aTsyReqHandle )
   814     {
   820     {
   815 TFLOGSTRING("TSY: CMmONStoreTsy::DeleteAllL");
   821 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DELETEALLL_1, "TSY: CMmONStoreTsy::DeleteAllL");
   816     // Init variable for DeleteAllPhase1
   822     // Init variable for DeleteAllPhase1
   817     iDeleteAllContinue = ETrue;
   823     iDeleteAllContinue = ETrue;
   818 
   824 
   819     // Forwarded extension call
   825     // Forwarded extension call
   820     TInt ret = iMmONStoreExtInterface->DeleteAllL( 
   826     TInt ret = iMmONStoreExtInterface->DeleteAllL( 
   842 // ---------------------------------------------------------------------------
   848 // ---------------------------------------------------------------------------
   843 //
   849 //
   844 void CMmONStoreTsy::CompleteDeleteAllPhase1L(
   850 void CMmONStoreTsy::CompleteDeleteAllPhase1L(
   845     TInt aResult )
   851     TInt aResult )
   846     {
   852     {
   847 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteDeleteAllPhase1L");
   853 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEDELETEALLPHASE1L_1, "TSY: CMmONStoreTsy::CompleteDeleteAllPhase1L");
   848     // Check that DeleteAll was called
   854     // Check that DeleteAll was called
   849     if ( iDeleteAllContinue )
   855     if ( iDeleteAllContinue )
   850         {
   856         {
   851         if ( KErrNone == aResult )
   857         if ( KErrNone == aResult )
   852             {
   858             {
   888         EMultimodeONStoreDeleteAll );
   894         EMultimodeONStoreDeleteAll );
   889 
   895 
   890     // Check that deleted request handle was valid
   896     // Check that deleted request handle was valid
   891     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   897     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   892         {
   898         {
   893 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteDeleteAll");        
   899 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEDELETEALL_1, "TSY: CMmONStoreTsy::CompleteDeleteAll");
   894         // Complete with error
   900         // Complete with error
   895         ReqCompleted( reqHandle, aResult );
   901         ReqCompleted( reqHandle, aResult );
   896 
   902 
   897         // If deletion done succesfully, complete notify store event
   903         // If deletion done succesfully, complete notify store event
   898         // Notify will complete if it was requested
   904         // Notify will complete if it was requested
   906             }
   912             }
   907         }
   913         }
   908     else if(EMultimodeONStoreReqHandleUnknown !=
   914     else if(EMultimodeONStoreReqHandleUnknown !=
   909 				 iTsyReqHandleStore->GetTsyReqHandle(EMultimodeONStoreStoreAll ))
   915 				 iTsyReqHandleStore->GetTsyReqHandle(EMultimodeONStoreStoreAll ))
   910     	{
   916     	{
   911 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteDeleteAll requested by StoreAllL.");
   917 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEDELETEALL_2, "TSY: CMmONStoreTsy::CompleteDeleteAll requested by StoreAllL.");
   912     	TInt ret (aResult);
   918     	TInt ret (aResult);
   913 		    	
   919 		    	
   914     	if(KErrNone == ret)
   920     	if(KErrNone == ret)
   915     		{
   921     		{
   916     		// ON store is now empty. Let's begin with reading store size to actually store all entries.
   922     		// ON store is now empty. Let's begin with reading store size to actually store all entries.
   927         	CompleteStoreAll( ret );
   933         	CompleteStoreAll( ret );
   928         	}
   934         	}
   929     	}
   935     	}
   930     else
   936     else
   931     	{
   937     	{
   932 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteDeleteAll - the request has been cancelled or bad req handle");
   938 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEDELETEALL_3, "TSY: CMmONStoreTsy::CompleteDeleteAll - the request has been cancelled or bad req handle");
   933     	}
   939     	}
   934     }
   940     }
   935 
   941 
   936 // ---------------------------------------------------------------------------
   942 // ---------------------------------------------------------------------------
   937 // CMmONStoreTsy::DeleteAllCancel
   943 // CMmONStoreTsy::DeleteAllCancel
   940 // ---------------------------------------------------------------------------
   946 // ---------------------------------------------------------------------------
   941 //
   947 //
   942 TInt CMmONStoreTsy::DeleteAllCancel(
   948 TInt CMmONStoreTsy::DeleteAllCancel(
   943     const TTsyReqHandle aTsyReqHandle )
   949     const TTsyReqHandle aTsyReqHandle )
   944     {
   950     {
   945 TFLOGSTRING("TSY: CMmONStoreTsy::DeleteAllCancel");
   951 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DELETEALLCANCEL_1, "TSY: CMmONStoreTsy::DeleteAllCancel");
   946     // Reset req handle. Returns the deleted req handle
   952     // Reset req handle. Returns the deleted req handle
   947     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   953     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   948         EMultimodeONStoreDeleteAll );
   954         EMultimodeONStoreDeleteAll );
   949 
   955 
   950     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   956     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
   966 //
   972 //
   967 TInt CMmONStoreTsy::GetInfoL(
   973 TInt CMmONStoreTsy::GetInfoL(
   968     const TTsyReqHandle aTsyReqHandle,
   974     const TTsyReqHandle aTsyReqHandle,
   969     RMobileONStore::TMobileONStoreInfoV1* aInfo )
   975     RMobileONStore::TMobileONStoreInfoV1* aInfo )
   970     {
   976     {
   971 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoL");
   977 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_1, "TSY: CMmONStoreTsy::GetInfoL");
   972 
   978 
   973     TInt ret( KErrNone );
   979     TInt ret( KErrNone );
   974 
   980 
   975     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
   981     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
   976         EMultimodeONStoreGetInfo );
   982         EMultimodeONStoreGetInfo );
   987         }
   993         }
   988 
   994 
   989    	// Don't send request if pb init is still ongoing
   995    	// Don't send request if pb init is still ongoing
   990 	// instead create an ADN book store and wait for it to initilize
   996 	// instead create an ADN book store and wait for it to initilize
   991     
   997     
   992 TFLOGSTRING2( "TSY: CMmONStoreTsy::GetInfoL iPBList->GetNumberOfObjects() = %d", iMmPhone->PBList()->GetNumberOfObjects());
   998 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_2,  "TSY: CMmONStoreTsy::GetInfoL iPBList->GetNumberOfObjects() = %d", iMmPhone->PBList()->GetNumberOfObjects());
   993     CMmPhoneBookStoreTsy* pbStore = NULL;
   999     CMmPhoneBookStoreTsy* pbStore = NULL;
   994 	for( TInt i = 0; (i < iMmPhone->PBList()->GetNumberOfObjects()) && (NULL == pbStore) ; i++ )
  1000 	for( TInt i = 0; (i < iMmPhone->PBList()->GetNumberOfObjects()) && (NULL == pbStore) ; i++ )
   995 	    {
  1001 	    {
   996 	    pbStore = iMmPhone->PBList()->GetMmPBByIndex( i );
  1002 	    pbStore = iMmPhone->PBList()->GetMmPBByIndex( i );
   997 TFLOGSTRING2( "TSY: CMmONStoreTsy::GetInfoL index = %d", i);    
  1003 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_3,  "TSY: CMmONStoreTsy::GetInfoL index = %d", i);
   998         if( (pbStore->GetPhonebookType() != KADNPhoneBook) && (pbStore->GetPhonebookType() != KFDNPhoneBook ) ) 
  1004         if( (pbStore->GetPhonebookType() != KADNPhoneBook) && (pbStore->GetPhonebookType() != KFDNPhoneBook ) ) 
   999             {
  1005             {
  1000             pbStore = NULL;
  1006             pbStore = NULL;
  1001             }
  1007             }
  1002         else
  1008         else
  1003             {
  1009             {
  1004         
  1010         
  1005 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoL - found ADN or FDN store");
  1011 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_4, "TSY: CMmONStoreTsy::GetInfoL - found ADN or FDN store");
  1006 			}
  1012 			}
  1007    		}
  1013    		}
  1008 	if(NULL == pbStore)
  1014 	if(NULL == pbStore)
  1009 	    {
  1015 	    {
  1010 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoL - no ADN nor FDN store- creating ADN");
  1016 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_5, "TSY: CMmONStoreTsy::GetInfoL - no ADN nor FDN store- creating ADN");
  1011         pbStore = CMmPhoneBookStoreTsy::NewL( iMmPhone, KETelIccAdnPhoneBook );
  1017         pbStore = CMmPhoneBookStoreTsy::NewL( iMmPhone, KETelIccAdnPhoneBook );
  1012         TInt addPBSucceeded = iMmPhone->PBList()->AddObject( pbStore );
  1018         TInt addPBSucceeded = iMmPhone->PBList()->AddObject( pbStore );
  1013         if(addPBSucceeded != KErrNone)
  1019         if(addPBSucceeded != KErrNone)
  1014             {
  1020             {
  1015             delete pbStore;
  1021             delete pbStore;
  1021 	// Set get info internal pointer
  1027 	// Set get info internal pointer
  1022     iONStoreInfoChanged = aInfo;
  1028     iONStoreInfoChanged = aInfo;
  1023 
  1029 
  1024 	if ( !pbStore->IsPBInitDone())
  1030 	if ( !pbStore->IsPBInitDone())
  1025 	    {
  1031 	    {
  1026 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoL - waiting for phone book to be initilized");
  1032 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_6, "TSY: CMmONStoreTsy::GetInfoL - waiting for phone book to be initilized");
  1027         // Save tsy req handle type
  1033         // Save tsy req handle type
  1028         iReqHandleType = EMultimodeONStoreGetInfo;
  1034         iReqHandleType = EMultimodeONStoreGetInfo;
  1029         return KErrNone;
  1035         return KErrNone;
  1030 	    }
  1036 	    }
  1031      
  1037      
  1032 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoL - PBInit done, complete");
  1038 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOL_7, "TSY: CMmONStoreTsy::GetInfoL - PBInit done, complete");
  1033         
  1039         
  1034     // Request to GSM extension, get used entries,
  1040     // Request to GSM extension, get used entries,
  1035     // -1 as a index param-> specified location param not needed
  1041     // -1 as a index param-> specified location param not needed
  1036     ret = iMmONStoreExtInterface->ReadL(EMmTsyONStoreGetInfoIPC, -1);
  1042     ret = iMmONStoreExtInterface->ReadL(EMmTsyONStoreGetInfoIPC, -1);
  1037 
  1043 
  1056 //
  1062 //
  1057 void CMmONStoreTsy::CompleteGetInfo( 
  1063 void CMmONStoreTsy::CompleteGetInfo( 
  1058     TInt aResult,
  1064     TInt aResult,
  1059     CMmDataPackage* aDataPackage )
  1065     CMmDataPackage* aDataPackage )
  1060     {
  1066     {
  1061 TFLOGSTRING2("TSY: CMmONStoreTsy::CompleteGetInfo - Result: %d", aResult );
  1067 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEGETINFO_1, "TSY: CMmONStoreTsy::CompleteGetInfo - Result: %d", aResult );
  1062 
  1068 
  1063     // Reset req handle. Returns the deleted req handle
  1069     // Reset req handle. Returns the deleted req handle
  1064     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1070     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1065         EMultimodeONStoreGetInfo );
  1071         EMultimodeONStoreGetInfo );
  1066 
  1072 
  1081             iONStoreInfo.iNumberLen = serviceType.iNumLen;
  1087             iONStoreInfo.iNumberLen = serviceType.iNumLen;
  1082             iONStoreInfo.iTextLen = serviceType.iNameLen;
  1088             iONStoreInfo.iTextLen = serviceType.iNameLen;
  1083 
  1089 
  1084             *iONStoreInfoChanged = iONStoreInfo;
  1090             *iONStoreInfoChanged = iONStoreInfo;
  1085 
  1091 
  1086 TFLOGSTRING3("TSY: CMmONStoreTsy::CompleteGetInfo - Name: %S, Type: %d", &iONStoreInfoChanged->iName, iONStoreInfoChanged->iType );
  1092 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEGETINFO_2, "TSY: CMmONStoreTsy::CompleteGetInfo - Name: %S, Type: %d", iONStoreInfoChanged->iName, iONStoreInfoChanged->iType );
  1087 TFLOGSTRING3("TSY: CMmONStoreTsy::CompleteGetInfo - Total entries: %d, Used entries: %d", iONStoreInfoChanged->iTotalEntries, iONStoreInfoChanged->iUsedEntries );
  1093 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEGETINFO_3, "TSY: CMmONStoreTsy::CompleteGetInfo - Total entries: %d, Used entries: %d", iONStoreInfoChanged->iTotalEntries, iONStoreInfoChanged->iUsedEntries );
  1088 TFLOGSTRING3("TSY: CMmONStoreTsy::CompleteGetInfo - Max Number length: %d, Max Name length: %d", iONStoreInfoChanged->iNumberLen, iONStoreInfoChanged->iTextLen );
  1094 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEGETINFO_4, "TSY: CMmONStoreTsy::CompleteGetInfo - Max Number length: %d, Max Name length: %d", iONStoreInfoChanged->iNumberLen, iONStoreInfoChanged->iTextLen );
  1089             }
  1095             }
  1090 
  1096 
  1091         // NULL the pointer to info supplied to TSY from the client
  1097         // NULL the pointer to info supplied to TSY from the client
  1092         iONStoreInfoChanged = NULL;
  1098         iONStoreInfoChanged = NULL;
  1093     
  1099     
  1102 // (other items were commented in a header).
  1108 // (other items were commented in a header).
  1103 // ---------------------------------------------------------------------------
  1109 // ---------------------------------------------------------------------------
  1104 //
  1110 //
  1105 void CMmONStoreTsy::SetInfo()
  1111 void CMmONStoreTsy::SetInfo()
  1106     {
  1112     {
  1107 TFLOGSTRING("TSY: CMmONStoreTsy::SetInfo");
  1113 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_SETINFO_1, "TSY: CMmONStoreTsy::SetInfo");
  1108     // The name of the store
  1114     // The name of the store
  1109     iONStoreInfo.iName = KETelOwnNumberStore;
  1115     iONStoreInfo.iName = KETelOwnNumberStore;
  1110 
  1116 
  1111     // The maximum number of characters for the number in a phonebook entry
  1117     // The maximum number of characters for the number in a phonebook entry
  1112     iONStoreInfo.iNumberLen = KNoInfoAvail;
  1118     iONStoreInfo.iNumberLen = KNoInfoAvail;
  1134 // ---------------------------------------------------------------------------
  1140 // ---------------------------------------------------------------------------
  1135 //
  1141 //
  1136 TInt CMmONStoreTsy::GetInfoCancel(
  1142 TInt CMmONStoreTsy::GetInfoCancel(
  1137     const TTsyReqHandle aTsyReqHandle )
  1143     const TTsyReqHandle aTsyReqHandle )
  1138     {
  1144     {
  1139 TFLOGSTRING("TSY: CMmONStoreTsy::GetInfoCancel");
  1145 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_GETINFOCANCEL_1, "TSY: CMmONStoreTsy::GetInfoCancel");
  1140 
  1146 
  1141     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeONStoreGetInfo );
  1147     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeONStoreGetInfo );
  1142 
  1148 
  1143     // Complete with KErrCancel
  1149     // Complete with KErrCancel
  1144     ReqCompleted( aTsyReqHandle, KErrCancel );
  1150     ReqCompleted( aTsyReqHandle, KErrCancel );
  1154 //
  1160 //
  1155 TInt CMmONStoreTsy::NotifyStoreEvent(
  1161 TInt CMmONStoreTsy::NotifyStoreEvent(
  1156     RMobilePhoneStore::TMobileStoreEvent* aEvent,
  1162     RMobilePhoneStore::TMobileStoreEvent* aEvent,
  1157     TInt* aIndex )
  1163     TInt* aIndex )
  1158     {
  1164     {
  1159 TFLOGSTRING("TSY: CMmONStoreTsy::NotifyStoreEvent");
  1165 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_NOTIFYSTOREEVENT_1, "TSY: CMmONStoreTsy::NotifyStoreEvent");
  1160     TTsyReqHandle requestHandle = iTsyReqHandleStore->GetTsyReqHandle( 
  1166     TTsyReqHandle requestHandle = iTsyReqHandleStore->GetTsyReqHandle( 
  1161         EMultimodeONStoreNotifyStoreEvent );
  1167         EMultimodeONStoreNotifyStoreEvent );
  1162 
  1168 
  1163     // If request is not running
  1169     // If request is not running
  1164     if ( 0 == requestHandle )
  1170     if ( 0 == requestHandle )
  1181 // ---------------------------------------------------------------------------
  1187 // ---------------------------------------------------------------------------
  1182 //
  1188 //
  1183 void CMmONStoreTsy::CompleteNotifyStoreEvent(
  1189 void CMmONStoreTsy::CompleteNotifyStoreEvent(
  1184     TInt aLocation )
  1190     TInt aLocation )
  1185     {
  1191     {
  1186 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteNotifyStoreEvent");
  1192 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETENOTIFYSTOREEVENT_1, "TSY: CMmONStoreTsy::CompleteNotifyStoreEvent");
  1187     // Reset request handle. Returns the deleted req handle
  1193     // Reset request handle. Returns the deleted req handle
  1188     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1194     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1189         EMultimodeONStoreNotifyStoreEvent );
  1195         EMultimodeONStoreNotifyStoreEvent );
  1190 
  1196 
  1191     // If request handle is valid
  1197     // If request handle is valid
  1210 // ---------------------------------------------------------------------------
  1216 // ---------------------------------------------------------------------------
  1211 //
  1217 //
  1212 TInt CMmONStoreTsy::NotifyStoreEventCancel(
  1218 TInt CMmONStoreTsy::NotifyStoreEventCancel(
  1213     const TTsyReqHandle aTsyReqHandle )
  1219     const TTsyReqHandle aTsyReqHandle )
  1214     {
  1220     {
  1215 TFLOGSTRING("TSY: CMmONStoreTsy::NotifyStoreEventCancel");
  1221 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_NOTIFYSTOREEVENTCANCEL_1, "TSY: CMmONStoreTsy::NotifyStoreEventCancel");
  1216     // Reset req handle. Returns the deleted req handle
  1222     // Reset req handle. Returns the deleted req handle
  1217     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1223     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1218         EMultimodeONStoreNotifyStoreEvent );
  1224         EMultimodeONStoreNotifyStoreEvent );
  1219 
  1225 
  1220     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1226     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1237 TInt CMmONStoreTsy::ReadAllPhase1L(
  1243 TInt CMmONStoreTsy::ReadAllPhase1L(
  1238     const TTsyReqHandle aReqHandle,
  1244     const TTsyReqHandle aReqHandle,
  1239     const RMobilePhone::TClientId* aId, 
  1245     const RMobilePhone::TClientId* aId, 
  1240     TInt* aBufSize )
  1246     TInt* aBufSize )
  1241     {
  1247     {
  1242 TFLOGSTRING("TSY: CMmONStoreTsy::ReadAllPhase1L");
  1248 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_READALLPHASE1L_1, "TSY: CMmONStoreTsy::ReadAllPhase1L");
  1243     // Init return value
  1249     // Init return value
  1244     TInt ret( KErrNone );
  1250     TInt ret( KErrNone );
  1245     
  1251     
  1246     // Store index when reading all entries
  1252     // Store index when reading all entries
  1247     TInt readAllIndex = -1; 
  1253     TInt readAllIndex = -1; 
  1280 //
  1286 //
  1281 void CMmONStoreTsy::InternalRetrieveONListReadSizeL(
  1287 void CMmONStoreTsy::InternalRetrieveONListReadSizeL(
  1282     TInt aError,
  1288     TInt aError,
  1283     CMmDataPackage* aDataPackage )
  1289     CMmDataPackage* aDataPackage )
  1284     {
  1290     {
  1285 TFLOGSTRING("TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL");
  1291 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALRETRIEVEONLISTREADSIZEL_1, "TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL");
  1286     if ( KErrNone == aError )
  1292     if ( KErrNone == aError )
  1287         {
  1293         {
  1288         TInt size;
  1294         TInt size;
  1289         aDataPackage->UnPackData( size );
  1295         aDataPackage->UnPackData( size );
  1290 TFLOGSTRING2("TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL size=%d",size);
  1296 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALRETRIEVEONLISTREADSIZEL_2, "TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL size=%d",size);
  1291         if( 0 < size )
  1297         if( 0 < size )
  1292             {
  1298             {
  1293             *iReadAllBufSizePtr = size;
  1299             *iReadAllBufSizePtr = size;
  1294             iReadAllONStoreSize = size;
  1300             iReadAllONStoreSize = size;
  1295             MakeInternalRetrieveONListReadReqL();
  1301             MakeInternalRetrieveONListReadReqL();
  1296             }
  1302             }
  1297         else
  1303         else
  1298             {
  1304             {
  1299 TFLOGSTRING2("TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL size is %d", size);
  1305 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALRETRIEVEONLISTREADSIZEL_3, "TSY: CMmONStoreTsy::InternalRetrieveONListReadSizeL size is %d", size);
  1300             CompleteReadAllPhase1Req( KErrNotFound );
  1306             CompleteReadAllPhase1Req( KErrNotFound );
  1301             }
  1307             }
  1302         }
  1308         }
  1303     else
  1309     else
  1304         {
  1310         {
  1314 // (other items were commented in a header).
  1320 // (other items were commented in a header).
  1315 // ---------------------------------------------------------------------------
  1321 // ---------------------------------------------------------------------------
  1316 //
  1322 //
  1317 void CMmONStoreTsy::MakeInternalRetrieveONListReadReqL()
  1323 void CMmONStoreTsy::MakeInternalRetrieveONListReadReqL()
  1318     {
  1324     {
  1319 TFLOGSTRING("TSY: CMmONStoreTsy::MakeInternalRetrieveONListReadReqL");
  1325 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_MAKEINTERNALRETRIEVEONLISTREADREQL_1, "TSY: CMmONStoreTsy::MakeInternalRetrieveONListReadReqL");
  1320     // Read one entry from the PhoneBook.
  1326     // Read one entry from the PhoneBook.
  1321     TInt ret = iMmONStoreExtInterface->
  1327     TInt ret = iMmONStoreExtInterface->
  1322         ReadL( EMmTsyONStoreReadEntryIPC,iReadAllONStoreIndex );
  1328         ReadL( EMmTsyONStoreReadEntryIPC,iReadAllONStoreIndex );
  1323 
  1329 
  1324 	// Increase PhoneBookStoreIndex by 1.
  1330 	// Increase PhoneBookStoreIndex by 1.
  1341 //
  1347 //
  1342 void CMmONStoreTsy::InternalRetrieveONListReadEntryL(
  1348 void CMmONStoreTsy::InternalRetrieveONListReadEntryL(
  1343     TInt aError,
  1349     TInt aError,
  1344     CMmDataPackage* aDataPackage)
  1350     CMmDataPackage* aDataPackage)
  1345     {
  1351     {
  1346 TFLOGSTRING("TSY: CMmONStoreTsy::InternalRetrieveONListReadEntryL");
  1352 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALRETRIEVEONLISTREADENTRYL_1, "TSY: CMmONStoreTsy::InternalRetrieveONListReadEntryL");
  1347     if ( KErrNone == aError )
  1353     if ( KErrNone == aError )
  1348         {
  1354         {
  1349         // Check if there is data to save
  1355         // Check if there is data to save
  1350         if ( aDataPackage )
  1356         if ( aDataPackage )
  1351             {
  1357             {
  1387 // (other items were commented in a header).
  1393 // (other items were commented in a header).
  1388 // ---------------------------------------------------------------------------
  1394 // ---------------------------------------------------------------------------
  1389 //
  1395 //
  1390 TInt CMmONStoreTsy::CompleteReadAllPhase1L()
  1396 TInt CMmONStoreTsy::CompleteReadAllPhase1L()
  1391     {
  1397     {
  1392 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteReadAllPhase1L");
  1398 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEREADALLPHASE1L_1, "TSY: CMmONStoreTsy::CompleteReadAllPhase1L");
  1393     // Reset req handle. Returns the deleted req handle
  1399     // Reset req handle. Returns the deleted req handle
  1394     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
  1400     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
  1395         EMultimodeONStoreReadAll );
  1401         EMultimodeONStoreReadAll );
  1396 
  1402 
  1397     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1403     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1466 // ---------------------------------------------------------------------------
  1472 // ---------------------------------------------------------------------------
  1467 //
  1473 //
  1468 void CMmONStoreTsy::CompleteReadAllPhase1Req(
  1474 void CMmONStoreTsy::CompleteReadAllPhase1Req(
  1469     TInt aResult )
  1475     TInt aResult )
  1470     {
  1476     {
  1471 TFLOGSTRING("TSY: CMmONStoreTsy::CompleteReadAllPhase1Req");
  1477 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETEREADALLPHASE1REQ_1, "TSY: CMmONStoreTsy::CompleteReadAllPhase1Req");
  1472     // Reset req handle. Returns the deleted req handle
  1478     // Reset req handle. Returns the deleted req handle
  1473     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1479     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1474         EMultimodeONStoreReadAll );
  1480         EMultimodeONStoreReadAll );
  1475 
  1481 
  1476     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1482     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1495 // (other items were commented in a header).
  1501 // (other items were commented in a header).
  1496 // ---------------------------------------------------------------------------
  1502 // ---------------------------------------------------------------------------
  1497 //
  1503 //
  1498 void CMmONStoreTsy::DeleteONStoreListArrayElements()
  1504 void CMmONStoreTsy::DeleteONStoreListArrayElements()
  1499     {
  1505     {
  1500 TFLOGSTRING("TSY: CMmONStoreTsy::DeleteONStoreListArrayElements");
  1506 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_DELETEONSTORELISTARRAYELEMENTS_1, "TSY: CMmONStoreTsy::DeleteONStoreListArrayElements");
  1501     while( 0 == !iONStoreListArray->Count() )
  1507     while( 0 == !iONStoreListArray->Count() )
  1502         {
  1508         {
  1503         // Delete list member
  1509         // Delete list member
  1504         iONStoreListArray->Delete(0);
  1510         iONStoreListArray->Delete(0);
  1505         iONStoreListArray->Compress();
  1511         iONStoreListArray->Compress();
  1518 TInt CMmONStoreTsy::ReadAllPhase2(
  1524 TInt CMmONStoreTsy::ReadAllPhase2(
  1519     TTsyReqHandle aTsyReqHandle,
  1525     TTsyReqHandle aTsyReqHandle,
  1520     const RMobilePhone::TClientId* aId,
  1526     const RMobilePhone::TClientId* aId,
  1521     TDes8* aBuffer )
  1527     TDes8* aBuffer )
  1522     {
  1528     {
  1523 TFLOGSTRING("TSY: CMmONStoreTsy::ReadAllPhase2");
  1529 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_READALLPHASE2_1, "TSY: CMmONStoreTsy::ReadAllPhase2");
  1524     // Initialize ret value
  1530     // Initialize ret value
  1525     TInt ret( KErrCorrupt );
  1531     TInt ret( KErrCorrupt );
  1526 
  1532 
  1527     // Set read pointer to NULL
  1533     // Set read pointer to NULL
  1528     CListReadAllAttempt* read = NULL;
  1534     CListReadAllAttempt* read = NULL;
  1575 // ---------------------------------------------------------------------------
  1581 // ---------------------------------------------------------------------------
  1576 //
  1582 //
  1577 TInt CMmONStoreTsy::ReadAllCancel(
  1583 TInt CMmONStoreTsy::ReadAllCancel(
  1578     const TTsyReqHandle aTsyReqHandle )
  1584     const TTsyReqHandle aTsyReqHandle )
  1579     {
  1585     {
  1580 TFLOGSTRING("TSY: CMmONStoreTsy::ReadAllCancel");
  1586 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_READALLCANCEL_1, "TSY: CMmONStoreTsy::ReadAllCancel");
  1581     // Reset req handle. Returns the deleted req handle
  1587     // Reset req handle. Returns the deleted req handle
  1582     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1588     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1583         EMultimodeONStoreReadAll );
  1589         EMultimodeONStoreReadAll );
  1584 
  1590 
  1585     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1591     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1603 //
  1609 //
  1604 TInt CMmONStoreTsy::StoreAllL(
  1610 TInt CMmONStoreTsy::StoreAllL(
  1605     const TTsyReqHandle aTsyReqHandle,
  1611     const TTsyReqHandle aTsyReqHandle,
  1606     TDes8* aBuffer )
  1612     TDes8* aBuffer )
  1607     {
  1613     {
  1608 TFLOGSTRING("TSY: CMmONStoreTsy::StoreAllL");
  1614 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_STOREALLL_1, "TSY: CMmONStoreTsy::StoreAllL");
  1609     // Init return value
  1615     // Init return value
  1610     TInt ret( KErrNone );
  1616     TInt ret( KErrNone );
  1611     
  1617     
  1612     // Set pointer to descrptor
  1618     // Set pointer to descrptor
  1613     iStoreAllBuffer = aBuffer;
  1619     iStoreAllBuffer = aBuffer;
  1623     iStoreAllONListSize = aONList->Enumerate();
  1629     iStoreAllONListSize = aONList->Enumerate();
  1624     
  1630     
  1625     // StoreAll overwrites ON phone store. So, first delete all store.
  1631     // StoreAll overwrites ON phone store. So, first delete all store.
  1626     ret = iMmONStoreExtInterface->DeleteAllL( 
  1632     ret = iMmONStoreExtInterface->DeleteAllL( 
  1627         EMmTsyONStoreDeleteAllIPC );
  1633         EMmTsyONStoreDeleteAllIPC );
  1628 TFLOGSTRING2("CMmONStoreTsy::StoreAllL - DeleteAllL() ret: %d", ret);
  1634 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_STOREALLL_2, "CMmONStoreTsy::StoreAllL - DeleteAllL() ret: %d", ret);
  1629     
  1635     
  1630     // Message construction failed or phonet sender returned error
  1636     // Message construction failed or phonet sender returned error
  1631     if ( KErrNone != ret )
  1637     if ( KErrNone != ret )
  1632         {
  1638         {
  1633         ReqCompleted( aTsyReqHandle, ret );
  1639         ReqCompleted( aTsyReqHandle, ret );
  1652 //
  1658 //
  1653 void CMmONStoreTsy::InternalStoreAllGetSizeL(
  1659 void CMmONStoreTsy::InternalStoreAllGetSizeL(
  1654     TInt aError,
  1660     TInt aError,
  1655     CMmDataPackage* aDataPackage )
  1661     CMmDataPackage* aDataPackage )
  1656     {
  1662     {
  1657 TFLOGSTRING2("CMmONStoreTsy::InternalStoreAllGetSizeL %d",aError);
  1663 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALSTOREALLGETSIZEL_1, "CMmONStoreTsy::InternalStoreAllGetSizeL %d",aError);
  1658     if ( KErrNone == aError )
  1664     if ( KErrNone == aError )
  1659         {
  1665         {
  1660         TInt size;
  1666         TInt size;
  1661         aDataPackage->UnPackData( size );
  1667         aDataPackage->UnPackData( size );
  1662 
  1668 
  1663 TFLOGSTRING2("CMmONStoreTsy::InternalStoreAllGetSizeL size %d", size);
  1669 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALSTOREALLGETSIZEL_2, "CMmONStoreTsy::InternalStoreAllGetSizeL size %d", size);
  1664         // Check the size of ONStore and the ONList size from Client
  1670         // Check the size of ONStore and the ONList size from Client
  1665         // Client's ONList size should not be greater than ONStore size
  1671         // Client's ONList size should not be greater than ONStore size
  1666         if ( size > 0 && size >= iStoreAllONListSize )
  1672         if ( size > 0 && size >= iStoreAllONListSize )
  1667             {
  1673             {
  1668             TTsyReqHandle storeAllRequestHandle = 
  1674             TTsyReqHandle storeAllRequestHandle = 
  1700 // (other items were commented in a header).
  1706 // (other items were commented in a header).
  1701 // ---------------------------------------------------------------------------
  1707 // ---------------------------------------------------------------------------
  1702 //
  1708 //
  1703 void CMmONStoreTsy::MakeInternalStoreAllWriteReqL()
  1709 void CMmONStoreTsy::MakeInternalStoreAllWriteReqL()
  1704     {
  1710     {
  1705 TFLOGSTRING("CMmONStoreTsy::MakeInternalStoreAllWriteReqL ");
  1711 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_MAKEINTERNALSTOREALLWRITEREQL_1, "CMmONStoreTsy::MakeInternalStoreAllWriteReqL ");
  1706     // Create ONList and push it to cleanup stack
  1712     // Create ONList and push it to cleanup stack
  1707     CMobilePhoneONList* aONList=CMobilePhoneONList::NewL();
  1713     CMobilePhoneONList* aONList=CMobilePhoneONList::NewL();
  1708     CleanupStack::PushL(aONList);
  1714     CleanupStack::PushL(aONList);
  1709 
  1715 
  1710     // Check the existance of buffered ONlist
  1716     // Check the existance of buffered ONlist
  1776 // ---------------------------------------------------------------------------
  1782 // ---------------------------------------------------------------------------
  1777 //
  1783 //
  1778 void CMmONStoreTsy::InternalStoreAllWriteEntryL(
  1784 void CMmONStoreTsy::InternalStoreAllWriteEntryL(
  1779     TInt aResult )
  1785     TInt aResult )
  1780     {
  1786     {
  1781 TFLOGSTRING2("CMmONStoreTsy::InternalStoreAllWriteEntryL %d",aResult);
  1787 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALSTOREALLWRITEENTRYL_1, "CMmONStoreTsy::InternalStoreAllWriteEntryL %d",aResult);
  1782 
  1788 
  1783 	TTsyReqHandle storeAllRequestHandle = 
  1789 	TTsyReqHandle storeAllRequestHandle = 
  1784 		iTsyReqHandleStore->GetTsyReqHandle(
  1790 		iTsyReqHandleStore->GetTsyReqHandle(
  1785 				EMultimodeONStoreStoreAll );
  1791 				EMultimodeONStoreStoreAll );
  1786 	
  1792 	
  1787 	if ( EMultimodeONStoreReqHandleUnknown == storeAllRequestHandle )
  1793 	if ( EMultimodeONStoreReqHandleUnknown == storeAllRequestHandle )
  1788 		{
  1794 		{
  1789 		// The request has been cancelled or bad req handle
  1795 		// The request has been cancelled or bad req handle
  1790 TFLOGSTRING("The ON store request has been cancelled or bad req handle");
  1796 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_INTERNALSTOREALLWRITEENTRYL_2, "The ON store request has been cancelled or bad req handle");
  1791 		return;
  1797 		return;
  1792 		}
  1798 		}
  1793 
  1799 
  1794     if ( KErrNone == aResult )
  1800     if ( KErrNone == aResult )
  1795         {
  1801         {
  1809 // ---------------------------------------------------------------------------
  1815 // ---------------------------------------------------------------------------
  1810 //
  1816 //
  1811 void CMmONStoreTsy::CompleteStoreAll(
  1817 void CMmONStoreTsy::CompleteStoreAll(
  1812     TInt aResult )
  1818     TInt aResult )
  1813     {
  1819     {
  1814 TFLOGSTRING2("CMmONStoreTsy::CompleteStoreAll %d",aResult);
  1820 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETESTOREALL_1, "CMmONStoreTsy::CompleteStoreAll %d",aResult);
  1815     // Reset req handle. Returns the deleted req handle
  1821     // Reset req handle. Returns the deleted req handle
  1816     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1822     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1817         EMultimodeONStoreStoreAll );
  1823         EMultimodeONStoreStoreAll );
  1818 
  1824 
  1819     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1825     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1847 // ---------------------------------------------------------------------------
  1853 // ---------------------------------------------------------------------------
  1848 //
  1854 //
  1849 TInt CMmONStoreTsy::StoreAllCancel(
  1855 TInt CMmONStoreTsy::StoreAllCancel(
  1850     TTsyReqHandle aTsyReqHandle )
  1856     TTsyReqHandle aTsyReqHandle )
  1851     {
  1857     {
  1852 TFLOGSTRING("CMmONStoreTsy::StoreAllCancel");
  1858 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_STOREALLCANCEL_1, "CMmONStoreTsy::StoreAllCancel");
  1853     // Reset req handle. Returns the deleted req handle
  1859     // Reset req handle. Returns the deleted req handle
  1854     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1860     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
  1855         EMultimodeONStoreStoreAll );
  1861         EMultimodeONStoreStoreAll );
  1856 
  1862 
  1857     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1863     if ( EMultimodeONStoreReqHandleUnknown != reqHandle )
  1904 //
  1910 //
  1905 void CMmONStoreTsy::ReqCompleted(
  1911 void CMmONStoreTsy::ReqCompleted(
  1906     const TTsyReqHandle aTsyReqHandle, 
  1912     const TTsyReqHandle aTsyReqHandle, 
  1907     const TInt aError )
  1913     const TInt aError )
  1908     {
  1914     {
  1909 TFLOGSTRING3("TSY: CMmONStoreTsy::ReqCompleted Completed - Handle:%d Error:%d", aTsyReqHandle, aError);
  1915 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_REQCOMPLETED_1, "TSY: CMmONStoreTsy::ReqCompleted Completed - Handle:%d Error:%d", aTsyReqHandle, aError);
  1910 
  1916 
  1911     CTelObject::ReqCompleted( aTsyReqHandle, aError );
  1917     CTelObject::ReqCompleted( aTsyReqHandle, aError );
  1912     }
  1918     }
  1913 
  1919 
  1914 #endif // TF_LOGGING_ENABLED
  1920 #endif // TF_LOGGING_ENABLED
  1991 //
  1997 //
  1992 void CMmONStoreTsy::Complete(
  1998 void CMmONStoreTsy::Complete(
  1993     TInt aReqHandleType,
  1999     TInt aReqHandleType,
  1994     TInt aError )
  2000     TInt aError )
  1995     {
  2001     {
  1996 TFLOGSTRING3( "TSY: CMmONStoreTsy::Complete - ReqHandleType: %d Error: %d", aReqHandleType, aError );    
  2002 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_COMPLETE_1,  "TSY: CMmONStoreTsy::Complete - ReqHandleType: %d Error: %d", aReqHandleType, aError );
  1997     //All possible TSY req handle types are listed in the
  2003     //All possible TSY req handle types are listed in the
  1998     //switch case below.
  2004     //switch case below.
  1999     switch( aReqHandleType )
  2005     switch( aReqHandleType )
  2000         {
  2006         {
  2001         case EMultimodeONStoreRead:
  2007         case EMultimodeONStoreRead:
  2038 // (other items were commented in a header).
  2044 // (other items were commented in a header).
  2039 // ---------------------------------------------------------------------------
  2045 // ---------------------------------------------------------------------------
  2040 //
  2046 //
  2041 void CMmONStoreTsy::PhoneBookStoreInitCompleteL(TInt aError)
  2047 void CMmONStoreTsy::PhoneBookStoreInitCompleteL(TInt aError)
  2042     {
  2048     {
  2043     TFLOGSTRING("TSY: CMmONStoreTsy::PhoneBookStoreInitCompleteL ");
  2049     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMONSTORETSY_PHONEBOOKSTOREINITCOMPLETEL_1, "TSY: CMmONStoreTsy::PhoneBookStoreInitCompleteL ");
  2044     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeONStoreGetInfo );   
  2050     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeONStoreGetInfo );   
  2045     if( EMultimodeONStoreReqHandleUnknown != reqHandle )
  2051     if( EMultimodeONStoreReqHandleUnknown != reqHandle )
  2046         {
  2052         {
  2047         if( KErrNone != aError )
  2053         if( KErrNone != aError )
  2048             {
  2054             {