172 * @param aIniFile The ini file to read from. |
181 * @param aIniFile The ini file to read from. |
173 * @param aSection The section to reads from. |
182 * @param aSection The section to reads from. |
174 * @param aBehaviour The behaviour struct to read to. |
183 * @param aBehaviour The behaviour struct to read to. |
175 */ |
184 */ |
176 { |
185 { |
177 LOG_FUNC |
186 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_ENTRY ); |
178 #ifdef __FLOG_ACTIVE |
187 #ifdef _DEBUG |
179 TBuf8<KMaxName> buf; |
188 OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR, |
180 buf.Copy(aSection); |
189 "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection ); |
181 LOGTEXT2(_L8("\taSection = %S"), &buf); |
190 #endif//_DEBUG |
182 #endif // __FLOG_ACTIVE |
|
183 |
191 |
184 TPtrC temp; |
192 TPtrC temp; |
185 if ( !aIniFile.FindVar(aSection, KType(), temp) ) |
193 if ( !aIniFile.FindVar(aSection, KType(), temp) ) |
186 { |
194 { |
187 LOGTEXT2(_L8("\tPANICKING: can't find Type item in section %S"), &aSection); |
195 OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP1, |
188 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile); |
196 "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Type item in section %S", aSection ); |
|
197 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile ); |
|
198 User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile ); |
189 } |
199 } |
190 if ( temp == KSync ) |
200 if ( temp == KSync ) |
191 { |
201 { |
192 aBehaviour.iSynchronicity = ESynchronous; |
202 aBehaviour.iSynchronicity = ESynchronous; |
193 } |
203 } |
199 { |
209 { |
200 aBehaviour.iSynchronicity = ENever; |
210 aBehaviour.iSynchronicity = ENever; |
201 } |
211 } |
202 else |
212 else |
203 { |
213 { |
204 LOGTEXT3(_L8("\tPANICKING: bad Type value (%S) in section %S"), &temp, &aSection); |
214 OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP3, |
205 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile); |
215 "CUsbDummyClassController::GetBehaviour;PANICKING: bad Type value (%S) in section %S", temp, aSection ); |
|
216 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile ); |
|
217 User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile); |
206 } |
218 } |
207 TInt delay; |
219 TInt delay; |
208 if ( !aIniFile.FindVar(aSection, KTime(), delay) ) |
220 if ( !aIniFile.FindVar(aSection, KTime(), delay) ) |
209 { |
221 { |
210 LOGTEXT2(_L8("\tPANICKING: can't find Time item in section %S"), &aSection); |
222 OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP5, |
211 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile); |
223 "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Time item in section %S", aSection ); |
|
224 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile ); |
|
225 User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile); |
212 } |
226 } |
213 aBehaviour.iDelay = delay; |
227 aBehaviour.iDelay = delay; |
214 if ( !aIniFile.FindVar(aSection, KError(), aBehaviour.iErrorCode) ) |
228 if ( !aIniFile.FindVar(aSection, KError(), aBehaviour.iErrorCode) ) |
215 { |
229 { |
216 LOGTEXT2(_L8("\tPANICKING: can't find Error item in section %S"), &aSection); |
230 OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP7, |
217 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile); |
231 "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection ); |
218 } |
232 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile ); |
|
233 User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile ); |
|
234 } |
|
235 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_EXIT ); |
219 } |
236 } |
220 |
237 |
221 void CUsbDummyClassController::DoGetConfigL() |
238 void CUsbDummyClassController::DoGetConfigL() |
222 /** |
239 /** |
223 * Reads the config from the ini file. |
240 * Reads the config from the ini file. |
224 */ |
241 */ |
225 { |
242 { |
226 LOG_FUNC |
243 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_ENTRY ); |
227 |
244 |
228 CIniFile* iniFile = CIniFile::NewL(_L("dummy.ini")); |
245 CIniFile* iniFile = CIniFile::NewL(_L("dummy.ini")); |
229 CleanupStack::PushL(iniFile); |
246 CleanupStack::PushL(iniFile); |
230 TName section; |
247 TName section; |
231 |
248 |
235 // Read shutdown behaviour |
252 // Read shutdown behaviour |
236 section.Format(_L("%S.%d"), &KShutdown(), iIndex); |
253 section.Format(_L("%S.%d"), &KShutdown(), iIndex); |
237 GetBehaviour(*iniFile, section, iShutdownBehaviour); |
254 GetBehaviour(*iniFile, section, iShutdownBehaviour); |
238 |
255 |
239 CleanupStack::PopAndDestroy(iniFile); |
256 CleanupStack::PopAndDestroy(iniFile); |
|
257 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_EXIT ); |
240 } |
258 } |
241 |
259 |
242 void CUsbDummyClassController::GetConfig() |
260 void CUsbDummyClassController::GetConfig() |
243 /** |
261 /** |
244 * Reads the config from the ini file. |
262 * Reads the config from the ini file. |
245 * Note that this is assumed to succeed. Any failure will break the test and |
263 * Note that this is assumed to succeed. Any failure will break the test and |
246 * it's much cleaner to panic out of the test entirely rather than leave it to |
264 * it's much cleaner to panic out of the test entirely rather than leave it to |
247 * the user to figure out what's gone wrong. |
265 * the user to figure out what's gone wrong. |
248 */ |
266 */ |
249 { |
267 { |
250 LOG_FUNC |
268 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_ENTRY ); |
251 |
269 |
252 // Always use dummy.ini. The entity setting up the test is responsible for |
270 // Always use dummy.ini. The entity setting up the test is responsible for |
253 // copying the correct file to c:\\dummy.ini. The first found |
271 // copying the correct file to c:\\dummy.ini. The first found |
254 // by FindByDir will be used. TODO: enforce c:\\. |
272 // by FindByDir will be used. TODO: enforce c:\\. |
255 TRAPD(err, DoGetConfigL()); |
273 TRAPD(err, DoGetConfigL()); |
256 if ( err != KErrNone ) |
274 if ( err != KErrNone ) |
257 { |
275 { |
258 _USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError); |
276 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7, "CUsbDummyClassController::GetConfig;panic code=%d", EDummyPanicUnhandledError ); |
259 } |
277 User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError); |
260 |
278 } |
261 LOGTEXT2(_L8("\tLogging dummy class controller behaviour for instance %d"), iIndex); |
279 |
262 LOGTEXT2(_L8("\tiStartupBehaviour.iSynchronicity = %d"), iStartupBehaviour.iSynchronicity); |
280 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG, |
263 LOGTEXT2(_L8("\tiStartupBehaviour.iDelay = %d"), iStartupBehaviour.iDelay.Int()); |
281 "CUsbDummyClassController::GetConfig; Logging dummy class controller behaviour for instance %d", iIndex ); |
264 LOGTEXT2(_L8("\tiStartupBehaviour.iErrorCode = %d"), iStartupBehaviour.iErrorCode); |
282 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP1, |
265 LOGTEXT2(_L8("\tiShutdownBehaviour.iSynchronicity = %d"), iShutdownBehaviour.iSynchronicity); |
283 "CUsbDummyClassController::GetConfig;iStartupBehaviour.iSynchronicity=%d", iStartupBehaviour.iSynchronicity ); |
266 LOGTEXT2(_L8("\tiShutdownBehaviour.iDelay = %d"), iShutdownBehaviour.iDelay.Int()); |
284 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP2, |
267 LOGTEXT2(_L8("\tiShutdownBehaviour.iErrorCode = %d"), iShutdownBehaviour.iErrorCode); |
285 "CUsbDummyClassController::GetConfig;iStartupBehaviour.iDelay.Int()=%d", iStartupBehaviour.iDelay.Int() ); |
|
286 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP3, |
|
287 "CUsbDummyClassController::GetConfig;iStartupBehaviour.iErrorCode=%d", iStartupBehaviour.iErrorCode ); |
|
288 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP4, |
|
289 "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iSynchronicity=%d", iShutdownBehaviour.iSynchronicity ); |
|
290 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP5, |
|
291 "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iDelay.Int()=%d", iShutdownBehaviour.iDelay.Int() ); |
|
292 OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP6, |
|
293 "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iErrorCode=%d", iShutdownBehaviour.iErrorCode ); |
|
294 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_EXIT ); |
268 } |
295 } |
269 |
296 |
270 void CUsbDummyClassController::Start(TRequestStatus& aStatus) |
297 void CUsbDummyClassController::Start(TRequestStatus& aStatus) |
271 /** |
298 /** |
272 * Called by UsbMan to start this class. |
299 * Called by UsbMan to start this class. |
273 * |
300 * |
274 * @param aStatus Will be completed with success or failure. |
301 * @param aStatus Will be completed with success or failure. |
275 */ |
302 */ |
276 { |
303 { |
277 LOG_FUNC |
304 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_START_ENTRY ); |
278 |
305 |
279 //Start() should only be called if the CC is idle or started |
306 //Start() should only be called if the CC is idle or started |
280 __ASSERT_DEBUG((iState == EUsbServiceIdle || iState == EUsbServiceStarted), |
307 |
281 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStart) ); |
308 if(!(iState == EUsbServiceIdle || iState == EUsbServiceStarted)) |
|
309 { |
|
310 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadApiCallStart ); |
|
311 __ASSERT_DEBUG(EFalse, |
|
312 User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStart) ); |
|
313 } |
282 |
314 |
283 // Get config from ini file. Note that can't be done once in ConstructL |
315 // Get config from ini file. Note that can't be done once in ConstructL |
284 // because then, in the case of a CC which doesn't Stop, we'd never be |
316 // because then, in the case of a CC which doesn't Stop, we'd never be |
285 // able to shut down USBMAN! |
317 // able to shut down USBMAN! |
286 GetConfig(); |
318 GetConfig(); |
287 |
319 |
288 // NB We enforce that the device doesn't re-post requests on us. |
320 // NB We enforce that the device doesn't re-post requests on us. |
289 __ASSERT_DEBUG(!iReportStatus, |
321 if(iReportStatus) |
290 _USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice)); |
322 { |
|
323 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP1, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicOutstandingRequestFromDevice ); |
|
324 __ASSERT_DEBUG(EFalse, |
|
325 User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice)); |
|
326 } |
291 aStatus = KRequestPending; |
327 aStatus = KRequestPending; |
292 iReportStatus = &aStatus; |
328 iReportStatus = &aStatus; |
293 |
329 |
294 iState = EUsbServiceStarting; |
330 iState = EUsbServiceStarting; |
295 |
331 |
302 iReportStatus = NULL; |
338 iReportStatus = NULL; |
303 break; |
339 break; |
304 |
340 |
305 case EAsynchronous: |
341 case EAsynchronous: |
306 iTimer.After(iStatus, iStartupBehaviour.iDelay); |
342 iTimer.After(iStatus, iStartupBehaviour.iDelay); |
307 __ASSERT_DEBUG(!IsActive(), _USB_PANIC(KDummyControllerPanic, EDummyPanicAlreadyActive)); |
343 #ifdef _DEBUG |
|
344 if(IsActive()) |
|
345 { |
|
346 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP2, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicAlreadyActive ); |
|
347 User::Panic(KDummyControllerPanic, EDummyPanicAlreadyActive); |
|
348 } |
|
349 #endif |
308 SetActive(); |
350 SetActive(); |
309 break; |
351 break; |
310 |
352 |
311 case ENever: |
353 case ENever: |
312 // Don't do anything and never complete |
354 // Don't do anything and never complete |
313 break; |
355 break; |
314 |
356 |
315 default: |
357 default: |
316 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity); |
358 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP3, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadSynchronicity ); |
317 break; |
359 User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity); |
318 } |
360 break; |
|
361 } |
|
362 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_START_EXIT ); |
319 } |
363 } |
320 |
364 |
321 void CUsbDummyClassController::Stop(TRequestStatus& aStatus) |
365 void CUsbDummyClassController::Stop(TRequestStatus& aStatus) |
322 /** |
366 /** |
323 * Called by UsbMan to stop this class. |
367 * Called by UsbMan to stop this class. |
324 * |
368 * |
325 * @param aStatus Will be completed with success or failure. |
369 * @param aStatus Will be completed with success or failure. |
326 */ |
370 */ |
327 { |
371 { |
328 LOG_FUNC |
372 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_STOP_ENTRY ); |
329 |
373 |
330 //Stop() should only be called if the CC is Started or Idle |
374 //Stop() should only be called if the CC is Started or Idle |
331 __ASSERT_DEBUG((iState == EUsbServiceStarted || iState == EUsbServiceIdle), |
375 if(!(iState == EUsbServiceStarted || iState == EUsbServiceIdle)) |
332 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStop)); |
376 { |
|
377 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicBadApiCallStop ); |
|
378 __ASSERT_DEBUG(EFalse, |
|
379 User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStop)); |
|
380 } |
333 |
381 |
334 // Get config from ini file. Note that can't be done once in ConstructL |
382 // Get config from ini file. Note that can't be done once in ConstructL |
335 // because then, in the case of a CC which doesn't Stop, we'd never be |
383 // because then, in the case of a CC which doesn't Stop, we'd never be |
336 // able to shutdown USBMAN! |
384 // able to shutdown USBMAN! |
337 GetConfig(); |
385 GetConfig(); |
338 |
386 |
339 // NB We enforce that the device doesn't re-post requests on us. |
387 // NB We enforce that the device doesn't re-post requests on us. |
340 __ASSERT_DEBUG(!iReportStatus, |
388 if(iReportStatus) |
341 _USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice)); |
389 { |
|
390 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP1, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicOutstandingRequestFromDevice ); |
|
391 __ASSERT_DEBUG(EFalse, |
|
392 User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice)); |
|
393 } |
342 aStatus = KRequestPending; |
394 aStatus = KRequestPending; |
343 iReportStatus = &aStatus; |
395 iReportStatus = &aStatus; |
344 |
396 |
345 iState = EUsbServiceStopping; |
397 iState = EUsbServiceStopping; |
346 |
398 |
383 void CUsbDummyClassController::RunL() |
443 void CUsbDummyClassController::RunL() |
384 /** |
444 /** |
385 * Standard active object RunL. |
445 * Standard active object RunL. |
386 */ |
446 */ |
387 { |
447 { |
388 LOGTEXT3(_L8(">>CUsbDummyClassController::RunL [iStatus=%d,iState=%d]"), |
448 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_RUNL_ENTRY ); |
389 iStatus.Int(), iState); |
449 OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_RUNL, "CUsbDummyClassController::RunL;iStatus.Int()=%d;iState=%d", iStatus.Int(), iState ); |
|
450 |
390 |
451 |
391 if ( iStatus != KErrNone ) |
452 if ( iStatus != KErrNone ) |
392 { |
453 { |
393 // Panic runtime errors from the timer. We can't ignore them, and |
454 // Panic runtime errors from the timer. We can't ignore them, and |
394 // there's no point trying to code round them. This is part of the |
455 // there's no point trying to code round them. This is part of the |
395 // test framework and if it's failing we want to alert the user |
456 // test framework and if it's failing we want to alert the user |
396 // without faffing around. (It invalidates the test.) |
457 // without faffing around. (It invalidates the test.) |
397 _USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError); |
458 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicUnhandledError ); |
|
459 User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError); |
398 } |
460 } |
399 |
461 |
400 __ASSERT_DEBUG(iReportStatus, |
462 if(!iReportStatus) |
401 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState)); |
463 { |
|
464 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState ); |
|
465 __ASSERT_DEBUG(EFalse, |
|
466 User::Panic(KDummyControllerPanic, EDummyPanicBadState)); |
|
467 } |
402 |
468 |
403 switch ( iState ) |
469 switch ( iState ) |
404 { |
470 { |
405 case EUsbServiceStarting: |
471 case EUsbServiceStarting: |
406 // Completion of asynchronous startup... |
472 // Completion of asynchronous startup... |
407 __ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, |
473 if(iStartupBehaviour.iSynchronicity != EAsynchronous) |
408 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
474 { |
|
475 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity ); |
|
476 __ASSERT_DEBUG(EFalse, |
|
477 User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
|
478 } |
409 iState = EUsbServiceStarted; |
479 iState = EUsbServiceStarted; |
410 User::RequestComplete(iReportStatus, iStartupBehaviour.iErrorCode); |
480 User::RequestComplete(iReportStatus, iStartupBehaviour.iErrorCode); |
411 iReportStatus = NULL; |
481 iReportStatus = NULL; |
412 break; |
482 break; |
413 |
483 |
414 case EUsbServiceStopping: |
484 case EUsbServiceStopping: |
415 // Completion of asynchronous shutdown... |
485 // Completion of asynchronous shutdown... |
416 __ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, |
486 if(iShutdownBehaviour.iSynchronicity != EAsynchronous) |
417 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
487 { |
|
488 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity ); |
|
489 __ASSERT_DEBUG(EFalse, |
|
490 User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
|
491 } |
418 iState = EUsbServiceIdle; |
492 iState = EUsbServiceIdle; |
419 User::RequestComplete(iReportStatus, iShutdownBehaviour.iErrorCode); |
493 User::RequestComplete(iReportStatus, iShutdownBehaviour.iErrorCode); |
420 iReportStatus = NULL; |
494 iReportStatus = NULL; |
421 break; |
495 break; |
422 |
496 |
423 case EUsbServiceIdle: |
497 case EUsbServiceIdle: |
424 case EUsbServiceStarted: |
498 case EUsbServiceStarted: |
425 default: |
499 default: |
426 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState); |
500 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState ); |
427 break; |
501 User::Panic(KDummyControllerPanic, EDummyPanicBadState); |
428 } |
502 break; |
429 |
503 } |
430 LOGTEXT(_L8("<<CUsbDummyClassController::RunL")); |
504 |
|
505 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_RUNL_EXIT ); |
431 } |
506 } |
432 |
507 |
433 void CUsbDummyClassController::DoCancel() |
508 void CUsbDummyClassController::DoCancel() |
434 /** |
509 /** |
435 * Standard active object cancellation function. |
510 * Standard active object cancellation function. |
436 */ |
511 */ |
437 { |
512 { |
438 LOG_FUNC |
513 OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_ENTRY ); |
439 |
514 |
440 // Note that CActive::Cancel does not call DoCancel unless we are active. |
515 // Note that CActive::Cancel does not call DoCancel unless we are active. |
441 // Therefore we are at this point active. Therefore, we should have |
516 // Therefore we are at this point active. Therefore, we should have |
442 // iReportStatus pointing to something. This is true whether we are in |
517 // iReportStatus pointing to something. This is true whether we are in |
443 // our destructor or being cancelled by the device. It is also true that |
518 // our destructor or being cancelled by the device. It is also true that |
449 // 2/ The device wants to cancel us in the middle of a Start before |
524 // 2/ The device wants to cancel us in the middle of a Start before |
450 // issuing a Stop (or vice versa). Note that the device may cancel us in |
525 // issuing a Stop (or vice versa). Note that the device may cancel us in |
451 // the middle of a Start, then immediately issue another Start. |
526 // the middle of a Start, then immediately issue another Start. |
452 |
527 |
453 // Cancel our own asynchronous operation. |
528 // Cancel our own asynchronous operation. |
454 __ASSERT_DEBUG(iTimer.Handle(), |
529 #ifdef _DEBUG |
455 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState)); |
530 if(!iTimer.Handle()) |
|
531 { |
|
532 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState ); |
|
533 User::Panic(KDummyControllerPanic, EDummyPanicBadState); |
|
534 } |
|
535 #endif |
456 iTimer.Cancel(); |
536 iTimer.Cancel(); |
457 |
537 |
458 // Update our iState. If we're starting, then roll back to idle. If we're |
538 // Update our iState. If we're starting, then roll back to idle. If we're |
459 // stopping, role back to started. Nothing else is legal. |
539 // stopping, role back to started. Nothing else is legal. |
460 switch ( iState ) |
540 switch ( iState ) |
461 { |
541 { |
462 case EUsbServiceStarting: |
542 case EUsbServiceStarting: |
463 __ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, |
543 if(iStartupBehaviour.iSynchronicity != EAsynchronous) |
464 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
544 { |
|
545 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity ); |
|
546 __ASSERT_DEBUG(EFalse, |
|
547 User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
|
548 } |
465 iState = EUsbServiceIdle; |
549 iState = EUsbServiceIdle; |
466 break; |
550 break; |
467 |
551 |
468 case EUsbServiceStopping: |
552 case EUsbServiceStopping: |
469 __ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, |
553 if(iShutdownBehaviour.iSynchronicity != EAsynchronous) |
470 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
554 { |
|
555 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity ); |
|
556 __ASSERT_DEBUG(EFalse, |
|
557 User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity)); |
|
558 } |
471 iState = EUsbServiceStarted; |
559 iState = EUsbServiceStarted; |
472 break; |
560 break; |
473 |
561 |
474 case EUsbServiceIdle: |
562 case EUsbServiceIdle: |
475 case EUsbServiceStarted: |
563 case EUsbServiceStarted: |
476 default: |
564 default: |
477 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState); |
565 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState ); |
478 break; |
566 User::Panic(KDummyControllerPanic, EDummyPanicBadState); |
479 } |
567 break; |
480 |
568 } |
481 // Complete the client's request. |
569 |
482 __ASSERT_DEBUG(iReportStatus, |
570 // Complete the client's request. |
483 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState)); |
571 if(!iReportStatus) |
|
572 { |
|
573 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState ); |
|
574 __ASSERT_DEBUG(EFalse, |
|
575 User::Panic(KDummyControllerPanic, EDummyPanicBadState)); |
|
576 } |
484 User::RequestComplete(iReportStatus, KErrCancel); |
577 User::RequestComplete(iReportStatus, KErrCancel); |
485 iReportStatus = NULL; |
578 iReportStatus = NULL; |
|
579 OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_EXIT ); |
486 } |
580 } |
487 |
581 |
488 TInt CUsbDummyClassController::RunError(TInt /*aError*/) |
582 TInt CUsbDummyClassController::RunError(TInt /*aError*/) |
489 /** |
583 /** |
490 * Standard active object error-handling function. |
584 * Standard active object error-handling function. |
491 * |
585 * |
492 * Should return KErrNone to avoid an active scheduler panic. This function |
586 * Should return KErrNone to avoid an active scheduler panic. This function |
493 * should never be called as there is another mechanism for catching errors. |
587 * should never be called as there is another mechanism for catching errors. |
494 */ |
588 */ |
495 { |
589 { |
496 __ASSERT_DEBUG(EFalse, |
590 OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNERROR, "CUsbDummyClassController::RunError;panic code=%d", EDummyPanicBadState ); |
497 _USB_PANIC(KDummyControllerPanic, EDummyPanicBadState)); |
591 __ASSERT_DEBUG(EFalse, |
|
592 User::Panic(KDummyControllerPanic, EDummyPanicBadState)); |
498 return KErrNone; |
593 return KErrNone; |
499 } |
594 } |
500 |
595 |
501 // |
596 // |
502 // End of file |
597 // End of file |