kerneltest/e32test/usbho/t_usbdi/src/wakeuptimer.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15 // @internalComponent
    15 // @internalComponent
    16 // 
    16 // 
    17 //
    17 //
    18 
    18 
    19 #include "wakeuptimer.h"
    19 #include "wakeuptimer.h"
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "wakeuptimerTraces.h"
       
    23 #endif
       
    24 
    20 
    25 
    21 
    26 namespace NUnitTesting_USBDI
    22 namespace NUnitTesting_USBDI
    27 	{
    23 	{
    28 
    24 
    29 const TInt KOneSecond(1000000);
    25 const TInt KOneSecond(1000000);
    30 
    26 
    31 CRemoteWakeupTimer* CRemoteWakeupTimer::NewL(RUsbTestDevice& aTestDevice)
    27 CRemoteWakeupTimer* CRemoteWakeupTimer::NewL(RUsbTestDevice& aTestDevice)
    32 	{
    28 	{
    33 	OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_NEWL_ENTRY, ( TUint )&( aTestDevice ) );
       
    34 	CRemoteWakeupTimer* self = new (ELeave) CRemoteWakeupTimer(aTestDevice);
    29 	CRemoteWakeupTimer* self = new (ELeave) CRemoteWakeupTimer(aTestDevice);
    35 	CleanupStack::PushL(self);
    30 	CleanupStack::PushL(self);
    36 	self->ConstructL();
    31 	self->ConstructL();
    37 	CleanupStack::Pop(self);
    32 	CleanupStack::Pop(self);
    38 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_NEWL_EXIT, ( TUint )( self ) );
       
    39 	return self;
    33 	return self;
    40 	}
    34 	}
    41 
    35 
    42 
    36 
    43 CRemoteWakeupTimer::CRemoteWakeupTimer(RUsbTestDevice& aTestDevice)
    37 CRemoteWakeupTimer::CRemoteWakeupTimer(RUsbTestDevice& aTestDevice)
    44 :	CTimer(EPriorityStandard),
    38 :	CTimer(EPriorityStandard),
    45 	iTestDevice(aTestDevice)
    39 	iTestDevice(aTestDevice)
    46 	{
    40 	{
    47 	OstTraceFunctionEntryExt( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_ENTRY, this );
       
    48 	CActiveScheduler::Add(this);
    41 	CActiveScheduler::Add(this);
    49 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_EXIT, this );
       
    50 	}
    42 	}
    51 
    43 
    52 
    44 
    53 CRemoteWakeupTimer::~CRemoteWakeupTimer()
    45 CRemoteWakeupTimer::~CRemoteWakeupTimer()
    54 	{
    46 	{
    55 	OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_ENTRY_DUP01, this );
       
    56 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_EXIT_DUP01, this );
       
    57 	}
    47 	}
    58 
    48 
    59 
    49 
    60 void CRemoteWakeupTimer::ConstructL()
    50 void CRemoteWakeupTimer::ConstructL()
    61 	{
    51 	{
    62 	OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_CONSTRUCTL_ENTRY, this );
    52 	LOG_FUNC
    63 	CTimer::ConstructL();
    53 	CTimer::ConstructL();
    64 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CONSTRUCTL_EXIT, this );
       
    65 	}
    54 	}
    66 
    55 
    67 
    56 
    68 void CRemoteWakeupTimer::WakeUp(TUint16 aInterval)
    57 void CRemoteWakeupTimer::WakeUp(TUint16 aInterval)
    69 	{
    58 	{
    70 	OstTraceFunctionEntryExt( CREMOTEWAKEUPTIMER_WAKEUP_ENTRY, this );
    59 	LOG_FUNC
    71 	After(aInterval*KOneSecond);
    60 	After(aInterval*KOneSecond);
    72 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_WAKEUP_EXIT, this );
       
    73 	}
    61 	}
    74 
    62 
    75 
    63 
    76 void CRemoteWakeupTimer::RunL()
    64 void CRemoteWakeupTimer::RunL()
    77 	{
    65 	{
    78 	OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_RUNL_ENTRY, this );
    66 	LOG_FUNC
    79 	TInt completionCode(iStatus.Int());
    67 	TInt completionCode(iStatus.Int());
    80 	
    68 	
    81 	if(completionCode != KErrNone)
    69 	if(completionCode != KErrNone)
    82 		{
    70 		{
    83 		OstTrace1(TRACE_NORMAL, CREMOTEWAKEUPTIMER_RUNL, "<Error %d> software connect/disconnect timer error",completionCode);
    71 		RDebug::Printf("<Error %d> software connect/disconnect timer error",completionCode);
    84 		iTestDevice.ReportError(completionCode);
    72 		iTestDevice.ReportError(completionCode);
    85 		}
    73 		}
    86 	else
    74 	else
    87 		{
    75 		{
    88 		iTestDevice.RemoteWakeup();
    76 		iTestDevice.RemoteWakeup();
    89 		}	
    77 		}	
    90 	OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_RUNL_EXIT, this );
       
    91 	}	
    78 	}	
    92 
    79 
    93 	}
    80 	}
    94 
    81 
    95 
    82