30 const TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool> |
34 const TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool> |
31 CUT_PBASE_T_USBDI_1231::iFunctor(KTestCaseId); |
35 CUT_PBASE_T_USBDI_1231::iFunctor(KTestCaseId); |
32 |
36 |
33 CUT_PBASE_T_USBDI_1231* CUT_PBASE_T_USBDI_1231::NewL(TBool aHostRole) |
37 CUT_PBASE_T_USBDI_1231* CUT_PBASE_T_USBDI_1231::NewL(TBool aHostRole) |
34 { |
38 { |
|
39 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_NEWL_ENTRY, aHostRole ); |
35 CUT_PBASE_T_USBDI_1231* self = new (ELeave) CUT_PBASE_T_USBDI_1231(aHostRole); |
40 CUT_PBASE_T_USBDI_1231* self = new (ELeave) CUT_PBASE_T_USBDI_1231(aHostRole); |
36 CleanupStack::PushL(self); |
41 CleanupStack::PushL(self); |
37 self->ConstructL(); |
42 self->ConstructL(); |
38 CleanupStack::Pop(self); |
43 CleanupStack::Pop(self); |
|
44 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_NEWL_EXIT, ( TUint )( self ) ); |
39 return self; |
45 return self; |
40 } |
46 } |
41 |
47 |
42 CUT_PBASE_T_USBDI_1231::CUT_PBASE_T_USBDI_1231(TBool aHostRole) : |
48 CUT_PBASE_T_USBDI_1231::CUT_PBASE_T_USBDI_1231(TBool aHostRole) : |
43 CBaseTestCase(KTestCaseId, aHostRole), iInterface0Resumed(EFalse) |
49 CBaseTestCase(KTestCaseId, aHostRole), iInterface0Resumed(EFalse) |
44 { |
50 { |
|
51 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY, this ); |
|
52 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT, this ); |
45 } |
53 } |
46 |
54 |
47 void CUT_PBASE_T_USBDI_1231::ConstructL() |
55 void CUT_PBASE_T_USBDI_1231::ConstructL() |
48 { |
56 { |
49 RDebug::Printf("====> Constructor entry priority = %d", RThread().Priority()); |
57 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_ENTRY, this ); |
|
58 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231, "====> Constructor entry priority = %d", RThread().Priority()); |
50 |
59 |
51 // Collect existing thread priority (to reinstate later) |
60 // Collect existing thread priority (to reinstate later) |
52 iPriority = RThread().Priority(); |
61 iPriority = RThread().Priority(); |
53 |
62 |
54 iTestDevice = new RUsbDeviceA(this); |
63 iTestDevice = new RUsbDeviceA(this); |
55 BaseConstructL(); |
64 BaseConstructL(); |
|
65 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_EXIT, this ); |
56 } |
66 } |
57 |
67 |
58 CUT_PBASE_T_USBDI_1231::~CUT_PBASE_T_USBDI_1231() |
68 CUT_PBASE_T_USBDI_1231::~CUT_PBASE_T_USBDI_1231() |
59 { |
69 { |
60 LOG_FUNC |
70 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY_DUP01, this ); |
61 |
71 |
62 RDebug::Printf("====> Destructor entry priority = %d", RThread().Priority()); |
72 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231, "====> Destructor entry priority = %d", RThread().Priority()); |
63 |
73 |
64 // Reinstate original priority |
74 // Reinstate original priority |
65 |
75 |
66 RThread().SetPriority(iPriority); |
76 RThread().SetPriority(iPriority); |
67 |
77 |
83 if (!IsHost() && iTestDevice) |
93 if (!IsHost() && iTestDevice) |
84 { |
94 { |
85 iTestDevice->Close(); |
95 iTestDevice->Close(); |
86 } |
96 } |
87 delete iTestDevice; |
97 delete iTestDevice; |
|
98 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT_DUP01, this ); |
88 } |
99 } |
89 |
100 |
90 void CUT_PBASE_T_USBDI_1231::ExecuteHostTestCaseL() |
101 void CUT_PBASE_T_USBDI_1231::ExecuteHostTestCaseL() |
91 { |
102 { |
92 LOG_FUNC |
103 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_ENTRY, this ); |
93 |
104 |
94 RDebug::Printf("====> ExecuteHostTestCaseL entry priority = %d", |
105 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP01, "====> ExecuteHostTestCaseL entry priority = %d", |
95 RThread().Priority()); |
106 RThread().Priority()); |
96 |
107 |
97 // Bump thread priority for this test only |
108 // Bump thread priority for this test only |
98 |
109 |
99 RThread().SetPriority(EPriorityAbsoluteHigh); |
110 RThread().SetPriority(EPriorityAbsoluteHigh); |
100 RDebug::Printf("Thread priority raised %d->%d", iPriority, RThread().Priority()); |
111 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority()); |
101 |
112 |
102 iCaseStep = EInProcess; |
113 iCaseStep = EInProcess; |
103 iActorFDF = CActorFDF::NewL(*this); |
114 iActorFDF = CActorFDF::NewL(*this); |
104 iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0); |
115 iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0); |
105 iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1231::Interface0ResumedL,this)); |
116 iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1231::Interface0ResumedL,this)); |
108 // Monitor for device connections |
119 // Monitor for device connections |
109 iActorFDF->Monitor(); |
120 iActorFDF->Monitor(); |
110 |
121 |
111 // Start the connection timeout |
122 // Start the connection timeout |
112 TimeoutIn(30); |
123 TimeoutIn(30); |
|
124 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_EXIT, this ); |
113 } |
125 } |
114 |
126 |
115 void CUT_PBASE_T_USBDI_1231::ExecuteDeviceTestCaseL() |
127 void CUT_PBASE_T_USBDI_1231::ExecuteDeviceTestCaseL() |
116 { |
128 { |
117 LOG_FUNC |
129 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_EXECUTEDEVICETESTCASEL_ENTRY, this ); |
118 |
130 |
119 // Construct the device for the test case |
131 // Construct the device for the test case |
120 iTestDevice->OpenL(TestCaseId()); |
132 iTestDevice->OpenL(TestCaseId()); |
121 iTestDevice->SubscribeToReports(iStatus); |
133 iTestDevice->SubscribeToReports(iStatus); |
122 SetActive(); |
134 SetActive(); |
123 |
135 |
124 // Connect the test device |
136 // Connect the test device |
125 iTestDevice->SoftwareConnect(); |
137 iTestDevice->SoftwareConnect(); |
|
138 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEDEVICETESTCASEL_EXIT, this ); |
126 } |
139 } |
127 |
140 |
128 void CUT_PBASE_T_USBDI_1231::HostDoCancel() |
141 void CUT_PBASE_T_USBDI_1231::HostDoCancel() |
129 { |
142 { |
130 LOG_FUNC |
143 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_ENTRY, this ); |
131 |
144 |
132 RDebug::Printf("====> HostDoCancel entry priority = %d", RThread().Priority()); |
145 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority()); |
133 |
146 |
134 // Cancel the timeout timer |
147 // Cancel the timeout timer |
135 CancelTimeout(); |
148 CancelTimeout(); |
|
149 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_EXIT, this ); |
136 } |
150 } |
137 |
151 |
138 void CUT_PBASE_T_USBDI_1231::DeviceDoCancel() |
152 void CUT_PBASE_T_USBDI_1231::DeviceDoCancel() |
139 { |
153 { |
140 LOG_FUNC |
154 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_DEVICEDOCANCEL_ENTRY, this ); |
141 |
155 |
142 // Cancel the device |
156 // Cancel the device |
143 iTestDevice->CancelSubscriptionToReports(); |
157 iTestDevice->CancelSubscriptionToReports(); |
|
158 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEDOCANCEL_EXIT, this ); |
144 } |
159 } |
145 |
160 |
146 void CUT_PBASE_T_USBDI_1231::DeviceInsertedL(TUint aDeviceHandle) |
161 void CUT_PBASE_T_USBDI_1231::DeviceInsertedL(TUint aDeviceHandle) |
147 { |
162 { |
148 LOG_FUNC |
163 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_ENTRY, this ); |
149 |
164 |
150 RDebug::Printf("====> DeviceInsertedL entry priority = %d", RThread().Priority()); |
165 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority()); |
151 |
166 |
152 iInterface0Resumed = EFalse; |
167 iInterface0Resumed = EFalse; |
153 |
168 |
154 Cancel(); // Cancel the timer |
169 Cancel(); // Cancel the timer |
155 TInt err(KErrNone); |
170 TInt err(KErrNone); |
179 case EInProcess: |
195 case EInProcess: |
180 { |
196 { |
181 TUint32 token1(0); |
197 TUint32 token1(0); |
182 TUint32 token2(0); |
198 TUint32 token2(0); |
183 |
199 |
184 RDebug::Printf("Obtaining token for interface 0"); |
200 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP05, "Obtaining token for interface 0"); |
185 err = testDevice.Device().GetTokenForInterface(0, token1); |
201 err = testDevice.Device().GetTokenForInterface(0, token1); |
186 if (err != KErrNone) |
202 if (err != KErrNone) |
187 { |
203 { |
188 RDebug::Printf( |
204 RDebug::Printf( |
189 "<Error %d> Token for interface 0 could not be retrieved", |
205 "<Error %d> Token for interface 0 could not be retrieved", |
190 err); |
206 err); |
191 return TestFailed(err); |
207 return TestFailed(err); |
192 } |
208 } |
193 RDebug::Printf("Token 1 (%d) retrieved", token1); |
209 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP06, "Token 1 (%d) retrieved", token1); |
194 RDebug::Printf("Opening interface 0"); |
210 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP07, "Opening interface 0"); |
195 err = iUsbInterface0.Open(token1); // Alternate interface setting 0 |
211 err = iUsbInterface0.Open(token1); // Alternate interface setting 0 |
196 if (err != KErrNone) |
212 if (err != KErrNone) |
197 { |
213 { |
198 RDebug::Printf( |
214 RDebug::Printf( |
199 "<Error %d> Interface 0 could not be opened", err); |
215 "<Error %d> Interface 0 could not be opened", err); |
200 return TestFailed(err); |
216 return TestFailed(err); |
201 } |
217 } |
202 RDebug::Printf("Interface 0 opened"); |
218 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP08, "Interface 0 opened"); |
203 |
219 |
204 RDebug::Printf("Obtaining token for interface 1"); |
220 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP09, "Obtaining token for interface 1"); |
205 err = testDevice.Device().GetTokenForInterface(1, token2); |
221 err = testDevice.Device().GetTokenForInterface(1, token2); |
206 if (err != KErrNone) |
222 if (err != KErrNone) |
207 { |
223 { |
208 RDebug::Printf( |
224 RDebug::Printf( |
209 "<Error %d> Token for interface 1 could not be retrieved", |
225 "<Error %d> Token for interface 1 could not be retrieved", |
210 err); |
226 err); |
211 return TestFailed(err); |
227 return TestFailed(err); |
212 } |
228 } |
213 RDebug::Printf("Opening interface 1"); |
229 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP10, "Opening interface 1"); |
214 err = iUsbInterface1.Open(token2); // Alternate interface setting 0 |
230 err = iUsbInterface1.Open(token2); // Alternate interface setting 0 |
215 if (err != KErrNone) |
231 if (err != KErrNone) |
216 { |
232 { |
217 RDebug::Printf( |
233 RDebug::Printf( |
218 "<Error %d> Interface 1 could not be opened", err); |
234 "<Error %d> Interface 1 could not be opened", err); |
219 return TestFailed(err); |
235 return TestFailed(err); |
220 } |
236 } |
221 RDebug::Printf("Interface 1 opened"); |
237 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP11, "Interface 1 opened"); |
222 |
238 |
223 ResumeWhenSuspending(); |
239 ResumeWhenSuspending(); |
224 |
240 |
225 } |
241 } |
226 break; |
242 break; |
227 |
243 |
228 default: |
244 default: |
229 TestFailed(KErrCorrupt); |
245 TestFailed(KErrCorrupt); |
230 break; |
246 break; |
231 } |
247 } |
|
248 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_EXIT_DUP01, this ); |
232 } |
249 } |
233 |
250 |
234 TInt CUT_PBASE_T_USBDI_1231::Interface0ResumedL(TAny* aPtr) |
251 TInt CUT_PBASE_T_USBDI_1231::Interface0ResumedL(TAny* aPtr) |
235 { |
252 { |
236 LOG_CFUNC |
253 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_INTERFACE0RESUMEDL_ENTRY, 0 ); |
237 |
254 |
238 RDebug::Printf("====> Interface0ResumedL entry priority = %d", RThread().Priority()); |
255 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP12, "====> Interface0ResumedL entry priority = %d", RThread().Priority()); |
239 |
256 |
240 RDebug::Printf("-Interface 0 resumed"); |
257 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP13, "-Interface 0 resumed"); |
241 CUT_PBASE_T_USBDI_1231* self = |
258 CUT_PBASE_T_USBDI_1231* self = |
242 reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr); |
259 reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr); |
243 |
260 |
244 TInt completionCode=self->iInterface0Watcher->CompletionCode(); |
261 TInt completionCode=self->iInterface0Watcher->CompletionCode(); |
245 |
262 |
246 TInt testStep = self->iCaseStep; |
263 TInt testStep = self->iCaseStep; |
247 RDebug::Printf(" -watcher 0 iStatus = %d <teststep %d>",completionCode, testStep); |
264 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP14, " -watcher 0 iStatus = %d <teststep %d>",completionCode, testStep); |
248 |
265 |
249 self->iInterface0Resumed = ETrue; |
266 self->iInterface0Resumed = ETrue; |
250 |
267 |
251 switch (self->iCaseStep) |
268 switch (self->iCaseStep) |
252 { |
269 { |
253 |
270 |
254 case EValidResumeWhenSuspending: |
271 case EValidResumeWhenSuspending: |
255 { |
272 { |
256 if (completionCode == KErrNone) |
273 if (completionCode == KErrNone) |
257 { |
274 { |
258 RDebug::Printf("Device resume while suspending succeed!"); |
275 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP15, "Device resume while suspending succeed!"); |
259 self->TimeoutIn(10); |
276 self->TimeoutIn(10); |
260 self->iCaseStep = EPassed; |
277 self->iCaseStep = EPassed; |
261 self->SendEp0Request(); |
278 self->SendEp0Request(); |
262 } |
279 } |
263 else |
280 else |
273 |
290 |
274 default: |
291 default: |
275 break; |
292 break; |
276 }; |
293 }; |
277 |
294 |
|
295 OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE0RESUMEDL_EXIT, 0, KErrNone ); |
278 return KErrNone; |
296 return KErrNone; |
279 } |
297 } |
280 |
298 |
281 TInt CUT_PBASE_T_USBDI_1231::Interface1ResumedL(TAny* aPtr) |
299 TInt CUT_PBASE_T_USBDI_1231::Interface1ResumedL(TAny* aPtr) |
282 { |
300 { |
283 LOG_CFUNC |
301 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_ENTRY, 0 ); |
284 |
302 |
285 RDebug::Printf("====> Interface1ResumedL entry priority = %d", RThread().Priority()); |
303 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP16, "====> Interface1ResumedL entry priority = %d", RThread().Priority()); |
286 |
304 |
287 RDebug::Printf("Interface 1 resumed"); |
305 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP17, "Interface 1 resumed"); |
288 CUT_PBASE_T_USBDI_1231* self = |
306 CUT_PBASE_T_USBDI_1231* self = |
289 reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr); |
307 reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr); |
290 RDebug::Printf("watcher 1 iStatus=%d", |
308 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP18, "watcher 1 iStatus=%d", |
291 self->iInterface1Watcher->CompletionCode()); |
309 self->iInterface1Watcher->CompletionCode()); |
|
310 OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_EXIT, 0, KErrNone ); |
292 return KErrNone; |
311 return KErrNone; |
293 } |
312 } |
294 |
313 |
295 void CUT_PBASE_T_USBDI_1231::DeviceRemovedL(TUint aDeviceHandle) |
314 void CUT_PBASE_T_USBDI_1231::DeviceRemovedL(TUint aDeviceHandle) |
296 { |
315 { |
297 LOG_FUNC |
316 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICEREMOVEDL_ENTRY, this ); |
298 |
317 |
299 // The test device should not be removed until the test case has passed |
318 // The test device should not be removed until the test case has passed |
300 // so this test case has not completed, and state this event as an error |
319 // so this test case has not completed, and state this event as an error |
301 |
320 |
302 TestFailed(KErrDisconnected); |
321 TestFailed(KErrDisconnected); |
|
322 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEREMOVEDL_EXIT, this ); |
303 } |
323 } |
304 |
324 |
305 void CUT_PBASE_T_USBDI_1231::BusErrorL(TInt aError) |
325 void CUT_PBASE_T_USBDI_1231::BusErrorL(TInt aError) |
306 { |
326 { |
307 LOG_FUNC |
327 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_BUSERRORL_ENTRY, this ); |
308 |
328 |
309 // This test case handles no failiures on the bus |
329 // This test case handles no failiures on the bus |
310 |
330 |
311 TestFailed(aError); |
331 TestFailed(aError); |
|
332 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_BUSERRORL_EXIT, this ); |
312 } |
333 } |
313 |
334 |
314 void CUT_PBASE_T_USBDI_1231::DeviceStateChangeL( |
335 void CUT_PBASE_T_USBDI_1231::DeviceStateChangeL( |
315 RUsbDevice::TDeviceState aPreviousState, |
336 RUsbDevice::TDeviceState aPreviousState, |
316 RUsbDevice::TDeviceState aNewState, TInt aCompletionCode) |
337 RUsbDevice::TDeviceState aNewState, TInt aCompletionCode) |
317 { |
338 { |
318 LOG_FUNC |
339 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICESTATECHANGEL_ENTRY, this ); |
319 Cancel(); |
340 Cancel(); |
320 |
341 |
321 // test RInterface , the RUsbDevice notification logic not used . |
342 // test RInterface , the RUsbDevice notification logic not used . |
322 RDebug::Printf(" -Device State change from %d to %d err=%d", |
343 OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP19, " -Device State change from %d to %d err=%d", |
323 aPreviousState, aNewState, aCompletionCode); |
344 aPreviousState, aNewState, aCompletionCode); |
324 |
345 |
325 switch (iCaseStep) |
346 switch (iCaseStep) |
326 { |
347 { |
327 case EValidDeviceSuspend: |
348 case EValidDeviceSuspend: |
328 if (aNewState == RUsbDevice::EDeviceSuspended) |
349 if (aNewState == RUsbDevice::EDeviceSuspended) |
329 { |
350 { |
330 RDebug::Printf("Device suspend!"); |
351 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP20, "Device suspend!"); |
331 iCaseStep = EValidDeviceResume; |
352 iCaseStep = EValidDeviceResume; |
332 } |
353 } |
333 else |
354 else |
334 { |
355 { |
335 RDebug::Printf("Device suspend failed!"); |
356 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP21, "Device suspend failed!"); |
336 iCaseStep = EFailed; |
357 iCaseStep = EFailed; |
337 SendEp0Request(); |
358 SendEp0Request(); |
338 } |
359 } |
339 break; |
360 break; |
340 case EValidDeviceResume: |
361 case EValidDeviceResume: |
341 |
362 |
342 if (aNewState == RUsbDevice::EDeviceActive) |
363 if (aNewState == RUsbDevice::EDeviceActive) |
343 { |
364 { |
344 RDebug::Printf("Device resume!"); |
365 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP22, "Device resume!"); |
345 if (!iInterface0Resumed) |
366 if (!iInterface0Resumed) |
346 { |
367 { |
347 iCaseStep = EValidResumeWhenSuspending; |
368 iCaseStep = EValidResumeWhenSuspending; |
348 } |
369 } |
349 else |
370 else |
380 |
402 |
381 case EPassed: |
403 case EPassed: |
382 TestPassed(); |
404 TestPassed(); |
383 break; |
405 break; |
384 } |
406 } |
|
407 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_EXIT, this ); |
385 } |
408 } |
386 |
409 |
387 void CUT_PBASE_T_USBDI_1231::HostRunL() |
410 void CUT_PBASE_T_USBDI_1231::HostRunL() |
388 { |
411 { |
389 LOG_FUNC |
412 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_HOSTRUNL_ENTRY, this ); |
390 |
413 |
391 RDebug::Printf("====> HostRunL entry priority = %d", RThread().Priority()); |
414 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP24, "====> HostRunL entry priority = %d", RThread().Priority()); |
392 |
415 |
393 // Obtain the completion code |
416 // Obtain the completion code |
394 TInt completionCode(iStatus.Int()); |
417 TInt completionCode(iStatus.Int()); |
395 |
418 |
396 if (completionCode == KErrNone) |
419 if (completionCode == KErrNone) |
397 { |
420 { |
398 // Action timeout |
421 // Action timeout |
399 RDebug::Printf("<Error> Action timeout"); |
422 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP25, "<Error> Action timeout"); |
400 TestFailed(KErrTimedOut); |
423 TestFailed(KErrTimedOut); |
401 } |
424 } |
402 else |
425 else |
403 { |
426 { |
404 RDebug::Printf("<Error %d> Timeout timer could not complete", |
427 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP26, "<Error %d> Timeout timer could not complete", |
405 completionCode); |
428 completionCode); |
406 TestFailed(completionCode); |
429 TestFailed(completionCode); |
407 } |
430 } |
|
431 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTRUNL_EXIT, this ); |
408 } |
432 } |
409 |
433 |
410 void CUT_PBASE_T_USBDI_1231::DeviceRunL() |
434 void CUT_PBASE_T_USBDI_1231::DeviceRunL() |
411 { |
435 { |
412 LOG_FUNC |
436 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_DEVICERUNL_ENTRY, this ); |
413 |
437 |
414 // Disconnect the device |
438 // Disconnect the device |
415 |
439 |
416 iTestDevice->SoftwareDisconnect(); |
440 iTestDevice->SoftwareDisconnect(); |
417 |
441 |
418 // Complete the test case request |
442 // Complete the test case request |
419 |
443 |
420 TestPolicy().SignalTestComplete(iStatus.Int()); |
444 TestPolicy().SignalTestComplete(iStatus.Int()); |
|
445 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICERUNL_EXIT, this ); |
421 } |
446 } |
422 |
447 |
423 void CUT_PBASE_T_USBDI_1231::ResumeWhenSuspending() |
448 void CUT_PBASE_T_USBDI_1231::ResumeWhenSuspending() |
424 { |
449 { |
425 RDebug::Printf("====> ResumeWhenSuspending entry priority = %d", |
450 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_ENTRY, this ); |
|
451 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP27, "====> ResumeWhenSuspending entry priority = %d", |
426 RThread().Priority()); |
452 RThread().Priority()); |
427 |
453 |
428 // Suspend interface 0 |
454 // Suspend interface 0 |
429 RDebug::Printf("Suspending interface 0"); |
455 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP28, "Suspending interface 0"); |
430 iInterface0Watcher->SuspendAndWatch(); |
456 iInterface0Watcher->SuspendAndWatch(); |
431 |
457 |
432 // Suspend interface 1 |
458 // Suspend interface 1 |
433 RDebug::Printf("Suspending interface 1"); |
459 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP29, "Suspending interface 1"); |
434 iInterface1Watcher->SuspendAndWatch(); |
460 iInterface1Watcher->SuspendAndWatch(); |
435 |
461 |
436 // Cancel suspend-in-progress |
462 // Cancel suspend-in-progress |
437 RDebug::Printf("Cancel Suspend interface 0"); |
463 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP30, "Cancel Suspend interface 0"); |
438 iUsbInterface0.CancelPermitSuspend(); |
464 iUsbInterface0.CancelPermitSuspend(); |
439 |
465 |
440 iCaseStep = EValidDeviceSuspend; |
466 iCaseStep = EValidDeviceSuspend; |
441 |
467 |
|
468 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_EXIT, this ); |
442 } |
469 } |
443 |
470 |
444 void CUT_PBASE_T_USBDI_1231::SendEp0Request() |
471 void CUT_PBASE_T_USBDI_1231::SendEp0Request() |
445 { |
472 { |
|
473 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_ENTRY, this ); |
446 TTestCasePassed request; |
474 TTestCasePassed request; |
447 iControlEp0->SendRequest(request, this); |
475 iControlEp0->SendRequest(request, this); |
|
476 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_EXIT, this ); |
448 } |
477 } |
449 |
478 |
450 }//end namespace |
479 }//end namespace |
451 |
480 |
452 |
481 |