63 _LIT(KTestCaseId,"PBASE-T_USBDI-0498"); |
67 _LIT(KTestCaseId,"PBASE-T_USBDI-0498"); |
64 const TFunctorTestCase<CUT_PBASE_T_USBDI_0498,TBool> CUT_PBASE_T_USBDI_0498::iFunctor(KTestCaseId); |
68 const TFunctorTestCase<CUT_PBASE_T_USBDI_0498,TBool> CUT_PBASE_T_USBDI_0498::iFunctor(KTestCaseId); |
65 |
69 |
66 CUT_PBASE_T_USBDI_0498* CUT_PBASE_T_USBDI_0498::NewL(TBool aHostRole) |
70 CUT_PBASE_T_USBDI_0498* CUT_PBASE_T_USBDI_0498::NewL(TBool aHostRole) |
67 { |
71 { |
|
72 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0498_NEWL_ENTRY, aHostRole ); |
68 CUT_PBASE_T_USBDI_0498* self = new (ELeave) CUT_PBASE_T_USBDI_0498(aHostRole); |
73 CUT_PBASE_T_USBDI_0498* self = new (ELeave) CUT_PBASE_T_USBDI_0498(aHostRole); |
69 CleanupStack::PushL(self); |
74 CleanupStack::PushL(self); |
70 self->ConstructL(); |
75 self->ConstructL(); |
71 CleanupStack::Pop(self); |
76 CleanupStack::Pop(self); |
|
77 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_NEWL_EXIT, ( TUint )( self ) ); |
72 return self; |
78 return self; |
73 } |
79 } |
74 |
80 |
75 |
81 |
76 CUT_PBASE_T_USBDI_0498::CUT_PBASE_T_USBDI_0498(TBool aHostRole) |
82 CUT_PBASE_T_USBDI_0498::CUT_PBASE_T_USBDI_0498(TBool aHostRole) |
77 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
83 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
78 iCaseStep(EInProgress), |
84 iCaseStep(EInProgress), |
79 iRequestDeviceValidationResultPtr(NULL,0) |
85 iRequestDeviceValidationResultPtr(NULL,0) |
80 { |
86 { |
|
87 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0498_CUT_PBASE_T_USBDI_0498_ENTRY, this ); |
|
88 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_CUT_PBASE_T_USBDI_0498_EXIT, this ); |
81 } |
89 } |
82 |
90 |
83 |
91 |
84 void CUT_PBASE_T_USBDI_0498::ConstructL() |
92 void CUT_PBASE_T_USBDI_0498::ConstructL() |
85 { |
93 { |
|
94 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0498_CONSTRUCTL_ENTRY, this ); |
86 BaseBulkConstructL(); |
95 BaseBulkConstructL(); |
87 |
96 |
88 iInBuffer = HBufC8::NewL(KTestBufferLength); |
97 iInBuffer = HBufC8::NewL(KTestBufferLength); |
89 RDebug::Printf("CUT_PBASE_T_USBDI_0491::ConstructL(): buffer created"); |
98 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_CONSTRUCTL, "CUT_PBASE_T_USBDI_0491::ConstructL(): buffer created"); |
|
99 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_CONSTRUCTL_EXIT, this ); |
90 } |
100 } |
91 |
101 |
92 |
102 |
93 CUT_PBASE_T_USBDI_0498::~CUT_PBASE_T_USBDI_0498() |
103 CUT_PBASE_T_USBDI_0498::~CUT_PBASE_T_USBDI_0498() |
94 /** |
104 /** |
95 The transfer objects have test specific names - so perform transfer specific clean up here. |
105 The transfer objects have test specific names - so perform transfer specific clean up here. |
96 */ |
106 */ |
97 { |
107 { |
98 LOG_FUNC |
108 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0498_CUT_PBASE_T_USBDI_0498_ENTRY_DUP01, this ); |
99 |
109 |
100 Cancel(); |
110 Cancel(); |
101 |
111 |
102 //Do this before deleting the transfer objects |
112 //Do this before deleting the transfer objects |
103 CloseInterfaceAndPipes(); |
113 CloseInterfaceAndPipes(); |
115 delete iIfc1InTransfer[count]; |
125 delete iIfc1InTransfer[count]; |
116 iIfc1InTransfer[count] = NULL; |
126 iIfc1InTransfer[count] = NULL; |
117 delete iIfc2InTransfer[count]; |
127 delete iIfc2InTransfer[count]; |
118 iIfc2InTransfer[count] = NULL; |
128 iIfc2InTransfer[count] = NULL; |
119 } |
129 } |
|
130 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_CUT_PBASE_T_USBDI_0498_EXIT_DUP01, this ); |
120 } |
131 } |
121 |
132 |
122 |
133 |
123 void CUT_PBASE_T_USBDI_0498::Ep0TransferCompleteL(TInt aCompletionCode) |
134 void CUT_PBASE_T_USBDI_0498::Ep0TransferCompleteL(TInt aCompletionCode) |
124 { |
135 { |
125 LOG_FUNC |
136 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_ENTRY, this ); |
126 |
137 |
127 RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode); |
138 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode); |
128 |
139 |
129 if(aCompletionCode != KErrNone) |
140 if(aCompletionCode != KErrNone) |
130 { |
141 { |
131 if(iCaseStep == EFailed) |
142 if(iCaseStep == EFailed) |
132 {// ignore error, nad catch the TestFailed method called further down. |
143 {// ignore error, nad catch the TestFailed method called further down. |
133 RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***"); |
144 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***"); |
134 } |
145 } |
135 else |
146 else |
136 { |
147 { |
137 TBuf<256> msg; |
148 TBuf<256> msg; |
138 msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode); |
149 msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode); |
139 RDebug::Print(msg); |
150 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP02, msg); |
140 iCaseStep = EFailed; |
151 iCaseStep = EFailed; |
141 TTestCaseFailed request(aCompletionCode,msg); |
152 TTestCaseFailed request(aCompletionCode,msg); |
142 iControlEp0->SendRequest(request,this); |
153 iControlEp0->SendRequest(request,this); |
|
154 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_EXIT, this ); |
143 return; |
155 return; |
144 } |
156 } |
145 } |
157 } |
146 |
158 |
147 switch(iCaseStep) |
159 switch(iCaseStep) |
156 TestFailed(KErrCompletion); |
168 TestFailed(KErrCompletion); |
157 break; |
169 break; |
158 |
170 |
159 case ERequestDeviceIFC1Read: |
171 case ERequestDeviceIFC1Read: |
160 { |
172 { |
161 RDebug::Printf("Asking client for 'Read' on interface 2"); |
173 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP03, "Asking client for 'Read' on interface 2"); |
162 iCaseStep = ERequestDeviceIFC2Read; |
174 iCaseStep = ERequestDeviceIFC2Read; |
163 TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number |
175 TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number |
164 iControlEp0->SendRequest(request,this); |
176 iControlEp0->SendRequest(request,this); |
165 } |
177 } |
166 break; |
178 break; |
167 |
179 |
168 case ERequestDeviceIFC2Read: |
180 case ERequestDeviceIFC2Read: |
169 { |
181 { |
170 RDebug::Printf("Asking client to 'Write' on interface 1"); |
182 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP04, "Asking client to 'Write' on interface 1"); |
171 iCaseStep = ERequestDeviceIFC1Write; |
183 iCaseStep = ERequestDeviceIFC1Write; |
172 TEndpointPatternWriteRequest request(1,1,KLiteralFrench4(),KDeviceNumWriteBytes); |
184 TEndpointPatternWriteRequest request(1,1,KLiteralFrench4(),KDeviceNumWriteBytes); |
173 iControlEp0->SendRequest(request,this); |
185 iControlEp0->SendRequest(request,this); |
174 } |
186 } |
175 break; |
187 break; |
176 |
188 |
177 case ERequestDeviceIFC1Write: |
189 case ERequestDeviceIFC1Write: |
178 { |
190 { |
179 RDebug::Printf("Asking client to 'Write' on interface 2"); |
191 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP05, "Asking client to 'Write' on interface 2"); |
180 iCaseStep = ERequestDeviceIFC2Write; |
192 iCaseStep = ERequestDeviceIFC2Write; |
181 TEndpointPatternWriteRequest request(2,1,KLiteralEnglish2(),KDeviceNumWriteBytes); |
193 TEndpointPatternWriteRequest request(2,1,KLiteralEnglish2(),KDeviceNumWriteBytes); |
182 iControlEp0->SendRequest(request,this); |
194 iControlEp0->SendRequest(request,this); |
183 } |
195 } |
184 break; |
196 break; |
185 |
197 |
186 case ERequestDeviceIFC2Write: |
198 case ERequestDeviceIFC2Write: |
187 { |
199 { |
188 RDebug::Printf("Try to perform ALL transfers on BOTH interfaces"); |
200 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP06, "Try to perform ALL transfers on BOTH interfaces"); |
189 |
201 |
190 iCaseStep = ETransfer; |
202 iCaseStep = ETransfer; |
191 |
203 |
192 iStartTime[0].HomeTime(); |
204 iStartTime[0].HomeTime(); |
193 iStartTime[1].HomeTime(); |
205 iStartTime[1].HomeTime(); |
207 break; |
219 break; |
208 |
220 |
209 case ERequestDeviceValidateIFC1: |
221 case ERequestDeviceValidateIFC1: |
210 { |
222 { |
211 iCaseStep = ERequestDeviceValidationResultIFC1; |
223 iCaseStep = ERequestDeviceValidationResultIFC1; |
212 RDebug::Printf("Interface 1: Request Client Validation Result"); |
224 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP07, "Interface 1: Request Client Validation Result"); |
213 iRequestDeviceValidationResultPtr.Set(iInBuffer->Des()); |
225 iRequestDeviceValidationResultPtr.Set(iInBuffer->Des()); |
214 iRequestDeviceValidationResultPtr.Zero(); //reset |
226 iRequestDeviceValidationResultPtr.Zero(); //reset |
215 iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength); |
227 iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength); |
216 TInterfaceGetPayloadRequest request(1,iRequestDeviceValidationResultPtr); |
228 TInterfaceGetPayloadRequest request(1,iRequestDeviceValidationResultPtr); |
217 iControlEp0->SendRequest(request,this); |
229 iControlEp0->SendRequest(request,this); |
218 } |
230 } |
219 break; |
231 break; |
220 |
232 |
221 case ERequestDeviceValidationResultIFC1: |
233 case ERequestDeviceValidationResultIFC1: |
222 { |
234 { |
223 RDebug::Printf("Interface 1: Client Validation Result string ..."); |
235 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP08, "Interface 1: Client Validation Result string ..."); |
224 RDebug::RawPrint(*iInBuffer); |
236 OstTraceData(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP58, "", iInBuffer->Ptr(), iInBuffer->Length()); |
225 RDebug::Printf("\n"); |
237 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP09, "\n"); |
226 TPtr8 ptr(iInBuffer->Des()); |
238 TPtr8 ptr(iInBuffer->Des()); |
227 if(ptr.Compare(KClientPassString) == 0) |
239 if(ptr.Compare(KClientPassString) == 0) |
228 { |
240 { |
229 RDebug::Printf("Client Validation Interface 1 Result is a PASS"); |
241 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP10, "Client Validation Interface 1 Result is a PASS"); |
230 RDebug::Printf("Now performing Client Validation for Interface 2"); |
242 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP11, "Now performing Client Validation for Interface 2"); |
231 iCaseStep = ERequestDeviceValidateIFC2; |
243 iCaseStep = ERequestDeviceValidateIFC2; |
232 TEndpointStringValidationRequest request(2,1,KLiteralEnglish2(),KDeviceNumReadBytes); |
244 TEndpointStringValidationRequest request(2,1,KLiteralEnglish2(),KDeviceNumReadBytes); |
233 iControlEp0->SendRequest(request,this); |
245 iControlEp0->SendRequest(request,this); |
234 } |
246 } |
235 else |
247 else |
236 { |
248 { |
237 TBuf<256> msg; |
249 TBuf<256> msg; |
238 msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful")); |
250 msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful")); |
239 RDebug::Print(msg); |
251 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP12, msg); |
240 iCaseStep = EFailed; |
252 iCaseStep = EFailed; |
241 TTestCaseFailed request(KErrCorrupt,msg); |
253 TTestCaseFailed request(KErrCorrupt,msg); |
242 iControlEp0->SendRequest(request,this); |
254 iControlEp0->SendRequest(request,this); |
243 } |
255 } |
244 } |
256 } |
245 break; |
257 break; |
246 |
258 |
247 case ERequestDeviceValidateIFC2: |
259 case ERequestDeviceValidateIFC2: |
248 { |
260 { |
249 iCaseStep = ERequestDeviceValidationResultIFC2; |
261 iCaseStep = ERequestDeviceValidationResultIFC2; |
250 RDebug::Printf("Interface 2: Request Client Validation Result"); |
262 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP13, "Interface 2: Request Client Validation Result"); |
251 iRequestDeviceValidationResultPtr.Set(iInBuffer->Des()); |
263 iRequestDeviceValidationResultPtr.Set(iInBuffer->Des()); |
252 iRequestDeviceValidationResultPtr.Zero(); //reset |
264 iRequestDeviceValidationResultPtr.Zero(); //reset |
253 iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength); |
265 iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength); |
254 TInterfaceGetPayloadRequest request(2,iRequestDeviceValidationResultPtr); |
266 TInterfaceGetPayloadRequest request(2,iRequestDeviceValidationResultPtr); |
255 iControlEp0->SendRequest(request,this); |
267 iControlEp0->SendRequest(request,this); |
256 } |
268 } |
257 break; |
269 break; |
258 |
270 |
259 case ERequestDeviceValidationResultIFC2: |
271 case ERequestDeviceValidationResultIFC2: |
260 { |
272 { |
261 RDebug::Printf("Interface 1: Client Validation Result string ..."); |
273 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP14, "Interface 1: Client Validation Result string ..."); |
262 RDebug::RawPrint(*iInBuffer); |
274 OstTraceData(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP54, "", iInBuffer->Ptr(), iInBuffer->Length()); |
263 RDebug::Printf("\n"); |
275 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP15, "\n"); |
264 TPtr8 ptr(iInBuffer->Des()); |
276 TPtr8 ptr(iInBuffer->Des()); |
265 if(ptr.Compare(KClientPassString) == 0) |
277 if(ptr.Compare(KClientPassString) == 0) |
266 { |
278 { |
267 RDebug::Printf("Client Validation Interface 2 Result is a PASS"); |
279 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP16, "Client Validation Interface 2 Result is a PASS"); |
268 RDebug::Printf("This is the FINAL check - the whole test has a PASSED"); |
280 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP17, "This is the FINAL check - the whole test has a PASSED"); |
269 iCaseStep = EPassed; |
281 iCaseStep = EPassed; |
270 TTestCasePassed request; |
282 TTestCasePassed request; |
271 iControlEp0->SendRequest(request,this); |
283 iControlEp0->SendRequest(request,this); |
272 } |
284 } |
273 else |
285 else |
274 { |
286 { |
275 TBuf<256> msg; |
287 TBuf<256> msg; |
276 msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful")); |
288 msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful")); |
277 RDebug::Print(msg); |
289 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP18, msg); |
278 iCaseStep = EFailed; |
290 iCaseStep = EFailed; |
279 TTestCaseFailed request(KErrCorrupt,msg); |
291 TTestCaseFailed request(KErrCorrupt,msg); |
280 iControlEp0->SendRequest(request,this); |
292 iControlEp0->SendRequest(request,this); |
281 } |
293 } |
282 } |
294 } |
283 break; |
295 break; |
284 |
296 |
285 default: |
297 default: |
286 RDebug::Printf("<Error> Unknown test step"); |
298 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_DUP19, "<Error> Unknown test step"); |
287 TestFailed(KErrUnknown); |
299 TestFailed(KErrUnknown); |
288 break; |
300 break; |
289 } |
301 } |
|
302 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this ); |
290 } |
303 } |
291 |
304 |
292 void CUT_PBASE_T_USBDI_0498::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
305 void CUT_PBASE_T_USBDI_0498::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
293 { |
306 { |
294 LOG_FUNC |
307 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_ENTRY, this ); |
295 Cancel(); |
308 Cancel(); |
296 |
309 |
297 TInt err(KErrNone); |
310 TInt err(KErrNone); |
298 TBuf<256> msg; |
311 TBuf<256> msg; |
299 RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
312 OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
300 |
313 |
301 |
314 |
302 switch(iCaseStep) |
315 switch(iCaseStep) |
303 { |
316 { |
304 case ETransfer: |
317 case ETransfer: |
322 case KIfc1BulkTransferOutId1: |
335 case KIfc1BulkTransferOutId1: |
323 case KIfc1BulkTransferOutId2: |
336 case KIfc1BulkTransferOutId2: |
324 case KIfc2BulkTransferOutId1: |
337 case KIfc2BulkTransferOutId1: |
325 case KIfc2BulkTransferOutId2: |
338 case KIfc2BulkTransferOutId2: |
326 iTransferComplete |= aTransferId; |
339 iTransferComplete |= aTransferId; |
327 RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); |
340 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP01, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); |
328 break; //switch(aTransferId) |
341 break; //switch(aTransferId) |
329 |
342 |
330 case KIfc1BulkTransferInId1: |
343 case KIfc1BulkTransferInId1: |
331 case KIfc1BulkTransferInId2: |
344 case KIfc1BulkTransferInId2: |
332 case KIfc2BulkTransferInId1: |
345 case KIfc2BulkTransferInId1: |
333 case KIfc2BulkTransferInId2: |
346 case KIfc2BulkTransferInId2: |
334 iTransferComplete |= aTransferId; |
347 iTransferComplete |= aTransferId; |
335 RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); |
348 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP02, "Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete); |
336 break; //switch(aTransferId) |
349 break; //switch(aTransferId) |
337 |
350 |
338 default: |
351 default: |
339 iTransferComplete = 0; //reset |
352 iTransferComplete = 0; //reset |
340 err = KUnexpectedTransferID; |
353 err = KUnexpectedTransferID; |
381 RecordTime(3); |
394 RecordTime(3); |
382 } |
395 } |
383 if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask) |
396 if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask) |
384 { |
397 { |
385 // ok, compare data rcvd now |
398 // ok, compare data rcvd now |
386 RDebug::Printf("All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
399 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP04, "All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
387 |
400 |
388 TPtrC8 data1(iIfc1InTransfer[0]->DataPolled()); |
401 TPtrC8 data1(iIfc1InTransfer[0]->DataPolled()); |
389 TPtrC8 data2(iIfc1InTransfer[1]->DataPolled()); |
402 TPtrC8 data2(iIfc1InTransfer[1]->DataPolled()); |
390 TPtrC8 data3(iIfc2InTransfer[0]->DataPolled()); |
403 TPtrC8 data3(iIfc2InTransfer[0]->DataPolled()); |
391 TPtrC8 data4(iIfc2InTransfer[1]->DataPolled()); |
404 TPtrC8 data4(iIfc2InTransfer[1]->DataPolled()); |
392 //Validate first transfer on Interface 1 for number of bytes originally written. |
405 //Validate first transfer on Interface 1 for number of bytes originally written. |
393 if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse) |
406 if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse) |
394 { |
407 { |
395 RDebug::Printf("Validation failure 1st transfer, Interface 1"); |
408 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP05, "Validation failure 1st transfer, Interface 1"); |
396 err = KErrCompletion; //indicates data validation failure |
409 err = KErrCompletion; //indicates data validation failure |
397 break; //switch(iCaseStep) |
410 break; //switch(iCaseStep) |
398 } |
411 } |
399 |
412 |
400 //Validate second transfer on Interface 1 for number of bytes originally written. |
413 //Validate second transfer on Interface 1 for number of bytes originally written. |
401 if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) |
414 if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) |
402 { |
415 { |
403 RDebug::Printf("Validation failure 2nd transfer, Interface 1"); |
416 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP06, "Validation failure 2nd transfer, Interface 1"); |
404 err = KErrCompletion; //indicates data validation failure |
417 err = KErrCompletion; //indicates data validation failure |
405 break; //switch(iCaseStep) |
418 break; //switch(iCaseStep) |
406 } |
419 } |
407 |
420 |
408 //Validate first transfer on Interface 2 for number of bytes originally written. |
421 //Validate first transfer on Interface 2 for number of bytes originally written. |
409 if(ValidateData(data3, KLiteralEnglish2(), KHostNumWriteBytes1) == EFalse) |
422 if(ValidateData(data3, KLiteralEnglish2(), KHostNumWriteBytes1) == EFalse) |
410 { |
423 { |
411 RDebug::Printf("Validation failure 1st transfer, Interface 2"); |
424 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP07, "Validation failure 1st transfer, Interface 2"); |
412 err = KErrCompletion; //indicates data validation failure |
425 err = KErrCompletion; //indicates data validation failure |
413 break; //switch(iCaseStep) |
426 break; //switch(iCaseStep) |
414 } |
427 } |
415 |
428 |
416 //Validate second transfer on Interface 2 for number of bytes originally written. |
429 //Validate second transfer on Interface 2 for number of bytes originally written. |
417 if(ValidateData(data4, KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) |
430 if(ValidateData(data4, KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse) |
418 { |
431 { |
419 RDebug::Printf("Validation failure 2nd transfer, Interface 2"); |
432 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP08, "Validation failure 2nd transfer, Interface 2"); |
420 err = KErrCompletion; //indicates data validation failure |
433 err = KErrCompletion; //indicates data validation failure |
421 break; //switch(iCaseStep) |
434 break; //switch(iCaseStep) |
422 } |
435 } |
423 |
436 |
424 // Comparison is a match |
437 // Comparison is a match |
425 RDebug::Printf("Comparison for IN transfer is a match"); |
438 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_TRANSFERCOMPLETEL_DUP09, "Comparison for IN transfer is a match"); |
426 } |
439 } |
427 break; //switch(iCaseStep) |
440 break; //switch(iCaseStep) |
428 |
441 |
429 default: |
442 default: |
430 err = KUndefinedStep; |
443 err = KUndefinedStep; |
514 iIfc2InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId2); |
528 iIfc2InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId2); |
515 iIfc2OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId1); |
529 iIfc2OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId1); |
516 iIfc2OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId2); |
530 iIfc2OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId2); |
517 |
531 |
518 // Initialise the descriptors for transfer |
532 // Initialise the descriptors for transfer |
519 RDebug::Printf("Initialising the transfer descriptors - interface 1"); |
533 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1"); |
520 err = iUsbInterface1.InitialiseTransferDescriptors(); |
534 err = iUsbInterface1.InitialiseTransferDescriptors(); |
521 if(err != KErrNone) |
535 if(err != KErrNone) |
522 { |
536 { |
523 msg.Format(_L("<Error %d> Unable to initialise transfer descriptors (Interface 1)"),err); |
537 msg.Format(_L("<Error %d> Unable to initialise transfer descriptors (Interface 1)"),err); |
524 } |
538 } |
525 else |
539 else |
526 { |
540 { |
527 // Initialise the descriptors for transfer |
541 // Initialise the descriptors for transfer |
528 RDebug::Printf("Initialising the transfer descriptors (Interface 2)"); |
542 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_DEVICEINSERTEDL_DUP02, "Initialising the transfer descriptors (Interface 2)"); |
529 err = iUsbInterface2.InitialiseTransferDescriptors(); |
543 err = iUsbInterface2.InitialiseTransferDescriptors(); |
530 if(err != KErrNone) |
544 if(err != KErrNone) |
531 { |
545 { |
532 msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err); |
546 msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err); |
533 } |
547 } |
534 } |
548 } |
535 } |
549 } |
536 } |
550 } |
537 if(err != KErrNone) |
551 if(err != KErrNone) |
538 { |
552 { |
539 RDebug::Print(msg); |
553 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_DEVICEINSERTEDL_DUP03, msg); |
540 iCaseStep = EFailed; |
554 iCaseStep = EFailed; |
541 TTestCaseFailed request(err,msg); |
555 TTestCaseFailed request(err,msg); |
542 iControlEp0->SendRequest(request,this); |
556 iControlEp0->SendRequest(request,this); |
543 } |
557 } |
544 else |
558 else |
545 { |
559 { |
546 RDebug::Printf("Asking client for 'Read' on interface 1"); |
560 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0498_DEVICEINSERTEDL_DUP04, "Asking client for 'Read' on interface 1"); |
547 iCaseStep = ERequestDeviceIFC1Read; |
561 iCaseStep = ERequestDeviceIFC1Read; |
548 TEndpointReadRequest request(1,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number |
562 TEndpointReadRequest request(1,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number |
549 iControlEp0->SendRequest(request,this); |
563 iControlEp0->SendRequest(request,this); |
550 } |
564 } |
|
565 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0498_DEVICEINSERTEDL_EXIT, this ); |
551 } |
566 } |
552 |
567 |
553 } //end namespace |
568 } //end namespace |