kerneltest/e32test/usbho/t_usbdi/src/wakeuptimer.cpp
changeset 0 a41df078684a
child 253 d37db4dcc88d
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2007-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 the License "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 // @file wakeuptimer.cpp
       
    15 // @internalComponent
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "wakeuptimer.h"
       
    20 
       
    21 
       
    22 namespace NUnitTesting_USBDI
       
    23 	{
       
    24 
       
    25 const TInt KOneSecond(1000000);
       
    26 
       
    27 CRemoteWakeupTimer* CRemoteWakeupTimer::NewL(RUsbTestDevice& aTestDevice)
       
    28 	{
       
    29 	CRemoteWakeupTimer* self = new (ELeave) CRemoteWakeupTimer(aTestDevice);
       
    30 	CleanupStack::PushL(self);
       
    31 	self->ConstructL();
       
    32 	CleanupStack::Pop(self);
       
    33 	return self;
       
    34 	}
       
    35 
       
    36 
       
    37 CRemoteWakeupTimer::CRemoteWakeupTimer(RUsbTestDevice& aTestDevice)
       
    38 :	CTimer(EPriorityStandard),
       
    39 	iTestDevice(aTestDevice)
       
    40 	{
       
    41 	CActiveScheduler::Add(this);
       
    42 	}
       
    43 
       
    44 
       
    45 CRemoteWakeupTimer::~CRemoteWakeupTimer()
       
    46 	{
       
    47 	}
       
    48 
       
    49 
       
    50 void CRemoteWakeupTimer::ConstructL()
       
    51 	{
       
    52 	LOG_FUNC
       
    53 	CTimer::ConstructL();
       
    54 	}
       
    55 
       
    56 
       
    57 void CRemoteWakeupTimer::WakeUp(TUint16 aInterval)
       
    58 	{
       
    59 	LOG_FUNC
       
    60 	After(aInterval*KOneSecond);
       
    61 	}
       
    62 
       
    63 
       
    64 void CRemoteWakeupTimer::RunL()
       
    65 	{
       
    66 	LOG_FUNC
       
    67 	TInt completionCode(iStatus.Int());
       
    68 	
       
    69 	if(completionCode != KErrNone)
       
    70 		{
       
    71 		RDebug::Printf("<Error %d> software connect/disconnect timer error",completionCode);
       
    72 		iTestDevice.ReportError(completionCode);
       
    73 		}
       
    74 	else
       
    75 		{
       
    76 		iTestDevice.RemoteWakeup();
       
    77 		}	
       
    78 	}	
       
    79 
       
    80 	}
       
    81 
       
    82 
       
    83