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