telephonyserverplugins/common_tsy/commontsy/src/mmstorage/cmmphonebookstoretsy.cpp
branchRCL_3
changeset 16 fe8b59ab9fa0
parent 15 fc69e1e37771
child 17 3f227a47ad75
equal deleted inserted replaced
15:fc69e1e37771 16:fe8b59ab9fa0
    30 #include <ctsy/serviceapi/gsmerror.h>
    30 #include <ctsy/serviceapi/gsmerror.h>
    31 
    31 
    32 
    32 
    33 // ======== MEMBER FUNCTIONS ========
    33 // ======== MEMBER FUNCTIONS ========
    34 
    34 
    35 CMmPhoneBookStoreTsy::CMmPhoneBookStoreTsy()
    35 CMmPhoneBookStoreTsy::CMmPhoneBookStoreTsy():
       
    36     iReqHandleType(EMultimodePhoneBookStoreReqHandleUnknown)
    36     {
    37     {
    37     }
    38     }
    38 
    39 
    39 void CMmPhoneBookStoreTsy::ConstructL( const TDesC& aName )
    40 void CMmPhoneBookStoreTsy::ConstructL( const TDesC& aName )
    40     {
    41     {
    77 
    78 
    78     // Used entries is zero in the start
    79     // Used entries is zero in the start
    79     iUsedEntries = 0;
    80     iUsedEntries = 0;
    80 
    81 
    81     // Create bootState
    82     // Create bootState
    82     CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState();
    83     CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState();
    83 
    84 
    84     //Create Read Store
    85     //Create Read Store
    85     iReadReqStore = new ( ELeave ) TReadRequestStore();
    86     iReadReqStore = new ( ELeave ) TReadRequestStore();
    86     //Init
    87     //Init
    87     iRetFillBufferedDes = KErrNone;
    88     iRetFillBufferedDes = KErrNone;
   127     {
   128     {
   128 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::~CMmPhoneBookStoreTsy - PB %S", &iPhoneBookName);
   129 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::~CMmPhoneBookStoreTsy - PB %S", &iPhoneBookName);
   129 
   130 
   130     if ( iMmPhoneTsy )
   131     if ( iMmPhoneTsy )
   131         {
   132         {
   132         CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState();
   133         CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState();
   133         
   134         
   134         if ( iMmPhoneTsy->GetCustomTsy() )
   135         if ( iMmPhoneTsy->GetCustomTsy() )
   135             {
   136             {
   136             RMmCustomAPI::TPndCacheStatus fdnCacheStatus = 
   137             RMmCustomAPI::TPndCacheStatus fdnCacheStatus = 
   137             iMmPhoneTsy->GetCustomTsy()->GetPhonebookCacheStatus( KFDNPhoneBook );
   138             iMmPhoneTsy->GetCustomTsy()->GetPhonebookCacheStatus( KFDNPhoneBook );
   485 TFLOGSTRING3("TSY: CMmPhoneBookStoreTsy::ExtFunc IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   486 TFLOGSTRING3("TSY: CMmPhoneBookStoreTsy::ExtFunc IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   486 
   487 
   487     TInt ret = KErrNone;
   488     TInt ret = KErrNone;
   488     TInt trapError = KErrNone;
   489     TInt trapError = KErrNone;
   489 
   490 
   490     // Reset last tsy request type
   491     // Ensure the ReqHandleType is unset.
   491     iReqHandleType = EMultimodePhoneBookStoreReqHandleUnknown;
   492     // This will detect cases where this method indirectly calls itself
       
   493     // (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
       
   494     // Such cases are not supported because iReqHandleType is in the context of this class instance,
       
   495     // not this request, and we don't want the values set by the inner request and the outer request
       
   496     // interfering with each other.
       
   497     __ASSERT_DEBUG(iReqHandleType==EMultimodePhoneBookStoreReqHandleUnknown, User::Invariant());
       
   498 
   492 
   499 
   493     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); );
   500     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); );
   494 
   501 
   495     if ( KErrNone != trapError )
   502     if ( KErrNone != trapError )
   496         {
   503         {
   507 #ifdef REQHANDLE_TIMER
   514 #ifdef REQHANDLE_TIMER
   508         SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
   515         SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
   509 #else
   516 #else
   510         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
   517         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
   511 #endif
   518 #endif
       
   519         // We've finished with this value now. Clear it so it doesn't leak
       
   520         //  up to any other instances of this method down the call stack
       
   521         iReqHandleType = EMultimodePhoneBookStoreReqHandleUnknown;
   512         }
   522         }
   513 
   523 
   514     return KErrNone;
   524     return KErrNone;
   515     }
   525     }
   516 
   526 
  1090            KADNPhoneBook != iPhoneBookType ) )
  1100            KADNPhoneBook != iPhoneBookType ) )
  1091         {
  1101         {
  1092 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName);
  1102 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName);
  1093 
  1103 
  1094 		TInt ret = KErrNone;
  1104 		TInt ret = KErrNone;
  1095 		CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState();
  1105 		CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState();
  1096 		
  1106 		
  1097               if ( !iCacheReady )
  1107               if ( !iCacheReady )
  1098                 {
  1108                 {
  1099                 // Check if SIM is ready, and SMS has been cached already
  1109                 // Check if SIM is ready, and SMS has been cached already
  1100                 if ( ( KADNPhoneBook == iPhoneBookType ) ||
  1110                 if ( ( KADNPhoneBook == iPhoneBookType ) ||
  1162 	CArrayPtrSeg<CPhoneBookStoreEntry>* entryData;
  1172 	CArrayPtrSeg<CPhoneBookStoreEntry>* entryData;
  1163 	aDataPackage->UnPackData(entryData);	
  1173 	aDataPackage->UnPackData(entryData);	
  1164 	CopyLtsyCacheToCtsyCacheL(entryData);
  1174 	CopyLtsyCacheToCtsyCacheL(entryData);
  1165 #endif
  1175 #endif
  1166 	
  1176 	
  1167     CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState();
  1177     CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState();
  1168 
  1178 
  1169     // If cache were successfully generated, update
  1179     // If cache were successfully generated, update
  1170     // the number of used entries
  1180     // the number of used entries
  1171     if ( KErrNone == aResult )
  1181     if ( KErrNone == aResult )
  1172         {
  1182         {
  1762     // - Number to write
  1772     // - Number to write
  1763     // - Email address
  1773     // - Email address
  1764     // - SNE
  1774     // - SNE
  1765     // - ANR/AAS
  1775     // - ANR/AAS
  1766     // - GRP
  1776     // - GRP
       
  1777 
       
  1778 	if ( iWriteEntry != NULL )
       
  1779 		{
       
  1780 		delete iWriteEntry;
       
  1781 		iWriteEntry = NULL;
       
  1782 		}
  1767 
  1783 
  1768     // NOTE: when this entry is created, it is always
  1784     // NOTE: when this entry is created, it is always
  1769     // put on the cache in succesfull case.
  1785     // put on the cache in succesfull case.
  1770     iWriteEntry = new( ELeave )CPhoneBookStoreEntry();
  1786     iWriteEntry = new( ELeave )CPhoneBookStoreEntry();
  1771     iWriteEntry->ConstructL();
  1787     iWriteEntry->ConstructL();
  2117             {
  2133             {
  2118             ReqCompleted( aTsyReqHandle, KErrArgument );
  2134             ReqCompleted( aTsyReqHandle, KErrArgument );
  2119             }
  2135             }
  2120         else
  2136         else
  2121             {
  2137             {
       
  2138 			if ( iDeleteEntry == NULL )
       
  2139 				{
       
  2140 				delete iDeleteEntry;
       
  2141 				iDeleteEntry = NULL;
       
  2142 				}
       
  2143 
  2122             // These are done for updating cache
  2144             // These are done for updating cache
  2123             iDeleteEntry = new ( ELeave ) CPhoneBookStoreEntry;
  2145             iDeleteEntry = new ( ELeave ) CPhoneBookStoreEntry;
  2124             iDeleteEntry->ConstructL();
  2146             iDeleteEntry->ConstructL();
  2125             iDeleteEntry->iLocation = static_cast<TUint16>( *aIndex );
  2147             iDeleteEntry->iLocation = static_cast<TUint16>( *aIndex );
  2126     
  2148