# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268401720 -7200 # Node ID a15c582fbf976e98e8b3e35edc0aa75c12dd2a0a # Parent 7068aba64af5dd2e350b56b384911486dcc8853d Revision: 201007 Kit: 201008 diff -r 7068aba64af5 -r a15c582fbf97 layers.sysdef.xml --- a/layers.sysdef.xml Fri Feb 19 23:50:33 2010 +0200 +++ b/layers.sysdef.xml Fri Mar 12 15:48:40 2010 +0200 @@ -13,6 +13,7 @@ + diff -r 7068aba64af5 -r a15c582fbf97 package_definition.xml --- a/package_definition.xml Fri Feb 19 23:50:33 2010 +0200 +++ b/package_definition.xml Fri Mar 12 15:48:40 2010 +0200 @@ -4,7 +4,6 @@ - @@ -12,19 +11,12 @@ - - - - - - - - - - + + + @@ -32,7 +24,6 @@ - @@ -40,15 +31,16 @@ + + + - - @@ -57,5 +49,10 @@ + + + + + diff -r 7068aba64af5 -r a15c582fbf97 usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h --- a/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -415,6 +415,11 @@ TBool iMountChanged; /** + * If query note shown by us + */ + TBool iIsQueryNoteShown; + + /** * Used to load devenccommonutils.dll and check the device encryption status */ RLibrary iLibrary; diff -r 7068aba64af5 -r a15c582fbf97 usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp --- a/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -47,7 +47,9 @@ // ---------------------------------------------------------------------------- // CUsbActiveMscHandler::CUsbActiveMscHandler(TUsbPersonalityParams& aPersonalityParams) - : CUsbPersonalityPlugin(aPersonalityParams), iMountChanged(EFalse) + : CUsbPersonalityPlugin(aPersonalityParams), + iMountChanged(EFalse), + iIsQueryNoteShown(EFalse) { CActiveScheduler::Add( this ); } @@ -256,9 +258,13 @@ RemoveMassStorageFileSystem(); - // Remove all queries shown by this personality - iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier); - + if (iIsQueryNoteShown) + { + // Remove all queries shown by this personality + iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier); + iIsQueryNoteShown = EFalse; + } + iMscState = EUsbMscStateIdle; iRequestStatus = &aStatus; @@ -295,6 +301,7 @@ { if ( GlobalSystemState() == EUsbGSStateCategoryNormal ) { + iIsQueryNoteShown = ETrue; // if the error is something abnormal, note still needs to be shown iQueryParams().iQuery = EUSBStorageMediaFailure; iPersonalityParams.PersonalityNotifier().ShowQuery( @@ -491,6 +498,7 @@ { FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler::GetDrives: No removable drives found." ) ); + iIsQueryNoteShown = ETrue; iQueryParams().iQuery = EUSBStorageMediaFailure; iPersonalityParams.PersonalityNotifier().ShowQuery(KQueriesNotifier, iQueryParams, iDummy); diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/group/usbotgwatcher.mmp --- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Mar 12 15:48:40 2010 +0200 @@ -39,17 +39,17 @@ SOURCE cusbotgwatcher.cpp SOURCE cusbservicecontrol.cpp -SOURCE cusbpersonalityswitch.cpp SOURCE cusbstate.cpp SOURCE cusbstatehostabase.cpp -SOURCE cusbstatehostainitiatebase.cpp SOURCE cusbstatehostainitiate.cpp SOURCE cusbstatehostahost.cpp SOURCE cusbstatehostaperipheral.cpp -SOURCE cusbstatehostaidle.cpp -SOURCE cusbstatehosthandle.cpp +SOURCE cusbstatehosthandle.cpp SOURCE cusbstatehostdelayhandle.cpp +SOURCE cusbstatehostdelayattachedhandle.cpp +SOURCE cusbstatehostdelaynotattachedhandle.cpp +SOURCE cusbstatehosthandledropping.cpp SOURCE cusbstatehostundefined.cpp SOURCE cusbwaitnotifier.cpp diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h --- a/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Monitors USB activity + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Monitors USB activity + * + */ #ifndef C_USBBUSACTIVITYOBSERVER_H #define C_USBBUSACTIVITYOBSERVER_H @@ -39,13 +38,13 @@ * Called when when bus is in Idle, and some activity appears on the bus */ virtual void BusActiveL() = 0; - + /** - * Called when when error happened - * @param aError errorcode - */ - virtual void BusActivityErrorL(TInt aError) = 0; - + * Called when when error happened + * @param aError errorcode + */ + virtual void BusActivityErrorL(TInt aError) = 0; + }; /** @@ -126,7 +125,7 @@ /** * The observer reports state changes to own observers - * Owns + * Not owns */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h --- a/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Monitors host events + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Monitors host events + * + */ #ifndef C_USBHOSTEVENTNOTIFICATIONOBSERVER_H #define C_USBHOSTEVENTNOTIFICATIONOBSERVER_H @@ -63,11 +62,11 @@ * @param aInfo additional information */ virtual void DriverLoadFailureL(TDeviceEventInformation aInfo) = 0; - + /** - * Called when error happens while observing - * @param aError error code - */ + * Called when error happens while observing + * @param aError error code + */ virtual void HostEventNotificationErrorL(TInt aError) = 0; }; @@ -142,7 +141,7 @@ /** * The observer reports changes to own observers - * Owns + * Not owns */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbidpinobserver.h --- a/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Monitors ID pin change + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Monitors ID pin change + * + */ #ifndef C_USBIDPINOBSERVER_H #define C_USBIDPINOBSERVER_H @@ -39,13 +38,12 @@ * IdPin appeared */ virtual void IdPinOnL() = 0; - + /** * IdPin error * @param aError error code */ virtual void IdPinErrorL(TInt aError) = 0; - }; @@ -67,7 +65,7 @@ * @return instance of the objects of this class */ static CUsbIdPinObserver* NewL(); - + /** * Destructor. */ @@ -128,7 +126,7 @@ /** * The observer reports state changes to its own observers - * Own + * Not own */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbindicatornotifier.h --- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Blink/show Usb indicator notifier implementation + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Blink/show Usb indicator notifier implementation + * + */ #ifndef C_USBINDICATORNOTIFIER_H #define C_USBINDICATORNOTIFIER_H @@ -23,13 +22,11 @@ #include // SAknSmallIndicatorParams #include // SAknNotifierPackage #include // EAknIndicatorUSBConnection - #include "cusbtimer.h" #include "cusbnotifier.h" #include "cusbvbusobserver.h" #include "cusbotgwatcher.h" - /** * Class implements functionality of showing/blinking usb indicator * Class does not provide method to get response from the user @@ -43,7 +40,7 @@ * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications * @return Pointer to the new instance of CUsbIndicatorNotifier */ - static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher); + static CUsbIndicatorNotifier* NewL(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher); /** * Destructor. @@ -56,7 +53,7 @@ * @param aState new state */ virtual void OtgWatcherStateChangedL(TUsbStateIds aState); - + // From MUsbVBusObserver /** * VBus down event received @@ -69,10 +66,9 @@ /** * error handler * @param aError error code - */ + */ virtual void VBusObserverErrorL(TInt aError); - - + // From base class CUsbNotifier /** * Start to show notifier @@ -98,7 +94,7 @@ * @param aNotifManger parent * @param aOtgWatcher Otg watcher */ - CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher); + CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher); /** * 2nd phase constructor. @@ -110,7 +106,7 @@ * @param aState Indicator states */ void SetIndicatorStateL(const TInt aState); - + /** * Show/hide static icon of the indicator. * If the indicator is blinking, stop blinking it and show/hide the static @@ -118,17 +114,17 @@ * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator */ void ShowStaticL(TBool aVisible); - + /** * Blinks indicator */ void BlinkL(); - + /** * Sets indicator accordingly */ void SetIndicatorL(); - + private: // data @@ -136,8 +132,8 @@ * OtgWatcher * not own */ - CUsbOtgWatcher* iOtgWatcher; - + CUsbOtgWatcher& iOtgWatcher; + /** * Switch timer for showing/hiding the usb indicator interleavingly for * animating the indicator. diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h --- a/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Observes notifications from usb + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Observes notifications from usb + * + */ #ifndef C_USBMESSAGENOTIFICATIONOBSERVER_H #define C_USBMESSAGENOTIFICATIONOBSERVER_H @@ -58,12 +57,12 @@ * Called when session requested */ virtual void SessionRequestedL() = 0; - + /** - * Called when error happened - * @param aError error code - */ - virtual void MessageNotificationErrorL(TInt aError) = 0; + * Called when error happened + * @param aError error code + */ + virtual void MessageNotificationErrorL(TInt aError) = 0; }; /** @@ -139,7 +138,7 @@ /** * The observer reports to own observers - * Owns + * Not owns */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbnotenotifier.h --- a/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base classes for Usb notifier wrapper + * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base classes for Usb notifier wrapper + * + */ #ifndef C_CUSBNOTENOTIFIER_H #define C_CUSBNOTENOTIFIER_H @@ -38,62 +37,67 @@ */ class CNotifierActive : public CActive { - public: - /** - * Default constructor - * @param aNotifier RNotifier API - * @param aUsbNoteNotifier the note notifier container - */ - CNotifierActive(RNotifier& aNotifier, CUsbNoteNotifier* aUsbNoteNotifier); - - /** - * Destructor - */ - virtual ~CNotifierActive(); - - /** - * Start to show the notifier - */ - void StartL(); - - protected: - // From base class CActive - /** - * Caled when outstanding request completed - */ - void RunL(); + public: + /** + * Default constructor + * @param aNotifier RNotifier API + * @param aUsbNoteNotifier the note notifier container + */ + CNotifierActive(RNotifier& aNotifier, CUsbNoteNotifier& aUsbNoteNotifier); + + /** + * Destructor + */ + virtual ~CNotifierActive(); + + /** + * Start to show the notifier + */ + void StartL(); + + protected: + // From base class CActive + /** + * Caled when outstanding request completed + */ + void RunL(); - /** - * Called when outstanding request cancelled - */ - void DoCancel(); + /** + * Called when outstanding request cancelled + */ + void DoCancel(); - /** - * Called when RunL leaves - * @param aError errorcode - * @return errorcode - */ - TInt RunError(TInt aError); + /** + * Called when RunL leaves + * @param aError errorcode + * @return errorcode + */ + TInt RunError(TInt aError); - private: - // data + private: + // data - /** - * The note notifier container - * Not Own - */ - CUsbNoteNotifier* iUsbNoteNotifier; - - /** - * RNotifier API - * Not Own - */ - RNotifier& iNotifier; + /** + * The note notifier container + * Not Own + */ + CUsbNoteNotifier& iUsbNoteNotifier; + + /** + * RNotifier API + * Not Own + */ + RNotifier& iNotifier; /** * Response from notifier */ TPckg iRes; + + /** + * Notifier id pckg buffer + */ + TPckgBuf iNotifIdPckg; }; public: @@ -122,14 +126,14 @@ * @param acat Category * @param aNotidId id */ - CUsbNoteNotifier(RNotifier& aNotifier, CUsbNotifManager* aNotifManager, + CUsbNoteNotifier(RNotifier& aNotifier, CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId); /** * 2nd phase constructor. */ void ConstructL(); - + private: // data @@ -138,7 +142,7 @@ * Own */ CNotifierActive* iNotifierActive; - + /** * RNotifier API * Not Own diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbnotifier.h --- a/usbengines/usbotgwatcher/inc/cusbnotifier.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbnotifier.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base classes for Usb notifier wrapper + * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base classes for Usb notifier wrapper + * + */ #ifndef C_CUSBNOTIFIER_H #define C_CUSBNOTIFIER_H @@ -62,7 +61,7 @@ * @param acat Category * @param aNotidId id */ - CUsbNotifier(CUsbNotifManager* aNotifManager, TUid aCat, TUint aNotifId); + CUsbNotifier(CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId); /** * Set by child-class if the concrete notifier needs feedback from end-user @@ -77,7 +76,7 @@ * All notifiers are created, destroied and manupulated by the manager. * Not own */ - CUsbNotifManager* iNotifManager; + CUsbNotifManager& iNotifManager; /** * Category of the notifier. Needed for cancelling diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbnotifmanager.h --- a/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Manages notifiers + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Manages notifiers + * + */ #ifndef C_USBNOTIFMANAGER_H #define C_USBNOTIFMANAGER_H @@ -58,7 +57,7 @@ * aObserver will receive notification when completed */ static CWaitNotifierInfo* NewL(CUsbNotifier* aWaitNotifier, - MWaitNotifierObserver* aObserver); + MWaitNotifierObserver& aObserver); /** * Destructor @@ -83,7 +82,7 @@ * @param aObserver Observer */ CWaitNotifierInfo(CUsbNotifier* aWaitNotifier, - MWaitNotifierObserver* aObserver); + MWaitNotifierObserver& aObserver); /** * 2nd phase construction @@ -102,7 +101,7 @@ * observer * not owns */ - MWaitNotifierObserver* iObserver; + MWaitNotifierObserver& iObserver; }; /** @@ -119,7 +118,7 @@ * 2phase construction * @param aOtgWatcher OtgWatcher is a parent class */ - static CUsbNotifManager* NewL(CUsbOtgWatcher* aOtgWatcher); + static CUsbNotifManager* NewL(CUsbOtgWatcher& aOtgWatcher); /** * Destructor @@ -133,20 +132,20 @@ * @param aObserver will receive notifications */ void ShowNotifierL(TUid aCat, TUint aNotifId, - MWaitNotifierObserver* aObserver = NULL); + MWaitNotifierObserver* aObserver); /** * Closes and deletes all the notifiers */ void CloseAllNotifiers(); - + /** * Calls back Notifier show is over * @param aWaitNotifier wait notifier * @param aResult result (was any errors or not) * @param aFeedback user press (cancel or any other) */ - void NotifierShowCompletedL(CUsbNotifier* aWaitNotifier, TInt aResult, + void NotifierShowCompletedL(CUsbNotifier& aWaitNotifier, TInt aResult, TInt aFeedback); private: @@ -160,7 +159,7 @@ /** * Second phase construction */ - void ConstructL(CUsbOtgWatcher* aOtgWatcher); + void ConstructL(CUsbOtgWatcher& aOtgWatcher); private: // data diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbotgstateobserver.h --- a/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Observes OTG states + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Observes OTG states + * + */ #ifndef C_USBOTGSTATEOBSERVER_H #define C_USBOTGSTATEOBSERVER_H @@ -64,12 +63,12 @@ * Local device is B, and get to Host state */ virtual void BHostL() = 0; - + /** * Error handler * @param aError error code */ - virtual void OtgStateErrorL(TInt aError) = 0; + virtual void OtgStateErrorL(TInt aError) = 0; }; /** @@ -151,7 +150,7 @@ /** * The observer reports state changes to own observers - * Owns + * Not owns */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbotgwatcher.h --- a/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: OTG watcher state machine owner + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: OTG watcher state machine owner + * + */ #ifndef C_USBOTGWATCHER_H #define C_USBOTGWATCHER_H @@ -88,17 +87,20 @@ friend class CtUsbOtgWatcher; public: + /** * Two-phased constructor. * @param aUsb usbman API */ - IMPORT_C static CUsbOtgWatcher* NewL(RUsb& aUsb); + IMPORT_C + static CUsbOtgWatcher* NewL(RUsb& aUsb); /** * Check ID-Pin state * @return ETrue if the ID-Pin is present (A-Device) */ - IMPORT_C TBool IsDeviceA(); + IMPORT_C + TBool IsDeviceA(); /** * Destructor. @@ -159,7 +161,7 @@ /** * Id Pin On * @param aError - */ + */ void IdPinErrorL(TInt aError); // From VBus observer @@ -225,7 +227,7 @@ /** * error * @param aError error happened - */ + */ void BusActivityErrorL(TInt aError); // From Host Event notification observer @@ -257,7 +259,7 @@ /** * Error happened during observing * @param aError error code - */ + */ void HostEventNotificationErrorL(TInt aError); // From message notification observer @@ -285,9 +287,9 @@ /** * Error handler * @param error code - */ + */ void MessageNotificationErrorL(TInt aError); - + // From CUsbServiceControl /** * called when request for usb services is completed @@ -348,15 +350,17 @@ CUsbNotifManager* NotifManager(); /** * @return Handle state + * @param aStateId state id */ CUsbStateHostHandle* HostHandle(TUsbStateIds aStateId) const; /** * Handles problems in host functioning * @param aWhatKindOf problem Id to be handled + * @param aInState state id where to handle */ void HandleHostProblemL(TInt aWhatKindOf, TUsbStateIds aInState); - + /** * Add observer to USb Otg state machine * @param aObserver Observer @@ -373,7 +377,7 @@ * Used for test purposes */ void PrintStateToLog(); - + private: /** @@ -405,12 +409,12 @@ * @param aNewStateId new host state (id) */ void ChangeHostStateL(TUsbStateIds aNewStateId); - + /** * Used for test purposes * @return KErrNone if test is OK, otherwise errorcode */ - TInt SelfTestL(); + TInt SelfTestL(); private: // data @@ -491,12 +495,18 @@ * Own. */ CUsbServiceControl* iUsbServiceControl; - + /** * The observer reports state changes to its own observers * Not Own */ RPointerArray iOtgStateObservers; + + /** + * The observer reports state changes to its own observers + * Not Own + */ + CUsbServiceControl::TUsbServiceRequest iUsbServiceRequest; }; #endif // C_USBOTGWATCHER_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbservicecontrol.h --- a/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #ifndef C_USBSERVICECONTROL_H #define C_USBSERVICECONTROL_H @@ -50,12 +49,19 @@ public: + enum TUsbServiceRequest + { + ERequestUndefined, + EStartUsbService, + EStopUsbService + }; + /** * Two-phased constructor. * @param aObserver Observer * @param aUsb RUsb API */ - static CUsbServiceControl* NewL(MUsbServiceControlObserver* aObserver, + static CUsbServiceControl* NewL(MUsbServiceControlObserver& aObserver, RUsb& aUsb); /** @@ -107,7 +113,7 @@ * @param aObserver receives call back when service started or stopped * @param aUsb usbman API */ - CUsbServiceControl(MUsbServiceControlObserver* aObserver, RUsb& aUsb); + CUsbServiceControl(MUsbServiceControlObserver& aObserver, RUsb& aUsb); /** * 2nd phase construction @@ -120,7 +126,7 @@ * Observer * not own */ - MUsbServiceControlObserver* iObserver; + MUsbServiceControlObserver& iObserver; /** * RUsb API diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstate.h --- a/usbengines/usbotgwatcher/inc/cusbstate.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstate.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base class for states in state machine + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base class for states in state machine + * + */ #ifndef C_USBSTATE_H #define C_USBSTATE_H @@ -70,25 +69,25 @@ * This might be used in switching states in watcher. New state object searched by its id * @return Id */ - virtual TUsbStateIds Id(); - + virtual TUsbStateIds Id() = 0; + /** * Destruction */ virtual ~CUsbState(); - + /** * Two-phased constructor. * @param aWatcher owner */ - static CUsbState* NewL(CUsbOtgWatcher* aWatcher); + //static CUsbState* NewL(CUsbOtgWatcher& aWatcher); protected: /** * default constructor is protected to be able to be inherited be child classes * @param aOwner owner of the state */ - CUsbState(CUsbOtgWatcher* aOwner); + CUsbState(CUsbOtgWatcher& aOwner); /* * * Changes state in Device state machine @@ -101,20 +100,14 @@ * @param aNewStateId new host state */ void ChangeHostStateL(TUsbStateIds aNewStateId); - + /** * Handles special situation (error, or something else) * @param aWhat to hande (id) + * @param aWhereTohandle state id where to handle */ virtual void HandleL(TInt aWhat, TUsbStateIds aWhereTohandle); -private: - - /** - * 2nd phase construction - */ - void ConstructL(); - /** * State machine calls this, state object to perform any initial * activity, once just entered this state @@ -135,6 +128,11 @@ */ /** + * 2nd phase construction + */ + void ConstructL(); + + /** * Sets personality */ virtual void SetPersonalityL(); @@ -277,7 +275,7 @@ * Owner * Not own. */ - CUsbOtgWatcher* iWatcher; + CUsbOtgWatcher& iWatcher; }; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostabase.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the conctet state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of the conctet state + * + */ #ifndef C_USBSTATEHOSTABASE_H #define C_USBSTATEHOSTABASE_H @@ -41,14 +40,13 @@ * default construction * @param aWatcher owner */ - CUsbStateHostABase(CUsbOtgWatcher* aWatcher); + CUsbStateHostABase(CUsbOtgWatcher& aWatcher); /** * second phase construction */ void ConstructL(); - //from CUsbState // From VBus observer /** * VBus down @@ -66,6 +64,16 @@ */ virtual void AVBusErrorL(); + /** + * VBus error happen + */ + virtual void AHostL(); + + /** + * VBus error happen + */ + virtual void APeripheralL(); + // From bus activity observer /** * Bus is in idle @@ -83,6 +91,10 @@ */ virtual void MessageNotificationReceivedL(TInt aMessage); /** + * SRP request received + */ + virtual void SrpReceivedL(); + /** * Connected to hub in wrong level */ virtual void BadHubPositionL(); diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostahost.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,31 +1,26 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the concret state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of the concret state + * + */ #ifndef C_USBSTATEHOSTAHOST_H #define C_USBSTATEHOSTAHOST_H -#include "cusbotgwatcher.h" #include "cusbstatehostabase.h" -#ifndef STIF -#include "cusbtimer.h" -#else -#include "mockcusbtimer.h" -#endif + +class CUsbOtgWatcher; /** * This class implements behaviour in Host state (Drivers loaded, device is in Host role) @@ -39,7 +34,7 @@ * Two-phased constructor. * @param aWatcher Owner */ - static CUsbStateHostAHost* NewL(CUsbOtgWatcher* aWatcher); + static CUsbStateHostAHost* NewL(CUsbOtgWatcher& aWatcher); /** * Destructor. @@ -52,7 +47,7 @@ * Default construction * @param aWatcher owner */ - CUsbStateHostAHost(CUsbOtgWatcher* aWatcher); + CUsbStateHostAHost(CUsbOtgWatcher& aWatcher); /** * 2nd phase construction @@ -72,38 +67,27 @@ * trigger it and transition will not happen. This forces the transition in such cases. * */ - void JustAdvancedToThisStateL(); + virtual void JustAdvancedToThisStateL(); /** * State machine calls this, state object to perform any initial * activity, just before leaving this state * */ - void JustBeforeLeavingThisStateL(); + virtual void JustBeforeLeavingThisStateL(); - // From OTG state observer - /** - * Became a Host when A - */ - void AHostL(); - - /** - * Became a Peripheral when A - */ - void APeripheralL(); - // From Host Event notification observer /** * Device is detached * @param aInfo Device event data */ - void DeviceDetachedL(TDeviceEventInformation aInfo); + virtual void DeviceDetachedL(TDeviceEventInformation aInfo); // From message notification observer /** * Connected to hub in wrong level */ - void BadHubPositionL(); + virtual void BadHubPositionL(); private: // data diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,37 +1,39 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the concret state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of the concret state + * + */ #ifndef C_USBSTATEHOSTAINITIATE_H #define C_USBSTATEHOSTAINITIATE_H -#include "cusbotgwatcher.h" -#include "cusbstatehostainitiatebase.h" +#include "cusbstatehostabase.h" + #ifndef STIF #include "cusbtimer.h" #else #include "mockcusbtimer.h" #endif +class CUsbOtgWatcher; + /** * This class implements behaviour when Id pin just detected (initiating host role, loading drivers) * */ -NONSHARABLE_CLASS( CUsbStateHostAInitiate ) : public CUsbStateHostAInitiateBase +NONSHARABLE_CLASS( CUsbStateHostAInitiate ) : public CUsbStateHostABase, +MUsbTimerObserver { friend class CtUsbOtgWatcher; @@ -41,7 +43,7 @@ * Two-phased constructor. * @param aWatcher owner */ - static CUsbStateHostAInitiate* NewL(CUsbOtgWatcher* aWatcher); + static CUsbStateHostAInitiate* NewL(CUsbOtgWatcher& aWatcher); /** * Destructor. @@ -50,11 +52,18 @@ private: + // From MUsbTimerObserver + /** + * timer expired call back + * @param aTimerId timer id + */ + void TimerElapsedL(TUsbTimerId aTimerId); + /** * default construction * @param aWatcher owner */ - CUsbStateHostAInitiate(CUsbOtgWatcher* aWatcher); + CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher); /** * 2nd phase construction @@ -75,14 +84,54 @@ * */ void JustAdvancedToThisStateL(); - + /** * This is called when switched to this state, * because If all conditions for transition to another state exist, nothing will * trigger it and transition will not happen. This forces the transition in such cases. * */ - virtual void JustBeforeLeavingThisStateL(); + void JustBeforeLeavingThisStateL(); + + // From VBus observer + /** + * VBus up + */ + void VBusUpL(); + + // From Host Event notification observer + /** + * Device is attached + * @param Device event data + */ + void DeviceAttachedL(TDeviceEventInformation); + + /** + * Device is detached + * @param Device event data + */ + void DriverLoadSuccessL(TDeviceEventInformation); + + /** + * Drivers loaded partially + * @param Device event data + */ + void DriverLoadPartialSuccessL(TDeviceEventInformation); + + /** + * Drivers loading failed + * @param Device event data + */ + void DriverLoadFailureL(TDeviceEventInformation); + +private: + // data + + /* + * attachment timer + * own + */ + CUsbTimer* iAttachmentTimer; }; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,31 +1,26 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements concrete state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ #ifndef C_USBSTATEHOSTAPERIPHERAL_H #define C_USBSTATEHOSTAPERIPHERAL_H -#include "cusbotgwatcher.h" #include "cusbstatehostabase.h" -#ifndef STIF -#include "cusbtimer.h" -#else -#include "mockcusbtimer.h" -#endif + +class CUsbOtgWatcher; /** * This class implements behaviour when A device performs peripheral role, from OTG point of view @@ -40,7 +35,7 @@ * Two-phased constructor. * @param aWatcher owner */ - static CUsbStateHostAPeripheral* NewL(CUsbOtgWatcher* aWatcher); + static CUsbStateHostAPeripheral* NewL(CUsbOtgWatcher& aWatcher); /** * Destructor. @@ -53,20 +48,13 @@ * default constructor * @param aWatcher owner */ - CUsbStateHostAPeripheral(CUsbOtgWatcher* aWatcher); + CUsbStateHostAPeripheral(CUsbOtgWatcher& aWatcher); /** * 2nd phase construction */ void ConstructL(); - /** - * State machine calls this, state object to perform any initial - * activity, once just entered this state - * - */ - void JustAdvancedToThisStateL(); - //from CUsbState /** * state id diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ + +#ifndef C_USBSTATEHOSTDALAYATTACHEDHANDLE_H +#define C_USBSTATEHOSTDALAYATTACHEDHANDLE_H + +#include "cusbstatehostdelayhandle.h" + +#ifndef STIF +#include "cusbtimer.h" +#else +#include "mockcusbtimer.h" +#endif + +class CUsbOtgWatcher; + +/** + * problem handling, device is attached, vbus not dropping + * + */ +NONSHARABLE_CLASS( CUsbStateHostDelayAttachedHandle ) : public CUsbStateHostDelayHandle, +public MUsbTimerObserver + { + friend class CtUsbOtgWatcher; + friend class CUsbOtgWatcher; + +public: + + /** + * Two-phased constructor. + * @param aWatcher owner + */ + static CUsbStateHostDelayAttachedHandle* NewL(CUsbOtgWatcher& aWatcher); + + /** + * Destructor. + */ + virtual ~CUsbStateHostDelayAttachedHandle(); + +protected: + + // From MUsbTimerObserver + /** + * Call back when timer expired + * @param aTimerId timer id + */ + void TimerElapsedL(TUsbTimerId aTimerId); + + /** + * Device is detached + * @param aInfo Device event data + */ + virtual void DeviceDetachedL(TDeviceEventInformation aInfo); + + //from CUsbState + /** + * State id + * @return state id + */ + virtual TUsbStateIds Id(); + + /** + * This is called when leaving this state, + * + */ + virtual void JustBeforeLeavingThisStateL(); + + /** + * handles issue + */ + virtual void DoHandleL(); + + /** + * Default constructor + * @param aWatcher owner + */ + CUsbStateHostDelayAttachedHandle(CUsbOtgWatcher& aWatcher); + + /** + * 2nd phase construction + */ + void ConstructL(); + + // data + +private: + /** + * drivers not found + * own + */ + CUsbTimer* iDriversNotFoundTimer; + }; + +#endif // C_USBSTATEHOSTDELAYATTACHEDHANDLE_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,43 +1,32 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements concrete state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ - -#ifndef C_USBSTATEHOSTDALAYHANDLE_H +#ifndef C_USBSTATEHOSTDELAYHANDLE_H #define C_USBSTATEHOSTDELAYHANDLE_H -#include "cusbotgwatcher.h" #include "cusbstatehosthandle.h" -#ifndef STIF -#include "cusbnotifmanager.h" -#include "cusbtimer.h" -#else -#include "mockcusbnotifmanager.h" -#include "mockcusbtimer.h" -#endif +class CUsbOtgWatcher; /** - * This class implements behaviour when some problem needs vbus drop in a while, and mostly, user action. + * problem handling, vbus not dropping * */ -NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle, - // MWaitNotifierObserver, - MUsbTimerObserver -// this means only one wait notifier at a time can be shown by this state, might be redesigned +NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle { friend class CtUsbOtgWatcher; friend class CUsbOtgWatcher; @@ -45,119 +34,39 @@ public: /** - * Two-phased constructor. - * @param aWatcher owner - */ - static CUsbStateHostDelayHandle* NewL(CUsbOtgWatcher* aWatcher); - - /** * Destructor. */ virtual ~CUsbStateHostDelayHandle(); - // From MUsbTimerObserver - /** - * Call back when timer expired - * @param aTimerId timer id - */ - void TimerElapsedL(TUsbTimerId aTimerId); +protected: // From VBus observer /** - * VBus down - */ - void VBusUpL(); - /** - * VBus down + * VBus up */ - void VBusDownL(); - /** - * VBus error happened - */ - void VBusErrorL(); - - // From OTG state observer - /** - * VBus error happen - */ - void AVBusErrorL(); + virtual void VBusUpL(); // From Host Event notification observer /** * Device is attached * @param aInfo Device event data */ - void DeviceAttachedL(TDeviceEventInformation aInfo); - /** - * Device is detached - * @param aInfo Device event data - */ - void DeviceDetachedL(TDeviceEventInformation aInfo); - /** - * Connected to hub in wrong level - */ - void BadHubPositionL(); - - /** - * SRP request received - */ - void SrpReceivedL(); - -//from CUsbState - /** - * State id - * @return state id - */ - TUsbStateIds Id(); - - /** - * This is called when switched to this state, - * because If all conditions for transition to another state exist, nothing will - * trigger it and transition will not happen. This forces the transition in such cases. - * - */ - void JustAdvancedToThisStateL(); - - /** - * This is called when leaving this state, - * - */ - void JustBeforeLeavingThisStateL(); - - /** - * handles issue - */ - void DoHandleL(); - - -private: + virtual void DeviceAttachedL(TDeviceEventInformation aInfo); /** * Default constructor * @param aWatcher owner */ - CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher); + CUsbStateHostDelayHandle(CUsbOtgWatcher& aWatcher); /** * 2nd phase construction */ void ConstructL(); - -private: // data - /** - * too much power timer - * own - */ - CUsbTimer* iTooMuchPowerTimer; - - /** - * drivers not found - * own - */ - CUsbTimer* iDriversNotFoundTimer; +private: }; -#endif // C_USBSTATEHOSTHANDLE_H +#endif // C_USBSTATEHOSTDELAYHANDLE_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ + +#ifndef C_USBSTATEHOSTDELAYANOTTTACHEDHANDLE_H +#define C_USBSTATEHOSTDELAYNOTATTACHEDHANDLE_H + +#include "cusbstatehostdelayattachedhandle.h" + +#ifndef STIF +#include "cusbtimer.h" +#else +#include "mockcusbtimer.h" +#endif + +class CUsbOtgWatcher; +/** + * problem handling, device is not attached, vbus not dropping + * + */ +NONSHARABLE_CLASS( CUsbStateHostDelayNotAttachedHandle ) : public CUsbStateHostDelayHandle, +MUsbTimerObserver + { + friend class CtUsbOtgWatcher; + friend class CUsbOtgWatcher; + +public: + + /** + * Two-phased constructor. + * @param aWatcher owner + */ + static CUsbStateHostDelayNotAttachedHandle* NewL(CUsbOtgWatcher& aWatcher); + + /** + * Destructor. + */ + virtual ~CUsbStateHostDelayNotAttachedHandle(); + +private: + + // From MUsbTimerObserver + /** + * Call back when timer expired + * @param aTimerId timer id + */ + void TimerElapsedL(TUsbTimerId aTimerId); + + /** + * Device is detached + * @param aInfo Device event data + */ + void DeviceDetachedL(TDeviceEventInformation aInfo); + + // From OTG state observer + /** + * Became to Idle when A + */ + void AIdleL(); + + //from CUsbState + /** + * State id + * @return state id + */ + TUsbStateIds Id(); + + /** + * This is called when leaving this state, + * + */ + void JustBeforeLeavingThisStateL(); + + /** + * handles issue + */ + void DoHandleL(); + + /** + * Default constructor + * @param aWatcher owner + */ + CUsbStateHostDelayNotAttachedHandle(CUsbOtgWatcher& aWatcher); + + /** + * 2nd phase construction + */ + void ConstructL(); + + // data + + /** + * too much power timer + * own + */ + CUsbTimer* iTooMuchPowerTimer; + + }; + +#endif // C_USBSTATEHOSTDELAYNOTATTACHEDHANDLE_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehosthandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,42 +1,32 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements concrete state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ #ifndef C_USBSTATEHOSTHANDLE_H #define C_USBSTATEHOSTHANDLE_H -#include "cusbotgwatcher.h" -#include "cusbstate.h" +#include "cusbstatehostabase.h" -#ifndef STIF -#include "cusbnotifmanager.h" -#include "cusbtimer.h" -#else -#include "mockcusbnotifmanager.h" -#include "mockcusbtimer.h" -#endif +class CUsbOtgWatcher; /** - * This class implements behaviour when some problem needs vbus drop, and mostly, user action. + * problem handling base class * */ -NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbState, - MWaitNotifierObserver -// this means only one wait notifier at a time can be shown by this state, might be redesigned +NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbStateHostABase { friend class CtUsbOtgWatcher; friend class CUsbOtgWatcher; @@ -44,12 +34,6 @@ public: /** - * Two-phased constructor. - * @param aWatcher owner - */ - static CUsbStateHostHandle* NewL(CUsbOtgWatcher* aWatcher); - - /** * Destructor. */ virtual ~CUsbStateHostHandle(); @@ -60,82 +44,7 @@ */ void SetWhat(TInt aWhat); - // from MWaitNotifierObserver - /** - * Callback when notifier is completed - * @param aFeedback how notifier completed - */ - void WaitNotifierCompletedL(TInt aFeedback); - - // From VBus observer - /** - * VBus down - */ - virtual void VBusUpL(); - /** - * VBus down - */ - virtual void VBusDownL(); - /** - * VBus error happened - */ - virtual void VBusErrorL(); - - // From OTG state observer - /** - * Became to Idle when A - */ - virtual void AIdleL(); - /** - * Became a Host when A - */ - virtual void AHostL(); - /** - * Became a peripheral when A - */ - virtual void APeripheralL(); - /** - * VBus error happen - */ - virtual void AVBusErrorL(); - - // From bus activity observer - /** - * Bus is in idle - */ - virtual void BusIdleL(); - /** - * Bus active - */ - virtual void BusActiveL(); - - // From Host Event notification observer - /** - * Device is attached - * @param aInfo Device event data - */ - void DeviceAttachedL(TDeviceEventInformation aInfo); - /** - * Device is detached - * @param aInfo Device event data - */ - void DeviceDetachedL(TDeviceEventInformation aInfo); - - /** - * Drivers successfully loaded - * @param aInfo Device event data - */ - virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo); - /** - * Drivers loaded partially - * @param aInfo Device event data - */ - virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); - /** - * Drivers loading failed - * @param aInfo Device event data - */ - virtual void DriverLoadFailureL(TDeviceEventInformation aInfo); +protected: // From message notification observer /** @@ -145,21 +54,10 @@ virtual void MessageNotificationReceivedL(TInt aMessage); /** - * SRP request received - */ - virtual void SrpReceivedL(); - /** * Session request received */ virtual void SessionRequestedL(); - //from CUsbState - /** - * State id - * @return state id - */ - virtual TUsbStateIds Id(); - /** * This is called when switched to this state, * because If all conditions for transition to another state exist, nothing will @@ -169,30 +67,21 @@ virtual void JustAdvancedToThisStateL(); /** - * This is called when leaving this state, - * - */ - virtual void JustBeforeLeavingThisStateL(); - - /** * handles issue */ - virtual void DoHandleL(); - -protected: + virtual void DoHandleL() = 0; /** * Default constructor * @param aWatcher owner */ - CUsbStateHostHandle(CUsbOtgWatcher* aWatcher); + CUsbStateHostHandle(CUsbOtgWatcher& aWatcher); /** * 2nd phase construction */ void ConstructL(); -protected: // data /** @@ -200,6 +89,7 @@ */ TInt iWhat; +private: }; #endif // C_USBSTATEHOSTHANDLE_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements concrete state + * + */ + +#ifndef C_USBSTATEHOSTHANDLEDROPPING_H +#define C_USBSTATEHOSTHANDLEDROPPING_H + +#include "cusbstatehosthandle.h" + +#ifndef STIF +#include "cusbnotifmanager.h" +#else +#include "mockcusbnotifmanager.h" +#endif + +class CUsbOtgWatcher; + +/** + * problem handling class, dropping vbus + * + */ +NONSHARABLE_CLASS( CUsbStateHostHandleDropping ) : public CUsbStateHostHandle, +MWaitNotifierObserver +// this means only one wait notifier at a time can be shown by this state, might be redesigned + + { + friend class CtUsbOtgWatcher; + friend class CUsbOtgWatcher; + +public: + + /** + * Two-phased constructor. + * @param aWatcher owner + */ + static CUsbStateHostHandleDropping* NewL(CUsbOtgWatcher& aWatcher); + + /** + * Destructor. + */ + virtual ~CUsbStateHostHandleDropping(); + +private: + + // from MWaitNotifierObserver + /** + * Callback when notifier is completed + * @param aFeedback how notifier completed + */ + void WaitNotifierCompletedL(TInt aFeedback); + + // From VBus observer + /** + * VBus up + */ + void VBusUpL(); + + /** + * VBus down + */ + void VBusDownL(); + + // From Host Event notification observer + /** + * Device is attached + * @param aInfo Device event data + */ + void DeviceAttachedL(TDeviceEventInformation aInfo); + + /** + * Device is detached + * @param aInfo Device event data + */ + void DeviceDetachedL(TDeviceEventInformation aInfo); + + /** + * Drivers successfully loaded + * @param aInfo Device event data + */ + void DriverLoadSuccessL(TDeviceEventInformation aInfo); + + /** + * Drivers loaded partially + * @param aInfo Device event data + */ + void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); + + /** + * Drivers loading failed + * @param aInfo Device event data + */ + void DriverLoadFailureL(TDeviceEventInformation aInfo); + + // From message notification observer + /** + * Message received + * @param aMessage message id + */ + void MessageNotificationReceivedL(TInt aMessage); + + //from CUsbState + /** + * State id + * @return state id + */ + virtual TUsbStateIds Id(); + + /** + * This is called when leaving this state, + * + */ + void JustBeforeLeavingThisStateL(); + + /** + * handles issue + */ + void DoHandleL(); + + /** + * Default constructor + * @param aWatcher owner + */ + CUsbStateHostHandleDropping(CUsbOtgWatcher& aWatcher); + + /** + * 2nd phase construction + */ + void ConstructL(); + + }; + +#endif // C_USBSTATEHOSTDROPPINGHANDLE_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbstatehostundefined.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,118 +1,119 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the concret state + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of the concret state + * + */ #ifndef C_USBSTATEHOSTUNDEFINED_H #define C_USBSTATEHOSTUNDEFINED_H -#include "cusbotgwatcher.h" #include "cusbstatehostabase.h" -#ifndef STIF - -#else - -#endif - +class CUsbOtgWatcher; /** * This class implements behaviour in undefined state (when host) * */ NONSHARABLE_CLASS( CUsbStateHostUndefined ) : public CUsbStateHostABase { - public: +public: + + /** + * Destruction + */ + virtual ~CUsbStateHostUndefined(); - /** - * Destruction - */ - virtual ~CUsbStateHostUndefined(); - - /** - * Two-phased constructor. - * @param aWatcher owner - */ - static CUsbStateHostUndefined* NewL(CUsbOtgWatcher* aWatcher); + /** + * Two-phased constructor. + * @param aWatcher owner + */ + static CUsbStateHostUndefined* NewL(CUsbOtgWatcher& aWatcher); + +private: + /** + * default constructor is protected to be able to be inherited by child classes + * @param aOwner owner of the state + */ + CUsbStateHostUndefined(CUsbOtgWatcher& aOwner); - private: - /** - * default constructor is protected to be able to be inherited by child classes - * @param aOwner owner of the state - */ - CUsbStateHostUndefined(CUsbOtgWatcher* aOwner); - - /** - * Second phase construction - */ - void ConstructL(); + /** + * Second phase construction + */ + void ConstructL(); - /** - * This function is needed to find a real state by id - * This might be used in switching states in watcher. New state object searched by its id - * @return Id - */ - virtual TUsbStateIds Id(); + /** + * This function is needed to find a real state by id + * This might be used in switching states in watcher. New state object searched by its id + * @return Id + */ + virtual TUsbStateIds Id(); + + // From VBus observer + /** + * VBus down + */ + virtual void VBusDownL(); + + /** + * VBus UP + */ + virtual void VBusUpL(); - /** - * Id Pin OFF - */ - void IdPinOffL(); - /** - * Id Pin On - */ - void IdPinOnL(); + /** + * VBus error + */ + virtual void VBusErrorL(); + + /** + * AVBus Error + */ + virtual void AVBusErrorL(); + + /** + * Became to Idle when B + */ + virtual void BIdleL(); + + /** + * Became to Peripheral when B + */ + virtual void BPeripheralL(); - // From VBus observer - /** - * VBus down - */ - void VBusDownL(); - /** - * VBus UP - */ - void VBusUpL(); - - /** - * VBus error - */ - void VBusErrorL(); - - // From OTG state observer - /** - * Became to Idle when A - */ - void AIdleL(); - /** - * AVBus Error - */ - void AVBusErrorL(); - /** - * Became to Idle when B - */ - void BIdleL(); - /** - * Became to Peripheral when B - */ - void BPeripheralL(); - - // From Host Event notification observer - /** - * Device is detached - * @param aInfo Device event data - */ - virtual void DeviceDetachedL(TDeviceEventInformation aInfo); + // From Host Event notification observer + /** + * Device is detached + * @param aInfo Device event data + */ + virtual void DeviceDetachedL(TDeviceEventInformation aInfo); + + // From message notification observer + /** + * Message received + * @param aMessage message id + */ + virtual void MessageNotificationReceivedL(TInt aMessage); + /** + * SRP request received + */ + virtual void SrpReceivedL(); + /** + * Connected to hub in wrong level + */ + virtual void BadHubPositionL(); + /** + * Session request received + */ + virtual void SessionRequestedL(); private: // data diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbtimer.h --- a/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: timer + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: timer + * + */ #ifndef C_USBTIMER_H #define C_USBTIMER_H @@ -65,7 +65,7 @@ * @param aObserver will get call back * @param aTimerId timer id */ - static CUsbTimer * NewL(MUsbTimerObserver* aObserver, + static CUsbTimer * NewL(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId); /** @@ -106,7 +106,7 @@ * @param aObserver will get call back * @param aTimerId timer id */ - CUsbTimer(MUsbTimerObserver* aObserver, TUsbTimerId aTimerId); + CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId); /** * 2nd phase construction @@ -120,7 +120,7 @@ * Observer * not own */ - MUsbTimerObserver* iObserver; + MUsbTimerObserver& iObserver; /** * RTimer API diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbvbusobserver.h --- a/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements VBus observer + * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implements VBus observer + * + */ #ifndef C_USBVBUSOBSERVER_H #define C_USBVBUSOBSERVER_H @@ -41,7 +40,7 @@ /** * error handler * @param aError error code - */ + */ virtual void VBusObserverErrorL(TInt aError)=0; }; @@ -128,7 +127,7 @@ /** * The observer reports state changes to own observers - * Own + * Not owns */ RPointerArray iObservers; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbwaitnotifier.h --- a/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Usb waiting notifier implementation + * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Usb waiting notifier implementation + * + */ #ifndef C_USBWAITNOTIFIER_H #define C_USBWAITNOTIFIER_H @@ -39,7 +38,7 @@ * @return Pointer to the new instance of CUsbWaitNotifier */ static CUsbWaitNotifier* NewL(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId); + CUsbNotifManager& aNotifManager, TUint aNotifId); /** * Destructor. @@ -54,7 +53,7 @@ * @param aNotifManager Owner of the class, will destroy the object when needed * @param aNotifId Id of the notifier */ - CUsbWaitNotifier(RNotifier& aNotifier, CUsbNotifManager* aNotifManager, + CUsbWaitNotifier(RNotifier& aNotifier, CUsbNotifManager& aNotifManager, TUint aNotifId); /** diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/cusbwarningnotifier.h --- a/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Usb warning notifier implementation + * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Usb warning notifier implementation + * + */ #ifndef C_USBWARNINGNOTIFIER_H #define C_USBWARNINGNOTIFIER_H @@ -40,7 +39,7 @@ * @return Pointer to the new instance of CUsbWarningNotifier */ static CUsbWarningNotifier* NewL(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId); + CUsbNotifManager& aNotifManager, TUint aNotifId); /** * Destructor. @@ -56,7 +55,7 @@ * @param aNotifId Id of the notifier */ CUsbWarningNotifier(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId); + CUsbNotifManager& aNotifManager, TUint aNotifId); /** * 2nd phase construction diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/debug.h --- a/usbengines/usbotgwatcher/inc/debug.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/debug.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,118 +1,161 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * -* Description: Central place for debug-type macros & functions +* Description: Debug macros and declarations. * */ +#ifndef DEBUG_H +#define DEBUG_H -#ifndef _USBWATCHER_DEBUG_H -#define _USBWATCHER_DEBUG_H +////////////////////////////////////////////////////////////////////////////// +// Here are parameters need to be modified. +// Component name +#define MODULE_NAME "USBOTGWATCHER" +////////////////////////////////////////////////////////////////////////////// + + +// For handling unicode strings as L##MACRO is interpreted as LMACRO +#define WIDEN2( x ) L##x +#define WIDEN( x ) WIDEN2( x ) + +_LIT( KUsbPanicModule, ""WIDEN( MODULE_NAME ) ); #ifdef _DEBUG -// Enable this to enable memory tracing -//#define MEMTRACE - -// Following define is to enable OOM -// situations in SRCS -// SHOULD NEVER BE IN RELEASES. -//#define TEST_OOM - -#ifdef __WINS__ - -// File logging for WINS -#define __FLOGGING__ +// Comment this line out if using real-time debugging +//#define LOG_TO_FILE +// =========================================================================== +#if defined ( LOG_TO_FILE ) +// =========================================================================== +// Add corresponding libabry in mmp file +// LIBRARY flogger.lib +// The log file is located at +// c:\logs\usb\MODULE_NAME.txt -#else - -// Logging with RDebug for target HW -#define __CLOGGING__ - -#endif //__WINS__ - -#endif // Debug - -#if defined ( __FLOGGING__ ) - -_LIT( KLogFile,"UsbWatcher.txt" ); -_LIT( KLogDir,"usb" ); - -#include #include -#define FLOG( a ) { FPrint( a ); } - -#define FLOGHEX( value, len ) { RFileLogger::HexDump( KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len ); } - -#define FTRACE( a ) { a; } +#define DESC( x ) TPtrC( ( const TText* ) ( x ) ) +#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) ) +_LIT( KUsbLogDir, "USB" ); +_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" ); -inline void FPrint( const TRefByValue aFmt, ... ) -{ - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list ); +// s: c string. +#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ) ) - // If memory tracing is activated. -#ifdef MEMTRACE - TInt size; - User::Heap().AllocSize( size ); - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, _L( "[USBWATCHER]\tmemory\tMemory usage: %d high: %d" ), size, User::Heap().Size() ); -#endif -} +// s: c string contains "%x" +// v: varaible corresponding to %x +#define LOG1(s, v) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v) +// s: c string contains "%x%y" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +#define LOG2(s, v1, v2) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2) -inline void FHex( const TUint8* aPtr, TInt aLen ) -{ - RFileLogger::HexDump( KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen ); -} +// s: c string contains "%x%y%z" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +// v3: varaible corresponding to %z +#define LOG3(s, v1, v2, v3) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2, v3 ) -inline void FHex( const TDesC8& aDes ) -{ - FHex( aDes.Ptr(), aDes.Length() ); -} +class TFuncLogger + { +public: + TFuncLogger(const TDesC8& aFuncName) + { + iFuncName.Set( aFuncName ); + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] >>%s" ), iFuncName.Ptr() ); + } + ~TFuncLogger() + { + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, + EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] <<%s" ), iFuncName.Ptr() ); + } +private: + TPtrC8 iFuncName; + }; +// =========================================================================== +#else //Real-time logging +// =========================================================================== +#include -// RDebug logging -#elif defined(__CLOGGING__) +// Paramters same as above. +#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } -#include - -#define FLOG( a ) { RDebug::Print( a ); } - -#define FLOGHEX( a ) +#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); } -#define FTRACE( a ) { a; } +#define LOG2( s, v1,v2 ) { RDebug::Printf( "["MODULE_NAME"] "##s , v1, v2 ); } -// Declare the FPrint function +#define LOG3( s, v1, v2, v3 ) { RDebug::Printf( "["MODULE_NAME"] "##s , \ + v1, v2, v3); } -inline void FPrint( const TRefByValue aFmt, ... ) -{ - VA_LIST list; - VA_START( list,aFmt ); - TInt tmpInt = VA_ARG( list, TInt ); - TInt tmpInt2 = VA_ARG( list, TInt ); - TInt tmpInt3 = VA_ARG( list, TInt ); - VA_END( list ); - RDebug::Print( aFmt, tmpInt, tmpInt2, tmpInt3 ); -} +class TFuncLogger + { +public: + TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName ) + { + RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr()); + } + ~TFuncLogger() + { + RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr()); + } +private: + TPtrC8 iFuncName; + }; +#endif // LOG_TO_FILE + +#define LEAVE( exp ) {volatile TInt err = exp; \ + LOG3( "LEAVE(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ + User::Leave( err );} + +#define LEAVEIFERROR( exp ) {volatile TInt err = exp; if(err < 0) LEAVE(err);} + +#define PANIC( exp ) {volatile TInt err = exp; \ + LOG3( "PANIC(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ + User::Panic( KUsbPanicModule, err );} -#else // No loggings --> reduced code size +#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); + +#else // _DEBUG +// =========================================================================== -#define FLOG( a ) -#define FLOGHEX( a ) -#define FTRACE( a ) +#define LOG( s ) +#define LOG1( s, v ) +#define LOG2( s, v1, v2 ) +#define LOG3( s, v1, v2, v3 ) +#define LOG_FUNC_ENTRY +#define LOG_FUNC_EXIT +#define LEAVE( exp ) User::Leave( exp ); +#define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); +#define PANIC( err ) User::Panic( KUsbPanicModule, err ); +#define LOG_FUNC +// =========================================================================== +#endif // _DEBUG +// =========================================================================== +#endif // DEBUG_H -#endif //_DEBUG - -#endif // USBDEVCON_DEBUG_H - +// End of File diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/definitions.h --- a/usbengines/usbotgwatcher/inc/definitions.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/definitions.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Definitions for otgwatcher + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Definitions for otgwatcher + * + */ #ifndef DEFENITIONS_H #define DEFENITIONS_H @@ -39,14 +38,14 @@ enum TUsbStateIds { EUsbStateHostUndefined, - + EUsbStateHostAInitiate, EUsbStateHostAHost, EUsbStateHostAPeripheral, - EUsbStateHostAIdle, - EUsbStateHostHandle, - EUsbStateHostDelayHandle + EUsbStateHostDelayAttachedHandle, + EUsbStateHostDelayNotAttachedHandle, + EUsbStateHostHandleDropping }; const TInt KUsbWatcherPeripheralIsNotConnected = 0; // means not(KUsbWatcherPeripheralIsConnected) diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/errors.h --- a/usbengines/usbotgwatcher/inc/errors.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/errors.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File contains error codes, from Watcher perspective + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: File contains error codes, from Watcher perspective + * + */ #ifndef ERRORS_H #define ERRORS_H @@ -38,7 +37,11 @@ EUsbWatcherVBusObserverError, EUsbWatcherHostEventNotificationError, EUsbWatcherOtgStateError, - EUsbWatcherMessageNotificationError + EUsbWatcherMessageNotificationError, + EUsbWatcherCanNotStartSession, + EUsbWatcherCanNotEnableDriverLoading, + EUsbWatcherCanNotClearBusError, + EUsbWatcherCanNotRaiseVBus }; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/inc/panic.h --- a/usbengines/usbotgwatcher/inc/panic.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/panic.h Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Central place for debug-type macros & functions + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Central place for debug-type macros & functions + * + */ #ifndef USBWATCHER_PANIC_H #define USBWATCHER_PANIC_H #include @@ -107,14 +106,15 @@ EWrongTimerId, //66 EUnexpectedNotifId, //67 EUnknownUsbServiceState, //68 - EUnexpectedUsbServiceState, //69 + EUnexpectedUsbServiceState, //69 EUnexpectedUsbSwitchPersonalityState, //70 - + ECanNotFindUsbOtgWatcherStateObserver, //71 ENoObserverToUnsubscribe, // 72 EObserverAlreadyExists, //73 EIdForNotDefinedStateRequested, //74 - ECanNotFindHostEventNotificationObserver //75 + ECanNotFindHostEventNotificationObserver, //75 + ENoTimersDefinedForThisClass //76 }; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -40,8 +39,7 @@ // void CUsbBusActivityObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iBusActivity.Attach(KUidUsbManCategory, KUsbOtgConnectionIdleProperty)); @@ -54,8 +52,7 @@ // CUsbBusActivityObserver* CUsbBusActivityObserver::NewL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::NewL" ) ); + LOG_FUNC CUsbBusActivityObserver* self = new (ELeave) CUsbBusActivityObserver(); CleanupStack::PushL(self); @@ -71,8 +68,7 @@ CUsbBusActivityObserver::~CUsbBusActivityObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::~CUsbBusActivityObserver" ) ); + LOG_FUNC Cancel(); @@ -95,12 +91,10 @@ if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::BusActivity CanNotGetBusActivityProperty" ) ); - Panic(ECanNotGetBusActivityProperty); + LOG("ECanNotGetBusActivityProperty" ); + Panic( ECanNotGetBusActivityProperty); } - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::State = %d" ), val )); - return (0 == val ? EBusActive : EBusIdle); } @@ -111,12 +105,13 @@ // void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::SubscribeL" ) ); + LOG_FUNC + // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) + if (KErrNotFound != iObservers.Find(&aObserver)) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); + LOG( "Observer already exists" ); + Panic( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -135,18 +130,18 @@ // void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL" ) ); + LOG_FUNC TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) + if (KErrNotFound == i) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindIdPinObserver); + LOG( "Observer not found" ); + Panic( ECanNotFindBusActivityObserver); return; } - + iObservers.Remove(i); - + if (0 == iObservers.Count()) // no observers anymore { // cancel pending request @@ -160,15 +155,17 @@ // void CUsbBusActivityObserver::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d" , iStatus.Int()); // if error occured, inform observers - if(KErrNone != iStatus.Int()) + if (KErrNone != iStatus.Int()) { for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->BusActivityErrorL(iStatus.Int()); - } + { + iObservers[i]->BusActivityErrorL(iStatus.Int()); + } } // re-issue request first @@ -182,7 +179,7 @@ { case EBusIdle: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusIdle" ) ); + LOG("BusIdle"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -193,7 +190,7 @@ case EBusActive: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusActive" ) ); + LOG("BusActive"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -204,8 +201,8 @@ default: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusActive WrongBusState" ) ); - Panic(EWrongBusState); + LOG("WrongBusState" ); + Panic( EWrongBusState); } } @@ -226,9 +223,10 @@ // TInt CUsbBusActivityObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunError aError = %d" ), aError)); - + LOG1( "aError = %d", aError ); + // try to continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -41,8 +40,7 @@ // void CUsbHostEventNotificationObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::ConstructL" ) ); + LOG_FUNC } @@ -53,8 +51,7 @@ CUsbHostEventNotificationObserver* CUsbHostEventNotificationObserver::NewL( RUsb* aUsb) { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::NewL" ) ); + LOG_FUNC CUsbHostEventNotificationObserver* self = new (ELeave) CUsbHostEventNotificationObserver(aUsb); @@ -70,8 +67,7 @@ // CUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver" ) ); + LOG_FUNC Cancel(); @@ -86,16 +82,16 @@ void CUsbHostEventNotificationObserver::SubscribeL( MUsbHostEventNotificationObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::SubscribeL" ) ); + LOG_FUNC - // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); - return; - } - + // check if the same observer already exist in a list + if (KErrNotFound != iObservers.Find(&aObserver)) + { + LOG("Observer already exists" ); + Panic( EObserverAlreadyExists); + return; + } + iObservers.AppendL(&aObserver); if (KFirst == iObservers.Count()) // first item @@ -113,22 +109,23 @@ void CUsbHostEventNotificationObserver::UnsubscribeL( MUsbHostEventNotificationObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL" ) ); - TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindHostEventNotificationObserver); - return; - } - - iObservers.Remove(i); - - if (0 == iObservers.Count()) // no observers anymore - { - // cancel pending request - Cancel(); - } + LOG_FUNC + + TInt i(iObservers.Find(&aObserver)); + if (KErrNotFound == i) + { + LOG("Observer not found"); + Panic( ECanNotFindHostEventNotificationObserver); + return; + } + + iObservers.Remove(i); + + if (0 == iObservers.Count()) // no observers anymore + { + // cancel pending request + Cancel(); + } } // --------------------------------------------------------------------------- @@ -137,17 +134,19 @@ // void CUsbHostEventNotificationObserver::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d", iStatus.Int()); - // if error occured, tell to Observers - if(KErrNone != iStatus.Int()) + // if error occured, tell to Observers + if (KErrNone != iStatus.Int()) + { + for (TInt i(0); i < iObservers.Count(); ++i) { - for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->HostEventNotificationErrorL(iStatus.Int()); - } - return; + iObservers[i]->HostEventNotificationErrorL(iStatus.Int()); } + return; + } TDeviceEventInformation dei(iEventInfo); @@ -155,20 +154,20 @@ iUsb->HostEventNotification(iStatus, iEventInfo); SetActive(); - // Log the event - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iDeviceId = %d" ), dei.iDeviceId)); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iEventType = %d" ), dei.iEventType)); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iError = %d" ), dei.iError)); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iDriverLoadStatus = %d" ), dei.iDriverLoadStatus)); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iVid = %d" ), dei.iVid)); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iPid = %d" ), dei.iPid)); + // Log the event + LOG1( "iEventInfo.iDeviceId = %d" , dei.iDeviceId); + LOG1( "iEventInfo.iEventType = %d" , dei.iEventType); + LOG1( "iEventInfo.iError = %d" , dei.iError); + LOG1( "iEventInfo.iDriverLoadStatus = %d" , dei.iDriverLoadStatus); + LOG1( "iEventInfo.iVid = %d" , dei.iVid); + LOG1( "iEventInfo.iPid = %d" , dei.iPid); // then process property change switch (dei.iEventType) { case EDeviceAttachment: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DeviceAttachment" ) ); + LOG("DeviceAttachment" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -179,7 +178,7 @@ case EDeviceDetachment: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DeviceDetachment" ) ); + LOG( "DeviceDetachment" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -194,7 +193,7 @@ { case EDriverLoadSuccess: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadSuccess" ) ); + LOG( "DriverLoadSuccess" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -205,7 +204,7 @@ } case EDriverLoadPartialSuccess: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadPartialSuccess" ) ); + LOG( "DriverLoadPartialSuccess" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -216,7 +215,7 @@ } case EDriverLoadFailure: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadFailure" ) ); + LOG( "DriverLoadFailure"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -226,8 +225,8 @@ } default: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadFailure WrongDriverLoadStatus" ) ); - Panic(EWrongDriverLoadStatus); + LOG("WrongDriverLoadStatus" ); + Panic( EWrongDriverLoadStatus); } } break; @@ -235,8 +234,8 @@ } default: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL WrongHostEventNotification" ) ); - Panic(EWrongHostEventNotification); + LOG( "WrongHostEventNotification" ); + Panic( EWrongHostEventNotification); } } @@ -258,8 +257,9 @@ // TInt CUsbHostEventNotificationObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunError aError = %d" ), aError)); + LOG1( "aError = %d" , aError); // try to recover and continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbidpinobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -40,8 +39,7 @@ // void CUsbIdPinObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iIdPin.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty)); @@ -54,8 +52,7 @@ // CUsbIdPinObserver* CUsbIdPinObserver::NewL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::NewL" ) ); + LOG_FUNC CUsbIdPinObserver* self = new (ELeave) CUsbIdPinObserver(); CleanupStack::PushL(self); @@ -70,8 +67,7 @@ // CUsbIdPinObserver::~CUsbIdPinObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::~CUsbIdPinObserver" ) ); + LOG_FUNC Cancel(); @@ -89,20 +85,16 @@ /* this getter is not const, because for some reason RProperty::Get is not const */ { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin" ) ); - TInt val(0); TInt err = iIdPin.Get(val); if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin CanNotGetIdPinProperty" ) ); - Panic(ECanNotGetIdPinProperty); + LOG("CanNotGetIdPinProperty" ); + Panic( ECanNotGetIdPinProperty); } - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin = %d" ), val )); - return (EFalse == val ? EIdPinOff : EIdPinOn); } @@ -112,12 +104,13 @@ // void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL" ) ); + LOG_FUNC + // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) + if (KErrNotFound != iObservers.Find(&aObserver)) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); + LOG("Observer already exists" ); + Panic( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -136,18 +129,18 @@ // void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL" ) ); - + LOG_FUNC + TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) + if (KErrNotFound == i) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindIdPinObserver); + LOG("Observer not found"); + Panic( ECanNotFindIdPinObserver); return; } - + iObservers.Remove(i); - + if (0 == iObservers.Count()) // no observers anymore { // cancel pending request @@ -161,17 +154,19 @@ // void CUsbIdPinObserver::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d" , iStatus.Int()); - // if error occured, tell to Observers - if(KErrNone != iStatus.Int()) + // if error occured, tell to Observers + if (KErrNone != iStatus.Int()) + { + for (TInt i(0); i < iObservers.Count(); ++i) { - for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->IdPinErrorL(iStatus.Int()); - } - return; + iObservers[i]->IdPinErrorL(iStatus.Int()); } + return; + } // re-issue request first iIdPin.Subscribe(iStatus); @@ -185,7 +180,7 @@ { case EIdPinOn: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin ON")); + LOG("IdPin ON"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -197,7 +192,7 @@ case EIdPinOff: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin OFF")); + LOG("IdPin OFF"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -209,8 +204,8 @@ default: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL WrongIdPinState")); - Panic(EWrongIdPinState); + LOG("WrongIdPinState"); + Panic( EWrongIdPinState); } } @@ -231,8 +226,9 @@ // TInt CUsbIdPinObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunError aError = %d" ), aError)); + LOG1( "aError = %d", aError); // try to continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Blink/show Usb indicator notifier implementation + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Blink/show Usb indicator notifier implementation + * + */ #include #include @@ -33,11 +32,13 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher) +CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL( + CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::NewL" )); + LOG_FUNC - CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(aNotifManager, aOtgWatcher); + CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier( + aNotifManager, aOtgWatcher); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -50,32 +51,30 @@ // CUsbIndicatorNotifier::~CUsbIndicatorNotifier() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::~CUsbIndicatorNotifier" ) ); - + LOG_FUNC + Close(); delete iIconBlinkingTimer; - - // Unsubscribe from VBus change notifications - if(iOtgWatcher) + + if (iOtgWatcher.VBusObserver()) { - if(iOtgWatcher->VBusObserver()) - { - TRAP_IGNORE(iOtgWatcher->VBusObserver()->UnsubscribeL(*this)); - } - - // Unsubscribe from otg watcher states change notifications - TRAP_IGNORE(iOtgWatcher->UnsubscribeL(*this)); + TRAP_IGNORE(iOtgWatcher.VBusObserver()->UnsubscribeL(*this)); } + + // Unsubscribe from otg watcher states change notifications + TRAP_IGNORE(iOtgWatcher.UnsubscribeL(*this)); } // --------------------------------------------------------------------------- // C++ constructor // --------------------------------------------------------------------------- // -CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher) : - CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(aOtgWatcher) +CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager, + CUsbOtgWatcher& aOtgWatcher) : + CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher( + aOtgWatcher) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::CUsbIndicatorNotifier" ) ); + LOG_FUNC //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer //when AVKON implements animation form of usb indicator. @@ -88,16 +87,16 @@ // void CUsbIndicatorNotifier::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ConstructL" ) ); - + LOG_FUNC + // Subscribe for VBus change notifications - iOtgWatcher->VBusObserver()->SubscribeL(*this); - + iOtgWatcher.VBusObserver()->SubscribeL(*this); + // Subscribe for otg watcher states change notifications - iOtgWatcher->SubscribeL(*this); + iOtgWatcher.SubscribeL(*this); - iIconBlinkingTimer = CUsbTimer::NewL(this, EIconBlinkingTimer); - + iIconBlinkingTimer = CUsbTimer::NewL(*this, EIconBlinkingTimer); + // check here for condition to set usb indicator SetIndicatorL(); @@ -111,11 +110,15 @@ // void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible) { - FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowStaticL, aVisible=%d" ), aVisible)); + LOG_FUNC + + LOG1("aVisible = %d" , aVisible); iIconBlinkingTimer->Cancel(); - SetIndicatorStateL(aVisible ? EAknIndicatorStateOn : EAknIndicatorStateOff); + SetIndicatorStateL(aVisible + ? EAknIndicatorStateOn + : EAknIndicatorStateOff); } // --------------------------------------------------------------------------- @@ -124,7 +127,7 @@ // void CUsbIndicatorNotifier::BlinkL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::BlinkL" )); + LOG_FUNC // Will be canceled if active in After() iIconBlinkingTimer->After(0); @@ -136,8 +139,8 @@ // void CUsbIndicatorNotifier::ShowL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowL" ) ); - + LOG_FUNC + ShowStaticL(ETrue); } @@ -147,8 +150,8 @@ // void CUsbIndicatorNotifier::Close() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::Close" ) ); - + LOG_FUNC + iIconBlinkingTimer->Cancel(); TRAP_IGNORE( ShowStaticL(EFalse) ); } @@ -163,10 +166,14 @@ { case EIconBlinkingTimer: { - SetIndicatorStateL(iIndicatorState ? EAknIndicatorStateOn : EAknIndicatorStateOff); + SetIndicatorStateL(iIndicatorState + ? EAknIndicatorStateOn + : EAknIndicatorStateOff); - iIndicatorState = (iIndicatorState == EAknIndicatorStateOn - ? EAknIndicatorStateOff : EAknIndicatorStateOn); + iIndicatorState + = (iIndicatorState == EAknIndicatorStateOn + ? EAknIndicatorStateOff + : EAknIndicatorStateOn); // Will be canceled if active in After() iIconBlinkingTimer->After(KUsbIndicatorBlinkingInterval); @@ -174,8 +181,7 @@ } default: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::TimerElapsedL - Unknown timer" ) ); - + LOG1("Unknown timer id = %d", aTimerId) Panic(EWrongTimerId); } } @@ -187,11 +193,13 @@ // void CUsbIndicatorNotifier::SetIndicatorStateL(const TInt aState) { - FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::SetIndicatorStateL - aState=%d" ), aState)); + + LOG1( "USB indicator State = %d" , aState); - CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid(EAknIndicatorUSBConnection)); - indicator->SetIndicatorStateL( aState ); - CleanupStack::PopAndDestroy( indicator ); //indicator + CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid( + EAknIndicatorUSBConnection)); + indicator->SetIndicatorStateL(aState); + CleanupStack::PopAndDestroy(indicator); //indicator } // --------------------------------------------------------------------------- @@ -200,7 +208,6 @@ // void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState) { - FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::OtgWatcherStateChangedL - aState=%d" ), aState)); SetIndicatorL(); } @@ -210,7 +217,6 @@ // void CUsbIndicatorNotifier::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusDownL" ) ); SetIndicatorL(); } @@ -220,7 +226,6 @@ // void CUsbIndicatorNotifier::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusUpL" ) ); SetIndicatorL(); } @@ -230,8 +235,7 @@ // void CUsbIndicatorNotifier::VBusObserverErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusObserverErrorL" ) ); - // do not care + // do nothing } // --------------------------------------------------------------------------- @@ -240,24 +244,22 @@ // void CUsbIndicatorNotifier::SetIndicatorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::SetIndicatorL" ) ); - - if (!(iOtgWatcher->IsDeviceA())) + if (!(iOtgWatcher.IsDeviceA())) { // if B, than other party (usbwatcher) takes care of usb indicator // in combined usbwatcher (if role swap allowed) one class has to manage usb indicator return; } - + // if VBus Up and we are host -> show indicator - if ((iOtgWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) && - (iOtgWatcher->CurrentHostState()->Id() == EUsbStateHostAHost)) + if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) + && (iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAHost)) { ShowStaticL(ETrue); } // if VBus up and we are not host -> Blink indicator - else if((iOtgWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) && - (iOtgWatcher->CurrentHostState()->Id() != EUsbStateHostAHost)) + else if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) + && (iOtgWatcher.CurrentHostState()->Id() != EUsbStateHostAHost)) { BlinkL(); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include #include @@ -42,8 +41,7 @@ // void CUsbMessageNotificationObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::ConstructL" ) ); + LOG_FUNC } @@ -54,8 +52,7 @@ CUsbMessageNotificationObserver* CUsbMessageNotificationObserver::NewL( RUsb* aUsb) { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::NewL" ) ); + LOG_FUNC CUsbMessageNotificationObserver* self = new (ELeave) CUsbMessageNotificationObserver(aUsb); @@ -71,8 +68,7 @@ // CUsbMessageNotificationObserver::~CUsbMessageNotificationObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::~CUsbMessageNotificationObserver" ) ); + LOG_FUNC Cancel(); @@ -87,16 +83,16 @@ void CUsbMessageNotificationObserver::SubscribeL( MUsbMessageNotificationObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::SubscribeL" ) ); + LOG_FUNC - // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); - return; - } - iObservers.AppendL(&aObserver); + // check if the same observer already exist in a list + if (KErrNotFound != iObservers.Find(&aObserver)) + { + LOG("Observer already exists"); + Panic( EObserverAlreadyExists); + return; + } + iObservers.AppendL(&aObserver); if (KFirst == iObservers.Count()) // first item { @@ -112,17 +108,17 @@ void CUsbMessageNotificationObserver::UnsubscribeL( MUsbMessageNotificationObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL" ) ); + LOG_FUNC - TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindMessageNotificationObserver); - return; - } - - iObservers.Remove(i); + TInt i(iObservers.Find(&aObserver)); + if (KErrNotFound == i) + { + LOG("Observer not found" ) + Panic( ECanNotFindMessageNotificationObserver); + return; + } + + iObservers.Remove(i); if (0 == iObservers.Count()) // no items { @@ -137,13 +133,16 @@ // void CUsbMessageNotificationObserver::RunL() { + // Log the event + LOG1( "Message notification observer iMessage = %d" , iMessage); + // if error occured, tell to Observers - if(KErrNone != iStatus.Int()) + if (KErrNone != iStatus.Int()) { for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->MessageNotificationErrorL(iStatus.Int()); - } + { + iObservers[i]->MessageNotificationErrorL(iStatus.Int()); + } return; } @@ -153,15 +152,12 @@ iUsb->MessageNotification(iStatus, iMessage); SetActive(); - // Log the event - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL iMessage = %d" ), message)); - // then process property change switch (message) { case KErrUsbBadHubPosition: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL HubBadPosition" ) ); + LOG("HubBadPosition" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -171,7 +167,7 @@ } case KErrUsbOtgVbusError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL VBusError" ) ); + LOG( "VBusError"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -181,7 +177,7 @@ } case KUsbMessageSrpReceived: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL SRP received" ) ); + LOG("SRP received" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -191,7 +187,7 @@ } case KUsbMessageRequestSession: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL Session Requested" ) ); + LOG("Session requested" ); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -202,6 +198,7 @@ // notify states with other messages default: { + for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->MessageNotificationReceivedL(message); @@ -228,8 +225,9 @@ // TInt CUsbMessageNotificationObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunError aError = %d" ), aError)); + LOG1( "aError = %d" , aError); // try to recover and continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbnotenotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base classes for Usb notifier wrapper + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base classes for Usb notifier wrapper + * + */ #include "cusbnotifmanager.h" #include "cusbnotenotifier.h" @@ -29,12 +28,9 @@ // --------------------------------------------------------------------------- // CUsbNoteNotifier::CUsbNoteNotifier(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUid aCat, TUint aNotifId) : - CUsbNotifier(aNotifManager, aCat, aNotifId), - iNotifier(aNotifier) + CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId) : + CUsbNotifier(aNotifManager, aCat, aNotifId), iNotifier(aNotifier) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CUsbNoteNotifier" ) ); - } // --------------------------------------------------------------------------- @@ -43,9 +39,10 @@ // void CUsbNoteNotifier::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::ConstructL" ) ); + LOG_FUNC - iNotifierActive = new(ELeave)CUsbNoteNotifier::CNotifierActive(iNotifier, this); + iNotifierActive = new (ELeave) CUsbNoteNotifier::CNotifierActive( + iNotifier, *this); } // --------------------------------------------------------------------------- @@ -54,8 +51,8 @@ // CUsbNoteNotifier::~CUsbNoteNotifier() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::~CUsbNoteNotifier" ) ); - + LOG_FUNC + delete iNotifierActive; } @@ -65,7 +62,9 @@ // void CUsbNoteNotifier::ShowL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNoteNotifier::ShowL aCat = 0x%X aNotifId = 0x%X" ), iCat, iNotifId)); + LOG_FUNC + + LOG2( "aCat = 0x%X aNotifId = 0x%X" , iCat, iNotifId); iNotifierActive->StartL(); } @@ -76,22 +75,18 @@ // void CUsbNoteNotifier::Close() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::Close" ) ); } - // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- // C++ default constructor // --------------------------------------------------------------------------- // -CUsbNoteNotifier::CNotifierActive::CNotifierActive(RNotifier& aNotifier, - CUsbNoteNotifier* aUsbNoteNotifier) : - CUsbNoteNotifier::CNotifierActive::CActive(EPriorityStandard), - iUsbNoteNotifier(aUsbNoteNotifier), - iNotifier(aNotifier), - iRes(0) +CUsbNoteNotifier::CNotifierActive::CNotifierActive(RNotifier& aNotifier, + CUsbNoteNotifier& aUsbNoteNotifier) : + CUsbNoteNotifier::CNotifierActive::CActive(EPriorityStandard), + iUsbNoteNotifier(aUsbNoteNotifier), iNotifier(aNotifier), iRes(0) { CActiveScheduler::Add(this); } @@ -111,19 +106,16 @@ // void CUsbNoteNotifier::CNotifierActive::StartL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::ShowL aCat = 0x%X aNotifId = 0x%X" ), - iUsbNoteNotifier->iCat, iUsbNoteNotifier->iNotifId)); + LOG_FUNC if (IsActive()) { - Panic(ENotifierIsActiveAlready); + Panic( ENotifierIsActiveAlready); return; - } - - TPckgBuf pckg; - pckg() = iUsbNoteNotifier->iNotifId; - - iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier->iCat, pckg, iRes); + } + + iNotifIdPckg() = iUsbNoteNotifier.iNotifId; + iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier.iCat, iNotifIdPckg, iRes); SetActive(); } @@ -133,15 +125,18 @@ // void CUsbNoteNotifier::CNotifierActive::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCCUsbNoteNotifier::CNotifierActive::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d" , iStatus.Int()); // if error occured, deal with it in RunError User::LeaveIfError(iStatus.Int()); - iNotifier.CancelNotifier(iUsbNoteNotifier->iCat); + iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); // report to owner that show is over - iUsbNoteNotifier->iNotifManager->NotifierShowCompletedL(iUsbNoteNotifier, KErrNone, iRes()); + iUsbNoteNotifier.iNotifManager.NotifierShowCompletedL(iUsbNoteNotifier, + KErrNone, iRes()); } // --------------------------------------------------------------------------- @@ -150,9 +145,7 @@ // void CUsbNoteNotifier::CNotifierActive::DoCancel() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::DoCancel" ) ); - - iNotifier.CancelNotifier(iUsbNoteNotifier->iCat); + iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); } // --------------------------------------------------------------------------- @@ -161,9 +154,11 @@ // TInt CUsbNoteNotifier::CNotifierActive::RunError(TInt aError) { - FTRACE( FPrint(_L("[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::RunError aError = %d" ), aError)); + LOG_FUNC - iNotifier.CancelNotifier(iUsbNoteNotifier->iCat); + LOG1("aError = %d" , aError); + + iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); // try to continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbnotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbnotifier.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbnotifier.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,24 +1,23 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base classes for Usb notifier wrapper + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base classes for Usb notifier wrapper + * + */ #include "cusbnotifmanager.h" #include "cusbnotifier.h" - + #include "debug.h" #include "panic.h" @@ -30,7 +29,7 @@ // CUsbNotifier::~CUsbNotifier() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::~CUsbNotifier" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -46,12 +45,11 @@ // C++ constructor // --------------------------------------------------------------------------- // -CUsbNotifier::CUsbNotifier(CUsbNotifManager* aNotifManager, TUid aCat, +CUsbNotifier::CUsbNotifier(CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId) : iNotifManager(aNotifManager), iCat(aCat), iNotifId(aNotifId), iIsFeedbackNeeded(EFalse) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::CUsbNotifier" ) ); } // --------------------------------------------------------------------------- @@ -60,7 +58,6 @@ // void CUsbNotifier::SetFeedbackNeeded() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::SetFeedbackNeeded" ) ); iIsFeedbackNeeded = ETrue; } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbnotifmanager.cpp --- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -30,7 +30,7 @@ // --------------------------------------------------------------------------- // CWaitNotifierInfo::CWaitNotifierInfo(CUsbNotifier* aWaitNotifier, - MWaitNotifierObserver* aObserver) : + MWaitNotifierObserver& aObserver) : iWaitNotifier(aWaitNotifier), iObserver(aObserver) { } @@ -41,7 +41,7 @@ // void CWaitNotifierInfo::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::ConstructL" ) ); + LOG_FUNC // owenrship for iWaitNotifier transferred in default constructor. // this object is responsible for deletion of the iWaitNotifier then } @@ -51,9 +51,10 @@ // --------------------------------------------------------------------------- // CWaitNotifierInfo* CWaitNotifierInfo::NewL(CUsbNotifier* aWaitNotifier, - MWaitNotifierObserver* aObserver) + MWaitNotifierObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::NewL" ) ); + LOG_FUNC + CWaitNotifierInfo* self = new (ELeave) CWaitNotifierInfo(aWaitNotifier, aObserver); CleanupStack::PushL(self); @@ -68,7 +69,7 @@ // CWaitNotifierInfo::~CWaitNotifierInfo() { - FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::~CWaitNotifierInfo" ) ); + LOG_FUNC delete iWaitNotifier; } @@ -87,18 +88,16 @@ // MWaitNotifierObserver* CWaitNotifierInfo::Observer() const { - return iObserver; + return &iObserver; } - // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher* aOtgWatcher) +CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher& aOtgWatcher) { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) ); + LOG_FUNC CUsbNotifManager* self = new (ELeave) CUsbNotifManager(); CleanupStack::PushL(self); @@ -111,14 +110,13 @@ // // --------------------------------------------------------------------------- // -void CUsbNotifManager::ConstructL(CUsbOtgWatcher* aOtgWatcher) +void CUsbNotifManager::ConstructL(CUsbOtgWatcher& aOtgWatcher) { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iNotifier.Connect()); - - iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this, aOtgWatcher); + + iIndicatorNotifier = CUsbIndicatorNotifier::NewL(*this, aOtgWatcher); } @@ -128,7 +126,6 @@ // CUsbNotifManager::CUsbNotifManager() { - } // --------------------------------------------------------------------------- @@ -137,13 +134,12 @@ // CUsbNotifManager::~CUsbNotifManager() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) ); + LOG_FUNC CloseAllNotifiers(); - + delete iIndicatorNotifier; - + iNotifier.Close(); } @@ -155,16 +151,17 @@ void CUsbNotifManager::ShowNotifierL(TUid aCat, TUint aNotifId, MWaitNotifierObserver* aObserver) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifier aCat = 0x%X aNotifId = %d, aObserver=0x%X" ), - aCat, aNotifId, aObserver)); + LOG_FUNC + + LOG3( "aCat = 0x%X aNotifId = %d, aObserver=0x%X" , aCat, aNotifId, aObserver); // remove non-feedback notifiers from the list for (TUint i(0); i < iWaitNotifiers.Count(); ++i) { - CWaitNotifierInfo* waitNotifier = iWaitNotifiers[i]; - if (!(waitNotifier->WaitNotifier()->IsFeedbackNeeded())) + CWaitNotifierInfo* waitNotifierInfo = iWaitNotifiers[i]; + if (!(waitNotifierInfo->WaitNotifier()->IsFeedbackNeeded())) { - delete waitNotifier; + delete waitNotifierInfo; iWaitNotifiers.Remove(i); } } @@ -183,41 +180,42 @@ if (aCat == KUsbUiNotifOtgError) { __ASSERT_ALWAYS(aObserver != NULL, Panic(EWrongNotifierCategory)); - notifier = CUsbWaitNotifier::NewL(iNotifier, this, aNotifId); + notifier = CUsbWaitNotifier::NewL(iNotifier, *this, aNotifId); } else if (aCat == KUsbUiNotifOtgWarning) { - notifier = CUsbWarningNotifier::NewL(iNotifier, this, aNotifId); + notifier = CUsbWarningNotifier::NewL(iNotifier, *this, aNotifId); } else { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifierL - Unexpected aCat" ) ); + LOG1("Unexpected aCat = 0x%X", aCat ); Panic(EWrongNotifierCategory); } CleanupStack::PushL(notifier); - - iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, aObserver)); - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifierL - Start to show note" ) ); + iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, *aObserver)); + notifier->ShowL(); - CleanupStack::Pop(notifier); + CleanupStack::Pop(notifier); } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier* aWaitNotifier, +void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier& aWaitNotifier, TInt aResult, TInt aFeedback) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::NotifierShowCompleted aResult = %d" ), aResult)); + LOG_FUNC + + LOG1( "aResult = %d", aResult); // remove Notifier from the list for (TUint i(0); i < iWaitNotifiers.Count(); ++i) { - if (aWaitNotifier == iWaitNotifiers[i]->WaitNotifier()) + if (&aWaitNotifier == iWaitNotifiers[i]->WaitNotifier()) { MWaitNotifierObserver* observer = iWaitNotifiers[i]->Observer(); @@ -236,7 +234,7 @@ // void CUsbNotifManager::CloseAllNotifiers() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) ); + LOG_FUNC iWaitNotifiers.ResetAndDestroy(); iIndicatorNotifier->Close(); diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbotgstateobserver.h" @@ -38,8 +37,7 @@ // void CUsbOtgStateObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iOtgState.Attach(KUidUsbManCategory, KUsbOtgStateProperty)); @@ -52,8 +50,7 @@ // CUsbOtgStateObserver* CUsbOtgStateObserver::NewL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::NewL" ) ); + LOG_FUNC CUsbOtgStateObserver* self = new (ELeave) CUsbOtgStateObserver(); CleanupStack::PushL(self); @@ -68,8 +65,7 @@ // CUsbOtgStateObserver::~CUsbOtgStateObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::~CUsbOtgStateObserver" ) ); + LOG_FUNC Cancel(); @@ -85,21 +81,16 @@ // TUsbOtgState CUsbOtgStateObserver::OtgState() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::OtgState" ) ); - TInt val(0); TInt err = iOtgState.Get(val); if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::StOtgState CanNotGetOtgStateProperty" ) ); - Panic(ECanNotGetOtgStateProperty); + LOG("CanNotGetOtgStateProperty" ); + Panic( ECanNotGetOtgStateProperty); } - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::OtgState = %d" ), val )); - return (TUsbOtgState) val; } @@ -110,12 +101,13 @@ // void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::SubscribeL" ) ); + LOG_FUNC + // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) + if (KErrNotFound != iObservers.Find(&aObserver)) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); + LOG( "Observer already exists" ); + Panic( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -134,18 +126,18 @@ // void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::UnsubscribeL" ) ); - + LOG_FUNC + TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) + if (KErrNotFound == i) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindOtgStateObserver); + LOG("Observer not found"); + Panic( ECanNotFindOtgStateObserver); return; } - + iObservers.Remove(i); - + if (0 == iObservers.Count()) // no observers anymore { // cancel pending request @@ -159,18 +151,20 @@ // void CUsbOtgStateObserver::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d" , iStatus.Int()); // if error occured, tell to Observers - if(KErrNone != iStatus.Int()) + if (KErrNone != iStatus.Int()) { for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->OtgStateErrorL(iStatus.Int()); - } + { + iObservers[i]->OtgStateErrorL(iStatus.Int()); + } return; } - + // re-issue request first iOtgState.Subscribe(iStatus); SetActive(); @@ -182,12 +176,12 @@ { case EUsbOtgStateReset: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == RESET" ) ); + LOG("OTGState == RESET" ); break; } case EUsbOtgStateAIdle: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AIdle" ) ); + LOG("OTGState == AIdle" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->AIdleL(); @@ -196,7 +190,7 @@ } case EUsbOtgStateAHost: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AHost" ) ); + LOG( "OTGState == AHost"); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->AHostL(); @@ -205,7 +199,7 @@ } case EUsbOtgStateAPeripheral: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == APeripheral" ) ); + LOG("OTGState == APeripheral" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->APeripheralL(); @@ -214,7 +208,7 @@ } case EUsbOtgStateAVbusError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AVBusError" ) ); + LOG("OTGState == AVBusError" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->AVBusErrorL(); @@ -223,7 +217,7 @@ } case EUsbOtgStateBIdle: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BIdle" ) ); + LOG( "OTGState == BIdle" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->BIdleL(); @@ -232,7 +226,7 @@ } case EUsbOtgStateBPeripheral: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BPeripheral" ) ); + LOG("OTGState == BPeripheral" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->BPeripheralL(); @@ -241,7 +235,7 @@ } case EUsbOtgStateBHost: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BHost" ) ); + LOG("OTGState == BHost" ); for (TInt i(0); i < iObservers.Count(); ++i) { iObservers[i]->BHostL(); @@ -250,8 +244,8 @@ } default: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL WrongOtgState" ) ); - Panic(EWrongOtgState); + LOG("WrongOtgState" ); + Panic( EWrongOtgState); } } @@ -272,8 +266,9 @@ // TInt CUsbOtgStateObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::RunError aError = %d" ), aError)); + LOG1( "aError = %d" , aError); // try to continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbotgwatcher.cpp --- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,48 +1,42 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include #include #include - #include "cusbotgwatcher.h" #include "cusbstate.h" - #include "cusbstatehostainitiate.h" #include "cusbstatehostahost.h" #include "cusbstatehostaperipheral.h" -#include "cusbstatehostaidle.h" #include "cusbstatehosthandle.h" #include "cusbstatehostdelayhandle.h" +#include "cusbstatehostdelayattachedhandle.h" +#include "cusbstatehostdelaynotattachedhandle.h" +#include "cusbstatehosthandledropping.h" #include "cusbstatehostundefined.h" - #include "cusbwarningnotifier.h" - #ifndef STIF #include "cusbnotifmanager.h" #else #include "mockcusbnotifmanager.h" #endif - #include "errors.h" #include "debug.h" #include "panic.h" - _LIT_SECURITY_POLICY_PASS( KAlwaysPassPolicy ); _LIT_SECURITY_POLICY_C1( KLocalServicesPolicy, ECapabilityLocalServices ); @@ -51,9 +45,10 @@ // --------------------------------------------------------------------------- // CUsbOtgWatcher::CUsbOtgWatcher(RUsb& aUsbMan) : - iUsb(aUsbMan), iPersonalityId(KUsbPersonalityIdMTP) + iUsb(aUsbMan), iPersonalityId(KUsbPersonalityIdMTP), iUsbServiceRequest( + CUsbServiceControl::ERequestUndefined) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CUsbOtgWatcher" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -62,32 +57,35 @@ // void CUsbOtgWatcher::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ConstructL" ) ); + LOG_FUNC #ifdef _DEBUG SelfTestL(); #endif #ifndef STIF - User::LeaveIfError(RProperty::Define( KPSUidUsbWatcher, - KUsbWatcherIsPeripheralConnected, RProperty::EInt, KAlwaysPassPolicy, - KLocalServicesPolicy ) ); + User::LeaveIfError(RProperty::Define(KPSUidUsbWatcher, + KUsbWatcherIsPeripheralConnected, RProperty::EInt, + KAlwaysPassPolicy, KLocalServicesPolicy)); - User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher, + User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected, - KUsbWatcherPeripheralIsNotConnected ) ); + KUsbWatcherPeripheralIsNotConnected)); #endif - - iUsbServiceControl = CUsbServiceControl::NewL(this, iUsb); + + iUsbServiceControl = CUsbServiceControl::NewL(*this, iUsb); - User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAIdle::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostDelayHandle::NewL(this))); + User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); + + User::LeaveIfError(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( + *this))); + User::LeaveIfError(iStates.Append( + CUsbStateHostDelayNotAttachedHandle::NewL(*this))); + User::LeaveIfError(iStates.Append( + CUsbStateHostHandleDropping::NewL(*this))); iIdPinObserver = CUsbIdPinObserver::NewL(); iVBusObserver = CUsbVBusObserver::NewL(); @@ -97,12 +95,12 @@ &iUsb); iMessageNotificationObserver = CUsbMessageNotificationObserver::NewL( &iUsb); - + iHostState = iStates[EUsbStateHostUndefined]; - + // Notif manager must be created at least after VBus observer and iHostState initialization // to allow USb indicator subscribe to its notifications at construction and check their's current states - iNotifManager = CUsbNotifManager::NewL(this); + iNotifManager = CUsbNotifManager::NewL(*this); iVBusObserver->SubscribeL(*this); iOtgStateObserver->SubscribeL(*this); @@ -136,7 +134,7 @@ // EXPORT_C CUsbOtgWatcher* CUsbOtgWatcher::NewL(RUsb& aUsbMan) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::NewL" ) ); + LOG_FUNC CUsbOtgWatcher* self = new (ELeave) CUsbOtgWatcher(aUsbMan); CleanupStack::PushL(self); @@ -151,41 +149,41 @@ // CUsbOtgWatcher::~CUsbOtgWatcher() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::~CUsbOtgWatcher" ) ); - + LOG_FUNC + #ifndef STIF - RProperty::Delete( KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected ); + RProperty::Delete(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected); #endif - + // delete Notif manager before VBus observer, due to USB indicator observes VBus delete iNotifManager; - - if(iIdPinObserver) + + if (iIdPinObserver) { TRAP_IGNORE(iIdPinObserver->UnsubscribeL(*this)); } - - if(iVBusObserver) + + if (iVBusObserver) { TRAP_IGNORE(iVBusObserver->UnsubscribeL(*this)); } - if(iOtgStateObserver) + if (iOtgStateObserver) { TRAP_IGNORE(iOtgStateObserver->UnsubscribeL(*this)); } - if(iBusActivityObserver) + if (iBusActivityObserver) { TRAP_IGNORE(iBusActivityObserver->UnsubscribeL(*this)); } - if(iHostEventNotificationObserver) + if (iHostEventNotificationObserver) { TRAP_IGNORE(iHostEventNotificationObserver->UnsubscribeL(*this)); } - if(iMessageNotificationObserver) + if (iMessageNotificationObserver) { TRAP_IGNORE(iMessageNotificationObserver->UnsubscribeL(*this)); } - + delete iIdPinObserver; delete iVBusObserver; delete iOtgStateObserver; @@ -194,11 +192,11 @@ delete iMessageNotificationObserver; iOtgStateObservers.Close(); - + // Destroy states iStates.ResetAndDestroy(); iStates.Close(); - + delete iUsbServiceControl; iUsb.Close(); @@ -212,8 +210,9 @@ void CUsbOtgWatcher::SetPersonalityL(TRequestStatus& /*aStatus*/, TInt aPersonality) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPersonalityL aPersonality = %d" ), aPersonality)); + LOG1( "aPersonality = %d" , aPersonality); // watcher keeps this value, no need to pass it to request object // state can read it from watcher when needed @@ -233,7 +232,7 @@ // void CUsbOtgWatcher::CancelSetPersonalityL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CancelSetPersonalityL" ) ); + LOG_FUNC iState->CancelSetPersonalityL(); } @@ -244,7 +243,7 @@ // void CUsbOtgWatcher::SetPreviousPersonalityL(TRequestStatus& /*aStatus*/) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPersonalityL" ) ); + LOG_FUNC // maybe more complex processing needed here iState->SetPreviousPersonalityL(); @@ -256,7 +255,7 @@ // void CUsbOtgWatcher::SetPreviousPersonalityL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPersonalityL" ) ); + LOG_FUNC iState->SetPreviousPersonalityL(); } @@ -267,7 +266,7 @@ // void CUsbOtgWatcher::CancelSetPreviousPersonalityL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CancelSetPreviousPersonalityL" ) ); + LOG_FUNC iState->CancelSetPreviousPersonalityL(); } @@ -278,7 +277,7 @@ // void CUsbOtgWatcher::SetPreviousPreviousPersonalityOnDisconnectL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPreviousPersonalityOnDisconnectL" ) ); + LOG_FUNC } @@ -289,19 +288,22 @@ // void CUsbOtgWatcher::StartSessionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::StartSessionL" ) ); + LOG_FUNC if (!CanStartSessionL()) { - HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + HandleHostProblemL(EUsbWatcherCanNotStartSession, + EUsbStateHostHandleDropping); return; } + iUsbServiceRequest = CUsbServiceControl::EStartUsbService; TInt err = iUsbServiceControl->StartL(iPersonalityId); if (KErrNone != err) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::StartSessionL Can not start usb services. reason = %d" ), err)); - HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle); + LOG1( "Can not start usb services. err = %d" , err); + HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, + EUsbStateHostHandleDropping); return; } @@ -314,9 +316,10 @@ // // --------------------------------------------------------------------------- // -void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf, TUsbStateIds aInState ) +void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf, + TUsbStateIds aInState) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HandleProblemL" ) ); + LOG_FUNC HostHandle(aInState)->SetWhat(aWhatKindOf); ChangeHostStateL(aInState); } @@ -327,7 +330,7 @@ // void CUsbOtgWatcher::IdPinOnL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOnL" ) ); + LOG_FUNC StartSessionL(); } @@ -337,26 +340,24 @@ // void CUsbOtgWatcher::IdPinOffL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL" ) ); + LOG_FUNC ChangeHostStateL(EUsbStateHostUndefined); iNotifManager->CloseAllNotifiers(); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL Before DisableFunctionDriverLoad " ) ); Usb().DisableFunctionDriverLoading(); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL Before TryStop" ) ); + iUsbServiceRequest = CUsbServiceControl::EStopUsbService; + TInt err = iUsbServiceControl->StopL(); - TInt err = iUsbServiceControl->StopL(); + LOG1( "iUsbServiceControl->Stop() err = %d", err ); if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOnL ErrorStoppingUsbServices" ) ); + LOG( "ErrorStoppingUsbServices" ); Panic(ECanNotStopUsbServices); } - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL iUsbServiceControl->Stop() OK" ) ); } // --------------------------------------------------------------------------- @@ -365,9 +366,8 @@ // void CUsbOtgWatcher::IdPinErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinErrorL" ) ); - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); - HandleHostProblemL(EUsbWatcherIdPinError, EUsbStateHostHandle); + __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + HandleHostProblemL(EUsbWatcherIdPinError, EUsbStateHostHandleDropping); } @@ -378,7 +378,6 @@ // void CUsbOtgWatcher::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusDownL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->VBusDownL(); } @@ -389,7 +388,6 @@ // void CUsbOtgWatcher::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusUpL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->VBusUpL(); } @@ -400,9 +398,9 @@ // void CUsbOtgWatcher::VBusObserverErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusObserverErrorL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); - HandleHostProblemL(EUsbWatcherVBusObserverError, EUsbStateHostHandle); + HandleHostProblemL(EUsbWatcherVBusObserverError, + EUsbStateHostHandleDropping); } // From OTG state observer @@ -412,7 +410,6 @@ // void CUsbOtgWatcher::AIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AIdleL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->AIdleL(); } @@ -423,7 +420,6 @@ // void CUsbOtgWatcher::AHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AHostL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->AHostL(); } @@ -434,7 +430,6 @@ // void CUsbOtgWatcher::APeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::APeripheralL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->APeripheralL(); } @@ -445,7 +440,6 @@ // void CUsbOtgWatcher::AVBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AVBusErrorL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->AVBusErrorL(); } @@ -456,7 +450,6 @@ // void CUsbOtgWatcher::BIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BIdleL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BIdleL(); } @@ -467,7 +460,6 @@ // void CUsbOtgWatcher::BPeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BPeripheralL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BPeripheralL(); } @@ -478,7 +470,6 @@ // void CUsbOtgWatcher::BHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BHostL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BHostL(); } @@ -489,9 +480,8 @@ // void CUsbOtgWatcher::OtgStateErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::OtgStateErrorL" ) ); -__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); -HandleHostProblemL(EUsbWatcherOtgStateError, EUsbStateHostHandle); + __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + HandleHostProblemL(EUsbWatcherOtgStateError, EUsbStateHostHandleDropping); } // From bus activity observer @@ -501,7 +491,6 @@ // void CUsbOtgWatcher::BusIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusIdleL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BusIdleL(); } @@ -512,7 +501,6 @@ // void CUsbOtgWatcher::BusActiveL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusActiveL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BusActiveL(); } @@ -523,7 +511,6 @@ // void CUsbOtgWatcher::BusActivityErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusActivityErrorL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); // no action, continue } @@ -535,7 +522,6 @@ // void CUsbOtgWatcher::DeviceAttachedL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DeviceAttachedL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->DeviceAttachedL(aTdi); } @@ -546,7 +532,6 @@ // void CUsbOtgWatcher::DeviceDetachedL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DeviceDetachedL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->DeviceDetachedL(aTdi); } @@ -557,7 +542,6 @@ // void CUsbOtgWatcher::DriverLoadSuccessL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadSuccessL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->DriverLoadSuccessL(aTdi); } @@ -568,7 +552,6 @@ // void CUsbOtgWatcher::DriverLoadPartialSuccessL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadPartialSuccessL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->DriverLoadPartialSuccessL(aTdi); } @@ -579,7 +562,6 @@ // void CUsbOtgWatcher::DriverLoadFailureL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadFailureL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->DriverLoadFailureL(aTdi); } @@ -590,9 +572,9 @@ // void CUsbOtgWatcher::HostEventNotificationErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HostEventNotificationErrorL" ) ); -__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); -HandleHostProblemL(EUsbWatcherHostEventNotificationError, EUsbStateHostHandle); + __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + HandleHostProblemL(EUsbWatcherHostEventNotificationError, + EUsbStateHostHandleDropping); } // From message notification observer @@ -602,7 +584,6 @@ // void CUsbOtgWatcher::MessageNotificationReceivedL(TInt aMessage) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::MessageNotificationReceivedL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->MessageNotificationReceivedL(aMessage); } @@ -613,7 +594,6 @@ // void CUsbOtgWatcher::BadHubPositionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BadHubPositionL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->BadHubPositionL(); } @@ -624,7 +604,6 @@ // void CUsbOtgWatcher::VBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusErrorL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->VBusErrorL(); } @@ -635,7 +614,6 @@ // void CUsbOtgWatcher::SrpReceivedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SrpReceivedL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->SrpReceivedL(); } @@ -646,7 +624,6 @@ // void CUsbOtgWatcher::SessionRequestedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SessionRequestedL" ) ); __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); iHostState->SessionRequestedL(); } @@ -657,9 +634,9 @@ // void CUsbOtgWatcher::MessageNotificationErrorL(TInt aError) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::MessageNotificationErrorL" ) ); - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); - HandleHostProblemL(EUsbWatcherMessageNotificationError, EUsbStateHostHandle); + __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + HandleHostProblemL(EUsbWatcherMessageNotificationError, + EUsbStateHostHandleDropping); } // --------------------------------------------------------------------------- @@ -760,9 +737,8 @@ // CUsbStateHostHandle* CUsbOtgWatcher::HostHandle(TUsbStateIds aInState) const { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HostHandle" ) ); __ASSERT_DEBUG(iStates[aInState] != NULL, Panic(EBadState)); - + return (CUsbStateHostHandle*) iStates[aInState]; } @@ -772,20 +748,13 @@ // void CUsbOtgWatcher::ChangeStateL(TUsbStateIds aNewStateId) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ChangeStateL aNewState = %d" ), aNewStateId)); + LOG1( "aNewState = %d" , aNewStateId); if (NULL != iState) { - if (aNewStateId == iState->Id()) - { - return; // we already in the target state - } - else - { - - iState->JustBeforeLeavingThisStateL(); - } + iState->JustBeforeLeavingThisStateL(); } // sets new state @@ -809,20 +778,13 @@ // void CUsbOtgWatcher::ChangeHostStateL(TUsbStateIds aNewStateId) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ChangeHostStateL aNewState = %d" ), aNewStateId)); + LOG1( "aNewState = %d", aNewStateId); if (NULL != iHostState) { - if (aNewStateId == iHostState->Id()) - { - return; // we already in the target state - } - else - { - - iHostState->JustBeforeLeavingThisStateL(); - } + iHostState->JustBeforeLeavingThisStateL(); } // set new state @@ -837,7 +799,7 @@ __ASSERT_DEBUG(iHostState != NULL, Panic(EBadState)); iHostState->JustAdvancedToThisStateL(); // checks if there are conditions for advancing to another state(s) - + // notify state change to observers for (TInt i(0); i < iOtgStateObservers.Count(); ++i) { @@ -861,18 +823,19 @@ // void CUsbOtgWatcher::PrintStateToLog() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog IdPin = %d" ), iIdPinObserver->IdPin())); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog VBus = %d" ), iVBusObserver->VBus())); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog OtgState = %d" ), iOtgStateObserver->OtgState())); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog BusActivity = %d" ), iBusActivityObserver->BusActivity())); - - TInt isPeripheralConnected(KUsbWatcherPeripheralIsNotConnected); - - RProperty::Get( KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected, - isPeripheralConnected ); - - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog IsPeripheralConnected = %d" ), isPeripheralConnected)); - + LOG1( "Current state id = %d" , iHostState->Id()); + LOG1( "IdPin = %d" , iIdPinObserver->IdPin()); + LOG1( "VBus = %d" , iVBusObserver->VBus()); + LOG1( "OtgState = %d" , iOtgStateObserver->OtgState()); + LOG1( "BusActivity = %d" , iBusActivityObserver->BusActivity()); + + TInt isPeripheralConnected(KUsbWatcherPeripheralIsNotConnected); + + RProperty::Get(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected, + isPeripheralConnected); + + LOG1( "IsPeripheralConnected = %d" , isPeripheralConnected); + } // --------------------------------------------------------------------------- @@ -890,38 +853,46 @@ // void CUsbOtgWatcher::UsbServiceControlReqCompletedL(TInt aError) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompleted Error returned by UsbServiceControl = %d" ), aError)); - - switch(aError) - { - case KErrInUse: - // usb services already started (this might happen if more than one idpin on event come) - { - return; - } - - case KErrNone: + LOG_FUNC + + LOG1( "aError = %d" , aError); + + switch (aError) { - break; // do normal routine + case KErrInUse: + // usb services already started (this might happen if more than one idpin on event come) + { + return; + } + + case KErrNone: + { + break; // do normal routine + } + + default: // handle the issue + { + if (iUsbServiceRequest == CUsbServiceControl::EStartUsbService) // Handle only start issues + { + HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, + EUsbStateHostHandleDropping); + } + + iUsbServiceRequest = CUsbServiceControl::ERequestUndefined; + return; + } } - - default: // handle the issue - { - if(IsDeviceA()) // if there is no cable, give up - { - HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle); - } - return; - } - } + + iUsbServiceRequest = CUsbServiceControl::ERequestUndefined; TUsbServiceState serviceState; TInt err = iUsb.GetServiceState(serviceState); if (KErrNone != err) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompleted Error when requesting GetServiceState = %d" ), err)); - HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle); + LOG1( "Error when requesting GetServiceState = %d" , err); + HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, + EUsbStateHostHandleDropping); return; } @@ -929,38 +900,36 @@ { case EUsbServiceIdle: // just stopped usb service { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceIdle" ) ); + LOG("UsbServiceState == EUsbServiceIdle" ); // do nothing break; } case EUsbServiceStarted: // just started usb service { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStarted" ) ); + LOG( "UsbServiceState == EUsbServiceStarted" ); - iHostState = iStates[EUsbStateHostAInitiate]; - - iHostState->JustAdvancedToThisStateL(); // do any initial activity, once advanced to the state + ChangeHostStateL(EUsbStateHostAInitiate); break; } case EUsbServiceStarting: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStarting" ) ); + LOG("UsbServiceState == EUsbServiceStarting" ); // should not receive that, due to call back is called when service stopped or started // therefore scream // no break statement here } case EUsbServiceStopping: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStopping" ) ); + LOG("UsbServiceState == EUsbServiceStopping" ); // should not receive that, due to call back is called when service stopped or started // therefore scream // no break statement here } case EUsbServiceFatalError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceFatalError" ) ); + LOG( "UsbServiceState == EUsbServiceFatalError" ); Panic(EUnexpectedUsbServiceState); break; } @@ -970,7 +939,6 @@ Panic(EUnknownUsbServiceState); } } - } // --------------------------------------------------------------------------- @@ -980,21 +948,19 @@ TInt CUsbOtgWatcher::SelfTestL() { #ifdef _DEBUG - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating observers." ) ); + LOG_FUNC // create all the observers iIdPinObserver = CUsbIdPinObserver::NewL(); iVBusObserver = CUsbVBusObserver::NewL(); iOtgStateObserver = CUsbOtgStateObserver::NewL(); - iBusActivityObserver = - CUsbBusActivityObserver::NewL(); - iHostEventNotificationObserver = - CUsbHostEventNotificationObserver::NewL(&iUsb); - iMessageNotificationObserver = - CUsbMessageNotificationObserver::NewL(&iUsb); + iBusActivityObserver = CUsbBusActivityObserver::NewL(); + iHostEventNotificationObserver = CUsbHostEventNotificationObserver::NewL( + &iUsb); + iMessageNotificationObserver = CUsbMessageNotificationObserver::NewL( + &iUsb); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers getters." ) ); + LOG( "Observers getters" ); if (iIdPinObserver != IdPinObserver()) { @@ -1021,11 +987,11 @@ User::Leave(KErrGeneral); } - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers destructors." ) ); + LOG( "Observers destructors" ); // idpinobserver is deleted later // Vbus observer is deleted later - + delete iOtgStateObserver; iOtgStateObserver = 0; delete iBusActivityObserver; @@ -1035,69 +1001,72 @@ delete iMessageNotificationObserver; iMessageNotificationObserver = 0; - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating states." ) ); + LOG("Creating states"); - User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAIdle::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this))); - User::LeaveIfError(iStates.Append(CUsbStateHostDelayHandle::NewL(this))); + User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); + User::LeaveIfError(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( + *this))); + User::LeaveIfError(iStates.Append( + CUsbStateHostDelayNotAttachedHandle::NewL(*this))); + User::LeaveIfError(iStates.Append( + CUsbStateHostHandleDropping::NewL(*this))); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check State()" ) ); + LOG("Check State()" ); if (iStates[EUsbStateHostAInitiate] != State(EUsbStateHostAInitiate)) { User::Leave(KErrGeneral); } - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check CurrentHostState()" ) ); - + + LOG("Check CurrentHostState()" ); + iHostState = iStates[EUsbStateHostAInitiate]; - - if (iStates[EUsbStateHostAInitiate] != CurrentHostState()) + + if (iStates[EUsbStateHostAInitiate] != CurrentHostState()) { User::Leave(KErrGeneral); } - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier." ) ); - CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(this); + LOG("NotifManager and WarningNotifier." ); + + CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(*this); RNotifier rnotifier; User::LeaveIfError(rnotifier.Connect()); CUsbWarningNotifier* usbnotifier = CUsbWarningNotifier::NewL(rnotifier, - usbnotifmanager, EUsbOtgPartiallySupportedDevice); + *usbnotifmanager, EUsbOtgPartiallySupportedDevice); usbnotifier->IsFeedbackNeeded(); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier destruction." ) ); + LOG( "NotifManager and WarningNotifier destruction." ); delete usbnotifier; rnotifier.Close(); - delete usbnotifmanager; - + delete usbnotifmanager; + // VBus observer is deleted here, due to it is used by usbnotifmanager.usbindicatornotifier delete iVBusObserver; iVBusObserver = 0; - + // id pin observer is deleted here due to it is used by usbnotifmanager.usbindicatornotifier delete iIdPinObserver; iIdPinObserver = 0; - - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Destructing states." ) ); - + + LOG("Destructing states"); + iStates.ResetAndDestroy(); - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check UsbServiceControl" ) ); + LOG( "Check UsbServiceControl" ); - CUsbServiceControl* usbServiceControl = CUsbServiceControl::NewL(this, + CUsbServiceControl* usbServiceControl = CUsbServiceControl::NewL(*this, iUsb); usbServiceControl->RunError(KErrNone); delete usbServiceControl; - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL All completed OK." ) ); + LOG("All completed OK" ); #endif - return KErrNone; + return KErrNone; } @@ -1107,16 +1076,16 @@ // void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SubscribeL" ) ); + LOG_FUNC - // check if the same observer already exist in a list - if(KErrNotFound != iOtgStateObservers.Find(&aObserver)) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); - return; - } - iOtgStateObservers.AppendL(&aObserver); + // check if the same observer already exist in a list + if (KErrNotFound != iOtgStateObservers.Find(&aObserver)) + { + LOG( "Observer already exists" ); + Panic(EObserverAlreadyExists); + return; + } + iOtgStateObservers.AppendL(&aObserver); } @@ -1126,14 +1095,15 @@ // void CUsbOtgWatcher::UnsubscribeL(MUsbOtgWatcherStateObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL" ) ); - TInt i(iOtgStateObservers.Find(&aObserver)); - if(KErrNotFound == i) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindUsbOtgWatcherStateObserver); - return; - } - - iOtgStateObservers.Remove(i); + LOG_FUNC + + TInt i(iOtgStateObservers.Find(&aObserver)); + if (KErrNotFound == i) + { + LOG( "Observer not found" ); + Panic(ECanNotFindUsbOtgWatcherStateObserver); + return; + } + + iOtgStateObservers.Remove(i); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbservicecontrol.cpp --- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -26,7 +25,7 @@ // // --------------------------------------------------------------------------- // -CUsbServiceControl::CUsbServiceControl(MUsbServiceControlObserver* aObserver, +CUsbServiceControl::CUsbServiceControl(MUsbServiceControlObserver& aObserver, RUsb& aUsb) : CActive(CActive::EPriorityStandard), iObserver(aObserver), iUsb(aUsb), iPersonalityId(0) @@ -40,7 +39,8 @@ // CUsbServiceControl::~CUsbServiceControl() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::~CUsbServiceControl" ) ); + LOG_FUNC + Cancel(); } @@ -50,7 +50,7 @@ // void CUsbServiceControl::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::ConstructL" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -58,9 +58,9 @@ // --------------------------------------------------------------------------- // CUsbServiceControl* CUsbServiceControl::NewL( - MUsbServiceControlObserver* aObserver, RUsb& aUsb) + MUsbServiceControlObserver& aObserver, RUsb& aUsb) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::NewL" ) ); + LOG_FUNC CUsbServiceControl* self = new (ELeave) CUsbServiceControl(aObserver, aUsb); @@ -76,7 +76,9 @@ // TInt CUsbServiceControl::StartL(TInt aPersonalityId) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::Start aPersonalityId = %d" ), aPersonalityId)); + LOG_FUNC + + LOG1( "aPersonalityId = %d" , aPersonalityId); TUsbServiceState serviceState; TInt err = iUsb.GetServiceState(serviceState); @@ -90,12 +92,12 @@ { case EUsbServiceIdle: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceIdle" ) ); + LOG( "UsbServiceState == EUsbServiceIdle" ); iPersonalityId = aPersonalityId; // when request completed, this will indicate that we started what we wanted if (IsActive()) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Request is outstanding, cancelling first." ) ); + LOG("Request is outstanding, cancelling first" ); Cancel(); } iUsb.TryStart(aPersonalityId, iStatus); @@ -105,20 +107,20 @@ case EUsbServiceStarted: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarted" ) ); + LOG("UsbServiceState == EUsbServiceStarted"); TInt currentPersonality(0); err = iUsb.GetCurrentPersonalityId(currentPersonality); if (KErrNone != err) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Error getting current personality err = %d" ), err)); + LOG1( "Error getting current personality err = %d" , err); return err; } if (aPersonalityId == currentPersonality) // already started { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Personality already started" ) ); - iObserver->UsbServiceControlReqCompletedL(KErrInUse); + LOG("Personality already started" ); + iObserver.UsbServiceControlReqCompletedL(KErrInUse); return KErrNone; } @@ -133,13 +135,13 @@ } case EUsbServiceStarting: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarting" ) ); + LOG("UsbServiceState == EUsbServiceStarting" ); // do exactly the same as in case of EUsbServiceStopping; // break statement is not required here } case EUsbServiceStopping: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStopping" ) ); + LOG( "UsbServiceState == EUsbServiceStopping" ); // subscribe for usb service state change, and start new usb service once current one started/stopped iPersonalityId = aPersonalityId; // this will indicate that we want to start this personality @@ -147,7 +149,7 @@ // this check is needed due to usb service might be stopping by other client if (IsActive()) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Request outstanding. Waiting for completion." ) ); + LOG( "Request outstanding. Waiting for completion" ); return KErrNone; // when the outstanding request get completed, we start usb services with iPersonalityId } @@ -159,12 +161,12 @@ } case EUsbServiceFatalError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) ); + LOG( "UsbServiceState == EUsbServiceFatalError" ); return KErrGeneral; } default: { - Panic(EUnknownUsbServiceState); + Panic( EUnknownUsbServiceState); } } @@ -178,11 +180,12 @@ // TInt CUsbServiceControl::StopL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop" ) ); + LOG_FUNC TUsbServiceState serviceState; TInt err = iUsb.GetServiceState(serviceState); - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::StopL = %d; Usb service state = %d" ), err, serviceState)); + + LOG2("err = %d; serviceState = %d" , err, serviceState); if (KErrNone != err) { @@ -193,18 +196,18 @@ { case EUsbServiceIdle: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceIdle" ) ); + LOG("UsbServiceState == EUsbServiceIdle" ); return KErrNone; } case EUsbServiceStarted: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStarted" ) ); + LOG("UsbServiceState == EUsbServiceStarted" ); if (IsActive()) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop Request is outstanding, cancelling it." ) ); + LOG("Request is outstanding, cancelling it" ); Cancel(); } iUsb.TryStop(iStatus); @@ -214,13 +217,13 @@ } case EUsbServiceStopping: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStopping" ) ); + LOG( "UsbServiceState == EUsbServiceStopping" ); // do exactly the same as in case of EUsbServiceStarting; // break statement is not required here } case EUsbServiceStarting: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStarting" ) ); + LOG("UsbServiceState == EUsbServiceStarting" ); // subscribe for usb service state change, and stop usb service once current one started iPersonalityId = 0; // this will indicate that we do not want to start this personality @@ -228,7 +231,7 @@ // this check is needed due to usb service might be starting by other client if (IsActive()) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop Request is outstanding, waiting for completion. " ) ); + LOG("Request is outstanding, waiting for completion" ); return KErrNone; // when this request get completed, we request to stop usb services } @@ -240,12 +243,12 @@ } case EUsbServiceFatalError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) ); + LOG("UsbServiceState == EUsbServiceFatalError" ); return KErrGeneral; } default: { - Panic(EUnknownUsbServiceState); + Panic( EUnknownUsbServiceState); } } return KErrNone; @@ -257,10 +260,13 @@ // void CUsbServiceControl::RunL() { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL iStatus %d" ), iStatus.Int())); + LOG_FUNC + + LOG1("iStatus = %d" , iStatus.Int()); + if (KErrNone != iStatus.Int()) { - iObserver->UsbServiceControlReqCompletedL(iStatus.Int()); + iObserver.UsbServiceControlReqCompletedL(iStatus.Int()); return; } @@ -269,104 +275,104 @@ if (KErrNone != err) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting service state %d" ), err)); - iObserver->UsbServiceControlReqCompletedL(err); - return; + LOG1("Error while getting service state %d" , err); + iObserver.UsbServiceControlReqCompletedL(err); + return; } switch (serviceState) { case EUsbServiceIdle: // usb service stopped { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL UsbServiceState == EUsbServiceIdle" ) ); + LOG("UsbServiceState == EUsbServiceIdle" ); if (iPersonalityId != 0) // during service stopping, requested to start it { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL Requested to start personality %d. Starting it." ), iPersonalityId)); + LOG1("Requested to start personality %d. Starting it." , iPersonalityId); TInt personalityId = iPersonalityId; iPersonalityId = 0; // reset err = StartL(personalityId); - if(KErrNone != err) + if (KErrNone != err) { - iObserver->UsbServiceControlReqCompletedL(err); + iObserver.UsbServiceControlReqCompletedL(err); } return; } // otherwise, we've done, notify - iObserver->UsbServiceControlReqCompletedL(KErrNone); + iObserver.UsbServiceControlReqCompletedL(KErrNone); break; } case EUsbServiceStarted: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarted" ) ); + LOG("UsbServiceState == EUsbServiceStarted" ); TInt currentPersonality(0); err = iUsb.GetCurrentPersonalityId(currentPersonality); if (KErrNone != err) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting PersonalityId err = %d" ), err)); - iObserver->UsbServiceControlReqCompletedL(err); - return; + LOG1("Error while getting PersonalityId err = %d" , err); + iObserver.UsbServiceControlReqCompletedL(err); + return; } if (iPersonalityId == currentPersonality) // already done { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Personality already started." ) ); + LOG("Personality already started" ); iPersonalityId = 0; - iObserver->UsbServiceControlReqCompletedL(KErrNone); + iObserver.UsbServiceControlReqCompletedL(KErrNone); return; } if (iPersonalityId == 0) // during service start requested to stop it { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Requested to stop personality. Stopping." ) ); + LOG("Requested to stop personality. Stopping." ); err = StopL(); - if(KErrNone != err) + if (KErrNone != err) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while stopping personality err = %d" ), err)); - iObserver->UsbServiceControlReqCompletedL(err); + LOG1("Error while stopping personality err = %d" , err); + iObserver.UsbServiceControlReqCompletedL(err); } return; } // otherwise, during service start, requested to start it with another personality - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL Requested to start personality %d. Starting it." ), iPersonalityId)); + LOG1( "Requested to start personality %d. Starting it.", iPersonalityId); TInt personalityId = iPersonalityId; iPersonalityId = 0; // reset err = StartL(personalityId); - if(KErrNone != err) + if (KErrNone != err) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while starting personality err = %d" ), err)); - iObserver->UsbServiceControlReqCompletedL(err); + LOG1("Error while starting personality err = %d" , err); + iObserver.UsbServiceControlReqCompletedL(err); } break; } case EUsbServiceStarting: { - // do exactly same as in EUsbServiceStopping - // break statement is not required here - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start State == EUsbServiceStarting. Continue." ) ); + // do exactly same as in EUsbServiceStopping + // break statement is not required here + LOG("State == EUsbServiceStarting. Continue." ); } case EUsbServiceStopping: { - // we are not interested in these states, just continue monitoring - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start State == EUsbServiceStopping. Continue." ) ); + // we are not interested in these states, just continue monitoring + LOG("State == EUsbServiceStopping. Continue." ); iUsb.ServiceStateNotification(iServiceState, iStatus); SetActive(); break; } case EUsbServiceFatalError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) ); - iObserver->UsbServiceControlReqCompletedL(KErrGeneral); + LOG("UsbServiceState == EUsbServiceFatalError" ); + iObserver.UsbServiceControlReqCompletedL(KErrGeneral); break; } default: { - Panic(EUnknownUsbServiceState); + Panic( EUnknownUsbServiceState); } } @@ -378,8 +384,9 @@ // TInt CUsbServiceControl::RunError(TInt aError) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunError aError %d" ), aError )); - TRAP_IGNORE(iObserver->UsbServiceControlReqCompletedL(aError)); + LOG_FUNC + LOG1("aError = %d", aError ); + TRAP_IGNORE(iObserver.UsbServiceControlReqCompletedL(aError)); return KErrNone; } @@ -390,10 +397,10 @@ // void CUsbServiceControl::DoCancel() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to Usb TryStart.")) + LOG( "Cancelling interest to Usb TryStart.") iUsb.CancelInterest(RUsb::ETryStart); - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to Usb TrySop.")) + LOG( "Cancelling interest to Usb TrySop.") iUsb.CancelInterest(RUsb::ETryStop); - FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to usb states notifications.")) + LOG("Cancelling interest to usb states notifications.") iUsb.ServiceStateNotificationCancel(); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstate.cpp --- a/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbstate.h" @@ -25,7 +24,7 @@ // // --------------------------------------------------------------------------- // -CUsbState::CUsbState(CUsbOtgWatcher* aWatcher) : +CUsbState::CUsbState(CUsbOtgWatcher& aWatcher) : iWatcher(aWatcher) { } @@ -42,19 +41,6 @@ // // --------------------------------------------------------------------------- // -CUsbState* CUsbState::NewL(CUsbOtgWatcher* aWatcher) - { - CUsbState* self = new (ELeave) CUsbState(aWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbState::ConstructL() { @@ -64,18 +50,9 @@ // // --------------------------------------------------------------------------- // -TUsbStateIds CUsbState::Id() - { - Panic(EIdForNotDefinedStateRequested); - return EUsbStateHostUndefined; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbState::JustAdvancedToThisStateL() { + iWatcher.PrintStateToLog(); } // --------------------------------------------------------------------------- @@ -93,7 +70,7 @@ void CUsbState::ChangeStateL(TUsbStateIds aNewStateId) { - iWatcher->ChangeStateL(aNewStateId); + iWatcher.ChangeStateL(aNewStateId); } @@ -104,7 +81,7 @@ void CUsbState::ChangeHostStateL(TUsbStateIds aNewStateId) { - iWatcher->ChangeHostStateL(aNewStateId); + iWatcher.ChangeHostStateL(aNewStateId); } @@ -114,9 +91,11 @@ // void CUsbState::HandleL(TInt aWhat, TUsbStateIds aWhereToHandle) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbState::HandleL aWhat = %d aWhere = %d" ), aWhat, aWhereToHandle)); + LOG_FUNC - iWatcher->HandleHostProblemL(aWhat, aWhereToHandle); + LOG2( "aWhat = %d aWhere = %d" , aWhat, aWhereToHandle); + + iWatcher.HandleHostProblemL(aWhat, aWhereToHandle); } // --------------------------------------------------------------------------- @@ -168,7 +147,7 @@ // void CUsbState::IdPinOffL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOffL" ) ); + LOG_FUNC Panic(EIdPinOffNotExpected); } @@ -178,7 +157,7 @@ // void CUsbState::IdPinOnL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOnL" ) ); + LOG_FUNC Panic(EIdPinOnNotExpected); } @@ -189,7 +168,7 @@ // void CUsbState::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusDownL" ) ); + LOG_FUNC Panic(EVBusDownNotExpected); } @@ -199,8 +178,8 @@ // void CUsbState::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusUpL" ) ); - Panic(EVBusUpNotExpected); + LOG_FUNC + Panic(EVBusUpNotExpected); } // From OTG state observer @@ -210,7 +189,7 @@ // void CUsbState::AIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AIdleL" ) ); + LOG_FUNC Panic(EAIdleNotExpected); } @@ -220,7 +199,7 @@ // void CUsbState::AHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AHostL" ) ); + LOG_FUNC Panic(EAHostNotExpected); } @@ -230,7 +209,7 @@ // void CUsbState::APeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::APeripheralL" ) ); + LOG_FUNC Panic(EAPeripheralNotExpected); } @@ -240,7 +219,7 @@ // void CUsbState::AVBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AVBusErrorL" ) ); + LOG_FUNC Panic(EAVBusErrorNotExpected); } @@ -250,7 +229,7 @@ // void CUsbState::BIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BIdleL" ) ); + LOG_FUNC Panic(EBIdleNotExpected); } @@ -260,7 +239,7 @@ // void CUsbState::BPeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BPeripheralL" ) ); + LOG_FUNC Panic(EBPeripheralNotExpected); } @@ -270,7 +249,7 @@ // void CUsbState::BHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BHostL" ) ); + LOG_FUNC Panic(EBHostNotExpected); } @@ -281,7 +260,7 @@ // void CUsbState::BusIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusIdleL" ) ); + LOG_FUNC Panic(EBusIdleNotExpected); } @@ -291,7 +270,7 @@ // void CUsbState::BusActiveL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusActiveL" ) ); + LOG_FUNC Panic(EBusActiveNotExpected); } @@ -302,7 +281,7 @@ // void CUsbState::DeviceAttachedL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceAttachedL" ) ); + LOG_FUNC Panic(EDeviceAttachedNotExpected); } @@ -312,7 +291,7 @@ // void CUsbState::DeviceDetachedL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceDetachedL" ) ); + LOG_FUNC Panic(EDeviceDetachedNotExpected); } @@ -322,7 +301,7 @@ // void CUsbState::DriverLoadSuccessL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) ); + LOG_FUNC Panic(EDriverLoadSuccessNotExpected); } @@ -332,7 +311,7 @@ // void CUsbState::DriverLoadPartialSuccessL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadPartialSuccessL" ) ); + LOG_FUNC Panic(EDriverLoadPartialSuccessNotExpected); } @@ -342,7 +321,7 @@ // void CUsbState::DriverLoadFailureL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadFailureL" ) ); + LOG_FUNC Panic(EDriverLoadFailureNotExpected); } @@ -352,7 +331,7 @@ // void CUsbState::BadHubPositionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BadHubPositionL" ) ); + LOG_FUNC Panic(EBadHubPositionNotExpected); } @@ -362,7 +341,7 @@ // void CUsbState::VBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusErrorL" ) ); + LOG_FUNC Panic(EVBusErrorNotExpected); } @@ -372,7 +351,7 @@ // void CUsbState::MessageNotificationReceivedL(TInt) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::MessageNotificationReceivedL" ) ); + LOG_FUNC Panic(EMessageNotificationNotExpected); } @@ -382,7 +361,7 @@ // void CUsbState::SrpReceivedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SrpReceivedL" ) ); + LOG_FUNC Panic(ESrpNotExpected); } @@ -392,6 +371,6 @@ // void CUsbState::SessionRequestedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SessionRequestedL" ) ); + LOG_FUNC Panic(ESessionRequestNotExpected); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostabase.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include #include @@ -22,7 +21,7 @@ #include #include "cusbstatehostabase.h" -#include "cusbstatehosthandle.h" +#include "cusbstatehosthandledropping.h" #include "errors.h" @@ -33,7 +32,7 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostABase::CUsbStateHostABase(CUsbOtgWatcher* aWatcher) : +CUsbStateHostABase::CUsbStateHostABase(CUsbOtgWatcher& aWatcher) : CUsbState(aWatcher) { } @@ -44,7 +43,7 @@ // void CUsbStateHostABase::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::ConstructL" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -53,29 +52,28 @@ // CUsbStateHostABase::~CUsbStateHostABase() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::~CUsbStateHostABase" ) ); - + LOG_FUNC } // From VBus observer // --------------------------------------------------------------------------- -// +// VBus can be dropped by lower leyer in case of a critical problem // --------------------------------------------------------------------------- // void CUsbStateHostABase::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::VBusDownL" ) ); - ChangeHostStateL(EUsbStateHostAIdle); + LOG_FUNC + HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); } // From OTG state observer // --------------------------------------------------------------------------- -// +// // --------------------------------------------------------------------------- // void CUsbStateHostABase::AIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AIdleL" ) ); + LOG_FUNC // do nothing } @@ -83,12 +81,32 @@ // // --------------------------------------------------------------------------- // +void CUsbStateHostABase::AHostL() + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostABase::APeripheralL() + { + LOG_FUNC + ChangeHostStateL( EUsbStateHostAPeripheral); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void CUsbStateHostABase::AVBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AVBusErrorL" ) ); + LOG_FUNC // No need to handle BusClearError error code, due to Bus will be dropped anyway - iWatcher->Usb().BusClearError(); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle); + iWatcher.Usb().BusClearError(); + HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, + EUsbStateHostHandleDropping); } // From bus activity observer @@ -98,7 +116,7 @@ // void CUsbStateHostABase::BusIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BusIdleL" ) ); + LOG_FUNC //do nothing } @@ -108,7 +126,7 @@ // void CUsbStateHostABase::BusActiveL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BusActiveL" ) ); + LOG_FUNC // do nothing } @@ -119,43 +137,21 @@ // void CUsbStateHostABase::MessageNotificationReceivedL(TInt aMessage) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL = %d" ), aMessage)); + LOG_FUNC + LOG1( "aMessage = %d" , aMessage); switch (aMessage) { // OTGDI - case KErrUsbOtgEventQueueOverflow: // = -6670; - case KErrUsbOtgStateQueueOverflow:// = -6671; - case KErrUsbOtgMessageQueueOverflow: // = -6672; - - case KErrUsbOtgBadState:// = -6675; - case KErrUsbOtgStackNotStarted:// = -6680; - //case KErrUsbOtgVbusAlreadyRaised:// = -6681; - //case KErrUsbOtgSrpForbidden:// = -6682; - case KErrUsbOtgHnpNotResponding:// = -6683; - //case KErrUsbOtgHnpBusDrop:// = -6684; - case KErrUsbOtgBusControlProblem:// = -6685; - case KErrUsbOtgVbusPowerUpError:// = -6686; - case KErrUsbOtgHnpEnableProblem:// = -6687; - case KErrUsbOtgVbusError:// = -6690; - case KErrUsbOtgSrpTimeout:// = -6691; - //case KErrUsbOtgSrpActive:// = -6692; - //case KErrUsbOtgSrpNotPermitted:// = -6693; - //case KErrUsbOtgHnpNotPermitted:// = -6694; - //case KErrUsbOtgHnpNotEnabled:// = -6695; - //case KErrUsbOtgHnpNotSuspended:// = -6696; - //case KErrUsbOtgVbusPowerUpNotPermitted:// = -6697; - //case KErrUsbOtgVbusPowerDownNotPermitted:// = -6698; - //case KErrUsbOtgVbusClearErrorNotPermitted:// = -6699; - // hosterrors.h + // hosterrors.h case KErrUsbConfigurationHasNoInterfaces: case KErrUsbInterfaceCountMismatch: case KErrUsbDuplicateInterfaceNumbers: @@ -163,15 +159,15 @@ case KErrUsbDeviceDetachedDuringDriverLoading: case KErrUsbAttachmentFailureGeneralError: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL ErrorInConnection" ) ); - HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + LOG( "ErrorInConnection" ); + HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); break; } - // OTGDI - case KErrUsbOtgPeriphNotSupported: // = -6688 + // OTGDI + case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only - // USBDI + // USBDI case KErrUsbRequestsPending: case KErrUsbBadAddress: case KErrUsbNoAddress: @@ -188,20 +184,22 @@ case KErrUsbBadDescriptorTopology: case KErrUsbDeviceRejected: case KErrUsbDeviceFailed: - case KErrUsbBadDevice: + case KErrUsbBadDevice: // = -6656 case KErrUsbBadHub: case KErrUsbEventOverflow: + case KErrUsbBadDeviceAttached: - // hosterrors.h + // hosterrors.h case KErrUsbUnsupportedDevice: { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL UnsupportedDevice" ) ); - HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle); + LOG( "UnsupportedDevice" ); + HandleL(EUsbWatcherErrUnsupportedDevice, + EUsbStateHostHandleDropping); break; } default: { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL Unhandled message = %d" ), aMessage)); + LOG1( "Unhandled message = %d" , aMessage); break; } @@ -215,8 +213,8 @@ // void CUsbStateHostABase::BadHubPositionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BadHubPositionL" ) ); - HandleL(EUsbWatcherHubsNotSupported, EUsbStateHostHandle); + LOG_FUNC + HandleL(EUsbWatcherHubsNotSupported, EUsbStateHostHandleDropping); } // --------------------------------------------------------------------------- @@ -225,10 +223,28 @@ // void CUsbStateHostABase::VBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::VBusErrorL" ) ); + LOG_FUNC // No error code handling after BusClearError call, due to bus will be dropped anyway - iWatcher->Usb().BusClearError(); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle); + iWatcher.Usb().BusClearError(); + HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, + EUsbStateHostHandleDropping); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostABase::SrpReceivedL() + { + LOG_FUNC + + TInt err = iWatcher.Usb().BusRespondSrp(); + if (KErrNone != err) + { + LOG1( "BusRespondSrp error = %d" , err ); + iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, + EUsbStateHostHandleDropping); + } } // --------------------------------------------------------------------------- @@ -237,22 +253,21 @@ // void CUsbStateHostABase::SessionRequestedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL" ) ); + LOG_FUNC - if (iWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) + if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) { - // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL() VBus is already UP; ignore Session request." ) ); + // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... + LOG( "VBus is already UP; ignore Session request." ); return; } - TInt err = iWatcher->Usb().BusRequest(); + TInt err = iWatcher.Usb().BusRequest(); if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes... { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL BusRequestError err = %d" ), err)); - iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + LOG1( "BusRequestError err = %d" , err); + iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, + EUsbStateHostHandleDropping); return; } - - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL Session started OK (or VBUS already UP) err = %d" ), err)); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostahost.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include #include @@ -22,15 +21,8 @@ #include "cusbstatehostahost.h" #include "cusbnotifmanager.h" -#ifndef STIF -#include "cusbtimer.h" -#else -#include "mockcusbtimer.h" -#endif #include "definitions.h" - #include "errors.h" - #include "debug.h" #include "panic.h" @@ -38,7 +30,7 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher* aWatcher) : +CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher& aWatcher) : CUsbStateHostABase(aWatcher) { } @@ -49,7 +41,7 @@ // void CUsbStateHostAHost::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::ConstructL" ) ); + LOG_FUNC CUsbStateHostABase::ConstructL(); @@ -59,9 +51,9 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher* aWatcher) +CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher& aWatcher) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::NewL" ) ); + LOG_FUNC CUsbStateHostAHost* self = new (ELeave) CUsbStateHostAHost(aWatcher); CleanupStack::PushL(self); @@ -76,7 +68,7 @@ // CUsbStateHostAHost::~CUsbStateHostAHost() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::~CUsbStateHostAHost" ) ); + LOG_FUNC } @@ -86,8 +78,6 @@ // TUsbStateIds CUsbStateHostAHost::Id() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::Id" ) ); - return EUsbStateHostAHost; } @@ -97,13 +87,15 @@ // void CUsbStateHostAHost::JustAdvancedToThisStateL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::JustAdvancedToThisStateL" ) ); - - User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher, - KUsbWatcherIsPeripheralConnected, - KUsbWatcherPeripheralIsConnected ) ); - - iWatcher->PrintStateToLog(); + LOG_FUNC + + // do general things + CUsbStateHostABase::JustAdvancedToThisStateL(); + + User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, + KUsbWatcherIsPeripheralConnected, + KUsbWatcherPeripheralIsConnected)); + } // --------------------------------------------------------------------------- @@ -112,31 +104,14 @@ // void CUsbStateHostAHost::JustBeforeLeavingThisStateL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::JustBeforeLeavingThisStateL" ) ); - - User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher, - KUsbWatcherIsPeripheralConnected, - KUsbWatcherPeripheralIsNotConnected ) ); - } + LOG_FUNC -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostAHost::AHostL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::AHostL" ) ); - // do nothing - } + User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, + KUsbWatcherIsPeripheralConnected, + KUsbWatcherPeripheralIsNotConnected)); -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostAHost::APeripheralL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AHostL" ) ); - ChangeHostStateL(EUsbStateHostAPeripheral); + // do general things + CUsbStateHostABase::JustBeforeLeavingThisStateL(); } // --------------------------------------------------------------------------- @@ -145,8 +120,8 @@ // void CUsbStateHostAHost::DeviceDetachedL(TDeviceEventInformation) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::DeviceDetachedL" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); + LOG_FUNC + ChangeHostStateL( EUsbStateHostAInitiate); } // --------------------------------------------------------------------------- @@ -155,6 +130,6 @@ // void CUsbStateHostAHost::BadHubPositionL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::BadHubPositionL" ) ); - Panic(EBadHubPositionEventNotExpected); + LOG_FUNC + Panic( EBadHubPositionEventNotExpected); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,32 +1,33 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ +#include #include "cusbstatehostainitiate.h" #ifndef STIF +#include "cusbtimer.h" #include "cusbnotifmanager.h" -#include "cusbtimer.h" #else #include "mockcusbnotifmanager.h" #include "mockcusbtimer.h" #endif -#include "definitions.h" +#include "definitions.h" #include "errors.h" + #include "debug.h" #include "panic.h" @@ -34,8 +35,8 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostAInitiate::CUsbStateHostAInitiate(CUsbOtgWatcher* aWatcher) : - CUsbStateHostAInitiateBase(aWatcher) +CUsbStateHostAInitiate::CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher) : + CUsbStateHostABase(aWatcher) { } @@ -45,18 +46,21 @@ // void CUsbStateHostAInitiate::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::ConstructL" ) ); + LOG_FUNC - CUsbStateHostAInitiateBase::ConstructL(); + CUsbStateHostABase::ConstructL(); + + iAttachmentTimer = CUsbTimer::NewL(*this, EDeviceAttachmentTimer); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -CUsbStateHostAInitiate* CUsbStateHostAInitiate::NewL(CUsbOtgWatcher* aWatcher) +CUsbStateHostAInitiate* CUsbStateHostAInitiate::NewL(CUsbOtgWatcher& aWatcher) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::NewL" ) ); + LOG_FUNC CUsbStateHostAInitiate* self = new (ELeave) CUsbStateHostAInitiate( aWatcher); @@ -72,7 +76,9 @@ // CUsbStateHostAInitiate::~CUsbStateHostAInitiate() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::~CUsbStateHostAInitiate" ) ); + LOG_FUNC + + delete iAttachmentTimer; } // --------------------------------------------------------------------------- @@ -81,9 +87,21 @@ // TUsbStateIds CUsbStateHostAInitiate::Id() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::Id" ) ); + return EUsbStateHostAInitiate; + } - return EUsbStateHostAInitiate; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::JustBeforeLeavingThisStateL() + { + LOG_FUNC + + iAttachmentTimer->Cancel(); + + // do general things + CUsbStateHostABase::JustBeforeLeavingThisStateL(); } // --------------------------------------------------------------------------- @@ -92,24 +110,24 @@ // void CUsbStateHostAInitiate::JustAdvancedToThisStateL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL" ) ); + LOG_FUNC - iWatcher->PrintStateToLog(); + // do general things + CUsbStateHostABase::JustAdvancedToThisStateL(); - TInt err = iWatcher->Usb().EnableFunctionDriverLoading(); + TInt err = iWatcher.Usb().EnableFunctionDriverLoading(); if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL EnableFunctionDriverLoading error" ) ); - iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + LOG1( "EnableFunctionDriverLoading err = %d", err ); + iWatcher.HandleHostProblemL(EUsbWatcherCanNotEnableDriverLoading, + EUsbStateHostHandleDropping); return; } - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL EnableFunctionDriverLoading(); = %d" ), err)); - // do BusRequest, if down - if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus()) + if (CUsbVBusObserver::EVBusUp != iWatcher.VBusObserver()->VBus()) { const TUint maxTrial = 3; TInt busReqErr(KErrGeneral); @@ -117,16 +135,17 @@ while (count < maxTrial && KErrNone != busReqErr) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate Calling RUsb::BusRequest()..." ) ); - busReqErr = iWatcher->Usb().BusRequest(); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL BusRequest() = %d" ), err)); + busReqErr = iWatcher.Usb().BusRequest(); + LOG1( "BusRequest() err = %d" , err); if (KErrNone != busReqErr) { - err = iWatcher->Usb().BusClearError(); + err = iWatcher.Usb().BusClearError(); if (KErrNone != err) { - iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + iWatcher.HandleHostProblemL( + EUsbWatcherCanNotClearBusError, + EUsbStateHostHandleDropping); return; } } @@ -134,7 +153,8 @@ } if (KErrNone != busReqErr) { - iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + iWatcher.HandleHostProblemL(EUsbWatcherCanNotRaiseVBus, + EUsbStateHostHandleDropping); return; } } @@ -144,13 +164,127 @@ } +// From TimerObserver +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::TimerElapsedL(TUsbTimerId aTimerId) + { + LOG_FUNC + + switch (aTimerId) + { + case EDeviceAttachmentTimer: + { + LOG("AttachmentTimer" ); + HandleL(EUsbWatcherErrDandlingCable, EUsbStateHostHandleDropping); + break; + } + default: + { + LOG1( "Unknown timer id = %d", aTimerId ); + Panic( EWrongTimerId); + } + } + } + +// From VBus observer +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::VBusUpL() + { + LOG_FUNC + } + +// From Host Event notification observer // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CUsbStateHostAInitiate::JustBeforeLeavingThisStateL() +void CUsbStateHostAInitiate::DeviceAttachedL(TDeviceEventInformation aTdi) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustBeforeLeavingThisStateL" ) ); - - CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL(); + LOG_FUNC + + iAttachmentTimer->Cancel(); + + // check if an OTG device connected + TOtgDescriptor otgDescriptor; + + // ignore all the errors, assume we connected to not otg + TInt err = iWatcher.Usb().GetOtgDescriptor(aTdi.iDeviceId, otgDescriptor); + LOG1("GetOtgDescriptor() err = %d", err ); + + TBool hnpSupported(otgDescriptor.iAttributes & EUsbOtgHNPSupported); + TBool srpSupported(otgDescriptor.iAttributes & EUsbOtgSRPSupported); + + // OTG device supports both hnp and srp + if (hnpSupported && srpSupported) + { + + HandleL(EUsbWatcherConnectedToOTG, EUsbStateHostHandleDropping); + return; + } + + if (KErrNone != aTdi.iError) + { + switch (aTdi.iError) + // error in attachement + { + case KErrBadPower: + { + LOG( "TooMuchPower" ); + HandleL( + EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, + EUsbStateHostDelayNotAttachedHandle); + break; + } + default: + { + LOG1("AttachmentError aTdi.iError = %d" , aTdi.iError ); + HandleL(EUsbWatcherErrUnsupportedDevice, + EUsbStateHostHandleDropping); + break; + } + } + + return; + } } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::DriverLoadSuccessL(TDeviceEventInformation) + { + LOG_FUNC + ChangeHostStateL( EUsbStateHostAHost); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::DriverLoadPartialSuccessL( + TDeviceEventInformation) + { + LOG_FUNC + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning, + EUsbOtgPartiallySupportedDevice, NULL); + ChangeHostStateL( EUsbStateHostAHost); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::DriverLoadFailureL(TDeviceEventInformation aDei) + { + LOG_FUNC + + HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayAttachedHandle); + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,33 +1,24 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include #include "cusbstatehostaperipheral.h" -#ifndef STIF -#include "cusbnotifmanager.h" -#include "cusbtimer.h" -#else -#include "mockcusbnotifmanager.h" -#include "mockcusbtimer.h" -#endif - #include "errors.h" #include "debug.h" #include "panic.h" @@ -36,7 +27,7 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostAPeripheral::CUsbStateHostAPeripheral(CUsbOtgWatcher* aWatcher) : +CUsbStateHostAPeripheral::CUsbStateHostAPeripheral(CUsbOtgWatcher& aWatcher) : CUsbStateHostABase(aWatcher) { } @@ -47,7 +38,7 @@ // void CUsbStateHostAPeripheral::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::ConstructL" ) ); + LOG_FUNC CUsbStateHostABase::ConstructL(); } @@ -57,9 +48,9 @@ // --------------------------------------------------------------------------- // CUsbStateHostAPeripheral* CUsbStateHostAPeripheral::NewL( - CUsbOtgWatcher* aWatcher) + CUsbOtgWatcher& aWatcher) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::NewL" ) ); + LOG_FUNC CUsbStateHostAPeripheral* self = new (ELeave) CUsbStateHostAPeripheral( aWatcher); @@ -75,17 +66,7 @@ // CUsbStateHostAPeripheral::~CUsbStateHostAPeripheral() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::~CUsbStateHostAPeripheral" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostAPeripheral::JustAdvancedToThisStateL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::JustAdvancedToThisStateL" ) ); - iWatcher->PrintStateToLog(); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -94,7 +75,6 @@ // TUsbStateIds CUsbStateHostAPeripheral::Id() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::Id" ) ); return EUsbStateHostAPeripheral; } @@ -106,7 +86,7 @@ // void CUsbStateHostAPeripheral::AHostL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::AHostL" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); + LOG_FUNC + ChangeHostStateL( EUsbStateHostAInitiate); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ + +#include + +#include "cusbstatehostdelayattachedhandle.h" +#ifndef STIF +#include "cusbtimer.h" +#else +#include "mockcusbtimer.h" +#endif + +#include "errors.h" +#include "debug.h" +#include "panic.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayAttachedHandle::CUsbStateHostDelayAttachedHandle( + CUsbOtgWatcher& aWatcher) : + CUsbStateHostDelayHandle(aWatcher) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayAttachedHandle* CUsbStateHostDelayAttachedHandle::NewL( + CUsbOtgWatcher& aWatcher) + { + LOG_FUNC + + CUsbStateHostDelayAttachedHandle* self = + new (ELeave) CUsbStateHostDelayAttachedHandle(aWatcher); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayAttachedHandle::ConstructL() + { + LOG_FUNC + + CUsbStateHostDelayHandle::ConstructL(); + iDriversNotFoundTimer = CUsbTimer::NewL(*this, EDriversNotFoundTimer); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayAttachedHandle::~CUsbStateHostDelayAttachedHandle() + { + LOG_FUNC + + delete iDriversNotFoundTimer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUsbStateIds CUsbStateHostDelayAttachedHandle::Id() + { + return EUsbStateHostDelayAttachedHandle; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayAttachedHandle::JustBeforeLeavingThisStateL() + { + LOG_FUNC + + iDriversNotFoundTimer->Cancel(); + + // do general things + CUsbStateHostDelayHandle::JustBeforeLeavingThisStateL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayAttachedHandle::DoHandleL() + { + LOG_FUNC + LOG1( "iWhat = %d" , iWhat); + + switch (iWhat) + { + case EUsbWatcherErrDriversNotFound: + { + LOG("DriversNotFound" ); + + iDriversNotFoundTimer->After(KTimeDriversNotFound); + break; + + } + + default: + { + LOG1("Unexpected request id = %d" , iWhat ); + Panic( EUnexpectedSituationToHandle); + break; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayAttachedHandle::DeviceDetachedL( + TDeviceEventInformation) + { + LOG_FUNC + + ChangeHostStateL( EUsbStateHostAInitiate); + } + +// From TimerObserver +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayAttachedHandle::TimerElapsedL(TUsbTimerId aTimerId) + { + LOG_FUNC + + switch (aTimerId) + { + case EDriversNotFoundTimer: + { + LOG( "EDriversNotFoundTimer" ); + HandleL(EUsbWatcherErrUnsupportedDevice, + EUsbStateHostHandleDropping); + + break; + } + default: + { + LOG1( "Unknown timer id = %d", aTimerId ); + Panic( EWrongTimerId); + } + } + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,29 +1,21 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - - -#include + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbstatehostdelayhandle.h" -#ifndef STIF -#include "cusbnotifmanager.h" -#else -#include "mockcusbnotifmanager.h" -#endif #include "errors.h" #include "debug.h" @@ -33,7 +25,7 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostDelayHandle::CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher) : +CUsbStateHostDelayHandle::CUsbStateHostDelayHandle(CUsbOtgWatcher& aWatcher) : CUsbStateHostHandle(aWatcher) { } @@ -42,28 +34,11 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostDelayHandle* CUsbStateHostDelayHandle::NewL(CUsbOtgWatcher* aWatcher) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::NewL" ) ); - - CUsbStateHostDelayHandle* self = new (ELeave) CUsbStateHostDelayHandle(aWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbStateHostDelayHandle::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::ConstructL" ) ); + LOG_FUNC - iTooMuchPowerTimer = CUsbTimer::NewL(this, ETooMuchPowerRequiredTimer); - iDriversNotFoundTimer = CUsbTimer::NewL(this, EDriversNotFoundTimer); - + CUsbStateHostHandle::ConstructL(); } // --------------------------------------------------------------------------- @@ -72,84 +47,7 @@ // CUsbStateHostDelayHandle::~CUsbStateHostDelayHandle() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::~CUsbStateHostDelayHandle" ) ); - - delete iTooMuchPowerTimer; - delete iDriversNotFoundTimer; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUsbStateIds CUsbStateHostDelayHandle::Id() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::Id" ) ); - - return EUsbStateHostDelayHandle; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::JustAdvancedToThisStateL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::JustAdvancedToThisStateL" ) ); - // first do something specific to entering this state - // nothing by now, but something in the future - - // then do general things, defined in superclass - CUsbStateHostHandle::JustAdvancedToThisStateL(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::JustBeforeLeavingThisStateL() - { - iTooMuchPowerTimer->Cancel(); - iDriversNotFoundTimer->Cancel(); - - // do general things for error handling - CUsbStateHostHandle::JustBeforeLeavingThisStateL(); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::DoHandleL() - { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DoHandleL iWhat = %d" ), iWhat)); - - switch (iWhat) - { - case EUsbWatcherErrDriversNotFound: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DoHandleL DriversNotFound" ) ); - - iDriversNotFoundTimer->After(KTimeDriversNotFound); - break; - - } - - case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DoHandleL EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" ) ); - - iTooMuchPowerTimer->After(KTimeTooMuchPowerRequired); - break; - } - - default: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DoHandleL Pass request to CUsbStateHostHandle" ) ); - Panic(EUnexpectedSituationToHandle); - break; - } - } + LOG_FUNC } ///////////////////////////////////////////////////////////////////////////////////// @@ -160,42 +58,9 @@ // void CUsbStateHostDelayHandle::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::VBusUpL" ) ); - // this is not expected, due to in this state vbus already up, since entering the state - Panic(EVBusUpNotExpected); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::VBusDownL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::VBusDownL" ) ); - // this is not expected, due to in this state vbus up during all the lifetime - Panic(EVBusDownNotExpected); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::VBusErrorL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::VBusErrorL" ) ); - iWatcher->Usb().BusClearError(); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle); - } - -// --------------------------------------------------------------------------- -// this will drop VBus in a while => -// handle it in another state -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::AVBusErrorL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::AVBusErrorL" ) ); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle); + LOG_FUNC + // this is not expected, due to in this state vbus already up, since entering the state + Panic( EVBusUpNotExpected); } // From Host Event notification observer @@ -206,71 +71,8 @@ void CUsbStateHostDelayHandle::DeviceAttachedL( TDeviceEventInformation aDevEventInfo) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DeviceAttachedL" ) ); - - ChangeHostStateL(EUsbStateHostAInitiate); - iWatcher->DeviceAttachedL(aDevEventInfo); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::DeviceDetachedL(TDeviceEventInformation) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::DeviceDetachedL" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::BadHubPositionL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::BadHubPositionL" ) ); - - HandleL(EUsbWatcherHubsNotSupported, EUsbStateHostHandle); - } - + LOG_FUNC -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::SrpReceivedL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::SrpReceivedL" ) ); - // srp is not expected due to vbus is up in thes state - Panic(ESrpNotExpected); + ChangeHostStateL( EUsbStateHostAInitiate); + iWatcher.DeviceAttachedL(aDevEventInfo); } - -// From TimerObserver -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostDelayHandle::TimerElapsedL(TUsbTimerId aTimerId) - { - switch (aTimerId) - { - case ETooMuchPowerRequiredTimer: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::TimerElapsedL - ETooMuchPowerRequiredTimer" ) ); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle); - break; - } - case EDriversNotFoundTimer: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::TimerElapsedL - EDriversNotFoundTimer" ) ); - HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle); - - break; - } - default: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::TimerElapsedL - Unknown timer" ) ); - Panic(EWrongTimerId); - } - } - } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ + +#include "cusbstatehostdelaynotattachedhandle.h" + +#include "errors.h" +#include "debug.h" +#include "panic.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayNotAttachedHandle::CUsbStateHostDelayNotAttachedHandle( + CUsbOtgWatcher& aWatcher) : + CUsbStateHostDelayHandle(aWatcher) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayNotAttachedHandle* CUsbStateHostDelayNotAttachedHandle::NewL( + CUsbOtgWatcher& aWatcher) + { + LOG_FUNC + + CUsbStateHostDelayNotAttachedHandle* self = + new (ELeave) CUsbStateHostDelayNotAttachedHandle(aWatcher); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::ConstructL() + { + LOG_FUNC + + CUsbStateHostDelayHandle::ConstructL(); + + iTooMuchPowerTimer = CUsbTimer::NewL(*this, ETooMuchPowerRequiredTimer); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostDelayNotAttachedHandle::~CUsbStateHostDelayNotAttachedHandle() + { + LOG_FUNC + + delete iTooMuchPowerTimer; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUsbStateIds CUsbStateHostDelayNotAttachedHandle::Id() + { + return EUsbStateHostDelayNotAttachedHandle; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::JustBeforeLeavingThisStateL() + { + LOG_FUNC + + iTooMuchPowerTimer->Cancel(); + + // do general things + CUsbStateHostDelayHandle::JustBeforeLeavingThisStateL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::DoHandleL() + { + LOG_FUNC + LOG1( "iWhat = %d" , iWhat); + + switch (iWhat) + { + case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration: + { + LOG("EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" ); + + iTooMuchPowerTimer->After(KTimeTooMuchPowerRequired); + break; + } + + default: + { + LOG1("Unexpected request id = %d", iWhat); + Panic( EUnexpectedSituationToHandle); + break; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::AIdleL() + { + LOG_FUNC + + // Exit on AIdle, due to Detachment not comes, + // because no corresponding attachment with err == KErrNone + ChangeHostStateL( EUsbStateHostAInitiate); + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::DeviceDetachedL( + TDeviceEventInformation) + { + LOG_FUNC + Panic( EDeviceDetachedNotExpected); + + } + +// From TimerObserver +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostDelayNotAttachedHandle::TimerElapsedL(TUsbTimerId aTimerId) + { + LOG_FUNC + switch (aTimerId) + { + case ETooMuchPowerRequiredTimer: + { + LOG("ETooMuchPowerRequiredTimer" ); + HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, + EUsbStateHostHandleDropping); + break; + } + default: + { + LOG1("Unknown timer id = %d", aTimerId ); + Panic( EWrongTimerId); + } + } + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,29 +1,21 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - - -#include + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbstatehosthandle.h" -#ifndef STIF -#include "cusbnotifmanager.h" -#else -#include "mockcusbnotifmanager.h" -#endif #include "errors.h" #include "debug.h" @@ -33,8 +25,8 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostHandle::CUsbStateHostHandle(CUsbOtgWatcher* aWatcher) : - CUsbState(aWatcher) +CUsbStateHostHandle::CUsbStateHostHandle(CUsbOtgWatcher& aWatcher) : + CUsbStateHostABase(aWatcher) { } @@ -42,24 +34,12 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostHandle* CUsbStateHostHandle::NewL(CUsbOtgWatcher* aWatcher) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::NewL" ) ); - - CUsbStateHostHandle* self = new (ELeave) CUsbStateHostHandle(aWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbStateHostHandle::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::ConstructL" ) ); + LOG_FUNC + + CUsbStateHostABase::ConstructL(); + } // --------------------------------------------------------------------------- @@ -68,19 +48,7 @@ // CUsbStateHostHandle::~CUsbStateHostHandle() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::~CUsbStateHostHandle" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TUsbStateIds CUsbStateHostHandle::Id() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::Id" ) ); - - return EUsbStateHostHandle; + LOG_FUNC } // --------------------------------------------------------------------------- @@ -89,402 +57,42 @@ // void CUsbStateHostHandle::JustAdvancedToThisStateL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::JustAdvancedToThisStateL" ) ); - iWatcher->PrintStateToLog(); + LOG_FUNC + // first do general things + CUsbStateHostABase::JustAdvancedToThisStateL(); + + // then, do specific things DoHandleL(); + } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CUsbStateHostHandle::JustBeforeLeavingThisStateL() - { - iWatcher->NotifManager()->CloseAllNotifiers(); - } -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbStateHostHandle::SetWhat(TInt aWhat) { iWhat = aWhat; } -// this means only one wait notifier at a time can be shown by this state -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::WaitNotifierCompletedL(TInt /*aFeedback*/) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL" ) ); - switch (iWhat) - { - case EUsbWatcherErrDriversNotFound: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL DriversNotFound" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherHubsNotSupported: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherHubsNotSupported" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherErrDeviceRequiresTooMuchPower: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDeviceRequiresTooMuchPower" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherErrUnsupportedDevice: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrUnsupportedDevice" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherConnectedToOTG: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherConnectedToOTG" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherErrDandlingCable: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDandlingCable" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherNoActivity: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherNoActivity" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherErrorInConnection: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrorInConnection" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - case EUsbWatcherCanNotStartUsbServices: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherCanNotStartUsbServices" ) ); - - break; - } - // errors from observers mapped to one - case EUsbWatcherIdPinError: - case EUsbWatcherVBusObserverError: - case EUsbWatcherHostEventNotificationError: - case EUsbWatcherOtgStateError: - case EUsbWatcherMessageNotificationError: - { - // try to restore - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL Error in observer" ) ); - ChangeHostStateL(EUsbStateHostAInitiate); - break; - } - default: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL Unexpected situation to be handled" ) ); - Panic(EUnexpectedSituationToHandle); - break; - } - - } - } - +// From message notification observer // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CUsbStateHostHandle::DoHandleL() +void CUsbStateHostHandle::MessageNotificationReceivedL(TInt aMessage) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL iWhat = %d" ), iWhat)); - - // Drop VBus first - // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped - iWatcher->Usb().BusDrop(); - - switch (iWhat) - { - - case EUsbWatcherHubsNotSupported: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherHubsNotSupported" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgHubUnsupported, this); - break; - } - case EUsbWatcherErrDeviceRequiresTooMuchPower: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDeviceRequiresTooMuchPower" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgTooMuchPower, this); - break; - } - case EUsbWatcherErrUnsupportedDevice: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrUnsupportedDevice" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgUnsupportedDevice, this); - break; - } - case EUsbWatcherConnectedToOTG: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherConnectedToOTG" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgUnsupportedDevice, this); - - break; - } - case EUsbWatcherErrDandlingCable: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDandlingCable" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgErrorAttachTimedOut, this); - break; - } - case EUsbWatcherNoActivity: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherNoActivity" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgUnsupportedDevice, this); - - break; - } - case EUsbWatcherErrorInConnection: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrorInConnection" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgErrorInConnection, this); - break; - } - case EUsbWatcherCanNotStartUsbServices: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherCanNotStartUsbServices" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgErrorInConnection, this); - break; - } - // errors from observers mapped to one - case EUsbWatcherIdPinError: - case EUsbWatcherVBusObserverError: - case EUsbWatcherHostEventNotificationError: - case EUsbWatcherOtgStateError: - case EUsbWatcherMessageNotificationError: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL Error from observer" ) ); - iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, - EUsbOtgErrorInConnection, this); - break; - } - default: - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL Unexpected situation to be handled" ) ); - Panic(EUnexpectedSituationToHandle); - break; - } - } - } - -///////////////////////////////////////////////////////////////////////////////////// -// From VBus observer -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::VBusUpL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusUpL" ) ); - // as result of BusRespondSrp() VBus might rise up. - // role swap is not supported => drop vbus - // when role swap is supported, leave this function empty - - iWatcher->Usb().BusDrop(); - } - -// --------------------------------------------------------------------------- -// this is expected in the state, for example after calling BusDrop -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::VBusDownL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusDownL" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::VBusErrorL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusErrorL" ) ); - - iWatcher->Usb().BusClearError(); - } - -// From OTG state observer -// --------------------------------------------------------------------------- -// this AIdle means that VBus gets down. From usbwatcher POV no need to change state here -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::AIdleL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::AIdleL" ) ); + LOG_FUNC + LOG1( "Unhandled message aMessage = %d" , aMessage); } // --------------------------------------------------------------------------- -// this means VBus gets up (for example as result RespondSrp()). Do not change state to Host, due to for usbwatcher it would mean -// that device attached and driverls found. -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::AHostL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::AHostL" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::APeripheralL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::APeripheralL" ) ); - - ChangeHostStateL(EUsbStateHostAPeripheral); - - } - -// --------------------------------------------------------------------------- -// ignore any problems on VBus, just clear it -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::AVBusErrorL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::AVBusErrorL" ) ); - iWatcher->Usb().BusClearError(); - } - -// From bus activity observer -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::BusIdleL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusIdleL" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::BusActiveL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusActiveL" ) ); - } - -// From Host Event notification observer -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::DeviceAttachedL( - TDeviceEventInformation aDevEventInfo) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::DeviceDetachedL(TDeviceEventInformation) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceDetachedL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::DriverLoadSuccessL(TDeviceEventInformation) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::DriverLoadPartialSuccessL(TDeviceEventInformation) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadPartialSuccessL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::DriverLoadFailureL(TDeviceEventInformation) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadFailureL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::MessageNotificationReceivedL(TInt) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::MessageNotificationReceivedL" ) ); - - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostHandle::SrpReceivedL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL" ) ); - - TInt err = iWatcher->Usb().BusRespondSrp(); - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL BusRespondSrp()=%d" ), err)); - - if (KErrNone != err) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL BusRespondSrp error" ) ); - iWhat = EUsbWatcherErrorInConnection; - DoHandleL(); - return; - } - } - -// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CUsbStateHostHandle::SessionRequestedL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SessionRequestedL" ) ); - + LOG_FUNC } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ + +#include +#include + +#include "cusbstatehosthandledropping.h" +#ifndef STIF +#include "cusbnotifmanager.h" +#else +#include "mockcusbnotifmanager.h" +#endif + +#include "errors.h" +#include "debug.h" +#include "panic.h" + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostHandleDropping::CUsbStateHostHandleDropping( + CUsbOtgWatcher& aWatcher) : + CUsbStateHostHandle(aWatcher) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostHandleDropping* CUsbStateHostHandleDropping::NewL( + CUsbOtgWatcher& aWatcher) + { + LOG_FUNC + + CUsbStateHostHandleDropping* self = + new (ELeave) CUsbStateHostHandleDropping(aWatcher); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::ConstructL() + { + LOG_FUNC + CUsbStateHostHandle::ConstructL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CUsbStateHostHandleDropping::~CUsbStateHostHandleDropping() + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUsbStateIds CUsbStateHostHandleDropping::Id() + { + return EUsbStateHostHandleDropping; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::JustBeforeLeavingThisStateL() + { + LOG_FUNC + + iWatcher.NotifManager()->CloseAllNotifiers(); + + // do general things + CUsbStateHostHandle::JustBeforeLeavingThisStateL(); + } + +// this means only one wait notifier at a time can be shown by this state +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::WaitNotifierCompletedL(TInt /*aFeedback*/) + { + LOG_FUNC + + switch (iWhat) + { + case EUsbWatcherHubsNotSupported: + { + LOG( "EUsbWatcherHubsNotSupported" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherErrDeviceRequiresTooMuchPower: + { + LOG( "EUsbWatcherErrDeviceRequiresTooMuchPower" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherErrUnsupportedDevice: + { + LOG("EUsbWatcherErrUnsupportedDevice" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherConnectedToOTG: + { + LOG("EUsbWatcherConnectedToOTG" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherErrDandlingCable: + { + LOG("EUsbWatcherErrDandlingCable" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherNoActivity: + { + LOG("EUsbWatcherNoActivity" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + case EUsbWatcherErrorInConnection: + { + LOG( "EUsbWatcherErrorInConnection" ); + ChangeHostStateL( EUsbStateHostAInitiate); + break; + } + + // fatal errors + case EUsbWatcherCanNotStartUsbServices: + { + LOG( "EUsbWatcherCanNotStartUsbServices" ); + + // no break here + } + + // no break statement for following cases + case EUsbWatcherIdPinError: + case EUsbWatcherVBusObserverError: + case EUsbWatcherHostEventNotificationError: + case EUsbWatcherOtgStateError: + case EUsbWatcherMessageNotificationError: + case EUsbWatcherCanNotStartSession: + case EUsbWatcherCanNotEnableDriverLoading: + case EUsbWatcherCanNotClearBusError: + case EUsbWatcherCanNotRaiseVBus: + { + LOG("Fatal error" ); + ChangeHostStateL( EUsbStateHostUndefined); + break; + } + default: + { + LOG1("Unexpected situation to be handled iWhat = %d" , iWhat ); + Panic( EUnexpectedSituationToHandle); + break; + } + + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DoHandleL() + { + LOG_FUNC + + LOG1( "iWhat = %d" , iWhat); + + // Drop VBus first + // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped + iWatcher.Usb().BusDrop(); + + switch (iWhat) + { + + case EUsbWatcherHubsNotSupported: + { + LOG("EUsbWatcherHubsNotSupported" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgHubUnsupported, this); + break; + } + case EUsbWatcherErrDeviceRequiresTooMuchPower: + { + LOG("EUsbWatcherErrDeviceRequiresTooMuchPower" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgTooMuchPower, this); + break; + } + case EUsbWatcherErrUnsupportedDevice: + { + LOG("EUsbWatcherErrUnsupportedDevice" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgUnsupportedDevice, this); + break; + } + case EUsbWatcherConnectedToOTG: + { + LOG("EUsbWatcherConnectedToOTG" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgUnsupportedDevice, this); + + break; + } + case EUsbWatcherErrDandlingCable: + { + LOG( "EUsbWatcherErrDandlingCable" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgErrorAttachTimedOut, this); + break; + } + case EUsbWatcherNoActivity: + { + LOG( "EUsbWatcherNoActivity" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgUnsupportedDevice, this); + + break; + } + case EUsbWatcherErrorInConnection: + { + LOG("EUsbWatcherErrorInConnection" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgErrorInConnection, this); + break; + } + case EUsbWatcherCanNotStartUsbServices: + { + LOG("EUsbWatcherCanNotStartUsbServices" ); + // no break here + } + // no break in following cases + case EUsbWatcherIdPinError: + case EUsbWatcherVBusObserverError: + case EUsbWatcherHostEventNotificationError: + case EUsbWatcherOtgStateError: + case EUsbWatcherMessageNotificationError: + case EUsbWatcherCanNotStartSession: + case EUsbWatcherCanNotEnableDriverLoading: + case EUsbWatcherCanNotClearBusError: + case EUsbWatcherCanNotRaiseVBus: + { + LOG1( "Fatal error iWhat = %d", iWhat ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgErrorInConnection, this); + break; + } + default: + { + LOG1("Unexpected situation to be handled iWhat = %d", iWhat ); + Panic( EUnexpectedSituationToHandle); + break; + } + } + } + +///////////////////////////////////////////////////////////////////////////////////// +// From VBus observer +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::VBusUpL() + { + LOG_FUNC + ChangeHostStateL( EUsbStateHostAInitiate); + } + +// --------------------------------------------------------------------------- +// this is expected in the state, for example after calling BusDrop +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::VBusDownL() + { + LOG_FUNC + } + +// From Host Event notification observer +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DeviceAttachedL( + TDeviceEventInformation aDevEventInfo) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DeviceDetachedL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DriverLoadSuccessL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DriverLoadPartialSuccessL( + TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::DriverLoadFailureL(TDeviceEventInformation) + { + LOG_FUNC + } + +// From message notification observer +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::MessageNotificationReceivedL(TInt aMessage) + { + LOG_FUNC + + LOG1( "aMessage = %d", aMessage ) + + switch (aMessage) + { + // USBDI + case KEventUsbBadDeviceDetached: + { + LOG("BadDeviceDetached" ); + ChangeHostStateL( EUsbStateHostUndefined); + break; + } + default: + { + LOG1( "Unhandled message aMessage = %d" , aMessage); + break; + } + + } + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,28 +1,22 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbstatehostundefined.h" -#ifndef STIF - -#else - -#endif - #include "definitions.h" #include "errors.h" @@ -33,8 +27,7 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostUndefined::CUsbStateHostUndefined( - CUsbOtgWatcher* aWatcher) : +CUsbStateHostUndefined::CUsbStateHostUndefined(CUsbOtgWatcher& aWatcher) : CUsbStateHostABase(aWatcher) { } @@ -43,24 +36,25 @@ // // --------------------------------------------------------------------------- // -CUsbStateHostUndefined* CUsbStateHostUndefined::NewL(CUsbOtgWatcher* aWatcher) - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::NewL" ) ); +CUsbStateHostUndefined* CUsbStateHostUndefined::NewL(CUsbOtgWatcher& aWatcher) + { + LOG_FUNC - CUsbStateHostUndefined* self = new (ELeave) CUsbStateHostUndefined(aWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - + CUsbStateHostUndefined* self = new (ELeave) CUsbStateHostUndefined( + aWatcher); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CUsbStateHostUndefined::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::ConstructL" ) ); + LOG_FUNC CUsbStateHostABase::ConstructL(); @@ -72,8 +66,7 @@ // CUsbStateHostUndefined::~CUsbStateHostUndefined() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostundefined::~CUsbStateHostUndefined" ) ); - + LOG_FUNC } // --------------------------------------------------------------------------- @@ -85,26 +78,6 @@ return EUsbStateHostUndefined; } -///////////////////////////////////////////////////////////////////////////////////// -// From IdPin observer -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostUndefined::IdPinOffL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::IdPinOffL" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CUsbStateHostUndefined::IdPinOnL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::IdPinOnL" ) ); - } - // From VBus observer // --------------------------------------------------------------------------- // @@ -112,7 +85,7 @@ // void CUsbStateHostUndefined::VBusDownL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusDownL" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -121,7 +94,7 @@ // void CUsbStateHostUndefined::VBusUpL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusUpL" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -130,9 +103,8 @@ // void CUsbStateHostUndefined::VBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusErrorL" ) ); - iWatcher->Usb().BusClearError(); - HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + LOG_FUNC + iWatcher.Usb().BusClearError(); } // From OTG state observer @@ -140,20 +112,10 @@ // // --------------------------------------------------------------------------- // -void CUsbStateHostUndefined::AIdleL() - { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::AIdleL" ) ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// void CUsbStateHostUndefined::AVBusErrorL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::AVBusErrorL" ) ); - iWatcher->Usb().BusClearError(); - HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle); + LOG_FUNC + iWatcher.Usb().BusClearError(); } // --------------------------------------------------------------------------- @@ -162,7 +124,7 @@ // void CUsbStateHostUndefined::BIdleL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::BIdleL" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -171,11 +133,50 @@ // void CUsbStateHostUndefined::BPeripheralL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::BPeripheralL" ) ); + LOG_FUNC } // From host state observer void CUsbStateHostUndefined::DeviceDetachedL(TDeviceEventInformation /*aInfo*/) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::DeviceDetachedL" ) ); + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::SrpReceivedL() + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::SessionRequestedL() + { + LOG_FUNC } + +// From message notification observer +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::MessageNotificationReceivedL(TInt aMessage) + { + LOG_FUNC + LOG1( "Unhandled message aMessage = %d" , aMessage); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::BadHubPositionL() + { + LOG_FUNC + Panic( EBadHubPositionNotExpected); + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbtimer.cpp --- a/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include "cusbtimer.h" @@ -24,7 +23,7 @@ // // --------------------------------------------------------------------------- // -CUsbTimer::CUsbTimer(MUsbTimerObserver* aObserver, TUsbTimerId aTimerId) : +CUsbTimer::CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) : CActive(CActive::EPriorityStandard), iObserver(aObserver), iTimerId( aTimerId) { @@ -37,7 +36,7 @@ // CUsbTimer::~CUsbTimer() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::~CUsbTimer" ) ); + LOG_FUNC Cancel(); iTimer.Close(); } @@ -48,7 +47,7 @@ // void CUsbTimer::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iTimer.CreateLocal()); } @@ -56,12 +55,11 @@ // // --------------------------------------------------------------------------- // -CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver* anObserver, - TUsbTimerId aTimerId) +CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::NewL" ) ); + LOG_FUNC - CUsbTimer* self = new (ELeave) CUsbTimer(anObserver, aTimerId); + CUsbTimer* self = new (ELeave) CUsbTimer(aObserver, aTimerId); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); // pop self @@ -74,9 +72,7 @@ // void CUsbTimer::After(TInt aMilliseconds) { -// FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::After aMilliseconds %d, timerId=%d" ), aMilliseconds, iTimerId)) - - if (IsActive()) + if (IsActive()) { Cancel(); } @@ -93,13 +89,12 @@ void CUsbTimer::RunL() { - if(KErrNone != iStatus.Int()) + if (KErrNone != iStatus.Int()) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::RunL iStatus %d" ), iStatus.Int())); User::Leave(iStatus.Int()); } - iObserver->TimerElapsedL(iTimerId); + iObserver.TimerElapsedL(iTimerId); } // --------------------------------------------------------------------------- @@ -108,7 +103,8 @@ // TInt CUsbTimer::RunError(TInt aError) { - FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::RunError aError %d" ), aError )); + LOG_FUNC + LOG1( "aError = %d" , aError ); return KErrNone; } @@ -119,6 +115,5 @@ // void CUsbTimer::DoCancel() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::DoCancel" ) ) iTimer.Cancel(); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbvbusobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation + * + */ #include @@ -40,8 +39,7 @@ // void CUsbVBusObserver::ConstructL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::ConstructL" ) ); + LOG_FUNC User::LeaveIfError(iVBus.Attach(KUidUsbManCategory, KUsbOtgVBusPoweredProperty)); @@ -54,8 +52,7 @@ // CUsbVBusObserver* CUsbVBusObserver::NewL() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::NewL" ) ); + LOG_FUNC CUsbVBusObserver* self = new (ELeave) CUsbVBusObserver(); CleanupStack::PushL(self); @@ -70,8 +67,7 @@ // CUsbVBusObserver::~CUsbVBusObserver() { - - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::~CUsbVBusObserver" ) ); + LOG_FUNC Cancel(); @@ -88,20 +84,16 @@ CUsbVBusObserver::TState CUsbVBusObserver::VBus() /* not const, because for some reason RProperty::Get is not const */ { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus" ) ); - TInt val(0); TInt err = iVBus.Get(val); if (KErrNone != err) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus CanNotGetVBusProperty" ) ); - Panic(ECanNotGetVBusProperty); + LOG("CanNotGetVBusProperty" ) + Panic( ECanNotGetVBusProperty); } - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus = %d" ), val )); - return (0 == val ? EVBusDown : EVBusUp); } @@ -111,18 +103,18 @@ // void CUsbVBusObserver::SubscribeL(MUsbVBusObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL" ) ); - + LOG_FUNC + // check if the same observer already exist in a list - if(KErrNotFound != iObservers.Find(&aObserver)) + if (KErrNotFound != iObservers.Find(&aObserver)) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL Observer already exists." ) ); - Panic(EObserverAlreadyExists); + LOG( "Observer already exists" ); + Panic( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); - + if (KFirst == iObservers.Count()) // first item { iVBus.Subscribe(iStatus); @@ -136,18 +128,18 @@ // void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver& aObserver) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL" ) ); - + LOG_FUNC + TInt i(iObservers.Find(&aObserver)); - if(KErrNotFound == i) + if (KErrNotFound == i) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL Observer not found." ) ); - Panic(ECanNotFindVBusObserver); + LOG("Observer not found" ); + Panic( ECanNotFindVBusObserver); return; } - + iObservers.Remove(i); - + if (0 == iObservers.Count()) // no observers anymore { // cancel pending request, if any @@ -161,17 +153,19 @@ // void CUsbVBusObserver::RunL() { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL iStatus = %d" ), iStatus.Int())); + LOG_FUNC + + LOG1( "iStatus = %d" , iStatus.Int()); - // if error occured, tell to Observers - if(KErrNone != iStatus.Int()) + // if error occured, tell to Observers + if (KErrNone != iStatus.Int()) + { + for (TInt i(0); i < iObservers.Count(); ++i) { - for (TInt i(0); i < iObservers.Count(); ++i) - { - iObservers[i]->VBusObserverErrorL(iStatus.Int()); - } - return; + iObservers[i]->VBusObserverErrorL(iStatus.Int()); } + return; + } // re-issue request first iVBus.Subscribe(iStatus); @@ -185,7 +179,7 @@ { case EVBusUp: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL VBus UP")); + LOG("VBus UP"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -197,7 +191,7 @@ case EVBusDown: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL VBus DOWN")); + LOG("VBus DOWN"); for (TInt i(0); i < iObservers.Count(); ++i) { @@ -209,8 +203,8 @@ default: { - FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL WrongVBusState")); - Panic(EWrongVBusState); + LOG("WrongVBusState"); + Panic( EWrongVBusState); } } @@ -231,8 +225,9 @@ // TInt CUsbVBusObserver::RunError(TInt aError) { + LOG_FUNC - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunError aError = %d" ), aError)); + LOG1( "aError = %d" , aError); // try to continue return KErrNone; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Usb waiting notifier implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Usb waiting notifier implementation + * + */ #include #include @@ -32,9 +31,9 @@ // ----------------------------------------------------------------------------- // CUsbWaitNotifier* CUsbWaitNotifier::NewL(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId) + CUsbNotifManager& aNotifManager, TUint aNotifId) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::NewL" ) ); + LOG_FUNC CUsbWaitNotifier* self = new (ELeave) CUsbWaitNotifier(aNotifier, aNotifManager, aNotifId); @@ -50,7 +49,7 @@ // CUsbWaitNotifier::~CUsbWaitNotifier() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::~CUsbWaitNotifier" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -58,7 +57,7 @@ // --------------------------------------------------------------------------- // CUsbWaitNotifier::CUsbWaitNotifier(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId) : + CUsbNotifManager& aNotifManager, TUint aNotifId) : CUsbNoteNotifier(aNotifier, aNotifManager, KUsbUiNotifOtgError, aNotifId) { SetFeedbackNeeded(); @@ -70,7 +69,7 @@ // void CUsbWaitNotifier::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::ConstructL" ) ); + LOG_FUNC CUsbNoteNotifier::ConstructL(); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Usb warning notifier implementation + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * -*/ - + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Usb warning notifier implementation + * + */ #include #include @@ -34,9 +33,11 @@ // ----------------------------------------------------------------------------- // CUsbWarningNotifier* CUsbWarningNotifier::NewL(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId) + CUsbNotifManager& aNotifManager, TUint aNotifId) { - FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbWarningNotifier::NewL aNotifId = %d" ), aNotifId)); + LOG_FUNC + + LOG1( "aNotifId = %d" , aNotifId); CUsbWarningNotifier* self = new (ELeave) CUsbWarningNotifier(aNotifier, aNotifManager, aNotifId); @@ -52,7 +53,7 @@ // CUsbWarningNotifier::~CUsbWarningNotifier() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::~CUsbWarningNotifier" ) ); + LOG_FUNC } // --------------------------------------------------------------------------- @@ -60,11 +61,10 @@ // --------------------------------------------------------------------------- // CUsbWarningNotifier::CUsbWarningNotifier(RNotifier& aNotifier, - CUsbNotifManager* aNotifManager, TUint aNotifId) : + CUsbNotifManager& aNotifManager, TUint aNotifId) : CUsbNoteNotifier(aNotifier, aNotifManager, KUsbUiNotifOtgWarning, aNotifId) { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::CUsbWarningNotifier" ) ); } // ----------------------------------------------------------------------------- @@ -73,7 +73,7 @@ // void CUsbWarningNotifier::ConstructL() { - FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::ConstructL" ) ); + LOG_FUNC CUsbNoteNotifier::ConstructL(); } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbotgwatcher/src/panic.cpp --- a/usbengines/usbotgwatcher/src/panic.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbotgwatcher/src/panic.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,26 +1,25 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Central place for debug-type macros & functions -* -*/ - + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Central place for debug-type macros & functions + * + */ #include "panic.h" void Panic(TUsbWatcherPanic aCategory) -{ + { #ifdef _DEBUG - User::Panic(KUsbWatcherPanic, aCategory); + User::Panic(KUsbWatcherPanic, aCategory); #endif -} + } diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbwatcher/group/bld.inf --- a/usbengines/usbwatcher/group/bld.inf Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbwatcher/group/bld.inf Fri Mar 12 15:48:40 2010 +0200 @@ -47,4 +47,8 @@ ../rom/mtp_symbian_temp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_symbian_temp.iby) +// usbacmconfiguration.hby is included by usbacm.iby to define ACM configuration +// We use this one to overwrite the os default one +../rom/usbacmconfiguration.hby CORE_MW_LAYER_IBY_EXPORT_PATH(usbacmconfiguration.hby) + // End of file diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h --- a/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Fri Mar 12 15:48:40 2010 +0200 @@ -212,6 +212,11 @@ TPtrC8 iDummy; /** + * Dummy descriptor buf + */ + TBuf8<1> iDummyBuf; + + /** * Buffer where selected personality is stored by the ask * on connection. */ @@ -252,6 +257,11 @@ */ TUsbActivePersonalityState iState; + /** + * Cleanup process or normal process in various states + */ + TBool isFailureCleanup; + /** * Request to be completed. */ @@ -271,6 +281,11 @@ * The device state. */ TUsbDeviceState iDeviceState; + + /** + * Packages for queries + */ + TUSBQueriesNotifierParamsPckg iQueryParams; }; #endif // CUSBACTIVEPERSONALITYHANDLER_H diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbwatcher/rom/usbacmconfiguration.hby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbwatcher/rom/usbacmconfiguration.hby Fri Mar 12 15:48:40 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Configuration for ACM functions +* +*/ + +#ifndef USBACMCONFIGURATION_HBY +#define USBACMCONFIGURATION_HBY + +#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS 2 + +// USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM[X] is referring to the Xth ACM *function* +// which is accessed by the (X-1)th ACM *port* + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1 1 +//0x01 - code taken from USBCDC 1.1 Table 17- Hayes compatible modem + +#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2 255 +//0xFF - Vendor-specific + +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3 1 +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4 1 +//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5 1 + +// To enable an ACM function, you need to change the +// value of USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS, +// uncomment one define line then replace the protocol number with +// the ACM protocol number expected. +// + +#endif // USBACMCONFIGURATION_HBY diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp --- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -26,6 +26,7 @@ #include //for global system state #include "cusbactivepersonalityhandler.h" #include "cusbglobalsystemstateobserver.h" +#include // CONSTANTS // const TInt KSerialNumberLength = 12; @@ -44,6 +45,7 @@ : CActive( EPriorityStandard ) , iUsbMan( aUsbMan ) , iOwner( aOwner ) + , isFailureCleanup( EFalse ) { CActiveScheduler::Add( this ); } @@ -221,6 +223,7 @@ LOG( "PersonalityHandler created" ); iCurrentPersonalityHandler->PreparePersonalityStart( iStatus ); iState = EUsbPersonalityPrepareStart; + isFailureCleanup = EFalse; SetActive(); } else @@ -242,7 +245,8 @@ iRequestStatus = &aStatus; iState = EUsbPersonalityPrepareStop; - + isFailureCleanup = EFalse; + // prepare current personality for stop and return if( iCurrentPersonalityHandler ) { @@ -284,6 +288,11 @@ } break; } + case EUsbDeviceStateUndefined: + { + iPersonalityNotifier->CancelQuery(KQueriesNotifier); + break; + } default: // We do not handle other state here LOG( "DeviceStatechange ignored by ActivePersonalityhandler or EUsbDeviceStateConfigured" ); @@ -302,9 +311,45 @@ // outstanding request. We must not come here. // ---------------------------------------------------------------------------- // -TInt CUsbActivePersonalityHandler::RunError( TInt /*aError*/ ) +TInt CUsbActivePersonalityHandler::RunError( TInt aError ) { LOG_FUNC + + LOG2("Returned error: %d, iState: %d", aError, iState); + + if (KErrNoMemory == aError) + { + iQueryParams().iQuery = EUSBNotEnoughRam; + iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier, + iQueryParams, iDummyBuf); + } + + //only handle error when TryStart fails now + //clean up work to be done in the personality + if (iState == EUsbPersonalityStartUsb) + { + iState = EUsbPersonalityPrepareStop; + isFailureCleanup = ETrue; + + // prepare current personality for stop and return + if( iCurrentPersonalityHandler ) + { + LOG( "Call PersonalityPlugin to prepare stop" ); + iCurrentPersonalityHandler->PreparePersonalityStop( iStatus ); + SetActive(); + } + else + { + LOG( "No current PersonalityPlugin" ); + } + + //complete StartPersonality with aError + User::RequestComplete( iRequestStatus, aError ); + } + else + { + LOG( "Ignore error in other states" ); + } return KErrNone; } @@ -318,10 +363,8 @@ LOG_FUNC TInt ret = iStatus.Int(); - if( KErrNone != ret ) - { - LOG1( "ERROR: CUsbActivePersonalityHandler::RunL iStatus = %d", ret ); - } + + LOG2( "CUsbActivePersonalityHandler::RunL iStatus = %d, iState = %d", ret, iState ); switch( iState ) { @@ -340,6 +383,7 @@ break; case EUsbPersonalityStartUsb: + LEAVEIFERROR( ret ); LOG( "EUsbPersonalityStartUsb" ); iState = EUsbPersonalityFinishStart; if( iCurrentPersonalityHandler ) @@ -396,8 +440,12 @@ iPersonalityParams->PersonalityNotifier().CancelQuery( KCableConnectedNotifierUid ); } - User::RequestComplete( iRequestStatus, ret ); - + //the request should be completed with error code in RunError if failed + if ( !isFailureCleanup ) + { + User::RequestComplete( iRequestStatus, ret ); + } + iState = EUsbPersonalityIdle; break; diff -r 7068aba64af5 -r a15c582fbf97 usbengines/usbwatcher/src/cusbwatcher.cpp --- a/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -387,11 +387,13 @@ case EUsbStarting: LOG( "Personality started" ); Notify( ret ); - iState = EUsbStarted; if( iStopStartScenario ) { iStopStartScenario = EFalse; } + //check if StartPersonality() fails + LEAVEIFERROR( ret ); + iState = EUsbStarted; break; case EUsbStopping: @@ -453,10 +455,21 @@ // This method is not called cause RunL() never leaves. // ---------------------------------------------------------------------------- // -TInt CUsbWatcher::RunError(TInt /*aError*/) +TInt CUsbWatcher::RunError(TInt aError) { LOG_FUNC - // Left empty cause this can't happend + + LOG2("Returned error: %d, iState: %d", aError, iState); + if ( iState == EUsbStarting ) + { + RProperty::Set( KPSUidUsbWatcher, + KUsbWatcherSelectedPersonality, + KUsbWatcherSelectedPersonalityNone ); + LOG( "personality set to none" ); + + iState = EUsbIdle; + } + return KErrNone; } diff -r 7068aba64af5 -r a15c582fbf97 usbservices_plat/usb_notifier_api/inc/usbuinotif.h --- a/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Mar 12 15:48:40 2010 +0200 @@ -63,7 +63,8 @@ EUSBPossibleDataLossCable, EUSBPossibleDataLossMMC, EUSBChangeFromMassStorage, - EUSBNoMemoryCard + EUSBNoMemoryCard, + EUSBNotEnoughRam }; /** diff -r 7068aba64af5 -r a15c582fbf97 usbuis/group/bld.inf --- a/usbuis/group/bld.inf Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/group/bld.inf Fri Mar 12 15:48:40 2010 +0200 @@ -19,5 +19,4 @@ #include "../usbui/group/bld.inf" #include "../usbuinotif/group/bld.inf" #include "../imageprintuiprovider/group/bld.inf" -#include "../imageprintui/group/bld.inf" -#include "../rndisui/group/bld.inf" \ No newline at end of file +#include "../imageprintui/group/bld.inf" \ No newline at end of file diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf --- a/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Mar 12 15:48:40 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: ?Description +* Description: * */ diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h --- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Mar 12 15:48:40 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: ?Description +* Description: * */ diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl --- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -11,10 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ + #include NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini --- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" +# under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini --- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" +# under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp --- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: ?Description +* Description: * */ diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp --- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: ?Description +* Description: * */ diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/data/usbuinotif.rss --- a/usbuis/usbuinotif/data/usbuinotif.rss Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/data/usbuinotif.rss Fri Mar 12 15:48:40 2010 +0200 @@ -244,8 +244,8 @@ RESOURCE TBUF r_usb_otg_error_unrecoverable { buf = qtn_usb_otg_error_unrecoverable; } -RESOURCE TBUF r_usb_otg_warning_partial_supported { - buf = qtn_usb_otg_warning_partial_supported; } +RESOURCE TBUF r_usb_otg_warning_partial_support { + buf = qtn_usb_otg_warning_partial_support; } RESOURCE TBUF r_usb_no_memory_card { buf = qtn_usb_mode_query_no_memory_card; } @@ -262,4 +262,7 @@ RESOURCE TBUF r_usb_msmm_error_out_of_memory { buf = qtn_memlo_not_enough_memory; } +RESOURCE TBUF r_usb_error_memory_not_enough { + buf = qtn_usb_error_memory_not_enough; } + // End of File diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h --- a/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Fri Mar 12 15:48:40 2010 +0200 @@ -106,7 +106,7 @@ * @return KErrNone - accepted, KErrCancel - Cancel or End call key */ TInt QueryUserResponseL(const TDesC& aStringHolder, TInt aCoverDialogId, - TBool aIsCancelKey); + TBool aIsCancelKey, TBool aIsErrorQuery); /** * Get attributes for the query dialog @@ -117,7 +117,7 @@ * @param aIsCancelKey Returned info about showing the Cancel key. * @return The string holder for the query. */ - HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey); + HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey, TBool& aIsErrorQuery); private: // Data diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/loc/usbuinotif.loc --- a/usbuis/usbuinotif/loc/usbuinotif.loc Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/loc/usbuinotif.loc Fri Mar 12 15:48:40 2010 +0200 @@ -139,6 +139,11 @@ // #define qtn_usb_otg_general_mass_storage_error "General Mass storage error" +//d: Memory not enough or full error +//l: popup_note_window +//r: 5.2 +#define qtn_usb_error_memory_not_enough "Memory full. Close some applications and try to connect USB cable again" + // End of USB_OTG // End of File diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/src/usbuinotifotgerror.cpp --- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -108,22 +108,29 @@ { User::Leave( KErrInUse ); } - - iMessage = aMessage; - iNeedToCompleteMessage = ETrue; - iReplySlot = aReplySlot; - + // Get parameters // - iErrorId = 0; + TPckgC pckg( iErrorId ); pckg.Set( aBuffer ); iErrorId = pckg(); - + + FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), iErrorId )); + if ( iErrorId < 0 || iErrorId >= iStringIds.Count() ) + { + User::Leave( KErrArgument); + } + + iMessage = aMessage; + iNeedToCompleteMessage = ETrue; + iReplySlot = aReplySlot; + SetActive(); iStatus = KRequestPending; TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); + User::RequestComplete( stat, KErrNone ); + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL() completed")); } diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/src/usbuinotifotgwarning.cpp --- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -73,7 +73,7 @@ void CUsbUiNotifOtgWarning::ConstructL() { CUSBUINotifierBase::ConstructL(); - iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORTED); + iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORT); } // ---------------------------------------------------------------------------- @@ -125,16 +125,22 @@ User::Leave( KErrInUse ); } - iMessage = aMessage; - iNeedToCompleteMessage = ETrue; - iReplySlot = aReplySlot; - // Get parameters // TPckgC pckg( iNoteId ); pckg.Set( aBuffer ); iNoteId = pckg(); - + + FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL iNoteId: %d"), iNoteId )); + if ( iNoteId < 0 || iNoteId >= iStringIds.Count() ) + { + User::Leave( KErrArgument); + } + + iMessage = aMessage; + iNeedToCompleteMessage = ETrue; + iReplySlot = aReplySlot; + SetActive(); iStatus = KRequestPending; TRequestStatus* stat = &iStatus; diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp --- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -163,13 +163,14 @@ FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RunL")); TBool isCancelKey = EFalse; + TBool isErrorQuery = EFalse; TInt returnValue = KErrNone; // for cover display support TInt coverDialogId = EUSBCoverInvalidDialogId; // Choose text and other query attributes // - HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey ); + HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey, isErrorQuery ); //check if query text string loading was successful if (NULL != stringHolder) @@ -177,7 +178,7 @@ DisableKeylock(); SuppressAppSwitching( ETrue ); returnValue = QueryUserResponseL( *stringHolder, coverDialogId, - isCancelKey ); + isCancelKey, isErrorQuery ); SuppressAppSwitching( EFalse ); RestoreKeylock(); CleanupStack::PopAndDestroy( stringHolder ); @@ -219,7 +220,7 @@ // ---------------------------------------------------------------------------- // TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder, - TInt aCoverDialogId, TBool aIsCancelKey) + TInt aCoverDialogId, TBool aIsCancelKey, TBool aIsErrorQuery) { FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL")); TInt returnValue = KErrNone; @@ -228,7 +229,13 @@ // Show dialog with or without the Cancel // - if (aIsCancelKey) + if (aIsErrorQuery) + { + // aIsErrorQuery flag is set in GetQueryAttributesLC() + // there is no defined QueryDialogError in resources so QueryOTGerror is used (contains Stop icon) + iUSBQueryDlg->PrepareLC( R_USB_QUERY_OTG_ERROR ); + } + else if (aIsCancelKey) { iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITH_CANCEL ); } @@ -270,11 +277,12 @@ // ---------------------------------------------------------------------------- // HBufC* CUSBUIQueriesNotifier::GetQueryAttributesLC(TInt& aCoverDialogId, - TBool& aIsCancelKey) + TBool& aIsCancelKey, TBool& aIsErrorQuery) { FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC")); HBufC* stringHolder = NULL; // The text for the query aIsCancelKey = EFalse; + aIsErrorQuery = EFalse; switch (iQueryType) { case EUSBStorageMediaFailure: @@ -299,6 +307,15 @@ stringHolder = StringLoader::LoadLC( R_USB_NO_MEMORY_CARD ); aCoverDialogId = EUSBCoverNoMemoryCard; break; + } + case EUSBNotEnoughRam: + { + FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNotEnoughRam")); + stringHolder = StringLoader::LoadLC( R_USB_ERROR_MEMORY_NOT_ENOUGH ); + aCoverDialogId = EUSBCoverNoMemoryCard; + //set flag to change the icon of querydialog (see QueryUserResponseL()) + aIsErrorQuery = ETrue; + break; } default: { diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ @rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available -@rem under the terms of the License "Eclipse Public License v1.0" +@rem under the terms of "Eclipse Public License v1.0" @rem which accompanies this distribution, and is available @rem at the URL "http://www.eclipse.org/legal/epl-v10.html". @rem diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ @rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available -@rem under the terms of the License "Eclipse Public License v1.0" +@rem under the terms of "Eclipse Public License v1.0" @rem which accompanies this distribution, and is available @rem at the URL "http://www.eclipse.org/legal/epl-v10.html". @rem diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ ; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). ; All rights reserved. ; This component and the accompanying materials are made available -; under the terms of the License "Eclipse Public License v1.0" +; under the terms of "Eclipse Public License v1.0" ; which accompanies this distribution, and is available ; at the URL "http://www.eclipse.org/legal/epl-v10.html". ; diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ ; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). ; All rights reserved. ; This component and the accompanying materials are made available -; under the terms of the License "Eclipse Public License v1.0" +; under the terms of "Eclipse Public License v1.0" ; which accompanies this distribution, and is available ; at the URL "http://www.eclipse.org/legal/epl-v10.html". ; diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" +# under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" +# under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 7068aba64af5 -r a15c582fbf97 usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Feb 19 23:50:33 2010 +0200 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Mar 12 15:48:40 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". *