usbengines/usbotgwatcher/src/cusbnotifmanager.cpp
changeset 1 705ec7b86991
parent 0 1e05558e2206
child 6 a15c582fbf97
--- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp	Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp	Thu Jan 07 13:25:34 2010 +0200
@@ -90,24 +90,35 @@
     return iObserver;
     }
 
+
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
-CUsbNotifManager::CUsbNotifManager()
+CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher* aOtgWatcher)
     {
+
+        FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
+
+    CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
+    CleanupStack::PushL(self);
+    self->ConstructL(aOtgWatcher);
+    CleanupStack::Pop(self);
+    return self;
     }
 
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
-void CUsbNotifManager::ConstructL()
+void CUsbNotifManager::ConstructL(CUsbOtgWatcher* aOtgWatcher)
     {
 
         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) );
 
     User::LeaveIfError(iNotifier.Connect());
+    
+    iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this, aOtgWatcher);
 
     }
 
@@ -115,16 +126,9 @@
 // 
 // ---------------------------------------------------------------------------
 //
-CUsbNotifManager* CUsbNotifManager::NewL()
+CUsbNotifManager::CUsbNotifManager()
     {
 
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
-
-    CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
     }
 
 // ---------------------------------------------------------------------------
@@ -134,10 +138,12 @@
 CUsbNotifManager::~CUsbNotifManager()
     {
 
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
+    FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
 
     CloseAllNotifiers();
-
+    
+    delete iIndicatorNotifier;
+    
     iNotifier.Close();
 
     }
@@ -200,37 +206,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbNotifManager::BlinkIndicatorL(TBool aBlinking)
-    {
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::BlinkIndicatorL, aBlinking=%d" ), aBlinking));
-
-    if (!iIndicatorNotifier)
-        iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
-
-    if (aBlinking)
-        iIndicatorNotifier->ShowL();
-    else
-        iIndicatorNotifier->Close();
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbNotifManager::ShowIndicatorL(TBool aVisible)
-    {
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowIndicatorL, aVisible=%d" ), aVisible ));
-
-    if (!iIndicatorNotifier)
-        iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
-
-    iIndicatorNotifier->ShowIndicatorL(aVisible);
-    }
-
-// ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
 //
@@ -264,6 +239,5 @@
         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) );
 
     iWaitNotifiers.ResetAndDestroy();
-    delete iIndicatorNotifier;
-    iIndicatorNotifier = NULL;
+    iIndicatorNotifier->Close();
     }