mobilemessaging/smilui/playersrc/SmilPlayerPauseIndicatorTimer.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005 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: SmilPlayerPauseIndicatorTimer implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "SmilPlayerPauseIndicatorTimer.h"
       
    22 #include "SmilPlayerPauseObserver.h"
       
    23 
       
    24 // CONSTANTS
       
    25 const TInt KPauseIndicatorBlinkingTime = 1000000; // 1 seconds
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CSmilPlayerPauseIndicatorTimer::CSmilPlayerPauseIndicatorTimer
       
    31 // C++ constructor.
       
    32 // ----------------------------------------------------------------------------
       
    33 //
       
    34 CSmilPlayerPauseIndicatorTimer::CSmilPlayerPauseIndicatorTimer( MSmilPlayerPauseObserver* aPauseObserver ) :
       
    35     CTimer( EPriorityStandard ),
       
    36     iPauseObserver( aPauseObserver )
       
    37     {
       
    38     CActiveScheduler::Add( this );
       
    39     }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // CSmilPlayerPauseIndicatorTimer::ConstructL
       
    43 // Symbian 2nd phase constructor. Creates timer.
       
    44 // ----------------------------------------------------------------------------
       
    45 // 
       
    46 void CSmilPlayerPauseIndicatorTimer::ConstructL()
       
    47     {
       
    48     CTimer::ConstructL();
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------
       
    52 // CSmilPlayerPauseIndicatorTimer::NewL 
       
    53 // Symbian two phased constructor
       
    54 // ---------------------------------------------------------
       
    55 // 
       
    56 CSmilPlayerPauseIndicatorTimer* CSmilPlayerPauseIndicatorTimer::NewL( MSmilPlayerPauseObserver* aPauseObserver )
       
    57     {
       
    58     CSmilPlayerPauseIndicatorTimer* self = new(ELeave) CSmilPlayerPauseIndicatorTimer( aPauseObserver );
       
    59     
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63 
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ----------------------------------------------------------------------------
       
    68 // CSmilPlayerPauseIndicatorTimer::~CSmilPlayerPauseIndicatorTimer
       
    69 // Destructor.
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 CSmilPlayerPauseIndicatorTimer::~CSmilPlayerPauseIndicatorTimer()
       
    73     {
       
    74     iPauseObserver = NULL; // For LINT
       
    75     }
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CSmilPlayerPauseIndicatorTimer::StartTimer
       
    79 // Starts pause timer.
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 void CSmilPlayerPauseIndicatorTimer::StartTimer()
       
    83     {
       
    84     Cancel();
       
    85     After( KPauseIndicatorBlinkingTime );
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------------------------------
       
    89 // CSmilPlayerPauseIndicatorTimer::RunL
       
    90 // Called when timer is triggered. Calls observer to toggle pause indicator and 
       
    91 // sets timer active again.
       
    92 // ----------------------------------------------------------------------------
       
    93 //
       
    94 void CSmilPlayerPauseIndicatorTimer::RunL()
       
    95     {
       
    96     iPauseObserver->TogglePauseIndicator();
       
    97     After( KPauseIndicatorBlinkingTime );
       
    98     }
       
    99 
       
   100 // End of File