45 _LIT(KTestCaseId,"PBASE-T_USBDI-0495"); |
49 _LIT(KTestCaseId,"PBASE-T_USBDI-0495"); |
46 const TFunctorTestCase<CUT_PBASE_T_USBDI_0495,TBool> CUT_PBASE_T_USBDI_0495::iFunctor(KTestCaseId); |
50 const TFunctorTestCase<CUT_PBASE_T_USBDI_0495,TBool> CUT_PBASE_T_USBDI_0495::iFunctor(KTestCaseId); |
47 |
51 |
48 CUT_PBASE_T_USBDI_0495* CUT_PBASE_T_USBDI_0495::NewL(TBool aHostRole) |
52 CUT_PBASE_T_USBDI_0495* CUT_PBASE_T_USBDI_0495::NewL(TBool aHostRole) |
49 { |
53 { |
|
54 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0495_NEWL_ENTRY, aHostRole ); |
50 CUT_PBASE_T_USBDI_0495* self = new (ELeave) CUT_PBASE_T_USBDI_0495(aHostRole); |
55 CUT_PBASE_T_USBDI_0495* self = new (ELeave) CUT_PBASE_T_USBDI_0495(aHostRole); |
51 CleanupStack::PushL(self); |
56 CleanupStack::PushL(self); |
52 self->ConstructL(); |
57 self->ConstructL(); |
53 CleanupStack::Pop(self); |
58 CleanupStack::Pop(self); |
|
59 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_NEWL_EXIT, ( TUint )( self ) ); |
54 return self; |
60 return self; |
55 } |
61 } |
56 |
62 |
57 |
63 |
58 CUT_PBASE_T_USBDI_0495::CUT_PBASE_T_USBDI_0495(TBool aHostRole) |
64 CUT_PBASE_T_USBDI_0495::CUT_PBASE_T_USBDI_0495(TBool aHostRole) |
59 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
65 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
60 iCaseStep(EInProgress), |
66 iCaseStep(EInProgress), |
61 iRequestValidationResultPtr(NULL,0) |
67 iRequestValidationResultPtr(NULL,0) |
62 { |
68 { |
|
69 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0495_CUT_PBASE_T_USBDI_0495_ENTRY, this ); |
|
70 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_CUT_PBASE_T_USBDI_0495_EXIT, this ); |
63 } |
71 } |
64 |
72 |
65 |
73 |
66 void CUT_PBASE_T_USBDI_0495::ConstructL() |
74 void CUT_PBASE_T_USBDI_0495::ConstructL() |
67 { |
75 { |
|
76 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0495_CONSTRUCTL_ENTRY, this ); |
68 BaseBulkConstructL(); |
77 BaseBulkConstructL(); |
69 |
78 |
70 iInBuffer = HBufC8::NewL(KTestBufferLength); |
79 iInBuffer = HBufC8::NewL(KTestBufferLength); |
71 |
80 |
72 //Create buffer to contain sufficient repeats of the payload pattern |
81 //Create buffer to contain sufficient repeats of the payload pattern |
78 for(TInt i=0;i<repeats;i++) |
87 for(TInt i=0;i<repeats;i++) |
79 { |
88 { |
80 iOutBufferPtr.Append(KLiteralEnglish5()); |
89 iOutBufferPtr.Append(KLiteralEnglish5()); |
81 } |
90 } |
82 |
91 |
83 RDebug::Printf("CUT_PBASE_T_USBDI_0495::ConstructL(): buffer created"); |
92 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_CONSTRUCTL, "CUT_PBASE_T_USBDI_0495::ConstructL(): buffer created"); |
|
93 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_CONSTRUCTL_EXIT, this ); |
84 } |
94 } |
85 |
95 |
86 |
96 |
87 CUT_PBASE_T_USBDI_0495::~CUT_PBASE_T_USBDI_0495() |
97 CUT_PBASE_T_USBDI_0495::~CUT_PBASE_T_USBDI_0495() |
88 { |
98 { |
89 LOG_FUNC |
99 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0495_CUT_PBASE_T_USBDI_0495_ENTRY_DUP01, this ); |
|
100 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_CUT_PBASE_T_USBDI_0495_EXIT_DUP01, this ); |
90 } |
101 } |
91 |
102 |
92 void CUT_PBASE_T_USBDI_0495::KillTransfers() |
103 void CUT_PBASE_T_USBDI_0495::KillTransfers() |
93 { |
104 { |
94 LOG_FUNC |
105 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0495_KILLTRANSFERS_ENTRY, this ); |
95 |
106 |
96 iOutTransfer[0]->Cancel(); |
107 iOutTransfer[0]->Cancel(); |
97 iOutTransfer[1]->Cancel(); |
108 iOutTransfer[1]->Cancel(); |
|
109 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_KILLTRANSFERS_EXIT, this ); |
98 } |
110 } |
99 |
111 |
100 |
112 |
101 |
113 |
102 void CUT_PBASE_T_USBDI_0495::Ep0TransferCompleteL(TInt aCompletionCode) |
114 void CUT_PBASE_T_USBDI_0495::Ep0TransferCompleteL(TInt aCompletionCode) |
103 { |
115 { |
104 LOG_FUNC |
116 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_ENTRY, this ); |
105 |
117 |
106 RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode); |
118 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode); |
107 |
119 |
108 if(aCompletionCode != KErrNone) |
120 if(aCompletionCode != KErrNone) |
109 { |
121 { |
110 if(iCaseStep == EFailed) |
122 if(iCaseStep == EFailed) |
111 {// ignore error, nad catch the TestFailed method called further down. |
123 {// ignore error, nad catch the TestFailed method called further down. |
112 RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***"); |
124 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***"); |
113 } |
125 } |
114 else |
126 else |
115 { |
127 { |
116 TBuf<256> msg; |
128 TBuf<256> msg; |
117 KillTransfers(); |
129 KillTransfers(); |
118 _LIT(lit, "<Error %d> Transfer to control endpoint 0 was not successful"); |
130 _LIT(lit, "<Error %d> Transfer to control endpoint 0 was not successful"); |
119 msg.Format(lit,aCompletionCode); |
131 msg.Format(lit,aCompletionCode); |
120 RDebug::Print(msg); |
132 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP02, msg); |
121 iCaseStep = EFailed; |
133 iCaseStep = EFailed; |
122 TTestCaseFailed request(aCompletionCode,msg); |
134 TTestCaseFailed request(aCompletionCode,msg); |
123 iControlEp0->SendRequest(request,this); |
135 iControlEp0->SendRequest(request,this); |
|
136 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_EXIT, this ); |
124 return; |
137 return; |
125 } |
138 } |
126 } |
139 } |
127 |
140 |
128 switch(iCaseStep) |
141 switch(iCaseStep) |
137 TestFailed(KErrCompletion); |
150 TestFailed(KErrCompletion); |
138 break; |
151 break; |
139 |
152 |
140 case ERequestRepeatedReadAndValidate: |
153 case ERequestRepeatedReadAndValidate: |
141 { |
154 { |
142 RDebug::Printf("Try to perform ALL transfers"); |
155 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP03, "Try to perform ALL transfers"); |
143 |
156 |
144 iCaseStep = ETransfer; |
157 iCaseStep = ETransfer; |
145 |
158 |
146 iTransferComplete |= PerformNextTransfer(KBulkTransferOutId[0]); //should not validate - just perform necessary transfers |
159 iTransferComplete |= PerformNextTransfer(KBulkTransferOutId[0]); //should not validate - just perform necessary transfers |
147 iTransferComplete |= PerformNextTransfer(KBulkTransferOutId[1]); //should not validate - just perform necessary transfers |
160 iTransferComplete |= PerformNextTransfer(KBulkTransferOutId[1]); //should not validate - just perform necessary transfers |
148 if((iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
161 if((iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
149 { |
162 { |
150 _LIT(lit, "TEST FAILURE: No data to send!!"); |
163 _LIT(lit, "TEST FAILURE: No data to send!!"); |
151 TBuf<40> msg(lit); |
164 TBuf<40> msg(lit); |
152 RDebug::Print(msg); |
165 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP04, msg); |
153 iCaseStep = EFailed; |
166 iCaseStep = EFailed; |
154 TTestCaseFailed request(KErrAbort,msg); |
167 TTestCaseFailed request(KErrAbort,msg); |
155 return iControlEp0->SendRequest(request,this); |
168 return iControlEp0->SendRequest(request,this); |
156 } |
169 } |
157 } |
170 } |
158 break; |
171 break; |
159 |
172 |
160 case ERequestPrepareEndpointValidationResult: |
173 case ERequestPrepareEndpointValidationResult: |
161 { |
174 { |
162 RDebug::Printf("Asking client to prepare the result of its continuous validation"); |
175 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP05, "Asking client to prepare the result of its continuous validation"); |
163 iCaseStep = ERequestValidationResult; |
176 iCaseStep = ERequestValidationResult; |
164 iRequestValidationResultPtr.Set( iInBuffer->Des()); |
177 iRequestValidationResultPtr.Set( iInBuffer->Des()); |
165 iRequestValidationResultPtr.Zero(); //reset |
178 iRequestValidationResultPtr.Zero(); //reset |
166 iRequestValidationResultPtr.SetLength(KPassFailStringLength); |
179 iRequestValidationResultPtr.SetLength(KPassFailStringLength); |
167 TInterfaceGetPayloadRequest request(1,iRequestValidationResultPtr); |
180 TInterfaceGetPayloadRequest request(1,iRequestValidationResultPtr); |
169 } |
182 } |
170 break; |
183 break; |
171 |
184 |
172 case ERequestValidationResult: |
185 case ERequestValidationResult: |
173 { |
186 { |
174 RDebug::Printf("Collect client's return validation result in a pass or fail string ..."); |
187 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP06, "Collect client's return validation result in a pass or fail string ..."); |
175 RDebug::RawPrint(*iInBuffer); |
188 OstTraceData(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP56, "", iInBuffer->Ptr(), iInBuffer->Length()); |
176 RDebug::Printf("\n"); |
189 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP07, "\n"); |
177 TPtr8 ptr(iInBuffer->Des()); |
190 TPtr8 ptr(iInBuffer->Des()); |
178 if(ptr.Compare(KClientPassString) == 0) |
191 if(ptr.Compare(KClientPassString) == 0) |
179 { |
192 { |
180 RDebug::Printf("Client Validation Result is a PASS"); |
193 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP08, "Client Validation Result is a PASS"); |
181 RDebug::Printf("This is the FINAL check - the whole test has a PASSED"); |
194 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP09, "This is the FINAL check - the whole test has a PASSED"); |
182 iCaseStep = EPassed; |
195 iCaseStep = EPassed; |
183 TTestCasePassed request; |
196 TTestCasePassed request; |
184 iControlEp0->SendRequest(request,this); |
197 iControlEp0->SendRequest(request,this); |
185 } |
198 } |
186 else |
199 else |
187 { |
200 { |
188 TBuf<256> msg; |
201 TBuf<256> msg; |
189 _LIT(lit, "<Error> Bulk data VALIDATION check was NOT successful"); |
202 _LIT(lit, "<Error> Bulk data VALIDATION check was NOT successful"); |
190 msg.Format(lit); |
203 msg.Format(lit); |
191 RDebug::Print(msg); |
204 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP10, msg); |
192 iCaseStep = EFailed; |
205 iCaseStep = EFailed; |
193 TTestCaseFailed request(KErrCorrupt,msg); |
206 TTestCaseFailed request(KErrCorrupt,msg); |
194 iControlEp0->SendRequest(request,this); |
207 iControlEp0->SendRequest(request,this); |
195 } |
208 } |
196 } |
209 } |
197 break; |
210 break; |
198 |
211 |
199 default: |
212 default: |
200 RDebug::Printf("<Error> Unknown test step"); |
213 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_DUP11, "<Error> Unknown test step"); |
201 TestFailed(KErrUnknown); |
214 TestFailed(KErrUnknown); |
202 break; |
215 break; |
203 } |
216 } |
|
217 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this ); |
204 } |
218 } |
205 |
219 |
206 void CUT_PBASE_T_USBDI_0495::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
220 void CUT_PBASE_T_USBDI_0495::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
207 { |
221 { |
208 LOG_FUNC |
222 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_ENTRY, this ); |
209 Cancel(); |
223 Cancel(); |
210 |
224 |
211 TInt err(KErrNone); |
225 TInt err(KErrNone); |
212 TBuf<256> msg; |
226 TBuf<256> msg; |
213 RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
227 OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
214 |
228 |
215 |
229 |
216 switch(iCaseStep) |
230 switch(iCaseStep) |
217 { |
231 { |
218 case ETransfer: |
232 case ETransfer: |
233 _LIT(lit, "<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"); |
247 _LIT(lit, "<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"); |
234 msg.Format(lit, err, KBulkTransferOutId[0], KBulkTransferOutId[1], aTransferId); |
248 msg.Format(lit, err, KBulkTransferOutId[0], KBulkTransferOutId[1], aTransferId); |
235 break; |
249 break; |
236 } |
250 } |
237 |
251 |
238 RDebug::Printf("Transfer OUT %d completed - num bytes sent = %d", aTransferId, iNumWriteBytesRequested); |
252 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_DUP01, "Transfer OUT %d completed - num bytes sent = %u", aTransferId, iNumWriteBytesRequested); |
239 |
253 |
240 iTransferComplete |= PerformNextTransfer(aTransferId); |
254 iTransferComplete |= PerformNextTransfer(aTransferId); |
241 |
255 |
242 if(err==KErrNone && (iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
256 if(err==KErrNone && (iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
243 { |
257 { |
244 /* |
258 /* |
245 Transfers all complete - now ask device to validate first interface's transfer OUT |
259 Transfers all complete - now ask device to validate first interface's transfer OUT |
246 */ |
260 */ |
247 RDebug::Printf("All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
261 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_DUP02, "All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
248 if(err==KErrNone) |
262 if(err==KErrNone) |
249 { |
263 { |
250 RDebug::Printf("Asking client to post validation recorded on the endpoint on its interface - ready for collection"); |
264 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_DUP03, "Asking client to post validation recorded on the endpoint on its interface - ready for collection"); |
251 iCaseStep = ERequestPrepareEndpointValidationResult; |
265 iCaseStep = ERequestPrepareEndpointValidationResult; |
252 TRecordedValidationResultRequest request(1,1); |
266 TRecordedValidationResultRequest request(1,1); |
253 iControlEp0->SendRequest(request,this); |
267 iControlEp0->SendRequest(request,this); |
254 } |
268 } |
255 } |
269 } |
271 } |
285 } |
272 |
286 |
273 if(err!=KErrNone) |
287 if(err!=KErrNone) |
274 { |
288 { |
275 KillTransfers(); |
289 KillTransfers(); |
276 RDebug::Print(msg); |
290 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_DUP04, msg); |
277 iCaseStep = EFailed; |
291 iCaseStep = EFailed; |
278 TTestCaseFailed request(err,msg); |
292 TTestCaseFailed request(err,msg); |
279 return iControlEp0->SendRequest(request,this); |
293 return iControlEp0->SendRequest(request,this); |
280 } |
294 } |
|
295 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_TRANSFERCOMPLETEL_EXIT, this ); |
281 } |
296 } |
282 |
297 |
283 void CUT_PBASE_T_USBDI_0495::DeviceInsertedL(TUint aDeviceHandle) |
298 void CUT_PBASE_T_USBDI_0495::DeviceInsertedL(TUint aDeviceHandle) |
284 { |
299 { |
285 LOG_FUNC |
300 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL_ENTRY, this ); |
286 |
301 |
287 Cancel(); |
302 Cancel(); |
288 RDebug::Printf("this - %08x", this); |
303 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL, "this - %08x", this); |
289 |
304 |
290 TBuf<256> msg; |
305 TBuf<256> msg; |
291 TInt err = KErrNone; |
306 TInt err = KErrNone; |
292 if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError) |
307 if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError) |
293 // Prepare for response from control transfer to client |
308 // Prepare for response from control transfer to client |
310 |
325 |
311 iOutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferOutId[0]); |
326 iOutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferOutId[0]); |
312 iOutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferOutId[1]); |
327 iOutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferOutId[1]); |
313 |
328 |
314 // Initialise the descriptors for transfer |
329 // Initialise the descriptors for transfer |
315 RDebug::Printf("Initialising the transfer descriptors - interface 1"); |
330 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1"); |
316 err = iUsbInterface1.InitialiseTransferDescriptors(); |
331 err = iUsbInterface1.InitialiseTransferDescriptors(); |
317 if(err != KErrNone) |
332 if(err != KErrNone) |
318 { |
333 { |
319 _LIT(lit, "<Error %d> Unable to initialise transfer descriptors"); |
334 _LIT(lit, "<Error %d> Unable to initialise transfer descriptors"); |
320 msg.Format(lit,err); |
335 msg.Format(lit,err); |
321 } |
336 } |
322 } |
337 } |
323 } |
338 } |
324 if(err != KErrNone) |
339 if(err != KErrNone) |
325 { |
340 { |
326 RDebug::Print(msg); |
341 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL_DUP02, msg); |
327 iCaseStep = EFailed; |
342 iCaseStep = EFailed; |
328 TTestCaseFailed request(err,msg); |
343 TTestCaseFailed request(err,msg); |
329 iControlEp0->SendRequest(request,this); |
344 iControlEp0->SendRequest(request,this); |
330 } |
345 } |
331 else |
346 else |
332 { |
347 { |
333 RDebug::Printf("Asking client for continuous 'Read' and 'Validate'"); |
348 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL_DUP03, "Asking client for continuous 'Read' and 'Validate'"); |
334 iCaseStep = ERequestRepeatedReadAndValidate; |
349 iCaseStep = ERequestRepeatedReadAndValidate; |
335 TRepeatedReadAndValidateDataRequest request(1,1,KLiteralEnglish5,KDeviceNumReadBytes,KTotalBytesToTransfer);// EP2 means endpoint index 2 not the actual endpoint number, here the ep with 32 byte max packet size |
350 TRepeatedReadAndValidateDataRequest request(1,1,KLiteralEnglish5,KDeviceNumReadBytes,KTotalBytesToTransfer);// EP2 means endpoint index 2 not the actual endpoint number, here the ep with 32 byte max packet size |
336 iControlEp0->SendRequest(request,this); |
351 iControlEp0->SendRequest(request,this); |
337 } |
352 } |
|
353 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_DEVICEINSERTEDL_EXIT, this ); |
338 } |
354 } |
339 |
355 |
340 TInt CUT_PBASE_T_USBDI_0495::PerformNextTransfer(TInt aTransferId) |
356 TInt CUT_PBASE_T_USBDI_0495::PerformNextTransfer(TInt aTransferId) |
341 /** |
357 /** |
342 @param aTransferId - specifies trasnfer to use |
358 @param aTransferId - specifies trasnfer to use |
343 @return zero UNLESS no more trasnfers have been queued for the specified ID in which case return the transfer ID |
359 @return zero UNLESS no more trasnfers have been queued for the specified ID in which case return the transfer ID |
344 Note: This return value allows the caller to respond easily if no more transfers are required for the specified |
360 Note: This return value allows the caller to respond easily if no more transfers are required for the specified |
345 transfer ID. |
361 transfer ID. |
346 */ |
362 */ |
347 { |
363 { |
348 LOG_FUNC |
364 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0495_PERFORMNEXTTRANSFER_ENTRY, this ); |
349 |
365 |
350 if(iNumWriteBytesRequested >= KTotalBytesToTransfer) |
366 if(iNumWriteBytesRequested >= KTotalBytesToTransfer) |
351 { |
367 { |
352 RDebug::Printf("****ALL DONE for Transfer using ID %d****", aTransferId); |
368 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_PERFORMNEXTTRANSFER, "****ALL DONE for Transfer using ID %d****", aTransferId); |
353 RDebug::Printf("Num bytes actually written = %d, num bytes required to be written = %d", iNumWriteBytesRequested, KTotalBytesToTransfer); |
369 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0495_PERFORMNEXTTRANSFER_DUP01, "Num bytes actually written = %u, num bytes required to be written = %u", iNumWriteBytesRequested, KTotalBytesToTransfer); |
|
370 OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0495_PERFORMNEXTTRANSFER_EXIT, this, aTransferId ); |
354 return aTransferId; //Not writing any more - signal to user that no more transfers are required on this transfer ID |
371 return aTransferId; //Not writing any more - signal to user that no more transfers are required on this transfer ID |
355 } |
372 } |
356 TUint bytesToWrite = KTotalBytesToTransfer - iNumWriteBytesRequested; |
373 TUint bytesToWrite = KTotalBytesToTransfer - iNumWriteBytesRequested; |
357 TUint numWriteBytes = bytesToWrite < KHostNumWriteBytes ? bytesToWrite : KHostNumWriteBytes; |
374 TUint numWriteBytes = bytesToWrite < KHostNumWriteBytes ? bytesToWrite : KHostNumWriteBytes; |
358 |
375 |
360 __ASSERT_DEBUG(aTransferId==KBulkTransferOutId[0] || aTransferId==KBulkTransferOutId[1], User::Panic(lit, KErrArgument)); |
377 __ASSERT_DEBUG(aTransferId==KBulkTransferOutId[0] || aTransferId==KBulkTransferOutId[1], User::Panic(lit, KErrArgument)); |
361 CBulkTransfer& bulkTransfer = aTransferId==KBulkTransferOutId[0]?*iOutTransfer[0]:*iOutTransfer[1]; |
378 CBulkTransfer& bulkTransfer = aTransferId==KBulkTransferOutId[0]?*iOutTransfer[0]:*iOutTransfer[1]; |
362 bulkTransfer.TransferOut(iOutBufferPtr.Mid(iNumWriteBytesRequested%(KLiteralEnglish5().Length()), numWriteBytes), EFalse); |
379 bulkTransfer.TransferOut(iOutBufferPtr.Mid(iNumWriteBytesRequested%(KLiteralEnglish5().Length()), numWriteBytes), EFalse); |
363 iNumWriteBytesRequested += numWriteBytes; |
380 iNumWriteBytesRequested += numWriteBytes; |
364 |
381 |
|
382 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0495_PERFORMNEXTTRANSFER_EXIT_DUP01, this ); |
365 return 0; //Signal to the user that another transfer is queued on the specified transfer ID |
383 return 0; //Signal to the user that another transfer is queued on the specified transfer ID |
366 } |
384 } |
367 |
385 |
368 |
386 |
369 } //end namespace |
387 } //end namespace |