--- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Feb 19 23:50:33 2010 +0200
@@ -49,6 +49,8 @@
SOURCE cusbstatehostaperipheral.cpp
SOURCE cusbstatehostaidle.cpp
SOURCE cusbstatehosthandle.cpp
+SOURCE cusbstatehostdelayhandle.cpp
+SOURCE cusbstatehostundefined.cpp
SOURCE cusbwaitnotifier.cpp
SOURCE cusbnotifmanager.cpp
--- a/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -82,13 +82,13 @@
* Adds subscriber for the notification
* @param aObserver Observer
*/
- void SubscribeL(MUsbBusActivityObserver* aObserver);
+ void SubscribeL(MUsbBusActivityObserver& aObserver);
/**
* Removes observer
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbBusActivityObserver* aObserver);
+ void UnsubscribeL(MUsbBusActivityObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -96,13 +96,13 @@
* Add observer to list of observers
* @param aObserver observer
*/
- void SubscribeL(MUsbHostEventNotificationObserver* aObserver);
+ void SubscribeL(MUsbHostEventNotificationObserver& aObserver);
/**
* Removes observer from list of observers
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbHostEventNotificationObserver* aObserver);
+ void UnsubscribeL(MUsbHostEventNotificationObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -83,13 +83,13 @@
* Add observer
* @param aObserver Observer
*/
- void SubscribeL(MUsbIdPinObserver* aObserver);
+ void SubscribeL(MUsbIdPinObserver& aObserver);
/**
* Remove observer
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbIdPinObserver* aObserver);
+ void UnsubscribeL(MUsbIdPinObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -90,13 +90,13 @@
* Subscribes for notifications
* @param aObserver observer
*/
- void SubscribeL(MUsbMessageNotificationObserver* aObserver);
+ void SubscribeL(MUsbMessageNotificationObserver& aObserver);
/**
* Unsubscribe from notifications
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbMessageNotificationObserver* aObserver);
+ void UnsubscribeL(MUsbMessageNotificationObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -101,13 +101,13 @@
* Subscribes for getting notifications
* @param aObserver Observer
*/
- void SubscribeL(MUsbOtgStateObserver* aObserver);
+ void SubscribeL(MUsbOtgStateObserver& aObserver);
/**
* Unsubscribes from getting notifications
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbOtgStateObserver* aObserver);
+ void UnsubscribeL(MUsbOtgStateObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Feb 19 23:50:33 2010 +0200
@@ -349,25 +349,25 @@
/**
* @return Handle state
*/
- CUsbStateHostHandle* HostHandle() const;
+ CUsbStateHostHandle* HostHandle(TUsbStateIds aStateId) const;
/**
* Handles problems in host functioning
* @param aWhatKindOf problem Id to be handled
*/
- void HandleHostProblemL(TInt aWhatKindOf);
+ void HandleHostProblemL(TInt aWhatKindOf, TUsbStateIds aInState);
/**
* Add observer to USb Otg state machine
* @param aObserver Observer
*/
- void SubscribeL(MUsbOtgWatcherStateObserver* aObserver);
+ void SubscribeL(MUsbOtgWatcherStateObserver& aObserver);
/**
* Remove observer from UsbOtg state observer
* @param aObserver Observer
*/
- void UnsubscribeL(MUsbOtgWatcherStateObserver* aObserver);
+ void UnsubscribeL(MUsbOtgWatcherStateObserver& aObserver);
/**
* Used for test purposes
--- a/usbengines/usbotgwatcher/inc/cusbstate.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbstate.h Fri Feb 19 23:50:33 2010 +0200
@@ -101,6 +101,12 @@
* @param aNewStateId new host state
*/
void ChangeHostStateL(TUsbStateIds aNewStateId);
+
+ /**
+ * Handles special situation (error, or something else)
+ * @param aWhat to hande (id)
+ */
+ virtual void HandleL(TInt aWhat, TUsbStateIds aWhereTohandle);
private:
--- a/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Feb 19 23:50:33 2010 +0200
@@ -20,6 +20,7 @@
#define C_USBSTATEHOSTABASE_H
#include "cusbstate.h"
+#include "definitions.h"
class CUsbOtgWatcher;
/**
@@ -47,12 +48,6 @@
*/
void ConstructL();
- /**
- * Handles special situation (error, or something else)
- * @param aWhat to hande (id)
- */
- virtual void HandleL(TInt aWhat);
-
//from CUsbState
// From VBus observer
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* 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
+#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
+
+/**
+ * This class implements behaviour when some problem needs vbus drop in a while, and mostly, user action.
+ *
+ */
+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
+ {
+ friend class CtUsbOtgWatcher;
+ friend class CUsbOtgWatcher;
+
+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);
+
+ // From VBus observer
+ /**
+ * VBus down
+ */
+ void VBusUpL();
+ /**
+ * VBus down
+ */
+ void VBusDownL();
+ /**
+ * VBus error happened
+ */
+ void VBusErrorL();
+
+ // From OTG state observer
+ /**
+ * VBus error happen
+ */
+ void AVBusErrorL();
+
+ // 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:
+
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+
+private:
+ // data
+
+ /**
+ * too much power timer
+ * own
+ */
+ CUsbTimer* iTooMuchPowerTimer;
+
+ /**
+ * drivers not found
+ * own
+ */
+ CUsbTimer* iDriversNotFoundTimer;
+ };
+
+#endif // C_USBSTATEHOSTHANDLE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Feb 19 23:50:33 2010 +0200
@@ -35,8 +35,7 @@
*
*/
NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbState,
- MWaitNotifierObserver,
- MUsbTimerObserver
+ MWaitNotifierObserver
// this means only one wait notifier at a time can be shown by this state, might be redesigned
{
friend class CtUsbOtgWatcher;
@@ -68,60 +67,47 @@
*/
void WaitNotifierCompletedL(TInt aFeedback);
- // From MUsbTimerObserver
- /**
- * Call back when timer expired
- * @param aTimerId timer id
- */
- void TimerElapsedL(TUsbTimerId aTimerId);
-
-private:
-
// From VBus observer
/**
* VBus down
*/
- void VBusDownL();
+ virtual void VBusUpL();
+ /**
+ * VBus down
+ */
+ virtual void VBusDownL();
+ /**
+ * VBus error happened
+ */
+ virtual void VBusErrorL();
// From OTG state observer
/**
* Became to Idle when A
*/
- void AIdleL();
+ virtual void AIdleL();
/**
* Became a Host when A
*/
- void AHostL();
+ virtual void AHostL();
/**
* Became a peripheral when A
*/
- void APeripheralL();
+ virtual void APeripheralL();
/**
* VBus error happen
*/
- void AVBusErrorL();
- /**
- * Became to Idle when B
- */
- void BIdleL();
- /**
- * Became a peripheral when B
- */
- void BPeripheralL();
- /**
- * Became a Host when B
- */
- void BHostL();
+ virtual void AVBusErrorL();
// From bus activity observer
/**
* Bus is in idle
*/
- void BusIdleL();
+ virtual void BusIdleL();
/**
* Bus active
*/
- void BusActiveL();
+ virtual void BusActiveL();
// From Host Event notification observer
/**
@@ -139,40 +125,61 @@
* Drivers successfully loaded
* @param aInfo Device event data
*/
- virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo);
+ virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo);
/**
* Drivers loaded partially
* @param aInfo Device event data
*/
- virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
+ virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
/**
* Drivers loading failed
* @param aInfo Device event data
*/
- virtual void DriverLoadFailureL(TDeviceEventInformation aInfo);
+ virtual void DriverLoadFailureL(TDeviceEventInformation aInfo);
// From message notification observer
/**
* Message received
* @param aMessage message id
*/
- void MessageNotificationReceivedL(TInt aMessage);
- /**
- * Connected to hub in wrong level
- */
- void BadHubPositionL();
- /**
- * VBus error happened
- */
- void VBusErrorL();
+ virtual void MessageNotificationReceivedL(TInt aMessage);
+
/**
* SRP request received
*/
- void SrpReceivedL();
+ virtual void SrpReceivedL();
/**
* Session request received
*/
- void SessionRequestedL();
+ 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
+ * trigger it and transition will not happen. This forces the transition in such cases.
+ *
+ */
+ virtual void JustAdvancedToThisStateL();
+
+ /**
+ * This is called when leaving this state,
+ *
+ */
+ virtual void JustBeforeLeavingThisStateL();
+
+ /**
+ * handles issue
+ */
+ virtual void DoHandleL();
+
+protected:
/**
* Default constructor
@@ -185,33 +192,7 @@
*/
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();
-
- /**
- * This is called when leaving this state,
- *
- */
- void JustBeforeLeavingThisStateL();
-
- /**
- * handles issue
- */
- void DoHandleL();
-
-private:
+protected:
// data
/**
@@ -219,17 +200,6 @@
*/
TInt iWhat;
- /**
- * too much power timer
- * own
- */
- CUsbTimer* iTooMuchPowerTimer;
-
- /**
- * drivers not found
- * own
- */
- CUsbTimer* iDriversNotFoundTimer;
};
#endif // C_USBSTATEHOSTHANDLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* 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
+
+/**
+ * This class implements behaviour in undefined state (when host)
+ *
+ */
+NONSHARABLE_CLASS( CUsbStateHostUndefined ) : public CUsbStateHostABase
+ {
+ public:
+
+ /**
+ * Destruction
+ */
+ virtual ~CUsbStateHostUndefined();
+
+ /**
+ * 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);
+
+ /**
+ * 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();
+
+ /**
+ * Id Pin OFF
+ */
+ void IdPinOffL();
+ /**
+ * Id Pin On
+ */
+ void IdPinOnL();
+
+ // 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);
+
+private:
+ // data
+ };
+
+#endif // C_USBSTATEHOSTUNDEFINED_H
--- a/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Feb 19 23:50:33 2010 +0200
@@ -80,13 +80,13 @@
* Adds observer to a list
* @param aObserver observer
*/
- void SubscribeL(MUsbVBusObserver* aObserver);
+ void SubscribeL(MUsbVBusObserver& aObserver);
/**
* removes observer from list
* @param aObserver observer
*/
- void UnsubscribeL(MUsbVBusObserver* aObserver);
+ void UnsubscribeL(MUsbVBusObserver& aObserver);
private:
--- a/usbengines/usbotgwatcher/inc/definitions.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/definitions.h Fri Feb 19 23:50:33 2010 +0200
@@ -38,14 +38,15 @@
*/
enum TUsbStateIds
{
- EUsbStateUndefined,
+ EUsbStateHostUndefined,
EUsbStateHostAInitiate,
EUsbStateHostAHost,
EUsbStateHostAPeripheral,
EUsbStateHostAIdle,
- EUsbStateHostHandle
+ EUsbStateHostHandle,
+ EUsbStateHostDelayHandle
};
const TInt KUsbWatcherPeripheralIsNotConnected = 0; // means not(KUsbWatcherPeripheralIsConnected)
--- a/usbengines/usbotgwatcher/inc/panic.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/panic.h Fri Feb 19 23:50:33 2010 +0200
@@ -110,7 +110,11 @@
EUnexpectedUsbServiceState, //69
EUnexpectedUsbSwitchPersonalityState, //70
- ECanNotFindUsbOtgWatcherStateObserver //71
+ ECanNotFindUsbOtgWatcherStateObserver, //71
+ ENoObserverToUnsubscribe, // 72
+ EObserverAlreadyExists, //73
+ EIdForNotDefinedStateRequested, //74
+ ECanNotFindHostEventNotificationObserver //75
};
--- a/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -89,8 +89,6 @@
CUsbBusActivityObserver::TBusActivity CUsbBusActivityObserver::BusActivity()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::BusActivity" ) );
-
TInt val(0);
TInt err = iBusActivity.Get(val);
@@ -111,11 +109,17 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver* aObserver)
+void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::SubscribeL" ) );
-
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if(KErrNotFound != iObservers.Find(&aObserver))
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) );
+ Panic(EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -129,31 +133,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver* aObserver)
+void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ TInt i(iObservers.Find(&aObserver));
+ if(KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL No observers" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindIdPinObserver);
return;
}
-
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
-
- if (aObserver == iObservers[i]) // found
- {
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL CanNotFindBusActivityObserver " ) );
- Panic(ECanNotFindBusActivityObserver);
- }
-
- if (0 == iObservers.Count()) // no items
+
+ iObservers.Remove(i);
+
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
--- a/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -84,11 +84,19 @@
// ---------------------------------------------------------------------------
//
void CUsbHostEventNotificationObserver::SubscribeL(
- MUsbHostEventNotificationObserver* aObserver)
+ MUsbHostEventNotificationObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::SubscribeL" ) );
- User::LeaveIfError(iObservers.Append(aObserver));
+ // 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;
+ }
+
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -103,34 +111,24 @@
// ---------------------------------------------------------------------------
//
void CUsbHostEventNotificationObserver::UnsubscribeL(
- MUsbHostEventNotificationObserver* aObserver)
+ MUsbHostEventNotificationObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL No observers" ) );
- return;
- }
-
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
-
- if (aObserver == iObservers[i]) // found
- {
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL CanNotFindIdPinObserver" ) );
- Panic(ECanNotFindIdPinObserver);
- }
-
- if (0 == iObservers.Count()) // no items
- {
- // cancel pending request
- Cancel();
- }
+ 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();
+ }
}
// ---------------------------------------------------------------------------
--- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -103,19 +103,24 @@
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin = %d" ), val ));
- // not found in docs clear definition of this property. Verification is needed
- return (0 == val ? EIdPinOff : EIdPinOn);
+ return (EFalse == val ? EIdPinOff : EIdPinOn);
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver* aObserver)
+void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL" ) );
-
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if(KErrNotFound != iObservers.Find(&aObserver))
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) );
+ Panic(EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -129,30 +134,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver* aObserver)
+void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL" ) );
+
+ TInt i(iObservers.Find(&aObserver));
+ if(KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL No observers" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindIdPinObserver);
return;
}
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
-
- if (aObserver == iObservers[i]) // found
- {
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL CanNotGetIdPinObserver" ) );
- Panic(ECanNotFindIdPinObserver);
- }
-
- if (0 == iObservers.Count()) // no items
+ iObservers.Remove(i);
+
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -60,13 +60,11 @@
{
if(iOtgWatcher->VBusObserver())
{
- TRAPD(err, iOtgWatcher->VBusObserver()->UnsubscribeL(this));
- err=err; // to avoid warning;
+ TRAP_IGNORE(iOtgWatcher->VBusObserver()->UnsubscribeL(*this));
}
// Unsubscribe from otg watcher states change notifications
- TRAPD(err, iOtgWatcher->UnsubscribeL(this));
- err=err; // to avoid warning;
+ TRAP_IGNORE(iOtgWatcher->UnsubscribeL(*this));
}
}
@@ -93,10 +91,10 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ConstructL" ) );
// 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);
--- a/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -22,7 +22,7 @@
#include "cusbmessagenotificationobserver.h"
-#include "definitions.h"
+#include "definitions.h"
#include "debug.h"
#include "panic.h"
@@ -85,11 +85,18 @@
// ---------------------------------------------------------------------------
//
void CUsbMessageNotificationObserver::SubscribeL(
- MUsbMessageNotificationObserver* aObserver)
+ MUsbMessageNotificationObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::SubscribeL" ) );
- User::LeaveIfError(iObservers.Append(aObserver));
+ // 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);
if (KFirst == iObservers.Count()) // first item
{
@@ -103,29 +110,19 @@
// ---------------------------------------------------------------------------
//
void CUsbMessageNotificationObserver::UnsubscribeL(
- MUsbMessageNotificationObserver* aObserver)
+ MUsbMessageNotificationObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ TInt i(iObservers.Find(&aObserver));
+ if(KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL No observers" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindMessageNotificationObserver);
return;
}
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
-
- if (aObserver == iObservers[i]) // found
- {
iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL CanNotFindMessageNotificationObserver" ) );
- Panic(ECanNotFindMessageNotificationObserver);
- }
if (0 == iObservers.Count()) // no items
{
--- a/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -108,11 +108,17 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver* aObserver)
+void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::SubscribeL" ) );
-
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if(KErrNotFound != iObservers.Find(&aObserver))
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::SubscribeL Observer already exists." ) );
+ Panic(EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -126,31 +132,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver* aObserver)
+void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::UnsubscribeL" ) );
-
- if (0 == iObservers.Count()) // no items
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::UnsubscribeL No observers" ) );
- return;
- }
-
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
-
- if (aObserver == iObservers[i]) // found
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::UnsubscribeL" ) );
+
+ TInt i(iObservers.Find(&aObserver));
+ if(KErrNotFound == i)
{
- iObservers.Remove(i);
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindOtgStateObserver);
+ return;
}
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::UnsubscribeL CanNotFindOtgStateObserver" ) );
- Panic(ECanNotFindOtgStateObserver);
- }
-
- if (0 == iObservers.Count()) // no items
+
+ iObservers.Remove(i);
+
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
--- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -28,6 +28,8 @@
#include "cusbstatehostaperipheral.h"
#include "cusbstatehostaidle.h"
#include "cusbstatehosthandle.h"
+#include "cusbstatehostdelayhandle.h"
+#include "cusbstatehostundefined.h"
#include "cusbwarningnotifier.h"
@@ -79,12 +81,13 @@
iUsbServiceControl = CUsbServiceControl::NewL(this, iUsb);
- User::LeaveIfError(iStates.Append(CUsbState::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(CUsbStateHostAIdle::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this)));
+ User::LeaveIfError(iStates.Append(CUsbStateHostDelayHandle::NewL(this)));
iIdPinObserver = CUsbIdPinObserver::NewL();
iVBusObserver = CUsbVBusObserver::NewL();
@@ -95,13 +98,18 @@
iMessageNotificationObserver = CUsbMessageNotificationObserver::NewL(
&iUsb);
- iHostState = iStates[EUsbStateUndefined];
+ 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);
- iIdPinObserver->SubscribeL(this);
+ iVBusObserver->SubscribeL(*this);
+ iOtgStateObserver->SubscribeL(*this);
+ iBusActivityObserver->SubscribeL(*this);
+ iHostEventNotificationObserver->SubscribeL(*this);
+ iMessageNotificationObserver->SubscribeL(*this);
+ iIdPinObserver->SubscribeL(*this);
if (CUsbIdPinObserver::EIdPinOn == iIdPinObserver->IdPin())
{
@@ -152,6 +160,32 @@
// delete Notif manager before VBus observer, due to USB indicator observes VBus
delete iNotifManager;
+ if(iIdPinObserver)
+ {
+ TRAP_IGNORE(iIdPinObserver->UnsubscribeL(*this));
+ }
+
+ if(iVBusObserver)
+ {
+ TRAP_IGNORE(iVBusObserver->UnsubscribeL(*this));
+ }
+ if(iOtgStateObserver)
+ {
+ TRAP_IGNORE(iOtgStateObserver->UnsubscribeL(*this));
+ }
+ if(iBusActivityObserver)
+ {
+ TRAP_IGNORE(iBusActivityObserver->UnsubscribeL(*this));
+ }
+ if(iHostEventNotificationObserver)
+ {
+ TRAP_IGNORE(iHostEventNotificationObserver->UnsubscribeL(*this));
+ }
+ if(iMessageNotificationObserver)
+ {
+ TRAP_IGNORE(iMessageNotificationObserver->UnsubscribeL(*this));
+ }
+
delete iIdPinObserver;
delete iVBusObserver;
delete iOtgStateObserver;
@@ -259,7 +293,7 @@
if (!CanStartSessionL())
{
- HandleHostProblemL(EUsbWatcherErrorInConnection);
+ HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
return;
}
@@ -267,7 +301,7 @@
if (KErrNone != err)
{
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::StartSessionL Can not start usb services. reason = %d" ), err));
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
+ HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle);
return;
}
@@ -280,11 +314,11 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf)
+void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf, TUsbStateIds aInState )
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HandleProblemL" ) );
- HostHandle()->SetWhat(aWhatKindOf);
- ChangeHostStateL(EUsbStateHostHandle);
+ HostHandle(aInState)->SetWhat(aWhatKindOf);
+ ChangeHostStateL(aInState);
}
// ---------------------------------------------------------------------------
@@ -305,18 +339,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL" ) );
- // for example, USB failed to start
- if(NULL == iHostState) return;
-
- iVBusObserver->UnsubscribeL(this);
- iOtgStateObserver->UnsubscribeL(this);
- iBusActivityObserver->UnsubscribeL(this);
- iHostEventNotificationObserver->UnsubscribeL(this);
- iMessageNotificationObserver->UnsubscribeL(this);
-
- iHostState->JustBeforeLeavingThisStateL();
-
- iHostState = NULL;
+ ChangeHostStateL(EUsbStateHostUndefined);
iNotifManager->CloseAllNotifiers();
@@ -344,7 +367,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinErrorL" ) );
__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherIdPinError);
+ HandleHostProblemL(EUsbWatcherIdPinError, EUsbStateHostHandle);
}
@@ -379,7 +402,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusObserverErrorL" ) );
__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherVBusObserverError);
+ HandleHostProblemL(EUsbWatcherVBusObserverError, EUsbStateHostHandle);
}
// From OTG state observer
@@ -468,7 +491,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::OtgStateErrorL" ) );
__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
-HandleHostProblemL(EUsbWatcherOtgStateError);
+HandleHostProblemL(EUsbWatcherOtgStateError, EUsbStateHostHandle);
}
// From bus activity observer
@@ -569,7 +592,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HostEventNotificationErrorL" ) );
__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
-HandleHostProblemL(EUsbWatcherHostEventNotificationError);
+HandleHostProblemL(EUsbWatcherHostEventNotificationError, EUsbStateHostHandle);
}
// From message notification observer
@@ -636,7 +659,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::MessageNotificationErrorL" ) );
__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherMessageNotificationError);
+ HandleHostProblemL(EUsbWatcherMessageNotificationError, EUsbStateHostHandle);
}
// ---------------------------------------------------------------------------
@@ -735,11 +758,12 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostHandle* CUsbOtgWatcher::HostHandle() const
+CUsbStateHostHandle* CUsbOtgWatcher::HostHandle(TUsbStateIds aInState) const
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HostHandle" ) );
- __ASSERT_DEBUG(iStates[EUsbStateHostHandle] != NULL, Panic(EBadState));
- return (CUsbStateHostHandle*) iStates[EUsbStateHostHandle];
+ __ASSERT_DEBUG(iStates[aInState] != NULL, Panic(EBadState));
+
+ return (CUsbStateHostHandle*) iStates[aInState];
}
// ---------------------------------------------------------------------------
@@ -883,7 +907,10 @@
default: // handle the issue
{
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
+ if(IsDeviceA()) // if there is no cable, give up
+ {
+ HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle);
+ }
return;
}
}
@@ -894,7 +921,7 @@
if (KErrNone != err)
{
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompleted Error when requesting GetServiceState = %d" ), err));
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
+ HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, EUsbStateHostHandle);
return;
}
@@ -915,12 +942,6 @@
iHostState->JustAdvancedToThisStateL(); // do any initial activity, once advanced to the state
- iVBusObserver->SubscribeL(this);
- iOtgStateObserver->SubscribeL(this);
- iBusActivityObserver->SubscribeL(this);
- iHostEventNotificationObserver->SubscribeL(this);
- iMessageNotificationObserver->SubscribeL(this);
-
break;
}
case EUsbServiceStarting:
@@ -928,12 +949,14 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL 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" ) );
// should not receive that, due to call back is called when service stopped or started
// therefore scream
+ // no break statement here
}
case EUsbServiceFatalError:
{
@@ -1014,12 +1037,13 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating states." ) );
- User::LeaveIfError(iStates.Append(CUsbState::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(CUsbStateHostAIdle::NewL(this)));
User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this)));
+ User::LeaveIfError(iStates.Append(CUsbStateHostDelayHandle::NewL(this)));
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check State()" ) );
@@ -1081,11 +1105,18 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver* aObserver)
+void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SubscribeL" ) );
- User::LeaveIfError(iOtgStateObservers.Append(aObserver));
+ // 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);
}
@@ -1093,26 +1124,16 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::UnsubscribeL(MUsbOtgWatcherStateObserver* 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
- {
+ TInt i(iOtgStateObservers.Find(&aObserver));
+ if(KErrNotFound == i)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindUsbOtgWatcherStateObserver);
+ return;
+ }
+
iOtgStateObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL CanNotGetUsbOtgStateWatcherObserver" ) );
- Panic(ECanNotFindUsbOtgWatcherStateObserver);
- }
}
--- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -182,6 +182,7 @@
TUsbServiceState serviceState;
TInt err = iUsb.GetServiceState(serviceState);
+ FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::StopL = %d; Usb service state = %d" ), err, serviceState));
if (KErrNone != err)
{
@@ -259,7 +260,6 @@
FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL iStatus %d" ), iStatus.Int()));
if (KErrNone != iStatus.Int())
{
- //User::Leave(iStatus.Int());
iObserver->UsbServiceControlReqCompletedL(iStatus.Int());
return;
}
@@ -270,7 +270,6 @@
if (KErrNone != err)
{
FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting service state %d" ), err));
- //User::Leave(err);
iObserver->UsbServiceControlReqCompletedL(err);
return;
}
@@ -308,7 +307,6 @@
if (KErrNone != err)
{
FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting PersonalityId err = %d" ), err));
- //User::Leave(err);
iObserver->UsbServiceControlReqCompletedL(err);
return;
}
@@ -337,7 +335,6 @@
FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL Requested to start personality %d. Starting it." ), iPersonalityId));
TInt personalityId = iPersonalityId;
iPersonalityId = 0; // reset
- //User::LeaveIfError(Start(personalityId));
err = StartL(personalityId);
if(KErrNone != err)
{
@@ -364,7 +361,6 @@
case EUsbServiceFatalError:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) );
- //User::Leave(KErrGeneral);
iObserver->UsbServiceControlReqCompletedL(KErrGeneral);
break;
}
@@ -383,7 +379,7 @@
TInt CUsbServiceControl::RunError(TInt aError)
{
FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunError aError %d" ), aError ));
- //TRAP_IGNORE(iObserver->UsbServiceControlReqCompletedL(aError));
+ TRAP_IGNORE(iObserver->UsbServiceControlReqCompletedL(aError));
return KErrNone;
}
--- a/usbengines/usbotgwatcher/src/cusbstate.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -66,7 +66,8 @@
//
TUsbStateIds CUsbState::Id()
{
- return EUsbStateUndefined;
+ Panic(EIdForNotDefinedStateRequested);
+ return EUsbStateHostUndefined;
}
// ---------------------------------------------------------------------------
@@ -111,6 +112,17 @@
//
// ---------------------------------------------------------------------------
//
+void CUsbState::HandleL(TInt aWhat, TUsbStateIds aWhereToHandle)
+ {
+ FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbState::HandleL aWhat = %d aWhere = %d" ), aWhat, aWhereToHandle));
+
+ iWatcher->HandleHostProblemL(aWhat, aWhereToHandle);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
void CUsbState::SetPersonalityL()
{
}
@@ -188,6 +200,7 @@
void CUsbState::VBusUpL()
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusUpL" ) );
+ Panic(EVBusUpNotExpected);
}
// From OTG state observer
--- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -88,7 +88,7 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AVBusErrorL" ) );
// No need to handle BusClearError error code, due to Bus will be dropped anyway
iWatcher->Usb().BusClearError();
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower);
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle);
}
// From bus activity observer
@@ -164,12 +164,12 @@
case KErrUsbAttachmentFailureGeneralError:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL ErrorInConnection" ) );
- HandleL(EUsbWatcherErrorInConnection);
+ HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
break;
}
// OTGDI
- //case KErrUsbOtgPeriphNotSupported: // = -6688
+ case KErrUsbOtgPeriphNotSupported: // = -6688
// USBDI
case KErrUsbRequestsPending:
@@ -196,7 +196,7 @@
case KErrUsbUnsupportedDevice:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL UnsupportedDevice" ) );
- HandleL(EUsbWatcherErrUnsupportedDevice);
+ HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle);
break;
}
default:
@@ -216,7 +216,7 @@
void CUsbStateHostABase::BadHubPositionL()
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BadHubPositionL" ) );
- HandleL(EUsbWatcherHubsNotSupported);
+ HandleL(EUsbWatcherHubsNotSupported, EUsbStateHostHandle);
}
// ---------------------------------------------------------------------------
@@ -228,7 +228,7 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::VBusErrorL" ) );
// No error code handling after BusClearError call, due to bus will be dropped anyway
iWatcher->Usb().BusClearError();
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower);
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, EUsbStateHostHandle);
}
// ---------------------------------------------------------------------------
@@ -250,20 +250,9 @@
if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes...
{
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL BusRequestError err = %d" ), err));
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
return;
}
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL Session started OK (or VBUS already UP) err = %d" ), err));
}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostABase::HandleL(TInt aWhat)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::HandleL aWhat = %d" ), aWhat));
-
- iWatcher->HandleHostProblemL(aWhat);
- }
--- a/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -104,7 +104,7 @@
err = iWatcher->Usb().BusClearError();
if (KErrNone != err)
{
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
}
}
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -101,7 +101,7 @@
if (KErrNone != err)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL EnableFunctionDriverLoading error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
return;
}
@@ -117,6 +117,7 @@
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));
@@ -125,7 +126,7 @@
err = iWatcher->Usb().BusClearError();
if (KErrNone != err)
{
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
return;
}
}
@@ -133,7 +134,7 @@
}
if (KErrNone != busReqErr)
{
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
return;
}
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -93,7 +93,7 @@
case EDeviceAttachmentTimer:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - AttachmentTimer" ) );
- HandleL(EUsbWatcherErrDandlingCable);
+ HandleL(EUsbWatcherErrDandlingCable, EUsbStateHostHandle);
break;
}
default:
@@ -177,7 +177,8 @@
// OTG device supports both hnp and srp
if(hnpSupported && srpSupported)
{
- HandleL(EUsbWatcherConnectedToOTG);
+
+ HandleL(EUsbWatcherConnectedToOTG, EUsbStateHostHandle);
return;
}
@@ -189,13 +190,13 @@
case KErrBadPower:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL TooMuchPower" ) );
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration);
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, EUsbStateHostDelayHandle);
break;
}
default:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL AttachmentError" ) );
- HandleL(EUsbWatcherErrUnsupportedDevice);
+ HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle);
break;
}
@@ -243,7 +244,7 @@
/* if (KErrNone != iUsbPersonalitySwitch->SwitchPersonalityL(aDei.iDeviceId,
KUsbPersonalityIdMS ))
{*/
- HandleL(EUsbWatcherErrDriversNotFound);
+ HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
// }
}
@@ -260,7 +261,7 @@
if (KErrNone != err)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL BusRespondSrp error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
}
}
}
@@ -288,7 +289,7 @@
if (KErrNotFound == aData)
{
// no supported or needed personality/ies in the peripheral
- HandleL(EUsbWatcherErrDriversNotFound);
+ HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
}
break;
}
@@ -306,7 +307,7 @@
case ERequestFailed:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestFailed" ) );
- HandleL(EUsbWatcherErrDriversNotFound);
+ HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
break;
}
default:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,276 @@
+/*
+* 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 "cusbstatehostdelayhandle.h"
+#ifndef STIF
+#include "cusbnotifmanager.h"
+#else
+#include "mockcusbnotifmanager.h"
+#endif
+
+#include "errors.h"
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayHandle::CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher) :
+ CUsbStateHostHandle(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+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" ) );
+
+ iTooMuchPowerTimer = CUsbTimer::NewL(this, ETooMuchPowerRequiredTimer);
+ iDriversNotFoundTimer = CUsbTimer::NewL(this, EDriversNotFoundTimer);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+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;
+ }
+ }
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+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);
+ }
+
+// From Host Event notification observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+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);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayHandle::SrpReceivedL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostDelayHandle::SrpReceivedL" ) );
+ // srp is not expected due to vbus is up in thes state
+ Panic(ESrpNotExpected);
+ }
+
+// 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);
+ }
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -44,7 +44,7 @@
//
CUsbStateHostHandle* CUsbStateHostHandle::NewL(CUsbOtgWatcher* aWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::NewL" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::NewL" ) );
CUsbStateHostHandle* self = new (ELeave) CUsbStateHostHandle(aWatcher);
CleanupStack::PushL(self);
@@ -60,10 +60,6 @@
void CUsbStateHostHandle::ConstructL()
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::ConstructL" ) );
-
- iTooMuchPowerTimer = CUsbTimer::NewL(this, ETooMuchPowerRequiredTimer);
- iDriversNotFoundTimer = CUsbTimer::NewL(this, EDriversNotFoundTimer);
-
}
// ---------------------------------------------------------------------------
@@ -74,8 +70,6 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::~CUsbStateHostHandle" ) );
- delete iTooMuchPowerTimer;
- delete iDriversNotFoundTimer;
}
// ---------------------------------------------------------------------------
@@ -107,9 +101,6 @@
//
void CUsbStateHostHandle::JustBeforeLeavingThisStateL()
{
- iTooMuchPowerTimer->Cancel();
- iDriversNotFoundTimer->Cancel();
-
iWatcher->NotifManager()->CloseAllNotifiers();
}
// ---------------------------------------------------------------------------
@@ -220,41 +211,24 @@
void CUsbStateHostHandle::DoHandleL()
{
FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL iWhat = %d" ), iWhat));
-
- if (iTooMuchPowerTimer)
- iTooMuchPowerTimer->Cancel();
-
+
+ // Drop VBus first
+ // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
+ iWatcher->Usb().BusDrop();
+
switch (iWhat)
{
- case EUsbWatcherErrDriversNotFound:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL DriversNotFound" ) );
- iDriversNotFoundTimer->After(KTimeDriversNotFound);
- break;
-
- }
case EUsbWatcherHubsNotSupported:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherHubsNotSupported" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgHubUnsupported, this);
break;
}
- case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" ) );
-
- iTooMuchPowerTimer->After(KTimeTooMuchPowerRequired);
- break;
- }
case EUsbWatcherErrDeviceRequiresTooMuchPower:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDeviceRequiresTooMuchPower" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgTooMuchPower, this);
break;
@@ -262,8 +236,6 @@
case EUsbWatcherErrUnsupportedDevice:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrUnsupportedDevice" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
break;
@@ -271,18 +243,14 @@
case EUsbWatcherConnectedToOTG:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherConnectedToOTG" ) );
-
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
+
break;
}
case EUsbWatcherErrDandlingCable:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrDandlingCable" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorAttachTimedOut, this);
break;
@@ -290,8 +258,6 @@
case EUsbWatcherNoActivity:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherNoActivity" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgUnsupportedDevice, this);
@@ -300,8 +266,6 @@
case EUsbWatcherErrorInConnection:
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherErrorInConnection" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorInConnection, this);
break;
@@ -321,15 +285,13 @@
case EUsbWatcherMessageNotificationError:
{
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()->ShowNotifierL(KUsbUiNotifOtgError,
EUsbOtgErrorInConnection, this);
break;
}
default:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL Unexpected situation to be handled" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL Unexpected situation to be handled" ) );
Panic(EUnexpectedSituationToHandle);
break;
}
@@ -337,16 +299,44 @@
}
/////////////////////////////////////////////////////////////////////////////////////
-// just ignore all the events
// 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()
@@ -356,7 +346,8 @@
}
// ---------------------------------------------------------------------------
-//
+// 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()
@@ -371,47 +362,20 @@
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" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::BIdleL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BIdleL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::BPeripheralL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BPeripheralL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::BHostL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BHostL" ) );
-
+ iWatcher->Usb().BusClearError();
}
// From bus activity observer
@@ -422,7 +386,6 @@
void CUsbStateHostHandle::BusIdleL()
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusIdleL" ) );
-
}
// ---------------------------------------------------------------------------
@@ -432,7 +395,6 @@
void CUsbStateHostHandle::BusActiveL()
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusActiveL" ) );
-
}
// From Host Event notification observer
@@ -445,14 +407,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL" ) );
- if (iTooMuchPowerTimer->IsActive() || iDriversNotFoundTimer->IsActive())
- {
- ChangeHostStateL(EUsbStateHostAInitiate);
- iWatcher->DeviceAttachedL(aDevEventInfo);
- return;
- }
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL Unexpected situation" ) );
- }
+ }
// ---------------------------------------------------------------------------
//
@@ -462,7 +417,7 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceDetachedL" ) );
- }
+ }
// ---------------------------------------------------------------------------
//
@@ -473,7 +428,7 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) );
}
-
+
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
@@ -498,37 +453,6 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbStateHostHandle::BadHubPositionL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BadHubPositionL" ) );
-
- if (iTooMuchPowerTimer->IsActive())
- {
- ChangeHostStateL(EUsbStateHostAInitiate);
- iWatcher->BadHubPositionL();
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL Unexpected situation" ) );
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::VBusErrorL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusErrorL" ) );
-
- iWatcher->Usb().BusClearError();
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusErrorL Unexpected situation" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
void CUsbStateHostHandle::MessageNotificationReceivedL(TInt)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::MessageNotificationReceivedL" ) );
@@ -543,20 +467,16 @@
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL" ) );
- if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusRespondSrp();
- if (KErrNone != err)
+ TInt err = iWatcher->Usb().BusRespondSrp();
+ FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL BusRespondSrp()=%d" ), err));
+
+ if (KErrNone != err)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL BusRespondSrp error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWhat = EUsbWatcherErrorInConnection;
+ DoHandleL();
+ return;
}
- else
- {
- ChangeHostStateL(EUsbStateHostAInitiate);
- }
- }
-
}
// ---------------------------------------------------------------------------
@@ -568,38 +488,3 @@
FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SessionRequestedL" ) );
}
-
-// From TimerObserver
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::TimerElapsedL(TUsbTimerId aTimerId)
- {
- switch (aTimerId)
- {
- case ETooMuchPowerRequiredTimer:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::TimerElapsedL - ETooMuchPowerRequiredTimer" ) );
- iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
- EUsbOtgTooMuchPowerRequired, this);
- break;
- }
- case EDriversNotFoundTimer:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::TimerElapsedL - EDriversNotFoundTimer" ) );
- // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
- iWatcher->Usb().BusDrop();
- iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
- EUsbOtgUnsupportedDevice, this);
-
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::TimerElapsedL - Unknown timer" ) );
- Panic(EWrongTimerId);
- }
- }
- }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* 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"
+
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined::CUsbStateHostUndefined(
+ CUsbOtgWatcher* aWatcher) :
+ CUsbStateHostABase(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined* CUsbStateHostUndefined::NewL(CUsbOtgWatcher* aWatcher)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::NewL" ) );
+
+ CUsbStateHostUndefined* self = new (ELeave) CUsbStateHostUndefined(aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::ConstructL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::ConstructL" ) );
+
+ CUsbStateHostABase::ConstructL();
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined::~CUsbStateHostUndefined()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostundefined::~CUsbStateHostUndefined" ) );
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbStateHostUndefined::Id()
+ {
+ return EUsbStateHostUndefined;
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+// From IdPin observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::IdPinOffL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::IdPinOffL" ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::IdPinOnL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::IdPinOnL" ) );
+ }
+
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusDownL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusDownL" ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusUpL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusUpL" ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusErrorL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::VBusErrorL" ) );
+ iWatcher->Usb().BusClearError();
+ HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
+ }
+
+// From OTG state observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::AIdleL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::AIdleL" ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::AVBusErrorL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::AVBusErrorL" ) );
+ iWatcher->Usb().BusClearError();
+ HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::BIdleL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::BIdleL" ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::BPeripheralL()
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::BPeripheralL" ) );
+ }
+
+// From host state observer
+void CUsbStateHostUndefined::DeviceDetachedL(TDeviceEventInformation /*aInfo*/)
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostUndefined::DeviceDetachedL" ) );
+ }
--- a/usbengines/usbotgwatcher/src/cusbtimer.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -76,7 +76,7 @@
{
// FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::After aMilliseconds %d, timerId=%d" ), aMilliseconds, iTimerId))
- if (IsActive()) // should we panic here? or just restart timer
+ if (IsActive())
{
Cancel();
}
--- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -85,10 +85,10 @@
//
// ---------------------------------------------------------------------------
//
-CUsbVBusObserver::TState CUsbVBusObserver::VBus() /* not const, because for some reason RProperty::Get is not const! */
+CUsbVBusObserver::TState CUsbVBusObserver::VBus() /* not const, because for some reason RProperty::Get is not const */
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus" ) );
TInt val(0);
@@ -96,13 +96,12 @@
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus CanNotGetVBusProperty" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus CanNotGetVBusProperty" ) );
Panic(ECanNotGetVBusProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus = %d" ), val ));
+ FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus = %d" ), val ));
- // not found in docs clear definition of this property. Verification is needed
return (0 == val ? EVBusDown : EVBusUp);
}
@@ -110,14 +109,20 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbVBusObserver::SubscribeL(MUsbVBusObserver* aObserver)
+void CUsbVBusObserver::SubscribeL(MUsbVBusObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL" ) );
+
+ // check if the same observer already exist in a list
+ if(KErrNotFound != iObservers.Find(&aObserver))
+ {
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL Observer already exists." ) );
+ Panic(EObserverAlreadyExists);
+ return;
+ }
- User::LeaveIfError(iObservers.Append(aObserver));
+ iObservers.AppendL(&aObserver);
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL Observer appended." ) );
-
if (KFirst == iObservers.Count()) // first item
{
iVBus.Subscribe(iStatus);
@@ -129,39 +134,24 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver* aObserver)
+void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver& aObserver)
{
FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ TInt i(iObservers.Find(&aObserver));
+ if(KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL No observers" ) );
+ FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL Observer not found." ) );
+ Panic(ECanNotFindVBusObserver);
return;
}
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- {
- ++i;
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL i = %d" ), i ));
- }
-
- if (aObserver == iObservers[i]) // found
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL Removing item" ) );
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL CanNotFindVBusObserver" ) );
- Panic(ECanNotFindVBusObserver);
- }
+ iObservers.Remove(i);
if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request, if any
Cancel();
- return;
}
}
@@ -219,6 +209,7 @@
default:
{
+ FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL WrongVBusState"));
Panic(EWrongVBusState);
}
}
--- a/usbengines/usbremotepersonality/src/csetpersonality.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbremotepersonality/src/csetpersonality.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -117,7 +117,6 @@
case KErrNone:
{
result =CRemotePersonalityHandler::ESuccess;
- iUsbWatcher->SetPreviousPersonalityOnDisconnect();
break;
}
case KErrNotFound:
--- a/usbengines/usbwatcher/inc/cusbwatcher.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbwatcher/inc/cusbwatcher.h Fri Feb 19 23:50:33 2010 +0200
@@ -170,7 +170,7 @@
* @param aPersonalityId Current personality id setting
* @return KErrNone in case of success
*/
- inline TInt WritePersonalityId( TInt aPersonalityId );
+ TInt WritePersonalityId( TInt aPersonalityId );
/**
* This method is called by the CUsbActiveState class when there is
--- a/usbengines/usbwatcher/inc/cusbwatcher.inl Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbwatcher/inc/cusbwatcher.inl Fri Feb 19 23:50:33 2010 +0200
@@ -28,14 +28,4 @@
return iSupportedPersonalities;
}
-// ----------------------------------------------------------------------------
-// Write new personality to central repository.
-// ----------------------------------------------------------------------------
-//
-inline TInt CUsbWatcher::WritePersonalityId( TInt aPersonalityId )
- {
- return iPersonalityRepository->Set( KUsbWatcherPersonality,
- aPersonalityId);
- }
-
// End of file
--- a/usbengines/usbwatcher/inc/debug.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbwatcher/inc/debug.h Fri Feb 19 23:50:33 2010 +0200
@@ -137,15 +137,16 @@
};
#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 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 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 );}
+#define PANIC( exp ) {volatile TInt err_ = exp; \
+ LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
+ User::Panic( KUsbPanicModule, err_ );}
#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -251,7 +251,7 @@
aStateOld);
break;
}
- LOG1( "Starting USB personality in device state: %d", aStateNew );
+ LOG1( "Starting USB personality in device state: %d", aStateNew );
iPersonalityHandler->StateChangeNotify( aStateOld, aStateNew );
// Check AskOnConnection setting every time
if( ( iSupportedPersonalities.Count() > 1 ) &&
@@ -1032,4 +1032,38 @@
return iOtgWatcher ? iOtgWatcher->IsDeviceA() : EFalse;
}
+// ----------------------------------------------------------------------------
+// Write new personality to central repository.
+// ----------------------------------------------------------------------------
+//
+TInt CUsbWatcher::WritePersonalityId( TInt aPersonalityId )
+ {
+ LOG_FUNC
+
+ // Save as the default personality only if it is not hidden
+ TUint32 property(0);
+ TInt ret = iUsbMan.GetPersonalityProperty( aPersonalityId, property );
+ if ( ret == KErrNone )
+ {
+ LOG2( "Personality %d property: 0x%x", aPersonalityId, property );
+ }
+ else
+ {
+ //Not fatal, treat as non-hidden
+ LOG1( "ERROR: GetPersonalityProperty = %d", ret );
+ property = 0;
+ }
+ if ( property & KUsbPersonalityPropertyHidden ) //Bitwise AND
+ {
+ LOG( "Hidden personality not saved to central repository" );
+ ret = KErrNone;
+ }
+ else
+ {
+ ret = iPersonalityRepository->Set( KUsbWatcherPersonality,
+ aPersonalityId );
+ }
+ return ret;
+ }
+
// End of file
--- a/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Tue Feb 02 00:52:37 2010 +0200
+++ b/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Fri Feb 19 23:50:33 2010 +0200
@@ -104,7 +104,7 @@
,
PERSONALITY
{
- bDeviceClass = 0xFF;
+ bDeviceClass = 0x00;
bDeviceSubClass = 0x00;
protocol = 0x00;
numConfigurations = 0x01;
Binary file usbuis/usbui/help/data/xhtml.zip has changed
--- a/usbuis/usbui/help/inc/usb.hlp.hrh Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbui/help/inc/usb.hlp.hrh Fri Feb 19 23:50:33 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -25,4 +25,4 @@
_LIT(KUSB_HLP_MAIN, "USB_HLP_MAIN"); //
_LIT(KUSB_HLP_PRINT_SETTINGS, "USB_HLP_PRINT_SETTINGS"); //
-#endif
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/bwins/usbuiapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/conf/ui_usbuiapitest.cfg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,399 @@
+/*
+* Copyright (c) 2002 - 2007 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: Test script config file
+*
+*/
+
+// USBUiApiTest Module - total ... tc
+
+// USBUiApiTest Api Tests (... tc)
+
+//[Test]
+//title Example Api Test
+//create USBUiApiTest tester
+//tester ExecuteApiTestBlock ExampleTestL API option 1 a
+//delete tester
+//[Endtest]
+
+// USB UI tests - total 14 tc
+/////////////////////
+//Ovi->MS
+[Test]
+title Change USB Connection Ovi Suite to MS Manual/KeyDown
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MS
+delete tester
+[Endtest]
+
+[Test]
+title Change USB Connection Ovi Suite to MS Manual/KeyUp
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyUpArrow //OVI
+pause 500
+presskey global EKeyUpArrow //MODEM
+pause 500
+presskey global EKeyUpArrow //MTP
+pause 500
+presskey global EKeyUpArrow //MS
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MS
+delete tester
+[Endtest]
+/////////////////////////
+//Ovi->MTP
+[Test]
+title Change USB Connection Ovi Suite to MTP Manual/KeyUp
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyUpArrow //OVI
+pause 500
+presskey global EKeyUpArrow //MODEM
+pause 500
+presskey global EKeyUpArrow //MTP
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MTP
+delete tester
+[Endtest]
+
+[Test]
+title Change USB Connection Ovi Suite to MTP Manual/KeyDown
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyDownArrow //MTP
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MTP
+delete tester
+[Endtest]
+/////////////////////////
+//MS->Ovi
+[Test]
+title Change USB Connection MS to Ovi Suite Manual
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MS
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyUpArrow //OVI
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF PCSUITE
+delete tester
+[Endtest]
+/////////////////////////
+//MS->MTP
+[Test]
+title Change USB Connection MS to MTP Manual
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MS
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyDownArrow //MTP
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MTP
+delete tester
+[Endtest]
+/////////////////////////
+//MTP->Ovi
+[Test]
+title Change USB Connection MTP to Ovi Suite Manual/KeyDown
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MTP
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF PCSUITE
+delete tester
+[Endtest]
+/////////////////////////
+//MTP->MS
+[Test]
+title Change USB Connection MTP to MS Manual/KeyDown
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MTP
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MS
+delete tester
+[Endtest]
+/////////////////////////
+//OVI->MODEM
+[Test]
+title Change USB Connection OVI to Modem Manual/KeyDown
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyDownArrow //MTP
+pause 500
+presskey global EKeyDownArrow //MODEM
+pause 500
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MODEM
+delete tester
+[Endtest]
+/////////////////////////
+//MODEM->OVI
+[Test]
+title Change USB Connection Modem to MS Options Menu/KeyUp
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MODEM
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyUpArrow //OVI
+pause 500
+presskey global EKeyUpArrow //MODEM
+pause 500
+presskey global EKeyUpArrow //MTP
+pause 500
+presskey global EKeyUpArrow //MS
+pause 500
+presskey global EKeyDevice0
+pause 1000
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MS
+delete tester
+[Endtest]
+/////////////////////////
+//Change In Options Menu
+//MS->MTP
+[Test]
+title Change USB Connection MS to MTP Change In Options Menu
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MS
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyDownArrow //MTP
+pause 500
+presskey global EKeyDevice0
+pause 2000
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MTP
+delete tester
+[Endtest]
+/////////////////////////
+//MTP->Ovi
+[Test]
+title Change USB Connection MTP to Ovi Suite Change In Options Menu
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF MTP
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDevice0
+pause 2000
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF PCSUITE
+delete tester
+[Endtest]
+/////////////////////////
+//Ovi->MS
+[Test]
+title Change USB Connection Ovi Suite to MS Change In Options Menu
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDownArrow //MS
+pause 500
+presskey global EKeyDevice0
+pause 2000
+presskey global EKeyEnter
+pause 1000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest USB_CONN_MODE OFF MS
+delete tester
+[Endtest]
+/////////////////////////
+//Exit
+[Test]
+title USB Application Exit/Device Key 1 Exit
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDevice1
+pause 2000
+tester ExecuteApiTestBlock FinishTest CANCELLED
+delete tester
+[Endtest]
+/////////////////////////
+//OPTIONS Cancel / EXIT
+[Test]
+title USB Application Cancelled/Options Key 1 Exit
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDevice0 //OPTIONS
+pause 500
+presskey global EKeyDevice1 //CANCEL OPTIONS
+pause 500
+presskey global EKeyDevice1 //EXIT
+pause 2000
+tester ExecuteApiTestBlock FinishTest CANCELLED
+delete tester
+[Endtest]
+/////////////////////////
+//EXIT WHEN NOT SELECTED
+[Test]
+title USB Application Exit/Options Menu Exit nothing selected
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDevice0 //OPTIONS/HELP
+pause 500
+presskey global EKeyDownArrow //EXIT
+pause 500
+presskey global EKeyDevice0 //SELECT EXIT
+pause 2000
+tester ExecuteApiTestBlock FinishTest CANCELLED
+delete tester
+[Endtest]
+/////////////////////////
+//EXIT WHEN SELECTED
+[Test]
+title USB Application Exit/Options Menu Exit Ovi Suite selected
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDownArrow //OVI
+pause 500
+presskey global EKeyDevice0 //OPTIONS/SELECT
+pause 500
+presskey global EKeyDownArrow //Help
+pause 500
+presskey global EKeyDownArrow //EXIT
+pause 500
+presskey global EKeyDevice0 //SELECT EXIT
+pause 2000
+tester ExecuteApiTestBlock FinishTest CANCELLED
+delete tester
+[Endtest]
+/////////////////////////
+//Help
+[Test]
+title USB Application Help Option Entered/Key 1 Exit
+create USBUiApiTest tester
+tester ExecuteApiTestBlock LaunchUsbUiApp OFF PCSUITE
+tester ExecuteApiTestBlock TurnLightsOn
+pause 4000
+presskey global EKeyDevice0 //OPTIONS
+pause 500
+presskey global EKeyEnter //ENTER HELP
+pause 5000
+presskey global EKeyDevice1 //KEY EXIT HELP
+pause 500
+presskey global EKeyDevice1 //KEY EXIT USB
+pause 2000
+tester ExecuteApiTestBlock FinishTest CANCELLED
+delete tester
+[Endtest]
+
+// Add new api tests here
+// ...
+
+
+// USBUiApiTest Module Tests (... tc)
+
+
+// Add new module tests here
+// ...
+
+
+// USBUiApiTest Branch Tests (... tc)
+
+
+// Add new branch tests here
+// ...
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/eabi/usbuiapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2002 - 2007 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: ?Description
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+USBUiApiTest.mmp
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_ats.bat Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,27 @@
+rem
+rem Copyright (c) 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 "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+rd /S /Q \epoc32\BUILD
+del usbuiapitest.sisx
+call bldmake bldfiles
+call abld reallyclean armv5
+call abld test build armv5
+call makesis usbuiapitest.pkg
+call signsis usbuiapitest.sis usbuiapitest.sisx x:\rd.cer x:\rd-key.pem
+
+del usbuiapitest.sis
+
+call pause
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_phone.bat Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,27 @@
+rem
+rem Copyright (c) 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 "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+rd /S /Q \epoc32\BUILD
+del usbuiapitest_phone.sisx
+call bldmake bldfiles
+call abld reallyclean armv5
+call abld test build armv5
+call makesis usbuiapitest_phone.pkg
+call signsis usbuiapitest_phone.sis usbuiapitest_phone.sisx x:\rd.cer x:\rd-key.pem
+
+del usbuiapitest_phone.sis
+
+call pause
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.mmp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002 - 2007 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: TYPE TESTSCRIPT
+*
+*/
+
+
+#if defined(__S60_)
+ // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+ #include <platform_paths.hrh>
+#endif
+
+TARGET usbuiapitest.dll
+TARGETTYPE dll
+UID 0x1000008D 0x101FB3E3
+
+CAPABILITY ALL -TCB
+
+DEFFILE usbuiapitest.def
+
+//#define ATS
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+SOURCEPATH ../src
+SOURCE usbuiapitest.cpp
+SOURCE usbuiapitestblocks.cpp
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY stiftestengine.lib
+LIBRARY centralrepository.lib
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+
+LANG SC
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.pkg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,62 @@
+;
+; 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: Installation file for STIF
+;
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"/epoc32/release/armv5/udeb/usbuiapitest.dll"-"c:/Sys/Bin/usbuiapitest.dll"
+
+"../init/usbuiapitest.ini"-"e:/testing/init/usbuiapitest.ini"
+"../conf/ui_usbuiapitest.cfg"-"e:/testing/conf/ui_usbuiapitest.cfg"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest_phone.pkg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,62 @@
+;
+; 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: Installation file for STIF
+;
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"/epoc32/release/armv5/urel/usbuiapitest.dll"-"c:/Sys/Bin/usbuiapitest.dll"
+
+"../init/usbuiapitest_phone.ini"-"c:/testframework/testframework.ini"
+"../conf/ui_usbuiapitest.cfg"-"c:/testframework/ui_usbuiapitest.cfg"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2002 - 2007 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: ?Description
+*
+*/
+
+
+
+
+#ifndef USBUIAPITEST_H
+#define USBUIAPITEST_H
+
+// INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include "coreapplicationuisdomainpskeys.h"
+#include <SettingsInternalCRKeys.h>
+#include <centralrepository.h>
+#include <apgcli.h>
+#include <apacmdln.h>
+#include <UsbWatcherInternalCRKeys.h>
+#include <usbpersonalityids.h>
+
+#include "USBClassChangeUI.h"
+// CONSTANTS
+_LIT( KUsbAppFileName, "usbclasschangeui" );
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+//_LIT( KUSBUiApiTestLogPath, "\\logs\\testframework\\USBUiApiTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+_LIT( KUSBUiApiTestLogPath, "e:\\testing\\stiflogs\\" );
+
+// Log file
+_LIT( KUSBUiApiTestLogFile, "USBUiApiTest.txt" );
+_LIT( KUSBUiApiTestLogFileWithTitle, "USBUiApiTest_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CUSBUiApiTest;
+
+// DATA TYPES
+//enum ?declaration
+
+enum TUSBUiApiTestResult
+ {
+ ETestCasePassed,
+ ETestCaseFailed
+ };
+
+enum TUSBAppTestOption
+ {
+ EAppCancelled = 0,
+ EAskOnConnectionSettingChanged,//1
+ EUsbConnectionModeSettingChanged//2
+ };
+
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS( TUSBUiApiTestBlockParams )
+ {
+ public:
+ TPtrC iTestBlockName;
+
+ TPtrC iTestOption1;
+ TPtrC iTestOption2;
+ TPtrC iTestOption3;
+
+ TInt iTestIntOption1;
+ TInt iTestIntOption2;
+
+ TChar iTestCharOption1;
+ TChar iTestCharOption2;
+ };
+
+/**
+* CUSBUiApiTest test class for STIF Test Framework TestScripter.
+* ?other_description_lines
+*
+* @lib ?library
+* @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CUSBUiApiTest ) : public CScriptBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CUSBUiApiTest* NewL( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUSBUiApiTest();
+
+ public: // New functions
+
+ /**
+ * ?member_description.
+ * @since ?Series60_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ public: // Functions from base classes
+
+ /**
+ * From CScriptBase Runs a script line.
+ * @since ?Series60_version
+ * @param aItem Script line containing method name and parameters
+ * @return Symbian OS error code
+ */
+ virtual TInt RunMethodL( CStifItemParser& aItem );
+
+ protected: // New functions
+
+ /**
+ * ?member_description.
+ * @since ?Series60_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ protected: // Functions from base classes
+
+ /**
+ * From ?base_class ?member_description
+ */
+ //?type ?member_function();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CUSBUiApiTest( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // ?classname( const ?classname& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // ?classname& operator=( const ?classname& );
+
+ /**
+ * Frees all resources allocated from test methods.
+ * @since ?Series60_version
+ */
+ void Delete();
+
+ /**
+ * Test methods are listed below.
+ */
+
+ virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
+ virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
+ virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
+
+ /**
+ * Method used to log version of test class
+ */
+ void SendTestClassVersion();
+
+ //ADD NEW METHOD DEC HERE
+ //[TestMethods] - Do not remove
+
+ void GetTestBlockParamsL( CStifItemParser& aItem );
+
+ void DoExecuteApiTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult );
+ void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult );
+ void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult );
+
+ void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
+ TInt aTestIntOption, TInt aTestCharOption, TUSBUiApiTestResult& aTestResult );
+
+ virtual TInt LaunchUsbUiApp( TPtrC aTestOption, TPtrC aTestSubOption, TUSBUiApiTestResult& aTestResult );
+ virtual TInt FinishTest( TPtrC aTestOption, TPtrC aTestSubOption, TPtrC aTestSubOption2, TUSBUiApiTestResult& aTestResult );
+ TInt GetTestOption( TPtrC aOptionString, TUSBAppTestOption& aOption );
+ TInt GetAskOnConnectionOptionFromString( TPtrC aOptionString, TInt& aOption );
+ TInt GetUsbPersonalityOptionFromString( TPtrC aOptionString, TInt& aOption );
+ TBool IsUsbAppRunning();
+ TInt GetUsbSettings( TInt& aUsbPersinalityId, TInt& aAskOnConnectionSetting );
+ TInt SetUsbSettings( TInt aUsbPersinalityId, TInt aAskOnConnectionSetting );
+
+ TInt TurnLightsOn( );
+
+
+
+ inline void Trace(TRefByValue<const TDesC8> aFmt, ...);
+ inline void Trace(TRefByValue<const TDesC16> aFmt, ...);
+
+ public: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ protected: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ private: // Data
+ TUSBUiApiTestBlockParams iTestBlockParams;
+
+ RApaLsSession iApaLsSession;
+
+ CApaCommandLine *iCommandLine;
+ CRepository *iRepository;
+
+ TSecureId iUsbAppSecureId;
+ TInt iAskOnConnectionSettingBackup;
+ TInt iUsbPersonalityBackup;
+ TInt iTestAskOnConnectionSetting;
+ TInt iTestUsbPersonality;
+
+ public: // Friend classes
+ //?friend_class_declaration;
+ protected: // Friend classes
+ //?friend_class_declaration;
+ private: // Friend classes
+ //?friend_class_declaration;
+
+ };
+
+#include "USBUiApiTestDebug.inl"
+
+#endif // USBUIAPITEST_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+#include <e32debug.h>
+
+NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+ {
+public:
+ void Overflow(TDes8& /*aDes*/) {}
+ };
+
+NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+ {
+public:
+ void Overflow(TDes16& /*aDes*/) {}
+ };
+
+
+_LIT8(KStifTestPrefix8, "[STIF_LOG] ");
+_LIT(KStifTestPrefix, "[STIF_LOG] ");
+
+const TInt KMaxLogLineLength = 512;
+
+#define TRACE_INFO(p) { Trace p; }
+
+void CUSBUiApiTest::Trace(TRefByValue<const TDesC8> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list, aFmt);
+ TOverflowTruncate8 overflow;
+ RBuf8 buf8;
+ buf8.Create( KMaxLogLineLength );
+ buf8.Append( KStifTestPrefix8 );
+ buf8.AppendFormatList(aFmt, list, &overflow);
+
+ RBuf16 buf16;
+ buf16.Create( KMaxLogLineLength );
+ buf16.Copy(buf8);
+ TRefByValue<const TDesC> tmpFmt(_L("%S"));
+ RDebug::Print(tmpFmt, &buf16);
+ iLog->Log(tmpFmt, &buf16);
+ buf8.Close();
+ buf16.Close();
+ };
+
+void CUSBUiApiTest::Trace(TRefByValue<const TDesC16> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list,aFmt);
+ RBuf16 theFinalString;
+ theFinalString.Create( KMaxLogLineLength );
+ theFinalString.Append( KStifTestPrefix );
+ TOverflowTruncate16 overflow;
+ theFinalString.AppendFormatList(aFmt,list,&overflow);
+ RDebug::Print(theFinalString);
+ iLog->Log(theFinalString);
+ theFinalString.Close();
+ };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,235 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# 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:
+#
+#
+
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+# - Set Test Reporting mode. TestReportMode's possible values are:
+# + 'Summary': Summary of the tested test cases.
+# + 'Environment': Hardware and software info.
+# + 'TestCases': Test case report.
+# + 'FullReport': Set of all above ones.
+# + Example 'TestReportMode= Summary TestCases'
+#
+# - CreateTestReport setting controls report creation mode
+# + YES, Test report will created.
+# + NO, No Test report.
+#
+# - File path indicates the base path of the test report.
+# - File name indicates the name of the test report.
+#
+# - File format indicates the type of the test report.
+# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
+# + HTML, Test report will be html type, for example 'TestReport.html'.
+# + XML, Test report will be xml type, for example 'TestReport.xml'.
+# Note, that xml format is available only when output is set to FILE.
+#
+# - File output indicates output source of the test report.
+# + FILE, Test report logging to file.
+# + RDEBUG, Test report logging to using rdebug.
+#
+# - File Creation Mode indicates test report overwriting if file exist.
+# + OVERWRITE, Overwrites if the Test report file exist.
+# + APPEND, Continue logging after the old Test report information if
+# report exist.
+# - Sets a device reset module's dll name(Reboot).
+# + If Nokia specific reset module is not available or it is not correct one
+# StifHWResetStub module may use as a template for user specific reset
+# module.
+# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= e:\testing\logs\
+TestReportFileName= USBUiApiTest_TestReport
+
+TestReportFormat= TXT # Possible values: TXT, HTML or XML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0 # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= USBUiApiTestUSBUiApiTestUSBUiApiTest
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= e:\testing\conf\ui_USBUiApiTest.cfg
+[End_Module]
+
+
+# Load testmoduleUSBUiApiTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUSBUiApiTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUSBUiApiTest used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# Hardware and emulator environment logging path and styles can
+# be configured from here to overwrite the Logger's implemented values.
+#
+# Settings description:
+# - Indicates option for creation log directory/directories. If log directory/directories
+# is/are not created by user they will make by software.
+# + YES, Create log directory/directories if not allready exist.
+# + NO, Log directory/directories not created. Only created one is used.
+#
+# - Overwrite emulator path setting.
+# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
+# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+# will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+# - Overwrite emulator's logging format.
+# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+# - Overwrited emulator logging output source.
+# + FILE, Logging to file(s).
+# + RDEBUG, Logging to using rdebug(s).
+#
+# - Overwrite hardware path setting (Same description as above in emulator path).
+# - Overwrite hardware's logging format(Same description as above in emulator format).
+# - Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+# - File Creation Mode indicates file overwriting if file exist.
+# + OVERWRITE, Overwrites if file(s) exist.
+# + APPEND, Continue logging after the old logging information if file(s) exist.
+#
+# - Will thread id include to the log filename.
+# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+# + NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+# - Will time stamps include the to log file.
+# + YES, Time stamp added to each line in log file(s). Time stamp is
+# for example'12.Nov.2003 115958 LOGGING INFO'
+# + NO, No time stamp(s).
+#
+# - Will line breaks include to the log file.
+# + YES, Each logging event includes line break and next log event is in own line.
+# + NO, No line break(s).
+#
+# - Will event ranking include to the log file.
+# + YES, Event ranking number added to each line in log file(s). Ranking number
+# depends on environment's tics, for example(includes time stamp also)
+# '012 12.Nov.2003 115958 LOGGING INFO'
+# + NO, No event ranking.
+#
+# - Will write log file in unicode format.
+# + YES, Log file will be written in unicode format
+# + NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+#AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# If you want to use filter with ConsoleUI, simply remove comments
+# from section below and provide valid filter entries.
+# Each filter line has to start with "filter= " keyword.
+# Filter can contain special wildcard characters:
+# * which stands for none or any literal;
+# ? which stands for single character.
+# Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,235 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# 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:
+#
+#
+
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+# - Set Test Reporting mode. TestReportMode's possible values are:
+# + 'Summary': Summary of the tested test cases.
+# + 'Environment': Hardware and software info.
+# + 'TestCases': Test case report.
+# + 'FullReport': Set of all above ones.
+# + Example 'TestReportMode= Summary TestCases'
+#
+# - CreateTestReport setting controls report creation mode
+# + YES, Test report will created.
+# + NO, No Test report.
+#
+# - File path indicates the base path of the test report.
+# - File name indicates the name of the test report.
+#
+# - File format indicates the type of the test report.
+# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
+# + HTML, Test report will be html type, for example 'TestReport.html'.
+# + XML, Test report will be xml type, for example 'TestReport.xml'.
+# Note, that xml format is available only when output is set to FILE.
+#
+# - File output indicates output source of the test report.
+# + FILE, Test report logging to file.
+# + RDEBUG, Test report logging to using rdebug.
+#
+# - File Creation Mode indicates test report overwriting if file exist.
+# + OVERWRITE, Overwrites if the Test report file exist.
+# + APPEND, Continue logging after the old Test report information if
+# report exist.
+# - Sets a device reset module's dll name(Reboot).
+# + If Nokia specific reset module is not available or it is not correct one
+# StifHWResetStub module may use as a template for user specific reset
+# module.
+# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= c:\logs\testframework\USBUiApiTest\
+TestReportFileName= testreport
+
+TestReportFormat= TXT # Possible values: TXT, HTML or XML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0 # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= USBUiApiTestUSBUiApiTestUSBUiApiTest
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= c:\testframework\ui_USBUiApiTest.cfg
+[End_Module]
+
+
+# Load testmoduleUSBUiApiTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUSBUiApiTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUSBUiApiTest used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# Hardware and emulator environment logging path and styles can
+# be configured from here to overwrite the Logger's implemented values.
+#
+# Settings description:
+# - Indicates option for creation log directory/directories. If log directory/directories
+# is/are not created by user they will make by software.
+# + YES, Create log directory/directories if not allready exist.
+# + NO, Log directory/directories not created. Only created one is used.
+#
+# - Overwrite emulator path setting.
+# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
+# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+# will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+# - Overwrite emulator's logging format.
+# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+# - Overwrited emulator logging output source.
+# + FILE, Logging to file(s).
+# + RDEBUG, Logging to using rdebug(s).
+#
+# - Overwrite hardware path setting (Same description as above in emulator path).
+# - Overwrite hardware's logging format(Same description as above in emulator format).
+# - Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+# - File Creation Mode indicates file overwriting if file exist.
+# + OVERWRITE, Overwrites if file(s) exist.
+# + APPEND, Continue logging after the old logging information if file(s) exist.
+#
+# - Will thread id include to the log filename.
+# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+# + NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+# - Will time stamps include the to log file.
+# + YES, Time stamp added to each line in log file(s). Time stamp is
+# for example'12.Nov.2003 115958 LOGGING INFO'
+# + NO, No time stamp(s).
+#
+# - Will line breaks include to the log file.
+# + YES, Each logging event includes line break and next log event is in own line.
+# + NO, No line break(s).
+#
+# - Will event ranking include to the log file.
+# + YES, Event ranking number added to each line in log file(s). Ranking number
+# depends on environment's tics, for example(includes time stamp also)
+# '012 12.Nov.2003 115958 LOGGING INFO'
+# + NO, No event ranking.
+#
+# - Will write log file in unicode format.
+# + YES, Log file will be written in unicode format
+# + NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+#AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# If you want to use filter with ConsoleUI, simply remove comments
+# from section below and provide valid filter entries.
+# Each filter line has to start with "filter= " keyword.
+# Filter can contain special wildcard characters:
+# * which stands for none or any literal;
+# ? which stands for single character.
+# Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,205 @@
+/*
+* Copyright (c) 2002 - 2007 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: ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "USBUiApiTest.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+// ?value_n: ?description_line1
+// ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+ ?arg_type arg, // ?description
+ ?arg_type arg) // ?description
+ {
+
+ ?code // ?comment
+
+ // ?comment
+ ?code
+ }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::CUSBUiApiTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUSBUiApiTest::CUSBUiApiTest(
+ CTestModuleIf& aTestModuleIf ):
+ CScriptBase( aTestModuleIf )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUSBUiApiTest::ConstructL()
+ {
+ //Read logger settings to check whether test case name is to be
+ //appended to log file name.
+ RSettingServer settingServer;
+ TInt ret = settingServer.Connect();
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Struct to StifLogger settigs.
+ TLoggerSettings loggerSettings;
+ // Parse StifLogger defaults from STIF initialization file.
+ ret = settingServer.GetLoggerSettings(loggerSettings);
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Close Setting server session
+ settingServer.Close();
+
+ TFileName logFileName;
+
+ if(loggerSettings.iAddTestCaseTitle)
+ {
+ TName title;
+ TestModuleIf().GetTestCaseTitleL(title);
+ logFileName.Format(KUSBUiApiTestLogFileWithTitle, &title);
+ }
+ else
+ {
+ logFileName.Copy(KUSBUiApiTestLogFile);
+ }
+
+ iLog = CStifLogger::NewL( KUSBUiApiTestLogPath,
+ logFileName,
+ CStifLogger::ETxt,
+ CStifLogger::EFile,
+ EFalse );
+
+ SendTestClassVersion();
+
+ iCommandLine = CApaCommandLine::NewL();
+ iUsbAppSecureId = TSecureId( KUidUSBClassChangeUI );
+ iRepository = CRepository::NewL( KCRUidUsbWatcher );
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUSBUiApiTest* CUSBUiApiTest::NewL(
+ CTestModuleIf& aTestModuleIf )
+ {
+ CUSBUiApiTest* self = new (ELeave) CUSBUiApiTest( aTestModuleIf );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+
+ }
+
+// Destructor
+CUSBUiApiTest::~CUSBUiApiTest()
+ {
+
+ // Delete resources allocated from test methods
+ Delete();
+
+ // Delete logger
+ delete iLog;
+
+ }
+
+//-----------------------------------------------------------------------------
+// CUSBUiApiTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUSBUiApiTest::SendTestClassVersion()
+ {
+ TVersion moduleVersion;
+ moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+ moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+ moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+
+ TFileName moduleName;
+ moduleName = _L("USBUiApiTest.dll");
+
+ TBool newVersionOfMethod = ETrue;
+ TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL(
+ CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+ {
+
+ return ( CScriptBase* ) CUSBUiApiTest::NewL( aTestModuleIf );
+
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,701 @@
+/*
+* Copyright (c) 2002 - 2007 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: ?Description
+*
+*/
+
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "USBUiApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+// ?value_n: ?description_line1
+// ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+ ?arg_type arg, // ?description
+ ?arg_type arg) // ?description
+ {
+
+ ?code // ?comment
+
+ // ?comment
+ ?code
+ }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// -----------------------------------------------------------------------------
+//
+void CUSBUiApiTest::Delete()
+ {
+ iApaLsSession.Close();
+ delete iCommandLine;
+ iCommandLine = NULL;
+ delete iRepository;
+ iRepository = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CUSBUiApiTest::RunMethodL(
+ CStifItemParser& aItem )
+ {
+
+ static TStifFunctionInfo const KFunctions[] =
+ {
+ //ADD NEW ENTRY HERE
+ // [test cases entries] - Do not remove
+ ENTRY( "ExecuteApiTestBlock", CUSBUiApiTest::ExecuteApiTestBlock ),
+ ENTRY( "ExecuteModuleTestBlock", CUSBUiApiTest::ExecuteModuleTestBlock ),
+ ENTRY( "ExecuteBranchTestBlock", CUSBUiApiTest::ExecuteBranchTestBlock ),
+ };
+
+ const TInt count = sizeof( KFunctions ) /
+ sizeof( TStifFunctionInfo );
+
+ return RunInternalL( KFunctions, count, aItem );
+
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::GetTestBlockParamsL
+// -----------------------------------------------------------------------------
+
+void CUSBUiApiTest::GetTestBlockParamsL( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>> GetTestBlockParamsL") );
+
+ // Add new test block branches below, get all required test parameters
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );
+ User::LeaveIfError( aItem.GetNextChar( iTestBlockParams.iTestCharOption1 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "LaunchUsbUiApp" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "TurnLightsOn" ) ) )
+ {
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FinishTest" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
+ if( iTestBlockParams.iTestOption1.Compare(_L("CANCELLED")) == KErrNotFound )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption3 ) );
+ }
+ }
+ else
+ {
+ TRACE_INFO( _L("GetTestBlockParamsL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+ TRACE_INFO( _L("<<< GetTestBlockParamsL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::ExecuteApiTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::ExecuteApiTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>> ExecuteApiTestBlock") );
+
+ TInt res;
+ TUSBUiApiTestResult testResult;
+
+ TRAP( res, DoExecuteApiTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteApiTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+ TRACE_INFO( _L("<<< ExecuteApiTestBlock") );
+
+ return KErrNone;
+ }
+
+
+void CUSBUiApiTest::DoExecuteApiTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteApiTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteApiTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Api test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new API test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "LaunchUsbUiApp" ) ) )
+ {
+ LaunchUsbUiApp( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FinishTest" ) ) )
+ {
+ FinishTest( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, iTestBlockParams.iTestOption3, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "TurnLightsOn" ) ) )
+ {
+ TurnLightsOn( );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteApiTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteApiTestBlockL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::ExecuteModuleTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::ExecuteModuleTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>>ExecuteModuleTestBlock") );
+
+ TInt res;
+ TUSBUiApiTestResult testResult;
+
+ TRAP( res, DoExecuteModuleTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteModuleTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+ TRACE_INFO( _L("<<<ExecuteModuleTestBlock") );
+ return KErrNone;
+ }
+
+
+void CUSBUiApiTest::DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteModuleTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteModuleTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Module test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new module test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteModuleTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteModuleTestBlockL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::ExecuteBranchTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::ExecuteBranchTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>>ExecuteBranchTestBlock") );
+
+ TInt res;
+ TUSBUiApiTestResult testResult;
+
+ TRAP( res, DoExecuteBranchTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteBranchTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+ TRACE_INFO( _L("<<<ExecuteBranchTestBlock") );
+ return KErrNone;
+ }
+
+
+void CUSBUiApiTest::DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteBranchTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteBranchTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Branch test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new branch test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteBranchTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteBranchTestBlockL") );
+ }
+
+// Add test block methods implementation here
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::ExampleTestL
+// -----------------------------------------------------------------------------
+
+void CUSBUiApiTest::ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
+ TInt aTestIntOption, TInt aTestCharOption, TUSBUiApiTestResult& aTestResult )
+ {
+
+ if ( !aTestOption.Compare( _L( "API" ) ) )
+ {
+ TRACE_INFO( (_L("Api test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Api test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Api test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Api test char option: %c"), aTestCharOption) );
+ }
+ else if ( !aTestOption.Compare( _L( "MODULE" ) ) )
+ {
+ TRACE_INFO( (_L("Module test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Module test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Module test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Module test char option: %c"), aTestCharOption) );
+ }
+ else if ( !aTestOption.Compare( _L( "BRANCH" ) ) )
+ {
+ TRACE_INFO( (_L("Branch test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Branch test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Branch test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Branch test char option: %c"), aTestCharOption) );
+ }
+ else
+ {
+ TRACE_INFO( _L("Invalid test parameter") );
+ User::Leave( KErrNotFound );
+ }
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<ExampleTestL") );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::LaunchUsbUiApp
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::LaunchUsbUiApp( TPtrC aTestOption, TPtrC aTestSubOption, TUSBUiApiTestResult& aTestResult )
+ {
+ TInt res;
+ TInt testAskOnConnectionSetting;
+ TInt testUsbPersonalityId;
+
+ res = GetAskOnConnectionOptionFromString( aTestOption, testAskOnConnectionSetting );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetAskOnConnectionOptionFromString failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetAskOnConnectionOptionFromString OK: %d"), testAskOnConnectionSetting) );
+
+
+ res = GetUsbPersonalityOptionFromString( aTestSubOption, testUsbPersonalityId );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetUsbPersonalityOptionFromString failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetUsbPersonalityOptionFromString OK: %d"),testUsbPersonalityId) );
+
+ res = GetUsbSettings( iUsbPersonalityBackup, iAskOnConnectionSettingBackup );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to backup usb settings with value: %d"), res) );
+ return res;
+ }
+ TRACE_INFO( (_L("GetUsbSettings OK: %d, %d"), iUsbPersonalityBackup, iAskOnConnectionSettingBackup) );
+
+ res = SetUsbSettings( testUsbPersonalityId, testAskOnConnectionSetting );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Changing usb settings failed with value (cenrep): %d"), res) );
+ return res;
+ }
+ TRACE_INFO( (_L("SetUsbSettings OK: %d, %d"), testUsbPersonalityId, testAskOnConnectionSetting) );
+
+ iCommandLine->SetCommandL( EApaCommandRun );
+ iCommandLine->SetExecutableNameL( KUsbAppFileName );
+
+ res = iApaLsSession.Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Connecting to application server failed with value: %d"), res) );
+ return res;
+
+ }
+ STIF_LOG("iApaLsSession.Connect OK");
+
+ res = iApaLsSession.StartApp( *iCommandLine );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Starting application failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ STIF_LOG("iApaLsSession.StartApp OK");
+
+ if ( !IsUsbAppRunning() )
+ {
+ TRACE_INFO( _L("Usb application launch error") );
+ iApaLsSession.Close();
+ return KErrGeneral;
+ }
+ STIF_LOG("IsUsbAppRunning OK");
+
+ TRACE_INFO( _L("Usb application started") );
+
+ aTestResult = ETestCasePassed;
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::FinishTest
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::FinishTest( TPtrC aTestOption, TPtrC aTestSubOption, TPtrC aTestSubOption2, TUSBUiApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>FinishTest") );
+
+ TInt res;
+ TUSBAppTestOption option;
+ TBool isAppRunning;
+ TInt actualAskOnConnectionSetting;
+ TInt expectedAskOnConnectionSetting;
+ TInt actualPersonalityIdSetting;
+ TInt expectedPersonalityIdSetting;
+
+ res = GetTestOption( aTestOption, option );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetTestOption failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetTestOption OK: %d"),option) );
+
+ if ( option == EAskOnConnectionSettingChanged || option == EUsbConnectionModeSettingChanged )
+ {
+ res = GetAskOnConnectionOptionFromString( aTestSubOption, expectedAskOnConnectionSetting );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetAskOnConnectionOptionFromString failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetAskOnConnectionOptionFromString OK: %d"), expectedAskOnConnectionSetting) );
+
+ res = GetUsbPersonalityOptionFromString( aTestSubOption2, expectedPersonalityIdSetting );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetUsbPersonalityOptionFromString failed with value: %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetUsbPersonalityOptionFromString OK %d"), expectedPersonalityIdSetting) );
+ }
+
+ isAppRunning = IsUsbAppRunning();
+
+ res = GetUsbSettings( actualPersonalityIdSetting, actualAskOnConnectionSetting );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Getting usb settings failed with value (cenrep): %d"), res) );
+ iApaLsSession.Close();
+ return res;
+ }
+ TRACE_INFO( (_L("GetUsbSettings OK: %d, %d"), actualPersonalityIdSetting, actualAskOnConnectionSetting) );
+
+ res = SetUsbSettings( iUsbPersonalityBackup, iAskOnConnectionSettingBackup );
+ if ( res != KErrNone )
+ TRACE_INFO( _L("Failed to restore original usb settings!") );
+ TRACE_INFO( (_L("SetUsbSettings OK: %d, %d"), iUsbPersonalityBackup, iAskOnConnectionSettingBackup) );
+
+ iApaLsSession.Close();
+
+ switch( option )
+ {
+ case EAskOnConnectionSettingChanged:
+ case EUsbConnectionModeSettingChanged:
+ TRACE_INFO( (_L("Actual USB ask on connection setting value: %d, expected: %d"), actualAskOnConnectionSetting, expectedAskOnConnectionSetting) );
+ STIF_ASSERT_EQUALS( expectedAskOnConnectionSetting, actualAskOnConnectionSetting );
+ TRACE_INFO( (_L("Actual USB personality setting value: %d, expected: %d"), actualPersonalityIdSetting, expectedPersonalityIdSetting) );
+ STIF_ASSERT_EQUALS( expectedPersonalityIdSetting, actualPersonalityIdSetting );
+ TRACE_INFO( (_L("USB app is running: %d, expected: %d"), isAppRunning, EFalse) );
+ STIF_ASSERT_FALSE( isAppRunning );
+ break;
+ case EAppCancelled:
+ TRACE_INFO( (_L("USB app is running: %d, expected: %d"), isAppRunning, EFalse) );
+ STIF_ASSERT_FALSE( isAppRunning );
+ break;
+ default:
+ return KErrNotFound;
+ }
+
+ TRACE_INFO( _L("Test case passed!") );
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<FinishTest") );
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::GetTestOption
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::GetTestOption( TPtrC aOptionString, TUSBAppTestOption& aOption )
+ {
+ if ( !aOptionString.Compare( _L( "USB_CONN_MODE" ) ) )
+ {
+ aOption = EUsbConnectionModeSettingChanged;
+ TRACE_INFO( _L("Test type: EUsbConnectionModeSettingChanged") );
+ }
+ else if ( !aOptionString.Compare( _L( "ASK_ON_CONN" ) ) )
+ {
+ aOption = EAskOnConnectionSettingChanged;
+ TRACE_INFO( _L("Test type: EAskOnConnectionSettingChanged") );
+ }
+ else if ( !aOptionString.Compare( _L( "CANCELLED" ) ) )
+ {
+ aOption = EAppCancelled;
+ TRACE_INFO( _L("Test type: EAppCancelled") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Test type: not supported") );
+ return KErrNotFound;
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::GetAskOnConnectionOptionFromString
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::GetAskOnConnectionOptionFromString( TPtrC aOptionString, TInt& aOption )
+ {
+ if ( !aOptionString.Compare( _L( "ON" ) ) )
+ {
+ aOption = KUsbWatcherChangeOnConnectionOn;
+ TRACE_INFO( _L("Ask on connection option: ON") );
+ }
+ else if ( !aOptionString.Compare( _L( "OFF" ) ) )
+ {
+ aOption = KUsbWatcherChangeOnConnectionOff;
+ TRACE_INFO( _L("Ask on connection option: OFF") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Ask on connection option: not supported") );
+ return KErrNotFound;
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::GetUsbPersonalityOptionFromString
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::GetUsbPersonalityOptionFromString( TPtrC aOptionString, TInt& aOption )
+ {
+ if ( !aOptionString.Compare( _L( "PCSUITE" ) ) )
+ {
+ aOption = KUsbPersonalityIdPCSuiteMTP;
+ TRACE_INFO( _L("Usb personality option: KUsbPersonalityIdPCSuiteMTP") );
+ }
+ else if ( !aOptionString.Compare( _L( "MS" ) ) )
+ {
+ aOption = KUsbPersonalityIdMS;
+ TRACE_INFO( _L("Usb personality option: KUsbPersonalityIdMS") );
+ }
+ else if ( !aOptionString.Compare( _L( "PTP" ) ) )
+ {
+ aOption = KUsbPersonalityIdPTP;
+ TRACE_INFO( _L("Usb personality option: KUsbPersonalityIdPTP") );
+ }
+ else if ( !aOptionString.Compare( _L( "MTP" ) ) )
+ {
+ aOption = KUsbPersonalityIdMTP;
+ TRACE_INFO( _L("Usb personality option: KUsbPersonalityIdMTP") );
+ }
+ else if ( !aOptionString.Compare( _L( "MODEM" ) ) )
+ {
+ aOption = KUsbPersonalityIdModemInst;
+ TRACE_INFO( _L("Usb personality option: KUsbPersonalityIdModemInst") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Usb personality option: not supported") );
+ return KErrNotFound;
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::IsUsbAppRunning
+// -----------------------------------------------------------------------------
+
+TBool CUSBUiApiTest::IsUsbAppRunning()
+ {
+ TFindProcess processFinder;
+ TFullName processName;
+ TBool isAppRunning = EFalse;
+ RProcess matchedProcess;
+
+ while ( processFinder.Next( processName ) == KErrNone )
+ {
+ matchedProcess.Open( processFinder );
+ if ( matchedProcess.SecureId() == iUsbAppSecureId )
+ isAppRunning = ETrue;
+ }
+
+ matchedProcess.Close();
+ return isAppRunning;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::GetUsbSettings
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::GetUsbSettings( TInt& aUsbPersonalityId, TInt& aAskOnConnectionSetting )
+ {
+ TInt res;
+ res = iRepository -> Get( KUsbWatcherChangeOnConnectionSetting, aAskOnConnectionSetting );
+ if ( res != KErrNone )
+ return res;
+
+ res = iRepository -> Get( KUsbWatcherPersonality, aUsbPersonalityId );
+ if ( res != KErrNone )
+ return res;
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::SetUsbSettings
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::SetUsbSettings( TInt aUsbPersonalityId, TInt aAskOnConnectionSetting )
+ {
+ TInt res;
+ res = iRepository -> Set( KUsbWatcherChangeOnConnectionSetting, aAskOnConnectionSetting );
+ if ( res != KErrNone )
+ return res;
+
+ res = iRepository -> Set( KUsbWatcherPersonality, aUsbPersonalityId );
+ if ( res != KErrNone )
+ return res;
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUSBUiApiTest::TurnLightsOn
+// -----------------------------------------------------------------------------
+
+TInt CUSBUiApiTest::TurnLightsOn( )
+ {
+ TInt res;
+ res = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn);
+ res = RProperty::Set(KPSUidCoreApplicationUIs, KLightsVTForcedLightsOn, EForcedLightsOn);
+ return res;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// [End of File] - Do not remove
--- a/usbuis/usbuinotif/BWINS/usbuinotifu.def Tue Feb 02 00:52:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
-
--- a/usbuis/usbuinotif/EABI/usbuinotifu.def Tue Feb 02 00:52:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z13NotifierArrayv @ 1 NONAME
-
--- a/usbuis/usbuinotif/group/usbavkonnotif.mmp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbuinotif/group/usbavkonnotif.mmp Fri Feb 19 23:50:33 2010 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2005-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"
@@ -46,7 +46,6 @@
LIBRARY estor.lib // for Cover Display UI support
LIBRARY FeatMgr.lib // for fetching if Cover Display is supported
LIBRARY centralrepository.lib // Central Repository
-LIBRARY aknmemorycardui.lib // for unlocking the MMC
LIBRARY efsrv.lib // File server
LIBRARY eikcore.lib // for icons
LIBRARY aknskins.lib
--- a/usbuis/usbuinotif/group/usbuinotif.mmp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbuinotif/group/usbuinotif.mmp Fri Feb 19 23:50:33 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -67,7 +67,6 @@
LIBRARY estor.lib // for Cover Display UI support
LIBRARY FeatMgr.lib // for fetching if Cover Display is supported
LIBRARY centralrepository.lib // Central Repository
-LIBRARY aknmemorycardui.lib // for unlocking the MMC
LIBRARY efsrv.lib // File server
LIBRARY eikcore.lib // for icons
LIBRARY aknskins.lib
--- a/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Fri Feb 19 23:50:33 2010 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2005-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"
@@ -22,7 +22,6 @@
#include "usbnotifier.h" // Base class
#include <AknQueryDialog.h> // AVKON component
-#include <aknmemorycarddialog.h>
// CLASS DECLARATION
@@ -31,8 +30,7 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase,
- public MAknMemoryCardDialogObserver
+NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase
{
public:
// Constructors and destructor
@@ -47,15 +45,6 @@
*/
virtual ~CUSBUIQueriesNotifier();
-public:
- // from MAknMemoryCardDialogObserver
-
- /**
- * To be notified when unlock completed
- * @param TInt aResult
- * @return void
- */
- void UnlockComplete(TInt aResult);
private:
// Functions from base class
@@ -104,15 +93,6 @@
private:
// New functions
- /**
- * Unlock the locked memory card
- * First inform user that the memory card is locked and then show the
- * memory card dialog for unlocking.
- * @param aStringHolder The string for the query.
- * @param aCoverDialogId The dialog ID for the cover UI.
- * @return KErrNone - user accepted, KErrCancel - End call key pressed
- */
- TInt UnlockMemoryCardL(const TDesC& aStringHolder, TInt aCoverDialogId);
/**
* Show query dialog
@@ -144,8 +124,6 @@
CAknQueryDialog* iUSBQueryDlg;
TUSBUIQueries iQueryType; // To store the type of the query
TInt iDriveLetter; // For MMC locked case
- // Used for possible Cancel while the dialog is showing
- CAknMemoryCardDialog* iMemoryCardDialog;
};
#endif // USBUINQUERIESNOTIFIER_H
--- a/usbuis/usbuinotif/src/usbuinmain.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuinmain.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2005-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"
@@ -128,11 +128,7 @@
const TImplementationProxy ImplementationTable[] =
{
-#ifdef __EABI__
- {{0x10281F23},(TFuncPtr)NotifierArray},
-#else
- {{0x10281F23},NotifierArray},
-#endif
+ IMPLEMENTATION_PROXY_ENTRY( 0x10281F23, NotifierArray )
};
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
--- a/usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp Tue Feb 02 00:52:37 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -19,7 +19,6 @@
#include <w32std.h>
#include <eikenv.h>
#include <coeaui.h>
-#include <aiscutdefs.h>
#include <vwsdef.H>
@@ -27,6 +26,12 @@
#include "debug.h"
#include "usbuinotifdebug.h"
+const TUid KDiallerUid = { 0x100058B3 };
+const TUid KDiallerViewId = { 0x10282D81 };
+const TUid KDiallerViewCommand = { 0x1 };
+
+
+
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// NewL
@@ -115,8 +120,8 @@
iwsSession = CVwsSessionWrapper::NewL(*this);
}
iNotified=EFalse;
- const TVwsViewId viewId(KScutDiallerUid, KScutDiallerViewId );
- TUid msgId = KScutDiallerViewCommand;
+ const TVwsViewId viewId(KDiallerUid, KDiallerViewId );
+ TUid msgId = KDiallerViewCommand;
iwsSession->CreateActivateViewEvent( viewId, msgId, KNullDesC8 );
CCoeAppUi* appui=CEikonEnv::Static()->AppUi();
iNotify->DialerActivated();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/bmarm/usbuinotifapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/bwins/usbuinotifapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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: Test script config file
+*
+*/
+
+// UsbUiNotifApiTest Module - total 21 tc
+
+// UsbUiNotifApiTest Api Tests (... tc)
+
+// Cable connected notifier tests (3)
+
+[Test]
+title USB Ovi Suite Personality Info (Cable Connected Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock CableConnectedNotifierTest PCSUITEMTP
+pause 4000
+delete tester
+[Endtest]
+
+[Test]
+title USB MS Personality Info (Cable Connected Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock CableConnectedNotifierTest MS
+pause 4000
+delete tester
+[Endtest]
+
+[Test]
+title USB MTP Personality Info (Cable Connected Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock CableConnectedNotifierTest MTP
+pause 4000
+delete tester
+[Endtest]
+
+
+[Test]
+title USB No Memory Card Query Accepted (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBNoMemoryCard
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title USB Storage Media Failure Query Accepted/Device Key Enter Pressed (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBStorageMediaFailure
+pause 3000
+presskey global EKeyEnter
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title USB Storage Media Failure Query Accepted/Device Key 0 Pressed (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBStorageMediaFailure
+pause 1000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title USB Change From Mass Storage Query Accepted/Device Key Enter Pressed (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
+pause 3000
+presskey global EKeyEnter
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title USB Change From Mass Storage Query Accepted/Device Key 0 Pressed (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title USB Change From Mass Storage Query Cancelled (USB Queries Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
+pause 3000
+presskey global EKeyDevice1
+tester ExecuteApiTestBlock FinishQuery CANCEL
+delete tester
+[Endtest]
+
+
+[Test]
+title OTG Error too much power (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgTooMuchPower
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Error too much power (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgTooMuchPowerRequired
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Error unsupported device (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Error Hub not supported device (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgHubUnsupported
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Error error in connection (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgErrorInConnection
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Attach timed out (Otg Error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgErrorAttachTimedOut
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title OTG Partially supported device (Otg Warning Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
+pause 500
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title Load and Unload notifiers
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock LoadNotifiers
+pause 500
+tester ExecuteApiTestBlock UnLoadNotifiers
+delete tester
+[Endtest]
+
+[Test]
+title MSMM error test (MSMM error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMGeneralError
+pause 500
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title MSMM error test (MSMM error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMUnknownFileSystem
+pause 500
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+[Test]
+title MSMM error test (MSMM error Notifier Test)
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMOutOfMemory
+pause 500
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
+delete tester
+[Endtest]
+
+// Add new api tests here
+// ...
+
+
+// UsbUiNotifApiTest Module Tests (... tc)
+
+// Add new module tests here
+// ...
+
+
+// UsbUiNotifApiTest Branch Tests (... tc)
+
+// Add new branch tests here
+// ...
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/eabi/usbuinotifapitestu.def Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/bld.inf Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +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 the License "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 file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+usbuinotifapitest.mmp
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_ats.bat Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,22 @@
+@rem
+@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of the License "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: Test script config file
+@rem
+@rem
+
+
+call bldmake bldfiles
+call abld test build armv5
+call makesis usbuinotifapitest.pkg
+call signsis usbuinotifapitest.sis usbuinotifapitest.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,24 @@
+@rem
+@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of the License "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description: Test script config file
+@rem
+@rem
+
+rd /q /s x:\epoc32\BUILD
+
+call bldmake bldfiles
+call abld test build armv5
+call makesis usbuinotifapitest_phone.pkg
+call signsis usbuinotifapitest_phone.sis usbuinotifapitest_phone.sisx x:\rd.cer x:\rd-key.pem
+call pause
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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: TYPE TESTSCRIPT
+*
+*/
+
+
+#if defined(__S60_)
+ // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+ #include <platform_paths.hrh>
+#endif
+
+TARGET usbuinotifapitest.dll
+TARGETTYPE dll
+UID 0x1000008D 0x101FB3E3
+
+CAPABILITY ALL -TCB
+
+DEFFILE usbuinotifapitest.def
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+SOURCEPATH ../src
+SOURCE usbuinotifapitest.cpp
+SOURCE usbuinotifapitestblocks.cpp
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY stiftestengine.lib
+LIBRARY centralrepository.lib
+LIBRARY usbman.lib
+LIBRARY usbwatcher.lib
+LIBRARY ecom.lib
+
+LANG SC
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.pkg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,62 @@
+;
+; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Eclipse Public License v1.0"
+; 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:
+;
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"/epoc32/release/armv5/udeb/usbuinotifapitest.dll"-"c:/sys/bin/usbuinotifapitest.dll"
+
+"../init/usbuinotifapitest.ini"-"e:/testing/init/usbuinotifapitest.ini"
+"../conf/ui_usbuinotifapitest.cfg"-"e:/testing/conf/ui_usbuinotifapitest.cfg"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest_phone.pkg Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,62 @@
+;
+; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Eclipse Public License v1.0"
+; 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:
+;
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"/epoc32/release/armv5/udeb/usbuinotifapitest.dll"-"c:/sys/bin/usbuinotifapitest.dll"
+
+"../init/usbuinotifapitest_phone.ini"-"c:/testframework/testframework.ini"
+"../conf/ui_usbuinotifapitest.cfg"-"c:/testframework/ui_usbuinotifapitest.cfg"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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 USBUINOTIFAPITEST_H
+#define USBUINOTIFAPITEST_H
+
+// INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include <usbuinotif.h>
+#include <usbpersonalityids.h>
+#include <centralrepository.h>
+#include <UsbWatcherInternalCRKeys.h>
+#include <usbman.h>
+#include <usbwatcher.h>
+#include <usb/hostms/srverr.h>
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+//_LIT( KUsbUiNotifApiTestLogPath, "\\logs\\testframework\\UsbUiNotifApiTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+_LIT( KUsbUiNotifApiTestLogPath, "e:\\testing\\stiflogs\\" );
+
+// Log file
+_LIT( KUsbUiNotifApiTestLogFile, "UsbUiNotifApiTest.txt" );
+_LIT( KUsbUiNotifApiTestLogFileWithTitle, "UsbUiNotifApiTest_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CUsbUiNotifApiTest;
+
+// DATA TYPES
+//enum ?declaration
+
+enum TUsbUiNotifApiTestResult
+ {
+ ETestCasePassed,
+ ETestCaseFailed
+ };
+
+enum TTestOption
+ {
+ EQueryDiscarded = 0,
+ EQueryAccepted,
+ EQueryCanceled
+ };
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS( TUsbUiNotifApiTestBlockParams )
+ {
+ public:
+ TPtrC iTestBlockName;
+
+ TPtrC iTestOption1;
+ TPtrC iTestOption2;
+ TPtrC iTestOption3;
+
+ TInt iTestIntOption1;
+ TInt iTestIntOption2;
+
+ TChar iTestCharOption1;
+ TChar iTestCharOption2;
+ };
+
+/**
+* CUsbUiNotifApiTest test class for STIF Test Framework TestScripter.
+* ?other_description_lines
+*
+* @lib ?library
+* @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CUsbUiNotifApiTest ) : public CScriptBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CUsbUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUsbUiNotifApiTest();
+
+ public: // New functions
+
+ /**
+ * ?member_description.
+ * @since ?Series60_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ public: // Functions from base classes
+
+ /**
+ * From CScriptBase Runs a script line.
+ * @since ?Series60_version
+ * @param aItem Script line containing method name and parameters
+ * @return Symbian OS error code
+ */
+ virtual TInt RunMethodL( CStifItemParser& aItem );
+
+ protected: // New functions
+
+ /**
+ * ?member_description.
+ * @since ?Series60_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ protected: // Functions from base classes
+
+ /**
+ * From ?base_class ?member_description
+ */
+ //?type ?member_function();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CUsbUiNotifApiTest( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // ?classname( const ?classname& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // ?classname& operator=( const ?classname& );
+
+ /**
+ * Frees all resources allocated from test methods.
+ * @since ?Series60_version
+ */
+ void Delete();
+
+ /**
+ * Test methods are listed below.
+ */
+
+ virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
+ virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
+ virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
+
+
+
+ /**
+ * Method used to log version of test class
+ */
+ void SendTestClassVersion();
+
+ //ADD NEW METHOD DEC HERE
+ //[TestMethods] - Do not remove
+
+ void GetTestBlockParamsL( CStifItemParser& aItem );
+
+ void DoExecuteApiTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );
+ void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );
+ void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult );
+
+ void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
+ TInt aTestIntOption, TInt aTestCharOption, TUsbUiNotifApiTestResult& aTestResult );
+
+ void CableConnectedNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void ConnectionNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ TInt FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult );
+ void UnLoadNotifiers ( TUsbUiNotifApiTestResult& aTestResult );
+ void Update( TUsbUiNotifApiTestResult& aTestResult );
+ //void Cancelnotifier( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void Notifierstart( TUsbUiNotifApiTestResult& aTestResult );
+ //void AsyncConnectionNotifier ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+ void UsbMSMMNotifierTests ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult );
+
+ TInt GetTestOption( TPtrC aOptionString, TTestOption& aOption );
+ TInt GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId );
+ TInt GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType );
+ TInt GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType );
+ TInt GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType );
+ TInt GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType );
+
+ inline void Trace(TRefByValue<const TDesC8> aFmt, ...);
+ inline void Trace(TRefByValue<const TDesC16> aFmt, ...);
+
+ public: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ protected: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ private: // Data
+ TUsbUiNotifApiTestBlockParams iTestBlockParams;
+
+ RNotifier *iNotifier;
+ RUsbWatcher* iUsbWatcher;
+
+ CRepository* iRepository;
+
+ TUSBConnectionNotifierParamsPckg iConnectionNotifierResponseParamsPckg;
+ TRequestStatus iReqStatus;
+ TInt iPersonalityIdBackup;
+ TBool iCompleteQuery;
+ TPckg<TInt> iRes;
+ CArrayPtr<MEikSrvNotifierBase2>* iNotifierArray;
+ TUid iInstanceUid;
+ THostMsErrData iErrData;
+ THostMsErrorDataPckg iErrPckg ;
+
+ // Reserved pointer for future extension
+ //TAny* iReserved;
+
+ public: // Friend classes
+ //?friend_class_declaration;
+ protected: // Friend classes
+ //?friend_class_declaration;
+ private: // Friend classes
+ //?friend_class_declaration;
+
+ };
+
+#include "UsbUiNotifApiTestDebug.inl"
+
+#endif // USBUINOTIFAPITEST_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+#include <e32debug.h>
+
+NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+ {
+public:
+ void Overflow(TDes8& /*aDes*/) {}
+ };
+
+NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+ {
+public:
+ void Overflow(TDes16& /*aDes*/) {}
+ };
+
+
+_LIT8(KStifTestPrefix8, "[STIF_LOG] ");
+_LIT(KStifTestPrefix, "[STIF_LOG] ");
+
+const TInt KMaxLogLineLength = 512;
+
+#define TRACE_INFO(p) { Trace p; }
+
+void CUsbUiNotifApiTest::Trace(TRefByValue<const TDesC8> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list, aFmt);
+ TOverflowTruncate8 overflow;
+ RBuf8 buf8;
+ buf8.Create( KMaxLogLineLength );
+ buf8.Append( KStifTestPrefix8 );
+ buf8.AppendFormatList(aFmt, list, &overflow);
+
+ RBuf16 buf16;
+ buf16.Create( KMaxLogLineLength );
+ buf16.Copy(buf8);
+ TRefByValue<const TDesC> tmpFmt(_L("%S"));
+ RDebug::Print(tmpFmt, &buf16);
+ iLog->Log(tmpFmt, &buf16);
+ buf8.Close();
+ buf16.Close();
+ };
+
+void CUsbUiNotifApiTest::Trace(TRefByValue<const TDesC16> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list,aFmt);
+ RBuf16 theFinalString;
+ theFinalString.Create( KMaxLogLineLength );
+ theFinalString.Append( KStifTestPrefix );
+ TOverflowTruncate16 overflow;
+ theFinalString.AppendFormatList(aFmt,list,&overflow);
+ RDebug::Print(theFinalString);
+ iLog->Log(theFinalString);
+ theFinalString.Close();
+ };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,235 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# 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:
+#
+#
+
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+# - Set Test Reporting mode. TestReportMode's possible values are:
+# + 'Summary': Summary of the tested test cases.
+# + 'Environment': Hardware and software info.
+# + 'TestCases': Test case report.
+# + 'FullReport': Set of all above ones.
+# + Example 'TestReportMode= Summary TestCases'
+#
+# - CreateTestReport setting controls report creation mode
+# + YES, Test report will created.
+# + NO, No Test report.
+#
+# - File path indicates the base path of the test report.
+# - File name indicates the name of the test report.
+#
+# - File format indicates the type of the test report.
+# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
+# + HTML, Test report will be html type, for example 'TestReport.html'.
+# + XML, Test report will be xml type, for example 'TestReport.xml'.
+# Note, that xml format is available only when output is set to FILE.
+#
+# - File output indicates output source of the test report.
+# + FILE, Test report logging to file.
+# + RDEBUG, Test report logging to using rdebug.
+#
+# - File Creation Mode indicates test report overwriting if file exist.
+# + OVERWRITE, Overwrites if the Test report file exist.
+# + APPEND, Continue logging after the old Test report information if
+# report exist.
+# - Sets a device reset module's dll name(Reboot).
+# + If Nokia specific reset module is not available or it is not correct one
+# StifHWResetStub module may use as a template for user specific reset
+# module.
+# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= e:\testing\logs\
+TestReportFileName= UsbUiNotifApiTest_TestReport
+
+TestReportFormat= TXT # Possible values: TXT, HTML or XML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0 # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= UsbUiNotifApiTestUsbUiNotifApiTestUsbUiNotifApiTest
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= e:\testing\conf\ui_USBUiNotifApiTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbUiNotifApiTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbUiNotifApiTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbUiNotifApiTest used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# Hardware and emulator environment logging path and styles can
+# be configured from here to overwrite the Logger's implemented values.
+#
+# Settings description:
+# - Indicates option for creation log directory/directories. If log directory/directories
+# is/are not created by user they will make by software.
+# + YES, Create log directory/directories if not allready exist.
+# + NO, Log directory/directories not created. Only created one is used.
+#
+# - Overwrite emulator path setting.
+# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
+# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+# will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+# - Overwrite emulator's logging format.
+# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+# - Overwrited emulator logging output source.
+# + FILE, Logging to file(s).
+# + RDEBUG, Logging to using rdebug(s).
+#
+# - Overwrite hardware path setting (Same description as above in emulator path).
+# - Overwrite hardware's logging format(Same description as above in emulator format).
+# - Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+# - File Creation Mode indicates file overwriting if file exist.
+# + OVERWRITE, Overwrites if file(s) exist.
+# + APPEND, Continue logging after the old logging information if file(s) exist.
+#
+# - Will thread id include to the log filename.
+# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+# + NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+# - Will time stamps include the to log file.
+# + YES, Time stamp added to each line in log file(s). Time stamp is
+# for example'12.Nov.2003 115958 LOGGING INFO'
+# + NO, No time stamp(s).
+#
+# - Will line breaks include to the log file.
+# + YES, Each logging event includes line break and next log event is in own line.
+# + NO, No line break(s).
+#
+# - Will event ranking include to the log file.
+# + YES, Event ranking number added to each line in log file(s). Ranking number
+# depends on environment's tics, for example(includes time stamp also)
+# '012 12.Nov.2003 115958 LOGGING INFO'
+# + NO, No event ranking.
+#
+# - Will write log file in unicode format.
+# + YES, Log file will be written in unicode format
+# + NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+#AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# If you want to use filter with ConsoleUI, simply remove comments
+# from section below and provide valid filter entries.
+# Each filter line has to start with "filter= " keyword.
+# Filter can contain special wildcard characters:
+# * which stands for none or any literal;
+# ? which stands for single character.
+# Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,235 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# 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:
+#
+#
+
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+# - Set Test Reporting mode. TestReportMode's possible values are:
+# + 'Summary': Summary of the tested test cases.
+# + 'Environment': Hardware and software info.
+# + 'TestCases': Test case report.
+# + 'FullReport': Set of all above ones.
+# + Example 'TestReportMode= Summary TestCases'
+#
+# - CreateTestReport setting controls report creation mode
+# + YES, Test report will created.
+# + NO, No Test report.
+#
+# - File path indicates the base path of the test report.
+# - File name indicates the name of the test report.
+#
+# - File format indicates the type of the test report.
+# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
+# + HTML, Test report will be html type, for example 'TestReport.html'.
+# + XML, Test report will be xml type, for example 'TestReport.xml'.
+# Note, that xml format is available only when output is set to FILE.
+#
+# - File output indicates output source of the test report.
+# + FILE, Test report logging to file.
+# + RDEBUG, Test report logging to using rdebug.
+#
+# - File Creation Mode indicates test report overwriting if file exist.
+# + OVERWRITE, Overwrites if the Test report file exist.
+# + APPEND, Continue logging after the old Test report information if
+# report exist.
+# - Sets a device reset module's dll name(Reboot).
+# + If Nokia specific reset module is not available or it is not correct one
+# StifHWResetStub module may use as a template for user specific reset
+# module.
+# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= c:\logs\testframework\UsbUiNotifApiTest\
+TestReportFileName= testreport
+
+TestReportFormat= TXT # Possible values: TXT, HTML or XML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0 # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= UsbUiNotifApiTestUsbUiNotifApiTestUsbUiNotifApiTest
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= c:\testframework\ui_UsbUiNotifApiTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbUiNotifApiTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbUiNotifApiTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbUiNotifApiTest used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# Hardware and emulator environment logging path and styles can
+# be configured from here to overwrite the Logger's implemented values.
+#
+# Settings description:
+# - Indicates option for creation log directory/directories. If log directory/directories
+# is/are not created by user they will make by software.
+# + YES, Create log directory/directories if not allready exist.
+# + NO, Log directory/directories not created. Only created one is used.
+#
+# - Overwrite emulator path setting.
+# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
+# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+# will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+# - Overwrite emulator's logging format.
+# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+# - Overwrited emulator logging output source.
+# + FILE, Logging to file(s).
+# + RDEBUG, Logging to using rdebug(s).
+#
+# - Overwrite hardware path setting (Same description as above in emulator path).
+# - Overwrite hardware's logging format(Same description as above in emulator format).
+# - Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+# - File Creation Mode indicates file overwriting if file exist.
+# + OVERWRITE, Overwrites if file(s) exist.
+# + APPEND, Continue logging after the old logging information if file(s) exist.
+#
+# - Will thread id include to the log filename.
+# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+# + NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+# - Will time stamps include the to log file.
+# + YES, Time stamp added to each line in log file(s). Time stamp is
+# for example'12.Nov.2003 115958 LOGGING INFO'
+# + NO, No time stamp(s).
+#
+# - Will line breaks include to the log file.
+# + YES, Each logging event includes line break and next log event is in own line.
+# + NO, No line break(s).
+#
+# - Will event ranking include to the log file.
+# + YES, Event ranking number added to each line in log file(s). Ranking number
+# depends on environment's tics, for example(includes time stamp also)
+# '012 12.Nov.2003 115958 LOGGING INFO'
+# + NO, No event ranking.
+#
+# - Will write log file in unicode format.
+# + YES, Log file will be written in unicode format
+# + NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+#AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# If you want to use filter with ConsoleUI, simply remove comments
+# from section below and provide valid filter entries.
+# Each filter line has to start with "filter= " keyword.
+# Filter can contain special wildcard characters:
+# * which stands for none or any literal;
+# ? which stands for single character.
+# Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "UsbUiNotifApiTest.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+// ?value_n: ?description_line1
+// ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+ ?arg_type arg, // ?description
+ ?arg_type arg) // ?description
+ {
+
+ ?code // ?comment
+
+ // ?comment
+ ?code
+ }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::CUsbUiNotifApiTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbUiNotifApiTest::CUsbUiNotifApiTest(
+ CTestModuleIf& aTestModuleIf ):
+ CScriptBase( aTestModuleIf ),
+ iRes(0)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbUiNotifApiTest::ConstructL()
+ {
+ //Read logger settings to check whether test case name is to be
+ //appended to log file name.
+ RSettingServer settingServer;
+ TInt ret = settingServer.Connect();
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Struct to StifLogger settigs.
+ TLoggerSettings loggerSettings;
+ // Parse StifLogger defaults from STIF initialization file.
+ ret = settingServer.GetLoggerSettings(loggerSettings);
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Close Setting server session
+ settingServer.Close();
+
+ TFileName logFileName;
+
+ if(loggerSettings.iAddTestCaseTitle)
+ {
+ TName title;
+ TestModuleIf().GetTestCaseTitleL(title);
+ logFileName.Format(KUsbUiNotifApiTestLogFileWithTitle, &title);
+ }
+ else
+ {
+ logFileName.Copy(KUsbUiNotifApiTestLogFile);
+ }
+
+ iLog = CStifLogger::NewL( KUsbUiNotifApiTestLogPath,
+ logFileName,
+ CStifLogger::ETxt,
+ CStifLogger::EFile,
+ EFalse );
+
+ SendTestClassVersion();
+
+ iNotifier = new ( ELeave ) RNotifier();
+ iUsbWatcher = new ( ELeave ) RUsbWatcher();
+ iRepository = CRepository::NewL( KCRUidUsbWatcher );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbUiNotifApiTest* CUsbUiNotifApiTest::NewL(
+ CTestModuleIf& aTestModuleIf )
+ {
+ CUsbUiNotifApiTest* self = new (ELeave) CUsbUiNotifApiTest( aTestModuleIf );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+
+ }
+
+// Destructor
+CUsbUiNotifApiTest::~CUsbUiNotifApiTest()
+ {
+
+ // Delete resources allocated from test methods
+ Delete();
+
+ // Delete logger
+ delete iLog;
+
+ }
+
+//-----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbUiNotifApiTest::SendTestClassVersion()
+ {
+ TVersion moduleVersion;
+ moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+ moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+ moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+
+ TFileName moduleName;
+ moduleName = _L("UsbUiNotifApiTest.dll");
+
+ TBool newVersionOfMethod = ETrue;
+ TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL(
+ CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+ {
+
+ return ( CScriptBase* ) CUsbUiNotifApiTest::NewL( aTestModuleIf );
+
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Feb 19 23:50:33 2010 +0200
@@ -0,0 +1,976 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* 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:
+*
+*/
+
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <ecom/ecom.h>
+#include <Stiftestinterface.h>
+#include "UsbUiNotifApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+// ?value_n: ?description_line1
+// ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+ ?arg_type arg, // ?description
+ ?arg_type arg) // ?description
+ {
+
+ ?code // ?comment
+
+ // ?comment
+ ?code
+ }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// -----------------------------------------------------------------------------
+//
+void CUsbUiNotifApiTest::Delete()
+ {
+ iNotifier -> Close();
+ delete iNotifier;
+ iNotifier = NULL;
+ iUsbWatcher -> Close();
+ delete iUsbWatcher;
+ iUsbWatcher = NULL;
+ delete iRepository;
+ iRepository = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CUsbUiNotifApiTest::RunMethodL(
+ CStifItemParser& aItem )
+ {
+
+ static TStifFunctionInfo const KFunctions[] =
+ {
+ //ADD NEW ENTRY HERE
+ // [test cases entries] - Do not remove
+ ENTRY( "ExecuteApiTestBlock", CUsbUiNotifApiTest::ExecuteApiTestBlock ),
+ ENTRY( "ExecuteModuleTestBlock", CUsbUiNotifApiTest::ExecuteModuleTestBlock ),
+ ENTRY( "ExecuteBranchTestBlock", CUsbUiNotifApiTest::ExecuteBranchTestBlock ),
+ };
+
+ const TInt count = sizeof( KFunctions ) /
+ sizeof( TStifFunctionInfo );
+
+ return RunInternalL( KFunctions, count, aItem );
+
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetTestBlockParamsL
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::GetTestBlockParamsL( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>> GetTestBlockParamsL") );
+
+ // Add new test block branches below, get all required test parameters
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );
+ User::LeaveIfError( aItem.GetNextChar( iTestBlockParams.iTestCharOption1 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CableConnectedNotifierTest" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbQueriesNotifierTest" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FinishQuery" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbOTGErrorNotifierTests" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbOTGWarningNotifierTests" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "LoadNotifiers" ) ) )
+ {
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UnLoadNotifiers" ) ) )
+ {
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbMSMMNotifierTests" ) ) )
+ {
+ User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
+ }
+ else
+ {
+ TRACE_INFO( _L("GetTestBlockParamsL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+ TRACE_INFO( _L("<<< GetTestBlockParamsL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::ExecuteApiTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::ExecuteApiTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>> ExecuteApiTestBlock") );
+
+ TInt res;
+ TUsbUiNotifApiTestResult testResult = ETestCaseFailed;
+
+ TRAP( res, DoExecuteApiTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteApiTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+
+ TRACE_INFO( _L("<<< ExecuteApiTestBlock") );
+
+ return KErrNone;
+ }
+
+
+void CUsbUiNotifApiTest::DoExecuteApiTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteApiTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteApiTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Api test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new API test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CableConnectedNotifierTest" ) ) )
+ {
+ CableConnectedNotifierTest( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbQueriesNotifierTest" ) ) )
+ {
+ UsbQueriesNotifierTest( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FinishQuery" ) ) )
+ {
+ FinishQuery( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbQueriesNotifierTest" ) ) )
+ {
+ UsbQueriesNotifierTest( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbQueriesNotifierTest" ) ) )
+ {
+ UsbQueriesNotifierTest( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbQueriesNotifierTest" ) ) )
+ {
+ UsbQueriesNotifierTest( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbOTGErrorNotifierTests" ) ) )
+ {
+ UsbOTGErrorNotifierTests( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbOTGWarningNotifierTests" ) ) )
+ {
+ UsbOTGWarningNotifierTests( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "LoadNotifiers" ) ) )
+ {
+ LoadNotifiersL( aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UnLoadNotifiers" ) ) )
+ {
+ UnLoadNotifiers( aTestResult );
+ }
+ else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "UsbMSMMNotifierTests" ) ) )
+ {
+ UsbMSMMNotifierTests( iTestBlockParams.iTestOption2, aTestResult );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteApiTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteApiTestBlockL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::ExecuteModuleTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::ExecuteModuleTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>>ExecuteModuleTestBlock") );
+
+ TInt res;
+ TUsbUiNotifApiTestResult testResult;
+
+ TRAP( res, DoExecuteModuleTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteModuleTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+ TRACE_INFO( _L("<<<ExecuteModuleTestBlock") );
+ return KErrNone;
+ }
+
+
+void CUsbUiNotifApiTest::DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteModuleTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteModuleTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Module test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new module test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteModuleTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteModuleTestBlockL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::ExecuteBranchTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::ExecuteBranchTestBlock( CStifItemParser& aItem )
+ {
+ TRACE_INFO( _L(">>>ExecuteBranchTestBlock") );
+
+ TInt res;
+ TUsbUiNotifApiTestResult testResult;
+
+ TRAP( res, DoExecuteBranchTestBlockL( aItem, testResult ) );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("DoExecuteBranchTestBlockL error: %d"), res) );
+ return res;
+ }
+
+ STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+ TRACE_INFO( _L("Test case passed") );
+ TRACE_INFO( _L("<<<ExecuteBranchTestBlock") );
+ return KErrNone;
+ }
+
+
+void CUsbUiNotifApiTest::DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>DoExecuteBranchTestBlockL") );
+
+ User::LeaveIfError( aItem.GetString( _L( "ExecuteBranchTestBlock" ), iTestBlockParams.iTestBlockName ) );
+ TRACE_INFO( (_L("Branch test type: %S"), &iTestBlockParams.iTestBlockName) );
+
+ GetTestBlockParamsL( aItem );
+
+ // Add new branch test block branches with optional test parameters here
+ if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
+ {
+ ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
+ iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
+ }
+ else
+ {
+ TRACE_INFO( _L("DoExecuteBranchTestBlockL() Test type: not found") );
+ User::Leave( KErrNotFound );
+ }
+
+ TRACE_INFO( _L("<<<DoExecuteBranchTestBlockL") );
+ }
+
+// Add test block methods implementation here
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::ExampleTestL
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
+ TInt aTestIntOption, TInt aTestCharOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>ExampleTestL") );
+
+ if ( !aTestOption.Compare( _L( "API" ) ) )
+ {
+ TRACE_INFO( (_L("Api test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Api test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Api test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Api test char option: %c"), aTestCharOption) );
+ }
+ else if ( !aTestOption.Compare( _L( "MODULE" ) ) )
+ {
+ TRACE_INFO( (_L("Module test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Module test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Module test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Module test char option: %c"), aTestCharOption) );
+ }
+ else if ( !aTestOption.Compare( _L( "BRANCH" ) ) )
+ {
+ TRACE_INFO( (_L("Branch test option: %S"), &aTestOption) );
+ TRACE_INFO( (_L("Branch test sub-option: %S"), &aTestSubOption) );
+ TRACE_INFO( (_L("Branch test int option: %d"), aTestIntOption) );
+ TRACE_INFO( (_L("Branch test char option: %c"), aTestCharOption) );
+ }
+ else
+ {
+ TRACE_INFO( _L("Invalid test parameter") );
+ User::Leave( KErrNotFound );
+ }
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<ExampleTestL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::CableConnectedNotifierTest
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::CableConnectedNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>CableConnectedNotifierTest") );
+
+ TInt res;
+ TUSBConnectionNotifierParamsPckg emptyNotifierInputPckg;
+ TPtrC displayedUsbPersonalityName( KNullDesC );
+ TInt displayedUsbPersonalityId;
+
+ res = GetPersonalityIdFromString( aTestSubOption, displayedUsbPersonalityId );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetPersonalityIdFromString failed with value: %d"), res) );
+ return;
+ }
+
+ res = iRepository -> Get( KUsbWatcherPersonality, iPersonalityIdBackup );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Personality backup failed with value (cenrep): %d"), res) );
+ return;
+ }
+
+ res = iUsbWatcher -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect UsbWatcher with value: %d"), res) );
+ return;
+ }
+ TRACE_INFO( _L("UsbWatcher connected") );
+
+ iUsbWatcher -> SetPersonality( iReqStatus, displayedUsbPersonalityId, ETrue, ETrue );
+ User::WaitForRequest( iReqStatus );
+ if ( iReqStatus.Int() != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to set usb personality with value: %d"), iReqStatus.Int()) );
+ iUsbWatcher -> Close();
+ return;
+ }
+
+ res = iNotifier -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
+ iUsbWatcher -> Close();
+ return;
+ }
+ TRACE_INFO( _L("RNotifier connected") );
+
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KCableConnectedNotifierUid, emptyNotifierInputPckg, iConnectionNotifierResponseParamsPckg );
+ User::WaitForRequest( iReqStatus );
+
+ TRACE_INFO((_L("StartNotifierAndGetResponse Status: %d, expected: %d"), iReqStatus.Int(), KErrCancel));
+ if(iReqStatus.Int() == KErrCancel)
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<CableConnectedNotifierTest") );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::UsbQueriesNotifierTest
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>UsbQueriesNotifierTest") );
+ TInt res;
+ TUSBUIQueries usbQueryType;
+
+
+ res = GetQueryType( aTestSubOption, usbQueryType );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetQueryType failed with value: %d"), res) );
+ return;
+ }
+
+ TUSBQueriesNotiferParams notifierParams;
+ notifierParams.iDrive = 'c';
+ notifierParams.iQuery = usbQueryType;
+ TUSBQueriesNotifierParamsPckg notifierParamsPckg( notifierParams );
+ TPckgBuf<TBool> output;
+
+ res = iNotifier -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
+ return;
+ }
+ TRACE_INFO( _L("RNotifier connected") );
+
+ switch( usbQueryType )
+ {
+ case EUSBNoMemoryCard:
+ iCompleteQuery = ETrue;
+ break;
+ case EUSBStorageMediaFailure:
+ case EUSBChangeFromMassStorage:
+ iCompleteQuery = EFalse;
+ break;
+ default:
+ break;
+ }
+
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KQueriesNotifier, notifierParamsPckg, output );
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<UsbQueriesNotifierTest") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::UsbOTGErrorNotifierTests
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>UsbOTGErrorNotifierTests") );
+
+ TInt res;
+ TUsbUiNotifOtgError usbOTGErrorType;
+
+ res = GetOTGErrorType( aTestSubOption, usbOTGErrorType );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("usbOTGErrorType failed with value: %d"), res) );
+ return;
+ }
+
+ res = iNotifier -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
+ return;
+ }
+ TRACE_INFO( _L("RNotifier connected") );
+
+ TPckgBuf<TInt> notifierParamsPckg;
+ notifierParamsPckg() = usbOTGErrorType;
+ iCompleteQuery = EFalse;
+
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, notifierParamsPckg, iRes );
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<UsbOTGErrorNotifierTests") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::UsbOTGWarningNotifierTests
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>UsbOTGWarningNotifierTests") );
+
+ TInt res;
+ TUsbUiNotifOtgWarning usbOTGWarningType;
+
+
+ res = GetOTGWarningType( aTestSubOption, usbOTGWarningType );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("usbOTGErrorType failed with value: %d"), res) );
+ return;
+ }
+
+ res = iNotifier -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
+ return;
+ }
+ TRACE_INFO( _L("RNotifier connected") );
+
+ TPckgBuf<TInt> notifierParamsPckg;
+ notifierParamsPckg() = usbOTGWarningType;
+ iCompleteQuery = EFalse;
+
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgWarning, notifierParamsPckg, iRes );
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<UsbOTGWarningNotifierTests") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::UsbMSMMNotifierTests
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::UsbMSMMNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>UsbMSMMNotifierTests") );
+
+ TInt res;
+ THostMsErrCode usbMSMMNErrorType;
+
+ res = GetMSMMrrorType( aTestSubOption, usbMSMMNErrorType );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("MSMMrrorType failed with value: %d"), res) );
+ return;
+ }
+ iErrData.iError=usbMSMMNErrorType;
+ iErrPckg = iErrData;
+ res = iNotifier -> Connect();
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
+ return;
+ }
+ TRACE_INFO( _L("RNotifier connected") );
+
+ TPckgBuf<TInt> notifierParamsPckg;
+ notifierParamsPckg() = usbMSMMNErrorType;
+ iCompleteQuery = EFalse;
+
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifMsmmError, iErrPckg, iRes );
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<UsbMSMMNotifierTests") );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::FinishQuery
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>FinishQuery") );
+
+ TInt res;
+ TTestOption option;
+
+ if ( iCompleteQuery )
+ {
+ TRequestStatus* statPtr = &iReqStatus;
+ User::RequestComplete( statPtr, KErrNone );
+ }
+
+ res = GetTestOption( aTestSubOption, option );
+ if ( res != KErrNone )
+ {
+ TRACE_INFO( (_L("GetTestOption failed with value: %d"), res) );
+ iNotifier -> Close();
+ return res;
+ }
+
+ User::WaitForRequest( iReqStatus );
+ iNotifier -> Close();
+
+ switch( option )
+ {
+ case EQueryAccepted:
+ TRACE_INFO( (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone) );
+ STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() );
+ break;
+ case EQueryCanceled:
+ TRACE_INFO( (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel) );
+ STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() );
+ break;
+ default:
+ return KErrNotFound;
+ }
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<FinishQuery") );
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::LoadNotifiersL
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>LoadNotifiersL") );
+
+ iNotifierArray = reinterpret_cast<CArrayPtr<MEikSrvNotifierBase2>*>(
+ REComSession::CreateImplementationL(TUid::Uid(0x10281F23), iInstanceUid));
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<LoadNotifiersL") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::UnLoadNotifiers
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::UnLoadNotifiers ( TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>UnLoadNotifiers") );
+
+ TInt count = iNotifierArray->Count();
+ TInt i=0;
+ for (i=0; i<count; i++)
+ {
+ iNotifierArray->At(i)->Release();
+ }
+ iNotifierArray->Reset();
+ delete iNotifierArray;
+ REComSession::DestroyedImplementation(iInstanceUid);
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<UnLoadNotifiers") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::Update
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::Update( TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>Update") );
+ TInt count = iNotifierArray->Count();
+ TInt i=0;
+ _LIT8(test, "test");
+ TBuf8<32> buf(test);
+ for (i=0; i<count; i++)
+ {
+ iNotifierArray->At(i)->UpdateL(buf);
+ }
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<Update") );
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::Notifierstart
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::Notifierstart( TUsbUiNotifApiTestResult& aTestResult )
+ {
+ TRACE_INFO( _L(">>>Notifierstart") );
+ TInt count = iNotifierArray->Count();
+ TInt i=0;
+ _LIT8(test, "test");
+ TBuf8<32> buf(test);
+ for (i=0; i<count; i++)
+ {
+ iNotifierArray->At(i)->StartL(buf);
+ }
+
+ aTestResult = ETestCasePassed;
+
+ TRACE_INFO( _L("<<<Notifierstart") );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetQueryType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType )
+ {
+ TRACE_INFO( _L(">>>GetQueryType") );
+ if ( !aTypeString.Compare( _L( "EUSBNoMemoryCard" ) ) )
+ {
+ aQueryType = EUSBNoMemoryCard;
+ TRACE_INFO( _L("Query type: EUSBNoMemoryCard") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUSBStorageMediaFailure" ) ) )
+ {
+ aQueryType = EUSBStorageMediaFailure;
+ TRACE_INFO( _L("Query type: EUSBStorageMediaFailure") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUSBChangeFromMassStorage" ) ) )
+ {
+ aQueryType = EUSBChangeFromMassStorage;
+ TRACE_INFO( _L("Query type: EUSBChangeFromMassStorage") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Query type: not supported") );
+ return KErrNotFound;
+ }
+ TRACE_INFO( _L("<<<GetQueryType") );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetOTGErrorType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType )
+ {
+ TRACE_INFO( _L(">>>GetOTGErrorType") );
+
+ if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPower" ) ) )
+ {
+ aQueryType = EUsbOtgTooMuchPower;
+ TRACE_INFO( _L("Query type: EUsbOtgTooMuchPower") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPowerRequired" ) ) )
+ {
+ aQueryType = EUsbOtgTooMuchPowerRequired;
+ TRACE_INFO( _L("Query type: EUsbOtgTooMuchPowerRequired") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgUnsupportedDevice" ) ) )
+ {
+ aQueryType = EUsbOtgUnsupportedDevice;
+ TRACE_INFO( _L("Query type: EUsbOtgUnsupportedDevice") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgHubUnsupported" ) ) )
+ {
+ aQueryType = EUsbOtgHubUnsupported;
+ TRACE_INFO( _L("Query type: EUsbOtgHubUnsupported") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgErrorInConnection" ) ) )
+ {
+ aQueryType = EUsbOtgErrorInConnection;
+ TRACE_INFO( _L("Query type: EUsbOtgErrorInConnection") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgErrorAttachTimedOut" ) ) )
+ {
+ aQueryType = EUsbOtgErrorAttachTimedOut;
+ TRACE_INFO( _L("Query type: EUsbOtgErrorAttachTimedOut") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Query type: not supported") );
+ return KErrNotFound;
+ }
+
+ TRACE_INFO( _L("<<<GetOTGErrorType") );
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetOTGWarningType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType )
+ {
+ TRACE_INFO( _L(">>>GetOTGWarningType") );
+
+ if ( !aTypeString.Compare( _L( "EUsbOtgPartiallySupportedDevice" ) ) )
+ {
+ aQueryType = EUsbOtgPartiallySupportedDevice;
+ TRACE_INFO( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Query type: not supported") );
+ return KErrNotFound;
+ }
+
+ TRACE_INFO( _L("<<<GetOTGWarningType") );
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetMSMMrrorType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType )
+ {
+ TRACE_INFO( _L(">>>GetMSMMrrorType") );
+ if ( !aTypeString.Compare( _L( "EUsbMSMMGeneralError" ) ) )
+ {
+ aQueryType = EHostMsErrGeneral;
+ TRACE_INFO( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbMSMMUnknownFileSystem" ) ) )
+ {
+ aQueryType = EHostMsErrUnknownFileSystem;
+ TRACE_INFO( _L("Query type: EUsbMSMMUnknownFileSystem") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbMSMMOutOfMemory" ) ) )
+ {
+ aQueryType = EHostMsErrOutOfMemory;
+ TRACE_INFO( _L("Query type: EUsbMSMMOutOfMemory") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Query type: not supported") );
+ return KErrNotFound;
+ }
+
+ TRACE_INFO( _L("<<<GetMSMMrrorType") );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetTestOption
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption )
+ {
+ if ( !aOptionString.Compare( _L( "DISCARD" ) ) )
+ {
+ aOption = EQueryDiscarded;
+ TRACE_INFO( _L("Test type: EQueryDiscarded") );
+ }
+ else if ( !aOptionString.Compare( _L( "ACCEPT" ) ) )
+ {
+ aOption = EQueryAccepted;
+ TRACE_INFO( _L("Test type: EQueryAccepted") );
+ }
+ else if ( !aOptionString.Compare( _L( "CANCEL" ) ) )
+ {
+ aOption = EQueryCanceled;
+ TRACE_INFO( _L("Test type: EQueryCanceled") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Test type: not supported") );
+ return KErrNotFound;
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetPersonalityIdFromString
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId )
+ {
+ if ( !aOptionString.Compare( _L( "MS" ) ) )
+ {
+ aPersonalityId = KUsbPersonalityIdMS;
+ TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdMS") );
+ }
+ else if ( !aOptionString.Compare( _L( "PCSUITE" ) ) )
+ {
+ aPersonalityId = KUsbPersonalityIdPCSuite;
+ TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdPCSuite") );
+ }
+ else if ( !aOptionString.Compare( _L( "MTP" ) ) )
+ {
+ aPersonalityId = KUsbPersonalityIdMTP;
+ TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdMTP") );
+ }
+ else if ( !aOptionString.Compare( _L( "PCSUITEMTP" ) ) )
+ {
+ aPersonalityId = KUsbPersonalityIdPCSuiteMTP;
+ TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdPCSuiteMTP") );
+ }
+ else
+ {
+ TRACE_INFO( _L("Usb personality type: not found") );
+ return KErrNotFound;
+ }
+
+ return KErrNone;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// [End of File] - Do not remove