author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 02 Sep 2010 21:54:16 +0300 | |
changeset 259 | 57b9594f5772 |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2000-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 |
// e32test/usb\t_usb_device\src\activetimer.cpp |
|
15 |
// USB Test Program T_USB_DEVICE, functional part. |
|
16 |
// Device-side part, to work against T_USB_HOST running on the host. |
|
17 |
// |
|
18 |
// |
|
19 |
||
20 |
#include "general.h" // CActiveControl, CActiveRW |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "OstTraceDefinitions.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#ifdef OST_TRACE_COMPILER_IN_USE |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#include "activetimerTraces.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#endif |
0 | 25 |
#include "activetimer.h" |
26 |
||
27 |
extern RTest test; |
|
28 |
extern TBool gVerbose; |
|
29 |
extern TBool gSkip; |
|
30 |
extern TBool gStopOnFail; |
|
31 |
extern TInt gSoakCount; |
|
32 |
||
33 |
// |
|
34 |
// --- class CActiveTimer --------------------------------------------------------- |
|
35 |
// |
|
36 |
||
37 |
CActiveTimer::CActiveTimer(CConsoleBase* aConsole, RDEVCLIENT* aPort) |
|
38 |
: CActive(EPriorityNormal), |
|
39 |
iConsole(aConsole), |
|
40 |
iPort(aPort) |
|
41 |
{ |
|
42 |
CActiveScheduler::Add(this); |
|
43 |
} |
|
44 |
||
45 |
||
46 |
CActiveTimer* CActiveTimer::NewL(CConsoleBase* aConsole, RDEVCLIENT* aPort) |
|
47 |
{ |
|
48 |
CActiveTimer* self = new (ELeave) CActiveTimer(aConsole, aPort); |
|
49 |
CleanupStack::PushL(self); |
|
50 |
self->ConstructL(); |
|
51 |
CleanupStack::Pop(); // self |
|
52 |
return self; |
|
53 |
} |
|
54 |
||
55 |
||
56 |
void CActiveTimer::ConstructL() |
|
57 |
{ |
|
58 |
User::LeaveIfError(iTimer.CreateLocal()); |
|
59 |
} |
|
60 |
||
61 |
||
62 |
CActiveTimer::~CActiveTimer() |
|
63 |
{ |
|
64 |
TUSB_VERBOSE_PRINT("CActiveTimer::~CActiveTimer()"); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
if(gVerbose) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
OstTrace0(TRACE_VERBOSE, CACTIVETIMER_DCACTIVETIMER, "CActiveTimer::~CActiveTimer()"); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
} |
0 | 69 |
Cancel(); // base class |
70 |
iTimer.Close(); |
|
71 |
} |
|
72 |
||
73 |
||
74 |
void CActiveTimer::DoCancel() |
|
75 |
{ |
|
76 |
TUSB_VERBOSE_PRINT("CActiveTimer::DoCancel()"); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
if(gVerbose) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
OstTrace0(TRACE_VERBOSE, CACTIVETIMER_DOCANCEL, "CActiveTimer::DoCancel()"); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
} |
0 | 81 |
iTimer.Cancel(); |
82 |
} |
|
83 |
||
84 |
||
85 |
void CActiveTimer::RunL() |
|
86 |
{ |
|
87 |
TUSB_VERBOSE_PRINT("CActiveTimer::RunL()"); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
if(gVerbose) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
OstTrace0(TRACE_VERBOSE, CACTIVETIMER_RUNL, "CActiveTimer::RunL()"); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
} |
0 | 92 |
// Nothing to do here, as we call ReadCancel() after a manual WaitForRequest() |
93 |
// (in CActiveRW::ReceiveVersion()). |
|
94 |
} |
|
95 |
||
96 |
||
97 |
void CActiveTimer::Activate(TTimeIntervalMicroSeconds32 aDelay) |
|
98 |
{ |
|
99 |
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
|
100 |
iTimer.After(iStatus, aDelay); |
|
101 |
SetActive(); |
|
102 |
} |
|
103 |
||
104 |
||
105 |
// -eof- |