253
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
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"
|
253
|
20 |
#include "OstTraceDefinitions.h"
|
|
21 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
22 |
#include "wakeuptimerTraces.h"
|
|
23 |
#endif
|
0
|
24 |
|
|
25 |
|
|
26 |
namespace NUnitTesting_USBDI
|
|
27 |
{
|
|
28 |
|
|
29 |
const TInt KOneSecond(1000000);
|
|
30 |
|
|
31 |
CRemoteWakeupTimer* CRemoteWakeupTimer::NewL(RUsbTestDevice& aTestDevice)
|
|
32 |
{
|
253
|
33 |
OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_NEWL_ENTRY, ( TUint )&( aTestDevice ) );
|
0
|
34 |
CRemoteWakeupTimer* self = new (ELeave) CRemoteWakeupTimer(aTestDevice);
|
|
35 |
CleanupStack::PushL(self);
|
|
36 |
self->ConstructL();
|
|
37 |
CleanupStack::Pop(self);
|
253
|
38 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_NEWL_EXIT, ( TUint )( self ) );
|
0
|
39 |
return self;
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
CRemoteWakeupTimer::CRemoteWakeupTimer(RUsbTestDevice& aTestDevice)
|
|
44 |
: CTimer(EPriorityStandard),
|
|
45 |
iTestDevice(aTestDevice)
|
|
46 |
{
|
253
|
47 |
OstTraceFunctionEntryExt( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_ENTRY, this );
|
0
|
48 |
CActiveScheduler::Add(this);
|
253
|
49 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_EXIT, this );
|
0
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
CRemoteWakeupTimer::~CRemoteWakeupTimer()
|
|
54 |
{
|
253
|
55 |
OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_ENTRY_DUP01, this );
|
|
56 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CREMOTEWAKEUPTIMER_EXIT_DUP01, this );
|
0
|
57 |
}
|
|
58 |
|
|
59 |
|
|
60 |
void CRemoteWakeupTimer::ConstructL()
|
|
61 |
{
|
253
|
62 |
OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_CONSTRUCTL_ENTRY, this );
|
0
|
63 |
CTimer::ConstructL();
|
253
|
64 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_CONSTRUCTL_EXIT, this );
|
0
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
void CRemoteWakeupTimer::WakeUp(TUint16 aInterval)
|
|
69 |
{
|
253
|
70 |
OstTraceFunctionEntryExt( CREMOTEWAKEUPTIMER_WAKEUP_ENTRY, this );
|
0
|
71 |
After(aInterval*KOneSecond);
|
253
|
72 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_WAKEUP_EXIT, this );
|
0
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
void CRemoteWakeupTimer::RunL()
|
|
77 |
{
|
253
|
78 |
OstTraceFunctionEntry1( CREMOTEWAKEUPTIMER_RUNL_ENTRY, this );
|
0
|
79 |
TInt completionCode(iStatus.Int());
|
|
80 |
|
|
81 |
if(completionCode != KErrNone)
|
|
82 |
{
|
253
|
83 |
OstTrace1(TRACE_NORMAL, CREMOTEWAKEUPTIMER_RUNL, "<Error %d> software connect/disconnect timer error",completionCode);
|
0
|
84 |
iTestDevice.ReportError(completionCode);
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
iTestDevice.RemoteWakeup();
|
|
89 |
}
|
253
|
90 |
OstTraceFunctionExit1( CREMOTEWAKEUPTIMER_RUNL_EXIT, this );
|
0
|
91 |
}
|
|
92 |
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
|