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) 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 PBASE-T_USBDI-0473.cpp |
|
15 |
// @internalComponent |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include "PBASE-T_USBDI-0473.h" |
|
20 |
#include <d32usbc.h> |
|
21 |
#include "testdebug.h" |
|
22 |
#include "modelleddevices.h" |
|
23 |
#include "TestPolicy.h" |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#include "OstTraceDefinitions.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#ifdef OST_TRACE_COMPILER_IN_USE |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#include "PBASE-T_USBDI-0473Traces.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
#endif |
0 | 28 |
|
29 |
namespace NUnitTesting_USBDI |
|
30 |
{ |
|
31 |
||
32 |
_LIT(KTestCaseId,"PBASE-T_USBDI-0473"); |
|
33 |
const TFunctorTestCase<CUT_PBASE_T_USBDI_0473,TBool> CUT_PBASE_T_USBDI_0473::iFunctor(KTestCaseId); |
|
34 |
||
35 |
CUT_PBASE_T_USBDI_0473* CUT_PBASE_T_USBDI_0473::NewL(TBool aHostRole) |
|
36 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
37 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_NEWL_ENTRY, aHostRole ); |
0 | 38 |
CUT_PBASE_T_USBDI_0473* self = new (ELeave) CUT_PBASE_T_USBDI_0473(aHostRole); |
39 |
CleanupStack::PushL(self); |
|
40 |
self->ConstructL(); |
|
41 |
CleanupStack::Pop(self); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_NEWL_EXIT, ( TUint )( self ) ); |
0 | 43 |
return self; |
44 |
} |
|
45 |
||
46 |
||
47 |
CUT_PBASE_T_USBDI_0473::CUT_PBASE_T_USBDI_0473(TBool aHostRole) |
|
48 |
: CBaseTestCase(KTestCaseId,aHostRole), |
|
49 |
iSuspendedI0(EFalse), |
|
50 |
iSuspendedI1(EFalse), |
|
51 |
iDeviceNotificationPending(ETrue) |
|
52 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT, this ); |
0 | 55 |
} |
56 |
||
57 |
||
58 |
void CUT_PBASE_T_USBDI_0473::ConstructL() |
|
59 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_ENTRY, this ); |
0 | 61 |
iTestDevice = new RUsbDeviceA(this); |
62 |
BaseConstructL(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_EXIT, this ); |
0 | 64 |
} |
65 |
||
66 |
||
67 |
CUT_PBASE_T_USBDI_0473::~CUT_PBASE_T_USBDI_0473() |
|
68 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY_DUP01, this ); |
0 | 70 |
|
71 |
// Cancel any async operations |
|
72 |
||
73 |
Cancel(); // Cancel host timer |
|
74 |
||
75 |
// Destroy the watchers |
|
76 |
// they still use opened interfaces to cancel the suspend if active |
|
77 |
delete iInterface1Watcher; |
|
78 |
delete iInterface0Watcher; |
|
79 |
||
80 |
// Close the interfaces |
|
81 |
iUsbInterface1.Close(); |
|
82 |
iUsbInterface0.Close(); |
|
83 |
||
84 |
delete iControlEp0; |
|
85 |
delete iActorFDF; |
|
86 |
if(!IsHost() && iTestDevice) |
|
87 |
{ |
|
88 |
iTestDevice->Close(); |
|
89 |
} |
|
90 |
delete iTestDevice; |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT_DUP01, this ); |
0 | 92 |
} |
93 |
||
94 |
||
95 |
void CUT_PBASE_T_USBDI_0473::ExecuteHostTestCaseL() |
|
96 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_ENTRY, this ); |
0 | 98 |
iCaseStep = EStepSuspend; |
99 |
iActorFDF = CActorFDF::NewL(*this); |
|
100 |
iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0); |
|
101 |
iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_0473::Interface0ResumedL,this)); |
|
102 |
iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_0473::Interface1ResumedL,this)); |
|
103 |
||
104 |
// Monitor for device connections |
|
105 |
iActorFDF->Monitor(); |
|
106 |
||
107 |
// Start the connection timeout |
|
108 |
TimeoutIn(30); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_EXIT, this ); |
0 | 110 |
} |
111 |
||
112 |
void CUT_PBASE_T_USBDI_0473::ExecuteDeviceTestCaseL() |
|
113 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_ENTRY, this ); |
0 | 115 |
|
116 |
// Construct the device for the test case |
|
117 |
iTestDevice->OpenL(TestCaseId()); |
|
118 |
iTestDevice->SubscribeToReports(iStatus); |
|
119 |
SetActive(); |
|
120 |
||
121 |
// Connect the test device |
|
122 |
iTestDevice->SoftwareConnect(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_EXIT, this ); |
0 | 124 |
} |
125 |
||
126 |
||
127 |
void CUT_PBASE_T_USBDI_0473::HostDoCancel() |
|
128 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
129 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_ENTRY, this ); |
0 | 130 |
|
131 |
// Cancel the timeout timer |
|
132 |
CancelTimeout(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_EXIT, this ); |
0 | 134 |
} |
135 |
||
136 |
||
137 |
void CUT_PBASE_T_USBDI_0473::DeviceDoCancel() |
|
138 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_ENTRY, this ); |
0 | 140 |
|
141 |
// Cancel the device |
|
142 |
iTestDevice->CancelSubscriptionToReports(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
143 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_EXIT, this ); |
0 | 144 |
} |
145 |
||
146 |
void CUT_PBASE_T_USBDI_0473::DeviceInsertedL(TUint aDeviceHandle) |
|
147 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_ENTRY, this ); |
0 | 149 |
|
150 |
Cancel(); // Cancel the timer |
|
151 |
TInt err(KErrNone); |
|
152 |
iDeviceHandle = aDeviceHandle; |
|
153 |
iActorFDF->Monitor(); |
|
154 |
||
155 |
// Validate that device is as expected |
|
156 |
CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle); |
|
157 |
if(testDevice.SerialNumber().Compare(TestCaseId()) != 0) |
|
158 |
{ |
|
159 |
// Incorrect device for this test case |
|
160 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)", |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
KErrNotFound,testDevice.SerialNumber(),TestCaseId()); |
0 | 163 |
|
164 |
// Start the connection timeout again |
|
165 |
TimeoutIn(30); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT, this ); |
0 | 167 |
return; |
168 |
} |
|
169 |
// Check tree now |
|
170 |
CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone); |
|
171 |
||
172 |
// Perform the correct test step |
|
173 |
switch(iCaseStep) |
|
174 |
{ |
|
175 |
case EStepSuspend: |
|
176 |
{ |
|
177 |
TUint32 token1(0); |
|
178 |
TUint32 token2(0); |
|
179 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP01, "Obtaining token for interface 0"); |
0 | 181 |
err = testDevice.Device().GetTokenForInterface(0,token1); |
182 |
if(err != KErrNone) |
|
183 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP02, "<Error %d> Token for interface 0 could not be retrieved",err); |
0 | 185 |
return TestFailed(err); |
186 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP03, "Token 1 (%d) retrieved",token1); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP04, "Opening interface 0"); |
0 | 189 |
err = iUsbInterface0.Open(token1); // Alternate interface setting 0 |
190 |
if(err != KErrNone) |
|
191 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
192 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP05, "<Error %d> Interface 0 could not be opened",err); |
0 | 193 |
return TestFailed(err); |
194 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP06, "Interface 0 opened"); |
0 | 196 |
|
197 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP07, "Obtaining token for interface 1"); |
0 | 199 |
err = testDevice.Device().GetTokenForInterface(1,token2); |
200 |
if(err != KErrNone) |
|
201 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP08, "<Error %d> Token for interface 1 could not be retrieved",err); |
0 | 203 |
return TestFailed(err); |
204 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP09, "Opening interface 1"); |
0 | 206 |
err = iUsbInterface1.Open(token2); // Alternate interface setting 0 |
207 |
if(err != KErrNone) |
|
208 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP10, "<Error %d> Interface 1 could not be opened",err); |
0 | 210 |
return TestFailed(err); |
211 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
212 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP11, "Interface 1 opened"); |
0 | 213 |
|
214 |
// close it |
|
215 |
iUsbInterface1.Close(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
216 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP12, "Interface 1 closed"); |
0 | 217 |
|
218 |
//re-open now |
|
219 |
err = iUsbInterface1.Open(token2); // Alternate interface setting 0 |
|
220 |
if(err != KErrNone) |
|
221 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP13, "<Error %d> Interface 1 could not be re-opened",err); |
0 | 223 |
return TestFailed(err); |
224 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP14, "Interface 1 re-opened"); |
0 | 226 |
|
227 |
||
228 |
// Suspend interface 0 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
229 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP15, "Suspending interface 0"); |
0 | 230 |
iInterface0Watcher->SuspendAndWatch(); |
231 |
iSuspendedI0 = ETrue; |
|
232 |
||
233 |
// Suspend interface 1 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
234 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP16, "Suspending interface 1"); |
0 | 235 |
iInterface1Watcher->SuspendAndWatch(); |
236 |
iSuspendedI1 = ETrue; |
|
237 |
||
238 |
iCaseStep = EValidateSuspendingInterfaces; |
|
239 |
TimeoutIn(10); // Give 10 seconds for device to suspend |
|
240 |
} |
|
241 |
break; |
|
242 |
||
243 |
default: |
|
244 |
TestFailed(KErrCorrupt); |
|
245 |
break; |
|
246 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT_DUP01, this ); |
0 | 248 |
} |
249 |
||
250 |
||
251 |
TInt CUT_PBASE_T_USBDI_0473::Interface0ResumedL(TAny* aPtr) |
|
252 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
253 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_ENTRY, 0 ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
254 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL, "Interface 0 resumed"); |
0 | 255 |
CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
256 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_DUP01, "watcher 0 iStatus=%d",self->iInterface0Watcher->CompletionCode()); |
0 | 257 |
self->iSuspendedI0 = EFalse; |
258 |
return self->CheckForAllResumedNotificationsAndContinueFSM(); |
|
259 |
} |
|
260 |
||
261 |
||
262 |
TInt CUT_PBASE_T_USBDI_0473::Interface1ResumedL(TAny* aPtr) |
|
263 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_ENTRY, 0 ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
265 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL, "Interface 1 resumed"); |
0 | 266 |
CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
267 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_DUP01, "watcher 1 iStatus=%d",self->iInterface1Watcher->CompletionCode()); |
0 | 268 |
self->iSuspendedI1 = EFalse; |
269 |
return self->CheckForAllResumedNotificationsAndContinueFSM(); |
|
270 |
} |
|
271 |
||
272 |
||
273 |
void CUT_PBASE_T_USBDI_0473::DeviceRemovedL(TUint aDeviceHandle) |
|
274 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
275 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_ENTRY, this ); |
0 | 276 |
|
277 |
// The test device should not be removed until the test case has passed |
|
278 |
// so this test case has not completed, and state this event as an error |
|
279 |
||
280 |
TestFailed(KErrDisconnected); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_EXIT, this ); |
0 | 282 |
} |
283 |
||
284 |
||
285 |
void CUT_PBASE_T_USBDI_0473::BusErrorL(TInt aError) |
|
286 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
287 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_BUSERRORL_ENTRY, this ); |
0 | 288 |
|
289 |
// This test case handles no failiures on the bus |
|
290 |
||
291 |
TestFailed(aError); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
292 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_BUSERRORL_EXIT, this ); |
0 | 293 |
} |
294 |
||
295 |
TInt CUT_PBASE_T_USBDI_0473::CheckForAllResumedNotificationsAndContinueFSM() |
|
296 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_ENTRY, this ); |
0 | 298 |
TBool readyToContinueFSM= ETrue; |
299 |
if( iInterface0Watcher->IsActive() |
|
300 |
|| iInterface0Watcher->iStatus == KRequestPending) |
|
301 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
302 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM, "Interface 0 watcher still pending"); |
0 | 303 |
readyToContinueFSM= EFalse; |
304 |
} |
|
305 |
||
306 |
if( iInterface1Watcher->IsActive() |
|
307 |
|| iInterface1Watcher->iStatus == KRequestPending) |
|
308 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
309 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_DUP01, "Interface 1 watcher still pending"); |
0 | 310 |
readyToContinueFSM= EFalse; |
311 |
} |
|
312 |
||
313 |
if( iDeviceNotificationPending) |
|
314 |
{ |
|
315 |
readyToContinueFSM= EFalse; |
|
316 |
} |
|
317 |
||
318 |
if( readyToContinueFSM) |
|
319 |
{ |
|
320 |
return ContinueFSMAfterAllResumedNotifications(); |
|
321 |
} |
|
322 |
else |
|
323 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
324 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_EXIT, this, KErrNone ); |
0 | 325 |
return KErrNone; |
326 |
} |
|
327 |
} |
|
328 |
||
329 |
TInt CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications() |
|
330 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
331 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_ENTRY, this ); |
0 | 332 |
iDeviceNotificationPending= ETrue; |
333 |
if(iSuspendedI0) |
|
334 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
335 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS, "<Error %d> Interface 0 still suspended",KErrCompletion); |
0 | 336 |
TestFailed(KErrCompletion); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
337 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT, this, KErrCompletion ); |
0 | 338 |
return KErrCompletion; |
339 |
} |
|
340 |
||
341 |
if(iSuspendedI1) |
|
342 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
343 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP01, "<Error %d> Interface 1 still suspended",KErrCompletion); |
0 | 344 |
TestFailed(KErrCompletion); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
345 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP01, this, KErrCompletion ); |
0 | 346 |
return KErrCompletion; |
347 |
} |
|
348 |
||
349 |
switch(iCaseStep) |
|
350 |
{ |
|
351 |
case EValidateResumptionAfterInterfaceSuspension: |
|
352 |
{ |
|
353 |
// Device is resumed, send request to client: Remote wake up in 6 secs |
|
354 |
TInt err= iUsbInterface1.PermitRemoteWakeup(ETrue); |
|
355 |
||
356 |
if(err != KErrNone) |
|
357 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP02, "<Error %d> Unable to permit remote device wakeup",err); |
0 | 359 |
iCaseStep = EFailed; |
360 |
TTestCaseFailed request(err,_L8("Unable to permit remote device wakeup")); |
|
361 |
iControlEp0->SendRequest(request,this); |
|
362 |
} |
|
363 |
else |
|
364 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP03, "Device is resumed, send request to client: Remote wake up in 6 secs"); |
0 | 366 |
|
367 |
TRemoteWakeupRequest request(6); |
|
368 |
iControlEp0->SendRequest(request,this); |
|
369 |
iCaseStep = ESuspendForRemoteWakeup; |
|
370 |
} |
|
371 |
} |
|
372 |
break; |
|
373 |
||
374 |
case EValidateResumptionAfterWakeup: |
|
375 |
{ |
|
376 |
if(iStoredNewState == RUsbDevice::EDeviceActive) |
|
377 |
{ |
|
378 |
// Now suspend the device again after resumption from remote wakeup |
|
379 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
380 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP04, "Suspending interface 0"); |
0 | 381 |
iInterface0Watcher->SuspendAndWatch(); |
382 |
iSuspendedI0 = ETrue; |
|
383 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
384 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP05, "Suspending interface 1"); |
0 | 385 |
iInterface1Watcher->SuspendAndWatch(); |
386 |
iSuspendedI1 = ETrue; |
|
387 |
||
388 |
iCaseStep = EValidateSuspendAfterWakeup; |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
392 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP06, "<Error %d> Device is still suspended",KErrCompletion); |
0 | 393 |
TestFailed(KErrCompletion); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP02, this, KErrCompletion ); |
0 | 395 |
return KErrCompletion; |
396 |
} |
|
397 |
} |
|
398 |
break; |
|
399 |
||
400 |
default: |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
401 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP07, "CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications: Invalid state %d", iCaseStep); |
0 | 402 |
TestFailed(KErrCompletion); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP03, this, KErrCompletion ); |
0 | 404 |
return KErrCompletion; |
405 |
} |
|
406 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
407 |
OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP04, this, KErrNone ); |
0 | 408 |
return KErrNone; |
409 |
} |
|
410 |
||
411 |
void CUT_PBASE_T_USBDI_0473::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,TInt aCompletionCode) |
|
412 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
413 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_ENTRY, this ); |
0 | 414 |
Cancel(); |
415 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
416 |
OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL, "Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode); |
0 | 417 |
|
418 |
switch(iCaseStep) |
|
419 |
{ |
|
420 |
||
421 |
// Validate that the device was suspended by individual interface suspension |
|
422 |
||
423 |
case EValidateSuspendingInterfaces: |
|
424 |
{ |
|
425 |
if(aNewState == RUsbDevice::EDeviceSuspended) |
|
426 |
{ |
|
427 |
// Device state is suspended now resume it by resuming one of the interfaces |
|
428 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
429 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP01, "Device is suspended now resume device by resuming one of the interfaces"); |
0 | 430 |
iUsbInterface0.CancelPermitSuspend(); |
431 |
iCaseStep = EValidateResumptionAfterInterfaceSuspension; |
|
432 |
} |
|
433 |
else |
|
434 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
435 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP02, "<Error %d> State was not suspended",KErrCompletion); |
0 | 436 |
|
437 |
// Since the device is not suspended, send test case failed to the device |
|
438 |
||
439 |
iCaseStep = EFailed; |
|
440 |
TTestCaseFailed request(KErrCompletion,_L8("The device was not in the expected suspend state")); |
|
441 |
iControlEp0->SendRequest(request,this); |
|
442 |
} |
|
443 |
} |
|
444 |
break; |
|
445 |
||
446 |
// Validate that device is now active after resuming one of the interfaces |
|
447 |
||
448 |
case EValidateResumptionAfterInterfaceSuspension: |
|
449 |
{ |
|
450 |
iDeviceNotificationPending= EFalse; |
|
451 |
||
452 |
if(aNewState == RUsbDevice::EDeviceActive) |
|
453 |
{ |
|
454 |
CheckForAllResumedNotificationsAndContinueFSM(); |
|
455 |
} |
|
456 |
else |
|
457 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP03, "<Error %d> Device is still suspended",KErrCompletion); |
0 | 459 |
return TestFailed(KErrCompletion); |
460 |
} |
|
461 |
} |
|
462 |
break; |
|
463 |
||
464 |
// Validate that the device is now suspended for the device to remote-wakeup |
|
465 |
case EValidateSuspendForRemoteWakeup: |
|
466 |
{ |
|
467 |
if(aNewState == RUsbDevice::EDeviceSuspended) |
|
468 |
{ |
|
469 |
// Now awaiting a remote wake up state change notification |
|
470 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP04, "Now awaiting a remote wake up state change notification"); |
0 | 472 |
|
473 |
CancelTimeout(); |
|
474 |
iTimer.After(iStatus,10000000); // Give 10 seconds for device to signal remote wake-up |
|
475 |
iCaseStep = EValidateResumptionAfterWakeup; |
|
476 |
SetActive(); |
|
477 |
} |
|
478 |
else |
|
479 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP05, "<Error %d> State was not suspended",KErrCompletion); |
0 | 481 |
|
482 |
// Since the device is not suspended, send test case failed to the device |
|
483 |
||
484 |
iCaseStep = EFailed; |
|
485 |
TTestCaseFailed request(KErrCompletion,_L8("State was not suspended")); |
|
486 |
iControlEp0->SendRequest(request,this); |
|
487 |
} |
|
488 |
} |
|
489 |
break; |
|
490 |
||
491 |
// This step should never be reached as ep0 complete traps this step, but if it does test fails. |
|
492 |
case ESuspendForRemoteWakeup: |
|
493 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP06, "Resumed before suspended"); |
0 | 495 |
iCaseStep = EFailed; |
496 |
TTestCaseFailed request(KErrCompletion,_L8("State was not suspended")); |
|
497 |
iControlEp0->SendRequest(request,this); |
|
498 |
break; |
|
499 |
} |
|
500 |
||
501 |
// Validate that the device is now active from a remote wakeup |
|
502 |
case EValidateResumptionAfterWakeup: |
|
503 |
{ |
|
504 |
iDeviceNotificationPending= EFalse; |
|
505 |
iStoredNewState= aNewState; |
|
506 |
CheckForAllResumedNotificationsAndContinueFSM(); |
|
507 |
} |
|
508 |
break; |
|
509 |
||
510 |
// Validate that the device can be suspended after a remote wakeup |
|
511 |
||
512 |
case EValidateSuspendAfterWakeup: |
|
513 |
{ |
|
514 |
// Successfully suspended after a remote wake up event |
|
515 |
if(aNewState == RUsbDevice::EDeviceSuspended) |
|
516 |
{ |
|
517 |
// Device is now suspended, now activate the device again to send test case |
|
518 |
// completed request to device |
|
519 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
520 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP07, "Device is now suspended, now activate the device again to send test case completed request to device"); |
0 | 521 |
|
522 |
CUsbTestDevice& testDevice = iActorFDF->DeviceL(iDeviceHandle); |
|
523 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
524 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP08, "Resuming at device level"); |
0 | 525 |
TInt err(testDevice.Device().Resume()); |
526 |
if(err != KErrNone) |
|
527 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
528 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP09, "<Error %d> Unable to suspend the device",err); |
0 | 529 |
iCaseStep = EFailed; |
530 |
TTestCaseFailed request(err,_L8("Unable to suspend the device")); |
|
531 |
iControlEp0->SendRequest(request,this); |
|
532 |
} |
|
533 |
||
534 |
iCaseStep = EPassed; |
|
535 |
} |
|
536 |
else |
|
537 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP10, "<Error %d> State was not suspended",KErrCompletion); |
0 | 539 |
|
540 |
// Since the device is not suspended, send test case failed to the device |
|
541 |
||
542 |
iCaseStep = EFailed; |
|
543 |
TTestCaseFailed request(KErrCompletion,_L8("State was not suspended")); |
|
544 |
iControlEp0->SendRequest(request,this); |
|
545 |
} |
|
546 |
} |
|
547 |
break; |
|
548 |
||
549 |
// Validate that the device is now active again |
|
550 |
||
551 |
case EPassed: |
|
552 |
{ |
|
553 |
if(aNewState == RUsbDevice::EDeviceActive) |
|
554 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
555 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP11, "Device is active again, test case passed"); |
0 | 556 |
TTestCasePassed request; |
557 |
iControlEp0->SendRequest(request,this); |
|
558 |
} |
|
559 |
else |
|
560 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP12, "<Error %d> Device is still suspended",KErrCompletion); |
0 | 562 |
return TestFailed(KErrCompletion); |
563 |
} |
|
564 |
} |
|
565 |
break; |
|
566 |
||
567 |
default: |
|
568 |
break; |
|
569 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_EXIT, this ); |
0 | 571 |
} |
572 |
||
573 |
||
574 |
void CUT_PBASE_T_USBDI_0473::Ep0TransferCompleteL(TInt aCompletionCode) |
|
575 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
576 |
OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_ENTRY, this ); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
577 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode); |
0 | 578 |
switch(iCaseStep) |
579 |
{ |
|
580 |
case ESuspendForRemoteWakeup: |
|
581 |
{ |
|
582 |
// Suspend device again so a remote wakeup can be achieved |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
583 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP01, "Suspend device again so a remote wakeup can be achieved"); |
0 | 584 |
|
585 |
// Suspend interface 0 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
586 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP02, "Suspending interface 0"); |
0 | 587 |
iInterface0Watcher->SuspendAndWatch(); |
588 |
iSuspendedI0 = ETrue; |
|
589 |
||
590 |
// Suspend interface 1 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP03, "Suspending interface 1"); |
0 | 592 |
iInterface1Watcher->SuspendAndWatch(); |
593 |
iSuspendedI1 = ETrue; |
|
594 |
||
595 |
iCaseStep = EValidateSuspendForRemoteWakeup; |
|
596 |
TimeoutIn(10); // Give 10 seconds for device to suspend |
|
597 |
} |
|
598 |
break; |
|
599 |
||
600 |
// Fail the test case |
|
601 |
||
602 |
default: |
|
603 |
case EFailed: |
|
604 |
TestFailed(KErrCompletion); |
|
605 |
break; |
|
606 |
||
607 |
// Pass the test case |
|
608 |
||
609 |
case EPassed: |
|
610 |
TestPassed(); |
|
611 |
break; |
|
612 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
613 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_EXIT, this ); |
0 | 614 |
} |
615 |
||
616 |
||
617 |
void CUT_PBASE_T_USBDI_0473::HostRunL() |
|
618 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
619 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_ENTRY, this ); |
0 | 620 |
|
621 |
// Obtain the completion code |
|
622 |
TInt completionCode(iStatus.Int()); |
|
623 |
||
624 |
if(completionCode == KErrNone) |
|
625 |
{ |
|
626 |
// Action timeout |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
627 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL, "<Error> Action timeout"); |
0 | 628 |
TestFailed(KErrTimedOut); |
629 |
} |
|
630 |
else |
|
631 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
632 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode); |
0 | 633 |
TestFailed(completionCode); |
634 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
635 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_EXIT, this ); |
0 | 636 |
} |
637 |
||
638 |
||
639 |
void CUT_PBASE_T_USBDI_0473::DeviceRunL() |
|
640 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
641 |
OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_ENTRY, this ); |
0 | 642 |
|
643 |
// Disconnect the device |
|
644 |
||
645 |
iTestDevice->SoftwareDisconnect(); |
|
646 |
||
647 |
// Complete the test case request |
|
648 |
||
649 |
TestPolicy().SignalTestComplete(iStatus.Int()); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
650 |
OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_EXIT, this ); |
0 | 651 |
} |
652 |
||
653 |
||
654 |
} |