multimediacommscontroller/mmccdtmfpayloadformat/src/dtmfhighresolutiontimer.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Provides high resolution timer services.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "dtmfhighresolutiontimer.h"
       
    22 #include "dtmfpayloadformatdefs.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CDtmfHighResTimer::CDTMFPayloadDecoder
       
    26 // C++ default constructor can NOT contain any code, that might leave.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CDtmfHighResTimer::CDtmfHighResTimer( TInt aPriority )
       
    30     :
       
    31     CTimer( aPriority )
       
    32     {
       
    33     CActiveScheduler::Add( this );
       
    34     }
       
    35 
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CDtmfHighResTimer::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 void CDtmfHighResTimer::ConstructL()
       
    43     {
       
    44     CTimer::ConstructL();
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CDtmfHighResTimer::NewL
       
    50 // Two-phased constructor.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CDtmfHighResTimer* CDtmfHighResTimer::NewL( TInt aPriority )
       
    54     {
       
    55     CDtmfHighResTimer* self = CDtmfHighResTimer::NewLC( aPriority );
       
    56     CleanupStack::Pop( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CDtmfHighResTimer::NewLC
       
    63 // Two-phased constructor.
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CDtmfHighResTimer* CDtmfHighResTimer::NewLC( TInt aPriority )
       
    67     {
       
    68     CDtmfHighResTimer* self = new( ELeave ) CDtmfHighResTimer( aPriority );
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL();
       
    71     return self;
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CDtmfHighResTimer::~CDtmfHighResTimer
       
    77 // Destructor.
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CDtmfHighResTimer::~CDtmfHighResTimer()
       
    81     {
       
    82     
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CDtmfHighResTimer::Start
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CDtmfHighResTimer::Start(
       
    91         TTimeIntervalMicroSeconds32 aDelay,
       
    92         TTimeIntervalMicroSeconds32 anInterval,
       
    93         TCallBack aCallBack )
       
    94     {
       
    95     DP_DTMF_WRITE3( _L("CDtmfHighResTimer::Start, DELAY: %d, INTERVAL: %d"),
       
    96         aDelay.Int(), anInterval.Int() );
       
    97     ASSERT( aDelay.Int() >= 0 );
       
    98     ASSERT( anInterval.Int() >= 0 );
       
    99     
       
   100 	iInterval = anInterval.Int();
       
   101 	iCallBack = aCallBack;
       
   102 	CTimer::HighRes( aDelay );
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // From class CActive.
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void CDtmfHighResTimer::RunL()
       
   111     {
       
   112     CTimer::HighRes( iInterval );
       
   113 	iCallBack.CallBack();
       
   114     }