telephonyserverplugins/simatktsy/src/csattimer.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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".
    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 "csattimerTraces.h"
       
    27 #endif
       
    28 
    23 #include "CSatTimer.h"              // Class header
    29 #include "CSatTimer.h"              // Class header
    24 #include "TfLogger.h"               // For TFLOGSTRING
       
    25 #include "CSatNotificationsTsy.h"   // Sat Tsy class
    30 #include "CSatNotificationsTsy.h"   // Sat Tsy class
    26 #include "CSatDataPackage.h"	        // For data packages
    31 #include "CSatDataPackage.h"	        // For data packages
    27 
    32 
    28 
    33 
    29 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
    49         ( 
    54         ( 
    50         CSatNotificationsTsy* aSatNotificationsTsy
    55         CSatNotificationsTsy* aSatNotificationsTsy
    51         )
    56         )
    52     {
    57     {
    53 
    58 
    54     TFLOGSTRING( "CSAT: CSatTimer::ConstructL" );
    59     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_CONSTRUCTL_1,  "CSAT: CSatTimer::ConstructL" );
    55     iSatNotificationsTsy = aSatNotificationsTsy;
    60     iSatNotificationsTsy = aSatNotificationsTsy;
    56     iTimerTable = new ( ELeave ) RArray<TTimer>( KMaxNumberOfParallelTimers );  
    61     iTimerTable = new ( ELeave ) RArray<TTimer>( KMaxNumberOfParallelTimers );  
    57     // Neutral priority, 0
    62     // Neutral priority, 0
    58     iTimer = CHeartbeat::NewL( CActive::EPriorityStandard );
    63     iTimer = CHeartbeat::NewL( CActive::EPriorityStandard );
    59 
    64 
    78 CSatTimer::~CSatTimer
    83 CSatTimer::~CSatTimer
    79         (
    84         (
    80         //None
    85         //None
    81         )
    86         )
    82     {
    87     {
    83     TFLOGSTRING( "CSAT: CSatTimer::~CSatTimer" );
    88     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_DTOR_1,  "CSAT: CSatTimer::~CSatTimer" );
    84     if ( iTimer )
    89     if ( iTimer )
    85         {
    90         {
    86         // Stop calling Beat...
    91         // Stop calling Beat...
    87         iTimer->Cancel();
    92         iTimer->Cancel();
    88         delete iTimer;
    93         delete iTimer;
   104         (
   109         (
   105         TInt aTimerId,      // Timer Id
   110         TInt aTimerId,      // Timer Id
   106         TUint32 aTimerValue // Timer value
   111         TUint32 aTimerValue // Timer value
   107         )
   112         )
   108     {
   113     {
   109     TFLOGSTRING( "CSAT: CSatTimer::Start" );
   114     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_START_1,  "CSAT: CSatTimer::Start" );
   110     TInt ret( KErrNone );
   115     TInt ret( KErrNone );
   111 
   116 
   112      // Check if the entry is already in the table 
   117      // Check if the entry is already in the table 
   113     if ( CheckTimerTable( aTimerId ) )
   118     if ( CheckTimerTable( aTimerId ) )
   114         {
   119         {
   144 void CSatTimer::Stop
   149 void CSatTimer::Stop
   145         (
   150         (
   146         //None
   151         //None
   147         )
   152         )
   148     {
   153     {
   149     TFLOGSTRING( "CSAT: CSatTimer::Stop" );
   154     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_STOP_1,  "CSAT: CSatTimer::Stop" );
   150     // Check if active 
   155     // Check if active 
   151     if ( iTimer->IsActive () ) 
   156     if ( iTimer->IsActive () ) 
   152         { 
   157         { 
   153         // Cancel beat method calling 
   158         // Cancel beat method calling 
   154         iTimer->Cancel(); 
   159         iTimer->Cancel(); 
   186 					);
   191 					);
   187 					
   192 					
   188                 if ( trapError )
   193                 if ( trapError )
   189 					{
   194 					{
   190 					ret = trapError;
   195 					ret = trapError;
   191 					TFLOGSTRING2("CSAT: CSatTimer::Beat, Trap error: %d", 
   196 					OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_BEAT_1, "CSAT: CSatTimer::Beat, Trap error: %d", trapError);
   192 						trapError);
       
   193 					}
   197 					}
   194 					
   198 					
   195                 // Remove timer from the table
   199                 // Remove timer from the table
   196                 if ( KErrNone == ret )
   200                 if ( KErrNone == ret )
   197                     {
   201                     {
   215 void CSatTimer::Synchronize
   219 void CSatTimer::Synchronize
   216         (
   220         (
   217         // None
   221         // None
   218         )
   222         )
   219     {
   223     {
   220     TFLOGSTRING( "CSAT: CSatTimer::Synchronize" );
   224     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_SYNCHRONIZE_1,  "CSAT: CSatTimer::Synchronize" );
   221     iBeatCounter++;
   225     iBeatCounter++;
   222     }
   226     }
   223 
   227 
   224 // -----------------------------------------------------------------------------
   228 // -----------------------------------------------------------------------------
   225 // CSatTimer::CheckTimerTable
   229 // CSatTimer::CheckTimerTable
   230         (
   234         (
   231         TInt aTimerId
   235         TInt aTimerId
   232         )
   236         )
   233     {
   237     {
   234     
   238     
   235     TFLOGSTRING( "CSAT: CSatTimer::CheckTimerTable" );
   239     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_CHECKTIMERTABLE_1,  "CSAT: CSatTimer::CheckTimerTable" );
   236     TBool ret( EFalse );
   240     TBool ret( EFalse );
   237 
   241 
   238     // Create the entry with meaningful values only
   242     // Create the entry with meaningful values only
   239     TTimer timer( aTimerId, 0, 0 );
   243     TTimer timer( aTimerId, 0, 0 );
   240 
   244 
   260         (
   264         (
   261         TInt aTimerId // Timer identifier
   265         TInt aTimerId // Timer identifier
   262         )
   266         )
   263     { 
   267     { 
   264     
   268     
   265     TFLOGSTRING( "CSAT: CSatTimer::DeleteTimerById" );
   269     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_DELETETIMERBYID_1,  "CSAT: CSatTimer::DeleteTimerById" );
   266     TInt ret( KErrNotFound );
   270     TInt ret( KErrNotFound );
   267 
   271 
   268     // Create the entry with meaningful values only
   272     // Create the entry with meaningful values only
   269     TTimer timer( aTimerId, 0, 0 );
   273     TTimer timer( aTimerId, 0, 0 );
   270 
   274 
   298 TUint32 CSatTimer::CurrentValueOfTimerById
   302 TUint32 CSatTimer::CurrentValueOfTimerById
   299         (
   303         (
   300         TInt aTimerId // Timer identifier
   304         TInt aTimerId // Timer identifier
   301         )
   305         )
   302     { 
   306     { 
   303     TFLOGSTRING( "CSAT: CSatTimer::CurrentValueOfTimerById" );
   307     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_CURRENTVALUEOFTIMERBYID_1,  "CSAT: CSatTimer::CurrentValueOfTimerById" );
   304     TInt ret( KErrNotFound );
   308     TInt ret( KErrNotFound );
   305 
   309 
   306     // Create the entry with meaningful values only
   310     // Create the entry with meaningful values only
   307     TTimer timer( aTimerId, 0, 0 );
   311     TTimer timer( aTimerId, 0, 0 );
   308 
   312 
   342 void CSatTimer::SetProactiveCommandOnGoingStatus
   346 void CSatTimer::SetProactiveCommandOnGoingStatus
   343         ( 
   347         ( 
   344         TBool aStatus 
   348         TBool aStatus 
   345         )
   349         )
   346     {
   350     {
   347     TFLOGSTRING( "CSAT: CSatTimer::SetProactiveCommandOnGoingStatus" );
   351     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_SETPROACTIVECOMMANDONGOINGSTATUS_1,  "CSAT: CSatTimer::SetProactiveCommandOnGoingStatus" );
   348     iIsProactiveCommandOnGoing = aStatus;
   352     iIsProactiveCommandOnGoing = aStatus;
   349     }
   353     }
   350 
   354 
   351 // -----------------------------------------------------------------------------
   355 // -----------------------------------------------------------------------------
   352 // CSatTimer::TTimer
   356 // CSatTimer::TTimer
   359         TUint32 aStartTime,  // Timer start time
   363         TUint32 aStartTime,  // Timer start time
   360         TUint32 aTimeStamp   // Time stamp
   364         TUint32 aTimeStamp   // Time stamp
   361         ): iTimerId( aTimerId ), iStartTime( aStartTime ), 
   365         ): iTimerId( aTimerId ), iStartTime( aStartTime ), 
   362            iTimeStamp( aTimeStamp )
   366            iTimeStamp( aTimeStamp )
   363     {
   367     {
   364     TFLOGSTRING( "CSAT: TTimer::TTimer" );
   368     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_TTIMER_1,  "CSAT: TTimer::TTimer" );
   365     }
   369     }
   366 
   370 
   367 // -----------------------------------------------------------------------------
   371 // -----------------------------------------------------------------------------
   368 // CSatTimer::TimeStamp
   372 // CSatTimer::TimeStamp
   369 // Gets the value of iTimeStamp
   373 // Gets the value of iTimeStamp
   372 TUint32 CSatTimer::TTimer::TimeStamp
   376 TUint32 CSatTimer::TTimer::TimeStamp
   373         (
   377         (
   374         // None
   378         // None
   375         )
   379         )
   376     {
   380     {
   377     TFLOGSTRING( "CSAT: TTimer::TimeStamp" );
   381     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_TIMESTAMP_1,  "CSAT: TTimer::TimeStamp" );
   378     return iTimeStamp;
   382     return iTimeStamp;
   379     }
   383     }
   380 
   384 
   381 // -----------------------------------------------------------------------------
   385 // -----------------------------------------------------------------------------
   382 // CSatTimer::TimerId
   386 // CSatTimer::TimerId
   386 TInt CSatTimer::TTimer::TimerId
   390 TInt CSatTimer::TTimer::TimerId
   387         (
   391         (
   388         // None
   392         // None
   389         )
   393         )
   390     {
   394     {
   391     TFLOGSTRING( "CSAT: TTimer::TimerId" );
   395     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_TIMERID_1,  "CSAT: TTimer::TimerId" );
   392     return iTimerId;
   396     return iTimerId;
   393     }
   397     }
   394 
   398 
   395 // -----------------------------------------------------------------------------
   399 // -----------------------------------------------------------------------------
   396 // CSatTimer::TimerStartTime
   400 // CSatTimer::TimerStartTime
   400 TUint32 CSatTimer::TTimer::TimerStartTime
   404 TUint32 CSatTimer::TTimer::TimerStartTime
   401         (
   405         (
   402         // None
   406         // None
   403         )
   407         )
   404     {
   408     {
   405     TFLOGSTRING( "CSAT: TTimer::TimerStartTime" );
   409     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_TIMERSTARTTIME_1,  "CSAT: TTimer::TimerStartTime" );
   406     return iStartTime;
   410     return iStartTime;
   407     }
   411     }
   408 
   412 
   409 // -----------------------------------------------------------------------------
   413 // -----------------------------------------------------------------------------
   410 // CSatTimer::CompareEntries
   414 // CSatTimer::CompareEntries
   415         (
   419         (
   416         const CSatTimer::TTimer& aArg1, 
   420         const CSatTimer::TTimer& aArg1, 
   417         const CSatTimer::TTimer& aArg2 
   421         const CSatTimer::TTimer& aArg2 
   418         )
   422         )
   419     {
   423     {
   420     TFLOGSTRING( "CSAT: CSatTimer::TTimer::CompareEntries" );
   424     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_COMPAREENTRIES_1,  "CSAT: CSatTimer::TTimer::CompareEntries" );
   421     TBool ret( EFalse ); 
   425     TBool ret( EFalse ); 
   422 
   426 
   423     // We are interested only in the timer id
   427     // We are interested only in the timer id
   424     if ( aArg1.iTimerId == aArg2.iTimerId )
   428     if ( aArg1.iTimerId == aArg2.iTimerId )
   425         {
   429         {
   426         ret =  ETrue;
   430         ret =  ETrue;
   427         }
   431         }
   428     else
   432     else
   429         {
   433         {
   430         TFLOGSTRING( "CSAT: CSatTimer::TTimer::CompareEntries, Not equal" );
   434         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_COMPAREENTRIES_2,  "CSAT: CSatTimer::TTimer::CompareEntries, Not equal" );
   431         }
   435         }
   432     return ret;
   436     return ret;
   433     }
   437     }
   434 
   438 
   435 // -----------------------------------------------------------------------------
   439 // -----------------------------------------------------------------------------
   441         (
   445         (
   442         const CSatTimer::TTimer& aArg1, 
   446         const CSatTimer::TTimer& aArg1, 
   443         const CSatTimer::TTimer& aArg2  
   447         const CSatTimer::TTimer& aArg2  
   444         ) 
   448         ) 
   445     {
   449     {
   446     TFLOGSTRING( "CSAT: CSatTimer::TTimer::OrderEntries" );
   450     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_ORDERENTRIES_1,  "CSAT: CSatTimer::TTimer::OrderEntries" );
   447     TInt ret( KFirstTimeStampSmaller );
   451     TInt ret( KFirstTimeStampSmaller );
   448 
   452 
   449     // We are interested only in the time stamp
   453     // We are interested only in the time stamp
   450     if ( aArg1.iTimeStamp == aArg2.iTimeStamp )
   454     if ( aArg1.iTimeStamp == aArg2.iTimeStamp )
   451         {
   455         {
   455         {
   459         {
   456         ret = KFirstTimeStampBigger;
   460         ret = KFirstTimeStampBigger;
   457         }
   461         }
   458     else
   462     else
   459         {
   463         {
   460         TFLOGSTRING( "CSAT: CSatTimer::TTimer::OrderEntries, \
   464         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATTIMER_TTIMER_ORDERENTRIES_2,  "CSAT: CSatTimer::TTimer::OrderEntries, KFirstTimeStampSmaller" );
   461             KFirstTimeStampSmaller" );
       
   462         }
   465         }
   463 
   466 
   464     return ret;
   467     return ret;
   465     }
   468     }
   466 
   469