telephonyserverplugins/common_tsy/commontsy/src/mmutility/cmmtsyreqhandlestore.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 17 3f227a47ad75
child 66 07a122eea281
child 69 b982c3e940f3
equal deleted inserted replaced
61:17af172ffa5f 65: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 "cmmtsyreqhandlestoreTraces.h"
       
    23 #endif
       
    24 
    19 #include <e32std.h>
    25 #include <e32std.h>
    20 #include "cmmtsyreqhandlestore.h"
    26 #include "cmmtsyreqhandlestore.h"
    21 #include "cmmphonetsy.h"
    27 #include "cmmphonetsy.h"
    22 #include "CResponseTimerStore.h"
    28 #include "CResponseTimerStore.h"
    23 
    29 
    39 
    45 
    40 CMmTsyReqHandleStore* CMmTsyReqHandleStore::NewL(
    46 CMmTsyReqHandleStore* CMmTsyReqHandleStore::NewL(
    41     TInt aNumberOfRequests, //number of requests
    47     TInt aNumberOfRequests, //number of requests
    42     TTsyReqHandle* aFirstElement ) //pointer to the first element
    48     TTsyReqHandle* aFirstElement ) //pointer to the first element
    43     {
    49     {
    44     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=%x",aNumberOfRequests,aFirstElement);
    50     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_NEWL_1, "TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=0x%08x",aNumberOfRequests, (TUint)aFirstElement);
    45     
    51     
    46     CMmTsyReqHandleStore* tsyReqHandleStore 
    52     CMmTsyReqHandleStore* tsyReqHandleStore 
    47             = new ( ELeave ) CMmTsyReqHandleStore();
    53             = new ( ELeave ) CMmTsyReqHandleStore();
    48  
    54  
    49     CleanupStack::PushL( tsyReqHandleStore );
    55     CleanupStack::PushL( tsyReqHandleStore );
    54     //check that array is really initialised and reset it at the same time
    60     //check that array is really initialised and reset it at the same time
    55     for( TInt i = 0; i < aNumberOfRequests; i++ )
    61     for( TInt i = 0; i < aNumberOfRequests; i++ )
    56         *( tsyReqHandleStore->iReqHandles + i ) = 0;
    62         *( tsyReqHandleStore->iReqHandles + i ) = 0;
    57 
    63 
    58     CleanupStack::Pop();
    64     CleanupStack::Pop();
    59     TFLOGSTRING2("TSY:CMmTsyReqHandleStore::NewL returns tsyReqHandleStore=%x",tsyReqHandleStore);
    65     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_NEWL_2, "TSY:CMmTsyReqHandleStore::NewL returns tsyReqHandleStore=0x%08x", (TUint)tsyReqHandleStore);
    60     return tsyReqHandleStore;
    66     return tsyReqHandleStore;
    61     }
    67     }
    62 
    68 
    63 #ifdef REQHANDLE_TIMER
    69 #ifdef REQHANDLE_TIMER
    64 
    70 
    66     CTelObject * aCTelObject, 
    72     CTelObject * aCTelObject, 
    67     CMmPhoneTsy *aPhone, 
    73     CMmPhoneTsy *aPhone, 
    68     TInt aNumberOfRequests, 
    74     TInt aNumberOfRequests, 
    69     TTsyReqHandle* aFirstElement ) 
    75     TTsyReqHandle* aFirstElement ) 
    70     {
    76     {
    71     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aCTelObject=%x aPhone=%x",aCTelObject,aPhone);
    77     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_NEWL1_1, "TSY:CMmTsyReqHandleStore::NewL aCTelObject=0x%08x aPhone=0x%08x",(TUint)aCTelObject, (TUint)aPhone);
    72     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=%x",aNumberOfRequests,aFirstElement);
    78     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_NEWL1_2, "TSY:CMmTsyReqHandleStore::NewL aNumberOfRequests=%d aFirstElement=0x%08x",aNumberOfRequests,(TUint)aFirstElement);
    73     CMmTsyReqHandleStore* tsyReqHandleStore 
    79     CMmTsyReqHandleStore* tsyReqHandleStore 
    74             = new ( ELeave ) CMmTsyReqHandleStore();
    80             = new ( ELeave ) CMmTsyReqHandleStore();
    75     
    81     
    76     CleanupStack::PushL( tsyReqHandleStore );
    82     CleanupStack::PushL( tsyReqHandleStore );
    77 
    83 
    97 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
    98 //
   104 //
    99 TTsyReqHandle CMmTsyReqHandleStore::GetTsyReqHandle(
   105 TTsyReqHandle CMmTsyReqHandleStore::GetTsyReqHandle(
   100     const TInt aIndex )
   106     const TInt aIndex )
   101     {
   107     {
   102     TFLOGSTRING2("TSY:CMmTsyReqHandleStore::GetTsyReqHandle aIndex=%d", aIndex);
   108     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_GETTSYREQHANDLE_1, "TSY:CMmTsyReqHandleStore::GetTsyReqHandle aIndex=%d", aIndex);
   103     TTsyReqHandle ret( NULL );
   109     TTsyReqHandle ret( NULL );
   104 
   110 
   105     //check the bounds
   111     //check the bounds
   106     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   112     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   107         {
   113         {
   119 //
   125 //
   120 void CMmTsyReqHandleStore::SetTsyReqHandle(    
   126 void CMmTsyReqHandleStore::SetTsyReqHandle(    
   121     const TInt aIndex, 
   127     const TInt aIndex, 
   122     const TTsyReqHandle aTsyReqHandle ) 
   128     const TTsyReqHandle aTsyReqHandle ) 
   123     {
   129     {
   124     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d aTsyReqHandle=%d ", aIndex, aTsyReqHandle);
   130     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_SETTSYREQHANDLE_1, "TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d aTsyReqHandle=0x%08x", aIndex, (TUint)aTsyReqHandle);
   125     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   131     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   126         {
   132         {
   127         *( iReqHandles + aIndex ) = aTsyReqHandle;
   133         *( iReqHandles + aIndex ) = aTsyReqHandle;
   128         }
   134         }
   129 
   135 
   142     const TInt aIndex, 
   148     const TInt aIndex, 
   143     const TTsyReqHandle aTsyReqHandle, 
   149     const TTsyReqHandle aTsyReqHandle, 
   144     TInt aTimeout, 
   150     TInt aTimeout, 
   145     TInt aIPC ) 
   151     TInt aIPC ) 
   146     {
   152     {
   147     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d, aTsyReqHandle=%d",aIndex,aTsyReqHandle);
   153     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_SETTSYREQHANDLE1_1, "TSY:CMmTsyReqHandleStore::SetTsyReqHandle aIndex=%d, aTsyReqHandle=0x%08x",aIndex,(TUint)aTsyReqHandle);
   148     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::SetTsyReqHandle aTimeout=%d  IPC=%d", aTimeout, aIPC);
   154     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_SETTSYREQHANDLE1_2, "TSY:CMmTsyReqHandleStore::SetTsyReqHandle aTimeout=%d  IPC=%d", aTimeout, aIPC);
   149     
   155     
   150     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   156     if ( aIndex >= 0 && aIndex < iNumOfRequests )
   151         {
   157         {
   152         *( iReqHandles + aIndex ) = aTsyReqHandle;
   158         *( iReqHandles + aIndex ) = aTsyReqHandle;
   153 
   159 
   159         iPhone->GetTimeStampStore()->AddTimeEntry( aIndex, 
   165         iPhone->GetTimeStampStore()->AddTimeEntry( aIndex, 
   160                                                    this,
   166                                                    this,
   161                                                    iCTelObject,
   167                                                    iCTelObject,
   162                                                    aTimeout,
   168                                                    aTimeout,
   163                                                    aIPC );
   169                                                    aIPC );
       
   170      
   164         }
   171         }
   165     }
   172     }
   166 
   173 
   167 #endif
   174 #endif
   168 
   175 
   175 // ---------------------------------------------------------------------------
   182 // ---------------------------------------------------------------------------
   176 //
   183 //
   177 TTsyReqHandle CMmTsyReqHandleStore::ResetTsyReqHandle(    
   184 TTsyReqHandle CMmTsyReqHandleStore::ResetTsyReqHandle(    
   178     const TInt aIndex ) 
   185     const TInt aIndex ) 
   179 {
   186 {
   180 TFLOGSTRING2("TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d", aIndex);
   187 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_RESETTSYREQHANDLE_1, "TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d", aIndex);
   181     //req handle was not used.
   188     //req handle was not used.
   182     TInt ret = 0;
   189     TInt ret = 0;
   183 
   190 
   184 #ifdef REQHANDLE_TIMER
   191 #ifdef REQHANDLE_TIMER
   185 
   192 
   207         //reset req handle
   214         //reset req handle
   208         *( iReqHandles + aIndex ) = 0;
   215         *( iReqHandles + aIndex ) = 0;
   209     
   216     
   210         }
   217         }
   211     }
   218     }
   212 TFLOGSTRING3("TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d, ret=%d", aIndex, ret);
   219     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_RESETTSYREQHANDLE_2, "TSY:CMmTsyReqHandleStore::ResetTsyReqHandle aIndex=%d, ret=%d", aIndex, ret);
   213     return ret;
   220     return ret;
   214 }
   221 }
   215 
   222 
   216 #ifdef REQHANDLE_TIMER
   223 #ifdef REQHANDLE_TIMER
   217 
   224 
   223 //
   230 //
   224 void CMmTsyReqHandleStore::PostponeTimeout(
   231 void CMmTsyReqHandleStore::PostponeTimeout(
   225     const TInt aHandle, 
   232     const TInt aHandle, 
   226     const TInt aTimeout ) 
   233     const TInt aTimeout ) 
   227     {
   234     {
   228     TFLOGSTRING3("TSY:CMmTsyReqHandleStore::PostponeTimeout aHandle=%d, aTimeout=%d",aHandle,aTimeout);
   235     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_POSTPONETIMEOUT_1, "TSY:CMmTsyReqHandleStore::PostponeTimeout aHandle=%d, aTimeout=%d",aHandle,aTimeout);
   229     // call ResetEntryTimeout 
   236     // call ResetEntryTimeout 
   230     iPhone->GetTimeStampStore()->ResetEntryTimeout( aHandle,
   237     iPhone->GetTimeStampStore()->ResetEntryTimeout( aHandle,
   231                                                     this,
   238                                                     this,
   232                                                     iCTelObject,
   239                                                     iCTelObject,
   233                                                     aTimeout );
   240                                                     aTimeout );
   241 // ---------------------------------------------------------------------------
   248 // ---------------------------------------------------------------------------
   242 //
   249 //
   243 void CMmTsyReqHandleStore::StopTimeout(
   250 void CMmTsyReqHandleStore::StopTimeout(
   244     const TInt aHandle ) 
   251     const TInt aHandle ) 
   245     {
   252     {
   246     TFLOGSTRING2("TSY:CMmTsyReqHandleStore::StopTimeout aHandle=%d",aHandle);
   253     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYREQHANDLESTORE_STOPTIMEOUT_1, "TSY:CMmTsyReqHandleStore::StopTimeout aHandle=%d",aHandle);
   247     iPhone->GetTimeStampStore()->DeleteEntryByHandle( aHandle, this );
   254     iPhone->GetTimeStampStore()->DeleteEntryByHandle( aHandle, this );
   248     }
   255     }
   249 
   256 
   250 #endif
   257 #endif
   251 
   258