services/terminalmodeservice/tsrc/upnptmservertest/src/discoverytesttimer.cpp
changeset 24 e9457ebcc4df
equal deleted inserted replaced
19:b9e36322dee2 24:e9457ebcc4df
       
     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 "discoverytesttimer.h"
       
    21 #include "tmservertest.h"
       
    22 
       
    23 const TInt KMicroSecond1 = 1000000;
       
    24 
       
    25 CDiscoveryTestTimer* CDiscoveryTestTimer::NewL(CTmServerTest& aTmServerTest)
       
    26     {
       
    27     return new (ELeave) CDiscoveryTestTimer(aTmServerTest);  
       
    28     }
       
    29 
       
    30 CDiscoveryTestTimer::~CDiscoveryTestTimer()
       
    31     {
       
    32     Cancel();
       
    33     iDiscoveryTimer.Close(); 
       
    34     }
       
    35 
       
    36 void CDiscoveryTestTimer::AfterDiscovery(const TInt aDuration)
       
    37     {
       
    38     iDiscoveryTimer.After(iStatus, aDuration*KMicroSecond1);
       
    39     SetActive();    
       
    40     }
       
    41 
       
    42 CDiscoveryTestTimer::CDiscoveryTestTimer(CTmServerTest& aTmServerTest)
       
    43 :CActive(EPriorityStandard), iTmServerTest(aTmServerTest)
       
    44     {
       
    45     CActiveScheduler::Add(this);
       
    46     iDiscoveryTimer.CreateLocal();   
       
    47     }
       
    48 
       
    49 void CDiscoveryTestTimer::RunL()
       
    50     {
       
    51      iTmServerTest.TestTimerDiscoveryTimedOut();
       
    52     }
       
    53 
       
    54 void CDiscoveryTestTimer::DoCancel()
       
    55     {
       
    56     iDiscoveryTimer.Cancel();
       
    57     }
       
    58