testexecfw/useremul/engine/WSServer/src/CaptureKeyTimer.cpp
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*------------------------------------------------------------------
       
     2  -
       
     3  * Software Name : UserEmulator
       
     4  * Version       : v4.2.1309
       
     5  * 
       
     6  * Copyright (c) 2009 France Telecom. All rights reserved.
       
     7  * This software is distributed under the License 
       
     8  * "Eclipse Public License - v 1.0" the text of which is available
       
     9  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10  *
       
    11  * Initial Contributors:
       
    12  * France Telecom 
       
    13  *
       
    14  * Contributors:
       
    15  *------------------------------------------------------------------
       
    16  -
       
    17  * File Name: CaptureKeyTimer.cpp
       
    18  * 
       
    19  * Created: 13/08/2009
       
    20  * Author(s): Marcell Kiss
       
    21  *   
       
    22  * Description:
       
    23  * Key Timer class
       
    24  *------------------------------------------------------------------
       
    25  -
       
    26  *
       
    27  */
       
    28  
       
    29 // User Includes
       
    30 #include "CaptureKeyTimer.h"
       
    31 
       
    32 // ======== MEMBER FUNCTIONS ========
       
    33 
       
    34 CCaptureKeyTimer* CCaptureKeyTimer::NewL(MCaptureKeyTimerNotify& aNotify)
       
    35 {
       
    36     CCaptureKeyTimer* me = new (ELeave) CCaptureKeyTimer(aNotify);
       
    37     CleanupStack::PushL(me);
       
    38     me->ConstructL();
       
    39     CleanupStack::Pop(me);
       
    40     return me;
       
    41 } 
       
    42  
       
    43 CCaptureKeyTimer::~CCaptureKeyTimer()
       
    44 {	
       
    45 	Cancel();
       
    46 	iTimer.Close();
       
    47 }
       
    48 // ----------------------------------------------------------
       
    49 // Set timer
       
    50 // ----------------------------------------------------------
       
    51 //
       
    52 void CCaptureKeyTimer::After(TTimeIntervalMicroSeconds32 aInterval)
       
    53 {
       
    54     Cancel();
       
    55     iTimer.After(iStatus,aInterval);
       
    56     SetActive();
       
    57 }
       
    58 // ----------------------------------------------------------
       
    59 // Notifies AppUi that timer expired
       
    60 // ----------------------------------------------------------
       
    61 //
       
    62 void CCaptureKeyTimer::RunL()
       
    63 {
       
    64     iNotify.KeyTimerExpired();
       
    65 }
       
    66 // ----------------------------------------------------------
       
    67 // Cancel timer
       
    68 // ----------------------------------------------------------
       
    69 //
       
    70 void CCaptureKeyTimer::DoCancel()
       
    71 {
       
    72     iTimer.Cancel();
       
    73 }
       
    74 // ----------------------------------------------------------
       
    75 // CCaptureKeyTimer::CCaptureKeyTimer
       
    76 // ----------------------------------------------------------
       
    77 //
       
    78 CCaptureKeyTimer::CCaptureKeyTimer(MCaptureKeyTimerNotify& aNotify)
       
    79 :CActive(EPriorityNormal),iNotify(aNotify)
       
    80 {
       
    81 }
       
    82 // ----------------------------------------------------------
       
    83 // Second phase constructor
       
    84 // ----------------------------------------------------------
       
    85 //
       
    86 void CCaptureKeyTimer::ConstructL(void)
       
    87 {
       
    88 	CActiveScheduler::Add(this);
       
    89 	iTimer.CreateLocal();
       
    90 }