--- a/layers.sysdef.xml Thu Dec 17 09:14:30 2009 +0200
+++ b/layers.sysdef.xml Thu Jan 07 13:25:34 2010 +0200
@@ -11,7 +11,14 @@
</module>
<module name="">
<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" />
+ </module>
+ </layer>
+ <layer name="api_test_layer">
+ <module name="usbservices_test">
+ <unit unitID="lcdo.usbservices_test" mrp="" bldFile="&layer_real_source_path;/tsrc/group" name="usbservices_test" />
</module>
- </layer>
+ </layer>
</systemModel>
</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/group/bld.inf Thu Jan 07 13:25:34 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 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: Build information file for project
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+//build files for shortlinkconn
+#include "../../../shortlinkconn/localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/group/bld.inf"
+#include "../../../shortlinkconn/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf"
+
+//build files for usb
+#include "../../usbclasses/msmmplugin/tsrc/MsmmPluginTest/group/bld.inf"
+#include "../../usbuis/usbui/tsrc/USBUiApiTest/group/bld.inf"
+#include "../../usbclasses/usbhidclassdriver/tsrc/UsbHidClassDriverTest/group/bld.inf"
+
+
+PRJ_EXPORTS
+
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- a/usbclasses/group/bld.inf Thu Dec 17 09:14:30 2009 +0200
+++ b/usbclasses/group/bld.inf Thu Jan 07 13:25:34 2010 +0200
@@ -23,6 +23,9 @@
//#include "../sicdusbplugin/group/bld.inf"
//#include "../ptpserver/group/bld.inf"
#include "../pictbridgeengine/group/bld.inf"
-#include "../msmmplugin/group/bld.inf"
-#include "../usbhidclassdriver/group/bld.inf"
+//Wusan@20091210: DEF143281: sf build break because of
+// msmmplugin & usbhidclassdriver do not contribute to.
+//PS, this comment and the below 2 line will be deleted after review!
+//#include "../msmmplugin/group/bld.inf"
+//#include "../usbhidclassdriver/group/bld.inf"
#include "../usbphoneasmodem/group/bld.inf"
--- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Thu Jan 07 13:25:34 2010 +0200
@@ -23,37 +23,56 @@
#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
*/
-NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver
+NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver, MUsbOtgWatcherStateObserver, MUsbVBusObserver
{
public:
/**
* Two-phased constructor.
- * @param aNotifManager Owner of the class, will destroy the object when needed
+ * @param aNotifManager parent
+ * @param aOtgWatcher provides VBus observer and usb otg watcher state notifications
* @return Pointer to the new instance of CUsbIndicatorNotifier
*/
- static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager);
+ static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher);
/**
* Destructor.
*/
virtual ~CUsbIndicatorNotifier();
+ // From MUsbOtgWatcherStateObserver
/**
- * Show/hide static icon of the indicator.
- * If the indicator is blinking, stop blinking it and show/hide the static
- * form of the indicator.
- * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator
+ * Otg Watcher state changed call back
+ * @param aState new state
+ */
+ virtual void OtgWatcherStateChangedL(TUsbStateIds aState);
+
+ // From MUsbVBusObserver
+ /**
+ * VBus down event received
*/
- void ShowIndicatorL(TBool aVisible);
-
+ virtual void VBusDownL();
+ /**
+ * VBus up event received
+ */
+ virtual void VBusUpL();
+ /**
+ * error handler
+ * @param aError error code
+ */
+ virtual void VBusObserverErrorL(TInt aError);
+
+
// From base class CUsbNotifier
/**
* Start to show notifier
@@ -76,9 +95,10 @@
/**
* Default constructor.
- * @param aNotifManager Owner
+ * @param aNotifManger parent
+ * @param aOtgWatcher Otg watcher
*/
- CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager);
+ CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher);
/**
* 2nd phase constructor.
@@ -91,10 +111,34 @@
*/
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
+ * form of the indicator.
+ * @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
/**
+ * OtgWatcher
+ * not own
+ */
+ CUsbOtgWatcher* iOtgWatcher;
+
+ /**
* Switch timer for showing/hiding the usb indicator interleavingly for
* animating the indicator.
* Own
--- a/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Thu Jan 07 13:25:34 2010 +0200
@@ -24,6 +24,7 @@
// forward declaration
class CUsbNotifier;
class CUsbIndicatorNotifier;
+class CUsbOtgWatcher;
// pause warning is visible for (ms)
const TUint KPauseForWarnings = 1000000; // 1 sec
@@ -116,8 +117,9 @@
/**
* 2phase construction
+ * @param aOtgWatcher OtgWatcher is a parent class
*/
- static CUsbNotifManager* NewL();
+ static CUsbNotifManager* NewL(CUsbOtgWatcher* aOtgWatcher);
/**
* Destructor
@@ -134,18 +136,6 @@
MWaitNotifierObserver* aObserver = NULL);
/**
- * Changes USB indicator to blink or not
- * @param aBlinking ETrue if want to make it blinking, EFalse otherwise
- */
- void BlinkIndicatorL(TBool aBlinking);
-
- /**
- * Shows or hides usb indicator
- * @param aVisible ETRue is show, EFalse id hide
- */
- void ShowIndicatorL(TBool aVisible);
-
- /**
* Closes and deletes all the notifiers
*/
void CloseAllNotifiers();
@@ -163,13 +153,14 @@
/**
* Default construction
+ * @param aOtgWatcher otg watcher (parent class)
*/
CUsbNotifManager();
/**
* Second phase construction
*/
- void ConstructL();
+ void ConstructL(CUsbOtgWatcher* aOtgWatcher);
private:
// data
@@ -186,7 +177,7 @@
/**
* Own
- * Notifier for showing or blinking Usb indicator
+ * USB indicator
*/
CUsbIndicatorNotifier* iIndicatorNotifier;
};
--- a/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Thu Jan 07 13:25:34 2010 +0200
@@ -51,6 +51,23 @@
class CUsbNotifManager;
/**
+ * Observers for usb otg watcher state nachine
+ * Observers gets feedback by implementing this interface
+ */
+class MUsbOtgWatcherStateObserver
+ {
+
+public:
+
+ /**
+ * Observer must implement this interface
+ * which is called back when state changes
+ * @param aState new state id
+ */
+ virtual void OtgWatcherStateChangedL(TUsbStateIds aState) = 0;
+ };
+
+/**
* UsbWatcher main class
* Implements states machines and owns them
*
@@ -339,6 +356,18 @@
* @param aWhatKindOf problem Id to be handled
*/
void HandleHostProblemL(TInt aWhatKindOf);
+
+ /**
+ * Add observer to USb Otg state machine
+ * @param aObserver Observer
+ */
+ void SubscribeL(MUsbOtgWatcherStateObserver* aObserver);
+
+ /**
+ * Remove observer from UsbOtg state observer
+ * @param aObserver Observer
+ */
+ void UnsubscribeL(MUsbOtgWatcherStateObserver* aObserver);
/**
* Used for test purposes
@@ -462,6 +491,12 @@
* Own.
*/
CUsbServiceControl* iUsbServiceControl;
+
+ /**
+ * The observer reports state changes to its own observers
+ * Not Own
+ */
+ RPointerArray<MUsbOtgWatcherStateObserver> iOtgStateObservers;
};
#endif // C_USBOTGWATCHER_H
--- a/usbengines/usbotgwatcher/inc/cusbstate.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbstate.h Thu Jan 07 13:25:34 2010 +0200
@@ -66,9 +66,22 @@
public:
/**
+ * 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();
+
+ /**
* Destruction
*/
virtual ~CUsbState();
+
+ /**
+ * Two-phased constructor.
+ * @param aWatcher owner
+ */
+ static CUsbState* NewL(CUsbOtgWatcher* aWatcher);
protected:
/**
@@ -90,13 +103,11 @@
void ChangeHostStateL(TUsbStateIds aNewStateId);
private:
-
+
/**
- * 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
+ * 2nd phase construction
*/
- virtual TUsbStateIds Id() = 0;
+ void ConstructL();
/**
* State machine calls this, state object to perform any initial
--- a/usbengines/usbotgwatcher/inc/definitions.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/definitions.h Thu Jan 07 13:25:34 2010 +0200
@@ -37,6 +37,8 @@
*/
enum TUsbStateIds
{
+ EUsbStateUndefined,
+
EUsbStateHostAInitiate,
EUsbStateHostAHost,
EUsbStateHostAPeripheral,
--- a/usbengines/usbotgwatcher/inc/panic.h Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/inc/panic.h Thu Jan 07 13:25:34 2010 +0200
@@ -108,7 +108,9 @@
EUnexpectedNotifId, //67
EUnknownUsbServiceState, //68
EUnexpectedUsbServiceState, //69
- EUnexpectedUsbSwitchPersonalityState //70
+ EUnexpectedUsbSwitchPersonalityState, //70
+
+ ECanNotFindUsbOtgWatcherStateObserver //71
};
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -21,7 +21,7 @@
#include <usbuinotif.h>
#include "cusbindicatornotifier.h"
-#include "cusbnotifier.h"
+#include "cusbstate.h"
#include "definitions.h"
#include "debug.h"
@@ -33,11 +33,11 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(CUsbNotifManager* aNotifManager)
+CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::NewL" ));
- CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(aNotifManager);
+ CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(aNotifManager, aOtgWatcher);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
@@ -54,6 +54,47 @@
Close();
delete iIconBlinkingTimer;
+
+ // Unsubscribe from VBus change notifications
+ iOtgWatcher->VBusObserver()->UnsubscribeL(this);
+
+ // Unsubscribe from otg watcher states change notifications
+ iOtgWatcher->UnsubscribeL(this);
+ }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher) :
+ CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(aOtgWatcher)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::CUsbIndicatorNotifier" ) );
+
+ //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer
+ //when AVKON implements animation form of usb indicator.
+ iIndicatorState = EAknIndicatorStateOn;
+ }
+
+// ---------------------------------------------------------------------------
+// Second-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::ConstructL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ConstructL" ) );
+
+ // Subscribe for VBus change notifications
+ iOtgWatcher->VBusObserver()->SubscribeL(this);
+
+ // Subscribe for otg watcher states change notifications
+ iOtgWatcher->SubscribeL(this);
+
+ iIconBlinkingTimer = CUsbTimer::NewL(this, EIconBlinkingTimer);
+
+ // check here for condition to set usb indicator
+ SetIndicatorL();
+
}
// ---------------------------------------------------------------------------
@@ -62,9 +103,9 @@
// form of the indicator.
// ---------------------------------------------------------------------------
//
-void CUsbIndicatorNotifier::ShowIndicatorL(TBool aVisible)
+void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible)
{
- FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowIndicator, aVisible=%d" ), aVisible));
+ FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowStaticL, aVisible=%d" ), aVisible));
iIconBlinkingTimer->Cancel();
@@ -72,15 +113,26 @@
}
// ---------------------------------------------------------------------------
-// From CUsbNotifier
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::BlinkL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::BlinkL" ));
+
+ // Will be canceled if active in After()
+ iIconBlinkingTimer->After(0);
+ }
+
+// ---------------------------------------------------------------------------
+// From base class CUsbNotifier
// ---------------------------------------------------------------------------
//
void CUsbIndicatorNotifier::ShowL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowL" ));
-
- // Will be canceled if active in After()
- iIconBlinkingTimer->After(0);
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowL" ) );
+
+ ShowStaticL(ETrue);
}
// ---------------------------------------------------------------------------
@@ -92,7 +144,7 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::Close" ) );
iIconBlinkingTimer->Cancel();
- TRAP_IGNORE( ShowIndicatorL(EFalse) );
+ TRAP_IGNORE( ShowStaticL(EFalse) );
}
// ---------------------------------------------------------------------------
@@ -124,31 +176,6 @@
}
// ---------------------------------------------------------------------------
-// C++ constructor
-// ---------------------------------------------------------------------------
-//
-CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager) :
- CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::CUsbIndicatorNotifier" ) );
-
- //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer
- //when AVKON implements animation form of usb indicator.
- iIndicatorState = EAknIndicatorStateOn;
- }
-
-// ---------------------------------------------------------------------------
-// Second-phase constructor
-// ---------------------------------------------------------------------------
-//
-void CUsbIndicatorNotifier::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ConstructL" ) );
-
- iIconBlinkingTimer = CUsbTimer::NewL(this, EIconBlinkingTimer);
- }
-
-// ---------------------------------------------------------------------------
// Set USB indicator On or Off
// ---------------------------------------------------------------------------
//
@@ -161,4 +188,70 @@
CleanupStack::PopAndDestroy( indicator ); //indicator
}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState)
+ {
+ FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::OtgWatcherStateChangedL - aState=%d" ), aState));
+ SetIndicatorL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::VBusDownL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusDownL" ) );
+ SetIndicatorL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::VBusUpL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusUpL" ) );
+ SetIndicatorL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::VBusObserverErrorL(TInt aError)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusObserverErrorL" ) );
+ // do not care
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::SetIndicatorL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::SetIndicatorL" ) );
+ // if VBus Up and we are host -> show indicator
+ 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))
+ {
+ BlinkL();
+ }
+ else
+ // Otherwise do not show indicator
+ {
+ ShowStaticL(EFalse);
+ }
+ }
+
// End of file
--- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -90,24 +90,35 @@
return iObserver;
}
+
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-CUsbNotifManager::CUsbNotifManager()
+CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher* aOtgWatcher)
{
+
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
+
+ CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
+ CleanupStack::PushL(self);
+ self->ConstructL(aOtgWatcher);
+ CleanupStack::Pop(self);
+ return self;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbNotifManager::ConstructL()
+void CUsbNotifManager::ConstructL(CUsbOtgWatcher* aOtgWatcher)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) );
User::LeaveIfError(iNotifier.Connect());
+
+ iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this, aOtgWatcher);
}
@@ -115,16 +126,9 @@
//
// ---------------------------------------------------------------------------
//
-CUsbNotifManager* CUsbNotifManager::NewL()
+CUsbNotifManager::CUsbNotifManager()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
-
- CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
}
// ---------------------------------------------------------------------------
@@ -134,10 +138,12 @@
CUsbNotifManager::~CUsbNotifManager()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
CloseAllNotifiers();
-
+
+ delete iIndicatorNotifier;
+
iNotifier.Close();
}
@@ -200,37 +206,6 @@
}
// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbNotifManager::BlinkIndicatorL(TBool aBlinking)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::BlinkIndicatorL, aBlinking=%d" ), aBlinking));
-
- if (!iIndicatorNotifier)
- iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
-
- if (aBlinking)
- iIndicatorNotifier->ShowL();
- else
- iIndicatorNotifier->Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbNotifManager::ShowIndicatorL(TBool aVisible)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowIndicatorL, aVisible=%d" ), aVisible ));
-
- if (!iIndicatorNotifier)
- iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
-
- iIndicatorNotifier->ShowIndicatorL(aVisible);
- }
-
-// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
@@ -264,6 +239,5 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) );
iWaitNotifiers.ResetAndDestroy();
- delete iIndicatorNotifier;
- iIndicatorNotifier = NULL;
+ iIndicatorNotifier->Close();
}
--- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -77,9 +77,9 @@
KUsbWatcherPeripheralIsNotConnected ) );
#endif
- iNotifManager = CUsbNotifManager::NewL();
iUsbServiceControl = CUsbServiceControl::NewL(this, iUsb);
+ User::LeaveIfError(iStates.Append(CUsbState::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this)));
@@ -94,6 +94,12 @@
&iUsb);
iMessageNotificationObserver = CUsbMessageNotificationObserver::NewL(
&iUsb);
+
+ iHostState = iStates[EUsbStateUndefined];
+
+ // 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);
iIdPinObserver->SubscribeL(this);
@@ -143,6 +149,9 @@
RProperty::Delete( KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected );
#endif
+ // delete Notif manager before VBus observer, due to USB indicator observes VBus
+ delete iNotifManager;
+
delete iIdPinObserver;
delete iVBusObserver;
delete iOtgStateObserver;
@@ -150,11 +159,12 @@
delete iHostEventNotificationObserver;
delete iMessageNotificationObserver;
+ iOtgStateObservers.Close();
+
// Destroy states
iStates.ResetAndDestroy();
iStates.Close();
-
- delete iNotifManager;
+
delete iUsbServiceControl;
iUsb.Close();
@@ -803,7 +813,12 @@
__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)
+ {
+ iOtgStateObservers[i]->OtgWatcherStateChangedL(iHostState->Id());
+ }
}
// ---------------------------------------------------------------------------
@@ -926,8 +941,6 @@
//
// ---------------------------------------------------------------------------
//
-
-
TInt CUsbOtgWatcher::SelfTestL()
{
#ifdef _DEBUG
@@ -945,15 +958,7 @@
iMessageNotificationObserver =
CUsbMessageNotificationObserver::NewL(&iUsb);
- /* FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL idPinObserver->Subscribe" ) );
-
- iIdPinObserver->SubscribeL(this);
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL idPinObserver->Unsubscribe" ) );
-
- iIdPinObserver->UnsubscribeL(this); */
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers getters." ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers getters." ) );
if (iIdPinObserver != IdPinObserver())
{
@@ -984,8 +989,9 @@
delete iIdPinObserver;
iIdPinObserver = 0;
- delete iVBusObserver;
- iVBusObserver = 0;
+
+ // Vbus observer is deleted later
+
delete iOtgStateObserver;
iOtgStateObserver = 0;
delete iBusActivityObserver;
@@ -995,23 +1001,9 @@
delete iMessageNotificationObserver;
iMessageNotificationObserver = 0;
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier." ) );
-
- CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL();
- RNotifier rnotifier;
- User::LeaveIfError(rnotifier.Connect());
- CUsbWarningNotifier* usbnotifier = CUsbWarningNotifier::NewL(rnotifier,
- usbnotifmanager, EUsbOtgPartiallySupportedDevice);
- usbnotifier->IsFeedbackNeeded();
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier destruction." ) );
-
- delete usbnotifier;
- rnotifier.Close();
- delete usbnotifmanager;
-
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating states." ) );
+ User::LeaveIfError(iStates.Append(CUsbState::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this)));
@@ -1033,6 +1025,25 @@
{
User::Leave(KErrGeneral);
}
+
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier." ) );
+
+ CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(this);
+ RNotifier rnotifier;
+ User::LeaveIfError(rnotifier.Connect());
+ CUsbWarningNotifier* usbnotifier = CUsbWarningNotifier::NewL(rnotifier,
+ usbnotifmanager, EUsbOtgPartiallySupportedDevice);
+ usbnotifier->IsFeedbackNeeded();
+
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier destruction." ) );
+
+ delete usbnotifier;
+ rnotifier.Close();
+ delete usbnotifmanager;
+
+ // VBus observer is deleted here, due to it is used by usbnotifmanager.usbindicatornotifier
+ delete iVBusObserver;
+ iVBusObserver = 0;
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Destructing states." ) );
@@ -1051,3 +1062,42 @@
}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver* aObserver)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SubscribeL" ) );
+
+ User::LeaveIfError(iOtgStateObservers.Append(aObserver));
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbOtgWatcher::UnsubscribeL(MUsbOtgWatcherStateObserver* aObserver)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL" ) );
+ if (0 == iOtgStateObservers.Count()) // no items
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL No observers" ) );
+ return;
+ }
+
+ TInt i(0);
+ while (i < iOtgStateObservers.Count() && aObserver != iOtgStateObservers[i])
+ ++i;
+
+ if (aObserver == iOtgStateObservers[i]) // found
+ {
+ iOtgStateObservers.Remove(i);
+ }
+ else
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL CanNotGetUsbOtgStateWatcherObserver" ) );
+ Panic(ECanNotFindUsbOtgWatcherStateObserver);
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstate.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -42,6 +42,37 @@
//
// ---------------------------------------------------------------------------
//
+CUsbState* CUsbState::NewL(CUsbOtgWatcher* aWatcher)
+ {
+ CUsbState* self = new (ELeave) CUsbState(aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbState::ConstructL()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbState::Id()
+ {
+ return EUsbStateUndefined;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
void CUsbState::JustAdvancedToThisStateL()
{
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -103,8 +103,6 @@
KUsbWatcherIsPeripheralConnected,
KUsbWatcherPeripheralIsConnected ) );
- iWatcher->NotifManager()->ShowIndicatorL(ETrue);
-
iWatcher->PrintStateToLog();
}
@@ -119,8 +117,6 @@
User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher,
KUsbWatcherIsPeripheralConnected,
KUsbWatcherPeripheralIsNotConnected ) );
-
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
}
// ---------------------------------------------------------------------------
--- a/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -95,8 +95,6 @@
iWatcher->PrintStateToLog();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
-
// do BusDrop, if Up
if (CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus())
{
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -141,7 +141,6 @@
// start timer, waiting for device attachment
iAttachmentTimer->After(KTimeToWaitForDeviceAttachment);
- iWatcher->NotifManager()->BlinkIndicatorL(ETrue);
}
// ---------------------------------------------------------------------------
@@ -152,7 +151,5 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustBeforeLeavingThisStateL" ) );
- iWatcher->NotifManager()->BlinkIndicatorL(EFalse);
-
CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL();
}
--- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -227,7 +227,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL DriversNotFound" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
@@ -238,7 +237,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherHubsNotSupported" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgHubUnsupported, this);
break;
@@ -255,7 +253,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDeviceRequiresTooMuchPower" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgTooMuchPower, this);
break;
@@ -265,7 +262,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrUnsupportedDevice" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
break;
@@ -276,7 +272,6 @@
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
break;
@@ -286,7 +281,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDandlingCable" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorAttachTimedOut, this);
break;
@@ -296,7 +290,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherNoActivity" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
@@ -307,7 +300,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrorInConnection" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorInConnection, this);
break;
@@ -315,7 +307,6 @@
case EUsbWatcherCanNotStartUsbServices:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherCanNotStartUsbServices" ) );
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorInConnection, this);
break;
@@ -330,7 +321,6 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL Error from observer" ) );
// Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorInConnection, this);
break;
@@ -592,7 +582,6 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::TimerElapsedL - ETooMuchPowerRequiredTimer" ) );
iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowIndicatorL(EFalse);
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgTooMuchPowerRequired, this);
break;
--- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -115,6 +115,8 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL" ) );
User::LeaveIfError(iObservers.Append(aObserver));
+
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL Observer appended." ) );
if (KFirst == iObservers.Count()) // first item
{
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Thu Jan 07 13:25:34 2010 +0200
@@ -24,7 +24,6 @@
#include <cusbpersonalityplugin.h>
#include <tusbpersonalityparams.h>
#include <startupdomainpskeys.h> //for global system state
-#include <rusb.h> // for KUsbmanSvrUid
#include "cusbactivepersonalityhandler.h"
#include "cusbglobalsystemstateobserver.h"
@@ -32,6 +31,8 @@
// const TInt KSerialNumberLength = 12;
const TInt KContainerIdLength = 16;
+const TUid KUsbmanSvrUid = {0x101fe1db};
+
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
--- a/usbuis/imageprintuiprovider/data/1020E471.rss Thu Dec 17 09:14:30 2009 +0200
+++ b/usbuis/imageprintuiprovider/data/1020E471.rss Thu Jan 07 13:25:34 2010 +0200
@@ -43,4 +43,4 @@
}
};
}
-
\ No newline at end of file
+
--- a/usbuis/rndisui/group/rndisauthorizationnotifier.mmp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbuis/rndisui/group/rndisauthorizationnotifier.mmp Thu Jan 07 13:25:34 2010 +0200
@@ -25,7 +25,7 @@
DEFFILE rndisautherizationnotifier.def
USERINCLUDE ../inc
-OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SOURCEPATH ../src
--- a/usbuis/rndisui/group/rndisrefusalnotifier.mmp Thu Dec 17 09:14:30 2009 +0200
+++ b/usbuis/rndisui/group/rndisrefusalnotifier.mmp Thu Jan 07 13:25:34 2010 +0200
@@ -27,7 +27,7 @@
USERINCLUDE ../inc
-OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SOURCEPATH ../src
SOURCE rndisrefusalnotifier.cpp