45 |
44 |
46 // Not use |
45 // Not use |
47 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_EXIT ); |
46 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBSERVICESTATECHANGE_EXIT ); |
48 } |
47 } |
49 |
48 |
|
49 #ifdef SYMBIAN_USB_BATTERYCHARGING_V1_1 |
|
50 void TUsbBatteryChargingPluginStateBase::PeerDeviceMaxPower(TUint aCurrent) |
|
51 { |
|
52 (void)aCurrent; |
|
53 } |
|
54 |
|
55 void TUsbBatteryChargingPluginStateBase::UsbChargingPortType(TUint aPortType) |
|
56 { |
|
57 switch (aPortType) |
|
58 { |
|
59 case EUsbChargingPortTypeDedicatedChargingPort: |
|
60 case EUsbChargingPortTypeAcaRidA: |
|
61 case EUsbChargingPortTypeAcaRidB: |
|
62 case EUsbChargingPortTypeNone: |
|
63 case EUsbChargingPortTypeUnsupported: |
|
64 iParent.SetState(EPluginStateIdle); |
|
65 break; |
|
66 case EUsbChargingPortTypeAcaRidC: |
|
67 case EUsbChargingPortTypeStandardDownstreamPort: |
|
68 case EUsbChargingPortTypeChargingDownstreamPort: |
|
69 case EUsbChargingPortTypeChargingPort: |
|
70 default: |
|
71 break; |
|
72 } |
|
73 } |
|
74 #endif |
|
75 |
50 void TUsbBatteryChargingPluginStateBase::UsbDeviceStateChange(TInt aLastError, |
76 void TUsbBatteryChargingPluginStateBase::UsbDeviceStateChange(TInt aLastError, |
51 TUsbDeviceState aOldState, TUsbDeviceState aNewState) |
77 TUsbDeviceState aOldState, TUsbDeviceState aNewState) |
52 { |
78 { |
53 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_ENTRY ); |
79 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_ENTRY ); |
54 |
80 (void)aLastError; |
55 (void)aLastError; |
81 (void)aOldState; |
56 (void)aOldState; |
82 iParent.iDeviceState = aNewState; |
57 (void)aNewState; |
|
58 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_EXIT ); |
83 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_USBDEVICESTATECHANGE_EXIT ); |
59 } |
84 } |
60 |
85 |
61 void TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL( |
86 |
62 const TUid& aRepository, TUint aId, TInt aVal) |
|
63 { |
|
64 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_ENTRY ); |
|
65 |
|
66 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL, |
|
67 "TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL;aRepository = 0x%08x;aId=%d;aVal=%d", |
|
68 aRepository.iUid, aId, (TInt32)aVal ); |
|
69 OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_DUP1, |
|
70 "TUsbBatteryChargingPluginStateBase::HandleRepositoryValueChangedL;Plugin State = %d, Device State = %d", |
|
71 iParent.iPluginState, iParent.iDeviceState ); |
|
72 |
|
73 if ((aRepository == KUsbBatteryChargingCentralRepositoryUid) && |
|
74 (aId == KUsbBatteryChargingKeyEnabledUserSetting)) |
|
75 { |
|
76 iParent.iUserSetting = (TUsbBatteryChargingUserSetting)aVal; |
|
77 |
|
78 if (iParent.iUserSetting == EUsbBatteryChargingUserSettingDisabled) |
|
79 { |
|
80 if(iParent.iPluginState == EPluginStateCharging) |
|
81 { |
|
82 iParent.StopCharging(); |
|
83 |
|
84 // Push EPluginStateIdleNegotiated state to recover state |
|
85 iParent.PushRecoverState(EPluginStateIdleNegotiated); |
|
86 } |
|
87 else |
|
88 { |
|
89 // Push current state to recover state |
|
90 iParent.PushRecoverState(iParent.iPluginState); |
|
91 } |
|
92 |
|
93 iParent.SetState(EPluginStateUserDisabled); |
|
94 } |
|
95 } |
|
96 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_HANDLEREPOSITORYVALUECHANGEDL_EXIT ); |
|
97 } |
|
98 |
|
99 void TUsbBatteryChargingPluginStateBase::DeviceStateTimeout() |
87 void TUsbBatteryChargingPluginStateBase::DeviceStateTimeout() |
100 { |
88 { |
101 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_ENTRY ); |
89 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_ENTRY ); |
102 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT, "TUsbBatteryChargingPluginStateBase::DeviceStateTimeout;Time: %u Plugin State = %d, Device State = %d", User::NTickCount(), (TInt32)iParent.iPluginState, (TInt32)iParent.iDeviceState ); |
90 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT, "TUsbBatteryChargingPluginStateBase::DeviceStateTimeout;Time: %u Plugin State = %d, Device State = %d", User::NTickCount(), (TInt32)iParent.iPluginState, (TInt32)iParent.iDeviceState ); |
103 |
91 |
104 iParent.iDeviceReEnumerator->Cancel(); // cancel re-enumeration AO |
92 iParent.iDeviceReEnumerator->Cancel(); // cancel re-enumeration AO |
105 |
93 |
106 if(iParent.iUserSetting) // User allow charging already and not in negotiating process... |
94 iParent.SetState(EPluginStateIdle); |
107 { |
|
108 // Should not happen !!! Otherwise, something wrong!!! |
|
109 iParent.SetState(EPluginStateIdle); |
|
110 } |
|
111 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_EXIT ); |
95 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEBASE_DEVICESTATETIMEOUT_EXIT ); |
112 } |
96 } |
113 |
97 |
114 // For host OTG enabled charging plug-in |
98 // For host OTG enabled charging plug-in |
115 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV |
99 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV |
270 switch(iParent.iDeviceState) |
233 switch(iParent.iDeviceState) |
271 { |
234 { |
272 case EUsbDeviceStateConfigured: |
235 case EUsbDeviceStateConfigured: |
273 if (iParent.IsUsbChargingPossible()) |
236 if (iParent.IsUsbChargingPossible()) |
274 { |
237 { |
275 iParent.iDeviceStateTimer->Cancel(); |
238 iParent.iAvailableMilliAmps = iParent.iRequestedCurrentValue; |
276 |
239 iParent.iDeviceStateTimer->Cancel(); |
277 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP1, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;iParent.iAvailableMilliAmps=%d", iParent.iAvailableMilliAmps ); |
240 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP1, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;iParent.iAvailableMilliAmps=%d", iParent.iAvailableMilliAmps ); |
278 iParent.iAvailableMilliAmps = iParent.iRequestedCurrentValue; |
|
279 |
241 |
280 if(0 != iParent.iRequestedCurrentValue) |
242 if(0 != iParent.iRequestedCurrentValue) |
281 { |
243 { |
282 // A non-zero value was accepted by host, charging |
244 iParent.SetState(EPluginStateIdleNegotiated); |
283 // can be performed now. |
|
284 iParent.StartCharging(iParent.iAvailableMilliAmps); |
|
285 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP2, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;PluginState => EPluginStateCharging(%d)", iParent.iPluginState ); |
245 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP2, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;PluginState => EPluginStateCharging(%d)", iParent.iPluginState ); |
286 iParent.SetNegotiatedCurrent(iParent.iAvailableMilliAmps); |
|
287 } |
246 } |
288 else |
247 else |
289 { |
248 { |
290 // Host can only accept 0 charging current |
249 // Host can only accept 0 charging current |
291 // No way to do charging |
250 // No way to do charging |
292 iParent.SetState(EPluginStateNoValidCurrent); |
251 iParent.SetState(EPluginStateNoValidCurrent); |
293 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP3, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;No more current value to try, iPluginState turned to %d", iParent.iPluginState ); |
252 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_USBDEVICESTATECHANGE_DUP3, "TUsbBatteryChargingPluginStateCurrentNegotiating::UsbDeviceStateChange;No more current value to try, iPluginState turned to %d", iParent.iPluginState ); |
294 } |
253 } |
295 } |
254 } |
296 |
|
297 break; |
255 break; |
298 |
256 |
299 // If no configured received, there must be a timeout |
257 // If no configured received, there must be a timeout |
300 // caught by the iDeviceStateTimer, and it will try next value or send state to |
258 // caught by the iDeviceStateTimer, and it will try next value or send state to |
301 // EPluginStateNoValidCurrent, so don't worry that we omit something important :-) |
259 // EPluginStateNoValidCurrent, so don't worry that we omit something important :-) |
327 } |
285 } |
328 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_EXIT ); |
286 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECURRENTNEGOTIATING_DEVICESTATETIMEOUT_EXIT ); |
329 } |
287 } |
330 |
288 |
331 |
289 |
332 // Charging plugin charing state |
|
333 |
|
334 |
|
335 TUsbBatteryChargingPluginStateCharging::TUsbBatteryChargingPluginStateCharging ( |
|
336 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
|
337 TUsbBatteryChargingPluginStateBase(aParentStateMachine) |
|
338 { |
|
339 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_ENTRY ); |
|
340 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_CONS_EXIT ); |
|
341 } |
|
342 |
|
343 void TUsbBatteryChargingPluginStateCharging::UsbDeviceStateChange( |
|
344 TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState) |
|
345 { |
|
346 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_ENTRY ); |
|
347 |
|
348 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateCharging::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState ); |
|
349 (void)aLastError; |
|
350 (void)aOldState; |
|
351 iParent.iDeviceState = aNewState; |
|
352 iParent.LogStateText(aNewState); |
|
353 |
|
354 switch(iParent.iDeviceState) |
|
355 { |
|
356 case EUsbDeviceStateConfigured: |
|
357 break; // I think this can not happen at all but in case ... |
|
358 |
|
359 case EUsbDeviceStateAttached: |
|
360 case EUsbDeviceStatePowered: |
|
361 case EUsbDeviceStateDefault: |
|
362 case EUsbDeviceStateAddress: |
|
363 case EUsbDeviceStateSuspended: |
|
364 { |
|
365 // wait until configured |
|
366 iParent.StopCharging(); |
|
367 iParent.SetState(EPluginStateIdleNegotiated); |
|
368 } |
|
369 break; |
|
370 |
|
371 default: |
|
372 break; |
|
373 } |
|
374 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATECHARGING_USBDEVICESTATECHANGE_EXIT ); |
|
375 } |
|
376 |
|
377 // Charging plugin negotiated fail state |
290 // Charging plugin negotiated fail state |
378 |
291 |
379 |
292 |
380 TUsbBatteryChargingPluginStateNoValidCurrent::TUsbBatteryChargingPluginStateNoValidCurrent ( |
293 TUsbBatteryChargingPluginStateNoValidCurrent::TUsbBatteryChargingPluginStateNoValidCurrent ( |
381 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
294 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
404 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateIdleNegotiated::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState ); |
317 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateIdleNegotiated::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState ); |
405 (void)aLastError; |
318 (void)aLastError; |
406 (void)aOldState; |
319 (void)aOldState; |
407 iParent.iDeviceState = aNewState; |
320 iParent.iDeviceState = aNewState; |
408 iParent.LogStateText(aNewState); |
321 iParent.LogStateText(aNewState); |
409 |
322 if (aNewState != EUsbDeviceStateConfigured && aNewState != EUsbDeviceStateSuspended) |
410 switch(iParent.iDeviceState) |
323 { |
411 { |
324 iParent.iAvailableMilliAmps = 0; |
412 case EUsbDeviceStateConfigured: |
325 iParent.SetState(EPluginStateIdle); |
413 { |
326 } |
414 // wait until configured |
|
415 if (iParent.IsUsbChargingPossible()) |
|
416 { |
|
417 iParent.StartCharging(iParent.iAvailableMilliAmps); |
|
418 } |
|
419 } |
|
420 break; |
|
421 |
|
422 default: |
|
423 break; |
|
424 } |
|
425 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_EXIT ); |
327 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEIDLENEGOTIATED_USBDEVICESTATECHANGE_EXIT ); |
426 } |
328 } |
427 |
329 |
428 // Charging plugin user disabled state |
|
429 |
|
430 TUsbBatteryChargingPluginStateUserDisabled::TUsbBatteryChargingPluginStateUserDisabled ( |
|
431 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
|
432 TUsbBatteryChargingPluginStateBase(aParentStateMachine) |
|
433 { |
|
434 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_ENTRY ); |
|
435 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_CONS_EXIT ); |
|
436 }; |
|
437 |
|
438 |
|
439 void TUsbBatteryChargingPluginStateUserDisabled::UsbDeviceStateChange( |
|
440 TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState) |
|
441 { |
|
442 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_ENTRY ); |
|
443 |
|
444 OstTraceExt3( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE, "TUsbBatteryChargingPluginStateUserDisabled::UsbDeviceStateChange;aLastError=%d;aOldState=%d;aNewState=%d", aLastError, aOldState, aNewState ); |
|
445 (void)aLastError; |
|
446 (void)aOldState; |
|
447 iParent.iDeviceState = aNewState; |
|
448 iParent.LogStateText(aNewState); |
|
449 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_USBDEVICESTATECHANGE_EXIT ); |
|
450 } |
|
451 |
|
452 void TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL( |
|
453 const TUid& aRepository, TUint aId, TInt aVal) |
|
454 { |
|
455 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_ENTRY ); |
|
456 |
|
457 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;aRepository = 0x%08x", aRepository.iUid ); |
|
458 OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP1, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;aId=%d;aVal=%d", aId, aVal ); |
|
459 OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP2, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;iParent.iPluginState=%d;iParent.iDeviceState=%d", iParent.iPluginState, iParent.iDeviceState ); |
|
460 |
|
461 if ((aRepository == KUsbBatteryChargingCentralRepositoryUid) && |
|
462 (aId == KUsbBatteryChargingKeyEnabledUserSetting)) |
|
463 { |
|
464 iParent.iUserSetting = (TUsbBatteryChargingUserSetting)aVal; |
|
465 |
|
466 if (iParent.iUserSetting == EUsbBatteryChargingUserSettingEnabled) |
|
467 { |
|
468 // EPluginStateUserDisabled must be the current state |
|
469 iParent.PopRecoverState(); |
|
470 if ((iParent.iPluginState == EPluginStateIdleNegotiated) |
|
471 && (iParent.iDeviceState == EUsbDeviceStateConfigured)) |
|
472 { |
|
473 iParent.StartCharging(iParent.iAvailableMilliAmps); // Go to charing state implicitly |
|
474 } |
|
475 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_DUP3, "TUsbBatteryChargingPluginStateUserDisabled::HandleRepositoryValueChangedL;PluginState => %d", iParent.iPluginState ); |
|
476 } |
|
477 } |
|
478 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_HANDLEREPOSITORYVALUECHANGEDL_EXIT ); |
|
479 } |
|
480 |
|
481 // For host OTG enabled charging plug-in |
|
482 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV |
|
483 void TUsbBatteryChargingPluginStateUserDisabled::MpsoIdPinStateChanged(TInt aValue) |
|
484 { |
|
485 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_ENTRY ); |
|
486 |
|
487 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED, "TUsbBatteryChargingPluginStateUserDisabled::MpsoIdPinStateChanged;IdPinState changed => %d", aValue ); |
|
488 |
|
489 // Disable charging here when IdPin is present |
|
490 // When IdPin disappears (i.e. the phone becomes B-Device), all necessary step are performed |
|
491 // in UsbDeviceStateChange() method |
|
492 |
|
493 iParent.iIdPinState = aValue; |
|
494 |
|
495 switch(aValue) |
|
496 { |
|
497 case EUsbBatteryChargingIdPinARole: |
|
498 TRAP_IGNORE(iParent.SetInitialConfigurationL()); |
|
499 iParent.PushRecoverState(EPluginStateBEndedCableNotPresent); |
|
500 |
|
501 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT ); |
|
502 return; |
|
503 |
|
504 case EUsbBatteryChargingIdPinBRole: |
|
505 iParent.PushRecoverState(EPluginStateIdle); |
|
506 break; |
|
507 |
|
508 default: |
|
509 iParent.SetState(EPluginStateIdle); |
|
510 break; |
|
511 } |
|
512 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOIDPINSTATECHANGED_EXIT_DUP1 ); |
|
513 } |
|
514 |
|
515 #endif |
|
516 |
|
517 void TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged(TInt aNewState) |
|
518 { |
|
519 OstTraceFunctionEntry0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_ENTRY ); |
|
520 |
|
521 if (aNewState == iParent.iVBusState) |
|
522 { |
|
523 OstTrace1( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED, "TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged;Receive VBus State Change notification without any state change: aNewState = %d", aNewState ); |
|
524 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT ); |
|
525 return; |
|
526 } |
|
527 |
|
528 OstTraceExt2( TRACE_NORMAL, REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_DUP1, "TUsbBatteryChargingPluginStateUserDisabled::MpsoVBusStateChanged;VBusState changed from %d to %d", iParent.iVBusState, aNewState ); |
|
529 |
|
530 iParent.iVBusState = aNewState; |
|
531 if (aNewState == 0) // VBus drop down - we have disconnected from host |
|
532 { |
|
533 iParent.iRequestedCurrentValue = 0; |
|
534 iParent.iCurrentIndexRequested = 0; |
|
535 iParent.iAvailableMilliAmps = 0; |
|
536 |
|
537 iParent.iPluginStateToRecovery = EPluginStateIdle; |
|
538 } |
|
539 |
|
540 // The handling of VBus on will be down in DeviceStateChanged implicitly |
|
541 OstTraceFunctionExit0( REF_TUSBBATTERYCHARGINGPLUGINSTATEUSERDISABLED_MPSOVBUSSTATECHANGED_EXIT_DUP1 ); |
|
542 } |
|
543 |
|
544 |
|
545 // Charging plugin A-role state |
330 // Charging plugin A-role state |
546 |
331 |
547 TUsbBatteryChargingPluginStateBEndedCableNotPresent::TUsbBatteryChargingPluginStateBEndedCableNotPresent ( |
332 TUsbBatteryChargingPluginStateBEndedCableNotPresent::TUsbBatteryChargingPluginStateBEndedCableNotPresent ( |
548 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
333 CUsbBatteryChargingPlugin& aParentStateMachine ) : |
549 TUsbBatteryChargingPluginStateBase(aParentStateMachine) |
334 TUsbBatteryChargingPluginStateBase(aParentStateMachine) |
550 { |
335 { |
551 OstTraceFunctionEntry0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_ENTRY ); |
336 OstTraceFunctionEntry0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_ENTRY ); |
552 OstTraceFunctionExit0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_EXIT ); |
337 OstTraceFunctionExit0( RES_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_TUSBBATTERYCHARGINGPLUGINSTATEBENDEDCABLENOTPRESENT_CONS_EXIT ); |
553 }; |
338 } |
554 |
339 |
555 |
340 #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV |
556 |
341 void TUsbBatteryChargingPluginStateBEndedCableNotPresent::MpsoIdPinStateChanged(TInt aValue) |
|
342 { |
|
343 iParent.iIdPinState = aValue; |
|
344 |
|
345 switch(aValue) |
|
346 { |
|
347 case EUsbBatteryChargingIdPinARole: |
|
348 break; |
|
349 case EUsbBatteryChargingIdPinBRole: |
|
350 iParent.SetState(EPluginStateIdle); |
|
351 break; |
|
352 default: |
|
353 iParent.SetState(EPluginStateIdle); |
|
354 break; |
|
355 } |
|
356 } |
|
357 #endif |
|
358 |
|
359 |
|
360 |