Merge fix for bug 2169.
--- a/layers.sysdef.xml Fri Mar 05 16:56:45 2010 -0800
+++ b/layers.sysdef.xml Thu Jun 24 14:30:02 2010 +0100
@@ -1,19 +1,23 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
<!ENTITY layer_real_source_path "sf/mw/usbservices" >
]>
-<SystemDefinition name="usbservices" schema="1.4.0">
+<SystemDefinition name="usbservices" schema="1.5.1">
<systemModel>
<layer name="mw_layer">
<module name="usbservices">
<unit unitID="lcdo.usbservices" mrp="" bldFile="&layer_real_source_path;/group" name="usbservices" />
</module>
- <module name="">
+ <module name="non_sf_components">
<unit unitID="lcdo.usbservices.usbclasses.usbosdescriptorhandler" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbosdescriptorhandler/group" filter="!sf_build" name="usbservices_usbclasses_usbosdescriptorhandler" />
<unit unitID="lcdo.usbservices.usbclasses.msmmplugin" mrp="" bldFile="&layer_real_source_path;/usbclasses/msmmplugin/group" filter="!sf_build" name="usbservices_usbclasses_msmmplugin" />
<unit unitID="lcdo.usbservices.usbclasses.usbhidclassdriver" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbhidclassdriver/group" filter="!sf_build" name="usbservices_usbclasses_usbhidclassdriver" />
- </module>
+ <unit unitID="lcdo.usbservices.usbuis.rndisui" mrp="" bldFile="&layer_real_source_path;/usbuis/rndisui/group" filter="!sf_build" name="usbservices_usbuis_rndisui" />
+ </module>
+ <module name="usbuiqt">
+ <unit unitID="lcdo.usbservices.usbclasses.usbuiqt" mrp="" bldFile="&layer_real_source_path;/usbuis/usbuiqt" name="usbservices_usbuis_usbapplication" proFile="usbapplication.pro" qmakeArgs="" />
+ </module>
</layer>
<layer name="api_test_layer">
<module name="usbservices_test">
--- a/package_definition.xml Fri Mar 05 16:56:45 2010 -0800
+++ b/package_definition.xml Thu Jun 24 14:30:02 2010 +0100
@@ -4,7 +4,6 @@
<collection id="usbclasses" name="USB Classes" level="framework">
<component id="usbobexclasscontroller" filter="s60" name="USB OBEX Class Controller" class="plugin">
<unit bldFile="usbclasses/usbobexclasscontroller/group"/>
- <!-- <unit bldFile="usbclasses/usbobexclasscontroller/tsrc/group"/> -->
</component>
<component id="usbbasicpersonality" filter="s60" name="USB Basic Personality" class="plugin">
<unit bldFile="usbclasses/usbbasicpersonality/group"/>
@@ -12,19 +11,12 @@
<component id="usbmscpersonality" filter="s60" name="USB MSC Personality" class="plugin">
<unit bldFile="usbclasses/usbmscpersonality/group"/>
</component>
- <component id="ptpstack" filter="s60" name="Picture Transfer Protocol Stack">
- <unit bldFile="usbclasses/ptpstack/group"/>
- </component>
- <component id="sicdusbplugin" filter="s60" name="SICD USB Plugin" class="plugin">
- <unit bldFile="usbclasses/sicdusbplugin/group"/>
- </component>
- <component id="ptpserver" filter="s60" name="Picture Transfer Protocol Server">
- <unit bldFile="usbclasses/ptpserver/group"/>
- <!-- <unit bldFile="usbclasses/ptpserver/ptpclasscontroller/group"/> -->
- </component>
<component id="pictbridgeengine" filter="s60" name="PictBridge Engine">
<unit bldFile="usbclasses/pictbridgeengine/group"/>
</component>
+ <component id="usbphoneasmodem" filter="s60" name="USB Phone as Modem" introduced="^3">
+ <unit bldFile="usbclasses/usbphoneasmodem/group"/>
+ </component>
</collection>
<collection id="usbengines" name="USB Engines" level="generic">
<component id="usbwatcher" filter="s60" name="USB Watcher">
@@ -32,7 +24,6 @@
</component>
<component id="usblocodplugin" filter="s60" name="USB Local Connectivity Domain Plugin" class="plugin">
<unit bldFile="usbengines/usblocodplugin/group"/>
- <!-- <unit bldFile="usbengines/usblocodplugin/tsrc/group"/> -->
</component>
<component id="usbdevcon" filter="s60" name="USB Device Control">
<unit bldFile="usbengines/usbdevcon/group"/>
@@ -40,15 +31,16 @@
<component id="usbremotepersonality" filter="s60" name="USB Remote Personality">
<unit bldFile="usbengines/usbremotepersonality/group"/>
</component>
+ <component id="usbotgwatcher" filter="s60" name="USB OTG Watcher" introduced="^3">
+ <unit bldFile="usbengines/usbotgwatcher/group"/>
+ </component>
</collection>
<collection id="usbuis" name="USB UIs" level="specific">
<component id="usbui" filter="s60" name="USB UI">
<unit bldFile="usbuis/usbui/group"/>
- <!-- <unit bldFile="usbuis/usbui/tsrc/usbuiapitest/group"/> -->
</component>
<component id="usbuinotif" filter="s60" name="USB UI Notifiers">
<unit bldFile="usbuis/usbuinotif/group"/>
- <!-- <unit bldFile="usbuis/usbuinotif/tsrc/usbuinotifapitest/group"/> -->
</component>
<component id="imageprintuiprovider" filter="s60" name="ImagePrint UI Provider" class="plugin">
<unit bldFile="usbuis/imageprintuiprovider/group"/>
@@ -57,5 +49,13 @@
<unit bldFile="usbuis/imageprintui/group"/>
</component>
</collection>
+ <collection id="usbservices_info" name="USB Services Info" level="plugin">
+ <component id="usbservices_plat" filter="s60" name="USB Services Platform Interfaces" class="api">
+ <unit bldFile="usbservices_plat/group"/>
+ </component>
+ <component id="usbservices_test" filter="s60,test,api_test" name="USB Services Tests">
+ <unit bldFile="tsrc/group"/>
+ </component>
+ </collection>
</package>
</SystemDefinition>
--- a/sysdef_1_4_0.dtd Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- levels CDATA #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
- name CDATA #REQUIRED
- level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- unitID ID #REQUIRED
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- bldFile CDATA #REQUIRED
- priority CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
- name CDATA #REQUIRED
- version CDATA #REQUIRED
- late (Y|N) #IMPLIED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- a/tsrc/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/tsrc/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -20,7 +20,6 @@
DEFAULT
//build files for shortlinkconn
-#include "../../../shortlinkconn/localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/group/bld.inf"
#include "../../../shortlinkconn/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf"
//build files for usb
--- a/usbclasses/usbmscpersonality/group/UsbMscPersonality.mmp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbmscpersonality/group/UsbMscPersonality.mmp Thu Jun 24 14:30:02 2010 +0100
@@ -41,11 +41,6 @@
target usbmscpersonality.rsc
end
-start resource usbms.rss
-targetpath /private/10204bbb
-header
-end
-
LIBRARY euser.lib
LIBRARY usbpersonality.lib
LIBRARY usbman.lib
--- a/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbmscpersonality/inc/CUsbActiveMscHandlerMdrv.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -415,6 +415,11 @@
TBool iMountChanged;
/**
+ * If query note shown by us
+ */
+ TBool iIsQueryNoteShown;
+
+ /**
* Used to load devenccommonutils.dll and check the device encryption status
*/
RLibrary iLibrary;
--- a/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -47,7 +47,9 @@
// ----------------------------------------------------------------------------
//
CUsbActiveMscHandler::CUsbActiveMscHandler(TUsbPersonalityParams& aPersonalityParams)
- : CUsbPersonalityPlugin(aPersonalityParams), iMountChanged(EFalse)
+ : CUsbPersonalityPlugin(aPersonalityParams),
+ iMountChanged(EFalse),
+ iIsQueryNoteShown(EFalse)
{
CActiveScheduler::Add( this );
}
@@ -256,9 +258,13 @@
RemoveMassStorageFileSystem();
- // Remove all queries shown by this personality
- iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier);
-
+ if (iIsQueryNoteShown)
+ {
+ // Remove all queries shown by this personality
+ iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier);
+ iIsQueryNoteShown = EFalse;
+ }
+
iMscState = EUsbMscStateIdle;
iRequestStatus = &aStatus;
@@ -295,6 +301,7 @@
{
if ( GlobalSystemState() == EUsbGSStateCategoryNormal )
{
+ iIsQueryNoteShown = ETrue;
// if the error is something abnormal, note still needs to be shown
iQueryParams().iQuery = EUSBStorageMediaFailure;
iPersonalityParams.PersonalityNotifier().ShowQuery(
@@ -491,6 +498,7 @@
{
FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler::GetDrives: No removable drives found." ) );
+ iIsQueryNoteShown = ETrue;
iQueryParams().iQuery = EUSBStorageMediaFailure;
iPersonalityParams.PersonalityNotifier().ShowQuery(KQueriesNotifier, iQueryParams, iDummy);
--- a/usbclasses/usbmscpersonality/src/usbms.rss Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2004 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: Resource file for the USB mass storage configuration.
-*
-*/
-
-NAME MSCF
-
-#include <badef.rh>
-#include "usbms.rh"
-
-RESOURCE BA_RSS_SIGNATURE
- {
- signature = 1;
- }
-
-RESOURCE USBMASSSTORAGE_CONFIG usbms_config
- {
- vendorId = "Nokia"; // no more than 8 characters
- productId = "S60"; // no more than 16 characters
- productRev = "1.0"; // no more than 4 characters
- }
-
--- a/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp Thu Jun 24 14:30:02 2010 +0100
@@ -28,6 +28,7 @@
SOURCEPATH ../src
SOURCE CUsbObexClassImpCollection.cpp
SOURCE CUsbObexClassController.cpp
+SOURCE obexsmwatcher.cpp
USERINCLUDE ../inc
--- a/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -23,6 +23,7 @@
#include <cusbclasscontrollerplugin.h>
#include <usbobex.h>
#include <usb/usblogger.h>
+#include "obexsmwatcher.h"
const TInt KObexClassPriority = 2;
const TInt KObexNumInterfaces = 2;
@@ -35,7 +36,7 @@
*
* @since S60 V3.1
*/
-NONSHARABLE_CLASS(CUsbObexClassController) : public CUsbClassControllerPlugIn
+NONSHARABLE_CLASS(CUsbObexClassController) : public CUsbClassControllerPlugIn, public MObexSMObserver
{
public:
/**
@@ -53,6 +54,9 @@
virtual void DoCancel();
virtual TInt RunError(TInt aError);
+// from MObexSMObserver
+ void MosmError(TInt aError);
+
// from base class CUsbClassControllerBase
/**
@@ -95,6 +99,7 @@
private: // data
TRequestStatus* iRequestStatus;
CObexUSB* iObexSM;
+ CObexSMWatcher *iObexSMWatcher;
};
#endif // CUSBOBEXCLASSCONTROLLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/inc/mobexsmwatcher.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Monitors Obex ServiceMan errors.
+*
+*/
+
+#ifndef MOBEXSMWATCHER_H
+#define MOBEXSMWATCHER_H
+
+class MObexSMObserver
+ {
+public:
+ virtual void MosmError(TInt aError) = 0;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/inc/obexsmwatcher.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Monitors Obex ServiceMan errors.
+*
+*/
+
+#ifndef COBEXSMWATCHER_H
+#define COBEXSMWATCHER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32def.h>
+#include <e32property.h> //Publish & Subscribe header
+#include "mobexsmwatcher.h"
+
+/**
+ * CObexSMWatcher class
+ * Subscribes to ObexServiceMan property changes to monitor initialization errors
+ */
+class CObexSMWatcher : public CActive
+ {
+public:
+ static CObexSMWatcher* NewL(MObexSMObserver& aObserver);
+ virtual ~CObexSMWatcher();
+
+ // From CActive
+ virtual void RunL();
+ virtual void DoCancel();
+
+protected:
+ CObexSMWatcher(MObexSMObserver& aObserver);
+ void ConstructL();
+
+private:
+ // An observer object for obexseviceman P&S keys
+ MObexSMObserver& iObserver;
+ // A property object for obexseviceman P&S keys
+ RProperty iObexSMPostInit;
+ };
+
+#endif
--- a/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002 - 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002 - 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -21,6 +21,8 @@
#include <obex.h>
#include <SrcsInterface.h>
#include <mmf/common/mmfcontrollerpluginresolver.h> //for CleanupResetAndDestroyPushL
+#include <musbclasscontrollernotify.h>
+
// Panic category only used in debug builds
#ifdef _DEBUG
_LIT( KObexCcPanicCategory, "OBEXCC" );
@@ -79,6 +81,7 @@
{
LOG_FUNC
iObexSM = CObexUSB::NewL();
+ iObexSMWatcher = CObexSMWatcher::NewL(*this);
}
// ---------------------------------------------------------------------------
@@ -90,7 +93,8 @@
{
LOG_FUNC
Cancel();
- delete iObexSM;
+ delete iObexSM;
+ delete iObexSMWatcher;
}
// ---------------------------------------------------------------------------
@@ -258,5 +262,12 @@
LOGTEXT2(_L8("CUsbObexClassController::RunError aError=%d"), aError);
return KErrNone;
}
-
+
+void CUsbObexClassController::MosmError(TInt aError)
+ {
+ LOG_FUNC
+ LOGTEXT2(_L8("CUsbObexClassController::MosmError aError=%d"), aError);
+ Owner().UccnError(aError);
+ }
+
// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Monitors Obex ServiceMan errors.
+*
+*/
+
+#include "obexsmwatcher.h"
+#include <e32base.h>
+#include <obexservicemanprop.h>
+#include <usb/usblogger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbObexCcSMW");
+#endif
+
+/**
+ * @since S60 V5.2
+ */
+CObexSMWatcher* CObexSMWatcher::NewL(MObexSMObserver& aObserver)
+ {
+ LOG_STATIC_FUNC_ENTRY
+
+ CObexSMWatcher* self = new (ELeave) CObexSMWatcher(aObserver);
+ CleanupStack::PushL( self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+ *
+ */
+CObexSMWatcher::~CObexSMWatcher()
+ {
+ LOG_FUNC
+ Cancel();
+ iObexSMPostInit.Close();
+ }
+
+/**
+ * Performs 2nd phase construction.
+ */
+void CObexSMWatcher::ConstructL()
+ {
+ LOG_FUNC
+
+ TInt err = iObexSMPostInit.Attach(KUidObexSMCategory, KObexSMPostInitErrorProperty);
+ User::LeaveIfError( err);
+
+ RunL();
+ }
+
+/**
+ *
+ */
+
+CObexSMWatcher::CObexSMWatcher(MObexSMObserver& aObserver) :
+ CActive(CActive::EPriorityStandard), iObserver(aObserver)
+ {
+ LOG_FUNC
+ CActiveScheduler::Add(this);
+ }
+
+/**
+ *
+ */
+void CObexSMWatcher::RunL()
+ {
+ LOG_FUNC
+
+ LOGTEXT2(_L8(">>CObexSMWatcher::RunL [iStatus=%d]"), iStatus.Int());
+
+ iObexSMPostInit.Subscribe( iStatus );
+ SetActive();
+
+ TInt value = KErrNone;
+ TInt err = iObexSMPostInit.Get(value);
+ if (err == KErrNone && value != KErrNone)
+ {
+ iObserver.MosmError(value);
+ }
+
+ LOGTEXT(_L8("<<CObexSMWatcher::RunL"));
+ }
+
+/**
+ *
+ */
+void CObexSMWatcher::DoCancel()
+ {
+ LOG_FUNC
+ iObexSMPostInit.Cancel();
+ }
Binary file usbclasses/usbphoneasmodem/classcontroller/conf/usbmanager_mscfile_2000fda8.crml has changed
Binary file usbclasses/usbphoneasmodem/classcontroller/conf/usbphoneasmodem_mscfile_classcontroller.confml has changed
--- a/usbclasses/usbphoneasmodem/classcontroller/data/usbmscfileresource.rss Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// 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:
-//
-//
-
-// RESOURCE IDENTIFIER
-NAME UMSC
-
-#include <eikon.rh>
-#include "usbmscfileclasscontroller.rh"
-
-// CONSTANTS
-
-// MACROS
-
-// RESOURCE DEFINITIONS
-
-//-----------------------------------------------------------------------------
-//
-// -
-// Resource signature
-//
-//-----------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE {}
-
-//-----------------------------------------------------------------------------
-//
-// -
-// Resource filename
-//
-//-----------------------------------------------------------------------------
-//
-RESOURCE TBUF
- {
- buf = "usbmscfileresource";
- }
-
-RESOURCE ARRAY r_usbmscfile_image_paths
- {
- items =
- {
- USBMSCFILE_FILESYSTEM_IMAGE
- {
- lun = 0;
- path = "phone_as_modem.iso";
- }
- };
- }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbphoneasmodem/classcontroller/data/usbpammscfile.rss Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2004-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:
+* Resource file for the USB mass storage configuration.
+*
+*/
+
+/**
+ @file
+*/
+
+NAME MSCF
+
+#include <badef.rh>
+#include "usbpammscfile.rh"
+
+RESOURCE BA_RSS_SIGNATURE
+ {
+ signature = 1;
+ }
+
+RESOURCE USBMASSSTORAGE_CONFIG usbms_config
+ {
+ vendorId = "Nokia"; // no more than 8 characters
+ productId = "S60"; // no more than 16 characters
+ productRev = "1.0"; // no more than 4 characters
+ }
+
+
+
+
--- a/usbclasses/usbphoneasmodem/classcontroller/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbphoneasmodem/classcontroller/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -27,3 +27,5 @@
PRJ_EXPORTS
../rom/usbmscfileclasscontroller.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbmscfileclasscontroller.iby)
+../conf/usbphoneasmodem_mscfile_classcontroller.confml MW_LAYER_CONFML(usbphoneasmodem_mscfile_classcontroller.confml)
+../conf/usbmanager_mscfile_2000fda8.crml MW_LAYER_CRML(usbmanager_mscfile_2000fda8.crml)
\ No newline at end of file
--- a/usbclasses/usbphoneasmodem/classcontroller/group/usbmscfileclasscontroller.mmp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbphoneasmodem/classcontroller/group/usbmscfileclasscontroller.mmp Thu Jun 24 14:30:02 2010 +0100
@@ -42,13 +42,14 @@
TARGET usbmscfileclasscontroller.rsc
END
-START RESOURCE usbmscfileresource.rss
+start resource usbpammscfile.rss
HEADER
-TARGETPATH APP_RESOURCE_DIR
-END
+targetpath /private/101fe1db
+end
LIBRARY euser.lib
LIBRARY usbclasscontroller.lib
LIBRARY efsrv.lib
LIBRARY bafl.lib
+LIBRARY centralrepository.lib
DEBUGLIBRARY flogger.lib
--- a/usbclasses/usbphoneasmodem/classcontroller/inc/usbmscfileclasscontroller.rh Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-// 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:
-//
-//
-
-
-#include <badef.rh>
-
-STRUCT USBMSCFILE_FILESYSTEM_IMAGE
- {
- WORD protocol = 0; // protocol not used
- WORD lun; // only LUN 0 supported currently
- LTEXT path; // full path to file system image file
- }
-
-// End Of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbphoneasmodem/classcontroller/inc/usbmscfileclasscontroller_crkeys.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,42 @@
+// 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: Adheres to the UsbMan USB Class API and talks to mass storage file system
+//
+//
+#ifndef USBMSCFILECLASSCONTROLLER_CRKEYS_H
+#define USBMSCFILECLASSCONTROLLER_CRKEYS_H
+
+// CONSTANTS
+const TUid KCRUidUsbPhoneAsModemMscFileClassController = { 0x2000FDA8 };
+
+/*
+the least significant four bits is used for columns(unit file attributes: unit number, full name),
+the remains bit is used for rows(which unit file).
+
+for example, if two units is used, the following can be added for the second unit keys.
+
+const TUint32 KCRIdMscFileLogicalUnitNumber2 = 0x00000010;
+const TUint32 KCRIdMscFileImageFullName2 = 0x00000011;
+
+refer to central repository how-to document section 5, Structured Data in the Central Repository
+
+*/
+const TUint32 KCRIdMscFileLogicalUnitNumber1 = 0x00000000;
+const TUint32 KCRIdMscFileImageFullName1 = 0x00000001;
+
+const TUint32 KCRMscFileLogicalUnitNumberColumn = 0x00000000;
+const TUint32 KCRMscFileImageFullNameColumn = 0x00000001;
+
+const TUint32 KCRMscFileColumnMask = 0x0000000F;
+const TUint32 KCRMscFileRowMask = 0xFFFFFFF0;
+#endif // USBMSCFILECLASSCONTROLLER_CRKEYS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbphoneasmodem/classcontroller/inc/usbpammscfile.rh Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2004-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:
+* Resource header for usbman configuration.
+*
+*/
+
+/**
+ @file
+*/
+
+STRUCT USBMASSSTORAGE_CONFIG
+ {
+ LTEXT vendorId; // no more than 8 characters
+ LTEXT productId; // no more than 16 characters
+ LTEXT productRev; // no more than 4 characters
+ }
+
+
--- a/usbclasses/usbphoneasmodem/classcontroller/rom/usbmscfileclasscontroller.iby Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbphoneasmodem/classcontroller/rom/usbmscfileclasscontroller.iby Thu Jun 24 14:30:02 2010 +0100
@@ -23,7 +23,7 @@
#ifdef FF_USB_MODEM
ECOM_PLUGIN(usbmscfileclasscontroller.dll, usbmscfileclasscontroller.rsc)
-S60_APP_RESOURCE(usbmscfileresource)
+data=DATAZ_\private\101fe1db\usbpammscfile.rsc \private\101fe1db\usbpammscfile.rsc
#endif
--- a/usbclasses/usbphoneasmodem/classcontroller/src/usbmscfileclasscontroller.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbphoneasmodem/classcontroller/src/usbmscfileclasscontroller.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -18,11 +18,12 @@
#include <barsread.h>
#include <usb_std.h>
#include <cusbclasscontrollerplugin.h>
-#include <usbms.rsg>
-#include <usbmscfileresource.rsg>
+#include <centralrepository.h>
+#include <usbpammscfile.rsg>
#include <data_caging_path_literals.hrh>
#include "usbmscfileclasscontroller.h"
#include "usbmscfile.h"
+#include "usbmscfileclasscontroller_crkeys.h"
#include "debug.h"
// Panic category
@@ -30,8 +31,7 @@
_LIT( KMsCcPanicCategory, "UsbMscFileCc" );
#endif
-_LIT( KResourceFileName, "usbmscfileresource.rsc" );
-_LIT( KUsbMsResource, "\\private\\101fe1db\\usbms.rsc" );
+_LIT( KUsbMsResource, "\\private\\101fe1db\\usbpammscfile.rsc" );
/**
Panic codes for the USB MSC File Class Controller.
@@ -397,38 +397,32 @@
LEAVE_IF_ERROR( mscFile.Connect() );
CleanupClosePushL( mscFile );
- LEAVE_IF_ERROR( fs.Connect() );
- CleanupClosePushL( fs );
+ CRepository* repository = CRepository::NewLC(KCRUidUsbPhoneAsModemMscFileClassController);
+
+ RArray<TUint32> lunKeys;
+ CleanupClosePushL(lunKeys);
+
+ repository->FindL(KCRMscFileLogicalUnitNumberColumn, KCRMscFileColumnMask, lunKeys);
- TFileName fileName;
- const TDriveNumber KStoreDrive = EDriveZ;
- TDriveUnit driveUnit( KStoreDrive );
- TDriveName drive = driveUnit.Name();
- fileName.Insert( 0, drive );
-
- fileName += KDC_APP_RESOURCE_DIR; // From data_caging_path_literals.hrh
- fileName += KResourceFileName;
-
- RResourceFile resourceFile;
- CleanupClosePushL( resourceFile );
- resourceFile.OpenL( fs, fileName );
- resourceFile.ConfirmSignatureL();
+
+ TInt count = lunKeys.Count();
+ for (TInt i=0; i<count; i++)
+ {
+ TUint32 lunKey = lunKeys[i];
+ TUint32 fullNameKey = ((lunKey&KCRMscFileRowMask)|KCRMscFileImageFullNameColumn);
+ TRACE_INFO( (_L( "lunKey=%d,fullNameKey=%d" ), lunKey, fullNameKey) )
- HBufC8* buf8 = resourceFile.AllocReadLC( R_USBMSCFILE_IMAGE_PATHS );
-
- TResourceReader reader;
- reader.SetBuffer( buf8 );
-
- TInt count = reader.ReadInt16();
-
- while ( count-- )
- {
- TInt protocol = reader.ReadUint16();
- TInt lun = reader.ReadUint16();
- HBufC* path = reader.ReadHBufCL();
- CleanupStack::PushL( path );
- LEAVE_IF_ERROR( mscFile.SetupLogicalUnit( *path, protocol, lun ) );
- CleanupStack::PopAndDestroy( path );
- }
- CleanupStack::PopAndDestroy( 4 ); // mscFile, fs, resourceFile, buf8
+ TInt lun = 0;
+ LEAVE_IF_ERROR(repository->Get(lunKey, lun));
+
+ TFileName fullName;
+ LEAVE_IF_ERROR(repository->Get(fullNameKey, fullName));
+
+ TRACE_INFO( (_L("lun=%d, fullName=%S"), lun, &fullName) );
+
+ TInt protocol = 0; // It is not used. Bulk Transport(0x50), SCSI transparent command Set(0x06), PDT CD/DVD device(0x05) is supported only.
+
+ LEAVE_IF_ERROR(mscFile.SetupLogicalUnit( fullName, protocol, lun ));
+ }
+ CleanupStack::PopAndDestroy( 3 ); // mscFile, repository, lunKeys
}
Binary file usbclasses/usbphoneasmodem/classimplementation/mscfileserver/rom/phone_as_modem.iso has changed
--- a/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/src/mscfilesession.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/src/mscfilesession.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -118,33 +118,16 @@
TRACE_FUNC_ENTRY
TInt protocol;
TInt lun;
- RBuf buf;
+ RBuf fullImageFileName;
TInt len = aMessage.GetDesLength( 0 );
- buf.CreateL( len );
- buf.CleanupClosePushL();
- aMessage.ReadL( 0, buf );
+ fullImageFileName.CreateL( len );
+ fullImageFileName.CleanupClosePushL();
+ aMessage.ReadL( 0, fullImageFileName );
protocol = aMessage.Int1();
lun = aMessage.Int2();
-
- //get the directory and name of image file
- RFs fs;
- LEAVE_IF_ERROR(fs.Connect());
- CleanupClosePushL(fs);
- TFileName fileName;
- const TDriveNumber KResourceDrive = EDriveZ;
- TDriveUnit driveUnit( KResourceDrive );
- TDriveName drive = driveUnit.Name();
- fileName.Insert( 0, drive );
- // append private path
- TPath privatePath;
- fs.PrivatePath(privatePath);
- fileName.Append(privatePath);
- CleanupStack::PopAndDestroy(&fs);
-
- fileName.Append(buf);
- iMscFileServer.Controller().SetupLogicalUnitL( fileName, protocol, lun );
- CleanupStack::PopAndDestroy( &buf );
+ iMscFileServer.Controller().SetupLogicalUnitL( fullImageFileName, protocol, lun );
+ CleanupStack::PopAndDestroy( &fullImageFileName );
TRACE_FUNC_EXIT
}
/**
--- a/usbengines/usbdevcon/inc/cusbdevcon.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbdevcon/inc/cusbdevcon.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 - 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"
@@ -109,13 +109,6 @@
*/
void StopL();
- /**
- * Take needed actions on resuming services
- *
- * @since S60 v.5.0
- */
- void ResumeL();
-
// from CActive
/**
@@ -136,8 +129,6 @@
*/
TInt RunError( TInt /*aError*/ );
- void Destroy();
-
private: // data
/**
--- a/usbengines/usbdevcon/src/cusbdevcon.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbdevcon/src/cusbdevcon.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 - 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"
@@ -114,49 +114,44 @@
// Destruction
// ---------------------------------------------------------------------------
//
-void CUsbDevCon::Destroy()
+CUsbDevCon::~CUsbDevCon()
{
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon" ) );
-
- Cancel();
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon Cancel" ) );
-
- delete iStateMachine;
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon StateMachine" ) );
-
- delete iRequestsHandler;
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon RequestsHandler" ) );
-
- delete iUsbStateWatcher;
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbStateWatcher" ) );
-
- iUsbWatcher.Close();
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbWatcher" ) );
-
- iUsbManager.Close();
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbManager" ) );
-
- iLdd.Close();
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon LDD" ) );
-
- iShutdownTimer.Close();
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon Timer" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon" ) );
+
+ Cancel();
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon Cancel" ) );
+
+ delete iStateMachine;
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon StateMachine" ) );
+
+ delete iRequestsHandler;
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon RequestsHandler" ) );
+
+ delete iUsbStateWatcher;
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbStateWatcher" ) );
+
+ iUsbWatcher.Close();
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbWatcher" ) );
+
+ iUsbManager.Close();
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon UsbManager" ) );
+
+ iLdd.Close();
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon LDD" ) );
+
+ iShutdownTimer.Close();
+
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::~CUsbDevCon Timer" ) );
}
-CUsbDevCon::~CUsbDevCon()
- {
- Destroy();
- }
-
// ---------------------------------------------------------------------------
// Acts accordingly to USB state
// ---------------------------------------------------------------------------
@@ -170,33 +165,46 @@
{
FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Undefined" ) );
-
+
StopL();
break;
}
case EUsbcDeviceStateAttached:
{
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Attached" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Attached, ignored" ) );
- StartL();
break;
}
+ case EUsbcDeviceStateSuspended:
+ {
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Suspended" ) );
+ // NO break here
+ }
case EUsbcDeviceStatePowered:
{
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Powered" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Powered" ) );
- StartL();
+ // In powered or suspended state, we are not allowed to do any data
+ // communication. Hence if there are pending read/write requests,
+ // we need cancel them.
+ // Not call StopL() here because we do not want to shut down this
+ // process so earlier but in Undefined state.
+ if ( iStateMachine->IsStarted() )
+ {
+ iStateMachine->Stop();
+ // release device control
+ User::LeaveIfError(iLdd.ReleaseDeviceControl());
+ }
break;
}
case EUsbcDeviceStateDefault:
{
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Default" ) );
+ // The request will only be started from default state.
+ // If it has been started already, nothing will be done.
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Default" ) );
StartL();
break;
@@ -204,8 +212,7 @@
case EUsbcDeviceStateAddress:
{
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Addressed" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Addressed" ) );
StartL();
break;
@@ -213,32 +220,16 @@
case EUsbcDeviceStateConfigured:
{
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Configured" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Configured" ) );
- if(iPrevUsbState == EUsbcDeviceStateSuspended)
- {
- ResumeL();
- }
- else
- {
- StartL();
- }
+ StartL();
break;
}
- case EUsbcDeviceStateSuspended:
- {
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: Suspended" ) );
-
- break;
- }
-
default:
{
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: ***Undefined***" ) );
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ActAccordinglyToUsbStateL State: ***Unknown***" ) );
StopL();
break;
@@ -266,8 +257,7 @@
FLOG( _L( "[USBDEVCON]\tCUsbDevCon::RunL Exiting usbdevcon" ) );
// Shutdown timer is finished, exit program
- Destroy(); // destruct resources
- User::Exit(KErrNone);
+ CActiveScheduler::Stop(); // destruct resources
}
}
@@ -309,9 +299,9 @@
}
- // Cancel shutdown timer, if it is started
- iShutdownTimer.Cancel();
- }
+ // Cancel shutdown timer, if it is started
+ iShutdownTimer.Cancel();
+ }
// ---------------------------------------------------------------------------
// Stops UsbDevCon services
@@ -331,34 +321,21 @@
// release device control
User::LeaveIfError(iLdd.ReleaseDeviceControl());
- }
+ }
- if(!IsActive()) // not waiting for timer
- {
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::StopL Starting timer" ) );
- // run timer
- iShutdownTimer.Cancel();
+ if(!IsActive()) // not waiting for timer
+ {
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::StopL Starting timer" ) );
+ // run timer
+ iShutdownTimer.Cancel();
- // RunL will be called after KInactiveTimeForShutDown milliseconds
- iShutdownTimer.After(iStatus, TTimeIntervalMicroSeconds32(KInactiveTimeForShutDown));
- SetActive();
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::StopL Timer is started" ) );
- }
+ // RunL will be called after KInactiveTimeForShutDown milliseconds
+ iShutdownTimer.After(iStatus, TTimeIntervalMicroSeconds32(KInactiveTimeForShutDown));
+ SetActive();
+ FLOG( _L( "[USBDEVCON]\tCUsbDevCon::StopL Timer is started" ) );
+ }
}
-// ---------------------------------------------------------------------------
-// Resumes UsbDevCon services
-// ---------------------------------------------------------------------------
-//
-void CUsbDevCon::ResumeL()
- {
-
- FLOG( _L( "[USBDEVCON]\tCUsbDevCon::ResumeL" ) );
-
- // Resume state machine
- StartL();
-
- }
// ----------------------------------------------------------------------------
// Constructs and installs the active scheduler, constructs UsbDevCon object.
@@ -419,6 +396,3 @@
return err;
}
-
-
-
--- a/usbengines/usblocodplugin/inc/usblcdactive.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usblocodplugin/inc/usblcdactive.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -65,8 +65,12 @@
CUsbLcdActive(MLocodBearerPluginObserver& aObserver);
void ConstructL();
- void Start();
- void NotifyLcd(TBool aUsbStatus);
+ void Start();
+ /**
+ * Handle the change of selected USB personality.
+ * @param aNewPersonalityId current selected USB personality ID.
+ */
+ void HandleUsbPersonalityChange( TInt aNewPersonalityId );
private: // data
--- a/usbengines/usblocodplugin/src/usblcdactive.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usblocodplugin/src/usblcdactive.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -79,26 +79,14 @@
else
{
- TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, value);
- LOGTEXT2(_L8("CUsbLcdActive::RunL() Personality = %d"), value);
+ TInt ret = iProperty.Get( value );
+ LOGTEXT3(_L8("Personality: %d, ret: %d"), value, ret);
iProperty.Subscribe(iStatus);
SetActive();
if (ret == KErrNone)
- {
- switch (value)
- {
- case KUsbPersonalityIdPCSuite:
- case KUsbPersonalityIdPCSuiteMTP:
- NotifyLcd(ETrue);
- LOGTEXT(_L8("CUsbLcdActive::RunL() in PC Suite mode"));
- break;
-
- default:
- NotifyLcd(EFalse);
- LOGTEXT(_L8("CUsbLcdActive::RunL() mode is not PC Suite"));
- break;
- }
- }
+ {
+ HandleUsbPersonalityChange( value );
+ }
}
}
@@ -145,17 +133,33 @@
LOG_FUNC
iProperty.Subscribe(iStatus);
SetActive();
+ // Check the starting state
+ TInt usbPersonalityId( KUsbWatcherSelectedPersonalityNone );
+ TInt ret = iProperty.Get( usbPersonalityId );
+ if ( ( ret == KErrNone ) &&
+ ( usbPersonalityId != KUsbWatcherSelectedPersonalityNone ) )
+ {
+ HandleUsbPersonalityChange( usbPersonalityId );
+ }
}
+
// ---------------------------------------------------------------------------
-// This function notifying LoCoD framewark about active USB personality
-// If Personality == 113 (PC Suite), then ETrue; in all other cases is EFalse
+// This function handles the USB active personality change, and notify LoCoD
+// framework whether PC Suite is active
// ---------------------------------------------------------------------------
//
-void CUsbLcdActive::NotifyLcd(TBool aUsbStatus)
+void CUsbLcdActive::HandleUsbPersonalityChange( TInt aNewPersonalityId )
{
LOG_FUNC
- iObserver.NotifyBearerStatus(ELocodBearerUSB, aUsbStatus);
+ LOGTEXT2( _L8( "aNewPersonalityId: %d"), aNewPersonalityId );
+ TBool isPcSuiteActive( EFalse );
+ if ( ( aNewPersonalityId == KUsbPersonalityIdPCSuite ) ||
+ ( aNewPersonalityId == KUsbPersonalityIdPCSuiteMTP ) )
+ {
+ isPcSuiteActive = ETrue;
+ }
+ iObserver.NotifyBearerStatus( ELocodBearerUSB, isPcSuiteActive );
}
//End of file
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/conf/USBLocodPluginTest.cfg Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/conf/USBLocodPluginTest.cfg Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,20 @@
+/*
+* 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:
+*
+*/
+
// USBLocodPluginTest Module - total 8 tc
// USBLocodPluginTest Api Tests (4 tc)
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_ats.ini Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_ats.ini Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,19 @@
+#
+# 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:
+#
+
#
# This is STIF initialization file
# Comment lines start with '#'-character.
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_phone.ini Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_phone.ini Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,18 @@
+#
+# 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:
+#
#
# This is STIF initialization file
# Comment lines start with '#'-character.
--- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -27,31 +27,32 @@
SOURCEPATH ../src
-SOURCE panic.cpp
-SOURCE cusbtimer.cpp
+SOURCE cusbtimer.cpp
-SOURCE cusbidpinobserver.cpp
-SOURCE cusbvbusobserver.cpp
-SOURCE cusbotgstateobserver.cpp
-SOURCE cusbhosteventnotificationobserver.cpp
-SOURCE cusbmessagenotificationobserver.cpp
-SOURCE cusbbusactivityobserver.cpp
+SOURCE cusbidpinobserver.cpp
+SOURCE cusbvbusobserver.cpp
+SOURCE cusbotgstateobserver.cpp
+SOURCE cusbhosteventnotificationobserver.cpp
+SOURCE cusbmessagenotificationobserver.cpp
+SOURCE cusbbusactivityobserver.cpp
SOURCE cusbotgwatcher.cpp
-SOURCE cusbservicecontrol.cpp
-SOURCE cusbpersonalityswitch.cpp
+SOURCE cusbservicecontrol.cpp
-SOURCE cusbstate.cpp
+SOURCE cusbstate.cpp
SOURCE cusbstatehostabase.cpp
-SOURCE cusbstatehostainitiatebase.cpp
SOURCE cusbstatehostainitiate.cpp
SOURCE cusbstatehostahost.cpp
SOURCE cusbstatehostaperipheral.cpp
-SOURCE cusbstatehostaidle.cpp
SOURCE cusbstatehosthandle.cpp
+SOURCE cusbstatehostdelayhandle.cpp
+SOURCE cusbstatehostdelayattachedhandle.cpp
+SOURCE cusbstatehostdelaynotattachedhandle.cpp
+SOURCE cusbstatehosthandledropping.cpp
+SOURCE cusbstatehostundefined.cpp
-SOURCE cusbwaitnotifier.cpp
-SOURCE cusbnotifmanager.cpp
+SOURCE cusbwaitnotifier.cpp
+SOURCE cusbnotifmanager.cpp
SOURCE cusbnotifier.cpp
SOURCE cusbnotenotifier.cpp
SOURCE cusbwarningnotifier.cpp
@@ -61,11 +62,11 @@
MW_LAYER_SYSTEMINCLUDE
-LIBRARY euser.lib
-LIBRARY usbman.lib
+LIBRARY euser.lib
+LIBRARY usbman.lib
#if defined(MARM_ARMV5)
-LIBRARY usbdescriptors.lib
-LIBRARY usbdi_utils.lib
+LIBRARY usbdescriptors.lib
+LIBRARY usbdi_utils.lib
#endif
LIBRARY aknnotify.lib
--- a/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors USB activity
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Monitors USB activity
+ *
+ */
#ifndef C_USBBUSACTIVITYOBSERVER_H
#define C_USBBUSACTIVITYOBSERVER_H
@@ -39,13 +38,13 @@
* Called when when bus is in Idle, and some activity appears on the bus
*/
virtual void BusActiveL() = 0;
-
+
/**
- * Called when when error happened
- * @param aError errorcode
- */
- virtual void BusActivityErrorL(TInt aError) = 0;
-
+ * Called when when error happened
+ * @param aError errorcode
+ */
+ virtual void BusActivityErrorL(TInt aError) = 0;
+
};
/**
@@ -82,13 +81,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:
@@ -126,7 +125,7 @@
/**
* The observer reports state changes to own observers
- * Owns
+ * Not owns
*/
RPointerArray<MUsbBusActivityObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors host events
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Monitors host events
+ *
+ */
#ifndef C_USBHOSTEVENTNOTIFICATIONOBSERVER_H
#define C_USBHOSTEVENTNOTIFICATIONOBSERVER_H
@@ -63,11 +62,11 @@
* @param aInfo additional information
*/
virtual void DriverLoadFailureL(TDeviceEventInformation aInfo) = 0;
-
+
/**
- * Called when error happens while observing
- * @param aError error code
- */
+ * Called when error happens while observing
+ * @param aError error code
+ */
virtual void HostEventNotificationErrorL(TInt aError) = 0;
};
@@ -96,13 +95,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:
@@ -142,7 +141,7 @@
/**
* The observer reports changes to own observers
- * Owns
+ * Not owns
*/
RPointerArray<MUsbHostEventNotificationObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbidpinobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors ID pin change
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Monitors ID pin change
+ *
+ */
#ifndef C_USBIDPINOBSERVER_H
#define C_USBIDPINOBSERVER_H
@@ -39,13 +38,12 @@
* IdPin appeared
*/
virtual void IdPinOnL() = 0;
-
+
/**
* IdPin error
* @param aError error code
*/
virtual void IdPinErrorL(TInt aError) = 0;
-
};
@@ -67,7 +65,7 @@
* @return instance of the objects of this class
*/
static CUsbIdPinObserver* NewL();
-
+
/**
* Destructor.
*/
@@ -83,13 +81,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:
@@ -128,7 +126,7 @@
/**
* The observer reports state changes to its own observers
- * Own
+ * Not own
*/
RPointerArray<MUsbIdPinObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Blink/show Usb indicator notifier implementation
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Blink/show Usb indicator notifier implementation
+ *
+ */
#ifndef C_USBINDICATORNOTIFIER_H
#define C_USBINDICATORNOTIFIER_H
@@ -24,17 +23,15 @@
#include <AknNotifySignature.h> // SAknNotifierPackage
#include <avkon.hrh> // EAknIndicatorUSBConnection
-#include "cusbtimer.h"
#include "cusbnotifier.h"
#include "cusbvbusobserver.h"
#include "cusbotgwatcher.h"
-
/**
* Class implements functionality of showing/blinking usb indicator
* Class does not provide method to get response from the user
*/
-NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver, MUsbOtgWatcherStateObserver, MUsbVBusObserver
+NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbOtgWatcherStateObserver, MUsbVBusObserver
{
public:
/**
@@ -43,7 +40,7 @@
* @param aOtgWatcher provides VBus observer and usb otg watcher state notifications
* @return Pointer to the new instance of CUsbIndicatorNotifier
*/
- static CUsbIndicatorNotifier* NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher);
+ static CUsbIndicatorNotifier* NewL(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher);
/**
* Destructor.
@@ -56,7 +53,7 @@
* @param aState new state
*/
virtual void OtgWatcherStateChangedL(TUsbStateIds aState);
-
+
// From MUsbVBusObserver
/**
* VBus down event received
@@ -69,10 +66,9 @@
/**
* error handler
* @param aError error code
- */
+ */
virtual void VBusObserverErrorL(TInt aError);
-
-
+
// From base class CUsbNotifier
/**
* Start to show notifier
@@ -84,13 +80,6 @@
*/
virtual void Close();
- // From MUsbTimerObserver
- /**
- * Timer elapsed
- * @param Timer id
- */
- void TimerElapsedL(TUsbTimerId aTimerId);
-
private:
/**
@@ -98,7 +87,7 @@
* @param aNotifManger parent
* @param aOtgWatcher Otg watcher
*/
- CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher);
+ CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher);
/**
* 2nd phase constructor.
@@ -110,7 +99,7 @@
* @param aState Indicator states
*/
void SetIndicatorStateL(const TInt aState);
-
+
/**
* Show/hide static icon of the indicator.
* If the indicator is blinking, stop blinking it and show/hide the static
@@ -118,17 +107,17 @@
* @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator
*/
void ShowStaticL(TBool aVisible);
-
+
/**
* Blinks indicator
*/
void BlinkL();
-
+
/**
* Sets indicator accordingly
*/
void SetIndicatorL();
-
+
private:
// data
@@ -136,14 +125,7 @@
* OtgWatcher
* not own
*/
- CUsbOtgWatcher* iOtgWatcher;
-
- /**
- * Switch timer for showing/hiding the usb indicator interleavingly for
- * animating the indicator.
- * Own
- */
- CUsbTimer* iIconBlinkingTimer;
+ CUsbOtgWatcher& iOtgWatcher;
/**
* Current indicator state
--- a/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observes notifications from usb
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Observes notifications from usb
+ *
+ */
#ifndef C_USBMESSAGENOTIFICATIONOBSERVER_H
#define C_USBMESSAGENOTIFICATIONOBSERVER_H
@@ -58,12 +57,12 @@
* Called when session requested
*/
virtual void SessionRequestedL() = 0;
-
+
/**
- * Called when error happened
- * @param aError error code
- */
- virtual void MessageNotificationErrorL(TInt aError) = 0;
+ * Called when error happened
+ * @param aError error code
+ */
+ virtual void MessageNotificationErrorL(TInt aError) = 0;
};
/**
@@ -90,13 +89,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:
@@ -139,7 +138,7 @@
/**
* The observer reports to own observers
- * Owns
+ * Not owns
*/
RPointerArray<MUsbMessageNotificationObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbnotenotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Base classes for Usb notifier wrapper
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Base classes for Usb notifier wrapper
+ *
+ */
#ifndef C_CUSBNOTENOTIFIER_H
#define C_CUSBNOTENOTIFIER_H
@@ -38,62 +37,67 @@
*/
class CNotifierActive : public CActive
{
- public:
- /**
- * Default constructor
- * @param aNotifier RNotifier API
- * @param aUsbNoteNotifier the note notifier container
- */
- CNotifierActive(RNotifier& aNotifier, CUsbNoteNotifier* aUsbNoteNotifier);
-
- /**
- * Destructor
- */
- virtual ~CNotifierActive();
-
- /**
- * Start to show the notifier
- */
- void StartL();
-
- protected:
- // From base class CActive
- /**
- * Caled when outstanding request completed
- */
- void RunL();
+ public:
+ /**
+ * Default constructor
+ * @param aNotifier RNotifier API
+ * @param aUsbNoteNotifier the note notifier container
+ */
+ CNotifierActive(RNotifier& aNotifier, CUsbNoteNotifier& aUsbNoteNotifier);
+
+ /**
+ * Destructor
+ */
+ virtual ~CNotifierActive();
+
+ /**
+ * Start to show the notifier
+ */
+ void StartL();
+
+ protected:
+ // From base class CActive
+ /**
+ * Caled when outstanding request completed
+ */
+ void RunL();
- /**
- * Called when outstanding request cancelled
- */
- void DoCancel();
+ /**
+ * Called when outstanding request cancelled
+ */
+ void DoCancel();
- /**
- * Called when RunL leaves
- * @param aError errorcode
- * @return errorcode
- */
- TInt RunError(TInt aError);
+ /**
+ * Called when RunL leaves
+ * @param aError errorcode
+ * @return errorcode
+ */
+ TInt RunError(TInt aError);
- private:
- // data
+ private:
+ // data
- /**
- * The note notifier container
- * Not Own
- */
- CUsbNoteNotifier* iUsbNoteNotifier;
-
- /**
- * RNotifier API
- * Not Own
- */
- RNotifier& iNotifier;
+ /**
+ * The note notifier container
+ * Not Own
+ */
+ CUsbNoteNotifier& iUsbNoteNotifier;
+
+ /**
+ * RNotifier API
+ * Not Own
+ */
+ RNotifier& iNotifier;
/**
* Response from notifier
*/
TPckg<TInt> iRes;
+
+ /**
+ * Notifier id pckg buffer
+ */
+ TPckgBuf<TInt> iNotifIdPckg;
};
public:
@@ -122,14 +126,14 @@
* @param acat Category
* @param aNotidId id
*/
- CUsbNoteNotifier(RNotifier& aNotifier, CUsbNotifManager* aNotifManager,
+ CUsbNoteNotifier(RNotifier& aNotifier, CUsbNotifManager& aNotifManager,
TUid aCat, TUint aNotifId);
/**
* 2nd phase constructor.
*/
void ConstructL();
-
+
private:
// data
@@ -138,7 +142,7 @@
* Own
*/
CNotifierActive* iNotifierActive;
-
+
/**
* RNotifier API
* Not Own
--- a/usbengines/usbotgwatcher/inc/cusbnotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbnotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Base classes for Usb notifier wrapper
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Base classes for Usb notifier wrapper
+ *
+ */
#ifndef C_CUSBNOTIFIER_H
#define C_CUSBNOTIFIER_H
@@ -62,7 +61,7 @@
* @param acat Category
* @param aNotidId id
*/
- CUsbNotifier(CUsbNotifManager* aNotifManager, TUid aCat, TUint aNotifId);
+ CUsbNotifier(CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId);
/**
* Set by child-class if the concrete notifier needs feedback from end-user
@@ -77,7 +76,7 @@
* All notifiers are created, destroied and manupulated by the manager.
* Not own
*/
- CUsbNotifManager* iNotifManager;
+ CUsbNotifManager& iNotifManager;
/**
* Category of the notifier. Needed for cancelling
--- a/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbnotifmanager.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Manages notifiers
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Manages notifiers
+ *
+ */
#ifndef C_USBNOTIFMANAGER_H
#define C_USBNOTIFMANAGER_H
@@ -58,7 +57,7 @@
* aObserver will receive notification when completed
*/
static CWaitNotifierInfo* NewL(CUsbNotifier* aWaitNotifier,
- MWaitNotifierObserver* aObserver);
+ MWaitNotifierObserver& aObserver);
/**
* Destructor
@@ -83,7 +82,7 @@
* @param aObserver Observer
*/
CWaitNotifierInfo(CUsbNotifier* aWaitNotifier,
- MWaitNotifierObserver* aObserver);
+ MWaitNotifierObserver& aObserver);
/**
* 2nd phase construction
@@ -102,7 +101,7 @@
* observer
* not owns
*/
- MWaitNotifierObserver* iObserver;
+ MWaitNotifierObserver& iObserver;
};
/**
@@ -119,7 +118,7 @@
* 2phase construction
* @param aOtgWatcher OtgWatcher is a parent class
*/
- static CUsbNotifManager* NewL(CUsbOtgWatcher* aOtgWatcher);
+ static CUsbNotifManager* NewL(CUsbOtgWatcher& aOtgWatcher);
/**
* Destructor
@@ -133,20 +132,20 @@
* @param aObserver will receive notifications
*/
void ShowNotifierL(TUid aCat, TUint aNotifId,
- MWaitNotifierObserver* aObserver = NULL);
+ MWaitNotifierObserver* aObserver);
/**
* Closes and deletes all the notifiers
*/
void CloseAllNotifiers();
-
+
/**
* Calls back Notifier show is over
* @param aWaitNotifier wait notifier
* @param aResult result (was any errors or not)
* @param aFeedback user press (cancel or any other)
*/
- void NotifierShowCompletedL(CUsbNotifier* aWaitNotifier, TInt aResult,
+ void NotifierShowCompletedL(CUsbNotifier& aWaitNotifier, TInt aResult,
TInt aFeedback);
private:
@@ -160,7 +159,7 @@
/**
* Second phase construction
*/
- void ConstructL(CUsbOtgWatcher* aOtgWatcher);
+ void ConstructL(CUsbOtgWatcher& aOtgWatcher);
private:
// data
--- a/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbotgstateobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Observes OTG states
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Observes OTG states
+ *
+ */
#ifndef C_USBOTGSTATEOBSERVER_H
#define C_USBOTGSTATEOBSERVER_H
@@ -64,12 +63,12 @@
* Local device is B, and get to Host state
*/
virtual void BHostL() = 0;
-
+
/**
* Error handler
* @param aError error code
*/
- virtual void OtgStateErrorL(TInt aError) = 0;
+ virtual void OtgStateErrorL(TInt aError) = 0;
};
/**
@@ -101,13 +100,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:
@@ -151,7 +150,7 @@
/**
* The observer reports state changes to own observers
- * Owns
+ * Not owns
*/
RPointerArray<MUsbOtgStateObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbotgwatcher.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: OTG watcher state machine owner
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: OTG watcher state machine owner
+ *
+ */
#ifndef C_USBOTGWATCHER_H
#define C_USBOTGWATCHER_H
@@ -88,17 +87,20 @@
friend class CtUsbOtgWatcher;
public:
+
/**
* Two-phased constructor.
* @param aUsb usbman API
*/
- IMPORT_C static CUsbOtgWatcher* NewL(RUsb& aUsb);
+ IMPORT_C
+ static CUsbOtgWatcher* NewL(RUsb& aUsb);
/**
* Check ID-Pin state
* @return ETrue if the ID-Pin is present (A-Device)
*/
- IMPORT_C TBool IsDeviceA();
+ IMPORT_C
+ TBool IsDeviceA();
/**
* Destructor.
@@ -159,7 +161,7 @@
/**
* Id Pin On
* @param aError
- */
+ */
void IdPinErrorL(TInt aError);
// From VBus observer
@@ -225,7 +227,7 @@
/**
* error
* @param aError error happened
- */
+ */
void BusActivityErrorL(TInt aError);
// From Host Event notification observer
@@ -257,7 +259,7 @@
/**
* Error happened during observing
* @param aError error code
- */
+ */
void HostEventNotificationErrorL(TInt aError);
// From message notification observer
@@ -285,9 +287,9 @@
/**
* Error handler
* @param error code
- */
+ */
void MessageNotificationErrorL(TInt aError);
-
+
// From CUsbServiceControl
/**
* called when request for usb services is completed
@@ -348,32 +350,34 @@
CUsbNotifManager* NotifManager();
/**
* @return Handle state
+ * @param aStateId state id
*/
- CUsbStateHostHandle* HostHandle() const;
+ CUsbStateHostHandle* HostHandle(TUsbStateIds aStateId) const;
/**
* Handles problems in host functioning
* @param aWhatKindOf problem Id to be handled
+ * @param aInState state id where to handle
*/
- void HandleHostProblemL(TInt aWhatKindOf);
-
+ 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
*/
void PrintStateToLog();
-
+
private:
/**
@@ -405,12 +409,12 @@
* @param aNewStateId new host state (id)
*/
void ChangeHostStateL(TUsbStateIds aNewStateId);
-
+
/**
* Used for test purposes
* @return KErrNone if test is OK, otherwise errorcode
*/
- TInt SelfTestL();
+ TInt SelfTestL();
private:
// data
@@ -491,12 +495,18 @@
* Own.
*/
CUsbServiceControl* iUsbServiceControl;
-
+
/**
* The observer reports state changes to its own observers
* Not Own
*/
RPointerArray<MUsbOtgWatcherStateObserver> iOtgStateObservers;
+
+ /**
+ * The observer reports state changes to its own observers
+ * Not Own
+ */
+ CUsbServiceControl::TUsbServiceRequest iUsbServiceRequest;
};
#endif // C_USBOTGWATCHER_H
--- a/usbengines/usbotgwatcher/inc/cusbpersonalityswitch.h Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Personality switch function.
- *
-*/
-
-#ifndef C_USBPERSONALITYSWITCH_H
-#define C_USBPERSONALITYSWITCH_H
-
-#include <e32base.h>
-#include <d32usbdi.h>
-
-const TInt KGetAllPersonalitiesReq = 0x82;
-const TInt KSetPersonalityReq = 0x89;
-
-const TInt KNumOfPersShift = 3;
-const TInt KCurrPersShift = 2;
-const TInt KFirstPersonalityIdShift = 4;
-const TInt KLenghtOfPersonalityData = 2;
-
-class MUsbPersonalitySwitchObserver
- {
-public:
- enum TState
- {
- EIdle = 0,
- ERequestingAllPersonalities,
- ERequestingSetPersonality,
- EGetAllPersonalitiesCompleted,
- ESetPersonalityCompleted,
- ERequestCancelled,
- ERequestFailed
- };
-public:
- virtual void UsbPersonalitySwitchStateChangedL(TState aState, TInt aData) = 0;
- };
-
-/* *
- * Reads personalities, if possible, switches peripheral to mass storage.
- * It is assumed that USB is started already
- */
-NONSHARABLE_CLASS(CUsbPersonalitySwitch) : public CActive
- {
- enum TState
- {
- EIdle = 0,
- EGetAllPersonalities,
- ESetPersonality /*,
- EGetAllPersResult,
- EGetSetPersResult*/
- };
-
-public:
-
- /**
- * Two-phased constructor
- *
- * @param aObserver will get call back
- * @param aTimerId timer id
- */
- static CUsbPersonalitySwitch * NewL(MUsbPersonalitySwitchObserver* aObserver);
-
- /**
- * Destructor.
- */
- virtual ~CUsbPersonalitySwitch();
-
- /**
- * calls RunL after aMilliseconds
- * @param aMilliseconds time in millisecs
- */
- TInt SwitchPersonalityL(TUint32 aDeviceId, TInt aPersonalityToBeSet);
-
- void CancelSwitchPersonalityL();
-
-public:
-
- // from base class CActive
- /**
- * Called when request is completed
- */
- void RunL();
-
- /**
- * called when RunL leaves
- * @param aError error code
- * @return error code
- */
- TInt RunError(TInt aError);
-
- /**
- * Called when request is cancelled
- */
- void DoCancel();
-
-private:
-
- /**
- * Default constructor
- * @param aObserver will get call back
- * @param aTimerId timer id
- */
- CUsbPersonalitySwitch(MUsbPersonalitySwitchObserver* aObserver);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- void Reset();
-
-private:
- // data
-
- /**
- * Observer
- * not own
- */
- MUsbPersonalitySwitchObserver* iObserver;
-
- RUsbInterface iUsbInterface;
-
- /**
- * timer id
- */
- TInt iPersonalityToBeSet;
-
- RUsbInterface::TUsbTransferRequestDetails iTransfer;
-
- RBuf8 iSendData;
-
- RBuf8 iRcvData;
-
- TState iState;
- };
-
-#endif // C_USBPERSONALITYSWITCH_H
--- a/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbservicecontrol.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#ifndef C_USBSERVICECONTROL_H
#define C_USBSERVICECONTROL_H
@@ -50,12 +49,19 @@
public:
+ enum TUsbServiceRequest
+ {
+ ERequestUndefined,
+ EStartUsbService,
+ EStopUsbService
+ };
+
/**
* Two-phased constructor.
* @param aObserver Observer
* @param aUsb RUsb API
*/
- static CUsbServiceControl* NewL(MUsbServiceControlObserver* aObserver,
+ static CUsbServiceControl* NewL(MUsbServiceControlObserver& aObserver,
RUsb& aUsb);
/**
@@ -107,7 +113,7 @@
* @param aObserver receives call back when service started or stopped
* @param aUsb usbman API
*/
- CUsbServiceControl(MUsbServiceControlObserver* aObserver, RUsb& aUsb);
+ CUsbServiceControl(MUsbServiceControlObserver& aObserver, RUsb& aUsb);
/**
* 2nd phase construction
@@ -120,7 +126,7 @@
* Observer
* not own
*/
- MUsbServiceControlObserver* iObserver;
+ MUsbServiceControlObserver& iObserver;
/**
* RUsb API
--- a/usbengines/usbotgwatcher/inc/cusbstate.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstate.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,44 +1,30 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Base class for states in state machine
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Base class for states in state machine
+ *
+ */
#ifndef C_USBSTATE_H
#define C_USBSTATE_H
#include <e32base.h>
#include <usbotgdefs.h>
-
-#include "cusbotgwatcher.h"
+#include <usbman.h>
-#ifndef STIF
-#include "cusbidpinobserver.h"
-#include "cusbvbusobserver.h"
-#include "cusbotgstateobserver.h"
-#include "cusbbusactivityobserver.h"
-#include "cusbhosteventnotificationobserver.h"
-#include "cusbmessagenotificationobserver.h"
-#else
-#include "mockcusbidpinobserver.h"
-#include "mockcusbvbusobserver.h"
-#include "mockcusbotgstateobserver.h"
-#include "mockcusbbusactivityobserver.h"
-#include "mockcusbhosteventnotificationobserver.h"
-#include "mockcusbmessagenotificationobserver.h"
-#endif
+#include "definitions.h"
+
+class CUsbOtgWatcher;
/**
* Base class for usb states
@@ -70,25 +56,19 @@
* This might be used in switching states in watcher. New state object searched by its id
* @return Id
*/
- virtual TUsbStateIds Id();
-
+ virtual TUsbStateIds Id() = 0;
+
/**
* Destruction
*/
virtual ~CUsbState();
-
- /**
- * Two-phased constructor.
- * @param aWatcher owner
- */
- static CUsbState* NewL(CUsbOtgWatcher* aWatcher);
protected:
/**
* default constructor is protected to be able to be inherited be child classes
* @param aOwner owner of the state
*/
- CUsbState(CUsbOtgWatcher* aOwner);
+ CUsbState(CUsbOtgWatcher& aOwner);
/* *
* Changes state in Device state machine
@@ -102,12 +82,12 @@
*/
void ChangeHostStateL(TUsbStateIds aNewStateId);
-private:
-
/**
- * 2nd phase construction
+ * Handles special situation (error, or something else)
+ * @param aWhat to hande (id)
+ * @param aWhereTohandle state id where to handle
*/
- void ConstructL();
+ virtual void HandleL(TInt aWhat, TUsbStateIds aWhereTohandle);
/**
* State machine calls this, state object to perform any initial
@@ -129,6 +109,11 @@
*/
/**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+ /**
* Sets personality
*/
virtual void SetPersonalityL();
@@ -271,7 +256,7 @@
* Owner
* Not own.
*/
- CUsbOtgWatcher* iWatcher;
+ CUsbOtgWatcher& iWatcher;
};
--- a/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the conctet state
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation of the conctet state
+ *
+ */
#ifndef C_USBSTATEHOSTABASE_H
#define C_USBSTATEHOSTABASE_H
#include "cusbstate.h"
+#include "definitions.h"
class CUsbOtgWatcher;
/**
@@ -40,20 +40,13 @@
* default construction
* @param aWatcher owner
*/
- CUsbStateHostABase(CUsbOtgWatcher* aWatcher);
+ CUsbStateHostABase(CUsbOtgWatcher& aWatcher);
/**
* second phase construction
*/
void ConstructL();
- /**
- * Handles special situation (error, or something else)
- * @param aWhat to hande (id)
- */
- virtual void HandleL(TInt aWhat);
-
- //from CUsbState
// From VBus observer
/**
* VBus down
@@ -71,6 +64,16 @@
*/
virtual void AVBusErrorL();
+ /**
+ * Become A host
+ */
+ virtual void AHostL();
+
+ /**
+ * become A peripheral
+ */
+ virtual void APeripheralL();
+
// From bus activity observer
/**
* Bus is in idle
@@ -87,14 +90,22 @@
* @param aMessage message id
*/
virtual void MessageNotificationReceivedL(TInt aMessage);
+
+ /**
+ * SRP request received
+ */
+ virtual void SrpReceivedL();
+
/**
* Connected to hub in wrong level
*/
virtual void BadHubPositionL();
+
/**
* VBus error happened
*/
virtual void VBusErrorL();
+
/**
* Session request received
*/
--- a/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,31 +1,26 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the concret state
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation of the concret state
+ *
+ */
#ifndef C_USBSTATEHOSTAHOST_H
#define C_USBSTATEHOSTAHOST_H
-#include "cusbotgwatcher.h"
#include "cusbstatehostabase.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
+
+class CUsbOtgWatcher;
/**
* This class implements behaviour in Host state (Drivers loaded, device is in Host role)
@@ -39,7 +34,7 @@
* Two-phased constructor.
* @param aWatcher Owner
*/
- static CUsbStateHostAHost* NewL(CUsbOtgWatcher* aWatcher);
+ static CUsbStateHostAHost* NewL(CUsbOtgWatcher& aWatcher);
/**
* Destructor.
@@ -52,7 +47,7 @@
* Default construction
* @param aWatcher owner
*/
- CUsbStateHostAHost(CUsbOtgWatcher* aWatcher);
+ CUsbStateHostAHost(CUsbOtgWatcher& aWatcher);
/**
* 2nd phase construction
@@ -72,38 +67,27 @@
* trigger it and transition will not happen. This forces the transition in such cases.
*
*/
- void JustAdvancedToThisStateL();
+ virtual void JustAdvancedToThisStateL();
/**
* State machine calls this, state object to perform any initial
* activity, just before leaving this state
*
*/
- void JustBeforeLeavingThisStateL();
+ virtual void JustBeforeLeavingThisStateL();
- // From OTG state observer
- /**
- * Became a Host when A
- */
- void AHostL();
-
- /**
- * Became a Peripheral when A
- */
- void APeripheralL();
-
// From Host Event notification observer
/**
* Device is detached
* @param aInfo Device event data
*/
- void DeviceDetachedL(TDeviceEventInformation aInfo);
+ virtual void DeviceDetachedL(TDeviceEventInformation aInfo);
// From message notification observer
/**
* Connected to hub in wrong level
*/
- void BadHubPositionL();
+ virtual void BadHubPositionL();
private:
// data
--- a/usbengines/usbotgwatcher/inc/cusbstatehostaidle.h Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Iplementation of the concret state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAIDLE_H
-#define C_USBSTATEHOSTAIDLE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- * This class implements basic behaviour in Idle state (VBus down, IdPin on)
- *
- */
-NONSHARABLE_CLASS( CUsbStateHostAIdle ) : public CUsbStateHostAInitiateBase
-
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aWatcher owner
- */
- static CUsbStateHostAIdle* NewL(CUsbOtgWatcher* aWatcher);
-
- /**
- * Destructor.
- */
- virtual ~CUsbStateHostAIdle();
-
-private:
-
- /**
- * Default construction
- * @param aWatcher owner
- */
- CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- //from CUsbState
- /**
- * State id
- * @return state id
- */
- TUsbStateIds Id();
-
- /**
- * This is called when switched to this state,
- * because If all conditions for transition to another state exist, nothing will
- * trigger it and transition will not happen. This forces the transition in such cases.
- *
- */
- void JustAdvancedToThisStateL();
-
- };
-
-#endif // C_USBSTATEHOSTAIDLE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,37 +1,39 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of the concret state
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation of the concret state
+ *
+ */
#ifndef C_USBSTATEHOSTAINITIATE_H
#define C_USBSTATEHOSTAINITIATE_H
-#include "cusbotgwatcher.h"
-#include "cusbstatehostainitiatebase.h"
+#include "cusbstatehostabase.h"
+
#ifndef STIF
#include "cusbtimer.h"
#else
#include "mockcusbtimer.h"
#endif
+class CUsbOtgWatcher;
+
/**
* This class implements behaviour when Id pin just detected (initiating host role, loading drivers)
*
*/
-NONSHARABLE_CLASS( CUsbStateHostAInitiate ) : public CUsbStateHostAInitiateBase
+NONSHARABLE_CLASS( CUsbStateHostAInitiate ) : public CUsbStateHostABase,
+MUsbTimerObserver
{
friend class CtUsbOtgWatcher;
@@ -41,7 +43,7 @@
* Two-phased constructor.
* @param aWatcher owner
*/
- static CUsbStateHostAInitiate* NewL(CUsbOtgWatcher* aWatcher);
+ static CUsbStateHostAInitiate* NewL(CUsbOtgWatcher& aWatcher);
/**
* Destructor.
@@ -50,11 +52,18 @@
private:
+ // From MUsbTimerObserver
+ /**
+ * timer expired call back
+ * @param aTimerId timer id
+ */
+ void TimerElapsedL(TUsbTimerId aTimerId);
+
/**
* default construction
* @param aWatcher owner
*/
- CUsbStateHostAInitiate(CUsbOtgWatcher* aWatcher);
+ CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher);
/**
* 2nd phase construction
@@ -75,15 +84,65 @@
*
*/
void JustAdvancedToThisStateL();
-
+
/**
* This is called when switched to this state,
* because If all conditions for transition to another state exist, nothing will
* trigger it and transition will not happen. This forces the transition in such cases.
*
*/
- virtual void JustBeforeLeavingThisStateL();
+ void JustBeforeLeavingThisStateL();
+
+ // From VBus observer
+ /**
+ * VBus up
+ */
+ void VBusUpL();
+
+ // From Host Event notification observer
+ /**
+ * Device is attached
+ * @param aInfo Device event data
+ */
+ void DeviceAttachedL(TDeviceEventInformation aInfo);
+
+ /**
+ * Device is detached
+ * @param aInfo Device event data
+ */
+ void DeviceDetachedL(TDeviceEventInformation aInfo);
+ /**
+ * Device is detached
+ * @param aInfo Device event data
+ */
+ void DriverLoadSuccessL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers loaded partially
+ * @param aInfo Device event data
+ */
+ void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers loading failed
+ * @param aInfo Device event data
+ */
+ void DriverLoadFailureL(TDeviceEventInformation aInfo);
+
+private:
+ // data
+
+ /*
+ * attachment timer
+ * own
+ */
+ CUsbTimer* iAttachmentTimer;
+
+ /*
+ * attachment attribute
+ */
+ TBool iDeviceAttached;
};
#endif // C_USBSTATEHOSTINITIATE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiatebase.h Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements concrete state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAINITIATEBASE_H
-#define C_USBSTATEHOSTAINITIATEBASE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostabase.h"
-#include "cusbpersonalityswitch.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- * This class implements besic behaviour when Id pin on, and vbus just turned down or just turned on,
- * specific concrete case/state is implemented in subclass
- */
-NONSHARABLE_CLASS( CUsbStateHostAInitiateBase ) : public CUsbStateHostABase,
- MUsbTimerObserver, MUsbPersonalitySwitchObserver
-
- {
- friend class CTestUsbOtgWatcher;
-
-public:
-
- /**
- * Destructor.
- */
- virtual ~CUsbStateHostAInitiateBase();
-
- // From MUsbTimerObserver
- /**
- * timer expired call back
- * @param aTimerId timer id
- */
- void TimerElapsedL(TUsbTimerId aTimerId);
-
- void UsbPersonalitySwitchStateChangedL(MUsbPersonalitySwitchObserver::TState aState, TInt aData);
-
-protected:
-
- /**
- * Default construction
- * @param aWatcher owner
- */
- CUsbStateHostAInitiateBase(CUsbOtgWatcher* aWatcher);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- //from CUsbState
-
- /**
- * This is called when switched to this state,
- * because If all conditions for transition to another state exist, nothing will
- * trigger it and transition will not happen. This forces the transition in such cases.
- *
- */
- virtual void JustBeforeLeavingThisStateL();
-
- // From VBus observer
- /**
- * VBus down
- */
- virtual void VBusDownL();
- /**
- * VBus UP
- */
- virtual void VBusUpL();
-
- /**
- * AHost
- */
- virtual void AHostL();
-
- /**
- * APeripheral
- */
- virtual void APeripheralL();
-
- // From Host Event notification observer
- /**
- * Device is attached
- * @param Device event data
- */
- virtual void DeviceAttachedL(TDeviceEventInformation);
- /**
- * Device is detached
- * @param Device event data
- */
- virtual void DriverLoadSuccessL(TDeviceEventInformation);
- /**
- * Drivers loaded partially
- * @param Device event data
- */
- virtual void DriverLoadPartialSuccessL(TDeviceEventInformation);
- /**
- * Drivers loading failed
- * @param Device event data
- */
- virtual void DriverLoadFailureL(TDeviceEventInformation);
-
- // From message notification observer
- /**
- * SRP request received
- */
- virtual void SrpReceivedL();
-
-protected:
- // data
-
- /*
- * attachment timer
- * own
- */
- CUsbTimer* iAttachmentTimer;
-
- CUsbPersonalitySwitch* iUsbPersonalitySwitch;
- };
-
-#endif // C_USBSTATEHOSTAINITIATEBASE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,31 +1,26 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements concrete state
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
#ifndef C_USBSTATEHOSTAPERIPHERAL_H
#define C_USBSTATEHOSTAPERIPHERAL_H
-#include "cusbotgwatcher.h"
#include "cusbstatehostabase.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
+
+class CUsbOtgWatcher;
/**
* This class implements behaviour when A device performs peripheral role, from OTG point of view
@@ -40,7 +35,7 @@
* Two-phased constructor.
* @param aWatcher owner
*/
- static CUsbStateHostAPeripheral* NewL(CUsbOtgWatcher* aWatcher);
+ static CUsbStateHostAPeripheral* NewL(CUsbOtgWatcher& aWatcher);
/**
* Destructor.
@@ -53,20 +48,13 @@
* default constructor
* @param aWatcher owner
*/
- CUsbStateHostAPeripheral(CUsbOtgWatcher* aWatcher);
+ CUsbStateHostAPeripheral(CUsbOtgWatcher& aWatcher);
/**
* 2nd phase construction
*/
void ConstructL();
- /**
- * State machine calls this, state object to perform any initial
- * activity, once just entered this state
- *
- */
- void JustAdvancedToThisStateL();
-
//from CUsbState
/**
* state id
@@ -79,6 +67,11 @@
* Became a host when A
*/
void AHostL();
+
+ /**
+ * Became to Idle when A
+ */
+ void AIdleL();
private:
// data
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
+
+#ifndef C_USBSTATEHOSTDALAYATTACHEDHANDLE_H
+#define C_USBSTATEHOSTDALAYATTACHEDHANDLE_H
+
+#include "cusbstatehostdelayhandle.h"
+
+#ifndef STIF
+#include "cusbtimer.h"
+#else
+#include "mockcusbtimer.h"
+#endif
+
+class CUsbOtgWatcher;
+
+/**
+ * problem handling, device is attached, vbus not dropping
+ *
+ */
+NONSHARABLE_CLASS( CUsbStateHostDelayAttachedHandle ) : public CUsbStateHostDelayHandle,
+public MUsbTimerObserver
+ {
+ friend class CtUsbOtgWatcher;
+ friend class CUsbOtgWatcher;
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aWatcher owner
+ */
+ static CUsbStateHostDelayAttachedHandle* NewL(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUsbStateHostDelayAttachedHandle();
+
+protected:
+
+ // From MUsbTimerObserver
+ /**
+ * Call back when timer expired
+ * @param aTimerId timer id
+ */
+ void TimerElapsedL(TUsbTimerId aTimerId);
+
+ /**
+ * Device is detached
+ * @param aInfo Device event data
+ */
+ virtual void DeviceDetachedL(TDeviceEventInformation aInfo);
+
+ //from CUsbState
+ /**
+ * State id
+ * @return state id
+ */
+ virtual TUsbStateIds Id();
+
+ /**
+ * This is called when leaving this state,
+ *
+ */
+ virtual void JustBeforeLeavingThisStateL();
+
+ /**
+ * handles issue
+ */
+ virtual void DoHandleL();
+
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostDelayAttachedHandle(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+ // data
+
+private:
+ /**
+ * drivers not found
+ * own
+ */
+ CUsbTimer* iDriversNotFoundTimer;
+ };
+
+#endif // C_USBSTATEHOSTDELAYATTACHEDHANDLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
+
+#ifndef C_USBSTATEHOSTDELAYHANDLE_H
+#define C_USBSTATEHOSTDELAYHANDLE_H
+
+#include "cusbstatehosthandle.h"
+
+class CUsbOtgWatcher;
+
+/**
+ * problem handling, vbus not dropping
+ *
+ */
+NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle
+ {
+ friend class CtUsbOtgWatcher;
+ friend class CUsbOtgWatcher;
+
+public:
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUsbStateHostDelayHandle();
+
+protected:
+
+ // From VBus observer
+ /**
+ * VBus up
+ */
+ virtual void VBusUpL();
+
+ // From Host Event notification observer
+ /**
+ * Device is attached
+ * @param aInfo Device event data
+ */
+ virtual void DeviceAttachedL(TDeviceEventInformation aInfo);
+
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostDelayHandle(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+ // data
+
+private:
+ };
+
+#endif // C_USBSTATEHOSTDELAYHANDLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
+
+#ifndef C_USBSTATEHOSTDELAYANOTTTACHEDHANDLE_H
+#define C_USBSTATEHOSTDELAYNOTATTACHEDHANDLE_H
+
+#include "cusbstatehostdelayhandle.h"
+
+#ifndef STIF
+#include "cusbtimer.h"
+#else
+#include "mockcusbtimer.h"
+#endif
+
+class CUsbOtgWatcher;
+/**
+ * problem handling, device is not attached, vbus not dropping
+ *
+ */
+NONSHARABLE_CLASS( CUsbStateHostDelayNotAttachedHandle ) : public CUsbStateHostDelayHandle,
+MUsbTimerObserver
+ {
+ friend class CtUsbOtgWatcher;
+ friend class CUsbOtgWatcher;
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aWatcher owner
+ */
+ static CUsbStateHostDelayNotAttachedHandle* NewL(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUsbStateHostDelayNotAttachedHandle();
+
+private:
+
+ // From MUsbTimerObserver
+ /**
+ * Call back when timer expired
+ * @param aTimerId timer id
+ */
+ void TimerElapsedL(TUsbTimerId aTimerId);
+
+ /**
+ * Device is detached
+ * @param aInfo Device event data
+ */
+ void DeviceDetachedL(TDeviceEventInformation aInfo);
+
+ // From OTG state observer
+ /**
+ * Became to Idle when A
+ */
+ void AIdleL();
+
+ //from CUsbState
+ /**
+ * State id
+ * @return state id
+ */
+ TUsbStateIds Id();
+
+ /**
+ * This is called when leaving this state,
+ *
+ */
+ void JustBeforeLeavingThisStateL();
+
+ /**
+ * handles issue
+ */
+ void DoHandleL();
+
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostDelayNotAttachedHandle(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+ // data
+
+ /**
+ * too much power timer
+ * own
+ */
+ CUsbTimer* iTooMuchPowerTimer;
+
+ };
+
+#endif // C_USBSTATEHOSTDELAYNOTATTACHEDHANDLE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,43 +1,32 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements concrete state
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
#ifndef C_USBSTATEHOSTHANDLE_H
#define C_USBSTATEHOSTHANDLE_H
-#include "cusbotgwatcher.h"
-#include "cusbstate.h"
+#include "cusbstatehostabase.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
-#else
-#include "mockcusbnotifmanager.h"
-#include "mockcusbtimer.h"
-#endif
+class CUsbOtgWatcher;
/**
- * This class implements behaviour when some problem needs vbus drop, and mostly, user action.
+ * problem handling base class
*
*/
-NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbState,
- MWaitNotifierObserver,
- MUsbTimerObserver
-// this means only one wait notifier at a time can be shown by this state, might be redesigned
+NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbStateHostABase
{
friend class CtUsbOtgWatcher;
friend class CUsbOtgWatcher;
@@ -45,12 +34,6 @@
public:
/**
- * Two-phased constructor.
- * @param aWatcher owner
- */
- static CUsbStateHostHandle* NewL(CUsbOtgWatcher* aWatcher);
-
- /**
* Destructor.
*/
virtual ~CUsbStateHostHandle();
@@ -61,136 +44,19 @@
*/
void SetWhat(TInt aWhat);
- // from MWaitNotifierObserver
- /**
- * Callback when notifier is completed
- * @param aFeedback how notifier completed
- */
- 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();
-
- // From OTG state observer
- /**
- * Became to Idle when A
- */
- void AIdleL();
- /**
- * Became a Host when A
- */
- void AHostL();
- /**
- * Became a peripheral when A
- */
- 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();
-
- // From bus activity observer
- /**
- * Bus is in idle
- */
- void BusIdleL();
- /**
- * Bus active
- */
- void BusActiveL();
-
- // From Host Event notification observer
- /**
- * Device is attached
- * @param aInfo Device event data
- */
- void DeviceAttachedL(TDeviceEventInformation aInfo);
- /**
- * Device is detached
- * @param aInfo Device event data
- */
- void DeviceDetachedL(TDeviceEventInformation aInfo);
-
- /**
- * Drivers successfully loaded
- * @param aInfo Device event data
- */
- virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo);
- /**
- * Drivers loaded partially
- * @param aInfo Device event data
- */
- virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
- /**
- * Drivers loading failed
- * @param aInfo Device event data
- */
- virtual void DriverLoadFailureL(TDeviceEventInformation aInfo);
+protected:
// From message notification observer
/**
* Message received
* @param aMessage message id
*/
- void MessageNotificationReceivedL(TInt aMessage);
- /**
- * Connected to hub in wrong level
- */
- void BadHubPositionL();
- /**
- * VBus error happened
- */
- void VBusErrorL();
- /**
- * SRP request received
- */
- void SrpReceivedL();
+ virtual void MessageNotificationReceivedL(TInt aMessage);
+
/**
* Session request received
*/
- void SessionRequestedL();
-
- /**
- * Default constructor
- * @param aWatcher owner
- */
- CUsbStateHostHandle(CUsbOtgWatcher* aWatcher);
-
- /**
- * 2nd phase construction
- */
- void ConstructL();
-
- //from CUsbState
- /**
- * State id
- * @return state id
- */
- TUsbStateIds Id();
+ virtual void SessionRequestedL();
/**
* This is called when switched to this state,
@@ -198,20 +64,24 @@
* 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();
+ virtual void JustAdvancedToThisStateL();
/**
* handles issue
*/
- void DoHandleL();
+ virtual void DoHandleL() = 0;
-private:
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostHandle(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
// data
/**
@@ -219,17 +89,7 @@
*/
TInt iWhat;
- /**
- * too much power timer
- * own
- */
- CUsbTimer* iTooMuchPowerTimer;
-
- /**
- * drivers not found
- * own
- */
- CUsbTimer* iDriversNotFoundTimer;
+private:
};
#endif // C_USBSTATEHOSTHANDLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements concrete state
+ *
+ */
+
+#ifndef C_USBSTATEHOSTHANDLEDROPPING_H
+#define C_USBSTATEHOSTHANDLEDROPPING_H
+
+#include "cusbstatehosthandle.h"
+
+#ifndef STIF
+#include "cusbnotifmanager.h"
+#else
+#include "mockcusbnotifmanager.h"
+#endif
+
+class CUsbOtgWatcher;
+
+/**
+ * problem handling class, dropping vbus
+ *
+ */
+NONSHARABLE_CLASS( CUsbStateHostHandleDropping ) : public CUsbStateHostHandle,
+MWaitNotifierObserver
+// this means only one wait notifier at a time can be shown by this state, might be redesigned
+
+ {
+ friend class CtUsbOtgWatcher;
+ friend class CUsbOtgWatcher;
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aWatcher owner
+ */
+ static CUsbStateHostHandleDropping* NewL(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CUsbStateHostHandleDropping();
+
+private:
+
+ // from MWaitNotifierObserver
+ /**
+ * Callback when notifier is completed
+ * @param aFeedback how notifier completed
+ */
+ void WaitNotifierCompletedL(TInt aFeedback);
+
+ // From VBus observer
+ /**
+ * VBus up
+ */
+ void VBusUpL();
+
+ /**
+ * VBus down
+ */
+ void VBusDownL();
+
+ /**
+ * 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);
+
+ /**
+ * Drivers successfully loaded
+ * @param aInfo Device event data
+ */
+ void DriverLoadSuccessL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers loaded partially
+ * @param aInfo Device event data
+ */
+ void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers loading failed
+ * @param aInfo Device event data
+ */
+ void DriverLoadFailureL(TDeviceEventInformation aInfo);
+
+ // From message notification observer
+ /**
+ * Message received
+ * @param aMessage message id
+ */
+ void MessageNotificationReceivedL(TInt aMessage);
+
+ /**
+ * VBus error happened
+ */
+ void VBusErrorL();
+
+ //from CUsbState
+ /**
+ * State id
+ * @return state id
+ */
+ TUsbStateIds Id();
+
+ /**
+ * This is called when leaving this state,
+ *
+ */
+ void JustBeforeLeavingThisStateL();
+
+ /**
+ * handles issue
+ */
+ void DoHandleL();
+
+ /**
+ * Default constructor
+ * @param aWatcher owner
+ */
+ CUsbStateHostHandleDropping(CUsbOtgWatcher& aWatcher);
+
+ /**
+ * 2nd phase construction
+ */
+ void ConstructL();
+
+ };
+
+#endif // C_USBSTATEHOSTDROPPINGHANDLE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation of the concret state
+ *
+ */
+
+#ifndef C_USBSTATEHOSTUNDEFINED_H
+#define C_USBSTATEHOSTUNDEFINED_H
+
+#include "cusbstatehostabase.h"
+
+class CUsbOtgWatcher;
+/**
+ * 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
+ */
+ TUsbStateIds Id();
+
+ // From VBus observer
+ /**
+ * VBus down
+ */
+ void VBusDownL();
+
+ /**
+ * VBus UP
+ */
+ void VBusUpL();
+
+ /**
+ * VBus error
+ */
+ void VBusErrorL();
+
+ /**
+ * 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 attached
+ * @param aInfo Device event data
+ */
+ void DeviceAttachedL(TDeviceEventInformation aInfo);
+
+ /**
+ * Device is detached
+ * @param aInfo Device event data
+ */
+ void DeviceDetachedL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers successfully loaded
+ * @param aInfo Device event data
+ */
+ void DriverLoadSuccessL(TDeviceEventInformation aInfo);
+
+ /**
+ * Drivers loaded partially
+ * @param aInfo Device event data
+ */
+ void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo);
+ /**
+ * Drivers loading failed
+ * @param aInfo Device event data
+ */
+ void DriverLoadFailureL(TDeviceEventInformation aInfo);
+
+ // From message notification observer
+ /**
+ * Message received
+ * @param aMessage message id
+ */
+ void MessageNotificationReceivedL(TInt aMessage);
+
+ /**
+ * SRP request received
+ */
+ void SrpReceivedL();
+
+ /**
+ * Connected to hub in wrong level
+ */
+ void BadHubPositionL();
+
+ /**
+ * Session request received
+ */
+ void SessionRequestedL();
+
+private:
+ // data
+ };
+
+#endif // C_USBSTATEHOSTUNDEFINED_H
--- a/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbtimer.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,19 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: timer
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: timer
+ *
+ */
#ifndef C_USBTIMER_H
#define C_USBTIMER_H
@@ -65,7 +65,7 @@
* @param aObserver will get call back
* @param aTimerId timer id
*/
- static CUsbTimer * NewL(MUsbTimerObserver* aObserver,
+ static CUsbTimer * NewL(MUsbTimerObserver& aObserver,
TUsbTimerId aTimerId);
/**
@@ -106,7 +106,7 @@
* @param aObserver will get call back
* @param aTimerId timer id
*/
- CUsbTimer(MUsbTimerObserver* aObserver, TUsbTimerId aTimerId);
+ CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId);
/**
* 2nd phase construction
@@ -120,7 +120,7 @@
* Observer
* not own
*/
- MUsbTimerObserver* iObserver;
+ MUsbTimerObserver& iObserver;
/**
* RTimer API
--- a/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implements VBus observer
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implements VBus observer
+ *
+ */
#ifndef C_USBVBUSOBSERVER_H
#define C_USBVBUSOBSERVER_H
@@ -41,7 +40,7 @@
/**
* error handler
* @param aError error code
- */
+ */
virtual void VBusObserverErrorL(TInt aError)=0;
};
@@ -80,13 +79,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:
@@ -128,7 +127,7 @@
/**
* The observer reports state changes to own observers
- * Own
+ * Not owns
*/
RPointerArray<MUsbVBusObserver> iObservers;
--- a/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Usb waiting notifier implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Usb waiting notifier implementation
+ *
+ */
#ifndef C_USBWAITNOTIFIER_H
#define C_USBWAITNOTIFIER_H
@@ -39,7 +38,7 @@
* @return Pointer to the new instance of CUsbWaitNotifier
*/
static CUsbWaitNotifier* NewL(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId);
+ CUsbNotifManager& aNotifManager, TUint aNotifId);
/**
* Destructor.
@@ -54,7 +53,7 @@
* @param aNotifManager Owner of the class, will destroy the object when needed
* @param aNotifId Id of the notifier
*/
- CUsbWaitNotifier(RNotifier& aNotifier, CUsbNotifManager* aNotifManager,
+ CUsbWaitNotifier(RNotifier& aNotifier, CUsbNotifManager& aNotifManager,
TUint aNotifId);
/**
--- a/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Usb warning notifier implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Usb warning notifier implementation
+ *
+ */
#ifndef C_USBWARNINGNOTIFIER_H
#define C_USBWARNINGNOTIFIER_H
@@ -40,7 +39,7 @@
* @return Pointer to the new instance of CUsbWarningNotifier
*/
static CUsbWarningNotifier* NewL(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId);
+ CUsbNotifManager& aNotifManager, TUint aNotifId);
/**
* Destructor.
@@ -56,7 +55,7 @@
* @param aNotifId Id of the notifier
*/
CUsbWarningNotifier(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId);
+ CUsbNotifManager& aNotifManager, TUint aNotifId);
/**
* 2nd phase construction
--- a/usbengines/usbotgwatcher/inc/debug.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/debug.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 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"
@@ -11,108 +11,152 @@
*
* Contributors:
*
-* Description: Central place for debug-type macros & functions
+* Description: Debug macros and declarations.
*
*/
-#ifndef _USBWATCHER_DEBUG_H
-#define _USBWATCHER_DEBUG_H
+#ifndef DEBUG_H
+#define DEBUG_H
+
+//////////////////////////////////////////////////////////////////////////////
+// Here are parameters need to be modified.
+// Component name
+#define MODULE_NAME "USBOTGWATCHER"
+//////////////////////////////////////////////////////////////////////////////
+
+
+// For handling unicode strings as L##MACRO is interpreted as LMACRO
+#define WIDEN2( x ) L##x
+#define WIDEN( x ) WIDEN2( x )
+
+_LIT( KUsbPanicModule, ""WIDEN( MODULE_NAME ) );
#ifdef _DEBUG
-// Enable this to enable memory tracing
-//#define MEMTRACE
-
-// Following define is to enable OOM
-// situations in SRCS
-// SHOULD NEVER BE IN RELEASES.
-//#define TEST_OOM
-
-#ifdef __WINS__
-
-// File logging for WINS
-#define __FLOGGING__
+// Comment this line out if using real-time debugging
+//#define LOG_TO_FILE
+// ===========================================================================
+#if defined ( LOG_TO_FILE )
+// ===========================================================================
+// Add corresponding libabry in mmp file
+// LIBRARY flogger.lib
+// The log file is located at
+// c:\logs\usb\MODULE_NAME.txt
-#else
-
-// Logging with RDebug for target HW
-#define __CLOGGING__
-
-#endif //__WINS__
-
-#endif // Debug
-
-#if defined ( __FLOGGING__ )
-
-_LIT( KLogFile,"UsbWatcher.txt" );
-_LIT( KLogDir,"usb" );
-
-#include <f32file.h>
#include <flogger.h>
-#define FLOG( a ) { FPrint( a ); }
+#define DESC( x ) TPtrC( ( const TText* ) ( x ) )
+#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) )
+_LIT( KUsbLogDir, "USB" );
+_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" );
-#define FLOGHEX( value, len ) { RFileLogger::HexDump( KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len ); }
-
-#define FTRACE( a ) { a; }
+// s: c string.
+#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \
+ KUsbLogFile, EFileLoggingModeAppend, \
+ DESC8( "["MODULE_NAME"] "##s ) )
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
-{
- VA_LIST list;
- VA_START( list, aFmt );
- RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list );
+// s: c string contains "%x"
+// v: varaible corresponding to %x
+#define LOG1(s, v) RFileLogger::WriteFormat( KUsbLogDir, \
+ KUsbLogFile, EFileLoggingModeAppend, \
+ DESC8( "["MODULE_NAME"] "##s ), v)
+// s: c string contains "%x%y"
+// v1: varaible corresponding to %x
+// v2: varaible corresponding to %y
+#define LOG2(s, v1, v2) RFileLogger::WriteFormat( KUsbLogDir, \
+ KUsbLogFile, EFileLoggingModeAppend, \
+ DESC8( "["MODULE_NAME"] "##s ), v1, v2)
- // If memory tracing is activated.
-#ifdef MEMTRACE
- TInt size;
- User::Heap().AllocSize( size );
- RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, _L( "[USBWATCHER]\tmemory\tMemory usage: %d high: %d" ), size, User::Heap().Size() );
-#endif
-}
+// s: c string contains "%x%y%z"
+// v1: varaible corresponding to %x
+// v2: varaible corresponding to %y
+// v3: varaible corresponding to %z
+#define LOG3(s, v1, v2, v3) RFileLogger::WriteFormat( KUsbLogDir, \
+ KUsbLogFile, EFileLoggingModeAppend, \
+ DESC8( "["MODULE_NAME"] "##s ), v1, v2, v3 )
-inline void FHex( const TUint8* aPtr, TInt aLen )
-{
- RFileLogger::HexDump( KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen );
-}
+class TFuncLogger
+ {
+public:
+ TFuncLogger(const TDesC8& aFuncName)
+ {
+ iFuncName.Set( aFuncName );
+ RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, EFileLoggingModeAppend,
+ DESC8( "["MODULE_NAME"] >>%s" ), iFuncName.Ptr() );
+ }
+ ~TFuncLogger()
+ {
+ RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile,
+ EFileLoggingModeAppend,
+ DESC8( "["MODULE_NAME"] <<%s" ), iFuncName.Ptr() );
+ }
+private:
+ TPtrC8 iFuncName;
+ };
+// ===========================================================================
+#else //LOG_TO_FILE not defined
+// ===========================================================================
+#include <e32debug.h>
-inline void FHex( const TDesC8& aDes )
-{
- FHex( aDes.Ptr(), aDes.Length() );
-}
-
-// RDebug logging
-#elif defined(__CLOGGING__)
+// Paramters same as above.
+#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); }
-#include <e32svr.h>
+#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); }
-#define FLOG( a ) { RDebug::Print( a ); }
+#define LOG2( s, v1,v2 ) { RDebug::Printf( "["MODULE_NAME"] "##s , v1, v2 ); }
+
+#define LOG3( s, v1, v2, v3 ) { RDebug::Printf( "["MODULE_NAME"] "##s , \
+ v1, v2, v3); }
-#define FLOGHEX( a )
+class TFuncLogger
+ {
+public:
+ TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName )
+ {
+ RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr());
+ }
+ ~TFuncLogger()
+ {
+ RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr());
+ }
+private:
+ TPtrC8 iFuncName;
+ };
+#endif // LOG_TO_FILE
-#define FTRACE( a ) { a; }
-
-// Declare the FPrint function
+#define LEAVE( exp ) {volatile TInt err_ = exp; \
+ LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
+ User::Leave( err_ );}
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
-{
- VA_LIST list;
- VA_START( list,aFmt );
- TInt tmpInt = VA_ARG( list, TInt );
- TInt tmpInt2 = VA_ARG( list, TInt );
- TInt tmpInt3 = VA_ARG( list, TInt );
- VA_END( list );
- RDebug::Print( aFmt, tmpInt, tmpInt2, tmpInt3 );
-}
+#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 LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
+
+#define ASSERT_PANIC( exp, code ) {if(!(exp)) PANIC(code)}
+
+#else // _DEBUG not defined
+// ===========================================================================
-
-#else // No loggings --> reduced code size
+#define LOG( s )
+#define LOG1( s, v )
+#define LOG2( s, v1, v2 )
+#define LOG3( s, v1, v2, v3 )
+#define LOG_FUNC_ENTRY
+#define LOG_FUNC_EXIT
+#define LEAVE( exp ) User::Leave( exp );
+#define LEAVEIFERROR( exp ) User::LeaveIfError( exp );
+#define PANIC( err ) // in non-debug builds PANICs are silent
+#define LOG_FUNC
+#define ASSERT_PANIC( exp, code )
+// ===========================================================================
+#endif // _DEBUG
+// ===========================================================================
+#endif // DEBUG_H
-#define FLOG( a )
-#define FLOGHEX( a )
-#define FTRACE( a )
-
-#endif //_DEBUG
-
-#endif // USBDEVCON_DEBUG_H
-
+// End of File
--- a/usbengines/usbotgwatcher/inc/definitions.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/definitions.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for otgwatcher
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Definitions for otgwatcher
+ *
+ */
#ifndef DEFENITIONS_H
#define DEFENITIONS_H
@@ -38,14 +37,15 @@
*/
enum TUsbStateIds
{
- EUsbStateUndefined,
-
+ EUsbStateHostUndefined,
+
EUsbStateHostAInitiate,
EUsbStateHostAHost,
EUsbStateHostAPeripheral,
- EUsbStateHostAIdle,
- EUsbStateHostHandle
+ EUsbStateHostDelayAttachedHandle,
+ EUsbStateHostDelayNotAttachedHandle,
+ EUsbStateHostHandleDropping
};
const TInt KUsbWatcherPeripheralIsNotConnected = 0; // means not(KUsbWatcherPeripheralIsConnected)
--- a/usbengines/usbotgwatcher/inc/errors.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/errors.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File contains error codes, from Watcher perspective
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: File contains error codes, from Watcher perspective
+ *
+ */
#ifndef ERRORS_H
#define ERRORS_H
@@ -38,7 +37,12 @@
EUsbWatcherVBusObserverError,
EUsbWatcherHostEventNotificationError,
EUsbWatcherOtgStateError,
- EUsbWatcherMessageNotificationError
+ EUsbWatcherMessageNotificationError,
+ EUsbWatcherCanNotStartSession,
+ EUsbWatcherCanNotEnableDriverLoading,
+ EUsbWatcherCanNotClearBusError,
+ EUsbWatcherCanNotRaiseVBus,
+ EUsbWatcherNoMemory
};
--- a/usbengines/usbotgwatcher/inc/panic.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/inc/panic.h Thu Jun 24 14:30:02 2010 +0100
@@ -1,24 +1,25 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Central place for debug-type macros & functions
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Central place for debug-type macros & functions
+ *
+ */
+#ifndef C_PANIC_H
+#define C_PANIC_H
-#ifndef USBWATCHER_PANIC_H
-#define USBWATCHER_PANIC_H
#include <e32base.h>
#include <e32debug.h>
+
_LIT(KUsbWatcherPanic, "UsbOTGWatcher");
enum TUsbWatcherPanic
@@ -107,17 +108,16 @@
EWrongTimerId, //66
EUnexpectedNotifId, //67
EUnknownUsbServiceState, //68
- EUnexpectedUsbServiceState, //69
+ EUnexpectedUsbServiceState, //69
EUnexpectedUsbSwitchPersonalityState, //70
-
- ECanNotFindUsbOtgWatcherStateObserver //71
+
+ ECanNotFindUsbOtgWatcherStateObserver, //71
+ ENoObserverToUnsubscribe, // 72
+ EObserverAlreadyExists, //73
+ EIdForNotDefinedStateRequested, //74
+ ECanNotFindHostEventNotificationObserver, //75
+ ENoTimersDefinedForThisClass //76
};
-/**
- * Shows application name and panic code
- * @param aPanicId panic id
- */
-void Panic(TUsbWatcherPanic aPanicId);
-
-#endif // USBWATCHER_PANIC_H
+#endif // C_PANIC_H
--- a/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbotgdefs.h>
@@ -40,10 +39,9 @@
//
void CUsbBusActivityObserver::ConstructL()
{
+ LOG_FUNC
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::ConstructL" ) );
-
- User::LeaveIfError(iBusActivity.Attach(KUidUsbManCategory,
+ LEAVEIFERROR(iBusActivity.Attach(KUidUsbManCategory,
KUsbOtgConnectionIdleProperty));
}
@@ -54,8 +52,7 @@
//
CUsbBusActivityObserver* CUsbBusActivityObserver::NewL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::NewL" ) );
+ LOG_FUNC
CUsbBusActivityObserver* self = new (ELeave) CUsbBusActivityObserver();
CleanupStack::PushL(self);
@@ -71,8 +68,7 @@
CUsbBusActivityObserver::~CUsbBusActivityObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::~CUsbBusActivityObserver" ) );
+ LOG_FUNC
Cancel();
@@ -89,20 +85,16 @@
CUsbBusActivityObserver::TBusActivity CUsbBusActivityObserver::BusActivity()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::BusActivity" ) );
-
TInt val(0);
TInt err = iBusActivity.Get(val);
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::BusActivity CanNotGetBusActivityProperty" ) );
- Panic(ECanNotGetBusActivityProperty);
+ LOG("ECanNotGetBusActivityProperty" );
+ PANIC( ECanNotGetBusActivityProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::State = %d" ), val ));
-
return (0 == val ? EBusActive : EBusIdle);
}
@@ -111,11 +103,18 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver* aObserver)
+void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG( "Observer already exists" );
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -129,31 +128,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver* aObserver)
+void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL" ) );
+ LOG_FUNC
- if (0 == iObservers.Count()) // no items
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::UnsubscribeL No observers" ) );
+ LOG( "Observer not found" );
+ PANIC( ECanNotFindBusActivityObserver);
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);
- }
+ iObservers.Remove(i);
- if (0 == iObservers.Count()) // no items
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
@@ -166,15 +155,17 @@
//
void CUsbBusActivityObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
// if error occured, inform observers
- if(KErrNone != iStatus.Int())
+ if (KErrNone != iStatus.Int())
{
for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->BusActivityErrorL(iStatus.Int());
- }
+ {
+ iObservers[i]->BusActivityErrorL(iStatus.Int());
+ }
}
// re-issue request first
@@ -188,7 +179,7 @@
{
case EBusIdle:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusIdle" ) );
+ LOG("BusIdle");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -199,7 +190,7 @@
case EBusActive:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusActive" ) );
+ LOG("BusActive");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -210,8 +201,8 @@
default:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunL BusActive WrongBusState" ) );
- Panic(EWrongBusState);
+ LOG("WrongBusState" );
+ PANIC( EWrongBusState);
}
}
@@ -232,9 +223,10 @@
//
TInt CUsbBusActivityObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbBusActivityObserver::RunError aError = %d" ), aError));
-
+ LOG1( "aError = %d", aError );
+
// try to continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbman.h>
@@ -41,8 +40,7 @@
//
void CUsbHostEventNotificationObserver::ConstructL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::ConstructL" ) );
+ LOG_FUNC
}
@@ -53,8 +51,7 @@
CUsbHostEventNotificationObserver* CUsbHostEventNotificationObserver::NewL(
RUsb* aUsb)
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::NewL" ) );
+ LOG_FUNC
CUsbHostEventNotificationObserver* self =
new (ELeave) CUsbHostEventNotificationObserver(aUsb);
@@ -70,8 +67,7 @@
//
CUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver" ) );
+ LOG_FUNC
Cancel();
@@ -84,11 +80,19 @@
// ---------------------------------------------------------------------------
//
void CUsbHostEventNotificationObserver::SubscribeL(
- MUsbHostEventNotificationObserver* aObserver)
+ MUsbHostEventNotificationObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG("Observer already exists" );
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -103,30 +107,21 @@
// ---------------------------------------------------------------------------
//
void CUsbHostEventNotificationObserver::UnsubscribeL(
- MUsbHostEventNotificationObserver* aObserver)
+ MUsbHostEventNotificationObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ LOG_FUNC
+
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::UnsubscribeL No observers" ) );
+ LOG("Observer not found");
+ PANIC( ECanNotFindHostEventNotificationObserver);
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);
- }
+ iObservers.Remove(i);
- if (0 == iObservers.Count()) // no items
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
@@ -139,17 +134,19 @@
//
void CUsbHostEventNotificationObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d", iStatus.Int());
- // if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ // if error occured, tell to Observers
+ if (KErrNone != iStatus.Int())
+ {
+ for (TInt i(0); i < iObservers.Count(); ++i)
{
- for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->HostEventNotificationErrorL(iStatus.Int());
- }
- return;
+ iObservers[i]->HostEventNotificationErrorL(iStatus.Int());
}
+ return;
+ }
TDeviceEventInformation dei(iEventInfo);
@@ -157,20 +154,20 @@
iUsb->HostEventNotification(iStatus, iEventInfo);
SetActive();
- // Log the event
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iDeviceId = %d" ), dei.iDeviceId));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iEventType = %d" ), dei.iEventType));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iError = %d" ), dei.iError));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iDriverLoadStatus = %d" ), dei.iDriverLoadStatus));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iVid = %d" ), dei.iVid));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL iEventInfo.iPid = %d" ), dei.iPid));
+ // Log the event
+ LOG1( "iEventInfo.iDeviceId = %d" , dei.iDeviceId);
+ LOG1( "iEventInfo.iEventType = %d" , dei.iEventType);
+ LOG1( "iEventInfo.iError = %d" , dei.iError);
+ LOG1( "iEventInfo.iDriverLoadStatus = %d" , dei.iDriverLoadStatus);
+ LOG1( "iEventInfo.iVid = %d" , dei.iVid);
+ LOG1( "iEventInfo.iPid = %d" , dei.iPid);
// then process property change
switch (dei.iEventType)
{
case EDeviceAttachment:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DeviceAttachment" ) );
+ LOG("DeviceAttachment" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -181,7 +178,7 @@
case EDeviceDetachment:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DeviceDetachment" ) );
+ LOG( "DeviceDetachment" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -196,7 +193,7 @@
{
case EDriverLoadSuccess:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadSuccess" ) );
+ LOG( "DriverLoadSuccess" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -207,18 +204,18 @@
}
case EDriverLoadPartialSuccess:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadPartialSuccess" ) );
+ LOG( "DriverLoadPartialSuccess" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->DriverLoadPartialSuccessL(dei);
}
+
break;
-
}
case EDriverLoadFailure:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadFailure" ) );
+ LOG( "DriverLoadFailure");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -228,8 +225,8 @@
}
default:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL DriverLoadFailure WrongDriverLoadStatus" ) );
- Panic(EWrongDriverLoadStatus);
+ LOG("WrongDriverLoadStatus" );
+ PANIC( EWrongDriverLoadStatus);
}
}
break;
@@ -237,12 +234,10 @@
}
default:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunL WrongHostEventNotification" ) );
- Panic(EWrongHostEventNotification);
+ LOG( "WrongHostEventNotification" );
+ PANIC( EWrongHostEventNotification);
}
-
}
-
}
// ---------------------------------------------------------------------------
@@ -260,8 +255,9 @@
//
TInt CUsbHostEventNotificationObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbHostEventNotificationObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d" , aError);
// try to recover and continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbotgdefs.h>
@@ -40,10 +39,9 @@
//
void CUsbIdPinObserver::ConstructL()
{
+ LOG_FUNC
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::ConstructL" ) );
-
- User::LeaveIfError(iIdPin.Attach(KUidUsbManCategory,
+ LEAVEIFERROR(iIdPin.Attach(KUidUsbManCategory,
KUsbOtgIdPinPresentProperty));
}
@@ -54,8 +52,7 @@
//
CUsbIdPinObserver* CUsbIdPinObserver::NewL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::NewL" ) );
+ LOG_FUNC
CUsbIdPinObserver* self = new (ELeave) CUsbIdPinObserver();
CleanupStack::PushL(self);
@@ -70,8 +67,7 @@
//
CUsbIdPinObserver::~CUsbIdPinObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::~CUsbIdPinObserver" ) );
+ LOG_FUNC
Cancel();
@@ -89,33 +85,35 @@
/* this getter is not const, because for some reason RProperty::Get is not const */
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin" ) );
-
TInt val(0);
TInt err = iIdPin.Get(val);
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin CanNotGetIdPinProperty" ) );
- Panic(ECanNotGetIdPinProperty);
+ LOG("CanNotGetIdPinProperty" );
+ PANIC( ECanNotGetIdPinProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::IdPin = %d" ), val ));
-
- // 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" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG("Observer already exists" );
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -129,30 +127,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver* aObserver)
+void CUsbIdPinObserver::UnsubscribeL(MUsbIdPinObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL" ) );
- if (0 == iObservers.Count()) // no items
+ LOG_FUNC
+
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIdPinObserver::UnsubscribeL No observers" ) );
+ LOG("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);
- }
+ iObservers.Remove(i);
- if (0 == iObservers.Count()) // no items
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
@@ -165,17 +154,19 @@
//
void CUsbIdPinObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
- // if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ // if error occured, tell to Observers
+ if (KErrNone != iStatus.Int())
+ {
+ for (TInt i(0); i < iObservers.Count(); ++i)
{
- for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->IdPinErrorL(iStatus.Int());
- }
- return;
+ iObservers[i]->IdPinErrorL(iStatus.Int());
}
+ return;
+ }
// re-issue request first
iIdPin.Subscribe(iStatus);
@@ -189,7 +180,7 @@
{
case EIdPinOn:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin ON"));
+ LOG("IdPin ON");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -197,11 +188,10 @@
}
break;
}
- ;
case EIdPinOff:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL IdPin OFF"));
+ LOG("IdPin OFF");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -209,12 +199,11 @@
}
break;
}
- ;
default:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunL WrongIdPinState"));
- Panic(EWrongIdPinState);
+ LOG("WrongIdPinState");
+ PANIC( EWrongIdPinState);
}
}
@@ -235,8 +224,9 @@
//
TInt CUsbIdPinObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbIdPinObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d", aError);
// try to continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Blink/show Usb indicator notifier implementation
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Blink/show Usb indicator notifier implementation
+ *
+ */
#include <AknSmallIndicator.h>
#include <avkon.hrh>
@@ -33,11 +32,13 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher)
+CUsbIndicatorNotifier* CUsbIndicatorNotifier::NewL(
+ CUsbNotifManager& aNotifManager, CUsbOtgWatcher& aOtgWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::NewL" ));
+ LOG_FUNC
- CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(aNotifManager, aOtgWatcher);
+ CUsbIndicatorNotifier* self = new (ELeave) CUsbIndicatorNotifier(
+ aNotifManager, aOtgWatcher);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
@@ -50,34 +51,29 @@
//
CUsbIndicatorNotifier::~CUsbIndicatorNotifier()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::~CUsbIndicatorNotifier" ) );
-
+ LOG_FUNC
+
Close();
- delete iIconBlinkingTimer;
-
- // Unsubscribe from VBus change notifications
- if(iOtgWatcher)
+
+ if (iOtgWatcher.VBusObserver())
{
- if(iOtgWatcher->VBusObserver())
- {
- TRAPD(err, iOtgWatcher->VBusObserver()->UnsubscribeL(this));
- err=err; // to avoid warning;
- }
-
- // Unsubscribe from otg watcher states change notifications
- TRAPD(err, iOtgWatcher->UnsubscribeL(this));
- err=err; // to avoid warning;
+ TRAP_IGNORE(iOtgWatcher.VBusObserver()->UnsubscribeL(*this));
}
+
+ // Unsubscribe from otg watcher states change notifications
+ TRAP_IGNORE(iOtgWatcher.UnsubscribeL(*this));
}
// ---------------------------------------------------------------------------
// C++ constructor
// ---------------------------------------------------------------------------
//
-CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager* aNotifManager, CUsbOtgWatcher* aOtgWatcher) :
- CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(aOtgWatcher)
+CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager,
+ CUsbOtgWatcher& aOtgWatcher) :
+ CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(
+ aOtgWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::CUsbIndicatorNotifier" ) );
+ LOG_FUNC
//To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer
//when AVKON implements animation form of usb indicator.
@@ -90,19 +86,16 @@
//
void CUsbIndicatorNotifier::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ConstructL" ) );
-
+ LOG_FUNC
+
// Subscribe for VBus change notifications
- iOtgWatcher->VBusObserver()->SubscribeL(this);
-
+ iOtgWatcher.VBusObserver()->SubscribeL(*this);
+
// Subscribe for otg watcher states change notifications
- iOtgWatcher->SubscribeL(this);
+ iOtgWatcher.SubscribeL(*this);
- iIconBlinkingTimer = CUsbTimer::NewL(this, EIconBlinkingTimer);
-
// check here for condition to set usb indicator
SetIndicatorL();
-
}
// ---------------------------------------------------------------------------
@@ -113,11 +106,13 @@
//
void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible)
{
- FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowStaticL, aVisible=%d" ), aVisible));
+ LOG_FUNC
+
+ LOG1("aVisible = %d" , aVisible);
- iIconBlinkingTimer->Cancel();
-
- SetIndicatorStateL(aVisible ? EAknIndicatorStateOn : EAknIndicatorStateOff);
+ SetIndicatorStateL(aVisible
+ ? EAknIndicatorStateOn
+ : EAknIndicatorStateOff);
}
// ---------------------------------------------------------------------------
@@ -126,10 +121,9 @@
//
void CUsbIndicatorNotifier::BlinkL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::BlinkL" ));
+ LOG_FUNC
- // Will be canceled if active in After()
- iIconBlinkingTimer->After(0);
+ SetIndicatorStateL( EAknIndicatorStateAnimate );
}
// ---------------------------------------------------------------------------
@@ -138,8 +132,8 @@
//
void CUsbIndicatorNotifier::ShowL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::ShowL" ) );
-
+ LOG_FUNC
+
ShowStaticL(ETrue);
}
@@ -149,38 +143,9 @@
//
void CUsbIndicatorNotifier::Close()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::Close" ) );
-
- iIconBlinkingTimer->Cancel();
- TRAP_IGNORE( ShowStaticL(EFalse) );
- }
+ LOG_FUNC
-// ---------------------------------------------------------------------------
-// From MUsbTimerObserver
-// ---------------------------------------------------------------------------
-//
-void CUsbIndicatorNotifier::TimerElapsedL(TUsbTimerId aTimerId)
- {
- switch (aTimerId)
- {
- case EIconBlinkingTimer:
- {
- SetIndicatorStateL(iIndicatorState ? EAknIndicatorStateOn : EAknIndicatorStateOff);
-
- iIndicatorState = (iIndicatorState == EAknIndicatorStateOn
- ? EAknIndicatorStateOff : EAknIndicatorStateOn);
-
- // Will be canceled if active in After()
- iIconBlinkingTimer->After(KUsbIndicatorBlinkingInterval);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::TimerElapsedL - Unknown timer" ) );
-
- Panic(EWrongTimerId);
- }
- }
+ TRAP_IGNORE( ShowStaticL(EFalse) );
}
// ---------------------------------------------------------------------------
@@ -189,11 +154,13 @@
//
void CUsbIndicatorNotifier::SetIndicatorStateL(const TInt aState)
{
- FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::SetIndicatorStateL - aState=%d" ), aState));
+
+ LOG1( "USB indicator State = %d" , aState);
- CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid(EAknIndicatorUSBConnection));
- indicator->SetIndicatorStateL( aState );
- CleanupStack::PopAndDestroy( indicator ); //indicator
+ CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid(
+ EAknIndicatorUSBConnection));
+ indicator->SetIndicatorStateL(aState);
+ CleanupStack::PopAndDestroy(indicator); //indicator
}
// ---------------------------------------------------------------------------
@@ -202,7 +169,6 @@
//
void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState)
{
- FTRACE( FPrint (_L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::OtgWatcherStateChangedL - aState=%d" ), aState));
SetIndicatorL();
}
@@ -212,7 +178,6 @@
//
void CUsbIndicatorNotifier::VBusDownL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusDownL" ) );
SetIndicatorL();
}
@@ -222,7 +187,6 @@
//
void CUsbIndicatorNotifier::VBusUpL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusUpL" ) );
SetIndicatorL();
}
@@ -232,8 +196,7 @@
//
void CUsbIndicatorNotifier::VBusObserverErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::VBusObserverErrorL" ) );
- // do not care
+ // do nothing
}
// ---------------------------------------------------------------------------
@@ -242,24 +205,22 @@
//
void CUsbIndicatorNotifier::SetIndicatorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbIndicatorNotifier::SetIndicatorL" ) );
-
- if (!(iOtgWatcher->IsDeviceA()))
+ if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral)
{
- // if B, than other party (usbwatcher) takes care of usb indicator
+ // if B or peripheral, than other party (usbwatcher) takes care of usb indicator
// in combined usbwatcher (if role swap allowed) one class has to manage usb indicator
return;
}
-
+
// if VBus Up and we are host -> show indicator
- if ((iOtgWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) &&
- (iOtgWatcher->CurrentHostState()->Id() == EUsbStateHostAHost))
+ if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
+ && (iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAHost))
{
ShowStaticL(ETrue);
}
// if VBus up and we are not host -> Blink indicator
- else if((iOtgWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) &&
- (iOtgWatcher->CurrentHostState()->Id() != EUsbStateHostAHost))
+ else if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
+ && (iOtgWatcher.CurrentHostState()->Id() != EUsbStateHostAHost))
{
BlinkL();
}
--- a/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbman.h>
#include <d32usbdi_errors.h>
@@ -22,7 +21,7 @@
#include "cusbmessagenotificationobserver.h"
-#include "definitions.h"
+#include "definitions.h"
#include "debug.h"
#include "panic.h"
@@ -42,8 +41,7 @@
//
void CUsbMessageNotificationObserver::ConstructL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::ConstructL" ) );
+ LOG_FUNC
}
@@ -54,8 +52,7 @@
CUsbMessageNotificationObserver* CUsbMessageNotificationObserver::NewL(
RUsb* aUsb)
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::NewL" ) );
+ LOG_FUNC
CUsbMessageNotificationObserver* self =
new (ELeave) CUsbMessageNotificationObserver(aUsb);
@@ -71,8 +68,7 @@
//
CUsbMessageNotificationObserver::~CUsbMessageNotificationObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::~CUsbMessageNotificationObserver" ) );
+ LOG_FUNC
Cancel();
@@ -85,11 +81,18 @@
// ---------------------------------------------------------------------------
//
void CUsbMessageNotificationObserver::SubscribeL(
- MUsbMessageNotificationObserver* aObserver)
+ MUsbMessageNotificationObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG("Observer already exists");
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -103,29 +106,19 @@
// ---------------------------------------------------------------------------
//
void CUsbMessageNotificationObserver::UnsubscribeL(
- MUsbMessageNotificationObserver* aObserver)
+ MUsbMessageNotificationObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL" ) );
+ LOG_FUNC
- if (0 == iObservers.Count()) // no items
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL No observers" ) );
- return;
- }
-
- TInt i(0);
- while (i < iObservers.Count() && aObserver != iObservers[i])
- ++i;
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
+ {
+ LOG("Observer not found" )
+ PANIC( ECanNotFindMessageNotificationObserver);
+ return;
+ }
- if (aObserver == iObservers[i]) // found
- {
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::UnsubscribeL CanNotFindMessageNotificationObserver" ) );
- Panic(ECanNotFindMessageNotificationObserver);
- }
+ iObservers.Remove(i);
if (0 == iObservers.Count()) // no items
{
@@ -140,13 +133,16 @@
//
void CUsbMessageNotificationObserver::RunL()
{
+ // Log the event
+ LOG1( "Message notification observer iMessage = %d" , iMessage);
+
// if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ if (KErrNone != iStatus.Int())
{
for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->MessageNotificationErrorL(iStatus.Int());
- }
+ {
+ iObservers[i]->MessageNotificationErrorL(iStatus.Int());
+ }
return;
}
@@ -156,15 +152,12 @@
iUsb->MessageNotification(iStatus, iMessage);
SetActive();
- // Log the event
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL iMessage = %d" ), message));
-
// then process property change
switch (message)
{
case KErrUsbBadHubPosition:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL HubBadPosition" ) );
+ LOG("HubBadPosition" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -174,7 +167,7 @@
}
case KErrUsbOtgVbusError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL VBusError" ) );
+ LOG( "VBusError");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -184,7 +177,7 @@
}
case KUsbMessageSrpReceived:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL SRP received" ) );
+ LOG("SRP received" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -194,7 +187,7 @@
}
case KUsbMessageRequestSession:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunL Session Requested" ) );
+ LOG("Session requested" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -205,6 +198,7 @@
// notify states with other messages
default:
{
+
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->MessageNotificationReceivedL(message);
@@ -231,8 +225,9 @@
//
TInt CUsbMessageNotificationObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbMessageNotificationObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d" , aError);
// try to recover and continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Base classes for Usb notifier wrapper
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Base classes for Usb notifier wrapper
+ *
+ */
#include "cusbnotifmanager.h"
#include "cusbnotenotifier.h"
@@ -29,12 +28,9 @@
// ---------------------------------------------------------------------------
//
CUsbNoteNotifier::CUsbNoteNotifier(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUid aCat, TUint aNotifId) :
- CUsbNotifier(aNotifManager, aCat, aNotifId),
- iNotifier(aNotifier)
+ CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId) :
+ CUsbNotifier(aNotifManager, aCat, aNotifId), iNotifier(aNotifier)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CUsbNoteNotifier" ) );
-
}
// ---------------------------------------------------------------------------
@@ -43,9 +39,10 @@
//
void CUsbNoteNotifier::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::ConstructL" ) );
+ LOG_FUNC
- iNotifierActive = new(ELeave)CUsbNoteNotifier::CNotifierActive(iNotifier, this);
+ iNotifierActive = new (ELeave) CUsbNoteNotifier::CNotifierActive(
+ iNotifier, *this);
}
// ---------------------------------------------------------------------------
@@ -54,8 +51,8 @@
//
CUsbNoteNotifier::~CUsbNoteNotifier()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::~CUsbNoteNotifier" ) );
-
+ LOG_FUNC
+
delete iNotifierActive;
}
@@ -65,7 +62,9 @@
//
void CUsbNoteNotifier::ShowL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNoteNotifier::ShowL aCat = 0x%X aNotifId = 0x%X" ), iCat, iNotifId));
+ LOG_FUNC
+
+ LOG2( "aCat = 0x%X aNotifId = 0x%X" , iCat, iNotifId);
iNotifierActive->StartL();
}
@@ -76,22 +75,18 @@
//
void CUsbNoteNotifier::Close()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::Close" ) );
}
-
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// C++ default constructor
// ---------------------------------------------------------------------------
//
-CUsbNoteNotifier::CNotifierActive::CNotifierActive(RNotifier& aNotifier,
- CUsbNoteNotifier* aUsbNoteNotifier) :
- CUsbNoteNotifier::CNotifierActive::CActive(EPriorityStandard),
- iUsbNoteNotifier(aUsbNoteNotifier),
- iNotifier(aNotifier),
- iRes(0)
+CUsbNoteNotifier::CNotifierActive::CNotifierActive(RNotifier& aNotifier,
+ CUsbNoteNotifier& aUsbNoteNotifier) :
+ CUsbNoteNotifier::CNotifierActive::CActive(EPriorityStandard),
+ iUsbNoteNotifier(aUsbNoteNotifier), iNotifier(aNotifier), iRes(0)
{
CActiveScheduler::Add(this);
}
@@ -111,19 +106,17 @@
//
void CUsbNoteNotifier::CNotifierActive::StartL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::ShowL aCat = 0x%X aNotifId = 0x%X" ),
- iUsbNoteNotifier->iCat, iUsbNoteNotifier->iNotifId));
+ LOG_FUNC
if (IsActive())
{
- Panic(ENotifierIsActiveAlready);
+ PANIC( ENotifierIsActiveAlready);
return;
}
- TPckgBuf<TInt> pckg;
- pckg() = iUsbNoteNotifier->iNotifId;
-
- iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier->iCat, pckg, iRes);
+ iNotifIdPckg() = iUsbNoteNotifier.iNotifId;
+ iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier.iCat,
+ iNotifIdPckg, iRes);
SetActive();
}
@@ -133,15 +126,18 @@
//
void CUsbNoteNotifier::CNotifierActive::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCCUsbNoteNotifier::CNotifierActive::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
// if error occured, deal with it in RunError
- User::LeaveIfError(iStatus.Int());
+ LEAVEIFERROR(iStatus.Int());
- iNotifier.CancelNotifier(iUsbNoteNotifier->iCat);
+ iNotifier.CancelNotifier(iUsbNoteNotifier.iCat);
// report to owner that show is over
- iUsbNoteNotifier->iNotifManager->NotifierShowCompletedL(iUsbNoteNotifier, KErrNone, iRes());
+ iUsbNoteNotifier.iNotifManager.NotifierShowCompletedL(iUsbNoteNotifier,
+ KErrNone, iRes());
}
// ---------------------------------------------------------------------------
@@ -150,9 +146,7 @@
//
void CUsbNoteNotifier::CNotifierActive::DoCancel()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::DoCancel" ) );
-
- iNotifier.CancelNotifier(iUsbNoteNotifier->iCat);
+ iNotifier.CancelNotifier(iUsbNoteNotifier.iCat);
}
// ---------------------------------------------------------------------------
@@ -161,9 +155,11 @@
//
TInt CUsbNoteNotifier::CNotifierActive::RunError(TInt aError)
{
- FTRACE( FPrint(_L("[USBOTGWATCHER]\tCUsbNoteNotifier::CNotifierActive::RunError aError = %d" ), aError));
+ LOG_FUNC
- iNotifier.CancelNotifier(iUsbNoteNotifier->iCat);
+ LOG1("aError = %d" , aError);
+
+ iNotifier.CancelNotifier(iUsbNoteNotifier.iCat);
// try to continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbnotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbnotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,24 +1,23 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Base classes for Usb notifier wrapper
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Base classes for Usb notifier wrapper
+ *
+ */
#include "cusbnotifmanager.h"
#include "cusbnotifier.h"
-
+
#include "debug.h"
#include "panic.h"
@@ -30,7 +29,7 @@
//
CUsbNotifier::~CUsbNotifier()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::~CUsbNotifier" ) );
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -46,12 +45,11 @@
// C++ constructor
// ---------------------------------------------------------------------------
//
-CUsbNotifier::CUsbNotifier(CUsbNotifManager* aNotifManager, TUid aCat,
+CUsbNotifier::CUsbNotifier(CUsbNotifManager& aNotifManager, TUid aCat,
TUint aNotifId) :
iNotifManager(aNotifManager), iCat(aCat), iNotifId(aNotifId),
iIsFeedbackNeeded(EFalse)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::CUsbNotifier" ) );
}
// ---------------------------------------------------------------------------
@@ -60,7 +58,6 @@
//
void CUsbNotifier::SetFeedbackNeeded()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifier::SetFeedbackNeeded" ) );
iIsFeedbackNeeded = ETrue;
}
--- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,19 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbuinotif.h>
@@ -30,7 +30,7 @@
// ---------------------------------------------------------------------------
//
CWaitNotifierInfo::CWaitNotifierInfo(CUsbNotifier* aWaitNotifier,
- MWaitNotifierObserver* aObserver) :
+ MWaitNotifierObserver& aObserver) :
iWaitNotifier(aWaitNotifier), iObserver(aObserver)
{
}
@@ -41,7 +41,7 @@
//
void CWaitNotifierInfo::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::ConstructL" ) );
+ LOG_FUNC
// owenrship for iWaitNotifier transferred in default constructor.
// this object is responsible for deletion of the iWaitNotifier then
}
@@ -51,9 +51,10 @@
// ---------------------------------------------------------------------------
//
CWaitNotifierInfo* CWaitNotifierInfo::NewL(CUsbNotifier* aWaitNotifier,
- MWaitNotifierObserver* aObserver)
+ MWaitNotifierObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::NewL" ) );
+ LOG_FUNC
+
CWaitNotifierInfo* self = new (ELeave) CWaitNotifierInfo(aWaitNotifier,
aObserver);
CleanupStack::PushL(self);
@@ -68,7 +69,7 @@
//
CWaitNotifierInfo::~CWaitNotifierInfo()
{
- FLOG( _L( "[USBOTGWATCHER]\tCWaitNotifierInfo::~CWaitNotifierInfo" ) );
+ LOG_FUNC
delete iWaitNotifier;
}
@@ -87,18 +88,16 @@
//
MWaitNotifierObserver* CWaitNotifierInfo::Observer() const
{
- return iObserver;
+ return &iObserver;
}
-
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher* aOtgWatcher)
+CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher& aOtgWatcher)
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
+ LOG_FUNC
CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
CleanupStack::PushL(self);
@@ -111,14 +110,13 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbNotifManager::ConstructL(CUsbOtgWatcher* aOtgWatcher)
+void CUsbNotifManager::ConstructL(CUsbOtgWatcher& aOtgWatcher)
{
+ LOG_FUNC
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) );
+ LEAVEIFERROR(iNotifier.Connect());
- User::LeaveIfError(iNotifier.Connect());
-
- iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this, aOtgWatcher);
+ iIndicatorNotifier = CUsbIndicatorNotifier::NewL(*this, aOtgWatcher);
}
@@ -128,7 +126,6 @@
//
CUsbNotifManager::CUsbNotifManager()
{
-
}
// ---------------------------------------------------------------------------
@@ -137,13 +134,12 @@
//
CUsbNotifManager::~CUsbNotifManager()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
+ LOG_FUNC
CloseAllNotifiers();
-
+
delete iIndicatorNotifier;
-
+
iNotifier.Close();
}
@@ -155,16 +151,17 @@
void CUsbNotifManager::ShowNotifierL(TUid aCat, TUint aNotifId,
MWaitNotifierObserver* aObserver)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifier aCat = 0x%X aNotifId = %d, aObserver=0x%X" ),
- aCat, aNotifId, aObserver));
+ LOG_FUNC
+
+ LOG3( "aCat = 0x%X aNotifId = %d, aObserver=0x%X" , aCat, aNotifId, aObserver);
// remove non-feedback notifiers from the list
for (TUint i(0); i < iWaitNotifiers.Count(); ++i)
{
- CWaitNotifierInfo* waitNotifier = iWaitNotifiers[i];
- if (!(waitNotifier->WaitNotifier()->IsFeedbackNeeded()))
+ CWaitNotifierInfo* waitNotifierInfo = iWaitNotifiers[i];
+ if (!(waitNotifierInfo->WaitNotifier()->IsFeedbackNeeded()))
{
- delete waitNotifier;
+ delete waitNotifierInfo;
iWaitNotifiers.Remove(i);
}
}
@@ -182,42 +179,43 @@
CUsbNotifier* notifier(NULL);
if (aCat == KUsbUiNotifOtgError)
{
- __ASSERT_ALWAYS(aObserver != NULL, Panic(EWrongNotifierCategory));
- notifier = CUsbWaitNotifier::NewL(iNotifier, this, aNotifId);
+ ASSERT_PANIC(aObserver != NULL, EWrongNotifierCategory);
+ notifier = CUsbWaitNotifier::NewL(iNotifier, *this, aNotifId);
}
else if (aCat == KUsbUiNotifOtgWarning)
{
- notifier = CUsbWarningNotifier::NewL(iNotifier, this, aNotifId);
+ notifier = CUsbWarningNotifier::NewL(iNotifier, *this, aNotifId);
}
else
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifierL - Unexpected aCat" ) );
- Panic(EWrongNotifierCategory);
+ LOG1("Unexpected aCat = 0x%X", aCat );
+ PANIC(EWrongNotifierCategory);
}
CleanupStack::PushL(notifier);
-
- iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, aObserver));
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowNotifierL - Start to show note" ) );
+ iWaitNotifiers.AppendL(CWaitNotifierInfo::NewL(notifier, *aObserver));
+
notifier->ShowL();
- CleanupStack::Pop(notifier);
+ CleanupStack::Pop(notifier);
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier* aWaitNotifier,
+void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier& aWaitNotifier,
TInt aResult, TInt aFeedback)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::NotifierShowCompleted aResult = %d" ), aResult));
+ LOG_FUNC
+
+ LOG1( "aResult = %d", aResult);
// remove Notifier from the list
for (TUint i(0); i < iWaitNotifiers.Count(); ++i)
{
- if (aWaitNotifier == iWaitNotifiers[i]->WaitNotifier())
+ if (&aWaitNotifier == iWaitNotifiers[i]->WaitNotifier())
{
MWaitNotifierObserver* observer = iWaitNotifiers[i]->Observer();
@@ -236,7 +234,7 @@
//
void CUsbNotifManager::CloseAllNotifiers()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) );
+ LOG_FUNC
iWaitNotifiers.ResetAndDestroy();
iIndicatorNotifier->Close();
--- a/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include "cusbotgstateobserver.h"
@@ -38,10 +37,9 @@
//
void CUsbOtgStateObserver::ConstructL()
{
+ LOG_FUNC
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::ConstructL" ) );
-
- User::LeaveIfError(iOtgState.Attach(KUidUsbManCategory,
+ LEAVEIFERROR(iOtgState.Attach(KUidUsbManCategory,
KUsbOtgStateProperty));
}
@@ -52,8 +50,7 @@
//
CUsbOtgStateObserver* CUsbOtgStateObserver::NewL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::NewL" ) );
+ LOG_FUNC
CUsbOtgStateObserver* self = new (ELeave) CUsbOtgStateObserver();
CleanupStack::PushL(self);
@@ -68,8 +65,7 @@
//
CUsbOtgStateObserver::~CUsbOtgStateObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::~CUsbOtgStateObserver" ) );
+ LOG_FUNC
Cancel();
@@ -85,21 +81,16 @@
//
TUsbOtgState CUsbOtgStateObserver::OtgState()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::OtgState" ) );
-
TInt val(0);
TInt err = iOtgState.Get(val);
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::StOtgState CanNotGetOtgStateProperty" ) );
- Panic(ECanNotGetOtgStateProperty);
+ LOG("CanNotGetOtgStateProperty" );
+ PANIC( ECanNotGetOtgStateProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::OtgState = %d" ), val ));
-
return (TUsbOtgState) val;
}
@@ -108,11 +99,18 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver* aObserver)
+void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG( "Observer already exists" );
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -126,31 +124,21 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver* aObserver)
+void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::UnsubscribeL" ) );
+ LOG_FUNC
- 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
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- iObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::UnsubscribeL CanNotFindOtgStateObserver" ) );
- Panic(ECanNotFindOtgStateObserver);
+ LOG("Observer not found");
+ PANIC( ECanNotFindOtgStateObserver);
+ return;
}
- if (0 == iObservers.Count()) // no items
+ iObservers.Remove(i);
+
+ if (0 == iObservers.Count()) // no observers anymore
{
// cancel pending request
Cancel();
@@ -163,18 +151,20 @@
//
void CUsbOtgStateObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
// if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ if (KErrNone != iStatus.Int())
{
for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->OtgStateErrorL(iStatus.Int());
- }
+ {
+ iObservers[i]->OtgStateErrorL(iStatus.Int());
+ }
return;
}
-
+
// re-issue request first
iOtgState.Subscribe(iStatus);
SetActive();
@@ -186,12 +176,12 @@
{
case EUsbOtgStateReset:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == RESET" ) );
+ LOG("OTGState == RESET" );
break;
}
case EUsbOtgStateAIdle:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AIdle" ) );
+ LOG("OTGState == AIdle" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->AIdleL();
@@ -200,7 +190,7 @@
}
case EUsbOtgStateAHost:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AHost" ) );
+ LOG( "OTGState == AHost");
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->AHostL();
@@ -209,7 +199,7 @@
}
case EUsbOtgStateAPeripheral:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == APeripheral" ) );
+ LOG("OTGState == APeripheral" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->APeripheralL();
@@ -218,7 +208,7 @@
}
case EUsbOtgStateAVbusError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == AVBusError" ) );
+ LOG("OTGState == AVBusError" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->AVBusErrorL();
@@ -227,7 +217,7 @@
}
case EUsbOtgStateBIdle:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BIdle" ) );
+ LOG( "OTGState == BIdle" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->BIdleL();
@@ -236,7 +226,7 @@
}
case EUsbOtgStateBPeripheral:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BPeripheral" ) );
+ LOG("OTGState == BPeripheral" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->BPeripheralL();
@@ -245,7 +235,7 @@
}
case EUsbOtgStateBHost:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL OTGState == BHost" ) );
+ LOG("OTGState == BHost" );
for (TInt i(0); i < iObservers.Count(); ++i)
{
iObservers[i]->BHostL();
@@ -254,8 +244,8 @@
}
default:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOTGStateObserver::RunL WrongOtgState" ) );
- Panic(EWrongOtgState);
+ LOG("WrongOtgState" );
+ PANIC( EWrongOtgState);
}
}
@@ -276,8 +266,9 @@
//
TInt CUsbOtgStateObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgStateObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d" , aError);
// try to continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,46 +1,42 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbpersonalityids.h>
#include <usbuinotif.h>
#include <UsbWatcherInternalPSKeys.h>
-
#include "cusbotgwatcher.h"
#include "cusbstate.h"
-
#include "cusbstatehostainitiate.h"
#include "cusbstatehostahost.h"
#include "cusbstatehostaperipheral.h"
-#include "cusbstatehostaidle.h"
#include "cusbstatehosthandle.h"
-
+#include "cusbstatehostdelayhandle.h"
+#include "cusbstatehostdelayattachedhandle.h"
+#include "cusbstatehostdelaynotattachedhandle.h"
+#include "cusbstatehosthandledropping.h"
+#include "cusbstatehostundefined.h"
#include "cusbwarningnotifier.h"
-
#ifndef STIF
#include "cusbnotifmanager.h"
#else
#include "mockcusbnotifmanager.h"
#endif
-
#include "errors.h"
#include "debug.h"
#include "panic.h"
-
_LIT_SECURITY_POLICY_PASS( KAlwaysPassPolicy );
_LIT_SECURITY_POLICY_C1( KLocalServicesPolicy, ECapabilityLocalServices );
@@ -49,9 +45,10 @@
// ---------------------------------------------------------------------------
//
CUsbOtgWatcher::CUsbOtgWatcher(RUsb& aUsbMan) :
- iUsb(aUsbMan), iPersonalityId(KUsbPersonalityIdMTP)
+ iUsb(aUsbMan), iPersonalityId(KUsbPersonalityIdMTP), iUsbServiceRequest(
+ CUsbServiceControl::ERequestUndefined)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CUsbOtgWatcher" ) );
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -60,31 +57,35 @@
//
void CUsbOtgWatcher::ConstructL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ConstructL" ) );
+ LOG_FUNC
#ifdef _DEBUG
SelfTestL();
#endif
#ifndef STIF
- User::LeaveIfError(RProperty::Define( KPSUidUsbWatcher,
- KUsbWatcherIsPeripheralConnected, RProperty::EInt, KAlwaysPassPolicy,
- KLocalServicesPolicy ) );
+ LEAVEIFERROR(RProperty::Define(KPSUidUsbWatcher,
+ KUsbWatcherIsPeripheralConnected, RProperty::EInt,
+ KAlwaysPassPolicy, KLocalServicesPolicy));
- User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher,
- KUsbWatcherIsPeripheralConnected,
- KUsbWatcherPeripheralIsNotConnected ) );
+ LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher,
+ KUsbWatcherIsPeripheralConnected,
+ KUsbWatcherPeripheralIsNotConnected));
#endif
-
- iUsbServiceControl = CUsbServiceControl::NewL(this, iUsb);
+
+ iUsbServiceControl = CUsbServiceControl::NewL(*this, iUsb);
- User::LeaveIfError(iStates.Append(CUsbState::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAIdle::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostUndefined::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAInitiate::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAHost::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAPeripheral::NewL(*this)));
+
+ LEAVEIFERROR(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL(
+ *this)));
+ LEAVEIFERROR(iStates.Append(
+ CUsbStateHostDelayNotAttachedHandle::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(
+ CUsbStateHostHandleDropping::NewL(*this)));
iIdPinObserver = CUsbIdPinObserver::NewL();
iVBusObserver = CUsbVBusObserver::NewL();
@@ -94,14 +95,19 @@
&iUsb);
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);
+ 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())
{
@@ -116,7 +122,7 @@
//
EXPORT_C TBool CUsbOtgWatcher::IsDeviceA()
{
- __ASSERT_DEBUG(iIdPinObserver != NULL, Panic(EIdPinObserverNULLPointer));
+ ASSERT_PANIC(iIdPinObserver != NULL, EIdPinObserverNULLPointer);
return (iIdPinObserver->IdPin() == CUsbIdPinObserver::EIdPinOn
? ETrue
: EFalse);
@@ -128,7 +134,7 @@
//
EXPORT_C CUsbOtgWatcher* CUsbOtgWatcher::NewL(RUsb& aUsbMan)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::NewL" ) );
+ LOG_FUNC
CUsbOtgWatcher* self = new (ELeave) CUsbOtgWatcher(aUsbMan);
CleanupStack::PushL(self);
@@ -143,15 +149,41 @@
//
CUsbOtgWatcher::~CUsbOtgWatcher()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::~CUsbOtgWatcher" ) );
-
+ LOG_FUNC
+
#ifndef STIF
- RProperty::Delete( KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected );
+ RProperty::Delete(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected);
#endif
-
+
// delete Notif manager before VBus observer, due to USB indicator observes VBus
delete iNotifManager;
-
+
+ if (iIdPinObserver)
+ {
+ 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;
@@ -160,11 +192,11 @@
delete iMessageNotificationObserver;
iOtgStateObservers.Close();
-
+
// Destroy states
iStates.ResetAndDestroy();
iStates.Close();
-
+
delete iUsbServiceControl;
iUsb.Close();
@@ -178,8 +210,9 @@
void CUsbOtgWatcher::SetPersonalityL(TRequestStatus& /*aStatus*/,
TInt aPersonality)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPersonalityL aPersonality = %d" ), aPersonality));
+ LOG1( "aPersonality = %d" , aPersonality);
// watcher keeps this value, no need to pass it to request object
// state can read it from watcher when needed
@@ -199,7 +232,7 @@
//
void CUsbOtgWatcher::CancelSetPersonalityL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CancelSetPersonalityL" ) );
+ LOG_FUNC
iState->CancelSetPersonalityL();
}
@@ -210,7 +243,7 @@
//
void CUsbOtgWatcher::SetPreviousPersonalityL(TRequestStatus& /*aStatus*/)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPersonalityL" ) );
+ LOG_FUNC
// maybe more complex processing needed here
iState->SetPreviousPersonalityL();
@@ -222,7 +255,7 @@
//
void CUsbOtgWatcher::SetPreviousPersonalityL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPersonalityL" ) );
+ LOG_FUNC
iState->SetPreviousPersonalityL();
}
@@ -233,7 +266,7 @@
//
void CUsbOtgWatcher::CancelSetPreviousPersonalityL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::CancelSetPreviousPersonalityL" ) );
+ LOG_FUNC
iState->CancelSetPreviousPersonalityL();
}
@@ -244,7 +277,7 @@
//
void CUsbOtgWatcher::SetPreviousPreviousPersonalityOnDisconnectL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SetPreviousPreviousPersonalityOnDisconnectL" ) );
+ LOG_FUNC
}
@@ -255,19 +288,22 @@
//
void CUsbOtgWatcher::StartSessionL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::StartSessionL" ) );
+ LOG_FUNC
if (!CanStartSessionL())
{
- HandleHostProblemL(EUsbWatcherErrorInConnection);
+ HandleHostProblemL(EUsbWatcherCanNotStartSession,
+ EUsbStateHostHandleDropping);
return;
}
+ iUsbServiceRequest = CUsbServiceControl::EStartUsbService;
TInt err = iUsbServiceControl->StartL(iPersonalityId);
if (KErrNone != err)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::StartSessionL Can not start usb services. reason = %d" ), err));
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
+ LOG1( "Can not start usb services. err = %d" , err);
+ HandleHostProblemL(EUsbWatcherCanNotStartUsbServices,
+ EUsbStateHostHandleDropping);
return;
}
@@ -280,11 +316,12 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf)
+void CUsbOtgWatcher::HandleHostProblemL(TInt aWhatKindOf,
+ TUsbStateIds aInState)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HandleProblemL" ) );
- HostHandle()->SetWhat(aWhatKindOf);
- ChangeHostStateL(EUsbStateHostHandle);
+ LOG_FUNC
+ HostHandle(aInState)->SetWhat(aWhatKindOf);
+ ChangeHostStateL(aInState);
}
// ---------------------------------------------------------------------------
@@ -293,7 +330,7 @@
//
void CUsbOtgWatcher::IdPinOnL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOnL" ) );
+ LOG_FUNC
StartSessionL();
}
@@ -303,37 +340,24 @@
//
void CUsbOtgWatcher::IdPinOffL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL" ) );
-
- // for example, USB failed to start
- if(NULL == iHostState) return;
+ LOG_FUNC
- iVBusObserver->UnsubscribeL(this);
- iOtgStateObserver->UnsubscribeL(this);
- iBusActivityObserver->UnsubscribeL(this);
- iHostEventNotificationObserver->UnsubscribeL(this);
- iMessageNotificationObserver->UnsubscribeL(this);
-
- iHostState->JustBeforeLeavingThisStateL();
-
- iHostState = NULL;
+ ChangeHostStateL(EUsbStateHostUndefined);
iNotifManager->CloseAllNotifiers();
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL Before DisableFunctionDriverLoad " ) );
Usb().DisableFunctionDriverLoading();
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL Before TryStop" ) );
+ iUsbServiceRequest = CUsbServiceControl::EStopUsbService;
+ TInt err = iUsbServiceControl->StopL();
- TInt err = iUsbServiceControl->StopL();
+ LOG1( "iUsbServiceControl->Stop() err = %d", err );
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOnL ErrorStoppingUsbServices" ) );
- Panic(ECanNotStopUsbServices);
+ LOG( "ErrorStoppingUsbServices" );
+ PANIC(ECanNotStopUsbServices);
}
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinOffL iUsbServiceControl->Stop() OK" ) );
}
// ---------------------------------------------------------------------------
@@ -342,9 +366,8 @@
//
void CUsbOtgWatcher::IdPinErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::IdPinErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherIdPinError);
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
+ HandleHostProblemL(EUsbWatcherIdPinError, EUsbStateHostHandleDropping);
}
@@ -355,8 +378,7 @@
//
void CUsbOtgWatcher::VBusDownL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusDownL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->VBusDownL();
}
@@ -366,8 +388,7 @@
//
void CUsbOtgWatcher::VBusUpL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusUpL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->VBusUpL();
}
@@ -377,9 +398,9 @@
//
void CUsbOtgWatcher::VBusObserverErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusObserverErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherVBusObserverError);
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
+ HandleHostProblemL(EUsbWatcherVBusObserverError,
+ EUsbStateHostHandleDropping);
}
// From OTG state observer
@@ -389,8 +410,7 @@
//
void CUsbOtgWatcher::AIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AIdleL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->AIdleL();
}
@@ -400,8 +420,7 @@
//
void CUsbOtgWatcher::AHostL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AHostL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->AHostL();
}
@@ -411,8 +430,7 @@
//
void CUsbOtgWatcher::APeripheralL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::APeripheralL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->APeripheralL();
}
@@ -422,8 +440,7 @@
//
void CUsbOtgWatcher::AVBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::AVBusErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->AVBusErrorL();
}
@@ -433,8 +450,7 @@
//
void CUsbOtgWatcher::BIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BIdleL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BIdleL();
}
@@ -444,8 +460,7 @@
//
void CUsbOtgWatcher::BPeripheralL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BPeripheralL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BPeripheralL();
}
@@ -455,8 +470,7 @@
//
void CUsbOtgWatcher::BHostL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BHostL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BHostL();
}
@@ -466,9 +480,8 @@
//
void CUsbOtgWatcher::OtgStateErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::OtgStateErrorL" ) );
-__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
-HandleHostProblemL(EUsbWatcherOtgStateError);
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
+ HandleHostProblemL(EUsbWatcherOtgStateError, EUsbStateHostHandleDropping);
}
// From bus activity observer
@@ -478,8 +491,7 @@
//
void CUsbOtgWatcher::BusIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusIdleL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BusIdleL();
}
@@ -489,8 +501,7 @@
//
void CUsbOtgWatcher::BusActiveL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusActiveL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BusActiveL();
}
@@ -500,8 +511,7 @@
//
void CUsbOtgWatcher::BusActivityErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BusActivityErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
// no action, continue
}
@@ -512,8 +522,7 @@
//
void CUsbOtgWatcher::DeviceAttachedL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DeviceAttachedL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->DeviceAttachedL(aTdi);
}
@@ -523,8 +532,7 @@
//
void CUsbOtgWatcher::DeviceDetachedL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DeviceDetachedL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->DeviceDetachedL(aTdi);
}
@@ -534,8 +542,7 @@
//
void CUsbOtgWatcher::DriverLoadSuccessL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadSuccessL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->DriverLoadSuccessL(aTdi);
}
@@ -545,8 +552,7 @@
//
void CUsbOtgWatcher::DriverLoadPartialSuccessL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadPartialSuccessL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->DriverLoadPartialSuccessL(aTdi);
}
@@ -556,8 +562,7 @@
//
void CUsbOtgWatcher::DriverLoadFailureL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::DriverLoadFailureL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->DriverLoadFailureL(aTdi);
}
@@ -567,9 +572,9 @@
//
void CUsbOtgWatcher::HostEventNotificationErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::HostEventNotificationErrorL" ) );
-__ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
-HandleHostProblemL(EUsbWatcherHostEventNotificationError);
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
+ HandleHostProblemL(EUsbWatcherHostEventNotificationError,
+ EUsbStateHostHandleDropping);
}
// From message notification observer
@@ -579,8 +584,7 @@
//
void CUsbOtgWatcher::MessageNotificationReceivedL(TInt aMessage)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::MessageNotificationReceivedL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->MessageNotificationReceivedL(aMessage);
}
@@ -590,8 +594,7 @@
//
void CUsbOtgWatcher::BadHubPositionL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::BadHubPositionL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->BadHubPositionL();
}
@@ -601,8 +604,7 @@
//
void CUsbOtgWatcher::VBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::VBusErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->VBusErrorL();
}
@@ -612,8 +614,7 @@
//
void CUsbOtgWatcher::SrpReceivedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SrpReceivedL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->SrpReceivedL();
}
@@ -623,8 +624,7 @@
//
void CUsbOtgWatcher::SessionRequestedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SessionRequestedL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
iHostState->SessionRequestedL();
}
@@ -634,9 +634,9 @@
//
void CUsbOtgWatcher::MessageNotificationErrorL(TInt aError)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::MessageNotificationErrorL" ) );
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState));
- HandleHostProblemL(EUsbWatcherMessageNotificationError);
+ ASSERT_PANIC(iHostState != NULL, EBadHostState);
+ HandleHostProblemL(EUsbWatcherMessageNotificationError,
+ EUsbStateHostHandleDropping);
}
// ---------------------------------------------------------------------------
@@ -735,11 +735,11 @@
//
// ---------------------------------------------------------------------------
//
-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_PANIC(iStates[aInState] != NULL, EBadState);
+
+ return (CUsbStateHostHandle*) iStates[aInState];
}
// ---------------------------------------------------------------------------
@@ -748,32 +748,27 @@
//
void CUsbOtgWatcher::ChangeStateL(TUsbStateIds aNewStateId)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ChangeStateL aNewState = %d" ), aNewStateId));
+ LOG1( "aNewState = %d" , aNewStateId);
if (NULL != iState)
{
- if (aNewStateId == iState->Id())
- {
- return; // we already in the target state
- }
- else
- {
-
- iState->JustBeforeLeavingThisStateL();
- }
+ iState->JustBeforeLeavingThisStateL();
}
// sets new state
// be careful to add states into States in exactly the same order as they enumerated
- // this method will work right as long as states, which in the enumeration, is added to the list iStates in the same order as they enumerated
- // and no one state is added, if all previous states are not added. no need to add all states, but if added - previous all must be added.
+ // this method will work right as long as states, which in the enumeration, is added
+ // to the list iStates in the same order as they enumerated and no one state is added,
+ // if all previous states are not added. no need to add all states, but if added -
+ // previous all must be added.
// For the general case, when some states added, some not, this method has to implement search by state ID. for this CUsbOtgWatcher::Id() is maintained.
iState = iStates[aNewStateId];
- __ASSERT_DEBUG(iState != NULL, Panic(EBadState));
+ ASSERT_PANIC(iState != NULL, EBadState);
iState->JustAdvancedToThisStateL(); // do any initial activity, once advanced to the state
@@ -785,35 +780,30 @@
//
void CUsbOtgWatcher::ChangeHostStateL(TUsbStateIds aNewStateId)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::ChangeHostStateL aNewState = %d" ), aNewStateId));
+ LOG1( "aNewState = %d", aNewStateId);
if (NULL != iHostState)
{
- if (aNewStateId == iHostState->Id())
- {
- return; // we already in the target state
- }
- else
- {
-
- iHostState->JustBeforeLeavingThisStateL();
- }
+ iHostState->JustBeforeLeavingThisStateL();
}
// set new state
// be careful to add states into States in exactly the same order as they enumerated
- // this method will work right as long as states, which in the enumeration, is added to the list iStates in the same order as they enumerated
- // and no one state is added, if all previous states are not added. no need to add all states, but if added - previous all must be added.
- // For the general case, when some states added, some not, this method has to implement search by state Id. for this CUsbOtgWatcher::Id() is maintained.
+ // this method will work right as long as states, which in the enumeration, is added
+ // to the list iStates in the same order as they enumerated and no one state is added,
+ // if all previous states are not added. no need to add all states, but if added -
+ // previous all must be added.
+ // For the general case, when some states added, some not, this method has to implement search by state ID. for this CUsbOtgWatcher::Id() is maintained.
iHostState = iStates[aNewStateId];
- __ASSERT_DEBUG(iHostState != NULL, Panic(EBadState));
+ ASSERT_PANIC(iHostState != NULL, EBadState)
iHostState->JustAdvancedToThisStateL(); // checks if there are conditions for advancing to another state(s)
-
+
// notify state change to observers
for (TInt i(0); i < iOtgStateObservers.Count(); ++i)
{
@@ -837,18 +827,19 @@
//
void CUsbOtgWatcher::PrintStateToLog()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog IdPin = %d" ), iIdPinObserver->IdPin()));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog VBus = %d" ), iVBusObserver->VBus()));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog OtgState = %d" ), iOtgStateObserver->OtgState()));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog BusActivity = %d" ), iBusActivityObserver->BusActivity()));
-
- TInt isPeripheralConnected(KUsbWatcherPeripheralIsNotConnected);
-
- RProperty::Get( KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected,
- isPeripheralConnected );
-
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::PrintStateToLog IsPeripheralConnected = %d" ), isPeripheralConnected));
-
+ LOG1( "Current state id = %d" , iHostState->Id());
+ LOG1( "IdPin = %d" , iIdPinObserver->IdPin());
+ LOG1( "VBus = %d" , iVBusObserver->VBus());
+ LOG1( "OtgState = %d" , iOtgStateObserver->OtgState());
+ LOG1( "BusActivity = %d" , iBusActivityObserver->BusActivity());
+
+ TInt isPeripheralConnected(KUsbWatcherPeripheralIsNotConnected);
+
+ RProperty::Get(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected,
+ isPeripheralConnected);
+
+ LOG1( "IsPeripheralConnected = %d" , isPeripheralConnected);
+
}
// ---------------------------------------------------------------------------
@@ -866,88 +857,105 @@
//
void CUsbOtgWatcher::UsbServiceControlReqCompletedL(TInt aError)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompleted Error returned by UsbServiceControl = %d" ), aError));
-
- switch(aError)
- {
- case KErrInUse:
- // usb services already started (this might happen if more than one idpin on event come)
+ LOG_FUNC
+
+ LOG1( "aError = %d" , aError);
+
+ iUsbServiceRequest = CUsbServiceControl::ERequestUndefined;
+
+ switch (aError)
{
- return;
+ case KErrInUse:
+ // usb services already started (this might happen if more than one idpin on event come)
+ {
+ return;
+ }
+
+ case KErrNone:
+ {
+ break; // do normal routine
+ }
+ case KErrNoMemory:
+ {
+ HandleHostProblemL(EUsbWatcherNoMemory,
+ EUsbStateHostHandleDropping);
+ return;
+ }
+
+ default:
+ // handle the issue
+ {
+ if (iUsbServiceRequest == CUsbServiceControl::EStartUsbService) // Handle only start issues
+ {
+ HandleHostProblemL(EUsbWatcherNoMemory,
+ EUsbStateHostHandleDropping);
+ }
+
+ iUsbServiceRequest = CUsbServiceControl::ERequestUndefined;
+ return;
+ }
}
-
- case KErrNone:
- {
- break; // do normal routine
- }
-
- default: // handle the issue
- {
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
- return;
- }
- }
+
+ iUsbServiceRequest = CUsbServiceControl::ERequestUndefined;
TUsbServiceState serviceState;
TInt err = iUsb.GetServiceState(serviceState);
if (KErrNone != err)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompleted Error when requesting GetServiceState = %d" ), err));
- HandleHostProblemL(EUsbWatcherCanNotStartUsbServices);
+ LOG1( "Error when requesting GetServiceState = %d" , err);
+ HandleHostProblemL(EUsbWatcherCanNotStartUsbServices,
+ EUsbStateHostHandleDropping);
return;
}
switch (serviceState)
{
case EUsbServiceIdle: // just stopped usb service
+
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceIdle" ) );
+ LOG("UsbServiceState == EUsbServiceIdle" );
// do nothing
break;
}
case EUsbServiceStarted: // just started usb service
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStarted" ) );
-
- iHostState = iStates[EUsbStateHostAInitiate];
- iHostState->JustAdvancedToThisStateL(); // do any initial activity, once advanced to the state
+ {
+ LOG( "UsbServiceState == EUsbServiceStarted" );
- iVBusObserver->SubscribeL(this);
- iOtgStateObserver->SubscribeL(this);
- iBusActivityObserver->SubscribeL(this);
- iHostEventNotificationObserver->SubscribeL(this);
- iMessageNotificationObserver->SubscribeL(this);
+ ChangeHostStateL(EUsbStateHostAInitiate);
break;
}
case EUsbServiceStarting:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStarting" ) );
+ LOG("UsbServiceState == EUsbServiceStarting" );
// should not receive that, due to call back is called when service stopped or started
// therefore scream
+ PANIC(EUnexpectedUsbServiceState);
+ break;
}
case EUsbServiceStopping:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceStopping" ) );
+ LOG("UsbServiceState == EUsbServiceStopping" );
// should not receive that, due to call back is called when service stopped or started
// therefore scream
+ PANIC(EUnexpectedUsbServiceState);
+ break;
}
case EUsbServiceFatalError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UsbServiceControlReqCompletedL UsbServiceState == EUsbServiceFatalError" ) );
- Panic(EUnexpectedUsbServiceState);
+ LOG( "UsbServiceState == EUsbServiceFatalError" );
+ PANIC(EUnexpectedUsbServiceState);
break;
}
default:
{
- Panic(EUnknownUsbServiceState);
+ PANIC(EUnknownUsbServiceState);
}
}
-
}
// ---------------------------------------------------------------------------
@@ -957,52 +965,50 @@
TInt CUsbOtgWatcher::SelfTestL()
{
#ifdef _DEBUG
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating observers." ) );
+ LOG_FUNC
// create all the observers
iIdPinObserver = CUsbIdPinObserver::NewL();
iVBusObserver = CUsbVBusObserver::NewL();
iOtgStateObserver = CUsbOtgStateObserver::NewL();
- iBusActivityObserver =
- CUsbBusActivityObserver::NewL();
- iHostEventNotificationObserver =
- CUsbHostEventNotificationObserver::NewL(&iUsb);
- iMessageNotificationObserver =
- CUsbMessageNotificationObserver::NewL(&iUsb);
+ iBusActivityObserver = CUsbBusActivityObserver::NewL();
+ iHostEventNotificationObserver = CUsbHostEventNotificationObserver::NewL(
+ &iUsb);
+ iMessageNotificationObserver = CUsbMessageNotificationObserver::NewL(
+ &iUsb);
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers getters." ) );
+ LOG( "Observers getters" );
if (iIdPinObserver != IdPinObserver())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
if (iOtgStateObserver != OtgStateObserver())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
if (iBusActivityObserver != BusActivityObserver())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
if (iHostEventNotificationObserver != HostEventNotificationObserver())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
if (iMessageNotificationObserver != MessageNotificationObserver())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Observers destructors." ) );
+ LOG( "Observers destructors" );
// idpinobserver is deleted later
// Vbus observer is deleted later
-
+
delete iOtgStateObserver;
iOtgStateObserver = 0;
delete iBusActivityObserver;
@@ -1012,68 +1018,72 @@
delete iMessageNotificationObserver;
iMessageNotificationObserver = 0;
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Creating states." ) );
+ LOG("Creating states");
- User::LeaveIfError(iStates.Append(CUsbState::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostAIdle::NewL(this)));
- User::LeaveIfError(iStates.Append(CUsbStateHostHandle::NewL(this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostUndefined::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAInitiate::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAHost::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostAPeripheral::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL(
+ *this)));
+ LEAVEIFERROR(iStates.Append(
+ CUsbStateHostDelayNotAttachedHandle::NewL(*this)));
+ LEAVEIFERROR(iStates.Append(
+ CUsbStateHostHandleDropping::NewL(*this)));
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check State()" ) );
+ LOG("Check State()" );
if (iStates[EUsbStateHostAInitiate] != State(EUsbStateHostAInitiate))
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check CurrentHostState()" ) );
-
+
+ LOG("Check CurrentHostState()" );
+
iHostState = iStates[EUsbStateHostAInitiate];
-
- if (iStates[EUsbStateHostAInitiate] != CurrentHostState())
+
+ if (iStates[EUsbStateHostAInitiate] != CurrentHostState())
{
- User::Leave(KErrGeneral);
+ LEAVE(KErrGeneral);
}
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier." ) );
+
+ LOG("NotifManager and WarningNotifier." );
- CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(this);
+ CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(*this);
RNotifier rnotifier;
- User::LeaveIfError(rnotifier.Connect());
+ LEAVEIFERROR(rnotifier.Connect());
CUsbWarningNotifier* usbnotifier = CUsbWarningNotifier::NewL(rnotifier,
- usbnotifmanager, EUsbOtgPartiallySupportedDevice);
+ *usbnotifmanager, EUsbOtgPartiallySupportedDevice);
usbnotifier->IsFeedbackNeeded();
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL NotifManager and WarningNotifier destruction." ) );
+ LOG( "NotifManager and WarningNotifier destruction." );
delete usbnotifier;
rnotifier.Close();
- delete usbnotifmanager;
-
+ delete usbnotifmanager;
+
// VBus observer is deleted here, due to it is used by usbnotifmanager.usbindicatornotifier
delete iVBusObserver;
iVBusObserver = 0;
-
+
// id pin observer is deleted here due to it is used by usbnotifmanager.usbindicatornotifier
delete iIdPinObserver;
iIdPinObserver = 0;
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Destructing states." ) );
-
+
+ LOG("Destructing states");
+
iStates.ResetAndDestroy();
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL Check UsbServiceControl" ) );
+ LOG( "Check UsbServiceControl" );
- CUsbServiceControl* usbServiceControl = CUsbServiceControl::NewL(this,
+ CUsbServiceControl* usbServiceControl = CUsbServiceControl::NewL(*this,
iUsb);
usbServiceControl->RunError(KErrNone);
delete usbServiceControl;
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SelfTestL All completed OK." ) );
+ LOG("All completed OK" );
#endif
- return KErrNone;
+ return KErrNone;
}
@@ -1081,11 +1091,18 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver* aObserver)
+void CUsbOtgWatcher::SubscribeL(MUsbOtgWatcherStateObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iOtgStateObservers.Append(aObserver));
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iOtgStateObservers.Find(&aObserver))
+ {
+ LOG( "Observer already exists" );
+ PANIC(EObserverAlreadyExists);
+ return;
+ }
+ iOtgStateObservers.AppendL(&aObserver);
}
@@ -1093,26 +1110,17 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbOtgWatcher::UnsubscribeL(MUsbOtgWatcherStateObserver* aObserver)
+void CUsbOtgWatcher::UnsubscribeL(MUsbOtgWatcherStateObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL" ) );
- if (0 == iOtgStateObservers.Count()) // no items
+ LOG_FUNC
+
+ TInt i(iOtgStateObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL No observers" ) );
+ LOG( "Observer not found" );
+ PANIC(ECanNotFindUsbOtgWatcherStateObserver);
return;
}
-
- TInt i(0);
- while (i < iOtgStateObservers.Count() && aObserver != iOtgStateObservers[i])
- ++i;
- if (aObserver == iOtgStateObservers[i]) // found
- {
- iOtgStateObservers.Remove(i);
- }
- else
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbOtgWatcher::UnsubscribeL CanNotGetUsbOtgStateWatcherObserver" ) );
- Panic(ECanNotFindUsbOtgWatcherStateObserver);
- }
+ iOtgStateObservers.Remove(i);
}
--- a/usbengines/usbotgwatcher/src/cusbpersonalityswitch.cpp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Switches personality
- *
-*/
-
-#include <e32base.h>
-#include <usb.h>
-#include <usbpersonalityids.h>
-
-#include "cusbpersonalityswitch.h"
-
-#include "panic.h"
-#include "debug.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::CUsbPersonalitySwitch(
- MUsbPersonalitySwitchObserver* aObserver) :
- CActive(CActive::EPriorityStandard), iObserver(aObserver), iState(EIdle)
- {
- CActiveScheduler::Add(this);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::~CUsbPersonalitySwitch()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::~CUsbPersonalitySwitch" ) );
- Cancel();
- iUsbInterface.Close();
- iSendData.Close();
- iRcvData.Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::ConstructL" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch* CUsbPersonalitySwitch::NewL(
- MUsbPersonalitySwitchObserver* aObserver)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::NewL" ) );
-
- CUsbPersonalitySwitch* self = new (ELeave) CUsbPersonalitySwitch(
- aObserver);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self); // pop self
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::SwitchPersonalityL(TUint32 aDeviceId,
- TInt aPersonalityToBeSet)
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality aDeviceId %d, aPersonalityToBeSet %d" ), aDeviceId, aPersonalityToBeSet))
-
- if (IsActive() || EIdle != iState)
- {
- Cancel();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
- }
-
- // create usb interface for the device id
- TUint32 token(0); // = RFdc.InterfaceToken();
- TInt err = iUsbInterface.Open(token);
-
- FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality UsbInterface Open err = %d" ), err));
- if (KErrNone != err)
- {
- return err;
- }
-
- iPersonalityToBeSet = aPersonalityToBeSet;
-
- // get list of supported personalities
- iTransfer.iRequestType = KUsbRequestType_DirToHost
- | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
- iTransfer.iRequest = KGetAllPersonalitiesReq;
- iTransfer.iValue = 0;
- iTransfer.iIndex = 0;
- iTransfer.iFlags
- = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
- Reset();
-
- iState = EGetAllPersonalities;
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonalityL Sending GetAllPersonalities request." ) );
- iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
- SetActive();
-
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestingAllPersonalities,
- KErrNone);
-
- return KErrNone;
- }
-
-void CUsbPersonalitySwitch::CancelSwitchPersonalityL()
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::CancelSwitchPersonalityL"));
-
- if (IsActive())
- {
- Cancel();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::RunL()
- {
-
- if (KErrNone != iStatus.Int())
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL iStatus %d" ), iStatus.Int()));
- User::Leave(iStatus.Int());
- }
-
- switch (iState)
- {
-
- case EGetAllPersonalities:
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersonalities completed."));
-
- TInt numOfPersonalities = iRcvData[KNumOfPersShift];
- FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Amount of personalities in peripheral = %d" ), numOfPersonalities));
-
- // if no personalities then return
- if (0 == numOfPersonalities)
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL No personailies found in peripheral."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNotFound);
- return;
- }
-
- // if needed pers already set, then return
- TInt currentPersonality = iRcvData[KCurrPersShift];
- if (iPersonalityToBeSet == currentPersonality)
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Needed personality already set in peripheral."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrInUse);
- return;
- }
-
- // check if device supports needed personality
- TInt count(0);
- while (count < numOfPersonalities && iPersonalityToBeSet
- != iRcvData[KFirstPersonalityIdShift
- + KLenghtOfPersonalityData * count])
- {
- ++count;
- }
-
- if (count == numOfPersonalities) // not found == not supported
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Peripheral does not support needed personality."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNotFound);
- return;
- }
-
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
- KErrNone);
-
- // set personality
- iTransfer.iRequestType = KUsbRequestType_DirToDev
- | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
- iTransfer.iRequest = KSetPersonalityReq;
- iTransfer.iValue = iPersonalityToBeSet;
- iTransfer.iIndex = 0;
- iTransfer.iFlags
- = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
- iSendData.Close();
- iRcvData.Close();
-
- iState = ESetPersonality;
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Sending SetPersonality request." ) );
- iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
- SetActive();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestingSetPersonality,
- KErrNone);
-
- break;
- }
- case ESetPersonality:
- {
- FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL SetPersonality completed."));
- Reset();
- iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ESetPersonalityCompleted,
- KErrNone);
-
- break;
- }
- /* case EGetAllPersResult:
- {
- FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersResult completed.");
-
- break;
- }
- case EGetSetPersResult:
- {
- FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetSetPersResult completed.");
-
- break;
- } */
-
- case EIdle: // do not break
- default:
- {
- Panic(EUnexpectedUsbSwitchPersonalityState);
- }
- }
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::RunError(TInt aError)
- {
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunError aError %d" ), aError ));
- Reset();
- TRAP_IGNORE (iObserver->UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::ERequestFailed, aError) );
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::DoCancel()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::DoCancel" ) )
-
- iUsbInterface.CancelEP0Transfer();
- Reset();
- }
-
-void CUsbPersonalitySwitch::Reset()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::Reset" ) )
-
- iState = EIdle;
- iSendData.Close();
- iRcvData.Close();
- }
--- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbman.h>
@@ -26,7 +25,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbServiceControl::CUsbServiceControl(MUsbServiceControlObserver* aObserver,
+CUsbServiceControl::CUsbServiceControl(MUsbServiceControlObserver& aObserver,
RUsb& aUsb) :
CActive(CActive::EPriorityStandard), iObserver(aObserver), iUsb(aUsb),
iPersonalityId(0)
@@ -40,7 +39,8 @@
//
CUsbServiceControl::~CUsbServiceControl()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::~CUsbServiceControl" ) );
+ LOG_FUNC
+
Cancel();
}
@@ -50,7 +50,7 @@
//
void CUsbServiceControl::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::ConstructL" ) );
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -58,9 +58,9 @@
// ---------------------------------------------------------------------------
//
CUsbServiceControl* CUsbServiceControl::NewL(
- MUsbServiceControlObserver* aObserver, RUsb& aUsb)
+ MUsbServiceControlObserver& aObserver, RUsb& aUsb)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::NewL" ) );
+ LOG_FUNC
CUsbServiceControl* self = new (ELeave) CUsbServiceControl(aObserver,
aUsb);
@@ -76,7 +76,9 @@
//
TInt CUsbServiceControl::StartL(TInt aPersonalityId)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::Start aPersonalityId = %d" ), aPersonalityId));
+ LOG_FUNC
+
+ LOG1( "aPersonalityId = %d" , aPersonalityId);
TUsbServiceState serviceState;
TInt err = iUsb.GetServiceState(serviceState);
@@ -90,12 +92,12 @@
{
case EUsbServiceIdle:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceIdle" ) );
+ LOG( "UsbServiceState == EUsbServiceIdle" );
iPersonalityId = aPersonalityId; // when request completed, this will indicate that we started what we wanted
if (IsActive())
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Request is outstanding, cancelling first." ) );
+ LOG("Request is outstanding, cancelling first" );
Cancel();
}
iUsb.TryStart(aPersonalityId, iStatus);
@@ -105,20 +107,20 @@
case EUsbServiceStarted:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarted" ) );
+ LOG("UsbServiceState == EUsbServiceStarted");
TInt currentPersonality(0);
err = iUsb.GetCurrentPersonalityId(currentPersonality);
if (KErrNone != err)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Error getting current personality err = %d" ), err));
+ LOG1( "Error getting current personality err = %d" , err);
return err;
}
if (aPersonalityId == currentPersonality) // already started
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Personality already started" ) );
- iObserver->UsbServiceControlReqCompletedL(KErrInUse);
+ LOG("Personality already started" );
+ iObserver.UsbServiceControlReqCompletedL(KErrInUse);
return KErrNone;
}
@@ -133,13 +135,13 @@
}
case EUsbServiceStarting:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarting" ) );
+ LOG("UsbServiceState == EUsbServiceStarting" );
// do exactly the same as in case of EUsbServiceStopping;
// break statement is not required here
}
case EUsbServiceStopping:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStopping" ) );
+ LOG( "UsbServiceState == EUsbServiceStopping" );
// subscribe for usb service state change, and start new usb service once current one started/stopped
iPersonalityId = aPersonalityId; // this will indicate that we want to start this personality
@@ -147,7 +149,7 @@
// this check is needed due to usb service might be stopping by other client
if (IsActive())
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Request outstanding. Waiting for completion." ) );
+ LOG( "Request outstanding. Waiting for completion" );
return KErrNone; // when the outstanding request get completed, we start usb services with iPersonalityId
}
@@ -159,12 +161,12 @@
}
case EUsbServiceFatalError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) );
+ LOG( "UsbServiceState == EUsbServiceFatalError" );
return KErrGeneral;
}
default:
{
- Panic(EUnknownUsbServiceState);
+ PANIC( EUnknownUsbServiceState);
}
}
@@ -178,11 +180,13 @@
//
TInt CUsbServiceControl::StopL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop" ) );
+ LOG_FUNC
TUsbServiceState serviceState;
TInt err = iUsb.GetServiceState(serviceState);
+ LOG2("err = %d; serviceState = %d" , err, serviceState);
+
if (KErrNone != err)
{
return err;
@@ -192,18 +196,18 @@
{
case EUsbServiceIdle:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceIdle" ) );
+ LOG("UsbServiceState == EUsbServiceIdle" );
return KErrNone;
}
case EUsbServiceStarted:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStarted" ) );
+ LOG("UsbServiceState == EUsbServiceStarted" );
if (IsActive())
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop Request is outstanding, cancelling it." ) );
+ LOG("Request is outstanding, cancelling it" );
Cancel();
}
iUsb.TryStop(iStatus);
@@ -213,13 +217,13 @@
}
case EUsbServiceStopping:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStopping" ) );
+ LOG( "UsbServiceState == EUsbServiceStopping" );
// do exactly the same as in case of EUsbServiceStarting;
// break statement is not required here
}
case EUsbServiceStarting:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop UsbServiceState == EUsbServiceStarting" ) );
+ LOG("UsbServiceState == EUsbServiceStarting" );
// subscribe for usb service state change, and stop usb service once current one started
iPersonalityId = 0; // this will indicate that we do not want to start this personality
@@ -227,7 +231,7 @@
// this check is needed due to usb service might be starting by other client
if (IsActive())
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Stop Request is outstanding, waiting for completion. " ) );
+ LOG("Request is outstanding, waiting for completion" );
return KErrNone; // when this request get completed, we request to stop usb services
}
@@ -239,12 +243,12 @@
}
case EUsbServiceFatalError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) );
+ LOG("UsbServiceState == EUsbServiceFatalError" );
return KErrGeneral;
}
default:
{
- Panic(EUnknownUsbServiceState);
+ PANIC( EUnknownUsbServiceState);
}
}
return KErrNone;
@@ -256,11 +260,13 @@
//
void CUsbServiceControl::RunL()
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL iStatus %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1("iStatus = %d" , iStatus.Int());
+
if (KErrNone != iStatus.Int())
{
- //User::Leave(iStatus.Int());
- iObserver->UsbServiceControlReqCompletedL(iStatus.Int());
+ iObserver.UsbServiceControlReqCompletedL(iStatus.Int());
return;
}
@@ -269,108 +275,104 @@
if (KErrNone != err)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting service state %d" ), err));
- //User::Leave(err);
- iObserver->UsbServiceControlReqCompletedL(err);
- return;
+ LOG1("Error while getting service state %d" , err);
+ iObserver.UsbServiceControlReqCompletedL(err);
+ return;
}
switch (serviceState)
{
case EUsbServiceIdle: // usb service stopped
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL UsbServiceState == EUsbServiceIdle" ) );
+ LOG("UsbServiceState == EUsbServiceIdle" );
if (iPersonalityId != 0) // during service stopping, requested to start it
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL Requested to start personality %d. Starting it." ), iPersonalityId));
+ LOG1("Requested to start personality %d. Starting it." , iPersonalityId);
TInt personalityId = iPersonalityId;
iPersonalityId = 0; // reset
err = StartL(personalityId);
- if(KErrNone != err)
+ if (KErrNone != err)
{
- iObserver->UsbServiceControlReqCompletedL(err);
+ iObserver.UsbServiceControlReqCompletedL(err);
}
return;
}
// otherwise, we've done, notify
- iObserver->UsbServiceControlReqCompletedL(KErrNone);
+ iObserver.UsbServiceControlReqCompletedL(KErrNone);
break;
}
case EUsbServiceStarted:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceStarted" ) );
+ LOG("UsbServiceState == EUsbServiceStarted" );
TInt currentPersonality(0);
err = iUsb.GetCurrentPersonalityId(currentPersonality);
if (KErrNone != err)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while getting PersonalityId err = %d" ), err));
- //User::Leave(err);
- iObserver->UsbServiceControlReqCompletedL(err);
- return;
+ LOG1("Error while getting PersonalityId err = %d" , err);
+ iObserver.UsbServiceControlReqCompletedL(err);
+ return;
}
if (iPersonalityId == currentPersonality) // already done
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Personality already started." ) );
+ LOG("Personality already started" );
iPersonalityId = 0;
- iObserver->UsbServiceControlReqCompletedL(KErrNone);
+ iObserver.UsbServiceControlReqCompletedL(KErrNone);
return;
}
if (iPersonalityId == 0) // during service start requested to stop it
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start Requested to stop personality. Stopping." ) );
+ LOG("Requested to stop personality. Stopping." );
err = StopL();
- if(KErrNone != err)
+ if (KErrNone != err)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while stopping personality err = %d" ), err));
- iObserver->UsbServiceControlReqCompletedL(err);
+ LOG1("Error while stopping personality err = %d" , err);
+ iObserver.UsbServiceControlReqCompletedL(err);
}
return;
}
// otherwise, during service start, requested to start it with another personality
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL Requested to start personality %d. Starting it." ), iPersonalityId));
+ LOG1( "Requested to start personality %d. Starting it.", iPersonalityId);
TInt personalityId = iPersonalityId;
iPersonalityId = 0; // reset
- //User::LeaveIfError(Start(personalityId));
err = StartL(personalityId);
- if(KErrNone != err)
+ if (KErrNone != err)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunL error while starting personality err = %d" ), err));
- iObserver->UsbServiceControlReqCompletedL(err);
+ LOG1("Error while starting personality err = %d" , err);
+ iObserver.UsbServiceControlReqCompletedL(err);
}
break;
}
case EUsbServiceStarting:
{
- // do exactly same as in EUsbServiceStopping
- // break statement is not required here
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start State == EUsbServiceStarting. Continue." ) );
+ // do exactly same as in EUsbServiceStopping
+ // break statement is not required here
+ LOG("State == EUsbServiceStarting. Continue." );
}
case EUsbServiceStopping:
{
- // we are not interested in these states, just continue monitoring
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start State == EUsbServiceStopping. Continue." ) );
+ // we are not interested in these states, just continue monitoring
+ LOG("State == EUsbServiceStopping. Continue." );
iUsb.ServiceStateNotification(iServiceState, iStatus);
SetActive();
break;
}
case EUsbServiceFatalError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::Start UsbServiceState == EUsbServiceFatalError" ) );
- //User::Leave(KErrGeneral);
- iObserver->UsbServiceControlReqCompletedL(KErrGeneral);
+ LOG("UsbServiceState == EUsbServiceFatalError" );
+ iObserver.UsbServiceControlReqCompletedL(KErrGeneral);
break;
}
default:
{
- Panic(EUnknownUsbServiceState);
+ PANIC( EUnknownUsbServiceState);
}
}
@@ -382,8 +384,9 @@
//
TInt CUsbServiceControl::RunError(TInt aError)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbServiceControl::RunError aError %d" ), aError ));
- //TRAP_IGNORE(iObserver->UsbServiceControlReqCompletedL(aError));
+ LOG_FUNC
+ LOG1("aError = %d", aError );
+ TRAP_IGNORE(iObserver.UsbServiceControlReqCompletedL(aError));
return KErrNone;
}
@@ -394,10 +397,10 @@
//
void CUsbServiceControl::DoCancel()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to Usb TryStart."))
+ LOG( "Cancelling interest to Usb TryStart.")
iUsb.CancelInterest(RUsb::ETryStart);
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to Usb TrySop."))
+ LOG( "Cancelling interest to Usb TrySop.")
iUsb.CancelInterest(RUsb::ETryStop);
- FLOG( _L( "[USBOTGWATCHER]\tCUsbServiceControl::DoCancel Cancelling interest to usb states notifications."))
+ LOG("Cancelling interest to usb states notifications.")
iUsb.ServiceStateNotificationCancel();
}
--- a/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,21 +1,21 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 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 "cusbotgwatcher.h"
#include "cusbstate.h"
#include "panic.h"
@@ -25,7 +25,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbState::CUsbState(CUsbOtgWatcher* aWatcher) :
+CUsbState::CUsbState(CUsbOtgWatcher& aWatcher) :
iWatcher(aWatcher)
{
}
@@ -42,19 +42,6 @@
//
// ---------------------------------------------------------------------------
//
-CUsbState* CUsbState::NewL(CUsbOtgWatcher* aWatcher)
- {
- CUsbState* self = new (ELeave) CUsbState(aWatcher);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
void CUsbState::ConstructL()
{
@@ -64,17 +51,9 @@
//
// ---------------------------------------------------------------------------
//
-TUsbStateIds CUsbState::Id()
- {
- return EUsbStateUndefined;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
void CUsbState::JustAdvancedToThisStateL()
{
+ iWatcher.PrintStateToLog();
}
// ---------------------------------------------------------------------------
@@ -92,7 +71,7 @@
void CUsbState::ChangeStateL(TUsbStateIds aNewStateId)
{
- iWatcher->ChangeStateL(aNewStateId);
+ iWatcher.ChangeStateL(aNewStateId);
}
@@ -103,8 +82,21 @@
void CUsbState::ChangeHostStateL(TUsbStateIds aNewStateId)
{
- iWatcher->ChangeHostStateL(aNewStateId);
+ iWatcher.ChangeHostStateL(aNewStateId);
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbState::HandleL(TInt aWhat, TUsbStateIds aWhereToHandle)
+ {
+ LOG_FUNC
+
+ LOG2( "aWhat = %d aWhere = %d" , aWhat, aWhereToHandle);
+
+ iWatcher.HandleHostProblemL(aWhat, aWhereToHandle);
}
// ---------------------------------------------------------------------------
@@ -156,8 +148,8 @@
//
void CUsbState::IdPinOffL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOffL" ) );
- Panic(EIdPinOffNotExpected);
+ LOG_FUNC
+ PANIC(EIdPinOffNotExpected);
}
// ---------------------------------------------------------------------------
@@ -166,8 +158,8 @@
//
void CUsbState::IdPinOnL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::IdPinOnL" ) );
- Panic(EIdPinOnNotExpected);
+ LOG_FUNC
+ PANIC(EIdPinOnNotExpected);
}
// From VBus observer
@@ -177,8 +169,8 @@
//
void CUsbState::VBusDownL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusDownL" ) );
- Panic(EVBusDownNotExpected);
+ LOG_FUNC
+ PANIC(EVBusDownNotExpected);
}
// ---------------------------------------------------------------------------
@@ -187,7 +179,8 @@
//
void CUsbState::VBusUpL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusUpL" ) );
+ LOG_FUNC
+ PANIC(EVBusUpNotExpected);
}
// From OTG state observer
@@ -197,8 +190,8 @@
//
void CUsbState::AIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AIdleL" ) );
- Panic(EAIdleNotExpected);
+ LOG_FUNC
+ PANIC(EAIdleNotExpected);
}
// ---------------------------------------------------------------------------
@@ -207,8 +200,8 @@
//
void CUsbState::AHostL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AHostL" ) );
- Panic(EAHostNotExpected);
+ LOG_FUNC
+ PANIC(EAHostNotExpected);
}
// ---------------------------------------------------------------------------
@@ -217,8 +210,8 @@
//
void CUsbState::APeripheralL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::APeripheralL" ) );
- Panic(EAPeripheralNotExpected);
+ LOG_FUNC
+ PANIC(EAPeripheralNotExpected);
}
// ---------------------------------------------------------------------------
@@ -227,8 +220,8 @@
//
void CUsbState::AVBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::AVBusErrorL" ) );
- Panic(EAVBusErrorNotExpected);
+ LOG_FUNC
+ PANIC(EAVBusErrorNotExpected);
}
// ---------------------------------------------------------------------------
@@ -237,8 +230,8 @@
//
void CUsbState::BIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BIdleL" ) );
- Panic(EBIdleNotExpected);
+ LOG_FUNC
+ PANIC(EBIdleNotExpected);
}
// ---------------------------------------------------------------------------
@@ -247,8 +240,8 @@
//
void CUsbState::BPeripheralL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BPeripheralL" ) );
- Panic(EBPeripheralNotExpected);
+ LOG_FUNC
+ PANIC(EBPeripheralNotExpected);
}
// ---------------------------------------------------------------------------
@@ -257,8 +250,8 @@
//
void CUsbState::BHostL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BHostL" ) );
- Panic(EBHostNotExpected);
+ LOG_FUNC
+ PANIC(EBHostNotExpected);
}
// From bus activity observer
@@ -268,8 +261,8 @@
//
void CUsbState::BusIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusIdleL" ) );
- Panic(EBusIdleNotExpected);
+ LOG_FUNC
+ PANIC(EBusIdleNotExpected);
}
// ---------------------------------------------------------------------------
@@ -278,8 +271,8 @@
//
void CUsbState::BusActiveL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BusActiveL" ) );
- Panic(EBusActiveNotExpected);
+ LOG_FUNC
+ PANIC(EBusActiveNotExpected);
}
// From Host Event notification observer
@@ -289,8 +282,8 @@
//
void CUsbState::DeviceAttachedL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceAttachedL" ) );
- Panic(EDeviceAttachedNotExpected);
+ LOG_FUNC
+ PANIC(EDeviceAttachedNotExpected);
}
// ---------------------------------------------------------------------------
@@ -299,8 +292,8 @@
//
void CUsbState::DeviceDetachedL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DeviceDetachedL" ) );
- Panic(EDeviceDetachedNotExpected);
+ LOG_FUNC
+ PANIC(EDeviceDetachedNotExpected);
}
// ---------------------------------------------------------------------------
@@ -309,8 +302,8 @@
//
void CUsbState::DriverLoadSuccessL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) );
- Panic(EDriverLoadSuccessNotExpected);
+ LOG_FUNC
+ PANIC(EDriverLoadSuccessNotExpected);
}
// ---------------------------------------------------------------------------
@@ -319,8 +312,8 @@
//
void CUsbState::DriverLoadPartialSuccessL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadPartialSuccessL" ) );
- Panic(EDriverLoadPartialSuccessNotExpected);
+ LOG_FUNC
+ PANIC(EDriverLoadPartialSuccessNotExpected);
}
// ---------------------------------------------------------------------------
@@ -329,8 +322,8 @@
//
void CUsbState::DriverLoadFailureL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadFailureL" ) );
- Panic(EDriverLoadFailureNotExpected);
+ LOG_FUNC
+ PANIC(EDriverLoadFailureNotExpected);
}
// ---------------------------------------------------------------------------
@@ -339,8 +332,8 @@
//
void CUsbState::BadHubPositionL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::BadHubPositionL" ) );
- Panic(EBadHubPositionNotExpected);
+ LOG_FUNC
+ PANIC(EBadHubPositionNotExpected);
}
// ---------------------------------------------------------------------------
@@ -349,8 +342,8 @@
//
void CUsbState::VBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::VBusErrorL" ) );
- Panic(EVBusErrorNotExpected);
+ LOG_FUNC
+ PANIC(EVBusErrorNotExpected);
}
// ---------------------------------------------------------------------------
@@ -359,8 +352,8 @@
//
void CUsbState::MessageNotificationReceivedL(TInt)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::MessageNotificationReceivedL" ) );
- Panic(EMessageNotificationNotExpected);
+ LOG_FUNC
+ PANIC(EMessageNotificationNotExpected);
}
// ---------------------------------------------------------------------------
@@ -369,8 +362,8 @@
//
void CUsbState::SrpReceivedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SrpReceivedL" ) );
- Panic(ESrpNotExpected);
+ LOG_FUNC
+ PANIC(ESrpNotExpected);
}
// ---------------------------------------------------------------------------
@@ -379,6 +372,6 @@
//
void CUsbState::SessionRequestedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::SessionRequestedL" ) );
- Panic(ESessionRequestNotExpected);
+ LOG_FUNC
+ PANIC(ESessionRequestNotExpected);
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,28 +1,28 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <e32base.h>
#include <usbhosterrors.h>
#include <d32otgdi_errors.h>
#include <d32usbdi_errors.h>
+#include "cusbotgwatcher.h"
#include "cusbstatehostabase.h"
-#include "cusbstatehosthandle.h"
+#include "cusbstatehosthandledropping.h"
#include "errors.h"
@@ -33,7 +33,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostABase::CUsbStateHostABase(CUsbOtgWatcher* aWatcher) :
+CUsbStateHostABase::CUsbStateHostABase(CUsbOtgWatcher& aWatcher) :
CUsbState(aWatcher)
{
}
@@ -44,7 +44,8 @@
//
void CUsbStateHostABase::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::ConstructL" ) );
+ LOG_FUNC
+ CUsbState::ConstructL();
}
// ---------------------------------------------------------------------------
@@ -53,29 +54,28 @@
//
CUsbStateHostABase::~CUsbStateHostABase()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::~CUsbStateHostABase" ) );
-
+ LOG_FUNC
}
// From VBus observer
// ---------------------------------------------------------------------------
-//
+// VBus can be dropped by lower leyer in case of a critical problem
// ---------------------------------------------------------------------------
//
void CUsbStateHostABase::VBusDownL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::VBusDownL" ) );
- ChangeHostStateL(EUsbStateHostAIdle);
+ LOG_FUNC
+ HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping);
}
// From OTG state observer
// ---------------------------------------------------------------------------
-//
+//
// ---------------------------------------------------------------------------
//
void CUsbStateHostABase::AIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AIdleL" ) );
+ LOG_FUNC
// do nothing
}
@@ -83,12 +83,32 @@
//
// ---------------------------------------------------------------------------
//
+void CUsbStateHostABase::AHostL()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostABase::APeripheralL()
+ {
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAPeripheral);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
void CUsbStateHostABase::AVBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AVBusErrorL" ) );
+ LOG_FUNC
// No need to handle BusClearError error code, due to Bus will be dropped anyway
- iWatcher->Usb().BusClearError();
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower);
+ iWatcher.Usb().BusClearError();
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower,
+ EUsbStateHostHandleDropping);
}
// From bus activity observer
@@ -98,7 +118,7 @@
//
void CUsbStateHostABase::BusIdleL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BusIdleL" ) );
+ LOG_FUNC
//do nothing
}
@@ -108,7 +128,7 @@
//
void CUsbStateHostABase::BusActiveL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BusActiveL" ) );
+ LOG_FUNC
// do nothing
}
@@ -119,41 +139,19 @@
//
void CUsbStateHostABase::MessageNotificationReceivedL(TInt aMessage)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL = %d" ), aMessage));
+ LOG_FUNC
+ LOG1( "aMessage = %d" , aMessage);
switch (aMessage)
{
// OTGDI
- case KErrUsbOtgEventQueueOverflow: // = -6670;
- case KErrUsbOtgStateQueueOverflow:// = -6671;
- case KErrUsbOtgMessageQueueOverflow: // = -6672;
-
- case KErrUsbOtgBadState:// = -6675;
-
case KErrUsbOtgStackNotStarted:// = -6680;
- //case KErrUsbOtgVbusAlreadyRaised:// = -6681;
- //case KErrUsbOtgSrpForbidden:// = -6682;
-
case KErrUsbOtgHnpNotResponding:// = -6683;
- //case KErrUsbOtgHnpBusDrop:// = -6684;
-
case KErrUsbOtgBusControlProblem:// = -6685;
-
case KErrUsbOtgVbusPowerUpError:// = -6686;
-
case KErrUsbOtgHnpEnableProblem:// = -6687;
-
case KErrUsbOtgVbusError:// = -6690;
- case KErrUsbOtgSrpTimeout:// = -6691;
- //case KErrUsbOtgSrpActive:// = -6692;
- //case KErrUsbOtgSrpNotPermitted:// = -6693;
- //case KErrUsbOtgHnpNotPermitted:// = -6694;
- //case KErrUsbOtgHnpNotEnabled:// = -6695;
- //case KErrUsbOtgHnpNotSuspended:// = -6696;
- //case KErrUsbOtgVbusPowerUpNotPermitted:// = -6697;
- //case KErrUsbOtgVbusPowerDownNotPermitted:// = -6698;
- //case KErrUsbOtgVbusClearErrorNotPermitted:// = -6699;
// hosterrors.h
case KErrUsbConfigurationHasNoInterfaces:
@@ -163,13 +161,13 @@
case KErrUsbDeviceDetachedDuringDriverLoading:
case KErrUsbAttachmentFailureGeneralError:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL ErrorInConnection" ) );
- HandleL(EUsbWatcherErrorInConnection);
+ LOG( "ErrorInConnection" );
+ HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping);
break;
}
// OTGDI
- //case KErrUsbOtgPeriphNotSupported: // = -6688
+ case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only
// USBDI
case KErrUsbRequestsPending:
@@ -188,20 +186,22 @@
case KErrUsbBadDescriptorTopology:
case KErrUsbDeviceRejected:
case KErrUsbDeviceFailed:
- case KErrUsbBadDevice:
+ case KErrUsbBadDevice: // = -6656
case KErrUsbBadHub:
case KErrUsbEventOverflow:
+ case KErrUsbBadDeviceAttached:
// hosterrors.h
case KErrUsbUnsupportedDevice:
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL UnsupportedDevice" ) );
- HandleL(EUsbWatcherErrUnsupportedDevice);
+ LOG( "UnsupportedDevice" );
+ HandleL(EUsbWatcherErrUnsupportedDevice,
+ EUsbStateHostHandleDropping);
break;
}
default:
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::MessageNotificationReceivedL Unhandled message = %d" ), aMessage));
+ LOG1( "Unhandled message = %d" , aMessage);
break;
}
@@ -215,8 +215,8 @@
//
void CUsbStateHostABase::BadHubPositionL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::BadHubPositionL" ) );
- HandleL(EUsbWatcherHubsNotSupported);
+ LOG_FUNC
+ HandleL(EUsbWatcherHubsNotSupported, EUsbStateHostHandleDropping);
}
// ---------------------------------------------------------------------------
@@ -225,10 +225,35 @@
//
void CUsbStateHostABase::VBusErrorL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::VBusErrorL" ) );
+ LOG_FUNC
// No error code handling after BusClearError call, due to bus will be dropped anyway
- iWatcher->Usb().BusClearError();
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower);
+ iWatcher.Usb().BusClearError();
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower,
+ EUsbStateHostHandleDropping);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostABase::SrpReceivedL()
+ {
+ LOG_FUNC
+
+ if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
+ {
+ LOG( "Session is ongoing (VBus high); ignore SRP request." );
+ return;
+ }
+
+ TInt err = iWatcher.Usb().BusRespondSrp();
+ LOG1( "BusRespondSrp() error = %d" , err );
+
+ if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err)
+ {
+ iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection,
+ EUsbStateHostHandleDropping);
+ }
}
// ---------------------------------------------------------------------------
@@ -237,33 +262,21 @@
//
void CUsbStateHostABase::SessionRequestedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL" ) );
+ LOG_FUNC
- if (iWatcher->VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
+ if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
{
- // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState...
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL() VBus is already UP; ignore Session request." ) );
+ // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState...
+ LOG( "Session is ongoing (VBus high); ignore Session Request." );
return;
}
- TInt err = iWatcher->Usb().BusRequest();
- if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes...
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL BusRequestError err = %d" ), err));
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
- return;
- }
-
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::SessionRequestedL Session started OK (or VBUS already UP) err = %d" ), err));
- }
+ TInt err = iWatcher.Usb().BusRequest();
+ LOG1( "BusRequest() err = %d" , err);
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostABase::HandleL(TInt aWhat)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostABase::HandleL aWhat = %d" ), aWhat));
-
- iWatcher->HandleHostProblemL(aWhat);
+ if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err)
+ {
+ iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection,
+ EUsbStateHostHandleDropping);
+ }
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,36 +1,29 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <e32base.h>
#include <UsbWatcherInternalPSKeys.h>
+#include <e32property.h>
#include "cusbstatehostahost.h"
#include "cusbnotifmanager.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
#include "definitions.h"
-
#include "errors.h"
-
#include "debug.h"
#include "panic.h"
@@ -38,7 +31,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher* aWatcher) :
+CUsbStateHostAHost::CUsbStateHostAHost(CUsbOtgWatcher& aWatcher) :
CUsbStateHostABase(aWatcher)
{
}
@@ -49,7 +42,7 @@
//
void CUsbStateHostAHost::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::ConstructL" ) );
+ LOG_FUNC
CUsbStateHostABase::ConstructL();
@@ -59,9 +52,9 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher* aWatcher)
+CUsbStateHostAHost* CUsbStateHostAHost::NewL(CUsbOtgWatcher& aWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::NewL" ) );
+ LOG_FUNC
CUsbStateHostAHost* self = new (ELeave) CUsbStateHostAHost(aWatcher);
CleanupStack::PushL(self);
@@ -76,7 +69,7 @@
//
CUsbStateHostAHost::~CUsbStateHostAHost()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::~CUsbStateHostAHost" ) );
+ LOG_FUNC
}
@@ -86,8 +79,6 @@
//
TUsbStateIds CUsbStateHostAHost::Id()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::Id" ) );
-
return EUsbStateHostAHost;
}
@@ -97,13 +88,15 @@
//
void CUsbStateHostAHost::JustAdvancedToThisStateL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::JustAdvancedToThisStateL" ) );
-
- User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher,
- KUsbWatcherIsPeripheralConnected,
- KUsbWatcherPeripheralIsConnected ) );
-
- iWatcher->PrintStateToLog();
+ LOG_FUNC
+
+ // do general things
+ CUsbStateHostABase::JustAdvancedToThisStateL();
+
+ LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher,
+ KUsbWatcherIsPeripheralConnected,
+ KUsbWatcherPeripheralIsConnected));
+
}
// ---------------------------------------------------------------------------
@@ -112,31 +105,14 @@
//
void CUsbStateHostAHost::JustBeforeLeavingThisStateL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::JustBeforeLeavingThisStateL" ) );
-
- User::LeaveIfError( RProperty::Set( KPSUidUsbWatcher,
- KUsbWatcherIsPeripheralConnected,
- KUsbWatcherPeripheralIsNotConnected ) );
- }
+ LOG_FUNC
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAHost::AHostL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::AHostL" ) );
- // do nothing
- }
+ LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher,
+ KUsbWatcherIsPeripheralConnected,
+ KUsbWatcherPeripheralIsNotConnected));
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAHost::APeripheralL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AHostL" ) );
- ChangeHostStateL(EUsbStateHostAPeripheral);
+ // do general things
+ CUsbStateHostABase::JustBeforeLeavingThisStateL();
}
// ---------------------------------------------------------------------------
@@ -145,8 +121,8 @@
//
void CUsbStateHostAHost::DeviceDetachedL(TDeviceEventInformation)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::DeviceDetachedL" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAInitiate);
}
// ---------------------------------------------------------------------------
@@ -155,6 +131,6 @@
//
void CUsbStateHostAHost::BadHubPositionL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::BadHubPositionL" ) );
- Panic(EBadHubPositionEventNotExpected);
+ LOG_FUNC
+ PANIC( EBadHubPositionEventNotExpected);
}
--- a/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
- *
-*/
-
-
-#include "cusbstatehostaidle.h"
-#include "cusbnotifmanager.h"
-
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-#include "definitions.h"
-
-#include "errors.h"
-#include "debug.h"
-#include "panic.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher) :
- CUsbStateHostAInitiateBase(aWatcher)
- {
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::ConstructL" ) );
-
- CUsbStateHostAInitiateBase::ConstructL();
- }
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-
-CUsbStateHostAIdle* CUsbStateHostAIdle::NewL(CUsbOtgWatcher* aWatcher)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::NewL" ) );
-
- CUsbStateHostAIdle* self = new (ELeave) CUsbStateHostAIdle(aWatcher);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::~CUsbStateHostAIdle()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::~CUsbStateHostAIdle" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TUsbStateIds CUsbStateHostAIdle::Id()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::Id" ) );
-
- return EUsbStateHostAIdle;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::JustAdvancedToThisStateL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::JustAdvancedToThisStateL" ) );
-
- iWatcher->PrintStateToLog();
-
- // do BusDrop, if Up
- if (CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusDrop();
- if (err != KErrNone)
- {
- err = iWatcher->Usb().BusClearError();
- if (KErrNone != err)
- {
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
- }
- }
- }
- }
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,32 +1,36 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 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 <usbhosterrors.h>
-
+#include "cusbotgwatcher.h"
#include "cusbstatehostainitiate.h"
+
#ifndef STIF
+#include "cusbtimer.h"
#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
#else
#include "mockcusbnotifmanager.h"
#include "mockcusbtimer.h"
#endif
-#include "definitions.h"
+#include "definitions.h"
#include "errors.h"
+
#include "debug.h"
#include "panic.h"
@@ -34,8 +38,8 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostAInitiate::CUsbStateHostAInitiate(CUsbOtgWatcher* aWatcher) :
- CUsbStateHostAInitiateBase(aWatcher)
+CUsbStateHostAInitiate::CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostABase(aWatcher), iDeviceAttached(EFalse)
{
}
@@ -45,18 +49,21 @@
//
void CUsbStateHostAInitiate::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::ConstructL" ) );
+ LOG_FUNC
- CUsbStateHostAInitiateBase::ConstructL();
+ CUsbStateHostABase::ConstructL();
+
+ iAttachmentTimer = CUsbTimer::NewL(*this, EDeviceAttachmentTimer);
+
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostAInitiate* CUsbStateHostAInitiate::NewL(CUsbOtgWatcher* aWatcher)
+CUsbStateHostAInitiate* CUsbStateHostAInitiate::NewL(CUsbOtgWatcher& aWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::NewL" ) );
+ LOG_FUNC
CUsbStateHostAInitiate* self = new (ELeave) CUsbStateHostAInitiate(
aWatcher);
@@ -72,7 +79,9 @@
//
CUsbStateHostAInitiate::~CUsbStateHostAInitiate()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::~CUsbStateHostAInitiate" ) );
+ LOG_FUNC
+
+ delete iAttachmentTimer;
}
// ---------------------------------------------------------------------------
@@ -81,9 +90,21 @@
//
TUsbStateIds CUsbStateHostAInitiate::Id()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::Id" ) );
+ return EUsbStateHostAInitiate;
+ }
- return EUsbStateHostAInitiate;
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::JustBeforeLeavingThisStateL()
+ {
+ LOG_FUNC
+
+ iAttachmentTimer->Cancel();
+
+ // do general things
+ CUsbStateHostABase::JustBeforeLeavingThisStateL();
}
// ---------------------------------------------------------------------------
@@ -92,24 +113,28 @@
//
void CUsbStateHostAInitiate::JustAdvancedToThisStateL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL" ) );
+ LOG_FUNC
+
+ // do general things
+ CUsbStateHostABase::JustAdvancedToThisStateL();
- iWatcher->PrintStateToLog();
+ // clear this attribute, and wait for attachment
+ // one attchment has to correspond to only one detachment
+ iDeviceAttached = EFalse; // to catch not corresponding Detachment, if any
- TInt err = iWatcher->Usb().EnableFunctionDriverLoading();
+ TInt err = iWatcher.Usb().EnableFunctionDriverLoading();
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL EnableFunctionDriverLoading error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ LOG1( "EnableFunctionDriverLoading err = %d", err );
+ iWatcher.HandleHostProblemL(EUsbWatcherCanNotEnableDriverLoading,
+ EUsbStateHostHandleDropping);
return;
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL EnableFunctionDriverLoading(); = %d" ), err));
-
// do BusRequest, if down
- if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
+ if (CUsbVBusObserver::EVBusUp != iWatcher.VBusObserver()->VBus())
{
const TUint maxTrial = 3;
TInt busReqErr(KErrGeneral);
@@ -117,15 +142,17 @@
while (count < maxTrial && KErrNone != busReqErr)
{
- busReqErr = iWatcher->Usb().BusRequest();
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustAdvancedToThisStateL BusRequest() = %d" ), err));
+ busReqErr = iWatcher.Usb().BusRequest();
+ LOG1( "BusRequest() busReqErr = %d" , busReqErr);
if (KErrNone != busReqErr)
{
- err = iWatcher->Usb().BusClearError();
+ err = iWatcher.Usb().BusClearError();
if (KErrNone != err)
{
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher.HandleHostProblemL(
+ EUsbWatcherCanNotClearBusError,
+ EUsbStateHostHandleDropping);
return;
}
}
@@ -133,7 +160,8 @@
}
if (KErrNone != busReqErr)
{
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
+ iWatcher.HandleHostProblemL(EUsbWatcherCanNotRaiseVBus,
+ EUsbStateHostHandleDropping);
return;
}
}
@@ -143,13 +171,165 @@
}
+// From TimerObserver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::TimerElapsedL(TUsbTimerId aTimerId)
+ {
+ LOG_FUNC
+
+ switch (aTimerId)
+ {
+ case EDeviceAttachmentTimer:
+ {
+ LOG("AttachmentTimer" );
+ HandleL(EUsbWatcherErrDandlingCable, EUsbStateHostHandleDropping);
+ break;
+ }
+ default:
+ {
+ LOG1( "Unknown timer id = %d", aTimerId );
+ PANIC( EWrongTimerId);
+ }
+ }
+ }
+
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::VBusUpL()
+ {
+ LOG_FUNC
+ }
+
+// From Host Event notification observer
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbStateHostAInitiate::JustBeforeLeavingThisStateL()
+void CUsbStateHostAInitiate::DeviceAttachedL(TDeviceEventInformation aTdi)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiate::JustBeforeLeavingThisStateL" ) );
-
- CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL();
+ LOG_FUNC
+
+ iDeviceAttached = ETrue;
+ iAttachmentTimer->Cancel();
+
+ // check if an OTG device connected
+ TOtgDescriptor otgDescriptor;
+
+ // ignore all the errors, assume we connected to not otg
+ TInt err = iWatcher.Usb().GetOtgDescriptor(aTdi.iDeviceId, otgDescriptor);
+ LOG1("GetOtgDescriptor() err = %d", err );
+
+ TBool hnpSupported(otgDescriptor.iAttributes & EUsbOtgHNPSupported);
+ TBool srpSupported(otgDescriptor.iAttributes & EUsbOtgSRPSupported);
+
+ // OTG device supports both hnp and srp
+ if (hnpSupported && srpSupported)
+ {
+
+ HandleL(EUsbWatcherConnectedToOTG, EUsbStateHostHandleDropping);
+ return;
+ }
+
+ switch (aTdi.iError)
+ // error in attachement
+ {
+ case KErrNone:
+ {
+ break;
+ }
+ case KErrUsbDeviceDetachedDuringDriverLoading:
+ {
+ //do not show error, due to device is already detached
+ // Device Detachment will not come after this (it was not attached yet)
+ // therefore emulate detachment
+ // content of aTdi is not important, due to detachment anyway
+ DeviceDetachedL(aTdi);
+ break;
+ }
+ case KErrBadPower:
+ {
+ LOG( "TooMuchPower" );
+ HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration,
+ EUsbStateHostDelayNotAttachedHandle);
+ break;
+ }
+ default:
+ {
+ LOG1("AttachmentError aTdi.iError = %d" , aTdi.iError );
+ HandleL(EUsbWatcherErrUnsupportedDevice,
+ EUsbStateHostHandleDropping);
+ }
+ }
}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::DeviceDetachedL(TDeviceEventInformation aTdi)
+ {
+ LOG_FUNC
+
+ // iDeviceAttached is used here to avoid one more state creation (init->attached->detached)
+ // due to purpose of this state only to wait for drivers load
+ if (!iDeviceAttached)
+ {
+ PANIC(EDeviceDetachedNotExpected)
+ }
+
+ // go out, and go in to the same state
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::DriverLoadSuccessL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAHost);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::DriverLoadPartialSuccessL(
+ TDeviceEventInformation aDei)
+ {
+ LOG_FUNC
+
+ switch (aDei.iError)
+ {
+ case KErrUsbDeviceDetachedDuringDriverLoading:
+ {
+ //do not show warning, due to device is already detached
+ break;
+ }
+ default:
+ {
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning,
+ EUsbOtgPartiallySupportedDevice, NULL);
+ }
+ }
+ ChangeHostStateL( EUsbStateHostAHost);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAInitiate::DriverLoadFailureL(TDeviceEventInformation aDei)
+ {
+ LOG_FUNC
+
+ HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayAttachedHandle);
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
- *
-*/
-
-
-#include <usbuinotif.h>
-#include <usbpersonalityids.h>
-
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
-#else
-#include "mockcusbnotifmanager.h"
-#include "mockcusbtimer.h"
-#endif
-
-#include "definitions.h"
-#include "errors.h"
-
-#include "debug.h"
-#include "panic.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::CUsbStateHostAInitiateBase(
- CUsbOtgWatcher* aWatcher) :
- CUsbStateHostABase(aWatcher)
- {
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::ConstructL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::ConstructL" ) );
-
- CUsbStateHostABase::ConstructL();
-
- iAttachmentTimer = CUsbTimer::NewL(this, EDeviceAttachmentTimer);
-
- //iUsbPersonalitySwitch = CUsbPersonalitySwitch::NewL(this);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase" ) );
-
- delete iAttachmentTimer;
- //delete iUsbPersonalitySwitch;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL" ) );
- iAttachmentTimer->Cancel();
- }
-
-// From TimerObserver
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::TimerElapsedL(TUsbTimerId aTimerId)
- {
- switch (aTimerId)
- {
- case EDeviceAttachmentTimer:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - AttachmentTimer" ) );
- HandleL(EUsbWatcherErrDandlingCable);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - Unknown timer" ) );
- Panic(EWrongTimerId);
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusUpL()
- {
- // start timer, waiting for device attachment
- iAttachmentTimer->After(KTimeToWaitForDeviceAttachment);
- }
-
-// From VBus observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusDownL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::VBusDownL" ) );
- iAttachmentTimer->Cancel();
-
- CUsbStateHostABase::VBusDownL();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::AHostL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::AHostL" ) );
- // do nothing
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::APeripheralL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AHostL" ) );
- ChangeHostStateL(EUsbStateHostAPeripheral);
- }
-
-// From Host Event notification observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DeviceAttachedL(TDeviceEventInformation aTdi)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDeviceId = %d" ), aTdi.iDeviceId));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iEventType = %d" ), aTdi.iEventType));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iError = %d" ), aTdi.iError));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDriverLoadStatus = %d" ), aTdi.iDriverLoadStatus));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iVid = %d" ), aTdi.iVid));
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iPid = %d" ), aTdi.iPid));
-
- iAttachmentTimer->Cancel();
-
- // check if an OTG device connected
- TOtgDescriptor otgDescriptor;
-
- // ignore all the errors, assume we connected to not otg
- TInt err = iWatcher->Usb().GetOtgDescriptor(aTdi.iDeviceId, otgDescriptor);
-
- TBool hnpSupported(otgDescriptor.iAttributes & EUsbOtgHNPSupported);
- TBool srpSupported(otgDescriptor.iAttributes & EUsbOtgSRPSupported);
-
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL GetOtgDescriptor err = %d, HNP supported = %d, SRP supported = %d" ), err, hnpSupported, srpSupported));
-
- // OTG device supports both hnp and srp
- if(hnpSupported && srpSupported)
- {
- HandleL(EUsbWatcherConnectedToOTG);
- return;
- }
-
- if (KErrNone != aTdi.iError)
- {
- switch (aTdi.iError)
- // error in attachement
- {
- case KErrBadPower:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL TooMuchPower" ) );
- HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL AttachmentError" ) );
- HandleL(EUsbWatcherErrUnsupportedDevice);
- break;
- }
-
- }
-
- return;
- }
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadSuccessL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadSuccessL" ) );
- ChangeHostStateL(EUsbStateHostAHost);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadPartialSuccessL(
- TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadPartialSuccessL" ) );
- iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning,
- EUsbOtgPartiallySupportedDevice, NULL);
- ChangeHostStateL(EUsbStateHostAHost);
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadFailureL(
- TDeviceEventInformation aDei)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadFailureL" ) );
-
- // try initiate to switch to mass storage
- /* if (KErrNone != iUsbPersonalitySwitch->SwitchPersonalityL(aDei.iDeviceId,
- KUsbPersonalityIdMS ))
- {*/
- HandleL(EUsbWatcherErrDriversNotFound);
- // }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::SrpReceivedL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL" ) );
- if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusRespondSrp();
- if (KErrNone != err)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL BusRespondSrp error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
- }
- }
- }
-
-void CUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL(
- MUsbPersonalitySwitchObserver::TState aState, TInt aData)
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL aState = %d aData = %d" ), TInt(aState), aData));
-
- switch (aState)
- {
- case ERequestingAllPersonalities:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingAllPersonalities" ) );
- break;
- }
- case ERequestingSetPersonality:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingSetPersonality" ) );
- break;
- }
- case EGetAllPersonalitiesCompleted:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL EGetAllPersonalitiesCompleted" ) );
- if (KErrNotFound == aData)
- {
- // no supported or needed personality/ies in the peripheral
- HandleL(EUsbWatcherErrDriversNotFound);
- }
- break;
- }
- case ESetPersonalityCompleted:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ESetPersonalityCompleted" ) );
-
- break;
- }
- case ERequestCancelled:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestCancelled" ) );
- break;
- }
- case ERequestFailed:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestFailed" ) );
- HandleL(EUsbWatcherErrDriversNotFound);
- break;
- }
- default:
- {
- Panic(EUnexpectedUsbSwitchPersonalityState);
- }
- }
- }
--- a/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,33 +1,24 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbuinotif.h>
#include "cusbstatehostaperipheral.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
-#else
-#include "mockcusbnotifmanager.h"
-#include "mockcusbtimer.h"
-#endif
-
#include "errors.h"
#include "debug.h"
#include "panic.h"
@@ -36,7 +27,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostAPeripheral::CUsbStateHostAPeripheral(CUsbOtgWatcher* aWatcher) :
+CUsbStateHostAPeripheral::CUsbStateHostAPeripheral(CUsbOtgWatcher& aWatcher) :
CUsbStateHostABase(aWatcher)
{
}
@@ -47,7 +38,7 @@
//
void CUsbStateHostAPeripheral::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::ConstructL" ) );
+ LOG_FUNC
CUsbStateHostABase::ConstructL();
}
@@ -57,9 +48,9 @@
// ---------------------------------------------------------------------------
//
CUsbStateHostAPeripheral* CUsbStateHostAPeripheral::NewL(
- CUsbOtgWatcher* aWatcher)
+ CUsbOtgWatcher& aWatcher)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::NewL" ) );
+ LOG_FUNC
CUsbStateHostAPeripheral* self = new (ELeave) CUsbStateHostAPeripheral(
aWatcher);
@@ -75,17 +66,7 @@
//
CUsbStateHostAPeripheral::~CUsbStateHostAPeripheral()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::~CUsbStateHostAPeripheral" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAPeripheral::JustAdvancedToThisStateL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::JustAdvancedToThisStateL" ) );
- iWatcher->PrintStateToLog();
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -94,19 +75,26 @@
//
TUsbStateIds CUsbStateHostAPeripheral::Id()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::Id" ) );
return EUsbStateHostAPeripheral;
}
// From OTG state observer
-
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void CUsbStateHostAPeripheral::AHostL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAPeripheral::AHostL" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAInitiate);
}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostAPeripheral::AIdleL()
+ {
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
+
+#include <usbuinotif.h>
+
+#include "cusbstatehostdelayattachedhandle.h"
+#ifndef STIF
+#include "cusbtimer.h"
+#else
+#include "mockcusbtimer.h"
+#endif
+
+#include "errors.h"
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayAttachedHandle::CUsbStateHostDelayAttachedHandle(
+ CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostDelayHandle(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayAttachedHandle* CUsbStateHostDelayAttachedHandle::NewL(
+ CUsbOtgWatcher& aWatcher)
+ {
+ LOG_FUNC
+
+ CUsbStateHostDelayAttachedHandle* self =
+ new (ELeave) CUsbStateHostDelayAttachedHandle(aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayAttachedHandle::ConstructL()
+ {
+ LOG_FUNC
+
+ CUsbStateHostDelayHandle::ConstructL();
+ iDriversNotFoundTimer = CUsbTimer::NewL(*this, EDriversNotFoundTimer);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayAttachedHandle::~CUsbStateHostDelayAttachedHandle()
+ {
+ LOG_FUNC
+
+ delete iDriversNotFoundTimer;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbStateHostDelayAttachedHandle::Id()
+ {
+ return EUsbStateHostDelayAttachedHandle;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayAttachedHandle::JustBeforeLeavingThisStateL()
+ {
+ LOG_FUNC
+
+ iDriversNotFoundTimer->Cancel();
+
+ // do general things
+ CUsbStateHostDelayHandle::JustBeforeLeavingThisStateL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayAttachedHandle::DoHandleL()
+ {
+ LOG_FUNC
+ LOG1( "iWhat = %d" , iWhat);
+
+ switch (iWhat)
+ {
+ case EUsbWatcherErrDriversNotFound:
+ {
+ LOG("DriversNotFound" );
+
+ iDriversNotFoundTimer->After(KTimeDriversNotFound);
+ break;
+
+ }
+
+ default:
+ {
+ LOG1("Unexpected request id = %d" , iWhat );
+ PANIC( EUnexpectedSituationToHandle);
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayAttachedHandle::DeviceDetachedL(
+ TDeviceEventInformation)
+ {
+ LOG_FUNC
+
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ }
+
+// From TimerObserver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayAttachedHandle::TimerElapsedL(TUsbTimerId aTimerId)
+ {
+ LOG_FUNC
+
+ switch (aTimerId)
+ {
+ case EDriversNotFoundTimer:
+ {
+ LOG( "EDriversNotFoundTimer" );
+ HandleL(EUsbWatcherErrUnsupportedDevice,
+ EUsbStateHostHandleDropping);
+
+ break;
+ }
+ default:
+ {
+ LOG1( "Unknown timer id = %d", aTimerId );
+ PANIC( EWrongTimerId);
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
+
+#include "cusbotgwatcher.h"
+#include "cusbstatehostdelayhandle.h"
+
+#include "errors.h"
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayHandle::CUsbStateHostDelayHandle(CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostHandle(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayHandle::ConstructL()
+ {
+ LOG_FUNC
+
+ CUsbStateHostHandle::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayHandle::~CUsbStateHostDelayHandle()
+ {
+ LOG_FUNC
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayHandle::VBusUpL()
+ {
+ LOG_FUNC
+ // this is not expected, due to in this state vbus already up, since entering the state
+ PANIC( EVBusUpNotExpected);
+ }
+
+// From Host Event notification observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayHandle::DeviceAttachedL(
+ TDeviceEventInformation aDevEventInfo)
+ {
+ LOG_FUNC
+
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ iWatcher.DeviceAttachedL(aDevEventInfo);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
+
+#include "cusbstatehostdelaynotattachedhandle.h"
+
+#include "errors.h"
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayNotAttachedHandle::CUsbStateHostDelayNotAttachedHandle(
+ CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostDelayHandle(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayNotAttachedHandle* CUsbStateHostDelayNotAttachedHandle::NewL(
+ CUsbOtgWatcher& aWatcher)
+ {
+ LOG_FUNC
+
+ CUsbStateHostDelayNotAttachedHandle* self =
+ new (ELeave) CUsbStateHostDelayNotAttachedHandle(aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::ConstructL()
+ {
+ LOG_FUNC
+
+ CUsbStateHostDelayHandle::ConstructL();
+
+ iTooMuchPowerTimer = CUsbTimer::NewL(*this, ETooMuchPowerRequiredTimer);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostDelayNotAttachedHandle::~CUsbStateHostDelayNotAttachedHandle()
+ {
+ LOG_FUNC
+
+ delete iTooMuchPowerTimer;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbStateHostDelayNotAttachedHandle::Id()
+ {
+ return EUsbStateHostDelayNotAttachedHandle;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::JustBeforeLeavingThisStateL()
+ {
+ LOG_FUNC
+
+ iTooMuchPowerTimer->Cancel();
+
+ // do general things
+ CUsbStateHostDelayHandle::JustBeforeLeavingThisStateL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::DoHandleL()
+ {
+ LOG_FUNC
+ LOG1( "iWhat = %d" , iWhat);
+
+ switch (iWhat)
+ {
+ case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration:
+ {
+ LOG("EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" );
+
+ iTooMuchPowerTimer->After(KTimeTooMuchPowerRequired);
+ break;
+ }
+
+ default:
+ {
+ LOG1("Unexpected request id = %d", iWhat);
+ PANIC( EUnexpectedSituationToHandle);
+ break;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::AIdleL()
+ {
+ LOG_FUNC
+
+ // Exit on AIdle, due to Detachment not comes,
+ // because no corresponding attachment with err == KErrNone
+ ChangeHostStateL( EUsbStateHostAInitiate);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::DeviceDetachedL(
+ TDeviceEventInformation)
+ {
+ LOG_FUNC
+ PANIC( EDeviceDetachedNotExpected);
+
+ }
+
+// From TimerObserver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostDelayNotAttachedHandle::TimerElapsedL(TUsbTimerId aTimerId)
+ {
+ LOG_FUNC
+ switch (aTimerId)
+ {
+ case ETooMuchPowerRequiredTimer:
+ {
+ LOG("ETooMuchPowerRequiredTimer" );
+ HandleL(EUsbWatcherErrUnsupportedDevice,
+ EUsbStateHostHandleDropping);
+ break;
+ }
+ default:
+ {
+ LOG1("Unknown timer id = %d", aTimerId );
+ PANIC( EWrongTimerId);
+ }
+ }
+ }
--- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,29 +1,21 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
-
-#include <usbuinotif.h>
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include "cusbstatehosthandle.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#else
-#include "mockcusbnotifmanager.h"
-#endif
#include "errors.h"
#include "debug.h"
@@ -33,8 +25,8 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostHandle::CUsbStateHostHandle(CUsbOtgWatcher* aWatcher) :
- CUsbState(aWatcher)
+CUsbStateHostHandle::CUsbStateHostHandle(CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostABase(aWatcher)
{
}
@@ -42,27 +34,11 @@
//
// ---------------------------------------------------------------------------
//
-CUsbStateHostHandle* CUsbStateHostHandle::NewL(CUsbOtgWatcher* aWatcher)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAHost::NewL" ) );
-
- CUsbStateHostHandle* self = new (ELeave) CUsbStateHostHandle(aWatcher);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
void CUsbStateHostHandle::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::ConstructL" ) );
+ LOG_FUNC
- iTooMuchPowerTimer = CUsbTimer::NewL(this, ETooMuchPowerRequiredTimer);
- iDriversNotFoundTimer = CUsbTimer::NewL(this, EDriversNotFoundTimer);
+ CUsbStateHostABase::ConstructL();
}
@@ -72,21 +48,7 @@
//
CUsbStateHostHandle::~CUsbStateHostHandle()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::~CUsbStateHostHandle" ) );
-
- delete iTooMuchPowerTimer;
- delete iDriversNotFoundTimer;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TUsbStateIds CUsbStateHostHandle::Id()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::Id" ) );
-
- return EUsbStateHostHandle;
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -95,467 +57,34 @@
//
void CUsbStateHostHandle::JustAdvancedToThisStateL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::JustAdvancedToThisStateL" ) );
- iWatcher->PrintStateToLog();
+ LOG_FUNC
+ // first do general things
+ CUsbStateHostABase::JustAdvancedToThisStateL();
+
+ // then, do specific things
DoHandleL();
+
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbStateHostHandle::JustBeforeLeavingThisStateL()
- {
- iTooMuchPowerTimer->Cancel();
- iDriversNotFoundTimer->Cancel();
-
- iWatcher->NotifManager()->CloseAllNotifiers();
- }
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
void CUsbStateHostHandle::SetWhat(TInt aWhat)
{
iWhat = aWhat;
}
-// this means only one wait notifier at a time can be shown by this state
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::WaitNotifierCompletedL(TInt /*aFeedback*/)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL" ) );
- switch (iWhat)
- {
- case EUsbWatcherErrDriversNotFound:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL DriversNotFound" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherHubsNotSupported:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherHubsNotSupported" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherErrDeviceRequiresTooMuchPower:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDeviceRequiresTooMuchPower" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherErrUnsupportedDevice:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrUnsupportedDevice" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherConnectedToOTG:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherConnectedToOTG" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherErrDandlingCable:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrDandlingCable" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherNoActivity:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherNoActivity" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherErrorInConnection:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherErrorInConnection" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- case EUsbWatcherCanNotStartUsbServices:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL EUsbWatcherCanNotStartUsbServices" ) );
-
- break;
- }
- // errors from observers mapped to one
- case EUsbWatcherIdPinError:
- case EUsbWatcherVBusObserverError:
- case EUsbWatcherHostEventNotificationError:
- case EUsbWatcherOtgStateError:
- case EUsbWatcherMessageNotificationError:
- {
- // try to restore
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL Error in observer" ) );
- ChangeHostStateL(EUsbStateHostAInitiate);
- break;
- }
- default:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::WaitNotifierCompletedL Unexpected situation to be handled" ) );
- Panic(EUnexpectedSituationToHandle);
- break;
- }
-
- }
- }
-
+// From message notification observer
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-void CUsbStateHostHandle::DoHandleL()
- {
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL iWhat = %d" ), iWhat));
-
- if (iTooMuchPowerTimer)
- iTooMuchPowerTimer->Cancel();
-
- 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;
- }
- 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;
- }
- 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;
- }
- 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);
-
- break;
- }
- 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;
- }
- case EUsbWatcherCanNotStartUsbServices:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL EUsbWatcherCanNotStartUsbServices" ) );
- iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
- EUsbOtgErrorInConnection, this);
- break;
- }
- // errors from observers mapped to one
- case EUsbWatcherIdPinError:
- case EUsbWatcherVBusObserverError:
- case EUsbWatcherHostEventNotificationError:
- case EUsbWatcherOtgStateError:
- case EUsbWatcherMessageNotificationError:
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DoHandleL Error from observer" ) );
- // 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" ) );
- Panic(EUnexpectedSituationToHandle);
- break;
- }
- }
- }
-
-/////////////////////////////////////////////////////////////////////////////////////
-// just ignore all the events
-// From VBus observer
-void CUsbStateHostHandle::VBusDownL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::VBusDownL" ) );
- }
-
-// From OTG state observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::AIdleL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::AIdleL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::AHostL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::AHostL" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::APeripheralL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::APeripheralL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::AVBusErrorL()
+void CUsbStateHostHandle::MessageNotificationReceivedL(TInt aMessage)
{
- 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" ) );
-
- }
-
-// From bus activity observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::BusIdleL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusIdleL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::BusActiveL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::BusActiveL" ) );
-
- }
-
-// From Host Event notification observer
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::DeviceAttachedL(
- TDeviceEventInformation aDevEventInfo)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL" ) );
-
- if (iTooMuchPowerTimer->IsActive() || iDriversNotFoundTimer->IsActive())
- {
- ChangeHostStateL(EUsbStateHostAInitiate);
- iWatcher->DeviceAttachedL(aDevEventInfo);
- return;
- }
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceAttachedL Unexpected situation" ) );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::DeviceDetachedL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::DeviceDetachedL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::DriverLoadSuccessL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadSuccessL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::DriverLoadPartialSuccessL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadPartialSuccessL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::DriverLoadFailureL(TDeviceEventInformation)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbState::DriverLoadFailureL" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::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" ) );
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostHandle::SrpReceivedL()
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL" ) );
-
- if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
- {
- TInt err = iWatcher->Usb().BusRespondSrp();
- if (KErrNone != err)
- {
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SrpReceivedL BusRespondSrp error" ) );
- iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection);
- }
- else
- {
- ChangeHostStateL(EUsbStateHostAInitiate);
- }
- }
+ LOG_FUNC
+ LOG1( "Unhandled message aMessage = %d" , aMessage);
}
@@ -565,41 +94,5 @@
//
void CUsbStateHostHandle::SessionRequestedL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostHandle::SessionRequestedL" ) );
-
+ LOG_FUNC
}
-
-// 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/cusbstatehosthandledropping.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,412 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
+
+#include <usbuinotif.h>
+#include <d32usbdi_errors.h>
+
+#include "cusbotgwatcher.h"
+#include "cusbstatehosthandledropping.h"
+
+#ifndef STIF
+#include "cusbnotifmanager.h"
+#else
+#include "mockcusbnotifmanager.h"
+#endif
+
+#include "errors.h"
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostHandleDropping::CUsbStateHostHandleDropping(
+ CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostHandle(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostHandleDropping* CUsbStateHostHandleDropping::NewL(
+ CUsbOtgWatcher& aWatcher)
+ {
+ LOG_FUNC
+
+ CUsbStateHostHandleDropping* self =
+ new (ELeave) CUsbStateHostHandleDropping(aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::ConstructL()
+ {
+ LOG_FUNC
+ CUsbStateHostHandle::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostHandleDropping::~CUsbStateHostHandleDropping()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbStateHostHandleDropping::Id()
+ {
+ return EUsbStateHostHandleDropping;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::JustBeforeLeavingThisStateL()
+ {
+ LOG_FUNC
+
+ iWatcher.NotifManager()->CloseAllNotifiers();
+
+ // do general things
+ CUsbStateHostHandle::JustBeforeLeavingThisStateL();
+ }
+
+// this means only one wait notifier at a time can be shown by this state
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::WaitNotifierCompletedL(TInt /*aFeedback*/)
+ {
+ LOG_FUNC
+
+ switch (iWhat)
+ {
+ case EUsbWatcherHubsNotSupported:
+ {
+ LOG( "EUsbWatcherHubsNotSupported" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherErrDeviceRequiresTooMuchPower:
+ {
+ LOG( "EUsbWatcherErrDeviceRequiresTooMuchPower" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherErrUnsupportedDevice:
+ {
+ LOG("EUsbWatcherErrUnsupportedDevice" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherConnectedToOTG:
+ {
+ LOG("EUsbWatcherConnectedToOTG" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherErrDandlingCable:
+ {
+ LOG("EUsbWatcherErrDandlingCable" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherNoActivity:
+ {
+ LOG("EUsbWatcherNoActivity" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+ case EUsbWatcherErrorInConnection:
+ {
+ LOG( "EUsbWatcherErrorInConnection" );
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ break;
+ }
+
+ // fatal errors
+ case EUsbWatcherCanNotStartUsbServices:
+ {
+ LOG( "EUsbWatcherCanNotStartUsbServices" );
+
+ // no break here
+ }
+
+ // no break statement for following cases
+ case EUsbWatcherNoMemory:
+ case EUsbWatcherIdPinError:
+ case EUsbWatcherVBusObserverError:
+ case EUsbWatcherHostEventNotificationError:
+ case EUsbWatcherOtgStateError:
+ case EUsbWatcherMessageNotificationError:
+ case EUsbWatcherCanNotStartSession:
+ case EUsbWatcherCanNotEnableDriverLoading:
+ case EUsbWatcherCanNotClearBusError:
+ case EUsbWatcherCanNotRaiseVBus:
+ {
+ LOG("Fatal error" );
+ ChangeHostStateL( EUsbStateHostUndefined);
+ break;
+ }
+ default:
+ {
+ LOG1("Unexpected situation to be handled iWhat = %d" , iWhat );
+ PANIC( EUnexpectedSituationToHandle);
+ break;
+ }
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DoHandleL()
+ {
+ LOG_FUNC
+
+ LOG1( "iWhat = %d" , iWhat);
+
+ // Drop VBus first
+ // Ignore any errors when calling BusDrop(). Those indicate that VBus already dropped
+ iWatcher.Usb().BusDrop();
+
+ switch (iWhat)
+ {
+
+ case EUsbWatcherHubsNotSupported:
+ {
+ LOG("EUsbWatcherHubsNotSupported" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgHubUnsupported, this);
+ break;
+ }
+ case EUsbWatcherErrDeviceRequiresTooMuchPower:
+ {
+ LOG("EUsbWatcherErrDeviceRequiresTooMuchPower" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgTooMuchPower, this);
+ break;
+ }
+ case EUsbWatcherErrUnsupportedDevice:
+ {
+ LOG("EUsbWatcherErrUnsupportedDevice" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgUnsupportedDevice, this);
+ break;
+ }
+ case EUsbWatcherConnectedToOTG:
+ {
+ LOG("EUsbWatcherConnectedToOTG" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgUnsupportedDevice, this);
+
+ break;
+ }
+ case EUsbWatcherErrDandlingCable:
+ {
+ LOG( "EUsbWatcherErrDandlingCable" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgErrorAttachTimedOut, this);
+ break;
+ }
+ case EUsbWatcherNoActivity:
+ {
+ LOG( "EUsbWatcherNoActivity" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgUnsupportedDevice, this);
+
+ break;
+ }
+ case EUsbWatcherErrorInConnection:
+ {
+ LOG("EUsbWatcherErrorInConnection" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgErrorInConnection, this);
+ break;
+ }
+ case EUsbWatcherNoMemory:
+ {
+ LOG("EUsbWatcherNoMemory" );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgErrorNoMemory, this);
+ break;
+ }
+ case EUsbWatcherCanNotStartUsbServices:
+ {
+ LOG("EUsbWatcherCanNotStartUsbServices" );
+ // no break here
+ }
+ // no break in following cases
+ case EUsbWatcherIdPinError:
+ case EUsbWatcherVBusObserverError:
+ case EUsbWatcherHostEventNotificationError:
+ case EUsbWatcherOtgStateError:
+ case EUsbWatcherMessageNotificationError:
+ case EUsbWatcherCanNotStartSession:
+ case EUsbWatcherCanNotEnableDriverLoading:
+ case EUsbWatcherCanNotClearBusError:
+ case EUsbWatcherCanNotRaiseVBus:
+ {
+ LOG1( "Fatal error iWhat = %d", iWhat );
+ iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError,
+ EUsbOtgErrorInConnection, this);
+ break;
+ }
+ default:
+ {
+ LOG1("Unexpected situation to be handled iWhat = %d", iWhat );
+ PANIC( EUnexpectedSituationToHandle);
+ break;
+ }
+ }
+ }
+
+/////////////////////////////////////////////////////////////////////////////////////
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::VBusUpL()
+ {
+ LOG_FUNC
+ ChangeHostStateL( EUsbStateHostAInitiate);
+ }
+
+// ---------------------------------------------------------------------------
+// this is expected in the state, for example after calling BusDrop
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::VBusDownL()
+ {
+ LOG_FUNC
+ }
+
+// From Host Event notification observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::AVBusErrorL()
+ {
+ LOG_FUNC
+ iWatcher.Usb().BusClearError();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DeviceAttachedL(
+ TDeviceEventInformation aDevEventInfo)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DeviceDetachedL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DriverLoadSuccessL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DriverLoadPartialSuccessL(
+ TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::DriverLoadFailureL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// From message notification observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::MessageNotificationReceivedL(TInt aMessage)
+ {
+ LOG_FUNC
+
+ LOG1( "aMessage = %d", aMessage )
+
+ switch (aMessage)
+ {
+ // USBDI
+ case KEventUsbBadDeviceDetached:
+ {
+ LOG("BadDeviceDetached" );
+ ChangeHostStateL( EUsbStateHostUndefined);
+ break;
+ }
+ default:
+ {
+ LOG1( "Unhandled message aMessage = %d" , aMessage);
+ break;
+ }
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostHandleDropping::VBusErrorL()
+ {
+ LOG_FUNC
+ iWatcher.Usb().BusClearError();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
+
+#include "cusbotgwatcher.h"
+#include "cusbstatehostundefined.h"
+
+#include "definitions.h"
+#include "errors.h"
+
+#include "debug.h"
+#include "panic.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined::CUsbStateHostUndefined(CUsbOtgWatcher& aWatcher) :
+ CUsbStateHostABase(aWatcher)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined* CUsbStateHostUndefined::NewL(CUsbOtgWatcher& aWatcher)
+ {
+ LOG_FUNC
+
+ CUsbStateHostUndefined* self = new (ELeave) CUsbStateHostUndefined(
+ aWatcher);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::ConstructL()
+ {
+ LOG_FUNC
+
+ CUsbStateHostABase::ConstructL();
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CUsbStateHostUndefined::~CUsbStateHostUndefined()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUsbStateIds CUsbStateHostUndefined::Id()
+ {
+ return EUsbStateHostUndefined;
+ }
+
+// From VBus observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusDownL()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusUpL()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::VBusErrorL()
+ {
+ LOG_FUNC
+ iWatcher.Usb().BusClearError();
+ }
+
+// From OTG state observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CUsbStateHostUndefined::AVBusErrorL()
+ {
+ LOG_FUNC
+ iWatcher.Usb().BusClearError();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::BIdleL()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::BPeripheralL()
+ {
+ LOG_FUNC
+ }
+
+// From host state observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::DeviceAttachedL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::DeviceDetachedL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::DriverLoadSuccessL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::DriverLoadPartialSuccessL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::DriverLoadFailureL(TDeviceEventInformation)
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::SrpReceivedL()
+ {
+ LOG_FUNC
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::SessionRequestedL()
+ {
+ LOG_FUNC
+ }
+
+// From message notification observer
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::MessageNotificationReceivedL(TInt aMessage)
+ {
+ LOG_FUNC
+ LOG1( "Unhandled message aMessage = %d" , aMessage);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CUsbStateHostUndefined::BadHubPositionL()
+ {
+ LOG_FUNC
+ PANIC( EBadHubPositionNotExpected);
+ }
--- a/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbtimer.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include "cusbtimer.h"
@@ -24,7 +23,7 @@
//
// ---------------------------------------------------------------------------
//
-CUsbTimer::CUsbTimer(MUsbTimerObserver* aObserver, TUsbTimerId aTimerId) :
+CUsbTimer::CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) :
CActive(CActive::EPriorityStandard), iObserver(aObserver), iTimerId(
aTimerId)
{
@@ -37,7 +36,7 @@
//
CUsbTimer::~CUsbTimer()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::~CUsbTimer" ) );
+ LOG_FUNC
Cancel();
iTimer.Close();
}
@@ -48,20 +47,19 @@
//
void CUsbTimer::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::ConstructL" ) );
- User::LeaveIfError(iTimer.CreateLocal());
+ LOG_FUNC
+ LEAVEIFERROR(iTimer.CreateLocal());
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
-CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver* anObserver,
- TUsbTimerId aTimerId)
+CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::NewL" ) );
+ LOG_FUNC
- CUsbTimer* self = new (ELeave) CUsbTimer(anObserver, aTimerId);
+ CUsbTimer* self = new (ELeave) CUsbTimer(aObserver, aTimerId);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self); // pop self
@@ -74,9 +72,7 @@
//
void CUsbTimer::After(TInt aMilliseconds)
{
-// FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::After aMilliseconds %d, timerId=%d" ), aMilliseconds, iTimerId))
-
- if (IsActive()) // should we panic here? or just restart timer
+ if (IsActive())
{
Cancel();
}
@@ -93,13 +89,12 @@
void CUsbTimer::RunL()
{
- if(KErrNone != iStatus.Int())
+ if (KErrNone != iStatus.Int())
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::RunL iStatus %d" ), iStatus.Int()));
- User::Leave(iStatus.Int());
+ LEAVE(iStatus.Int());
}
- iObserver->TimerElapsedL(iTimerId);
+ iObserver.TimerElapsedL(iTimerId);
}
// ---------------------------------------------------------------------------
@@ -108,7 +103,8 @@
//
TInt CUsbTimer::RunError(TInt aError)
{
- FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbTimer::RunError aError %d" ), aError ));
+ LOG_FUNC
+ LOG1( "aError = %d" , aError );
return KErrNone;
}
@@ -119,6 +115,5 @@
//
void CUsbTimer::DoCancel()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbTimer::DoCancel" ) )
iTimer.Cancel();
}
--- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Implementation
+ *
+ */
#include <usbotgdefs.h>
@@ -40,10 +39,9 @@
//
void CUsbVBusObserver::ConstructL()
{
+ LOG_FUNC
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::ConstructL" ) );
-
- User::LeaveIfError(iVBus.Attach(KUidUsbManCategory,
+ LEAVEIFERROR(iVBus.Attach(KUidUsbManCategory,
KUsbOtgVBusPoweredProperty));
}
@@ -54,8 +52,7 @@
//
CUsbVBusObserver* CUsbVBusObserver::NewL()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::NewL" ) );
+ LOG_FUNC
CUsbVBusObserver* self = new (ELeave) CUsbVBusObserver();
CleanupStack::PushL(self);
@@ -70,8 +67,7 @@
//
CUsbVBusObserver::~CUsbVBusObserver()
{
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::~CUsbVBusObserver" ) );
+ LOG_FUNC
Cancel();
@@ -85,24 +81,19 @@
//
// ---------------------------------------------------------------------------
//
-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" ) );
-
TInt val(0);
TInt err = iVBus.Get(val);
if (KErrNone != err)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus CanNotGetVBusProperty" ) );
- Panic(ECanNotGetVBusProperty);
+ LOG("CanNotGetVBusProperty" )
+ PANIC( ECanNotGetVBusProperty);
}
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::VBus = %d" ), val ));
-
- // not found in docs clear definition of this property. Verification is needed
return (0 == val ? EVBusDown : EVBusUp);
}
@@ -110,13 +101,19 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbVBusObserver::SubscribeL(MUsbVBusObserver* aObserver)
+void CUsbVBusObserver::SubscribeL(MUsbVBusObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL" ) );
+ LOG_FUNC
- User::LeaveIfError(iObservers.Append(aObserver));
-
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::SubscribeL Observer appended." ) );
+ // check if the same observer already exist in a list
+ if (KErrNotFound != iObservers.Find(&aObserver))
+ {
+ LOG( "Observer already exists" );
+ PANIC( EObserverAlreadyExists);
+ return;
+ }
+
+ iObservers.AppendL(&aObserver);
if (KFirst == iObservers.Count()) // first item
{
@@ -129,39 +126,24 @@
//
// ---------------------------------------------------------------------------
//
-void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver* aObserver)
+void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver& aObserver)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL" ) );
-
- if (0 == iObservers.Count()) // no items
+ LOG_FUNC
+
+ TInt i(iObservers.Find(&aObserver));
+ if (KErrNotFound == i)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbVBusObserver::UnsubscribeL No observers" ) );
+ LOG("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;
}
}
@@ -171,17 +153,19 @@
//
void CUsbVBusObserver::RunL()
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL iStatus = %d" ), iStatus.Int()));
+ LOG_FUNC
+
+ LOG1( "iStatus = %d" , iStatus.Int());
- // if error occured, tell to Observers
- if(KErrNone != iStatus.Int())
+ // if error occured, tell to Observers
+ if (KErrNone != iStatus.Int())
+ {
+ for (TInt i(0); i < iObservers.Count(); ++i)
{
- for (TInt i(0); i < iObservers.Count(); ++i)
- {
- iObservers[i]->VBusObserverErrorL(iStatus.Int());
- }
- return;
+ iObservers[i]->VBusObserverErrorL(iStatus.Int());
}
+ return;
+ }
// re-issue request first
iVBus.Subscribe(iStatus);
@@ -195,7 +179,7 @@
{
case EVBusUp:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL VBus UP"));
+ LOG("VBus UP");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -207,7 +191,7 @@
case EVBusDown:
{
- FLOG(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunL VBus DOWN"));
+ LOG("VBus DOWN");
for (TInt i(0); i < iObservers.Count(); ++i)
{
@@ -219,10 +203,10 @@
default:
{
- Panic(EWrongVBusState);
+ LOG("WrongVBusState");
+ PANIC( EWrongVBusState);
}
}
-
}
// ---------------------------------------------------------------------------
@@ -240,8 +224,9 @@
//
TInt CUsbVBusObserver::RunError(TInt aError)
{
+ LOG_FUNC
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbVBusObserver::RunError aError = %d" ), aError));
+ LOG1( "aError = %d" , aError);
// try to continue
return KErrNone;
--- a/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Usb waiting notifier implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Usb waiting notifier implementation
+ *
+ */
#include <e32std.h>
#include <usbuinotif.h>
@@ -32,9 +31,9 @@
// -----------------------------------------------------------------------------
//
CUsbWaitNotifier* CUsbWaitNotifier::NewL(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId)
+ CUsbNotifManager& aNotifManager, TUint aNotifId)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::NewL" ) );
+ LOG_FUNC
CUsbWaitNotifier* self = new (ELeave) CUsbWaitNotifier(aNotifier,
aNotifManager, aNotifId);
@@ -50,7 +49,7 @@
//
CUsbWaitNotifier::~CUsbWaitNotifier()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::~CUsbWaitNotifier" ) );
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -58,7 +57,7 @@
// ---------------------------------------------------------------------------
//
CUsbWaitNotifier::CUsbWaitNotifier(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId) :
+ CUsbNotifManager& aNotifManager, TUint aNotifId) :
CUsbNoteNotifier(aNotifier, aNotifManager, KUsbUiNotifOtgError, aNotifId)
{
SetFeedbackNeeded();
@@ -70,7 +69,7 @@
//
void CUsbWaitNotifier::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWaitNotifier::ConstructL" ) );
+ LOG_FUNC
CUsbNoteNotifier::ConstructL();
}
--- a/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,20 +1,19 @@
/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Usb warning notifier implementation
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
-*/
-
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Usb warning notifier implementation
+ *
+ */
#include <e32std.h>
#include <usbuinotif.h>
@@ -34,9 +33,11 @@
// -----------------------------------------------------------------------------
//
CUsbWarningNotifier* CUsbWarningNotifier::NewL(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId)
+ CUsbNotifManager& aNotifManager, TUint aNotifId)
{
- FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbWarningNotifier::NewL aNotifId = %d" ), aNotifId));
+ LOG_FUNC
+
+ LOG1( "aNotifId = %d" , aNotifId);
CUsbWarningNotifier* self = new (ELeave) CUsbWarningNotifier(aNotifier,
aNotifManager, aNotifId);
@@ -52,7 +53,7 @@
//
CUsbWarningNotifier::~CUsbWarningNotifier()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::~CUsbWarningNotifier" ) );
+ LOG_FUNC
}
// ---------------------------------------------------------------------------
@@ -60,11 +61,10 @@
// ---------------------------------------------------------------------------
//
CUsbWarningNotifier::CUsbWarningNotifier(RNotifier& aNotifier,
- CUsbNotifManager* aNotifManager, TUint aNotifId) :
+ CUsbNotifManager& aNotifManager, TUint aNotifId) :
CUsbNoteNotifier(aNotifier, aNotifManager, KUsbUiNotifOtgWarning,
aNotifId)
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::CUsbWarningNotifier" ) );
}
// -----------------------------------------------------------------------------
@@ -73,7 +73,7 @@
//
void CUsbWarningNotifier::ConstructL()
{
- FLOG( _L( "[USBOTGWATCHER]\tCUsbWarningNotifier::ConstructL" ) );
+ LOG_FUNC
CUsbNoteNotifier::ConstructL();
}
--- a/usbengines/usbotgwatcher/src/panic.cpp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Central place for debug-type macros & functions
-*
-*/
-
-
-#include "panic.h"
-
-void Panic(TUsbWatcherPanic aCategory)
-{
-#ifdef _DEBUG
- User::Panic(KUsbWatcherPanic, aCategory);
-#endif
-}
--- a/usbengines/usbremotepersonality/src/csetpersonality.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbremotepersonality/src/csetpersonality.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -117,7 +117,6 @@
case KErrNone:
{
result =CRemotePersonalityHandler::ESuccess;
- iUsbWatcher->SetPreviousPersonalityOnDisconnect();
break;
}
case KErrNotFound:
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
[StifSettings]
CapsModifier= USBRemotePersonalityTest.exe
[EndStifSettings]
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_ats.ini Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_ats.ini Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,20 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+
#
# This is STIF initialization file
# Comment lines start with '#'-character.
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_phone.ini Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_phone.ini Thu Jun 24 14:30:02 2010 +0100
@@ -1,3 +1,19 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
#
# This is STIF initialization file
# Comment lines start with '#'-character.
--- a/usbengines/usbwatcher/data/numberofacmfunctions.ini Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-[ACM_CONF]
-NumberOfAcmFunctions= 2
-
-[ACM 1]
-ProtocolNum= 1 // 0x01 - Code taken from USBCDC 1.1. Table 17- Hayes compatible modem
-
-
-[ACM 2]
-ProtocolNum= 255 //0xFF - vendor-specific
--- a/usbengines/usbwatcher/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -32,7 +32,7 @@
backup_registration.xml /epoc32/data/z/private/101F9696/backup_registration.xml
backup_registration.xml /epoc32/release/winscw/udeb/z/private/101F9696/backup_registration.xml
backup_registration.xml /epoc32/release/winscw/urel/z/private/101F9696/backup_registration.xml
-../data/numberofacmfunctions.ini /epoc32/data/z/private/101fe1db/numberofacmfunctions.ini
+
../loc/usbman.loc MW_LAYER_LOC_EXPORT_PATH(usbman.loc)
../rom/usbwatcher.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbwatcher.iby)
// This file contains actual personality rss data
@@ -48,3 +48,4 @@
../rom/mtp_symbian_temp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_symbian_temp.iby)
// End of file
+
--- a/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Thu Jun 24 14:30:02 2010 +0100
@@ -212,6 +212,11 @@
TPtrC8 iDummy;
/**
+ * Dummy descriptor buf
+ */
+ TBuf8<1> iDummyBuf;
+
+ /**
* Buffer where selected personality is stored by the ask
* on connection.
*/
@@ -252,6 +257,11 @@
*/
TUsbActivePersonalityState iState;
+ /**
+ * Cleanup process or normal process in various states
+ */
+ TBool isFailureCleanup;
+
/**
* Request to be completed.
*/
@@ -271,6 +281,11 @@
* The device state.
*/
TUsbDeviceState iDeviceState;
+
+ /**
+ * Packages for queries
+ */
+ TUSBQueriesNotifierParamsPckg iQueryParams;
};
#endif // CUSBACTIVEPERSONALITYHANDLER_H
--- a/usbengines/usbwatcher/inc/cusbwatcher.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/inc/cusbwatcher.h Thu Jun 24 14:30:02 2010 +0100
@@ -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 Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/inc/cusbwatcher.inl Thu Jun 24 14:30:02 2010 +0100
@@ -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 Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/inc/debug.h Thu Jun 24 14:30:02 2010 +0100
@@ -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/rom/mtp_symbian_temp.iby Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Thu Jun 24 14:30:02 2010 +0100
@@ -103,13 +103,6 @@
data=EPOCROOT##epoc32\data\Z\resource\mtp\2001FCAE.rsc resource\mtp\2001FCAE.rsc
#endif MTPIMAGEDP_IBY
-// mediasyncserver.iby
-#ifndef MEDIASYNCSERVER_IBY
-#define MEDIASYNCSERVER_IBY
-file=ABI_DIR\BUILD_DIR\rmediasyncserver.dll SHARED_LIB_DIR\rmediasyncserver.dll
-file=ABI_DIR\BUILD_DIR\mediasyncserver.exe PROGRAMS_DIR\mediasyncserver.exe
-#endif // MEDIASYNCSERVER_IBY
-
// mtp_statusservice.iby
#ifndef MTP_STATUSSERVICE_IBY
#define MTP_STATUSSERVICE_IBY
@@ -129,6 +122,7 @@
ECOM_PLUGIN(mtpmetadataservice.dll, mtpmetadataservice.rsc)
// MTP plugin registration resource file
data=EPOCROOT##epoc32\data\Z\resource\mtp\2001A9A3.rsc resource\mtp\2001A9A3.rsc
+data=EPOCROOT##epoc32\data\Z\deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms
#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_METADATASERVICE_IBY
@@ -185,18 +179,6 @@
#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_TASKDP_IBY
-// contactdp
-#ifndef MTP_CONTACTDP_IBY
-#define MTP_CONTACTDP_IBY
-#if !defined(SYMBIAN_EXCLUDE_MTP)
-// MTP Data Provider API
-ECOM_PLUGIN(mtpcontactdp.dll, mtpcontactdp.rsc)
-// MTP plugin registration resource file
-data=EPOCROOT##epoc32\data\Z\resource\mtp\102872bd.rsc resource\mtp\102872bd.rsc
-data=EPOCROOT##epoc32\data\Z\resource\apps\mtpcontactviewdefinition.rsc resource\apps\mtpcontactviewdefinition.rsc
-#endif // SYMBIAN_EXCLUDE_MTP
-#endif // MTP_CONTACTDP_IBY
-
// bluetooth
#ifndef MTP_BT_IBY
#define MTP_BT_IBY
--- a/usbengines/usbwatcher/rom/usbwatcher.iby Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/rom/usbwatcher.iby Thu Jun 24 14:30:02 2010 +0100
@@ -24,7 +24,6 @@
file=ABI_DIR\BUILD_DIR\usbwatcher.dll PROGRAMS_DIR\usbwatcher.dll
file=ABI_DIR\BUILD_DIR\usbpersonality.dll PROGRAMS_DIR\usbpersonality.dll
data=DATAZ_\private\101F9696\backup_registration.xml private\101F9696\backup_registration.xml
-data=ZPRIVATE\101fe1db\numberofacmfunctions.ini private\101fe1db\numberofacmfunctions.ini
#endif
#endif
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -26,10 +26,10 @@
#include <startupdomainpskeys.h> //for global system state
#include "cusbactivepersonalityhandler.h"
#include "cusbglobalsystemstateobserver.h"
+#include <usbuinotif.h>
// CONSTANTS
-// const TInt KSerialNumberLength = 12;
-const TInt KContainerIdLength = 16;
+const TInt KSerialNumberLength = 12;
const TUid KUsbmanSvrUid = {0x101fe1db};
@@ -44,6 +44,7 @@
: CActive( EPriorityStandard )
, iUsbMan( aUsbMan )
, iOwner( aOwner )
+ , isFailureCleanup( EFalse )
{
CActiveScheduler::Add( this );
}
@@ -122,23 +123,19 @@
TLex lex( iPhoneInfo.iSerialNumber );
TInt length = iPhoneInfo.iSerialNumber.Length();
- // currently the serial number is used for the USB container ID
- // the container ID length must be at least 16 bytes
- // also, even when serial number is not used for the container id
- // it must be at least 12, see below
- if( length < KContainerIdLength )
+ if( length < KSerialNumberLength )
{
- // In GSM, the complete IMEI can used as USB serial number. But in
- // CDMA, the ESN is too short for a valid Mass Storage serial number
- // (Mass-Storage and Bulk Only Transport specs both require minimum
- // 12 byte number), so it is extended with leading zeroes. When
- // doing this, make sure not to write anything over descriptor's
- // max length
- if( iPhoneInfo.iSerialNumber.MaxLength() < KContainerIdLength )
+ // In GSM, the complete IMEI can be used as USB serial
+ // number. But in CDMA, the ESN is too short for a valid Mass
+ // Storage serial number (Mass-Storage and Bulk Only Transport
+ // specs both require minimum 12 byte number), so it is
+ // extended with trailing zeroes. When doing this, make sure
+ // not to write anything over descriptor's max length
+ if( iPhoneInfo.iSerialNumber.MaxLength() < KSerialNumberLength )
{
- iPhoneInfo.iSerialNumber.SetLength( KContainerIdLength );
+ iPhoneInfo.iSerialNumber.SetLength( KSerialNumberLength );
}
- while( length < KContainerIdLength )
+ while( length < KSerialNumberLength )
{
iPhoneInfo.iSerialNumber.Append( '0' );
++length;
@@ -221,6 +218,7 @@
LOG( "PersonalityHandler created" );
iCurrentPersonalityHandler->PreparePersonalityStart( iStatus );
iState = EUsbPersonalityPrepareStart;
+ isFailureCleanup = EFalse;
SetActive();
}
else
@@ -242,7 +240,8 @@
iRequestStatus = &aStatus;
iState = EUsbPersonalityPrepareStop;
-
+ isFailureCleanup = EFalse;
+
// prepare current personality for stop and return
if( iCurrentPersonalityHandler )
{
@@ -284,6 +283,11 @@
}
break;
}
+ case EUsbDeviceStateUndefined:
+ {
+ iPersonalityNotifier->CancelQuery(KQueriesNotifier);
+ break;
+ }
default:
// We do not handle other state here
LOG( "DeviceStatechange ignored by ActivePersonalityhandler or EUsbDeviceStateConfigured" );
@@ -302,9 +306,54 @@
// outstanding request. We must not come here.
// ----------------------------------------------------------------------------
//
-TInt CUsbActivePersonalityHandler::RunError( TInt /*aError*/ )
+TInt CUsbActivePersonalityHandler::RunError( TInt aError )
{
LOG_FUNC
+
+ LOG2("Returned error: %d, iState: %d", aError, iState);
+
+ switch ( aError )
+ {
+ case KErrNoMemory:
+ iQueryParams().iQuery = EUSBNotEnoughRam;
+ iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier,
+ iQueryParams, iDummyBuf);
+ break;
+ case KErrDiskFull:
+ iQueryParams().iQuery = EUSBDiskFull;
+ iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier,
+ iQueryParams, iDummyBuf);
+ break;
+ default:
+ LOG( "Ignored" );
+ }
+
+ //only handle error when TryStart fails now
+ //clean up work to be done in the personality
+ if (iState == EUsbPersonalityStartUsb)
+ {
+ iState = EUsbPersonalityPrepareStop;
+ isFailureCleanup = ETrue;
+
+ // prepare current personality for stop and return
+ if( iCurrentPersonalityHandler )
+ {
+ LOG( "Call PersonalityPlugin to prepare stop" );
+ iCurrentPersonalityHandler->PreparePersonalityStop( iStatus );
+ SetActive();
+ }
+ else
+ {
+ LOG( "No current PersonalityPlugin" );
+ }
+
+ //complete StartPersonality with aError
+ User::RequestComplete( iRequestStatus, aError );
+ }
+ else
+ {
+ LOG( "Ignore error in other states" );
+ }
return KErrNone;
}
@@ -318,10 +367,8 @@
LOG_FUNC
TInt ret = iStatus.Int();
- if( KErrNone != ret )
- {
- LOG1( "ERROR: CUsbActivePersonalityHandler::RunL iStatus = %d", ret );
- }
+
+ LOG2( "CUsbActivePersonalityHandler::RunL iStatus = %d, iState = %d", ret, iState );
switch( iState )
{
@@ -340,6 +387,7 @@
break;
case EUsbPersonalityStartUsb:
+ LEAVEIFERROR( ret );
LOG( "EUsbPersonalityStartUsb" );
iState = EUsbPersonalityFinishStart;
if( iCurrentPersonalityHandler )
@@ -396,8 +444,12 @@
iPersonalityParams->PersonalityNotifier().CancelQuery(
KCableConnectedNotifierUid );
}
- User::RequestComplete( iRequestStatus, ret );
-
+ //the request should be completed with error code in RunError if failed
+ if ( !isFailureCleanup )
+ {
+ User::RequestComplete( iRequestStatus, ret );
+ }
+
iState = EUsbPersonalityIdle;
break;
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -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 ) &&
@@ -387,11 +387,13 @@
case EUsbStarting:
LOG( "Personality started" );
Notify( ret );
- iState = EUsbStarted;
if( iStopStartScenario )
{
iStopStartScenario = EFalse;
}
+ //check if StartPersonality() fails
+ LEAVEIFERROR( ret );
+ iState = EUsbStarted;
break;
case EUsbStopping:
@@ -453,10 +455,21 @@
// This method is not called cause RunL() never leaves.
// ----------------------------------------------------------------------------
//
-TInt CUsbWatcher::RunError(TInt /*aError*/)
+TInt CUsbWatcher::RunError(TInt aError)
{
LOG_FUNC
- // Left empty cause this can't happend
+
+ LOG2("Returned error: %d, iState: %d", aError, iState);
+ if ( iState == EUsbStarting )
+ {
+ RProperty::Set( KPSUidUsbWatcher,
+ KUsbWatcherSelectedPersonality,
+ KUsbWatcherSelectedPersonalityNone );
+ LOG( "personality set to none" );
+
+ iState = EUsbIdle;
+ }
+
return KErrNone;
}
@@ -1032,4 +1045,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_pcs.rss Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/usbman_pcs.rss Thu Jun 24 14:30:02 2010 +0100
@@ -51,7 +51,7 @@
manufacturer = per_manufacturer;
product = per_product;
id = KUsbPersonalityIdPCSuite;
- class_uids = "101fbf22, 101fbf24, 10281F2A";
+ class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A";
description = qtn_usb_mode_ovisuite;
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
--- a/usbengines/usbwatcher/src/usbman_pcsmtp.rss Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/usbman_pcsmtp.rss Thu Jun 24 14:30:02 2010 +0100
@@ -53,7 +53,7 @@
manufacturer = per_manufacturer;
product = per_product;
id = KUsbPersonalityIdPCSuiteMTP;
- class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A";
+ class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A";
description = qtn_usb_mode_ovisuite_mtp;
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
--- a/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Thu Jun 24 14:30:02 2010 +0100
@@ -52,7 +52,7 @@
manufacturer = per_manufacturer;
product = per_product;
id = KUsbPersonalityIdPCSuiteMTP;
- class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A";
+ class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A";
description = qtn_usb_mode_ovisuite_mtp;
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
@@ -104,7 +104,7 @@
,
PERSONALITY
{
- bDeviceClass = 0xFF;
+ bDeviceClass = 0x00;
bDeviceSubClass = 0x00;
protocol = 0x00;
numConfigurations = 0x01;
--- a/usbengines/usbwatcher/src/usbman_pcspam.rss Fri Mar 05 16:56:45 2010 -0800
+++ b/usbengines/usbwatcher/src/usbman_pcspam.rss Thu Jun 24 14:30:02 2010 +0100
@@ -51,7 +51,7 @@
manufacturer = per_manufacturer;
product = per_product;
id = KUsbPersonalityIdPCSuite;
- class_uids = "101fbf22, 101fbf24, 10281F2A";
+ class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A";
description = qtn_usb_mode_ovisuite;
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
--- a/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Thu Jun 24 14:30:02 2010 +0100
@@ -63,7 +63,9 @@
EUSBPossibleDataLossCable,
EUSBPossibleDataLossMMC,
EUSBChangeFromMassStorage,
- EUSBNoMemoryCard
+ EUSBNoMemoryCard,
+ EUSBNotEnoughRam,
+ EUSBDiskFull
};
/**
@@ -147,7 +149,8 @@
EUsbOtgUnsupportedDevice,
EUsbOtgHubUnsupported,
EUsbOtgErrorInConnection,
- EUsbOtgErrorAttachTimedOut
+ EUsbOtgErrorAttachTimedOut,
+ EUsbOtgErrorNoMemory
};
#endif // USBUINOTIF_H
--- a/usbservices_plat/usb_secondary_display_api/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/usbservices_plat/usb_secondary_display_api/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -24,4 +24,4 @@
PRJ_EXPORTS
-../inc/usbuinotifsecondarydisplay.h MW_LAYER_PLATFORM_EXPORT_PATH(secondarydisplay/usbuinotifsecondarydisplay.h)
+../inc/usbuinotifsecondarydisplay.h MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/usbuinotifsecondarydisplay.h)
--- a/usbuis/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -19,5 +19,4 @@
#include "../usbui/group/bld.inf"
#include "../usbuinotif/group/bld.inf"
#include "../imageprintuiprovider/group/bld.inf"
-#include "../imageprintui/group/bld.inf"
-#include "../rndisui/group/bld.inf"
\ No newline at end of file
+#include "../imageprintui/group/bld.inf"
\ No newline at end of file
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -310,16 +310,17 @@
iViewRef->HandleCommandL( EUSBUICmdSelect );
break;
}
+ case EEventPenDownOnItem:
+ {
+ ShowPopUpsL (CurrentItemIndex());
+ break;
+ }
case EEventPanningStarted:
case EEventPanningStopped:
case EEventFlickStarted:
case EEventFlickStopped:
- case EEventPenDownOnItem:
- case EEventItemDraggingActioned:
- {
- ShowPopUpsL (CurrentItemIndex()) ;
- break;
- }
+ case EEventItemDraggingActioned:
+ break;
default:
break;
}
Binary file usbuis/usbui/help/data/xhtml.zip has changed
--- a/usbuis/usbui/help/inc/usb.hlp.hrh Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbui/help/inc/usb.hlp.hrh Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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:
+*
+*/
+
+
+
+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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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:
+*
+*/
+
+
+
+
+#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 Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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:
+*
+*/
+
+
+#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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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:
+*
+*/
+
+
+
+// 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 Thu Jun 24 14:30:02 2010 +0100
@@ -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:
+*
+*/
+
+
+
+
+// [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 Fri Mar 05 16:56:45 2010 -0800
+++ /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 Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z13NotifierArrayv @ 1 NONAME
-
--- a/usbuis/usbuinotif/data/usbuinotif.rss Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/data/usbuinotif.rss Thu Jun 24 14:30:02 2010 +0100
@@ -244,8 +244,8 @@
RESOURCE TBUF r_usb_otg_error_unrecoverable {
buf = qtn_usb_otg_error_unrecoverable; }
-RESOURCE TBUF r_usb_otg_warning_partial_supported {
- buf = qtn_usb_otg_warning_partial_supported; }
+RESOURCE TBUF r_usb_otg_warning_partial_support {
+ buf = qtn_usb_otg_warning_partial_support; }
RESOURCE TBUF r_usb_no_memory_card {
buf = qtn_usb_mode_query_no_memory_card; }
@@ -262,4 +262,7 @@
RESOURCE TBUF r_usb_msmm_error_out_of_memory {
buf = qtn_memlo_not_enough_memory; }
+RESOURCE TBUF r_usb_error_memory_not_enough {
+ buf = qtn_usb_error_memory_not_enough; }
+
// End of File
--- a/usbuis/usbuinotif/group/bld.inf Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/group/bld.inf Thu Jun 24 14:30:02 2010 +0100
@@ -28,7 +28,6 @@
PRJ_MMPFILES
usbuinotif.mmp
-usbavkonnotif.mmp
PRJ_TESTMMPFILES
--- a/usbuis/usbuinotif/group/usbavkonnotif.mmp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2005-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: Project definition file for project USBUINotif.
- *
- */
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh> //this is needed for RESOURCE_FILES_DIR
-
-TARGET usbavkonnotif.dll
-TARGETTYPE dll
-UID 0x101fdfae 0x102068DD
-TARGETPATH SHARED_LIB_DIR
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-
-SOURCE usbuincableconnectednotifier.cpp usbavkonmain.cpp
-SOURCE usbnotifier.cpp
-
-USERINCLUDE ../inc
-
-SYSTEMINCLUDE ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/) //for internal and private API headers
-
-MW_LAYER_SYSTEMINCLUDE
-LIBRARY ECOM.LIB // Symbian E-Com Plugin definitions and types
-LIBRARY euser.lib cone.lib // Symbian OS frameworklibraries
-LIBRARY avkon.lib // UI library
-LIBRARY bafl.lib // Basic Application Framework
-LIBRARY commonengine.lib // Series 60 common components
-LIBRARY eikcoctl.lib eiksrv.lib // Eikon libraries
-LIBRARY eikdlg.lib // Eikon dialogs
-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
-LIBRARY aknskinsrv.lib
-LIBRARY aknicon.lib
-LIBRARY egul.lib
-LIBRARY usbman.lib // for personality IDs and descriptions
-LIBRARY aknnotifierwrapper.lib // Avkon's notifier wrapper
-LIBRARY apparc.lib
-LIBRARY akncapserverclient.lib // for suppressing the application key
-
-DEBUGLIBRARY flogger.lib // File logging services
--- a/usbuis/usbuinotif/group/usbuinotif.mmp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/group/usbuinotif.mmp Thu Jun 24 14:30:02 2010 +0100
@@ -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"
@@ -29,14 +29,11 @@
SOURCEPATH ../src
SOURCE usbuinmain.cpp
SOURCE usbnotifier.cpp
+SOURCE usbuincableconnectednotifier.cpp
SOURCE usbuinqueriesnotifiermdrv.cpp
SOURCE usbuinotifotgwarning.cpp
SOURCE usbuinotifotgerror.cpp
SOURCE usbuinotifmsmmerror.cpp
-SOURCE usbuinotifdialerwatcher.cpp
-
-
-
// ECom resource file
START RESOURCE ../data/102068DC.rss
TARGET usbuinotif.rsc
@@ -53,6 +50,7 @@
SYSTEMINCLUDE ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/) //for internal and private API headers
SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore
MW_LAYER_SYSTEMINCLUDE
@@ -67,7 +65,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
@@ -78,8 +75,7 @@
LIBRARY aknnotifierwrapper.lib // Avkon's notifier wrapper
LIBRARY apparc.lib
LIBRARY akncapserverclient.lib // for suppressing the application key
-LIBRARY viewcli.lib
-LIBRARY featmgr.lib
+LIBRARY hbcore.lib
DEBUGLIBRARY flogger.lib // File logging services
--- a/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -20,8 +20,8 @@
// INCLUDES
-#include <aknlistquerydialog.h>
-#include <AknQueryDialog.h>
+#include <hbdevicedialogsymbian.h>
+#include <hbsymbianvariant.h>
#include "usbnotifier.h" // Base class
// CLASS DECLARATION
@@ -31,8 +31,8 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
- public MEikCommandObserver
+NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
+ public MHbDeviceDialogObserver
{
public:
// Constructors and destructor
@@ -84,10 +84,22 @@
void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
+
+private:
+ // functions from MHbDeviceDialogObserver
+
/**
- * Handles the command on USB connected note
- */
- void ProcessCommandL(TInt aCommandId);
+ * lunches the QT usb ui setting
+ * @param aData is a CHbSymbianVariantMap daya which contains the keys
+ */
+ void DataReceived(CHbSymbianVariantMap& aData);
+ /*
+ * Virtual function from MHbDeviceDialogObserver
+ * Not implemented
+ */
+ void DeviceDialogClosed(TInt aCompletionCode);
+
+
private:
//New functions
@@ -98,10 +110,12 @@
void GetCurrentIdL(TInt& aCurrentPersonality);
/**
* Get the mode name and header for current personality
+ * The parameters are pushed to the cleanup stack in order
+ * aDescription, aHeader.
* @param aDescription The returned current personality string.
* @param aHeader The header string for message query.
*/
- void GetPersonalityStringL(HBufC*& aHeader,HBufC*& aDescription );
+ void GetPersonalityStringLC(HBufC*& aHeader,HBufC*& aDescription );
/**
* Runs the connected discreet note
@@ -110,26 +124,28 @@
/**
- * creates the USB UI setting view
- * @param aProcessName The process name (USBClassChangeUI.exe)
+ * launches the (USB) application
+ * @param aProcessName The process name (*.exe)
* @param TUidType
*/
- void CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const;
+ void LaunchApplication(const TDesC & aProcessName,const TUidType & aUidType) const;
+
+ /**
+ * Adds a parameter to the dialog parameters.
+ */
+ void AddParameterL(
+ CHbSymbianVariantMap* aParameters,
+ const TDesC& aKey,
+ const TAny* aData,
+ CHbSymbianVariant::TType aDataType);
+
private:
/**
* C++ default constructor.
*/
CUSBUICableConnectedNotifier();
- /**
- * Waiter for canceling notifier. Canceling is not posible when note is visible
- */
- CActiveSchedulerWait iNoteWaiter;
-
- /**
- * Note visible
- */
- TBool iNoteVisible;
+ CHbDeviceDialogSymbian* iDialog;
};
#endif // USBUINCABLECONNECTEDNOTIFIER_H
--- a/usbuis/usbuinotif/inc/usbuinotifdialerwatcher.h Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
-* Copyright (c) 2007, 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares USB dialer activation watcher class
- *
-*/
-
-#ifndef C_USBUINOTIFDIALERWATCHER_H
-#define C_USBUINOTIFDIALERWATCHER_H
-
-#include <e32base.h>
-#include <coecntrl.h>
-#include <viewclipartner.h>
-#include <viewcli.h>
-
-
-/**
- * Dialer activation callback
- *
- * This class specifies the functions when dialer is activated
- * or note can be reactivated
- *
- */
-class MDialerNotifier
- {
-public:
- /**
- * The function to be when Dialaer is activated
- *
- */
- virtual void DialerActivated() = 0;
-
- /**
- * The function to be when Dialaer is deactivated
- * and note can be shown again
- *
- */
- virtual void ReActivateDialog() = 0;
- };
-
-/**
- *
- * This class will check if application key is pressed when error note is active.
- * When application key is pressed dialer view is activated and error notifier is
- * informed so it can dismis dialog. When dialer is deactivated error notifier is
- * notified that dialog can be again shown.
- *
- */
-NONSHARABLE_CLASS( CUsbuinotifDialerWatcher): public CCoeControl,
- public MVwsSessionWrapperObserver
-
- {
-public:
- /**
- * Two-phased constructor.
- * @param aDialerKeyNotifier Callback interface for dialer activation/deactivation
- * @return dialer watcher
- */
-
- static CUsbuinotifDialerWatcher* NewL( MDialerNotifier* aDialerNotifier );
-
- /**
- * Two-phased constructor.
- * @param aDialerKeyNotifier Callback interface for dialer activation/deactivation
- * @return dialer watcher
- */
- static CUsbuinotifDialerWatcher* NewLC( MDialerNotifier* aDialerNotifier );
-
- /**
- * Destructor
- */
- virtual ~CUsbuinotifDialerWatcher();
-
-private:
-
- /**
- * From CCoeControl
- * @param aKeyEvent Key Event
- * @param aType Type of event
- */
- TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
-
-private:
-
- /**
- * From MVwsSessionWrapperObserver
- * @param aEvent View event
- */
- void HandleViewEventL(const TVwsViewEvent &aEvent);
-
-
-private:
-
- /**
- * Constructor
- * @param aDialerKeyNotifier Callback interface for dialer activation/deactivation
- */
- CUsbuinotifDialerWatcher( MDialerNotifier* aDialerKeyNotifier );
-
- /**
- * Two-phased constructor.
- */
- void ConstructL();
-
-private:
- // Member variables
-
- /**
- * The observer for this objects events
- * Not own.
- */
- MDialerNotifier* iNotify;
-
- /**
- * The observer for this objects events
- * Own.
- */
- CVwsSessionWrapper* iwsSession;
-
- /**
- * Is notifier allready notified.
- */
- TBool iNotified;
- };
-#endif // C_USBUINOTIFDIALERWATCHER_H
--- a/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Thu Jun 24 14:30:02 2010 +0100
@@ -23,8 +23,6 @@
#include "usbnotifier.h" // Base class
#include <AknQueryDialog.h> // AVKON component
-#include "usbuinotifdialerwatcher.h"
-
#define KUsbUiNotifOtgGeneralQueryGranularity 3
// CLASS DECLARATION
@@ -34,7 +32,7 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase, public MDialerNotifier
+NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase
{
public:
@@ -97,23 +95,6 @@
*/
void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
-
-private:
-
- /**
- * From MDialerNotifier
- * The function to be when Dialaer is activated
- *
- */
- void DialerActivated();
-
- /**
- * From MDialerNotifier
- * The function to be when Dialaer is deactivated
- * and note can be shown again
- *
- */
- void ReActivateDialog();
private:
@@ -140,14 +121,5 @@
CAknQueryDialog* iQuery;
RArray<TInt> iStringIds;
TInt iErrorId;
- /**
- * Dialer watcher
- * Own.
- */
- CUsbuinotifDialerWatcher* iDialerWatcher;
- /**
- * Dialog is dismissed.
- */
- TBool iDismissed;
};
#endif // USBUINOTIFMSMMERROR_H
--- a/usbuis/usbuinotif/inc/usbuinotifotgerror.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/inc/usbuinotifotgerror.h Thu Jun 24 14:30:02 2010 +0100
@@ -23,8 +23,6 @@
#include "usbnotifier.h" // Base class
#include <AknQueryDialog.h> // AVKON component
-#include "usbuinotifdialerwatcher.h"
-
#define KUsbUiNotifOtgGeneralQueryGranularity 3
// CLASS DECLARATION
@@ -34,7 +32,7 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase, public MDialerNotifier
+NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase
{
public:
// Constructors and destructor
@@ -87,23 +85,6 @@
*/
void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
-
-private:
-
- /**
- * From MDialerNotifier
- * The function to be when Dialaer is activated
- *
- */
- void DialerActivated();
-
- /**
- * From MDialerNotifier
- * The function to be when Dialaer is deactivated
- * and note can be shown again
- *
- */
- void ReActivateDialog();
private:
@@ -130,14 +111,5 @@
CAknQueryDialog* iQuery;
RArray<TInt> iStringIds;
TInt iErrorId;
- /**
- * Dialer watcher
- * Own.
- */
- CUsbuinotifDialerWatcher* iDialerWatcher;
- /**
- * Dialog is dismissed.
- */
- TBool iDismissed;
};
#endif // USBUINOTIFOTGERROR_H
--- a/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Thu Jun 24 14:30:02 2010 +0100
@@ -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/inc/usbuinqueriesnotifiermdrv.h Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Thu Jun 24 14:30:02 2010 +0100
@@ -106,7 +106,7 @@
* @return KErrNone - accepted, KErrCancel - Cancel or End call key
*/
TInt QueryUserResponseL(const TDesC& aStringHolder, TInt aCoverDialogId,
- TBool aIsCancelKey);
+ TBool aIsCancelKey, TBool aIsErrorQuery);
/**
* Get attributes for the query dialog
@@ -117,7 +117,7 @@
* @param aIsCancelKey Returned info about showing the Cancel key.
* @return The string holder for the query.
*/
- HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey);
+ HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey, TBool& aIsErrorQuery);
private:
// Data
--- a/usbuis/usbuinotif/loc/usbuinotif.loc Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/loc/usbuinotif.loc Thu Jun 24 14:30:02 2010 +0100
@@ -139,6 +139,11 @@
//
#define qtn_usb_otg_general_mass_storage_error "General Mass storage error"
+//d: Memory not enough or full error
+//l: popup_note_window
+//r: 5.2
+#define qtn_usb_error_memory_not_enough "Memory full. Close some applications and try to connect USB cable again"
+
// End of USB_OTG
// End of File
--- a/usbuis/usbuinotif/rom/usbuinotif.iby Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/rom/usbuinotif.iby Thu Jun 24 14:30:02 2010 +0100
@@ -22,7 +22,6 @@
#ifdef __USB_MULTIPERSONALITY
ECOM_PLUGIN(usbuinotif.dll, 102068DC.rsc)
-file=ABI_DIR\BUILD_DIR\usbavkonnotif.dll SHARED_LIB_DIR\usbavkonnotif.dll
#endif //__USB_MULTIPERSONALITY
#endif //__USBUINOTIF_IBY__
\ No newline at end of file
--- a/usbuis/usbuinotif/src/usbavkonmain.cpp Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2005-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: Methods for USB UI notifiers.
- *
- */
-
-// INCLUDE FILES
-#include <eiknotapi.h>
-#include <eikenv.h>
-
-#include "usbuincableconnectednotifier.h"
-#include "usbuinqueriesnotifier.h"
-#include "usbuinotifdebug.h"
-
-// CONSTANTS
-const TInt KUSBUINotifierArrayIncrement = 1;
-
-
-// ================= EXPORTED FUNCTIONS =======================================
-
-// ----------------------------------------------------------------------------
-//
-// Instantiate notifiers
-//
-// ----------------------------------------------------------------------------
-
-LOCAL_C void CreateUSBUINotifiersL(
- CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
- {
- FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL"));
-
- CUSBUICableConnectedNotifier* cableConnectedNotifier =
- CUSBUICableConnectedNotifier::NewL();
- CleanupStack::PushL( cableConnectedNotifier );
- aNotifiers->AppendL( cableConnectedNotifier );
- CleanupStack::Pop( cableConnectedNotifier );
-
-
- FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL completed"));
- }
-
-// ----------------------------------------------------------------------------
-//
-// Lib main entry point: Creates a notifiers array.
-//
-// ----------------------------------------------------------------------------
-
-EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
- {
- FLOG(_L("[USBUINOTIF]\t NotifierArray"));
-
- CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL;
-
- TRAPD( err, notifiers =
- new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(
- KUSBUINotifierArrayIncrement ));
-
- if ( err == KErrNone )
- {
- if( notifiers )
- {
- TRAPD( errCreate, CreateUSBUINotifiersL( notifiers ));
- if( errCreate )
- {
- TInt count = notifiers->Count();
- while(count--)
- {
- (*notifiers)[count]->Release();
- }
- delete notifiers;
- notifiers = NULL;
- }
-
- FLOG(_L("[USBUINOTIF]\t NotifierArray completed"));
- }
- }
- else
- {
- FLOG(_L("[USBUINOTIF]\t NotifierArray Failed!!!"));
- }
-
- return notifiers;
- }
-
-// End of File
--- a/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -21,32 +21,20 @@
#include <aknPopup.h>
#include <StringLoader.h> // Localisation stringloader
#include <utf.h> // Unicode character conversion utilities
-#include <AknsUtils.h>
-#include <usb.h>
+#include <usbman.h>
#include <usbuinotif.rsg> // Own resources
#include <centralrepository.h>
#include <e32property.h>
-//for loading icons USB fork and empty
-#include <AknIconArray.h>
-#include <avkon.mbg>
-#include <AknsConstants.h>
-#include <aknmessagequerydialog.h>
-//for cover display support
-#include <AknMediatorFacade.h>
-#include <SecondaryDisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
-#include <akndiscreetpopup.h>
#include <e32uid.h> // KExecutableImageUid
-#include <usbui.mbg>
#include "usbuincableconnectednotifier.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
#include "UsbWatcherInternalCRKeys.h"
-#include "usbpersonalityids.h"
#include "usbuinotif.hrh"
// Literals
-_LIT(KUSBExe, "usbclasschangeui.exe");
-const TInt KUSBUIUid = 0x102068E2;
+_LIT(KUSBExe, "usbapplication.exe");
+const TInt KUSBUIUid = 0x2002BCA3;
_LIT(KFileDrive,"z:");
_LIT(KUSBUIconFileName, "usbui.mif");
@@ -75,8 +63,7 @@
// might leave.
// ----------------------------------------------------------------------------
//
-CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier():
- iNoteVisible(EFalse)
+CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier()
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor"));
}
@@ -92,6 +79,8 @@
//this virtual function call is to the local CUSBUICableConnectedNotifier::
//Cancel, not to any possibly derived class implementation.
Cancel();
+ delete iDialog;
+
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor completed"));
}
@@ -146,7 +135,7 @@
void CUSBUICableConnectedNotifier::RunL()
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL"));
- iNoteVisible = ETrue;
+
DisableKeylock();
SuppressAppSwitching(ETrue);
RunQueryL();
@@ -164,12 +153,8 @@
void CUSBUICableConnectedNotifier::Cancel()
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() "));
- // Not allowed to cancel this one before note is closed.
- if ( iNoteVisible )
- {
- iNoteWaiter.Start();
- }
-
+
+ iDialog->Cancel(); // cancel the dialog, if it is active
CompleteMessage(KErrCancel);
CUSBUINotifierBase::Cancel();
@@ -181,7 +166,7 @@
// Get the strings for ask on connection message query
// -----------------------------------------------------------------------------------------------------------
//
-void CUSBUICableConnectedNotifier::GetPersonalityStringL(
+void CUSBUICableConnectedNotifier::GetPersonalityStringLC(
HBufC*& aHeader,HBufC*& aDescription )
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL"));
@@ -193,9 +178,9 @@
User::LeaveIfError(usbman.GetDescription(CurrentPersonalityID,
aDescription));
CleanupStack::PopAndDestroy(&usbman);
-
+ CleanupStack::PushL(aDescription);
aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER);
-
+ CleanupStack::PushL(aHeader);
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed"));
}
@@ -207,24 +192,45 @@
void CUSBUICableConnectedNotifier::RunQueryL()
{
FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL()"));
-
- HBufC* header = NULL;
- HBufC* description =NULL;
- GetPersonalityStringL(header, description);
-
- CleanupStack::PushL(header);
- CleanupStack::PushL(description);
-
- TFileName usbUiIconFilename( KFileDrive );
- usbUiIconFilename += KDC_APP_BITMAP_DIR;
- usbUiIconFilename += KUSBUIconFileName;
- iNoteVisible = ETrue;
- CAknDiscreetPopup::ShowGlobalPopupL(*header,*description, KAknsIIDQgnPropUsb, AknIconUtils::AvkonIconFileName(),
- EMbmAvkonQgn_prop_usb, EMbmAvkonQgn_prop_usb_mask,KAknDiscreetPopupDurationLong, EUSBUICmdDiscreetTapped,( MEikCommandObserver* ) this);
+
+ _LIT(KNotificationType,"com.nokia.hb.devicenotificationdialog/1.0");
+ _LIT(KTouchActivation, "touchActivation");
+ _LIT(KIconName, "iconName");
+ _LIT(KTitle, "title");
+ _LIT(KText, "text");
+
+ HBufC* header = NULL;
+ HBufC* description =NULL;
+ GetPersonalityStringLC(header, description);
- CleanupStack::PopAndDestroy(description);
+ TFileName usbUiIconFilename( KFileDrive );
+ usbUiIconFilename += KDC_APP_BITMAP_DIR;
+ usbUiIconFilename += KUSBUIconFileName;
+ if( iDialog )
+ {
+ delete iDialog;
+ iDialog = NULL;
+ }
+ iDialog = CHbDeviceDialogSymbian::NewL();
+ CHbSymbianVariantMap *parameters =CHbSymbianVariantMap::NewL();
+ CleanupStack::PushL(parameters);
+
+ AddParameterL(parameters, KTitle, header, CHbSymbianVariant::EDes);
+ AddParameterL(parameters, KText, description, CHbSymbianVariant::EDes);
+ AddParameterL(parameters, KIconName, &usbUiIconFilename, CHbSymbianVariant::EDes);
+ TBool activation=ETrue;
+ AddParameterL(parameters, KTouchActivation, &activation, CHbSymbianVariant::EBool);
+
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() show") );
+ TBool error = iDialog->Show(KNotificationType ,*parameters, this);
+ FTRACE( FPrint(
+ _L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() error = %d" ),
+ error ) );
+
+ CleanupStack::PopAndDestroy(parameters);
CleanupStack::PopAndDestroy(header);
-
+ CleanupStack::PopAndDestroy(description);
+
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
}
// ----------------------------------------------------------------------------
@@ -239,51 +245,100 @@
CRepository* repository = CRepository::NewL(KCRUidUsbWatcher);
CleanupStack::PushL(repository);
// Get the current USB mode
- repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
+ TInt ret = repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
+ FTRACE( FPrint(
+ _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::GetCurrentIdL() ret = %d" ),
+ ret ) );
CleanupStack::PopAndDestroy(repository);
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL completed"));
}
// ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::ProcessCommandL()
-// when discreet pop up is tapped the command will be handled here
+// CUSBUICableConnectedNotifier::DataReceived
+// launches the QT usb ui setting
// ----------------------------------------------------------------------------
//
-void CUSBUICableConnectedNotifier::ProcessCommandL(TInt aCommandId)
+void CUSBUICableConnectedNotifier::DataReceived(CHbSymbianVariantMap& aData)
{
- switch ( aCommandId )
- {
- case EUSBUICmdDiscreetTapped:
- {
- TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUSBUIUid));
- CreateChosenViewL(KUSBExe(),uidtype);
- }
- case EAknDiscreetPopupCmdClose:
- if ( iNoteWaiter.IsStarted() )
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::DataReceived"));
+ _LIT(KResult, "result");
+ _LIT(KActivated, "activated");
+ TInt result = 0;
+ MDesCArray& keys = aData.Keys();
+ HBufC* key = NULL;
+ for(TInt i = 0; i < keys.MdcaCount(); i++)
+ {
+ result = keys.MdcaPoint(i).Compare(KResult);
+ if (result == 0)
+ {
+ key = HBufC::New(KResult().Length());
+ if (key)
{
- iNoteWaiter.AsyncStop();
+ *key = KResult;
+ const CHbSymbianVariant* variant = aData.Get(*key);
+ delete key;
+ HBufC* value = static_cast<HBufC*>(variant->Data());
+ result = value->Des().Compare(KActivated);
+ if (result == 0)
+ {
+ TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
+ TUid::Uid(KUSBUIUid));
+ LaunchApplication(KUSBExe(), uidtype);
+ }
+ break;
}
- iNoteVisible = EFalse;
- CompleteMessage( KErrCancel );
- break;
- default:
-
- break;
- }
+ }
+ }
}
+
+// ----------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::DeviceDialogClosed
+// ----------------------------------------------------------------------------
+//
+ void CUSBUICableConnectedNotifier::DeviceDialogClosed(TInt aCompletionCode)
+ {
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::DeviceDialogClosed()"));
+ CompleteMessage(aCompletionCode);
+ }
+
// ---------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::CreateChosenViewL()
-// creates the USB UI setting view
+// CUSBUICableConnectedNotifier::LaunchApplication()
+// launches the application
// ---------------------------------------------------------------------------
//
- void CUSBUICableConnectedNotifier::CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const
+void CUSBUICableConnectedNotifier::LaunchApplication(const TDesC & aProcessName,
+ const TUidType & aUidType) const
{
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
- RProcess usbUiProcess;
- User::LeaveIfError(usbUiProcess.Create(aProcessName, KNullDesC, aUidType));
- usbUiProcess.Resume();
- usbUiProcess.Close();
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication()"));
+ RProcess usbUiProcess;
+ TInt result = usbUiProcess.Create(aProcessName, KNullDesC, aUidType);
+ FTRACE( FPrint(
+ _L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() result = %d" ),
+ result ) );
+ usbUiProcess.Resume();
+ usbUiProcess.Close();
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() completed"));
+ }
+// ---------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::AddParameter()
+// Adds a string parameter to the dialog parameters.
+// ---------------------------------------------------------------------------
+//
+void CUSBUICableConnectedNotifier::AddParameterL(
+ CHbSymbianVariantMap* aParameters,
+ const TDesC& aKey,
+ const TAny* aData,
+ CHbSymbianVariant::TType aDataType)
+ {
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter()") );
+ FTRACE( FPrint(
+ _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::RunQueryL() aKey = %S" ),
+ &aKey ) );
+ CHbSymbianVariant* variant = CHbSymbianVariant::NewL(aData, aDataType);
+ //aParameters takes variant ownership
+ User::LeaveIfError(aParameters->Add(aKey, variant));
+ FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter() completed") );
}
+
// End of File
--- a/usbuis/usbuinotif/src/usbuinmain.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuinmain.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -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"
@@ -20,21 +20,17 @@
#include <ecom/implementationproxy.h>
#include <eiknotapi.h>
#include <eikenv.h>
-#include <AknNotifierWrapper.h>
-#include <usbuinotif.h>
#include "usbuincableconnectednotifier.h"
#include "usbuinqueriesnotifier.h"
-
-
#include "usbuinotifdebug.h"
#include "usbuinotifotgwarning.h"
#include "usbuinotifotgerror.h"
#include "usbuinotifmsmmerror.h"
// CONSTANTS
-const TInt KUSBUINotifierArrayIncrement = 4;
-_LIT( KUSBUINotifdll, "usbavkonnotif.dll" );
+const TInt KUSBUINotifierArrayIncrement = 5;
+
// ================= EXPORTED FUNCTIONS =======================================
// ----------------------------------------------------------------------------
//
@@ -46,20 +42,12 @@
{
FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL"));
- /* The CableconnectionNotifier is created on the Avkon Wrapper
- * because it contains the discreet popups which are only possible
- * to be launched in a UI framework
- */
- CAknCommonNotifierWrapper* master =
- CAknCommonNotifierWrapper::NewL(KCableConnectedNotifierUid,
- KCableConnectedNotifierUid,
- MEikSrvNotifierBase2::ENotifierPriorityVHigh,
- KUSBUINotifdll,
- 1); // no synchronous reply used.
- CleanupStack::PushL(master);
-
- aNotifiers->AppendL(master );
- CleanupStack::Pop( master );
+ CUSBUICableConnectedNotifier* cableConnectedNotifier =
+ CUSBUICableConnectedNotifier::NewL();
+ CleanupStack::PushL( cableConnectedNotifier );
+ aNotifiers->AppendL( cableConnectedNotifier );
+ CleanupStack::Pop( cableConnectedNotifier );
+
CUSBUIQueriesNotifier* queriesNotifier = CUSBUIQueriesNotifier::NewL();
CleanupStack::PushL( queriesNotifier );
aNotifiers->AppendL( queriesNotifier );
@@ -128,11 +116,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 Fri Mar 05 16:56:45 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
-* Copyright (c) 2007, 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: USB dialer activation watcher class
- *
-*/
-
-
-#include <w32std.h>
-#include <eikenv.h>
-#include <coeaui.h>
-#include <aiscutdefs.h>
-#include <vwsdef.H>
-
-
-#include "usbuinotifdialerwatcher.h"
-#include "debug.h"
-#include "usbuinotifdebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CUsbuinotifDialerWatcher* CUsbuinotifDialerWatcher::NewL( MDialerNotifier* aDialerNotifier )
- {
- FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::NewL"))
- CUsbuinotifDialerWatcher* self = CUsbuinotifDialerWatcher::NewLC( aDialerNotifier);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CUsbuinotifDialerWatcher* CUsbuinotifDialerWatcher::NewLC( MDialerNotifier* aDialerNotifier )
- {
- FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::NewLC"))
- CUsbuinotifDialerWatcher* self = new ( ELeave ) CUsbuinotifDialerWatcher( aDialerNotifier );
- CleanupStack::PushL( self );
- self->ConstructL( );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CUsbuinotifDialerWatcher()
-// ---------------------------------------------------------------------------
-//
-CUsbuinotifDialerWatcher::CUsbuinotifDialerWatcher( MDialerNotifier* aDialerNotifier ) :
- iNotify( aDialerNotifier )
- {
- FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher::CUsbuinotifDialerWatcher"))
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CUsbuinotifDialerWatcher::~CUsbuinotifDialerWatcher()
- {
- FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher Destructor"))
- CCoeAppUi* appui=CEikonEnv::Static()->AppUi();
- appui->RemoveFromStack(this);
- delete iwsSession;
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CUsbuinotifDialerWatcher::ConstructL()
- {
- FLOG(_L("[USBUINOTIF]\t CUsbuinotifDialerWatcher ConstructL"));
- CCoeAppUi* appui=CEikonEnv::Static()->AppUi();
- appui->AddToStackL(this,ECoeStackPriorityCba);
- }
-
-// ---------------------------------------------------------------------------
-// HandleViewEventL()
-// ---------------------------------------------------------------------------
-//
-void CUsbuinotifDialerWatcher::HandleViewEventL(const TVwsViewEvent& /*aEvent*/)
- {
- FLOG((_L("[USBUINOTIF]\t HandleViewEventL ")));
-
- if ( !iNotified )
- {
- iNotify->ReActivateDialog();
- iNotified=ETrue;
- }
- FLOG(_L("[USBUINOTIF]\t HandleViewEventL Done"));
- }
-
-// ---------------------------------------------------------------------------
-// OfferKeyEventL
-// ---------------------------------------------------------------------------
-//
-TKeyResponse CUsbuinotifDialerWatcher::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
- {
- if (aKeyEvent.iScanCode == EStdKeyApplication0)
- {
- if ( !iwsSession )
- {
- iwsSession = CVwsSessionWrapper::NewL(*this);
- }
- iNotified=EFalse;
- const TVwsViewId viewId(KScutDiallerUid, KScutDiallerViewId );
- TUid msgId = KScutDiallerViewCommand;
- iwsSession->CreateActivateViewEvent( viewId, msgId, KNullDesC8 );
- CCoeAppUi* appui=CEikonEnv::Static()->AppUi();
- iNotify->DialerActivated();
- iwsSession->NotifyNextDeactivation(viewId);
- }
-
- return EKeyWasNotConsumed;
- }
-
--- a/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -24,7 +24,6 @@
#include <AknQueryDialog.h>
#include <aknnotewrappers.h>
#include <usb/hostms/srverr.h>
-#include <featmgr.h>
#include <usbuinotif.h> // pck
#include <usbuinotif.rsg> // Own resources
@@ -68,8 +67,6 @@
//this virtual function call is to local CUsbUiNotifMSMMError::Cancel,
//not to any possibly derived class implementation.
Cancel();
- delete iDialerWatcher;
- delete iQuery;
}
void CUsbUiNotifMSMMError::ConstructL()
@@ -144,28 +141,16 @@
{
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL"));
TInt returnValue = KErrNone;
- FeatureManager::InitializeLibL();
- if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) )
- {
- if (!iDialerWatcher)
- {
- iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this);
- }
- }
- iDismissed=EFalse;
+
DisableKeylock();
SuppressAppSwitching( ETrue );
//Excute dialog and check return value
returnValue = QueryUserResponseL();
- if (!iDismissed)
- {
- SuppressAppSwitching( EFalse );
- RestoreKeylock();
- delete iDialerWatcher;
- iDialerWatcher = NULL;
- CompleteMessage( returnValue );
- }
+
+ SuppressAppSwitching( EFalse );
+ RestoreKeylock();
+ CompleteMessage( returnValue );
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL() completed"));
}
@@ -178,56 +163,17 @@
void CUsbUiNotifMSMMError::Cancel()
{
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel"));
- // If dialog is not dismissed this is normal cancel and if query
- // doesn't exsist notifier is canceled during dismission
- if (!iDismissed || !iQuery )
- {
- delete iDialerWatcher;
- iDialerWatcher = NULL;
- CompleteMessage( KErrCancel );
- }
if (iQuery)
{
delete iQuery;
iQuery = NULL;
}
-
+ CompleteMessage( KErrCancel );
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed"));
}
// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgError::DialerActivated
-// Release all own resources (member variables)
-// ----------------------------------------------------------------------------
-//
-void CUsbUiNotifMSMMError::DialerActivated()
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()"));
- if ( iQuery )
- {
- iDismissed=ETrue;
- Cancel();
- }
- }
-
-// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgError::ReActivateDialog
-// Release all own resources (member variables)
-// ----------------------------------------------------------------------------
-//
-void CUsbUiNotifMSMMError::ReActivateDialog()
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()"));
- if ( !IsActive())
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* stat = &iStatus;
- User::RequestComplete( stat, KErrNone );
- }
- }
-// ----------------------------------------------------------------------------
// CUsbUiNotifMSMMError::QueryUserResponseL
// Show query dialog.
// ----------------------------------------------------------------------------
@@ -237,17 +183,9 @@
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::QueryUserResponseL"));
TInt returnValue = KErrNone;
TInt resourceId = R_USB_QUERY_OTG_ERROR;
- if (iDismissed)
- {
- iQuery = CAknQueryDialog::NewL();
- }
- else
- {
- iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
- }
-
-
- iDismissed=EFalse;
+
+ iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
+
if (iCoverDisplaySupported)
{
iQuery->PublishDialogL( iErrorId, KUsbUiNotifMsmmError );
--- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -23,7 +23,6 @@
#include <StringLoader.h> // Localisation stringloader
#include <AknQueryDialog.h>
#include <aknnotewrappers.h>
-#include <featmgr.h>
#include <usbuinotif.h> // pck
#include <usbuinotif.rsg> // Own resources
@@ -67,8 +66,6 @@
//this virtual function call is to local CUsbUiNotifOtgError::Cancel,
//not to any possibly derived class implementation.
Cancel();
- delete iDialerWatcher;
- delete iQuery;
}
void CUsbUiNotifOtgError::ConstructL()
@@ -80,6 +77,7 @@
iStringIds.AppendL( R_USB_OTG_ERROR_HUB_UNSUPPORTED);
iStringIds.AppendL( R_USB_OTG_ERROR_UNRECOVERABLE);
iStringIds.AppendL( R_USB_OTG_ERROR_ATTACH_TIMEDOUT);
+ iStringIds.AppendL( R_USB_ERROR_MEMORY_NOT_ENOUGH);
}
// ----------------------------------------------------------------------------
@@ -108,18 +106,24 @@
{
User::Leave( KErrInUse );
}
-
- iMessage = aMessage;
- iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
-
+
// Get parameters
//
- iErrorId = 0;
+
TPckgC<TInt> pckg( iErrorId );
pckg.Set( aBuffer );
iErrorId = pckg();
-
+
+ FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), iErrorId ));
+ if ( iErrorId < 0 || iErrorId >= iStringIds.Count() )
+ {
+ User::Leave( KErrArgument);
+ }
+
+ iMessage = aMessage;
+ iNeedToCompleteMessage = ETrue;
+ iReplySlot = aReplySlot;
+
SetActive();
iStatus = KRequestPending;
TRequestStatus* stat = &iStatus;
@@ -136,29 +140,16 @@
{
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL"));
TInt returnValue = KErrNone;
- FeatureManager::InitializeLibL();
- if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) )
- {
- if (!iDialerWatcher)
- {
- iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this);
- }
- }
- FeatureManager::UnInitializeLib();
- iDismissed=EFalse;
+
DisableKeylock();
SuppressAppSwitching( ETrue );
//Excute dialog and check return value
returnValue = QueryUserResponseL();
- if (!iDismissed)
- {
- SuppressAppSwitching( EFalse );
- RestoreKeylock();
- delete iDialerWatcher;
- iDialerWatcher = NULL;
- CompleteMessage( returnValue );
- }
+
+ SuppressAppSwitching( EFalse );
+ RestoreKeylock();
+ CompleteMessage( returnValue );
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed"));
}
@@ -170,54 +161,15 @@
//
void CUsbUiNotifOtgError::Cancel()
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel"));
-
- // If dialog is not dismissed this is normal cancel and if query
- // doesn't exsist notifier is canceled during dismission
- if (!iDismissed || !iQuery )
- {
- delete iDialerWatcher;
- iDialerWatcher = NULL;
- CompleteMessage( KErrCancel );
- }
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel"));
if (iQuery)
{
delete iQuery;
iQuery = NULL;
}
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
- }
+ CompleteMessage( KErrCancel );
-// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgError::DialerActivated
-// Release all own resources (member variables)
-// ----------------------------------------------------------------------------
-//
-void CUsbUiNotifOtgError::DialerActivated()
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()"));
- if ( iQuery )
- {
- iDismissed=ETrue;
- Cancel();
- }
- }
-
-// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgError::ReActivateDialog
-// Release all own resources (member variables)
-// ----------------------------------------------------------------------------
-//
-void CUsbUiNotifOtgError::ReActivateDialog()
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()"));
- if ( !IsActive())
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* stat = &iStatus;
- User::RequestComplete( stat, KErrNone );
- }
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
}
// ----------------------------------------------------------------------------
@@ -230,17 +182,9 @@
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL"));
TInt returnValue = KErrNone;
TInt resourceId = R_USB_QUERY_OTG_ERROR;
- if (iDismissed)
- {
- iQuery = CAknQueryDialog::NewL();
- }
- else
- {
- iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
- }
-
-
- iDismissed=EFalse;
+
+ iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
+
if (iCoverDisplaySupported)
{
iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError );
--- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -73,7 +73,7 @@
void CUsbUiNotifOtgWarning::ConstructL()
{
CUSBUINotifierBase::ConstructL();
- iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORTED);
+ iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORT);
}
// ----------------------------------------------------------------------------
@@ -123,18 +123,24 @@
if (iNote || iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave( KErrInUse );
- }
-
- iMessage = aMessage;
- iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
+ }
// Get parameters
//
TPckgC<TInt> pckg( iNoteId );
pckg.Set( aBuffer );
iNoteId = pckg();
+
+ FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL iNoteId: %d"), iNoteId ));
+ if ( iNoteId < 0 || iNoteId >= iStringIds.Count() )
+ {
+ User::Leave( KErrArgument);
+ }
+ iMessage = aMessage;
+ iNeedToCompleteMessage = ETrue;
+ iReplySlot = aReplySlot;
+
SetActive();
iStatus = KRequestPending;
TRequestStatus* stat = &iStatus;
--- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Mar 05 16:56:45 2010 -0800
+++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -163,13 +163,14 @@
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RunL"));
TBool isCancelKey = EFalse;
+ TBool isErrorQuery = EFalse;
TInt returnValue = KErrNone;
// for cover display support
TInt coverDialogId = EUSBCoverInvalidDialogId;
// Choose text and other query attributes
//
- HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey );
+ HBufC* stringHolder = GetQueryAttributesLC( coverDialogId, isCancelKey, isErrorQuery );
//check if query text string loading was successful
if (NULL != stringHolder)
@@ -177,7 +178,7 @@
DisableKeylock();
SuppressAppSwitching( ETrue );
returnValue = QueryUserResponseL( *stringHolder, coverDialogId,
- isCancelKey );
+ isCancelKey, isErrorQuery );
SuppressAppSwitching( EFalse );
RestoreKeylock();
CleanupStack::PopAndDestroy( stringHolder );
@@ -219,7 +220,7 @@
// ----------------------------------------------------------------------------
//
TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder,
- TInt aCoverDialogId, TBool aIsCancelKey)
+ TInt aCoverDialogId, TBool aIsCancelKey, TBool aIsErrorQuery)
{
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL"));
TInt returnValue = KErrNone;
@@ -228,7 +229,13 @@
// Show dialog with or without the Cancel
//
- if (aIsCancelKey)
+ if (aIsErrorQuery)
+ {
+ // aIsErrorQuery flag is set in GetQueryAttributesLC()
+ // there is no defined QueryDialogError in resources so QueryOTGerror is used (contains Stop icon)
+ iUSBQueryDlg->PrepareLC( R_USB_QUERY_OTG_ERROR );
+ }
+ else if (aIsCancelKey)
{
iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITH_CANCEL );
}
@@ -270,11 +277,12 @@
// ----------------------------------------------------------------------------
//
HBufC* CUSBUIQueriesNotifier::GetQueryAttributesLC(TInt& aCoverDialogId,
- TBool& aIsCancelKey)
+ TBool& aIsCancelKey, TBool& aIsErrorQuery)
{
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC"));
HBufC* stringHolder = NULL; // The text for the query
aIsCancelKey = EFalse;
+ aIsErrorQuery = EFalse;
switch (iQueryType)
{
case EUSBStorageMediaFailure:
@@ -299,6 +307,15 @@
stringHolder = StringLoader::LoadLC( R_USB_NO_MEMORY_CARD );
aCoverDialogId = EUSBCoverNoMemoryCard;
break;
+ }
+ case EUSBNotEnoughRam:
+ {
+ FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNotEnoughRam"));
+ stringHolder = StringLoader::LoadLC( R_USB_ERROR_MEMORY_NOT_ENOUGH );
+ aCoverDialogId = EUSBCoverNoMemoryCard;
+ //set flag to change the icon of querydialog (see QueryUserResponseL())
+ aIsErrorQuery = ETrue;
+ break;
}
default:
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/bmarm/usbuinotifapitestu.def Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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 Thu Jun 24 14:30:02 2010 +0100
@@ -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 "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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_2.svg Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="-0.014 0.037 42 36">
+<rect fill="none" height="36" width="42" x="-0.014" y="0.037"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="18.75" y1="11.54" x2="24.96" y2="27.67">
+<stop stop-color="#AABBD7" offset="0"/>
+<stop stop-color="#92A5CC" offset="0.26"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#637DB5" offset="0.76"/>
+<stop stop-color="#4C6EA4" offset="0.83"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M18.823,33.49c-0.028-0.01-0.053-0.021-0.077-0.037l0,0L8.569,28.85 c-0.093-0.043-0.157-0.125-0.171-0.225l0,0L7.83,25.033c-0.012-0.076,0.006-0.154,0.05-0.217l0,0l2.553-3.664l-0.393-3.671 c-0.01-0.082,0.016-0.164,0.068-0.226l0,0l9.84-11.568c1.962-1.956,4.492-2.737,6.807-2.735l0,0c0.896,0,1.76,0.117,2.553,0.329l0,0 c1.481,0.4,2.965,1.106,3.795,2.34l0,0c0.041,0.019,0.078,0.046,0.107,0.081l0,0c0.023,0.029,1.199,1.456,1.201,3.82l0,0 c0,0.34-0.022,0.699-0.078,1.077l0,0c-0.18,1.202-0.634,2.678-0.921,3.342l0,0l-7.986,14.282c-0.018,0.072-0.062,0.135-0.124,0.178 l0,0c-0.053,0.033-0.115,0.051-0.176,0.049l0,0c-0.025,0-0.05-0.004-0.074-0.01l0,0c-0.035-0.008-0.067-0.023-0.096-0.043l0,0 l-1.992-0.879l-3.774,5.799c-0.023,0.059-0.065,0.107-0.119,0.141l0,0c-0.034,0.02-0.07,0.033-0.107,0.039l0,0 c-0.001,0.002-0.003,0.002-0.004,0.002l0,0c-0.002,0-0.004,0-0.006,0l0,0c-0.015,0.002-0.03,0.004-0.045,0.004l0,0 C18.879,33.502,18.851,33.498,18.823,33.49L18.823,33.49z M32.753,6.081l0.179-0.148L32.753,6.081L32.753,6.081z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="27.94" y1="30.01" x2="8.42" y2="15.5">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#E0EAF3" offset="0.11"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#8CA9CF" offset="0.48"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#637DB5" offset="0.75"/>
+<stop stop-color="#4C6EA4" offset="0.82"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<polygon fill="url(#SVGID_2)" points="25.137,28.184 10.806,21.869 10.334,17.479 25.108,23.307 "/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="35.78" y1="4.5" x2="22.33" y2="31.13">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#E0EAF3" offset="0.11"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#8CA9CF" offset="0.48"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#637DB5" offset="0.75"/>
+<stop stop-color="#4C6EA4" offset="0.82"/>
+<stop stop-color="#265689" offset="0.91"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M25.117,23.307l7.864-17.383c0,0,1.487,1.795,1.058,4.664c-0.174,1.164-0.627,2.644-0.887,3.241 l-8.027,14.355L25.117,23.307z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="15.76" y1="-3.13" x2="28.63" y2="29.22">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#F4F8FB" offset="0.19"/>
+<stop stop-color="#D6E4F0" offset="0.52"/>
+<stop stop-color="#A7C5DF" offset="0.96"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<path d="M29.23,3.599c-2.747-0.735-6.439-0.292-9.072,2.331l-9.825,11.549l14.774,5.828l7.753-13.183 C34.642,6.166,31.987,4.338,29.23,3.599z" fill="url(#SVGID_4)"/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="25.22" y1="23.12" x2="19.08" y2="11.35">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#C6DCC1" offset="0.08"/>
+<stop stop-color="#91C06F" offset="0.21"/>
+<stop stop-color="#6BAB33" offset="0.32"/>
+<stop stop-color="#539E0E" offset="0.4"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#398419" offset="0.55"/>
+<stop stop-color="#22663B" offset="0.71"/>
+<stop stop-color="#135550" offset="0.85"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M22.05,10.979l-0.616,0.813l3.756,1.229l-2.353,3.107l1.332,0.439l0.696-0.922l2.916,0.965 l-2.067,2.724l-2.899-0.958l0.688-0.923l-6.795-2.236l-0.678,0.935c-0.483-0.736-1.019-1.479-1.515-2.136 c1.078-0.14,2.283-0.313,3.448-0.509l-0.601,0.818l4.521,1.486l1.672-2.219l-2.791-0.916l-0.61,0.814 c-0.477-0.732-1.006-1.473-1.5-2.13C19.741,11.225,20.968,11.053,22.05,10.979z" fill="url(#SVGID_5)"/>
+<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="19.37" y1="27.94" x2="-19.75" y2="-11.18">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_6)" points="23.084,23.328 18.86,29.619 8.123,25.02 12.285,19.045 "/>
+<polygon fill="#4D4D4D" points="14.777,23.287 13.833,24.76 11.07,23.572 12.019,22.139 "/>
+<polygon fill="#4D4D4D" points="20.001,25.482 19.064,27.021 16.364,25.848 17.304,24.344 "/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="17.97" y1="37.85" x2="26.77" y2="9.05">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_7)" points="18.873,29.617 23.084,23.328 22.852,27.178 18.908,33.236 "/>
+<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="18.44" y1="33.76" x2="-1.24" y2="14.08">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#000000" offset="1"/>
+</linearGradient>
+<polygon fill="url(#SVGID_8)" points="18.915,33.236 8.691,28.611 8.123,25.02 18.879,29.602 "/>
+<polygon fill="#FFFFFF" points="18.23,32.199 9.25,28.139 9.049,27.063 18.177,31.076 "/>
+<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="19.28" y1="1.82" x2="32.69" y2="8.11">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M24.564,5.472l6.489,1.948c0,0,0.749-1.301-2.161-2.179C25.981,4.364,24.564,5.472,24.564,5.472z" fill="url(#SVGID_9)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_4.svg Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
+<rect fill="none" height="36" width="42"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="4.34" y1="18" x2="37.66" y2="18">
+<stop stop-color="#A1C1DC" offset="0.1"/>
+<stop stop-color="#6C82B9" offset="0.71"/>
+<stop stop-color="#173F6C" offset="0.99"/>
+</linearGradient>
+<path d="M12.842,34.012l-0.057-0.078l-6.937-9.3l-0.042-0.059l-1.405-1.881L4.37,22.653v-0.052l-0.027-0.858 L4.34,21.59l0.149-0.015c1.725-0.188,3.256-0.634,4.676-1.372c0.68-1.623,2.405-2.95,4.057-3.121 c0.235-0.238,0.481-0.492,0.747-0.774L11.079,2.388L11.044,2.23l0.157-0.033l0.762-0.172l0.159-0.036l0.037,0.159 c0.482,2.094,1.557,2.859,2.694,3.67l0.098,0.07c0.172,0.12,0.348,0.243,0.523,0.364c1.704,1.185,3.464,2.408,3.86,5.01 c1.691-1.087,3.54-1.699,5.645-1.868l0.047-0.002l0.042,0.024l1.62,0.889l0.319,0.174l0.527,0.289l1.251,0.686l8.768,4.814 l0.106,0.057l-0.018,0.131l-0.219,1.099l-0.022,0.118l-0.125,0.013c-5.685,0.518-8.448,3.993-11.377,7.671 c-3.057,3.844-6.22,7.818-12.963,8.643L12.842,34.012L12.842,34.012z M13.666,8.596L15,15.196c0.997-1.081,2.029-2.183,3.198-3.116 C17.83,10.181,16.425,9.099,13.666,8.596L13.666,8.596z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="25.09" y1="3.25" x2="18.28" y2="29.64">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M4.504,21.748c10.374-1.113,10.566-11.391,20.483-12.18l12.506,6.863 c-12.585,1.681-11.545,14.341-24.322,16.136L4.504,21.748z" fill="url(#SVGID_2)"/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="11.67" y1="27.2" x2="22.42" y2="12.96">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M6.254,23.966c1.579-0.102,5.475-0.806,8.816-4.604l6.127,5.619c-2.307,2.884-6.286,5.21-9.765,5.507 L6.254,23.966z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="22.63" y1="18.3" x2="16.39" y2="28">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M15.837,18.577c1.691-1.97,3.833-4.857,7.662-6.644l7.04,4.334c-2.24,1.156-4.458,2.596-8.474,7.792 L15.837,18.577z" fill="url(#SVGID_4)"/>
+<path d="M24.679,11.449c0,0,2.42-0.559,2.777-0.528l7.598,4.183c0,0-1.459-0.021-3.218,0.643L24.679,11.449z" fill="#D6E3F1"/>
+<polygon fill="#FFFFFF" points="5.01,22.433 6.175,22.295 6.975,23.324 5.913,23.549 "/>
+<polygon fill="#FFFFFF" points="7.375,21.997 8.266,23.043 9.482,22.64 8.574,21.615 "/>
+<polygon fill="#FFFFFF" points="9.574,21.165 10.499,22.191 11.537,21.608 10.586,20.609 "/>
+<polygon fill="#FFFFFF" points="11.421,20.037 12.384,21.011 13.269,20.314 12.271,19.342 "/>
+<polygon fill="#FFFFFF" points="13.02,18.701 14.011,19.635 14.791,18.83 13.778,17.914 "/>
+<polygon fill="#FFFFFF" points="14.442,17.202 15.475,18.118 16.197,17.266 15.179,16.398 "/>
+<polygon fill="#FFFFFF" points="15.844,15.668 16.866,16.522 17.604,15.706 16.559,14.862 "/>
+<polygon fill="#FFFFFF" points="17.244,14.166 18.299,14.983 19.106,14.222 18.006,13.415 "/>
+<polygon fill="#FFFFFF" points="18.777,12.774 19.879,13.55 20.761,12.867 19.676,12.108 "/>
+<polygon fill="#FFFFFF" points="20.562,11.561 21.648,12.29 22.73,11.758 21.609,11.037 "/>
+<polygon fill="#FFFFFF" points="22.604,10.648 23.753,11.323 25.063,10.971 23.888,10.287 "/>
+<polygon fill="#FFFFFF" points="25.024,10.068 26.227,10.754 26.93,10.631 25.677,9.949 "/>
+<polygon fill="#FFFFFF" points="11.811,30.928 13.116,30.698 13.985,31.78 12.649,32.004 "/>
+<polygon fill="#FFFFFF" points="14.498,30.351 15.391,31.409 16.816,30.875 15.881,29.832 "/>
+<polygon fill="#FFFFFF" points="17.029,29.287 18.192,28.574 19.174,29.579 17.976,30.306 "/>
+<polygon fill="#FFFFFF" points="19.158,27.871 20.135,28.861 21.14,27.983 20.148,27.013 "/>
+<polygon fill="#FFFFFF" points="20.978,26.184 21.984,27.14 22.859,26.174 21.842,25.253 "/>
+<polygon fill="#FFFFFF" points="22.612,24.36 23.645,25.271 24.468,24.251 23.416,23.373 "/>
+<polygon fill="#FFFFFF" points="24.171,22.477 25.218,23.341 26.04,22.319 24.979,21.479 "/>
+<polygon fill="#FFFFFF" points="25.762,20.613 26.828,21.433 27.736,20.487 26.656,19.675 "/>
+<polygon fill="#FFFFFF" points="27.506,18.885 28.624,19.658 29.642,18.824 28.518,18.066 "/>
+<polygon fill="#FFFFFF" points="29.538,17.391 30.671,18.123 31.874,17.434 30.726,16.714 "/>
+<polygon fill="#FFFFFF" points="31.916,16.199 33.104,16.899 34.571,16.434 33.386,15.741 "/>
+<polygon fill="#FFFFFF" points="34.844,15.44 36.06,16.109 36.745,16.033 35.5,15.349 "/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="14.3" y1="2.22" x2="26.79" y2="28.48">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M13.232,32.458c12.06-1.605,12.525-15.277,24.25-16.038l-0.223,1.113 C25.511,18.605,26.003,32.25,12.916,33.847L13.232,32.458z" fill="url(#SVGID_5)"/>
+<polygon fill="url(#SVGID_2)" points="13.232,32.458 4.504,21.748 4.532,22.606 12.916,33.847 "/>
+<polygon fill="#7D96C5" points="12.839,31.979 12.556,33.363 11.799,32.325 11.973,30.891 "/>
+<polygon fill="#7D96C5" points="5.063,22.42 5.147,23.398 5.977,24.548 5.953,23.545 "/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="12.63" y1="30.81" x2="13.51" y2="19.84">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M16.126,24.422c-0.565,1.555-2.365,2.897-4.022,3.002c-1.654,0.103-2.539-1.072-1.975-2.624 c0.563-1.555,2.364-2.897,4.021-3.004C15.805,21.694,16.689,22.867,16.126,24.422z" fill="url(#SVGID_7)"/>
+<path d="M14.487,18.025l-3.252-15.66l0.762-0.171c0.51,2.215,1.676,2.994,2.856,3.836 c2.69,1.907,5.913,3.547,3.617,10.54l-0.544-0.218c1.583-5.44-0.518-7.292-4.471-7.949l2.114,10.467L14.487,18.025z" fill="#6D5723"/>
+<radialGradient id="SVGID_8" gradientUnits="userSpaceOnUse" cx="13.33" cy="18.95" fx="12.7" fy="19.13" r="2.87">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#A2762B" offset="0.44"/>
+<stop stop-color="#474219" offset="0.94"/>
+</radialGradient>
+<path d="M15.434,20.15c-0.58,1.712-2.439,3.188-4.158,3.292c-1.717,0.11-2.644-1.193-2.063-2.906 c0.578-1.709,2.438-3.184,4.158-3.292C15.087,17.136,16.014,18.437,15.434,20.15z" fill="url(#SVGID_8)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/icons/usb_icon_mode_5.svg Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
+<rect fill="none" height="36" width="42"/>
+<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="-0.54" y1="15.57" x2="35.4" y2="15.57">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A1C1DC" offset="0.35"/>
+<stop stop-color="#6C82B9" offset="0.7"/>
+<stop stop-color="#173F6C" offset="1"/>
+</linearGradient>
+<path d="M24.067,29.803c-0.456,0-0.918-0.07-1.381-0.207l-12.552-3.74c-2.362-0.703-3.827-2.558-3.919-4.957 L5.74,8.165C5.673,6.397,6.431,4.892,7.82,4.036c1.797-1.579,3.234-2.693,5.342-2.693c0.377,0,0.778,0.038,1.19,0.114l11.474,1.836 c3.21,0.579,5.817,3.865,5.817,7.33l-0.161,12.044c0,3.272-2.31,4.707-4.984,6.37c-0.135,0.096-0.275,0.184-0.425,0.265 l-0.009,0.008l-0.15,0.092l-0.018,0.011l-0.014-0.013C25.321,29.666,24.71,29.803,24.067,29.803L24.067,29.803z" fill="url(#SVGID_1)"/>
+<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="19.15" y1="2.32" x2="19.15" y2="26.35">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A1C1DC" offset="0.35"/>
+<stop stop-color="#6C82B9" offset="0.7"/>
+<stop stop-color="#173F6C" offset="1"/>
+</linearGradient>
+<path d="M25.729,29.107c2.868-1.805,5.439-3.154,5.439-6.506l0.161-12.039c0-3.337-2.497-6.497-5.583-7.052 L14.27,1.672c-3.083-0.557-4.703,1.116-7.302,3.402l6.56,0.938l11.324,2.309l1.155,12.016L25.729,29.107z" fill="url(#SVGID_2)"/>
+<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="6.6" y1="5.55" x2="28.55" y2="27.5">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M22.733,29.269c2.822,0.841,5.375-1.101,5.375-4.449V12.715c0-3.336-2.498-6.496-5.58-7.052 L11.366,3.65C8.277,3.094,5.871,5.092,5.986,8.095L6.461,20.83c0.084,2.214,1.425,4.015,3.72,4.696L22.733,29.269z" fill="url(#SVGID_3)"/>
+<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="12.92" y1="1.63" x2="32.49" y2="21.2">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#ADCEB3" offset="0.14"/>
+<stop stop-color="#78B277" offset="0.28"/>
+<stop stop-color="#57A052" offset="0.39"/>
+<stop stop-color="#4A9944" offset="0.44"/>
+<stop stop-color="#428E47" offset="0.5"/>
+<stop stop-color="#286C50" offset="0.68"/>
+<stop stop-color="#185756" offset="0.84"/>
+<stop stop-color="#124F58" offset="0.94"/>
+</linearGradient>
+<path d="M21.698,10.582c0.828,0.164,1.505,1.017,1.511,1.903l0.024,4.707l3.752,0.795v-4.86 c0-2.416-1.466-4.727-3.488-5.776c-0.465-0.24-0.96-0.414-1.471-0.506l-3.731-0.671v3.73L21.698,10.582z" fill="url(#SVGID_4)"/>
+<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="2.57" y1="1.96" x2="33.99" y2="39.18">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#B8CAE2" offset="0.11"/>
+<stop stop-color="#7C9DCD" offset="0.27"/>
+<stop stop-color="#5782BF" offset="0.38"/>
+<stop stop-color="#4977BA" offset="0.44"/>
+<stop stop-color="#3F6CAB" offset="0.51"/>
+<stop stop-color="#295489" offset="0.69"/>
+<stop stop-color="#1C4474" offset="0.84"/>
+<stop stop-color="#173F6C" offset="0.94"/>
+</linearGradient>
+<path d="M23.261,22.141c0.014,1.256-0.801,1.385-1.456,1.206l-9.833-2.939c-0.59-0.401-0.48-1.005-0.5-1.546 c-0.018-0.545-0.231-8.875-0.231-8.875c-0.023-0.829,0.626-1.365,1.458-1.197l5.035,1.004V6.072l-5.656-1.02 C9.324,4.556,7.178,6.336,7.281,9.014l0.423,11.352c0.075,1.974,1.269,3.58,3.314,4.187l11.191,3.335 c2.514,0.751,4.791-0.979,4.791-3.965v-5.36l-3.764-0.797L23.261,22.141z" fill="url(#SVGID_5)"/>
+<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="11.3" y1="22.66" x2="36.26" y2="22.66">
+<stop stop-color="#A1C1DC" offset="0.1"/>
+<stop stop-color="#6C82B9" offset="0.71"/>
+<stop stop-color="#173F6C" offset="0.99"/>
+</linearGradient>
+<path d="M17.672,34.657l-0.042-0.057l-5.196-6.966l-0.033-0.045l-1.052-1.408l-0.023-0.031v-0.039 l-0.021-0.645l-0.002-0.111l0.111-0.013c1.292-0.14,2.439-0.475,3.503-1.025c0.51-1.218,1.801-2.212,3.04-2.341 c0.176-0.176,0.36-0.367,0.559-0.578l-2.166-10.429l-0.025-0.118l0.118-0.026l0.57-0.128l0.119-0.026l0.027,0.119 c0.361,1.568,1.168,2.142,2.019,2.75l0.073,0.051c0.129,0.091,0.261,0.183,0.392,0.273c1.278,0.887,2.598,1.803,2.894,3.753 c1.265-0.815,2.649-1.272,4.229-1.399l0.034-0.001l0.032,0.017l1.212,0.667l0.24,0.129l0.395,0.216l0.938,0.515l6.568,3.605 l0.079,0.043l-0.013,0.099l-0.166,0.823l-0.016,0.09l-0.092,0.008c-4.26,0.389-6.33,2.992-8.523,5.748 c-2.289,2.879-4.659,5.857-9.711,6.474L17.672,34.657L17.672,34.657z M18.289,15.62l1,4.945c0.747-0.811,1.52-1.635,2.396-2.335 C21.408,16.807,20.356,15.997,18.289,15.62L18.289,15.62z" fill="url(#SVGID_6)"/>
+<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="26.85" y1="11.62" x2="21.75" y2="31.39">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M11.427,25.473c7.77-0.837,7.915-8.534,15.346-9.126l9.365,5.143 c-9.428,1.259-8.646,10.743-18.22,12.087L11.427,25.473z" fill="url(#SVGID_7)"/>
+<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="16.79" y1="29.56" x2="24.85" y2="18.89">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M12.737,27.133c1.182-0.074,4.101-0.602,6.604-3.449l4.59,4.212 c-1.728,2.159-4.709,3.901-7.315,4.124L12.737,27.133z" fill="url(#SVGID_8)"/>
+<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="25" y1="22.89" x2="20.33" y2="30.15">
+<stop stop-color="#DEE8F1" offset="0"/>
+<stop stop-color="#225487" offset="1"/>
+</linearGradient>
+<path d="M19.915,23.097c1.268-1.476,2.872-3.64,5.741-4.977l5.272,3.245 c-1.678,0.867-3.339,1.945-6.347,5.839L19.915,23.097z" fill="url(#SVGID_9)"/>
+<path d="M26.538,17.757c0,0,1.814-0.419,2.082-0.396l5.691,3.135c0,0-1.094-0.018-2.411,0.48L26.538,17.757z" fill="#D6E3F1"/>
+<polygon fill="#FFFFFF" points="11.806,25.985 12.678,25.883 13.278,26.651 12.481,26.82 "/>
+<polygon fill="#FFFFFF" points="13.576,25.66 14.246,26.442 15.155,26.141 14.475,25.371 "/>
+<polygon fill="#FFFFFF" points="15.224,25.035 15.917,25.804 16.695,25.367 15.982,24.619 "/>
+<polygon fill="#FFFFFF" points="16.608,24.189 17.33,24.92 17.991,24.398 17.245,23.671 "/>
+<polygon fill="#FFFFFF" points="17.805,23.189 18.548,23.891 19.132,23.285 18.373,22.6 "/>
+<polygon fill="#FFFFFF" points="18.871,22.067 19.646,22.753 20.185,22.115 19.422,21.465 "/>
+<polygon fill="#FFFFFF" points="19.922,20.918 20.687,21.559 21.24,20.945 20.457,20.313 "/>
+<polygon fill="#FFFFFF" points="20.969,19.792 21.76,20.404 22.364,19.834 21.541,19.23 "/>
+<polygon fill="#FFFFFF" points="22.118,18.75 22.944,19.331 23.603,18.82 22.793,18.25 "/>
+<polygon fill="#FFFFFF" points="23.455,17.841 24.271,18.387 25.08,17.988 24.239,17.447 "/>
+<polygon fill="#FFFFFF" points="24.985,17.157 25.847,17.663 26.827,17.399 25.946,16.886 "/>
+<polygon fill="#FFFFFF" points="26.8,16.723 27.699,17.236 28.225,17.144 27.287,16.633 "/>
+<polygon fill="#FFFFFF" points="16.898,32.349 17.878,32.177 18.529,32.987 17.528,33.154 "/>
+<polygon fill="#FFFFFF" points="18.911,31.916 19.581,32.709 20.65,32.309 19.949,31.528 "/>
+<polygon fill="#FFFFFF" points="20.808,31.118 21.681,30.585 22.415,31.339 21.518,31.885 "/>
+<polygon fill="#FFFFFF" points="22.404,30.058 23.138,30.801 23.888,30.143 23.146,29.416 "/>
+<polygon fill="#FFFFFF" points="23.767,28.795 24.522,29.512 25.178,28.787 24.414,28.098 "/>
+<polygon fill="#FFFFFF" points="24.992,27.429 25.765,28.111 26.38,27.348 25.595,26.689 "/>
+<polygon fill="#FFFFFF" points="26.159,26.018 26.943,26.666 27.558,25.899 26.766,25.271 "/>
+<polygon fill="#FFFFFF" points="27.351,24.623 28.149,25.235 28.829,24.527 28.021,23.921 "/>
+<polygon fill="#FFFFFF" points="28.657,23.328 29.494,23.908 30.257,23.281 29.415,22.713 "/>
+<polygon fill="#FFFFFF" points="30.181,22.209 31.028,22.756 31.93,22.24 31.069,21.701 "/>
+<polygon fill="#FFFFFF" points="31.96,21.314 32.851,21.84 33.95,21.492 33.063,20.973 "/>
+<polygon fill="#FFFFFF" points="34.155,20.746 35.064,21.25 35.579,21.19 34.646,20.68 "/>
+<linearGradient id="SVGID_10" gradientUnits="userSpaceOnUse" x1="18.78" y1="10.86" x2="28.12" y2="30.5">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#486EA2" offset="0.71"/>
+<stop stop-color="#225487" offset="0.99"/>
+</linearGradient>
+<path d="M17.964,33.494c9.035-1.201,9.381-11.443,18.168-12.012l-0.169,0.832 c-8.802,0.803-8.433,11.025-18.236,12.22L17.964,33.494z" fill="url(#SVGID_10)"/>
+<polygon fill="url(#SVGID_7)" points="17.964,33.494 11.427,25.473 11.446,26.115 17.727,34.534 "/>
+<polygon fill="#7D96C5" points="17.669,33.137 17.458,34.173 16.892,33.395 17.022,32.322 "/>
+<polygon fill="#7D96C5" points="11.844,25.977 11.908,26.709 12.529,27.569 12.512,26.818 "/>
+<linearGradient id="SVGID_12" gradientUnits="userSpaceOnUse" x1="17.52" y1="32.26" x2="18.17" y2="24.05">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A1C1DC" offset="1"/>
+</linearGradient>
+<path d="M20.134,27.476c-0.425,1.165-1.773,2.171-3.014,2.247c-1.239,0.079-1.903-0.801-1.48-1.965 c0.421-1.164,1.771-2.172,3.012-2.25C19.891,25.431,20.554,26.31,20.134,27.476z" fill="url(#SVGID_12)"/>
+<path d="M18.905,22.685l-2.436-11.732l0.57-0.127c0.382,1.659,1.256,2.242,2.14,2.874 c2.016,1.427,4.429,2.657,2.709,7.895l-0.407-0.162c1.186-4.076-0.389-5.463-3.35-5.955l1.583,7.84L18.905,22.685z" fill="#6D5723"/>
+<radialGradient id="SVGID_13" gradientUnits="userSpaceOnUse" cx="18.04" cy="23.37" fx="17.57" fy="23.5" r="2.14">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#A2762B" offset="0.44"/>
+<stop stop-color="#474219" offset="0.94"/>
+</radialGradient>
+<path d="M19.613,24.275c-0.434,1.281-1.827,2.387-3.115,2.466c-1.285,0.083-1.98-0.895-1.544-2.177 c0.433-1.28,1.827-2.386,3.114-2.467C19.354,22.018,20.048,22.99,19.613,24.275z" fill="url(#SVGID_13)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/mydebug.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef MYDEBUG_H
+#define MYDEBUG_H
+
+#include <QtDebug>
+
+#if defined(_DEBUG)
+ inline QDebug myDebug()
+ {
+ return qDebug();
+ }
+#else
+ inline QNoDebug myDebug()
+ {
+ return QNoDebug();
+ }
+#endif
+
+
+#endif // MYDEBUG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbmainview.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBMAINVIEW_H
+#define USBMAINVIEW_H
+
+#include <hbview.h>
+#include <QObject>
+
+class UsbUiSettingModel;
+class QGraphicsLinearLayout;
+class HbListWidgetItem;
+class HbListWidget;
+class HbTextEdit;
+class HbRadioButtonList;
+
+class UsbMainView : public HbView
+{
+ Q_OBJECT
+ friend class TestUsbUiModelActive;
+
+public:
+ explicit UsbMainView( QObject *parent = 0 );
+ virtual ~UsbMainView();
+
+public slots:
+ /**
+ * Update view item(s) between the selected rows.
+ * @param topLeft The top row index
+ * @param bottomRight The bottom row index
+ */
+ void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+
+ /*
+ * Set the personality user has selected in the radio button list
+ * @param personalityIndex The selection index in the radio button list
+ */
+ void setPersonality( int personalityIndex );
+
+signals:
+
+private:
+ /*
+ * creates the main view window row by row
+ */
+ void createMainView();
+ /*
+ * creates the first row in the view containing an icon and a mode name
+ * @param localPropertiesGroup main view layout
+ */
+ void createIconNameRow(QGraphicsLinearLayout *localPropertiesGroup);
+ /*
+ * creates the second row from the view containing the description of the selected mode
+ * @param localPropertiesGroup main view layout
+ */
+ void createDescriptionArea(QGraphicsLinearLayout *localPropertiesGroup);
+ /*
+ * creates the third row from the view containing the radio button list of the existing usb modes
+ * @param localPropertiesGroup main view layout
+ */
+ void createRadioButtonArea(QGraphicsLinearLayout *localPropertiesGroup);
+
+private:
+ // main view layout owned by this class
+ QGraphicsLinearLayout *mMainLayout;
+ // setting model not owned by the view,
+ // has to be deleted
+ UsbUiSettingModel *mModel;
+ //owned by the view
+ HbListWidgetItem *mListItem;
+ // owned by the view
+ HbListWidget *mlist;
+ // owned by the view
+ HbTextEdit *mlabel;
+ // owned by the view
+ HbRadioButtonList *mradio;
+ // not owned by the view
+ // need to be deleted
+ HbIcon *mIcon ;
+};
+
+#endif /* USBMAINVIEW_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbuimodelactive.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBUIMODELACTIVE_H
+#define USBUIMODELACTIVE_H
+
+#include <QObject>
+#include <e32base.h>
+#include <usbwatcher.h>
+
+class UsbUiModelActivePrivate;
+
+/*!
+ \class UsbUiModelActive
+ \brief Helper class for using active objects in Qt classes.
+
+ UsbUiModelActive is a helper class for using active objects
+ from any Qt class. It wraps a CActive-derived class in an interface
+ that uses Qt's signal-slot mechanism for communicating status changes
+ of the active object.
+
+ */
+class UsbUiModelActive : public QObject
+{
+ Q_OBJECT
+ friend class UsbUiModelActivePrivate;
+
+public:
+ explicit UsbUiModelActive( int priority = CActive::EPriorityStandard,
+ QObject *parent = NULL );
+ ~UsbUiModelActive();
+
+ inline TRequestStatus &RequestStatus();
+ inline void SetActive();
+ inline void Cancel();
+ inline bool IsActive();
+
+public:
+ int SetUsbPersonality(int personality);
+ void CancelSetPersonality();
+
+signals:
+ void requestCompleted( int status );
+
+private:
+ /*!
+ * emits a signal when the request is completed
+ * @param status is the error
+ */
+ void emitRequestCompleted( int status );
+
+private:
+ UsbUiModelActivePrivate *d;
+
+ /** Handle to USBWatcher for setting the personality */
+ RUsbWatcher iUsbWatcher;
+};
+
+
+/*!
+ \class UsbUiModelActivePrivate
+ \brief Private class of UsbUiModelActive, for using active objects in Qt classes.
+
+ UsbUiModelActivePrivate is a helper class for using active objects
+ from any Qt class. It derives from CActive and allows other classes to use
+ it for passing to asynchronous function calls through its RequestStatus method.
+
+ */
+class UsbUiModelActivePrivate : public CActive
+{
+ friend class UsbUiModelActive;
+
+public:
+ explicit UsbUiModelActivePrivate( UsbUiModelActive *parent, int priority );
+ ~UsbUiModelActivePrivate();
+
+private:
+ virtual void RunL();
+ virtual void DoCancel();
+ virtual TInt RunError( TInt aError );
+
+private:
+ UsbUiModelActive *q;
+
+};
+
+inline bool UsbUiModelActive::IsActive()
+{
+ return d->IsActive();
+}
+
+inline TRequestStatus &UsbUiModelActive::RequestStatus()
+{
+ return d->iStatus;
+}
+
+inline void UsbUiModelActive::SetActive()
+{
+ d->SetActive();
+}
+
+inline void UsbUiModelActive::Cancel()
+{
+ d->Cancel();
+}
+
+#endif /* USBUIMODELACTIVE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbuisettingmodel.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBUISETTINGMODEL_H
+#define USBUISETTINGMODEL_H
+
+
+#include <e32base.h>
+#include <e32property.h>
+#include <QStringList>
+#include <QAbstractItemModel>
+#include <XQSettingsManager>
+
+const int KDefaultColumn = 0;
+typedef QList< QMap< int, QVariant > > UsbUiModelDataSource;
+
+class RUsb;
+class UsbUiModelActive;
+
+class UsbUiSettingModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ friend class TestUsbUiModelActive;
+
+public:
+enum usbSettingsIndex {
+ DefaultMode,
+ Description,
+ UsbModeList,
+ EndOfSettings
+ };
+enum SettingsRoleValues {
+ SettingType = Qt::UserRole,
+ SettingsModeNameList,
+ };
+public:
+ UsbUiSettingModel( QObject *parent = 0 );
+ virtual ~UsbUiSettingModel();
+
+ /*
+ * Returns the index of the item in the model specified by the given row, column and parent index.
+ * @param row is the row number of the specified item
+ * @param column is the column number of the specified item
+ * @param parent QModelIndex parent
+ */
+ virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ * Returns QModelIndex() because this model item has no parent
+ * @param child is the index of item model, the parent of which is going to be returned
+ * @param child is not used in here
+ */
+ virtual QModelIndex parent( const QModelIndex &child ) const;
+ /*
+ * Returns the number of rows under the given parent
+ * @param parent QModelIndex parent
+ */
+ virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ * Returns the number of columns for the children of the given parent.
+ * @param parent QModelIndex parent
+ */
+ virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
+ /*
+ *Returns the data stored under the given role for the item referred to by the index.
+ */
+ virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
+ /*
+ * Sets the role data for the item at index to value. Returns true if successful; otherwise returns false.
+ */
+ virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
+
+ const QModelIndex* sourceData() const;
+
+public slots:
+ /*
+ * Provides notification of changes in selected usb mode
+ * @param key is not used
+ * @param value is the value read from cenrep key
+ */
+ void usbModeChanged( const XQSettingsKey &key, const QVariant &value );
+ /*
+ * it checks the response from usbwatcher to see if the new mode change has been successful
+ * it will go back to the previous personality if it has not been successfull
+ * @param status is the error code returned from usbwatcher
+ */
+ void setPersonalityCompleted (int status );
+
+private:
+ /*
+ * creats the logical name of the modename string for the list
+ * @param modeId is the usb personality id
+ */
+ QString modeListName( int modeId );
+ /*
+ * Get the current USB personality ID
+ * Returns 0, if the key is missing or the value cannot be converted
+ * to integer.
+ * @return The current personality id
+ */
+ int currentMode();
+ /*
+ * sets the value to different roles of the model's first row
+ */
+ void setDefaultModeSetting();
+ /*
+ * sets the value to different roles of the model's description row
+ */
+ void setDescriptionSetting();
+ /**
+ * Set the USB mode list and the current selection in the list.
+ * The personality IDs are stored to mPersonalityIds and the personality names
+ * to mSettingsList.
+ * @param modeId The current mode ID
+ */
+ bool setUsbModelistSetting( int modeId );
+ /**
+ * calls the model's set functions
+ * @param modeId The current mode ID
+ */
+ void setUsbSettings( int modeId );
+ /**
+ * updates the model rows and emits signal datachanged
+ * @param newPersonality is the new personality id
+ */
+ void setNewUsbMode(int newPersonality);
+
+ /**
+ * Check from the USB Manager if the USB personality is hidden.
+ * @param usbman Already opened USB Manager session
+ * @param personalityId The ID of the personality to be checked.
+ * @return For hidden personality, true is returned.
+ */
+ bool isPersonalityHidden(RUsb &usbman, TInt personalityId);
+
+ /**
+ * Check if the USB personality is hidden.
+ * The personality is hidden, if it does not exist in mPersonalityIds.
+ * @param personalityId The ID of the personality to be checked.
+ * @return For hidden personality, true is returned.
+ */
+ bool isPersonalityHidden(TInt personalityId);
+ private:
+
+ UsbUiModelDataSource mSettingsList;
+ int mCurrentMode;
+ // stored, so that we can show the correct personality when it fails to set the new one
+ int mPreviousMode;
+
+ XQSettingsManager mSettingsManager;
+ QList<int> mPersonalityIds;
+ UsbUiModelActive *mModelActive;
+};
+
+#endif // USBUISETTINGMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/inc/usbviewmanager.h Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBVIEWMANAGER_H
+#define USBVIEWMANAGER_H
+
+#include "usbmainview.h"
+
+
+class HbMainWindow;
+
+class UsbViewManager : public QObject
+ {
+ Q_OBJECT
+
+public:
+ explicit UsbViewManager(HbMainWindow* mainWindow, QObject *parent = 0 );
+ ~UsbViewManager();
+
+ void addView();
+
+private:
+ HbMainWindow* mWindow;
+ UsbMainView* mMainView; // owned
+
+ };
+
+
+#endif /* USBVIEWMANAGER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/rom/usbsettings.iby Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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:
+*
+*/
+
+#ifndef USBSETTING_IBY
+#define USBSETTING_IBY
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+file=/epoc32/release/armv5/urel/usbapplication.exe PROGRAMS_DIR/usbapplication.exe
+data=/epoc32/data/z/private/10003a3f/import/apps/usbapplication_reg.rsc /private/10003a3f/import/apps/usbapplication_reg.rsc
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/rom/usbsettingsresources.iby Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef USBSETTINGRESOURCES_IBY
+#define USBSETTINGRESOURCES_IBY
+// Use standard macros
+#include <data_caging_paths_for_iby.hrh>
+
+data=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/main.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <QTranslator>
+#include <eikenv.h>
+#include "usbviewmanager.h"
+
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ // add translator for application library
+ QString locale = QLocale::system().name();
+ QTranslator translator;
+ QString filename = QString("usbapplication_") + locale;
+#ifdef Q_OS_SYMBIAN
+ // TRAP is must here, otherwise it crashes
+TRAP_IGNORE(
+ bool loaded(false);
+ loaded = translator.load( filename, QString("z:/resource/qt/translations") );
+ if (!loaded)
+ translator.load(filename, QString("c:/resource/qt/translations") );
+);
+#else
+ translator.load(filename, QString("resource") );
+#endif //Q_OS_SYMBIAN
+ app.installTranslator(&translator);
+
+ HbMainWindow mainWindow;
+
+ // create the view manager, which handles 3 HbViews and add into mainWindow.
+ UsbViewManager* mViewManager = new UsbViewManager( &mainWindow, &app );
+ mViewManager->addView();
+
+ mainWindow.show();
+ return app.exec();
+}
Binary file usbuis/usbuiqt/src/usbapplication.qm has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication.qrc Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RCC>
+ <qresource prefix="/xml">
+ <file>usbview.docml</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication.ts Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="3.0" language="en_GB" sourcelanguage="en_GB">
+<context>
+<message numerus="no" id="txt_usb_description_5">
+ <comment>Description for USB Ovi Suite personality. This gives user help about the selected personality.</comment>
+ <source>Manage your phone with Ovi Suite and sync your media content.</source>
+ <translation variants="no">Manage your phone with Ovi Suite and sync your media content.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Text ID</extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature>Te</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_5">
+ <comment>USB mode name for Ovi Suite personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_5.</comment>
+ <source>Ovi Suite</source>
+ <translation variants="no">Ovi Suite</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Comment</extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature>Co</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_2">
+ <comment>USB mode name for Mass storage personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_2.</comment>
+ <source>Mass storage</source>
+ <translation variants="no">Mass storage</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Layout ID</extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature>La</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_2">
+ <comment>USB mode name for Mass storage personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Mass storage</source>
+ <translation variants="no">Mass storage</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>View ID (draft)</extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature>Vi</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_6">
+ <comment>USB mode name for Phone as modem personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_6.</comment>
+ <source>Connect PC to Web</source>
+ <translation variants="no">Connect PC to Web</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_2">
+ <comment>Description for USB Mass storage personality. This gives user help about the selected personality.</comment>
+ <source>Access your phoneÂ’s memory card from the device you are connected to.</source>
+ <translation variants="no">Access your phoneÂ’s memory card from the device you are connected to.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>Position ID</extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature>Po</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modelistname_4">
+ <comment>USB mode name for MTP personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_4.</comment>
+ <source>Media transfer</source>
+ <translation variants="no">Media transfer</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modelistname</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_5">
+ <comment>USB mode name for Ovi Suite personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Ovi Suite</source>
+ <translation variants="no">Ovi Suite</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid>File name</extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature>Fi</extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_6">
+ <comment>Description for USB Phone as Modem personality. This gives user help about the selected personality.</comment>
+ <source>Use your mobile phone as a modem</source>
+ <translation variants="no">Use your mobile phone as a modem</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_description_4">
+ <comment>Description for USB MTP personality. This gives user help about the selected personality.</comment>
+ <source>Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</source>
+ <translation variants="no">Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>description</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_6">
+ <comment>USB mode name for Phone as Modem personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Connect PC to Web</source>
+ <translation variants="no">Connect PC to Web</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+<message numerus="no" id="txt_usb_modename_4">
+ <comment>USB mode name for MTP personality. This is used in USB application as the default (selected) mode.</comment>
+ <source>Media transfer</source>
+ <translation variants="no">Media transfer</translation>
+ <extra-loc-layout_id></extra-loc-layout_id>
+ <extra-loc-viewid></extra-loc-viewid>
+ <extra-loc-positionid>modename</extra-loc-positionid>
+ <extra-loc-feature></extra-loc-feature>
+ <extra-loc-blank>False</extra-loc-blank>
+</message>
+</context>
+</TS>
Binary file usbuis/usbuiqt/src/usbapplication.xls has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbapplication_reg.rss Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,18 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.0) on: 2009-12-16T13:39:42
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#include <usbapplication.rsg>
+#include <appinfo.rh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0xECD2B4FE
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file="usbapplication";
+ localisable_resource_file="\\resource\\apps\\usbapplication";
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbicons.qrc Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>../icons/usb_icon_mode_2.svg</file>
+ <file>../icons/usb_icon_mode_4.svg</file>
+ <file>../icons/usb_icon_mode_5.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbmainview.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,180 @@
+/*
+* 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:
+*
+*/
+#include "usbmainview.h"
+#include <QModelIndex>
+#include <QtGui/QGraphicsLinearLayout>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
+#include <hbradiobuttonlist.h>
+#include <hbtextedit.h>
+
+#include "usbuisettingmodel.h"
+#include "mydebug.h"
+/*!
+ * default constructor
+ */
+UsbMainView::UsbMainView( QObject *parent )
+: HbView(), mModel(NULL)
+{
+ myDebug() << ">>> UsbMainView::UsbMainView";
+ setParent( parent );
+ setTitle( qtTrId("USB") );
+ mMainLayout = new QGraphicsLinearLayout( Qt::Vertical, this );
+ mModel = new UsbUiSettingModel();
+ createMainView();
+ setLayout( mMainLayout );
+ myDebug() << "<<< UsbMainView::UsbMainView";
+}
+
+/*!
+ * creates the main view
+ */
+void UsbMainView::createMainView()
+{
+ myDebug() << ">>> UsbMainView::createMainView";
+ QGraphicsLinearLayout *mainViewLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ mListItem = NULL;
+ mlist = NULL;
+ mlabel = NULL;
+ mradio = NULL;
+ mIcon = NULL;
+ createIconNameRow( mainViewLayout );
+ createDescriptionArea( mainViewLayout );
+ createRadioButtonArea( mainViewLayout );
+ mMainLayout->addItem( mainViewLayout );
+ bool connected = connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
+ this, SLOT( updateSettingItems( QModelIndex, QModelIndex ) ) );
+ myDebug() << "<<< UsbMainView::createMainView model connected=" << connected;
+ connected = connect(mradio, SIGNAL( itemSelected( int ) ),
+ this, SLOT( setPersonality( int ) ) );
+ myDebug() << "<<< UsbMainView::createMainView mradio connected=" << connected;
+ myDebug() << "<<< UsbMainView::createMainView";
+}
+/*!
+ * creating the creates the first row in the view containing an icon and a mode name
+ */
+void UsbMainView::createIconNameRow( QGraphicsLinearLayout *aLocalPropertiesGroup )
+{
+ myDebug() << ">>> UsbMainView::createIconNameRow";
+ QGraphicsLinearLayout *listLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ mlist = new HbListWidget( this );
+ mlist->setMaximumSize( 300, 50 ); //todo
+ mListItem= new HbListWidgetItem();
+ QModelIndex index = mModel->index( UsbUiSettingModel::DefaultMode, KDefaultColumn );
+ // QVariant iconName = mModel->data( index, Qt::DecorationRole );
+ mIcon = new HbIcon( mModel->data( index, Qt::DecorationRole ).toString() );
+ mListItem->setIcon( *mIcon );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ mlist->insertItem( 1, mListItem );
+ listLayout->addItem( mlist );
+ aLocalPropertiesGroup->addItem( listLayout );
+ myDebug() << "<<< UsbMainView::createIconNameRow";
+}
+/*!
+ * creates the second row from the view containing the description of the selected mode
+ */
+void UsbMainView::createDescriptionArea( QGraphicsLinearLayout *aLocalPropertiesGroup )
+{
+ myDebug() << ">>> UsbMainView::createDescriptionArea";
+ QGraphicsLinearLayout *desLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ QModelIndex index = mModel->index( UsbUiSettingModel::Description, KDefaultColumn );
+ mlabel = new HbTextEdit( mModel->data( index, Qt::DisplayRole ).toString() );
+ mlabel->setReadOnly( true );
+ mlabel->setCursorVisibility( Hb::TextCursorHidden );
+ desLayout->addItem( mlabel );
+ desLayout->setAlignment( mlabel, Qt::AlignTop );
+ aLocalPropertiesGroup->addItem( desLayout );
+ myDebug() << "<<< UsbMainView::createDescriptionArea";
+}
+
+/*!
+ * creates the third row from the view containing the radio button list of the existing usb modes
+ */
+void UsbMainView::createRadioButtonArea(QGraphicsLinearLayout *aLocalPropertiesGroup)
+{
+ myDebug() << ">>> UsbMainView::createRadioButtonArea";
+ QGraphicsLinearLayout *radioLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
+ QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
+ QStringList radioList = mModel->data( index, UsbUiSettingModel::SettingsModeNameList ).toStringList();
+ int selectedIndex = mModel->data( index, Qt::EditRole ).toInt();
+ mradio = new HbRadioButtonList( radioList, selectedIndex );
+ radioLayout->addItem( mradio );
+ radioLayout->setAlignment( mradio, Qt::AlignBottom );
+ aLocalPropertiesGroup->addItem(radioLayout);
+ myDebug() << "<<< UsbMainView::createRadioButtonArea";
+}
+
+/*!
+ Slot for receiving notification of data changes from the model.
+ Identify the setting changed and update the corresponding UI item.
+ */
+void UsbMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+{
+ myDebug() << ">>> UsbMainView::updateSettingItems";
+ // update only the part of the view specified by the model row(s)
+ for ( int row = topLeft.row(); row <= bottomRight.row(); row++ ) {
+ myDebug() << " UsbMainView::updateSettingItems row=" << row;
+ QModelIndex index = mModel->index( row, KDefaultColumn );
+ // Distinguish which setting value is changed.
+ switch ( row ) {
+ case UsbUiSettingModel::DefaultMode :
+ // set the selected personality icon and name
+ mIcon->setIconName( mModel->data( index, Qt::DecorationRole ).toString() );
+ mListItem->setIcon( *mIcon );
+ mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
+ break;
+ case UsbUiSettingModel::Description :
+ // set the description of the selected personality.
+ mlabel->setPlainText( mModel->data( index, Qt::DisplayRole ).toString() );
+ mlabel->setReadOnly( true );
+ mlabel->setCursorVisibility( Hb::TextCursorHidden );
+ break;
+ case UsbUiSettingModel::UsbModeList :
+ // only the selection can change, no changes in the list of personalities
+ mradio->setSelected( mModel->data( index, Qt::EditRole ).toInt() );
+ break;
+ default :
+ myDebug() << " UsbMainView::updateSettingItems unknown row " << row;
+ break;
+ }
+ }
+ myDebug() << "<<< UsbMainView::updateSettingItems";
+}
+
+/*
+ * Slot for receiving notification from the change in radio button list
+ */
+void UsbMainView::setPersonality( int personalityIndex )
+{
+ myDebug() << ">>> UsbMainView::setPersonality";
+ QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
+ mModel->setData( index, personalityIndex, Qt::EditRole );
+ myDebug() << "<<< UsbMainView::setPersonality";
+}
+
+/*!
+ * Destructor
+ * destructs the items which are not owned by this class
+ */
+UsbMainView::~UsbMainView()
+{
+ myDebug() << ">>> UsbMainView::~UsbMainView";
+ delete mModel;
+ delete mIcon;
+ myDebug() << "<<< UsbMainView::~UsbMainView";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbuimodelactive.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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:
+*
+*/
+
+#include "usbuimodelactive.h"
+#include "mydebug.h"
+
+//const ?type ?constant_var = ?constant;
+
+
+/*!
+ Constructor.
+ */
+UsbUiModelActive::UsbUiModelActive( int priority, QObject *parent )
+: QObject( parent )
+{
+ myDebug() << ">>> UsbUiModelActive::UsbUiModelActive";
+ d = new UsbUiModelActivePrivate( this, priority );
+ int err= iUsbWatcher.Connect();
+ myDebug() << "iUsbWatcher.Connect() returned ";
+ myDebug() << err;
+ myDebug() << "<<< UsbUiModelActive::UsbUiModelActive";
+}
+
+/*!
+ Destructor.
+ */
+UsbUiModelActive::~UsbUiModelActive()
+{
+ myDebug() << ">>> UsbUiModelActive::~UsbUiModelActive";
+ delete d;
+ iUsbWatcher.Close();
+ myDebug() << "<<< UsbUiModelActive::~UsbUiModelActive";
+}
+/*!
+ * emits a signal when the request is completed
+ */
+void UsbUiModelActive::emitRequestCompleted( int status )
+{
+ myDebug() << ">>> UsbUiModelActive::emitRequestCompleted status: ";
+ myDebug() << status;
+ emit requestCompleted( status );
+ myDebug() << "<<< UsbUiModelActive::emitRequestCompleted";
+}
+
+/*!
+ * UsbUiModelActive::SetUSBModeL
+ * Sets the Central Repository key to the parameter.
+ */
+int UsbUiModelActive::SetUsbPersonality(int personality)
+ {
+ myDebug() << ">>> UsbUiModelActive::SetUsbPersonality";
+ myDebug() << "requested personality is ";
+ myDebug() << personality;
+ // Change the personality asynchrously, result checked in RunL()
+ if( IsActive() )
+ {
+ Cancel();
+ }
+ myDebug() << "setting new personality";
+ iUsbWatcher.SetPersonality(RequestStatus(), personality);
+ SetActive();
+ myDebug() << "<<< UsbUiModelActive::SetUsbPersonality, returns 0";
+ return 0;
+ }
+/*!
+ * cancles the personality set in usbwatcher
+ */
+void UsbUiModelActive::CancelSetPersonality()
+ {
+ iUsbWatcher.CancelSetPersonality();
+ }
+
+/*!
+ Constructor.
+ */
+UsbUiModelActivePrivate::UsbUiModelActivePrivate(
+ UsbUiModelActive *parent, int priority )
+: CActive( (TInt) priority ), q( parent )
+{
+ myDebug() << ">>> UsbUiModelActivePrivate::UsbUiModelActivePrivate";
+ CActiveScheduler::Add( this );
+ myDebug() << "<<< UsbUiModelActivePrivate::UsbUiModelActivePrivate";
+}
+
+
+/*!
+ Destructor.
+ */
+UsbUiModelActivePrivate::~UsbUiModelActivePrivate()
+{
+ Cancel();
+}
+
+
+/*!
+ * Called by the active scheduler when the request has been completed.
+ */
+void UsbUiModelActivePrivate::RunL()
+{
+ myDebug() << ">>> UsbUiModelActivePrivate::RunL";
+ q->emitRequestCompleted( iStatus.Int() );
+ myDebug() << "<<< UsbUiModelActivePrivate::RunL";
+}
+
+
+/*!
+ Called by the active scheduler when the request has been cancelled.
+ */
+void UsbUiModelActivePrivate::DoCancel()
+{
+ q->CancelSetPersonality();
+}
+
+
+/*!
+ Called by the active scheduler when an error in RunL has occurred.
+ */
+TInt UsbUiModelActivePrivate::RunError( TInt aError )
+{
+ q->emitRequestCompleted( aError );
+ return KErrNone;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbuisettingmodel.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,362 @@
+/*
+* 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:
+*
+*/
+
+#include "usbuisettingmodel.h"
+#include "usbuimodelactive.h"
+#include "mydebug.h"
+#include <QStringList>
+#include <UsbWatcherInternalCRKeys.h>
+#include <XQSettingsKey>
+#include <usbman.h>
+
+const QString TextIdPrefix = ("txt_usb_");
+const QString ModeIconNamePrefix = (":/icons/usb_icon_mode_");
+
+/*!
+ Constructor.
+ */
+UsbUiSettingModel::UsbUiSettingModel( QObject *parent )
+ : QAbstractItemModel( parent )
+{
+ mModelActive = new UsbUiModelActive();
+
+ for ( int i = 0; i < UsbUiSettingModel::EndOfSettings; i++ ) {
+ // Initialize the list with empty values.
+ mSettingsList.append( QMap< int, QVariant >() );
+ }
+
+ mCurrentMode = currentMode();
+ mPreviousMode = mCurrentMode;
+ setUsbSettings(mCurrentMode);
+ bool ret = mSettingsManager.startMonitoring(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
+ myDebug() << ">>> UsbUiSettingModel::startMonitoring value="
+ << ret;
+
+ // signal: personality changed in the central repository
+ connect( &mSettingsManager,
+ SIGNAL( valueChanged( const XQSettingsKey&, const QVariant& ) ),
+ this,
+ SLOT( usbModeChanged( const XQSettingsKey&, const QVariant& ) ) );
+
+ // signal: response from usbwatcher to our attempt to set the personality
+ connect( mModelActive,
+ SIGNAL( requestCompleted( int status ) ),
+ this,
+ SLOT( setPersonalityCompleted (int status )));
+
+}
+/*!
+ * calls the model's set functions to initialize the model's data
+ */
+void UsbUiSettingModel::setUsbSettings( int aModeId )
+ {
+ setUsbModelistSetting( aModeId );
+ setDefaultModeSetting();
+ setDescriptionSetting();
+ }
+
+/*!
+ Destructor.
+ */
+UsbUiSettingModel::~UsbUiSettingModel()
+{
+ myDebug() << ">>> UsbUiSettingModel::~UsbUiSettingModel";
+ mSettingsManager.stopMonitoring(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
+ delete mModelActive;
+ myDebug() << "<<< UsbUiSettingModel::~UsbUiSettingModel";
+}
+
+/*!
+ Provides notification of changes in selected usb mode
+ */
+void UsbUiSettingModel::usbModeChanged( const XQSettingsKey &key,
+ const QVariant &value )
+{
+Q_UNUSED(key);
+ myDebug() << ">>> UsbUiSettingModel::usbModeChanged";
+ // key is not checked, as we monitor only one key
+
+ setNewUsbMode(value.toInt());
+
+ myDebug() << "<<< UsbUiSettingModel::usbModeChanged";
+}
+/*!
+ * updates the model rows and emits signal datachanged
+ */
+void UsbUiSettingModel::setNewUsbMode(int newPersonality)
+
+ {
+ myDebug() << ">>> UsbUiSettingModel::setNewUsbMode value="
+ << newPersonality;
+
+ mCurrentMode = newPersonality;
+ setUsbSettings(mCurrentMode);
+
+ emit dataChanged( createIndex( DefaultMode, KDefaultColumn ),
+ createIndex( UsbModeList, KDefaultColumn ) );
+
+ myDebug() << "<<< UsbUiSettingModel::setNewUsbMode";
+ }
+/*!
+ * Returns the index of the item in the model specified by the given row, column and parent index.
+ */
+QModelIndex UsbUiSettingModel::index( int row, int column, const QModelIndex &parent ) const
+{
+ return hasIndex( row, column, parent ) ? createIndex( row, column ) : QModelIndex();
+}
+
+
+/*
+ This model does not support hierarchy, so this returns an empty model index.
+ */
+QModelIndex UsbUiSettingModel::parent( const QModelIndex &child ) const
+{
+ Q_UNUSED( child );
+ return QModelIndex();
+}
+/*!
+ * Returns the number of rows under the given parent
+ */
+int UsbUiSettingModel::rowCount( const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ return mSettingsList.count();
+}
+
+
+/*!
+ * Returns the number of columns for the children of the given parent.
+ * This model is one-dimensional, so this returns 1.
+ */
+int UsbUiSettingModel::columnCount( const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ return 1;
+}
+/*!
+ * Returns the data stored under the given role for the item referred to by the index.
+ */
+QVariant UsbUiSettingModel::data( const QModelIndex &index, int role ) const
+{
+ return mSettingsList.value( index.row() ).value( role );
+}
+
+
+/*!
+ * This is called when usb mode is changed, it only sets the personality when the given role is EditRole
+ */
+bool UsbUiSettingModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ myDebug() << ">>> UsbUiSettingModel::setData";
+ bool success = false;
+ if ( role == Qt::EditRole ) {
+ // Only allow changes on the value with role EditRole. Others are managed here.
+ switch ( index.row() ) {
+ case UsbModeList: {
+ mModelActive->SetUsbPersonality( mPersonalityIds.at( value.toInt() ) );
+ success = true;
+ // also update the rest of the model with the about to be selected mode right away
+ setNewUsbMode(mPersonalityIds.at( value.toInt() ));
+ break;
+ }
+ case DefaultMode:
+ //no break
+ case Description:
+ //no break
+ default:
+ myDebug() << " UsbUiSettingModel::setData not supported row " << index.row();
+ break;
+ }
+ }
+ myDebug() << "<<< UsbUiSettingModel::setData return " << success;
+ return success;
+}
+
+/*!
+ * Getter for the source data.
+ */
+const QModelIndex* UsbUiSettingModel::sourceData() const
+{
+ return new QModelIndex( createIndex( 0, 0 ) );
+}
+
+/*!
+ * creats the logical name of the modename string for the list
+ */
+QString UsbUiSettingModel::modeListName( int modeId )
+{
+ QString textId = TextIdPrefix + "modelistname_" + QString::number( modeId );
+ QString modeName = qtTrId( textId.toAscii() );
+ return modeName;
+}
+
+/*!
+ * Get the current USB mode (personality) ID
+ */
+int UsbUiSettingModel::currentMode()
+{
+ myDebug() << ">>> UsbUiSettingModel::CurrentMode";
+ int currentMode = mSettingsManager.readItemValue(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
+ myDebug() << "<<< UsbUiSettingModel::CurrentMode " << currentMode;
+ return currentMode;
+}
+
+/*!
+ * sets the value to different roles of the model's first row
+ */
+void UsbUiSettingModel::setDefaultModeSetting()
+{
+ QString iconName;
+ QString modeName;
+ //empty iconName and modeName are used for a hidden personality
+ if ( !isPersonalityHidden(mCurrentMode) ) {
+ iconName = ModeIconNamePrefix + QString::number( mCurrentMode ) + ".svg";
+ QString textId = TextIdPrefix + "modename_" + QString::number( mCurrentMode );
+ modeName = qtTrId( textId.toAscii() );
+ }
+
+ myDebug() << ">>> UsbUiSettingModel::setDefaultModeSetting iconName="
+ << iconName << " modeName=" << modeName;
+ QMap< int, QVariant > val = mSettingsList.at( DefaultMode );
+ if ( val.isEmpty() ) {
+ val[ SettingType ] = QVariant( DefaultMode );
+ }
+ val[ Qt::DecorationRole ] = QVariant(iconName) ;
+ val[ Qt::DisplayRole ]= QVariant(modeName) ;
+ mSettingsList.replace( DefaultMode, val );
+ myDebug() << "<<< UsbUiSettingModel::setDefaultModeSetting";
+}
+
+/*!
+ Updates all values related to the mode description.
+ */
+void UsbUiSettingModel::setDescriptionSetting()
+{
+ QString description;
+ //the description will be empty for a hidden personality
+ if ( !isPersonalityHidden(mCurrentMode) ) {
+ QString textId = TextIdPrefix + "description_"
+ + QString::number( mCurrentMode );
+ description = qtTrId( textId.toAscii() );
+ }
+ myDebug() << ">>> UsbUiSettingModel::setDescriptionSetting description="
+ << description;
+ QMap< int, QVariant > val = mSettingsList.at( Description );
+ if ( val.isEmpty() ) {
+
+ val[ SettingType ] = QVariant( Description );
+
+ }
+ // The display role stores the string representation of the actual value.
+ val[ Qt::DisplayRole ] = QVariant( description );
+ mSettingsList.replace( Description, val );
+ myDebug() << "<<< UsbUiSettingModel::setDescriptionSetting";
+}
+
+/*!
+ Updates all values related to the visibility setting.
+ Updates the selectable USB modes only in the 1st call.
+ */
+bool UsbUiSettingModel::setUsbModelistSetting( int aModeId )
+{
+ myDebug() << ">>> UsbUiSettingModel::setUsbModelistSetting aModeIndex="
+ << aModeId;
+ bool ret = true;
+ QMap< int, QVariant > val = mSettingsList.at(UsbModeList);
+ if ( val.isEmpty() ) {
+ val[ SettingType ] = QVariant( UsbModeList );
+
+ RUsb iUsbman;
+ if ( iUsbman.Connect() == KErrNone ) {
+
+ RArray<TInt> personalityIds;
+ mPersonalityIds.clear();
+ if ( iUsbman.GetPersonalityIds( personalityIds ) == KErrNone ) {
+ QStringList modeList;
+ for ( int i = 0; i < personalityIds.Count(); i++ ) {
+ if ( !isPersonalityHidden(iUsbman, personalityIds[i]) ) {
+ mPersonalityIds.append( personalityIds[i] );
+ modeList.append( modeListName( mPersonalityIds[i] ) );
+ }
+ }
+ val[ SettingsModeNameList ] = QVariant( modeList );
+ }
+ }
+ else{
+ ret = false;
+ }
+ iUsbman.Close();
+ }
+ //index will be -1 for hidden personality
+ val[ Qt::EditRole ] = QVariant( mPersonalityIds.indexOf(aModeId) );
+ mSettingsList.replace( UsbModeList, val );
+ myDebug() << "<<< UsbUiSettingModel::setUsbModelistSetting";
+ return ret;
+}
+
+/*!
+ * it checks the response from usbwatcher to see if the new mode change has been successful
+ * it will go back to the previous personality if it has not been successfull
+ */
+void UsbUiSettingModel::setPersonalityCompleted (int status )
+{
+ myDebug() << ">>> UsbUiSettingModel::setPersonalityCompleted status= "
+ << status;
+ // status contains Symbian error code from usbwatcher
+ // if the status is KErrNone, we are ready to process the next request
+ if (status != KErrNone)
+ {
+ // changing the personality failed, so we need to set back the previous personality
+ // the value will be read from central repository and also updates mCurrentMode
+ mPreviousMode = mSettingsManager.readItemValue(
+ XQSettingsKey( XQSettingsKey::TargetCentralRepository,
+ KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
+ setNewUsbMode(mPreviousMode);
+ }
+
+ // after handling the return code we know the the current personality works
+ // and we will not go back to the previous one
+ mPreviousMode = mCurrentMode;
+ myDebug() << "<<< UsbUiSettingModel::setPersonalityCompleted";
+}
+
+bool UsbUiSettingModel::isPersonalityHidden(RUsb &usbman, TInt personalityId)
+{
+ myDebug() << ">>> UsbUiSettingModel::isPersonalityHidden from USB Manager";
+ bool hidden = false;
+ TUint32 property = 0;
+ TInt ret = usbman.GetPersonalityProperty(personalityId, property);
+ if (ret == KErrNone) {
+ myDebug() << "property " << property;
+ if (property & KUsbPersonalityPropertyHidden) {
+ hidden = true;
+ }
+ }
+ myDebug() << "<<< UsbUiSettingModel::isPersonalityHidden " << hidden;
+ return hidden;
+}
+
+bool UsbUiSettingModel::isPersonalityHidden(TInt personalityId)
+{
+ return ( mPersonalityIds.indexOf(personalityId) == -1 );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbview.docml Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.1">
+ <widget name="viewMain" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <widget name="container" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0017000000000000006"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <widget name="container_1" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0016000000000000005"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <widget name="container_2" type="HbWidget">
+ <sizehint height="18.0" type="MINIMUM" width="18.0"/>
+ <sizehint height="160.0" type="PREFERRED" width="363.0"/>
+ <zvalue value="0.0018000000000000006"/>
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <layout type="anchor" widget="content">
+ <anchoritem dst="container" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container" dstEdge="TOP" spacing="0.0" src="" srcEdge="TOP"/>
+ <anchoritem dst="container" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="container_1" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container_1" dstEdge="TOP" spacing="0.0" src="container" srcEdge="BOTTOM"/>
+ <anchoritem dst="container_1" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="container_2" dstEdge="LEFT" spacing="-3.0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="container_2" dstEdge="TOP" spacing="0.0" src="container_1" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <string name="title" value="USB"/>
+ </widget>
+ <metadata>
+ <resource location="usbapplication.qrc"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/src/usbviewmanager.cpp Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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:
+*
+*/
+
+#include <hbmainwindow.h>
+#include "usbviewmanager.h"
+#include "usbmainview.h"
+
+
+UsbViewManager::UsbViewManager( HbMainWindow* mainWindow, QObject *parent )
+: QObject( parent ),
+ mWindow(mainWindow)
+ {
+ }
+
+UsbViewManager::~UsbViewManager()
+ {
+
+ }
+
+/*!
+ Create views(main view, gadget gallery view and gadget details view).
+ Add them to MainWindow.
+ */
+void UsbViewManager::addView()
+ {
+ // Create main view and add
+ mMainView = new UsbMainView( this );
+ mWindow->addView(mMainView);
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuiqt/usbapplication.pro Thu Jun 24 14:30:02 2010 +0100
@@ -0,0 +1,67 @@
+#
+# 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: Project definition file for project USB Settings Application
+#
+
+TEMPLATE = app
+TARGET = usbapplication
+QT += core \
+ gui \
+ xml
+HEADERS += inc/usbuisettingmodel.h \
+ inc/usbuimodelactive.h \
+ inc/usbviewmanager.h \
+ inc/usbmainview.h
+SOURCES += src/usbuisettingmodel.cpp \
+ src/usbuimodelactive.cpp \
+ src/usbviewmanager.cpp \
+ src/usbmainview.cpp \
+ src/main.cpp \
+ src/usbapplication_reg.rss
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+LIBS += -lcentralrepository
+LIBS += -lusbwatcher
+LIBS += -lxqsettingsmanager
+LIBS += -lusbman
+
+FORMS +=
+RESOURCES += src/usbicons.qrc \
+ src/usbapplication.qrc
+CONFIG += qt \
+ hb
+
+symbian: {
+ TARGET.UID3 = 0x2002BCA3
+ TARGET.CAPABILITY = LocalServices \
+ WriteDeviceData
+
+ # for pkg
+ usbuitranslation.sources = src/usbapplication.qm
+ usbuitranslation.path = /resource
+ DEPLOYMENT += usbuitranslation
+
+ BLD_INF_RULES.prj_exports += "./src/usbapplication.qm z:/resource/qt/translations/usbapplication.qm
+}
+
+# placeholder for creating sis file
+createsis.commands += ( makesis -v usbapplication.pkg ); \
+ && \
+ ( signsis.exe usbapplication.sis usbapplication_signed.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key ); \
+ && \
+ ( del usbapplication.sis );
+QMAKE_EXTRA_TARGETS += createsis
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \
+ "rom/usbsettingsresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsresources.iby)"