usbengines/usbotgwatcher/src/cusbnotifmanager.cpp
changeset 47 878846f7623e
parent 46 0ffee699d6c7
child 63 ef2686f7597e
child 93 2dc695882abd
equal deleted inserted replaced
46:0ffee699d6c7 47:878846f7623e
     1 /*
     1 /*
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   112 //
   112 //
   113 void CUsbNotifManager::ConstructL(CUsbOtgWatcher& aOtgWatcher)
   113 void CUsbNotifManager::ConstructL(CUsbOtgWatcher& aOtgWatcher)
   114     {
   114     {
   115     LOG_FUNC
   115     LOG_FUNC
   116 
   116 
   117     User::LeaveIfError(iNotifier.Connect());
   117     LEAVEIFERROR(iNotifier.Connect());
   118 
   118 
   119     iIndicatorNotifier = CUsbIndicatorNotifier::NewL(*this, aOtgWatcher);
   119     iIndicatorNotifier = CUsbIndicatorNotifier::NewL(*this, aOtgWatcher);
   120 
   120 
   121     }
   121     }
   122 
   122 
   177     // As notifiers can be more than two types such as warning, error, indicator ...
   177     // As notifiers can be more than two types such as warning, error, indicator ...
   178     // to create concret notifiers according to categories instead of checking aObserver null
   178     // to create concret notifiers according to categories instead of checking aObserver null
   179     CUsbNotifier* notifier(NULL);
   179     CUsbNotifier* notifier(NULL);
   180     if (aCat == KUsbUiNotifOtgError)
   180     if (aCat == KUsbUiNotifOtgError)
   181         {
   181         {
   182         __ASSERT_ALWAYS(aObserver != NULL, Panic(EWrongNotifierCategory));
   182         ASSERT_PANIC(aObserver != NULL, EWrongNotifierCategory);
   183         notifier = CUsbWaitNotifier::NewL(iNotifier, *this, aNotifId);
   183         notifier = CUsbWaitNotifier::NewL(iNotifier, *this, aNotifId);
   184         }
   184         }
   185     else if (aCat == KUsbUiNotifOtgWarning)
   185     else if (aCat == KUsbUiNotifOtgWarning)
   186         {
   186         {
   187         notifier = CUsbWarningNotifier::NewL(iNotifier, *this, aNotifId);
   187         notifier = CUsbWarningNotifier::NewL(iNotifier, *this, aNotifId);
   188         }
   188         }
   189     else
   189     else
   190         {
   190         {
   191         LOG1("Unexpected aCat = 0x%X", aCat );
   191         LOG1("Unexpected aCat = 0x%X", aCat );
   192         Panic(EWrongNotifierCategory);
   192         PANIC(EWrongNotifierCategory);
   193         }
   193         }
   194 
   194 
   195     CleanupStack::PushL(notifier);
   195     CleanupStack::PushL(notifier);
   196 
   196 
   197     iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, *aObserver));
   197     iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, *aObserver));