--- a/layers.sysdef.xml Fri Apr 23 23:42:54 2010 +0300
+++ b/layers.sysdef.xml Fri Apr 23 23:57:55 2010 +0300
@@ -9,8 +9,11 @@
<module name="usbservices">
<unit unitID="lcdo.usbservices" mrp="" bldFile="&layer_real_source_path;/group" name="usbservices" />
</module>
- <module name="">
+ <module name="non_sf_components">
<unit unitID="lcdo.usbservices.usbclasses.usbosdescriptorhandler" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbosdescriptorhandler/group" filter="!sf_build" name="usbservices_usbclasses_usbosdescriptorhandler" />
+ <unit unitID="lcdo.usbservices.usbclasses.msmmplugin" mrp="" bldFile="&layer_real_source_path;/usbclasses/msmmplugin/group" filter="!sf_build" name="usbservices_usbclasses_msmmplugin" />
+ <unit unitID="lcdo.usbservices.usbclasses.usbhidclassdriver" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbhidclassdriver/group" filter="!sf_build" name="usbservices_usbclasses_usbhidclassdriver" />
+ <unit unitID="lcdo.usbservices.usbuis.rndisui" mrp="" bldFile="&layer_real_source_path;/usbuis/rndisui/group" filter="!sf_build" name="usbservices_usbuis_rndisui" />
</module>
<module name="usbuiqt">
<unit unitID="lcdo.usbservices.usbclasses.usbuiqt" mrp="" bldFile="&layer_real_source_path;/usbuis/usbuiqt" name="usbservices_usbuis_usbapplication" proFile="usbapplication.pro" qmakeArgs="" />
--- a/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Fri Apr 23 23:57:55 2010 +0300
@@ -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;
--- a/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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);
--- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbBusActivityObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbHostEventNotificationObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbIdPinObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Fri Apr 23 23:57:55 2010 +0300
@@ -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 <AknNotifyStd.h> // SAknSmallIndicatorParams
#include <AknNotifySignature.h> // SAknNotifierPackage
#include <avkon.hrh> // 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.
--- a/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbMessageNotificationObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<TInt> iRes;
+
+ /**
+ * Notifier id pckg buffer
+ */
+ TPckgBuf<TInt> 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
--- a/usbengines/usbotgwatcher/inc/cusbnotifier.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbnotifier.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbOtgStateObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbOtgWatcherStateObserver> iOtgStateObservers;
+
+ /**
+ * The observer reports state changes to its own observers
+ * Not Own
+ */
+ CUsbServiceControl::TUsbServiceRequest iUsbServiceRequest;
};
#endif // C_USBOTGWATCHER_H
--- a/usbengines/usbotgwatcher/inc/cusbpersonalityswitch.h Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* 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: Personality switch function.
- *
-*/
-
-#ifndef C_USBPERSONALITYSWITCH_H
-#define C_USBPERSONALITYSWITCH_H
-
-#include <e32base.h>
-#include <d32usbdi.h>
-
-const TInt KGetAllPersonalitiesReq = 0x82;
-const TInt KSetPersonalityReq = 0x89;
-
-const TInt KNumOfPersShift = 3;
-const TInt KCurrPersShift = 2;
-const TInt KFirstPersonalityIdShift = 4;
-const TInt KLenghtOfPersonalityData = 2;
-
-class MUsbPersonalitySwitchObserver
- {
-public:
- enum TState
- {
- EIdle = 0,
- ERequestingAllPersonalities,
- ERequestingSetPersonality,
- EGetAllPersonalitiesCompleted,
- ESetPersonalityCompleted,
- ERequestCancelled,
- ERequestFailed
- };
-public:
- virtual void UsbPersonalitySwitchStateChangedL(TState aState, TInt aData) = 0;
- };
-
-/* *
- * Reads personalities, if possible, switches peripheral to mass storage.
- * It is assumed that USB is started already
- */
-NONSHARABLE_CLASS(CUsbPersonalitySwitch) : public CActive
- {
- enum TState
- {
- EIdle = 0,
- EGetAllPersonalities,
- ESetPersonality /*,
- EGetAllPersResult,
- EGetSetPersResult*/
- };
-
-public:
-
- /**
- * Two-phased constructor
- *
- * @param aObserver will get call back
- * @param aTimerId timer id
- */
- static CUsbPersonalitySwitch * NewL(MUsbPersonalitySwitchObserver* aObserver);
-
- /**
- * Destructor.
- */
- virtual ~CUsbPersonalitySwitch();
-
- /**
- * calls RunL after aMilliseconds
- * @param aMilliseconds time in millisecs
- */
- TInt SwitchPersonalityL(TUint32 aDeviceId, TInt aPersonalityToBeSet);
-
- void CancelSwitchPersonalityL();
-
-public:
-
- // from base class CActive
- /**
- * Called when request is completed
- */
- void RunL();
-
- /**
- * called when RunL leaves
- * @param aError error code
- * @return error code
- */
- TInt RunError(TInt aError);
-
- /**
- * Called when request is cancelled
- */
- void DoCancel();
-
-private:
-
- /**
- * Default constructor
- * @param aObserver will get call back
- * @param aTimerId timer id
- */
- CUsbPersonalitySwitch(MUsbPersonalitySwitchObserver* aObserver);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- void Reset();
-
-private:
- // data
-
- /**
- * Observer
- * not own
- */
- MUsbPersonalitySwitchObserver* iObserver;
-
- RUsbInterface iUsbInterface;
-
- /**
- * timer id
- */
- TInt iPersonalityToBeSet;
-
- RUsbInterface::TUsbTransferRequestDetails iTransfer;
-
- RBuf8 iSendData;
-
- RBuf8 iRcvData;
-
- TState iState;
- };
-
-#endif // C_USBPERSONALITYSWITCH_H
--- a/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbstate.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstate.h Fri Apr 23 23:57:55 2010 +0300
@@ -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;
};
--- a/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Apr 23 23:57:55 2010 +0300
@@ -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();
--- a/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbstatehostaidle.h Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* 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: Iplementation of the concret state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAIDLE_H
-#define C_USBSTATEHOSTAIDLE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- * This class implements basic behaviour in Idle state (VBus down, IdPin on)
- *
- */
-NONSHARABLE_CLASS( CUsbStateHostAIdle ) : public CUsbStateHostAInitiateBase
-
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aWatcher owner
- */
- static CUsbStateHostAIdle* NewL(CUsbOtgWatcher* aWatcher);
-
- /**
- * Destructor.
- */
- virtual ~CUsbStateHostAIdle();
-
-private:
-
- /**
- * Default construction
- * @param aWatcher owner
- */
- CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- //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();
-
- };
-
-#endif // C_USBSTATEHOSTAIDLE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Apr 23 23:57:55 2010 +0300
@@ -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;
};
--- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiatebase.h Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-* 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 concrete state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAINITIATEBASE_H
-#define C_USBSTATEHOSTAINITIATEBASE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostabase.h"
-#include "cusbpersonalityswitch.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- * This class implements besic behaviour when Id pin on, and vbus just turned down or just turned on,
- * specific concrete case/state is implemented in subclass
- */
-NONSHARABLE_CLASS( CUsbStateHostAInitiateBase ) : public CUsbStateHostABase,
- MUsbTimerObserver, MUsbPersonalitySwitchObserver
-
- {
- friend class CTestUsbOtgWatcher;
-
-public:
-
- /**
- * Destructor.
- */
- virtual ~CUsbStateHostAInitiateBase();
-
- // From MUsbTimerObserver
- /**
- * timer expired call back
- * @param aTimerId timer id
- */
- void TimerElapsedL(TUsbTimerId aTimerId);
-
- void UsbPersonalitySwitchStateChangedL(MUsbPersonalitySwitchObserver::TState aState, TInt aData);
-
-protected:
-
- /**
- * Default construction
- * @param aWatcher owner
- */
- CUsbStateHostAInitiateBase(CUsbOtgWatcher* aWatcher);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- //from CUsbState
-
- /**
- * 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();
-
- // From VBus observer
- /**
- * VBus down
- */
- virtual void VBusDownL();
- /**
- * VBus UP
- */
- virtual void VBusUpL();
-
- /**
- * AHost
- */
- virtual void AHostL();
-
- /**
- * APeripheral
- */
- virtual void APeripheralL();
-
- // From Host Event notification observer
- /**
- * Device is attached
- * @param Device event data
- */
- virtual void DeviceAttachedL(TDeviceEventInformation);
- /**
- * Device is detached
- * @param Device event data
- */
- virtual void DriverLoadSuccessL(TDeviceEventInformation);
- /**
- * Drivers loaded partially
- * @param Device event data
- */
- virtual void DriverLoadPartialSuccessL(TDeviceEventInformation);
- /**
- * Drivers loading failed
- * @param Device event data
- */
- virtual void DriverLoadFailureL(TDeviceEventInformation);
-
- // From message notification observer
- /**
- * SRP request received
- */
- virtual void SrpReceivedL();
-
-protected:
- // data
-
- /*
- * attachment timer
- * own
- */
- CUsbTimer* iAttachmentTimer;
-
- CUsbPersonalitySwitch* iUsbPersonalitySwitch;
- };
-
-#endif // C_USBSTATEHOSTAINITIATEBASE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Apr 23 23:57:55 2010 +0300
@@ -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<MUsbVBusObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Apr 23 23:57:55 2010 +0300
@@ -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);
/**
--- a/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbotgwatcher/inc/debug.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/debug.h Fri Apr 23 23:57:55 2010 +0300
@@ -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 <f32file.h>
#include <flogger.h>
-#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<const TDesC> 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 <e32debug.h>
-// RDebug logging
-#elif defined(__CLOGGING__)
+// Paramters same as above.
+#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); }
-#include <e32svr.h>
-
-#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<const TDesC> 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
--- a/usbengines/usbotgwatcher/inc/definitions.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/definitions.h Fri Apr 23 23:57:55 2010 +0300
@@ -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)
--- a/usbengines/usbotgwatcher/inc/errors.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/errors.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
};
--- a/usbengines/usbotgwatcher/inc/panic.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/panic.h Fri Apr 23 23:57:55 2010 +0300
@@ -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 <e32base.h>
@@ -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
};
--- a/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbotgdefs.h>
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbman.h>
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbotgdefs.h>
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <AknSmallIndicator.h>
#include <avkon.hrh>
@@ -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();
}
--- a/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbman.h>
#include <d32usbdi_errors.h>
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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<TInt> 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;
--- a/usbengines/usbotgwatcher/src/cusbnotifier.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbnotifier.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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;
}
--- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
@@ -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();
--- a/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbpersonalityids.h>
#include <usbuinotif.h>
#include <UsbWatcherInternalPSKeys.h>
-
#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);
}
--- a/usbengines/usbotgwatcher/src/cusbpersonalityswitch.cpp Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* 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: Switches personality
- *
-*/
-
-#include <e32base.h>
-#include <usb.h>
-#include <usbpersonalityids.h>
-
-#include "cusbpersonalityswitch.h"
-
-#include "panic.h"
-#include "debug.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::CUsbPersonalitySwitch(
- MUsbPersonalitySwitchObserver* aObserver) :
- CActive(CActive::EPriorityStandard), iObserver(aObserver), iState(EIdle)
- {
- CActiveScheduler::Add(this);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::~CUsbPersonalitySwitch()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::~CUsbPersonalitySwitch" ) );
- Cancel();
- iUsbInterface.Close();
- iSendData.Close();
- iRcvData.Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::ConstructL" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch* CUsbPersonalitySwitch::NewL(
- MUsbPersonalitySwitchObserver* aObserver)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::NewL" ) );
-
- CUsbPersonalitySwitch* self = new (ELeave) CUsbPersonalitySwitch(
- aObserver);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self); // pop self
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::SwitchPersonalityL(TUint32 aDeviceId,
- TInt aPersonalityToBeSet)
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality aDeviceId %d, aPersonalityToBeSet %d" ), aDeviceId, aPersonalityToBeSet))
-
- if (IsActive() || EIdle != iState)
- {
- Cancel();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
- }
-
- // create usb interface for the device id
- TUint32 token(0); // = RFdc.InterfaceToken();
- TInt err = iUsbInterface.Open(token);
-
- FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality UsbInterface Open err = %d" ), err));
- if (KErrNone != err)
- {
- return err;
- }
-
- iPersonalityToBeSet = aPersonalityToBeSet;
-
- // get list of supported personalities
- iTransfer.iRequestType = KUsbRequestType_DirToHost
- | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
- iTransfer.iRequest = KGetAllPersonalitiesReq;
- iTransfer.iValue = 0;
- iTransfer.iIndex = 0;
- iTransfer.iFlags
- = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
- Reset();
-
- iState = EGetAllPersonalities;
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonalityL Sending GetAllPersonalities request." ) );
- iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
- SetActive();
-
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestingAllPersonalities,
- KErrNone);
-
- return KErrNone;
- }
-
-void CUsbPersonalitySwitch::CancelSwitchPersonalityL()
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::CancelSwitchPersonalityL"));
-
- if (IsActive())
- {
- Cancel();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::RunL()
- {
-
- if (KErrNone != iStatus.Int())
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL iStatus %d" ), iStatus.Int()));
- User::Leave(iStatus.Int());
- }
-
- switch (iState)
- {
-
- case EGetAllPersonalities:
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersonalities completed."));
-
- TInt numOfPersonalities = iRcvData[KNumOfPersShift];
- FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Amount of personalities in peripheral = %d" ), numOfPersonalities));
-
- // if no personalities then return
- if (0 == numOfPersonalities)
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL No personailies found in peripheral."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNotFound);
- return;
- }
-
- // if needed pers already set, then return
- TInt currentPersonality = iRcvData[KCurrPersShift];
- if (iPersonalityToBeSet == currentPersonality)
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Needed personality already set in peripheral."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrInUse);
- return;
- }
-
- // check if device supports needed personality
- TInt count(0);
- while (count < numOfPersonalities && iPersonalityToBeSet
- != iRcvData[KFirstPersonalityIdShift
- + KLenghtOfPersonalityData * count])
- {
- ++count;
- }
-
- if (count == numOfPersonalities) // not found == not supported
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Peripheral does not support needed personality."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNotFound);
- return;
- }
-
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNone);
-
- // set personality
- iTransfer.iRequestType = KUsbRequestType_DirToDev
- | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
- iTransfer.iRequest = KSetPersonalityReq;
- iTransfer.iValue = iPersonalityToBeSet;
- iTransfer.iIndex = 0;
- iTransfer.iFlags
- = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
- iSendData.Close();
- iRcvData.Close();
-
- iState = ESetPersonality;
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Sending SetPersonality request." ) );
- iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
- SetActive();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestingSetPersonality,
- KErrNone);
-
- break;
- }
- case ESetPersonality:
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL SetPersonality completed."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ESetPersonalityCompleted,
- KErrNone);
-
- break;
- }
- /* case EGetAllPersResult:
- {
- FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersResult completed.");
-
- break;
- }
- case EGetSetPersResult:
- {
- FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetSetPersResult completed.");
-
- break;
- } */
-
- case EIdle: // do not break
- default:
- {
- Panic(EUnexpectedUsbSwitchPersonalityState);
- }
- }
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::RunError(TInt aError)
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunError aError %d" ), aError ));
- Reset();
- TRAP_IGNORE (iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestFailed, aError) );
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::DoCancel()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::DoCancel" ) )
-
- iUsbInterface.CancelEP0Transfer();
- Reset();
- }
-
-void CUsbPersonalitySwitch::Reset()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::Reset" ) )
-
- iState = EIdle;
- iSendData.Close();
- iRcvData.Close();
- }
--- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbman.h>
@@ -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();
}
--- a/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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);
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <e32base.h>
#include <usbhosterrors.h>
@@ -22,7 +21,7 @@
#include <d32usbdi_errors.h>
#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));
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <e32base.h>
#include <UsbWatcherInternalPSKeys.h>
@@ -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);
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* 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 "cusbstatehostaidle.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"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher) :
- CUsbStateHostAInitiateBase(aWatcher)
- {
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::ConstructL" ) );
-
- CUsbStateHostAInitiateBase::ConstructL();
- }
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-
-CUsbStateHostAIdle* CUsbStateHostAIdle::NewL(CUsbOtgWatcher* aWatcher)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::NewL" ) );
-
- CUsbStateHostAIdle* self = new (ELeave) CUsbStateHostAIdle(aWatcher);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::~CUsbStateHostAIdle()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::~CUsbStateHostAIdle" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TUsbStateIds CUsbStateHostAIdle::Id()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::Id" ) );
-
- return EUsbStateHostAIdle;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::JustAdvancedToThisStateL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::JustAdvancedToThisStateL" ) );
-
- iWatcher->PrintStateToLog();
-
- // do BusDrop, if Up
- if (CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusDrop();
- if (err != KErrNone)
- {
- err = iWatcher->Usb().BusClearError();
- if (KErrNone != err)
- {
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
- }
- }
- }
- }
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
#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);
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp Fri Apr 23 23:42:54 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-/*
-* 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 <usbuinotif.h>
-#include <usbpersonalityids.h>
-
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
-#else
-#include "mockcusbnotifmanager.h"
-#include "mockcusbtimer.h"
-#endif
-
-#include "definitions.h"
-#include "errors.h"
-
-#include "debug.h"
-#include "panic.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::CUsbStateHostAInitiateBase(
- CUsbOtgWatcher* aWatcher) :
- CUsbStateHostABase(aWatcher)
- {
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::ConstructL" ) );
-
- CUsbStateHostABase::ConstructL();
-
- iAttachmentTimer = CUsbTimer::NewL(this, EDeviceAttachmentTimer);
-
- //iUsbPersonalitySwitch = CUsbPersonalitySwitch::NewL(this);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase" ) );
-
- delete iAttachmentTimer;
- //delete iUsbPersonalitySwitch;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL" ) );
- iAttachmentTimer->Cancel();
- }
-
-// From TimerObserver
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::TimerElapsedL(TUsbTimerId aTimerId)
- {
- switch (aTimerId)
- {
- case EDeviceAttachmentTimer:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - AttachmentTimer" ) );
- HandleL(EUsbWatcherErrDandlingCable, EUsbStateHostHandle);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - Unknown timer" ) );
- Panic(EWrongTimerId);
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusUpL()
- {
- // start timer, waiting for device attachment
- iAttachmentTimer->After(KTimeToWaitForDeviceAttachment);
- }
-
-// From VBus observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusDownL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::VBusDownL" ) );
- iAttachmentTimer->Cancel();
-
- CUsbStateHostABase::VBusDownL();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::AHostL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::AHostL" ) );
- // do nothing
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::APeripheralL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AHostL" ) );
- ChangeHostStateL(EUsbStateHostAPeripheral);
- }
-
-// From Host Event notification observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DeviceAttachedL(TDeviceEventInformation aTdi)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDeviceId = %d" ), aTdi.iDeviceId));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iEventType = %d" ), aTdi.iEventType));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iError = %d" ), aTdi.iError));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDriverLoadStatus = %d" ), aTdi.iDriverLoadStatus));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iVid = %d" ), aTdi.iVid));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iPid = %d" ), aTdi.iPid));
-
- 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);
-
- TBool hnpSupported(otgDescriptor.iAttributes & EUsbOtgHNPSupported);
- TBool srpSupported(otgDescriptor.iAttributes & EUsbOtgSRPSupported);
-
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL GetOtgDescriptor err = %d, HNP supported = %d, SRP supported = %d" ), err, hnpSupported, srpSupported));
-
- // OTG device supports both hnp and srp
- if(hnpSupported && srpSupported)
- {
-
- HandleL(EUsbWatcherConnectedToOTG, EUsbStateHostHandle);
- return;
- }
-
- if (KErrNone != aTdi.iError)
- {
- switch (aTdi.iError)
- // error in attachement
- {
- case KErrBadPower:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL TooMuchPower" ) );
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, EUsbStateHostDelayHandle);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL AttachmentError" ) );
- HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle);
- break;
- }
-
- }
-
- return;
- }
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadSuccessL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadSuccessL" ) );
- ChangeHostStateL(EUsbStateHostAHost);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadPartialSuccessL(
- TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadPartialSuccessL" ) );
- iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning,
- EUsbOtgPartiallySupportedDevice, NULL);
- ChangeHostStateL(EUsbStateHostAHost);
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadFailureL(
- TDeviceEventInformation aDei)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadFailureL" ) );
-
- // try initiate to switch to mass storage
- /* if (KErrNone != iUsbPersonalitySwitch->SwitchPersonalityL(aDei.iDeviceId,
- KUsbPersonalityIdMS ))
- {*/
- HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
- // }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::SrpReceivedL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL" ) );
- if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusRespondSrp();
- if (KErrNone != err)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL BusRespondSrp error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
- }
- }
- }
-
-void CUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::TState aState, TInt aData)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL aState = %d aData = %d" ), TInt(aState), aData));
-
- switch (aState)
- {
- case ERequestingAllPersonalities:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingAllPersonalities" ) );
- break;
- }
- case ERequestingSetPersonality:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingSetPersonality" ) );
- break;
- }
- case EGetAllPersonalitiesCompleted:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL EGetAllPersonalitiesCompleted" ) );
- if (KErrNotFound == aData)
- {
- // no supported or needed personality/ies in the peripheral
- HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
- }
- break;
- }
- case ESetPersonalityCompleted:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ESetPersonalityCompleted" ) );
-
- break;
- }
- case ERequestCancelled:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestCancelled" ) );
- break;
- }
- case ERequestFailed:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestFailed" ) );
- HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
- break;
- }
- default:
- {
- Panic(EUnexpectedUsbSwitchPersonalityState);
- }
- }
- }
--- a/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
#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);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
+
+#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);
+ }
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
+ * 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);
- }
- }
- }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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);
+ }
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
+ * 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
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbuinotif.h>
+#include <d32usbdi_errors.h>
+
+#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;
+ }
+
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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);
+ }
--- a/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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();
}
--- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <usbotgdefs.h>
@@ -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;
--- a/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <e32std.h>
#include <usbuinotif.h>
@@ -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();
}
--- a/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <e32std.h>
#include <usbuinotif.h>
@@ -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();
}
--- a/usbengines/usbotgwatcher/src/panic.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbotgwatcher/src/panic.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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
-}
+ }
--- a/usbengines/usbwatcher/group/bld.inf Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbwatcher/group/bld.inf Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/rom/usbacmconfiguration.hby Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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 <startupdomainpskeys.h> //for global system state
#include "cusbactivepersonalityhandler.h"
#include "cusbglobalsystemstateobserver.h"
+#include <usbuinotif.h>
// 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;
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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;
}
--- a/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Apr 23 23:57:55 2010 +0300
@@ -63,7 +63,8 @@
EUSBPossibleDataLossCable,
EUSBPossibleDataLossMMC,
EUSBChangeFromMassStorage,
- EUSBNoMemoryCard
+ EUSBNoMemoryCard,
+ EUSBNotEnoughRam
};
/**
--- a/usbuis/group/bld.inf Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/group/bld.inf Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Apr 23 23:57:55 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: ?Description
+* Description:
*
*/
--- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Apr 23 23:57:55 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: ?Description
+* Description:
*
*/
--- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Apr 23 23:57:55 2010 +0300
@@ -2,19 +2,20 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
-* Description:
+* Description:
*
*/
+
#include <e32debug.h>
NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
--- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
# 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 "Symbian Foundation License v1.0"
+# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
-# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
--- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
# 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 "Symbian Foundation License v1.0"
+# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
-# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
--- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: ?Description
+* Description:
*
*/
--- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: ?Description
+* Description:
*
*/
--- a/usbuis/usbuinotif/data/usbuinotif.rss Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/data/usbuinotif.rss Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbuis/usbuinotif/loc/usbuinotif.loc Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/loc/usbuinotif.loc Fri Apr 23 23:57:55 2010 +0300
@@ -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
--- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -105,18 +105,24 @@
{
User::Leave( KErrInUse );
}
-
- iMessage = aMessage;
- iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
-
+
// Get parameters
//
- iErrorId = 0;
+
TPckgC<TInt> 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;
--- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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);
}
// ----------------------------------------------------------------------------
@@ -123,18 +123,24 @@
if (iNote || iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave( KErrInUse );
- }
-
- iMessage = aMessage;
- iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
+ }
// Get parameters
//
TPckgC<TInt> 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;
--- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -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:
{
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
@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 "Symbian Foundation 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.symbianfoundation.org/legal/sfl-v10.html".
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
@rem
@rem Initial Contributors:
@rem Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
@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 "Symbian Foundation 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.symbianfoundation.org/legal/sfl-v10.html".
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
@rem
@rem Initial Contributors:
@rem Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
; 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 "Symbian Foundation License v1.0"
+; under the terms of "Eclipse Public License v1.0"
; which accompanies this distribution, and is available
-; at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
;
; Initial Contributors:
; Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
; 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 "Symbian Foundation License v1.0"
+; under the terms of "Eclipse Public License v1.0"
; which accompanies this distribution, and is available
-; at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
;
; Initial Contributors:
; Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
# 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 "Symbian Foundation License v1.0"
+# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
-# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
# 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 "Symbian Foundation License v1.0"
+# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
-# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -2,9 +2,9 @@
* 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 "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
--- a/usbuis/usbuiqt/rom/usbsettings.iby Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuiqt/rom/usbsettings.iby Fri Apr 23 23:57:55 2010 +0300
@@ -21,8 +21,6 @@
#include <data_caging_paths_for_iby.hrh>
file=/epoc32/release/armv5/urel/usbapplication.exe PROGRAMS_DIR/usbapplication.exe
-data=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc
data=/epoc32/data/z/private/10003a3f/import/apps/usbapplication_reg.rsc /private/10003a3f/import/apps/usbapplication_reg.rsc
-data=/epoc32/data/z/resource/usbapplication.qm RESOURCE_FILES_DIR/usbapplication.qm
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/rom/usbsettingsresources.iby Fri Apr 23 23:57:55 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBSETTINGRESOURCES_IBY
+#define USBSETTINGRESOURCES_IBY
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+data=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc
+
+#endif
--- a/usbuis/usbuiqt/src/main.cpp Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuiqt/src/main.cpp Fri Apr 23 23:57:55 2010 +0300
@@ -34,9 +34,9 @@
// TRAP is must here, otherwise it crashes
TRAP_IGNORE(
bool loaded(false);
- loaded = translator.load( filename, QString("z:/resource") );
+ loaded = translator.load( filename, QString("z:/resource/qt/translations") );
if (!loaded)
- translator.load(filename, QString("c:/resource") );
+ translator.load(filename, QString("c:/resource/qt/translations") );
);
#else
translator.load(filename, QString("resource") );
--- a/usbuis/usbuiqt/usbapplication.pro Fri Apr 23 23:42:54 2010 +0300
+++ b/usbuis/usbuiqt/usbapplication.pro Fri Apr 23 23:57:55 2010 +0300
@@ -55,7 +55,7 @@
usbuitranslation.path = /resource
DEPLOYMENT += usbuitranslation
- BLD_INF_RULES.prj_exports += "./src/usbapplication.qm z:/resource/usbapplication.qm"
+ BLD_INF_RULES.prj_exports += "./src/usbapplication.qm z:/resource/qt/translations/usbapplication.qm
}
# placeholder for creating sis file
@@ -66,5 +66,6 @@
( del usbapplication.sis );
QMAKE_EXTRA_TARGETS += createsis
-BLD_INF_RULES.prj_exports += \
- "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \
\ No newline at end of file
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \
+ "rom/usbsettingsresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsresources.iby)"