servicediscoveryandcontrol/pnp/test/upnp/Server/Flow/src/cupnptimer.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @internalComponent
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "cupnptimer.h"
       
    19 
       
    20 CUPnPTimer::CUPnPTimer(MUPnPTimerObserver& aObserver) 
       
    21 : CActive ( EPriorityStandard ),
       
    22 	iObserver ( aObserver )
       
    23 	{
       
    24 	CActiveScheduler::Add(this);
       
    25 	iTimer.CreateLocal();
       
    26 	}
       
    27 
       
    28 CUPnPTimer* CUPnPTimer::NewL(MUPnPTimerObserver& aObserver)
       
    29 	{
       
    30 	return new (ELeave) CUPnPTimer(aObserver);
       
    31 	}
       
    32 
       
    33 CUPnPTimer::~CUPnPTimer()
       
    34 	{
       
    35 	Cancel();
       
    36 	iTimer.Close();	
       
    37 	}
       
    38 
       
    39 void CUPnPTimer::RunL()
       
    40 	{
       
    41 	if ( iStatus.Int () == KErrNone )
       
    42 		iObserver.TimeOut();
       
    43 	}
       
    44 
       
    45 void CUPnPTimer::DoCancel()
       
    46 	{
       
    47 	iTimer.Cancel();
       
    48 	}
       
    49 
       
    50 void CUPnPTimer::StartTimer(TTimeIntervalMicroSeconds32 aTimeInterval)
       
    51 	{
       
    52 	if(!IsActive())
       
    53 		{
       
    54 		iTimer.After(iStatus, aTimeInterval);	
       
    55 		SetActive();
       
    56 		}
       
    57 	}
       
    58 
       
    59 void CUPnPTimer::StopTimer()
       
    60 	{
       
    61 	DoCancel ();
       
    62 	}
       
    63 
       
    64 
       
    65 
       
    66 
       
    67 
       
    68 
       
    69