phoneapp/phoneuiutils/src/cphonetimer.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 15 2a26698d78ba
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include "cphonetimer.h"
    21 #include "cphonetimer.h"
    22 #include "phoneui.pan"
    22 #include "phoneui.pan"
       
    23 #include "phonelogger.h"
    23 
    24 
    24 // ================= MEMBER FUNCTIONS =======================
    25 // ================= MEMBER FUNCTIONS =======================
    25 
    26 
    26 // ---------------------------------------------------------
    27 // ---------------------------------------------------------
    27 // CPhoneTimer::CPhoneTimer
    28 // CPhoneTimer::CPhoneTimer
    28 // ---------------------------------------------------------
    29 // ---------------------------------------------------------
    29 //
    30 //
    30 CPhoneTimer::CPhoneTimer( TInt aPriority ) :
    31 CPhoneTimer::CPhoneTimer( TInt aPriority ) :
    31     CTimer( aPriority)
    32     CTimer( aPriority)
    32     {
    33     {
       
    34     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::CPhoneTimer() ");
    33     CActiveScheduler::Add( this );
    35     CActiveScheduler::Add( this );
    34     }
    36     }
    35 
    37 
    36 // ---------------------------------------------------------
    38 // ---------------------------------------------------------
    37 // CPhoneTimer::ConstructL
    39 // CPhoneTimer::ConstructL
    38 // ---------------------------------------------------------
    40 // ---------------------------------------------------------
    39 //
    41 //
    40 void CPhoneTimer::ConstructL()
    42 void CPhoneTimer::ConstructL()
    41     {
    43     {
       
    44     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::ConstructL() ");
    42     CTimer::ConstructL();
    45     CTimer::ConstructL();
    43     }
    46     }
    44 
    47 
    45 // ---------------------------------------------------------
    48 // ---------------------------------------------------------
    46 // CPhoneTimer::NewL
    49 // CPhoneTimer::NewL
    47 // ---------------------------------------------------------
    50 // ---------------------------------------------------------
    48 //
    51 //
    49 EXPORT_C CPhoneTimer* CPhoneTimer::NewL( TInt aPriority )
    52 EXPORT_C CPhoneTimer* CPhoneTimer::NewL( TInt aPriority )
    50     {
    53     {
       
    54     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::NewL() ");
    51     CPhoneTimer* self = new (ELeave) CPhoneTimer( aPriority );
    55     CPhoneTimer* self = new (ELeave) CPhoneTimer( aPriority );
    52     
    56     
    53     CleanupStack::PushL( self );
    57     CleanupStack::PushL( self );
    54     self->ConstructL();
    58     self->ConstructL();
    55     CleanupStack::Pop( self );
    59     CleanupStack::Pop( self );
    61 // CPhoneTimer::~CPhoneTimer
    65 // CPhoneTimer::~CPhoneTimer
    62 // ---------------------------------------------------------
    66 // ---------------------------------------------------------
    63 //
    67 //
    64 EXPORT_C CPhoneTimer::~CPhoneTimer()
    68 EXPORT_C CPhoneTimer::~CPhoneTimer()
    65     {
    69     {
       
    70     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::~CPhoneTimer() ");
    66     Cancel();    
    71     Cancel();    
    67     }
    72     }
    68 
    73 
    69 // ---------------------------------------------------------
    74 // ---------------------------------------------------------
    70 // CPhoneTimer::RunL()
    75 // CPhoneTimer::RunL()
    71 // ---------------------------------------------------------
    76 // ---------------------------------------------------------
    72 //
    77 //
    73 void CPhoneTimer::RunL()
    78 void CPhoneTimer::RunL()
    74     {
    79     {
       
    80     __PHONELOG1( EBasic, EPhoneUIUtils, 
       
    81         "CPhoneTimer::RunL iStatus(%d)", 
       
    82         iStatus.Int() );
       
    83     
    75     if ( iStatus != KErrNone )
    84     if ( iStatus != KErrNone )
    76         {
    85         {
    77         //error code is ignored, as CPeriodic. 
    86         //error code is ignored, as CPeriodic. 
    78         return;
    87         return;
    79         }
    88         }
    80    
    89    
    81     if ( !iTimerObserver )
    90     if ( !iTimerObserver )
    82         {
    91         {
       
    92         __PHONELOG( EBasic, EPhoneUIUtils, 
       
    93             "CPhoneTimer::RunL CallBack" );
    83         iCallBack.CallBack();
    94         iCallBack.CallBack();
    84         }
    95         }
    85     else
    96     else
    86         {
    97         {
       
    98         __PHONELOG( EBasic, EPhoneUIUtils, 
       
    99             "CPhoneTimer::RunL HandleTimeOutL" );
    87         iTimerObserver->HandleTimeOutL();
   100         iTimerObserver->HandleTimeOutL();
    88         }
   101         }
    89     }
   102     }
    90 
   103 
    91 // ---------------------------------------------------------
   104 // ---------------------------------------------------------
    94 //
   107 //
    95 EXPORT_C void CPhoneTimer::After( 
   108 EXPORT_C void CPhoneTimer::After( 
    96     TTimeIntervalMicroSeconds32 anInterval, 
   109     TTimeIntervalMicroSeconds32 anInterval, 
    97     TCallBack aCallBack )
   110     TCallBack aCallBack )
    98     {
   111     {
       
   112     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::After() ");
    99     
   113     
   100     if ( IsActive() )
   114     if ( IsActive() )
   101         {
   115         {
   102         Cancel();
   116         Cancel();
   103         }
   117         }
   113 
   127 
   114 EXPORT_C void CPhoneTimer::After( 
   128 EXPORT_C void CPhoneTimer::After( 
   115     TTimeIntervalMicroSeconds32 anInterval, 
   129     TTimeIntervalMicroSeconds32 anInterval, 
   116     MPhoneTimer* aObserver )
   130     MPhoneTimer* aObserver )
   117     {
   131     {
       
   132     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::After() ");
   118     
   133     
   119     __ASSERT_DEBUG( aObserver, Panic( EPhoneUtilsParameterNotInitialized ) );
   134     __ASSERT_DEBUG( aObserver, Panic( EPhoneUtilsParameterNotInitialized ) );
   120     
   135     
   121     if ( IsActive() )
   136     if ( IsActive() )
   122         {
   137         {
   130 //  CPhoneTimer::CancelTimer
   145 //  CPhoneTimer::CancelTimer
   131 // ---------------------------------------------------------
   146 // ---------------------------------------------------------
   132 //
   147 //
   133 EXPORT_C void CPhoneTimer::CancelTimer()
   148 EXPORT_C void CPhoneTimer::CancelTimer()
   134     {
   149     {
       
   150     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::CancelTimer() ");
   135     Cancel();
   151     Cancel();
   136     }
   152     }
   137 
   153 
   138 // ---------------------------------------------------------
   154 // ---------------------------------------------------------
   139 //  CPhoneTimer::DoCancel
   155 //  CPhoneTimer::DoCancel
   140 // ---------------------------------------------------------
   156 // ---------------------------------------------------------
   141 //
   157 //
   142 void CPhoneTimer::DoCancel()
   158 void CPhoneTimer::DoCancel()
   143     {
   159     {
       
   160     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhoneTimer::DoCancel() ");
   144     iTimerObserver = NULL;
   161     iTimerObserver = NULL;
   145     CTimer::DoCancel();
   162     CTimer::DoCancel();
   146     }
   163     }
   147 
   164 
   148 //  End of File  
   165 //  End of File