services/terminalmodeservice/tsrc/upnptmservertest/src/testtimer.cpp
branchRCL_3
changeset 10 594d15129e2c
parent 9 5c72fd91570d
equal deleted inserted replaced
9:5c72fd91570d 10:594d15129e2c
     1 /**
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "testtimer.h"
       
    21 #include "tmservertest.h"
       
    22 
       
    23 const TInt KMicroSecond = 1000000;
       
    24 
       
    25 CTestTimer* CTestTimer::NewL(CTmServerTest& aTmServerTest)
       
    26     {
       
    27     return new (ELeave) CTestTimer(aTmServerTest);  
       
    28     }
       
    29 
       
    30 CTestTimer::~CTestTimer()
       
    31     {
       
    32     Cancel();
       
    33     iTimer.Close(); 
       
    34     }
       
    35 
       
    36 void CTestTimer::After(const TInt aDuration)
       
    37     {
       
    38     iTimer.After(iStatus, aDuration*KMicroSecond);
       
    39     SetActive();    
       
    40     }
       
    41 
       
    42 CTestTimer::CTestTimer(CTmServerTest& aTmServerTest)
       
    43 :CActive(EPriorityStandard), iTmServerTest(aTmServerTest)
       
    44     {
       
    45     CActiveScheduler::Add(this);
       
    46     iTimer.CreateLocal();   
       
    47     }
       
    48 
       
    49 void CTestTimer::RunL()
       
    50     {
       
    51      iTmServerTest.TestTimerTimedOutL();
       
    52     }
       
    53 
       
    54 void CTestTimer::DoCancel()
       
    55     {
       
    56     iTimer.Cancel();
       
    57     }
       
    58