usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp
changeset 26 0ae0f29418cd
parent 25 8c311f9acc5e
child 63 ef2686f7597e
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Fri Mar 19 09:48:52 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Fri Apr 16 16:02:21 2010 +0300
@@ -54,7 +54,6 @@
     LOG_FUNC
 
     Close();
-    delete iIconBlinkingTimer;
 
     if (iOtgWatcher.VBusObserver())
         {
@@ -95,11 +94,8 @@
     // Subscribe for otg watcher states change notifications
     iOtgWatcher.SubscribeL(*this);
 
-    iIconBlinkingTimer = CUsbTimer::NewL(*this, EIconBlinkingTimer);
-
     // check here for condition to set usb indicator
     SetIndicatorL();
-
     }
 
 // ---------------------------------------------------------------------------
@@ -114,8 +110,6 @@
 
     LOG1("aVisible = %d" , aVisible);
 
-    iIconBlinkingTimer->Cancel();
-
     SetIndicatorStateL(aVisible
                                 ? EAknIndicatorStateOn
                                    : EAknIndicatorStateOff);
@@ -129,8 +123,7 @@
     {
     LOG_FUNC
 
-    // Will be canceled if active in After()
-    iIconBlinkingTimer->After(0);
+    SetIndicatorStateL( EAknIndicatorStateAnimate );
     }
 
 // ---------------------------------------------------------------------------
@@ -152,42 +145,10 @@
     {
     LOG_FUNC
 
-    iIconBlinkingTimer->Cancel();
     TRAP_IGNORE( ShowStaticL(EFalse) );
     }
 
 // ---------------------------------------------------------------------------
-// From MUsbTimerObserver
-// ---------------------------------------------------------------------------
-// 
-void CUsbIndicatorNotifier::TimerElapsedL(TUsbTimerId aTimerId)
-    {
-    switch (aTimerId)
-        {
-        case EIconBlinkingTimer:
-            {
-            SetIndicatorStateL(iIndicatorState
-                                               ? EAknIndicatorStateOn
-                                                  : EAknIndicatorStateOff);
-
-            iIndicatorState
-                    = (iIndicatorState == EAknIndicatorStateOn
-                                                               ? EAknIndicatorStateOff
-                                                                  : EAknIndicatorStateOn);
-
-            // Will be canceled if active in After()
-            iIconBlinkingTimer->After(KUsbIndicatorBlinkingInterval);
-            break;
-            }
-        default:
-            {
-            LOG1("Unknown timer id = %d", aTimerId)
-            Panic(EWrongTimerId);
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // Set USB indicator On or Off
 // ---------------------------------------------------------------------------
 //
@@ -244,9 +205,9 @@
 //  
 void CUsbIndicatorNotifier::SetIndicatorL()
     {
-    if (!(iOtgWatcher.IsDeviceA()))
+    if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral)
         {
-        // if B, than other party (usbwatcher) takes care of usb indicator
+        // if B or peripheral, than other party (usbwatcher) takes care of usb indicator
         // in combined usbwatcher (if role swap allowed) one class has to manage usb indicator 
         return;
         }