|
1 // Copyright (c) 2000-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 // e32test/usb\t_usb_device\src\activestallnotifier.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 |
|
21 #include "activestallnotifier.h" |
|
22 |
|
23 extern RTest test; |
|
24 extern TBool gVerbose; |
|
25 extern TBool gSkip; |
|
26 extern TBool gStopOnFail; |
|
27 extern TInt gSoakCount; |
|
28 |
|
29 // |
|
30 // --- class CActiveStallNotifier --------------------------------------------------------- |
|
31 // |
|
32 |
|
33 CActiveStallNotifier::CActiveStallNotifier(CConsoleBase* aConsole, RDEVCLIENT* aPort) |
|
34 : CActive(EPriorityNormal), |
|
35 iConsole(aConsole), |
|
36 iPort(aPort), |
|
37 iEndpointState(0) |
|
38 { |
|
39 CActiveScheduler::Add(this); |
|
40 } |
|
41 |
|
42 CActiveStallNotifier* CActiveStallNotifier::NewL(CConsoleBase* aConsole, RDEVCLIENT* aPort) |
|
43 { |
|
44 CActiveStallNotifier* self = new (ELeave) CActiveStallNotifier(aConsole, aPort); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop(); // self |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 void CActiveStallNotifier::ConstructL() |
|
53 {} |
|
54 |
|
55 |
|
56 CActiveStallNotifier::~CActiveStallNotifier() |
|
57 { |
|
58 TUSB_VERBOSE_PRINT("CActiveStallNotifier::~CActiveStallNotifier()"); |
|
59 Cancel(); // base class |
|
60 } |
|
61 |
|
62 |
|
63 void CActiveStallNotifier::DoCancel() |
|
64 { |
|
65 TUSB_VERBOSE_PRINT("CActiveStallNotifier::DoCancel()"); |
|
66 iPort->EndpointStatusNotifyCancel(); |
|
67 } |
|
68 |
|
69 |
|
70 void CActiveStallNotifier::RunL() |
|
71 { |
|
72 // This just displays the bitmap, showing which endpoints (if any) are now stalled. |
|
73 // In a real world program, the user could take here appropriate action (cancel a |
|
74 // transfer request or whatever). |
|
75 TUSB_VERBOSE_PRINT1("StallNotifier: Endpointstate 0x%x\n", iEndpointState); |
|
76 Activate(); |
|
77 } |
|
78 |
|
79 |
|
80 void CActiveStallNotifier::Activate() |
|
81 { |
|
82 __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
|
83 iPort->EndpointStatusNotify(iStatus, iEndpointState); |
|
84 SetActive(); |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 // -eof- |