telephonyserverplugins/simatktsy/src/CSatTsyReqHandleStore.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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".
    18 //
    18 //
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  INCLUDE FILES
    22 //  INCLUDE FILES
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "CSatTsyReqHandleStoreTraces.h"
       
    27 #endif
       
    28 
       
    29 #include "CSatTsyReqHandleStore.h"  // Class header
    23 #include "CSatTsyReqHandleStore.h"  // Class header
    30 #include "CSatTsy.h"                // Main tsy class header
    24 #include "CSatTsy.h"                // Main tsy class header
       
    25 #include "TfLogger.h"               // For TFLOGSTRING
    31 
    26 
    32 // -----------------------------------------------------------------------------
    27 // -----------------------------------------------------------------------------
    33 // CSatTsyReqHandleStore::NewL
    28 // CSatTsyReqHandleStore::NewL
    34 // This method is used to create a new instance of CSatTsyReqHandleStore. 
    29 // This method is used to create a new instance of CSatTsyReqHandleStore. 
    35 // Because the constructor of CSatTsyReqHandleStore class is private, calling 
    30 // Because the constructor of CSatTsyReqHandleStore class is private, calling 
    40         (
    35         (
    41         TInt aNumberOfRequests,      // Number of requests
    36         TInt aNumberOfRequests,      // Number of requests
    42         TTsyReqHandle* aFirstElement // Pointer to the first element
    37         TTsyReqHandle* aFirstElement // Pointer to the first element
    43         )
    38         )
    44     {
    39     {
    45     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_NEWL_1,  "CSAT: CSatTsyReqHandleStore::NewL" );
    40     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::NewL" );
    46     CSatTsyReqHandleStore* tsyReqHandleStore = new ( ELeave ) 
    41     CSatTsyReqHandleStore* tsyReqHandleStore = new ( ELeave ) 
    47         CSatTsyReqHandleStore();
    42         CSatTsyReqHandleStore();
    48  
    43  
    49     CleanupStack::PushL( tsyReqHandleStore );
    44     CleanupStack::PushL( tsyReqHandleStore );
    50     tsyReqHandleStore->iNumOfRequests = aNumberOfRequests;   
    45     tsyReqHandleStore->iNumOfRequests = aNumberOfRequests;   
    55         {
    50         {
    56         *( tsyReqHandleStore->iReqHandles + i ) = 0;
    51         *( tsyReqHandleStore->iReqHandles + i ) = 0;
    57         }
    52         }
    58 
    53 
    59     CleanupStack::Pop( tsyReqHandleStore );
    54     CleanupStack::Pop( tsyReqHandleStore );
    60     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_NEWL_2,  "CSAT: CSatTsyReqHandleStore::NewL, end of method" );
    55     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::NewL, end of method" );
    61     return tsyReqHandleStore;
    56     return tsyReqHandleStore;
    62     }
    57     }
    63 
    58 
    64 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
    65 // CSatTsyReqHandleStore::~CSatTsyReqHandleStore
    60 // CSatTsyReqHandleStore::~CSatTsyReqHandleStore
    70 CSatTsyReqHandleStore::~CSatTsyReqHandleStore
    65 CSatTsyReqHandleStore::~CSatTsyReqHandleStore
    71         (
    66         (
    72         // None
    67         // None
    73         )
    68         )
    74     {
    69     {
    75     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_DTOR_1,  "CSAT: CSatTsyReqHandleStore::~CSatTsyReqHandleStore" );
    70     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::~CSatTsyReqHandleStore" );
    76     }
    71     }
    77 
    72 
    78 // -----------------------------------------------------------------------------
    73 // -----------------------------------------------------------------------------
    79 // CSatTsyReqHandleStore::CSatTsyReqHandleStore
    74 // CSatTsyReqHandleStore::CSatTsyReqHandleStore
    80 // Constructor
    75 // Constructor
    83 CSatTsyReqHandleStore::CSatTsyReqHandleStore
    78 CSatTsyReqHandleStore::CSatTsyReqHandleStore
    84         (
    79         (
    85         // None
    80         // None
    86         )
    81         )
    87     {
    82     {
    88     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_CTOR_1,  "CSAT: CSatTsyReqHandleStore::CSatTsyReqHandleStore" );
    83     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::CSatTsyReqHandleStore" );
    89     }
    84     }
    90 
    85 
    91 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    92 // CSatTsyReqHandleStore::ConstructL
    87 // CSatTsyReqHandleStore::ConstructL
    93 // Symbian 2nd phase constructor. 
    88 // Symbian 2nd phase constructor. 
    96 void CSatTsyReqHandleStore::ConstructL
    91 void CSatTsyReqHandleStore::ConstructL
    97         ( 
    92         ( 
    98         // None
    93         // None
    99         )
    94         )
   100     {
    95     {
   101     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_CONSTRUCTL_1,  "CSAT: CSatTsyReqHandleStore::ConstructL" );
    96     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::ConstructL" );
   102     }
    97     }
   103 
    98 
   104 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
   105 // CSatTsyReqHandleStore::TsyReqHandle
   100 // CSatTsyReqHandleStore::TsyReqHandle
   106 // Returns TSY request handle for given index.
   101 // Returns TSY request handle for given index.
   109 TTsyReqHandle CSatTsyReqHandleStore::TsyReqHandle
   104 TTsyReqHandle CSatTsyReqHandleStore::TsyReqHandle
   110         (
   105         (
   111         const TInt aIndex  // TSY req handle index
   106         const TInt aIndex  // TSY req handle index
   112         )
   107         )
   113     {
   108     {
   114     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_TSYREQHANDLE_1,  "CSAT: CSatTsyReqHandleStore::TsyReqHandle" );
   109     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::TsyReqHandle" );
   115     TTsyReqHandle ret( NULL );
   110     TTsyReqHandle ret( NULL );
   116 
   111 
   117     // Check the bounds
   112     // Check the bounds
   118     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   113     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   119         {
   114         {
   120         ret = *( iReqHandles + aIndex );
   115         ret = *( iReqHandles + aIndex );
   121         }
   116         }
   122     else
   117     else
   123         {
   118         {
   124         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_TSYREQHANDLE_2,  "CSAT: CSatTsyReqHandleStore::TsyReqHandle, Out of bounds" );
   119         TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::TsyReqHandle, \
       
   120             Out of bounds" );
   125         }
   121         }
   126     return ret;
   122     return ret;
   127     }
   123     }
   128 
   124 
   129 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   135         (    
   131         (    
   136         const TInt            aIndex,         // Index
   132         const TInt            aIndex,         // Index
   137         const TTsyReqHandle   aTsyReqHandle   // Request handle
   133         const TTsyReqHandle   aTsyReqHandle   // Request handle
   138         )
   134         )
   139     {
   135     {
   140     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_1,  "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle" );
   136     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle" );
   141     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   137     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   142         {
   138         {
   143         *( iReqHandles + aIndex ) = aTsyReqHandle;
   139         *( iReqHandles + aIndex ) = aTsyReqHandle;
   144         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_2,  "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, %d saved", aTsyReqHandle );
   140         TFLOGSTRING2( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, %d saved", 
       
   141             aTsyReqHandle );
   145         }
   142         }
   146     else
   143     else
   147         {
   144         {
   148         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_SETTSYREQHANDLE_3,  "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle, Request handle not saved" );
   145         TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::SetTsyReqHandle,\
       
   146             Request handle not saved" );
   149         }
   147         }
   150     }
   148     }
   151 
   149 
   152 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   153 // CSatTsyReqHandleStore::ResetTsyReqHandle
   151 // CSatTsyReqHandleStore::ResetTsyReqHandle
   160         (    
   158         (    
   161         const TInt aIndex   // Index
   159         const TInt aIndex   // Index
   162         )
   160         )
   163     {
   161     {
   164 
   162 
   165     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_1,  "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle" );
   163     TFLOGSTRING( "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle" );
   166     // Req handle was not used.
   164     // Req handle was not used.
   167     TInt ret = 0;
   165     TInt ret = 0;
   168 
   166 
   169     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   167     if ( ( aIndex >= 0 ) && ( aIndex < iNumOfRequests ) )
   170         {
   168         {
   174             // Return deleted req handle
   172             // Return deleted req handle
   175             ret = *( iReqHandles + aIndex );
   173             ret = *( iReqHandles + aIndex );
   176 
   174 
   177             // Reset req handle
   175             // Reset req handle
   178             *( iReqHandles + aIndex ) = 0;
   176             *( iReqHandles + aIndex ) = 0;
   179             OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_2,  "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, index %d removed", aIndex );
   177             TFLOGSTRING2( "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, index \
       
   178             	%d removed", aIndex );
   180             }
   179             }
   181         else
   180         else
   182             {
   181             {
   183             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_3, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle, Not in use");
   182             TFLOGSTRING("CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle,\
       
   183                 Not in use");
   184             }
   184             }
   185         }
   185         }
   186     else
   186     else
   187         {
   187         {
   188         // Do nothing    
   188         // Do nothing    
   189         }
   189         }
   190             
   190             
   191 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTSYREQHANDLESTORE_RESETTSYREQHANDLE_4, "CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle reqHandle is :%d", ret );
   191 	TFLOGSTRING2("CSAT: CSatTsyReqHandleStore::ResetTsyReqHandle \
       
   192 	    reqHandle is :%d", ret ); 
   192 		
   193 		
   193     return ret;
   194     return ret;
   194     }
   195     }
   195 
   196 
   196 //  End of File 
   197 //  End of File