Revert incorrect RCL_3 drop: RCL_3 PDK_3.0.2
authorPat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:20:49 +0100
branchRCL_3
changeset 80 e02eb84a14d2
parent 79 25fce757be94
child 83 60826dff342d
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
sysdef_1_5_1.dtd
tsrc/group/bld.inf
tsrc/testtools/usbman_stub/group/bld.inf
tsrc/testtools/usbman_stub/logger/bwins/usbloggeru.def
tsrc/testtools/usbman_stub/logger/eabi/usbloggeru.def
tsrc/testtools/usbman_stub/logger/group/bld.inf
tsrc/testtools/usbman_stub/logger/group/usblogger.mmh
tsrc/testtools/usbman_stub/logger/group/usblogger.mmp
tsrc/testtools/usbman_stub/logger/public/usblogger.h
tsrc/testtools/usbman_stub/logger/src/usblogger.cpp
tsrc/testtools/usbman_stub/usbman/bld.inf
tsrc/testtools/usbman_stub/usbman/client/bwins/usbman_over_dummyusbdiu.def
tsrc/testtools/usbman_stub/usbman/client/bwins/usbmanu.def
tsrc/testtools/usbman_stub/usbman/client/eabi/usbmanu.def
tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub.pkg
tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.pkg
tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.sis
tsrc/testtools/usbman_stub/usbman/client/group/Usbman.mmp
tsrc/testtools/usbman_stub/usbman/client/group/bld.inf
tsrc/testtools/usbman_stub/usbman/client/inc/usbmandll_stub.h
tsrc/testtools/usbman_stub/usbman/client/public/usbman.h
tsrc/testtools/usbman_stub/usbman/client/public/usbstates.h
tsrc/testtools/usbman_stub/usbman/client/rom/usbManStubSIS.iby
tsrc/testtools/usbman_stub/usbman/client/src/RUsb.cpp
tsrc/testtools/usbman_stub/usbman/server/public/rusb.h
tsrc/testtools/usbman_stub/usbman/server/public/usbman.rh
usbclasses/group/bld.inf
usbclasses/pictbridgeengine/BWINS/pictbridgeU.DEF
usbclasses/pictbridgeengine/EABI/pictbridgeU.DEF
usbclasses/pictbridgeengine/group/bld.inf
usbclasses/pictbridgeengine/group/pictbridge.mmp
usbclasses/pictbridgeengine/inc/dps.rh
usbclasses/pictbridgeengine/inc/dpsconnectnotifier.h
usbclasses/pictbridgeengine/inc/dpsconst.h
usbclasses/pictbridgeengine/inc/dpsdefs.h
usbclasses/pictbridgeengine/inc/dpsfile.h
usbclasses/pictbridgeengine/inc/dpsfile.inl
usbclasses/pictbridgeengine/inc/dpsoperation.h
usbclasses/pictbridgeengine/inc/dpsoperation.inl
usbclasses/pictbridgeengine/inc/dpsparam.h
usbclasses/pictbridgeengine/inc/dpsparam.inl
usbclasses/pictbridgeengine/inc/dpsptpnotifier.h
usbclasses/pictbridgeengine/inc/dpsscriptreceiver.h
usbclasses/pictbridgeengine/inc/dpsscriptsender.h
usbclasses/pictbridgeengine/inc/dpsstate.h
usbclasses/pictbridgeengine/inc/dpsstatemachine.h
usbclasses/pictbridgeengine/inc/dpsstatemachine.inl
usbclasses/pictbridgeengine/inc/dpstransaction.h
usbclasses/pictbridgeengine/inc/dpstransaction.inl
usbclasses/pictbridgeengine/inc/dpsusbnotifier.h
usbclasses/pictbridgeengine/inc/dpsxmlgenerator.h
usbclasses/pictbridgeengine/inc/dpsxmlparser.h
usbclasses/pictbridgeengine/inc/dpsxmlparser.inl
usbclasses/pictbridgeengine/inc/dpsxmlstring.h
usbclasses/pictbridgeengine/inc/pictbridge.h
usbclasses/pictbridgeengine/rom/pictbridge.iby
usbclasses/pictbridgeengine/src/dps.rss
usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp
usbclasses/pictbridgeengine/src/dpsfile.cpp
usbclasses/pictbridgeengine/src/dpsoperation.cpp
usbclasses/pictbridgeengine/src/dpsparam.cpp
usbclasses/pictbridgeengine/src/dpsptpnotifier.cpp
usbclasses/pictbridgeengine/src/dpsscriptreceiver.cpp
usbclasses/pictbridgeengine/src/dpsscriptsender.cpp
usbclasses/pictbridgeengine/src/dpsstate.cpp
usbclasses/pictbridgeengine/src/dpsstatemachine.cpp
usbclasses/pictbridgeengine/src/dpstransaction.cpp
usbclasses/pictbridgeengine/src/dpsusbnotifier.cpp
usbclasses/pictbridgeengine/src/dpsxmlgenerator.cpp
usbclasses/pictbridgeengine/src/dpsxmlparser.cpp
usbclasses/pictbridgeengine/src/dpsxmlstring.cpp
usbclasses/pictbridgeengine/src/pictbridge.cpp
usbclasses/usbbasicpersonality/src/10274797.rss
usbclasses/usbbasicpersonality/src/UsbActiveBasicHandlerImp.cpp
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bmarm/UsbBasicPersonalityTestu.def
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bwins/UsbBasicPersonalityTestu.def
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/conf/UsbBasicPersonalityTest.cfg
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/eabi/UsbBasicPersonalityTestu.def
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest.mmp
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_ats.pkg
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_exe.mmp
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_phone.pkg
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_ats.bat
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_phone.bat
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/inc/UsbBasicPersonalityTest.h
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_ats.ini
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_phone.ini
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest.cpp
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTestBlocks.cpp
usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest_exe.cpp
usbclasses/usbmscpersonality/group/UsbMscPersonality.mmp
usbclasses/usbmscpersonality/src/usbms.rss
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bmarm/UsbMscPersonalityTestu.def
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bwins/UsbMscPersonalityTestu.def
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/conf/UsbMscPersonalityTest.cfg
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/eabi/UsbMscPersonalityTestu.def
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest.mmp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_ats.pkg
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_exe.mmp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_phone.pkg
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_ats.bat
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_phone.bat
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/DismountClient.h
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTest.h
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTestActiveObject.h
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.inl
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_ats.ini
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_phone.ini
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/DismountClient.cpp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest.cpp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestActiveObject.cpp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestBlocks.cpp
usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest_exe.cpp
usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp
usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h
usbclasses/usbobexclasscontroller/inc/debug.h
usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp
usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bmarm/UsbObexClassControllerTestu.def
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bwins/UsbObexClassControllerTestu.def
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/conf/UsbObexClassControllerTest.cfg
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/eabi/UsbObexClassControllerTestu.def
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest.mmp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_ats.pkg
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_exe.mmp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_phone.pkg
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_ats.bat
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_phone.bat
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/USBObexApiTestActiveObject.h
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/UsbObexClassControllerTest.h
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_ats.ini
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_phone.ini
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest.cpp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTestBlocks.cpp
usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest_exe.cpp
usbclasses/usbphoneasmodem/classcontroller/data/usbpammscfile.rss
usbclasses/usbphoneasmodem/classcontroller/group/usbmscfileclasscontroller.mmp
usbclasses/usbphoneasmodem/classcontroller/inc/usbpammscfile.rh
usbclasses/usbphoneasmodem/classcontroller/rom/usbmscfileclasscontroller.iby
usbclasses/usbphoneasmodem/classcontroller/src/usbmscfileclasscontroller.cpp
usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h
usbclasses/usbphoneasmodem/classimplementation/mscfileserver/src/filesystemimage.cpp
usbengines/usblocodplugin/group/usblocodplugin.mmp
usbengines/usblocodplugin/inc/debug.h
usbengines/usblocodplugin/inc/usblcdactive.h
usbengines/usblocodplugin/inc/usblcdplugin.h
usbengines/usblocodplugin/src/usblcdactive.cpp
usbengines/usblocodplugin/src/usblcdplugin.cpp
usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg
usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat
usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat
usbengines/usbotgwatcher/group/usbotgwatcher.mmp
usbengines/usbotgwatcher/inc/cusbindicatornotifier.h
usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp
usbengines/usbotgwatcher/src/cusbotgwatcher.cpp
usbengines/usbotgwatcher/src/cusbservicecontrol.cpp
usbengines/usbotgwatcher/src/cusbstatehostabase.cpp
usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp
usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp
usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/conf/UsbOtgWatcherTest.cfg
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest.mmp
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_ats.pkg
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/UsbOtgWatcherTest.h
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTestBlocks.cpp
usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockchbindicatorsymbian.cpp
usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg
usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat
usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat
usbengines/usbwatcher/conf/usbwatcher.confml
usbengines/usbwatcher/conf/usbwatcher_101F8801.crml
usbengines/usbwatcher/data/numberofacmfunctions.ini
usbengines/usbwatcher/group/bld.inf
usbengines/usbwatcher/group/usbwatcherserver.mmp
usbengines/usbwatcher/inc/cusbindicatorhandler.h
usbengines/usbwatcher/inc/cusbwatcher.h
usbengines/usbwatcher/inc/usbvariation.rh
usbengines/usbwatcher/loc/usbman.loc
usbengines/usbwatcher/rom/mtp_symbian_temp.iby
usbengines/usbwatcher/rom/usbacmconfiguration.hby
usbengines/usbwatcher/rom/usbmanrsc.iby
usbengines/usbwatcher/rom/usbwatcher.iby
usbengines/usbwatcher/rom/usbwatcher_resources.iby
usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp
usbengines/usbwatcher/src/cusbactivestate.cpp
usbengines/usbwatcher/src/cusbindicatorhandler.cpp
usbengines/usbwatcher/src/cusbwatcher.cpp
usbengines/usbwatcher/src/tusbindicatorhandler.cpp
usbengines/usbwatcher/src/usbman_pcs.rss
usbengines/usbwatcher/src/usbman_pcsmtp.rss
usbengines/usbwatcher/src/usbman_pcsmtppam.rss
usbengines/usbwatcher/src/usbman_pcspam.rss
usbengines/usbwatcher/tsrc/UsbWatcherTest/Bmarm/UsbWatcherTestu.def
usbengines/usbwatcher/tsrc/UsbWatcherTest/Bwins/UsbWatcherTestu.def
usbengines/usbwatcher/tsrc/UsbWatcherTest/conf/UsbWatcherTest.cfg
usbengines/usbwatcher/tsrc/UsbWatcherTest/eabi/UsbWatcherTestu.def
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest.mmp
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_ats.pkg
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_phone.pkg
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_ats.bat
usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_phone.bat
usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTest.h
usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTestDebug.inl
usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.h
usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.inl
usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_ats.ini
usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_phone.ini
usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest.cpp
usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTestBlocks.cpp
usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest_exe.cpp
usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bmarm/UsbPersonalityPluginTestu.def
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bwins/UsbPersonalityPluginTestu.def
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/conf/UsbPersonalityPluginTest.cfg
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/eabi/UsbPersonalityPluginTestu.def
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest.mmp
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_ats.pkg
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_exe.mmp
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_phone.pkg
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_ats.bat
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_phone.bat
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginActiveObject.h
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTest.h
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTestDebug.inl
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.h
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.inl
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_ats.ini
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_phone.ini
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginActiveObject.cpp
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest.cpp
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTestBlocks.cpp
usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest_exe.cpp
usbservices_plat/usb_watcher_api/inc/usbpersonalityids.h
usbuis/group/bld.inf
usbuis/imageprintui/src/notes.cpp
usbuis/imageprintui/src/settingscontainer.cpp
usbuis/usbindicatorplugin/inc/usbaddressedindicator.h
usbuis/usbindicatorplugin/inc/usbdebug.h
usbuis/usbindicatorplugin/inc/usbdisconnectingindicator.h
usbuis/usbindicatorplugin/inc/usbindicator.h
usbuis/usbindicatorplugin/inc/usbindicatorplugin.h
usbuis/usbindicatorplugin/inc/usbmassstorageindicator.h
usbuis/usbindicatorplugin/rom/usbindicatorplugin.iby
usbuis/usbindicatorplugin/rom/usbindicatorpluginresources.iby
usbuis/usbindicatorplugin/src/usbaddressedindicator.cpp
usbuis/usbindicatorplugin/src/usbdisconnectingindicator.cpp
usbuis/usbindicatorplugin/src/usbindicator.cpp
usbuis/usbindicatorplugin/src/usbindicatorplugin.cpp
usbuis/usbindicatorplugin/src/usbmassstorageindicator.cpp
usbuis/usbindicatorplugin/usbindicatorplugin.pro
usbuis/usbsettingsapp/USBSettingsApp.pro
usbuis/usbsettingsapp/inc/ui_USBSettingsApp.h
usbuis/usbsettingsapp/inc/usbdebug.h
usbuis/usbsettingsapp/inc/usbsettingsapp.h
usbuis/usbsettingsapp/inc/usbuimodelactive.h
usbuis/usbsettingsapp/inc/usbuisettingmodel.h
usbuis/usbsettingsapp/rom/usbsettingsapp.iby
usbuis/usbsettingsapp/rom/usbsettingsappresources.iby
usbuis/usbsettingsapp/src/USBSettingsApp.ui
usbuis/usbsettingsapp/src/hblistviewitem.css
usbuis/usbsettingsapp/src/hblistviewitem.widgetml
usbuis/usbsettingsapp/src/main.cpp
usbuis/usbsettingsapp/src/usbsettinglayout.qrc
usbuis/usbsettingsapp/src/usbsettingsapp.cpp
usbuis/usbsettingsapp/src/usbsettingsapp.docml
usbuis/usbsettingsapp/src/usbsettingsapp.qrc
usbuis/usbsettingsapp/src/usbsettingsapp.ts
usbuis/usbsettingsapp/src/usbuimodelactive.cpp
usbuis/usbsettingsapp/src/usbuisettingmodel.cpp
usbuis/usbui/USBClassChangeUIPlugin/data/1020E472.rss
usbuis/usbui/USBClassChangeUIPlugin/data/USBClassChangeUIPlugin.rss
usbuis/usbui/USBClassChangeUIPlugin/group/USBClassChangeUIPlugin.mmp
usbuis/usbui/USBClassChangeUIPlugin/group/bld.inf
usbuis/usbui/USBClassChangeUIPlugin/group/usbuiplugin_icons_dc.mk
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.hrh
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginCRWatcher.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginContainer.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginDebug.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.inl
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginModel.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h
usbuis/usbui/USBClassChangeUIPlugin/inc/USBDeviceStateWatcher.h
usbuis/usbui/USBClassChangeUIPlugin/inc/usbotghoststatewatcher.h
usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginCRWatcher.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginImplementationTable.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginModel.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginView.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/USBDeviceStateWatcher.cpp
usbuis/usbui/USBClassChangeUIPlugin/src/usbotghoststatewatcher.cpp
usbuis/usbui/aif/USBClassChangeUI_caption.rss
usbuis/usbui/aif/USBClassChangeUIaif.rss
usbuis/usbui/data/USBClassChangeUI.rss
usbuis/usbui/data/USBClassChangeUI_reg.rss
usbuis/usbui/group/USBClassChangeUI.mmp
usbuis/usbui/group/bld.inf
usbuis/usbui/group/usbui_Icons_aif_scalable_dc.mk
usbuis/usbui/group/usbui_icons_aif_bitmaps_dc.mk
usbuis/usbui/help/data/xhtml.zip
usbuis/usbui/help/group/bld.inf
usbuis/usbui/help/inc/usb.hlp.hrh
usbuis/usbui/help/rom/usbuihelps_variant.iby
usbuis/usbui/inc/USBClassChangeUI.h
usbuis/usbui/inc/USBClassChangeUIApp.h
usbuis/usbui/inc/USBClassChangeUIAppUi.h
usbuis/usbui/inc/USBClassChangeUIDebug.h
usbuis/usbui/inc/USBClassChangeUIDocument.h
usbuis/usbui/loc/USBClassChangeUI.loc
usbuis/usbui/rom/USBClassChangeUI.iby
usbuis/usbui/rom/USBClassChangeUIResources.iby
usbuis/usbui/src/USBClassChangeUIApp.cpp
usbuis/usbui/src/USBClassChangeUIAppui.cpp
usbuis/usbui/src/USBClassChangeUIDocument.cpp
usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def
usbuis/usbui/tsrc/usbuiapitest/bwins/usbuiapitestu.def
usbuis/usbui/tsrc/usbuiapitest/conf/ui_usbuiapitest.cfg
usbuis/usbui/tsrc/usbuiapitest/eabi/usbuiapitestu.def
usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf
usbuis/usbui/tsrc/usbuiapitest/group/build_sis_ats.bat
usbuis/usbui/tsrc/usbuiapitest/group/build_sis_phone.bat
usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.mmp
usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.pkg
usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest_phone.pkg
usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h
usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl
usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini
usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini
usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp
usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp
usbuis/usbuinotif/BWINS/usbavkonnotifu.def
usbuis/usbuinotif/data/102068DC.rss
usbuis/usbuinotif/data/usbuinotif.rss
usbuis/usbuinotif/eabi/usbavkonnotifu.def
usbuis/usbuinotif/group/bld.inf
usbuis/usbuinotif/group/usbavkonnotif.mmp
usbuis/usbuinotif/group/usbuinotif.mmp
usbuis/usbuinotif/inc/usbnotifier.h
usbuis/usbuinotif/inc/usbuincableconnectednotifier.h
usbuis/usbuinotif/inc/usbuinotifdialerwatcher.h
usbuis/usbuinotif/inc/usbuinotifmsmmerror.h
usbuis/usbuinotif/inc/usbuinotifotgerror.h
usbuis/usbuinotif/inc/usbuinotifotgwarning.h
usbuis/usbuinotif/inc/usbuinqueriesnotifier.h
usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h
usbuis/usbuinotif/loc/usbuinotif.loc
usbuis/usbuinotif/rom/usbuinotif.iby
usbuis/usbuinotif/rom/usbuinotifresources.iby
usbuis/usbuinotif/src/usbavkonmain.cpp
usbuis/usbuinotif/src/usbnotifier.cpp
usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp
usbuis/usbuinotif/src/usbuinmain.cpp
usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp
usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp
usbuis/usbuinotif/src/usbuinotifotgerror.cpp
usbuis/usbuinotif/src/usbuinotifotgwarning.cpp
usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp
usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg
usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis.bat
usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat
usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp
usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h
usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl
usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp
usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp
usbuis/usbuinotif/usbuinotif.pro
--- a/layers.sysdef.xml	Tue Aug 31 16:13:57 2010 +0300
+++ b/layers.sysdef.xml	Wed Sep 01 12:20:49 2010 +0100
@@ -1,24 +1,20 @@
 <?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
   <!ENTITY layer_real_source_path "sf/mw/usbservices" >
 ]>
 
-<SystemDefinition name="usbservices" schema="1.5.1">
+<SystemDefinition name="usbservices" schema="1.4.0">
   <systemModel>
     <layer name="mw_layer">
       <module name="usbservices">
         <unit unitID="lcdo.usbservices" mrp="" bldFile="&layer_real_source_path;/group" name="usbservices" />
       </module>
-      <module name="non_sf_components">
+      <module name="">
         <unit unitID="lcdo.usbservices.usbclasses.usbosdescriptorhandler" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbosdescriptorhandler/group" filter="!sf_build" name="usbservices_usbclasses_usbosdescriptorhandler" />
         <unit unitID="lcdo.usbservices.usbclasses.msmmplugin" mrp="" bldFile="&layer_real_source_path;/usbclasses/msmmplugin/group" filter="!sf_build" name="usbservices_usbclasses_msmmplugin" />
         <unit unitID="lcdo.usbservices.usbclasses.usbhidclassdriver" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbhidclassdriver/group" filter="!sf_build" name="usbservices_usbclasses_usbhidclassdriver" />
-      </module>
-      <module name="usbqtui">
-        <unit unitID="lcdo.usbservices.usbuis.usbsettingsapp" mrp="" bldFile="&layer_real_source_path;/usbuis/usbsettingsapp" name="usbservices_usbuis_usbsettingsapp" proFile="USBSettingsApp.pro" qmakeArgs="-r" />
-        <unit unitID="lcdo.usbservices.usbuis.usbindicatorplugin" mrp="" bldFile="&layer_real_source_path;/usbuis/usbindicatorplugin" name="usbservices_usbuis_usbindicatorplugin" proFile="usbindicatorplugin.pro" qmakeArgs="-r" />
-        <unit unitID="lcdo.usbservices.usbuis.usbuinotif" mrp="" bldFile="&layer_real_source_path;/usbuis/usbuinotif" name="usbservices_usbuis_usbuinotif" proFile="usbuinotif.pro" qmakeArgs="-r" />
-     </module>
+        <unit unitID="lcdo.usbservices.usbuis.rndisui" mrp="" bldFile="&layer_real_source_path;/usbuis/rndisui/group" filter="!sf_build" name="usbservices_usbuis_rndisui" />
+      </module>      
     </layer>
     <layer name="api_test_layer">
       <module name="usbservices_test">
--- a/package_definition.xml	Tue Aug 31 16:13:57 2010 +0300
+++ b/package_definition.xml	Wed Sep 01 12:20:49 2010 +0100
@@ -11,6 +11,9 @@
       <component id="usbmscpersonality" filter="s60" name="USB MSC Personality" class="plugin">
         <unit bldFile="usbclasses/usbmscpersonality/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>
@@ -33,6 +36,12 @@
       </component>
     </collection>
     <collection id="usbuis" name="USB UIs" level="specific">
+      <component id="usbui" filter="s60" name="USB UI">
+        <unit bldFile="usbuis/usbui/group"/>
+      </component>
+      <component id="usbuinotif" filter="s60" name="USB UI Notifiers">
+        <unit bldFile="usbuis/usbuinotif/group"/>
+      </component>
       <component id="imageprintuiprovider" filter="s60" name="ImagePrint UI Provider" class="plugin">
         <unit bldFile="usbuis/imageprintuiprovider/group"/>
       </component>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,86 @@
+ <!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>  
--- a/sysdef_1_5_1.dtd	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +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
-  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	Tue Aug 31 16:13:57 2010 +0300
+++ b/tsrc/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -20,13 +20,29 @@
 DEFAULT
 
 //build files for Stub Framework
-#include "../testtools/stubsrv/group/bld.inf"
+
+
+//build files for shortlinkconn
+#include "../../../shortlinkconn/localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/group/bld.inf"
+#include "../../../shortlinkconn/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf"
+
 //build files for usb
-#include "../../usbclasses/msmmplugin/tsrc/MsmmPluginTest/group/bld.inf"
+#include "../../usbuis/usbui/tsrc/USBUiApiTest/group/bld.inf"
 #include "../../usbuis/usbuinotif/tsrc/USBUiNotifApiTest/group/bld.inf"
+
 #include "../../usbclasses/usbhidclassdriver/tsrc/UsbHidClassDriverTest/group/bld.inf"
-#include "../../usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/bld.inf"
+#include "../../usbclasses/msmmplugin/tsrc/MsmmPluginTest/group/bld.inf"
+#include "../../usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf"
+//#include "../../usbclasses/usbosdescriptorhandler/tsrc/UsbOsDescriptorHandlerTest/group/bld.inf"
+//#include "../../usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf"
+#include "../../usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf"
 
+//#include "../../usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/bld.inf"
+#include "../../usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/bld.inf"
+#include "../../usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/bld.inf"
+//#include "../../usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf"
+
+#include "../../usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf"
 
 PRJ_EXPORTS
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,19 @@
+/*
+* 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:
+*
+*/
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/bwins/usbloggeru.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,17 @@
+EXPORTS
+	??0TFunctionLogger@@QAE@ABVTDesC8@@0PAX@Z @ 1 NONAME ; TFunctionLogger::TFunctionLogger(class TDesC8 const &, class TDesC8 const &, void *)
+	??1TFunctionLogger@@QAE@XZ @ 2 NONAME ; TFunctionLogger::~TFunctionLogger(void)
+	?Close@CUsbLog@@SAXXZ @ 3 NONAME ; void CUsbLog::Close(void)
+	?Connect@CUsbLog@@SAHXZ @ 4 NONAME ; int CUsbLog::Connect(void)
+	?HexDump@CUsbLog@@SAXABVTDesC8@@PBG1PBEH@Z @ 5 NONAME ; void CUsbLog::HexDump(class TDesC8 const &, unsigned short const *, unsigned short const *, unsigned char const *, int)
+	?VerboseLeaveIfErrorL@@YAXABVTDesC8@@PADHH@Z @ 6 NONAME ; void VerboseLeaveIfErrorL(class TDesC8 const &, char *, int, int)
+	?VerbosePanic@@YAXABVTDesC8@@PADHHPAEABVTDesC16@@@Z @ 7 NONAME ; void VerbosePanic(class TDesC8 const &, char *, int, int, unsigned char *, class TDesC16 const &)
+	?Write@CUsbLog@@SAXABVTDesC8@@0@Z @ 8 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC8 const &)
+	?Write@CUsbLog@@SAXABVTDesC8@@ABVTDesC16@@@Z @ 9 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC16 const &)
+	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@AAY00PAC@Z @ 10 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC16 const >, signed char * [1] &)
+	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 11 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC16 const >, ...)
+	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@AAY00PAC@Z @ 12 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC8 const >, signed char * [1] &)
+	?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 13 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue<class TDesC8 const >, ...)
+	?VerboseLeaveL@@YAXABVTDesC8@@PADHH@Z @ 14 NONAME ; void VerboseLeaveL(class TDesC8 const &, char *, int, int)
+	?VerboseMsgPanic@@YAXABVTDesC8@@PADHABVRMessage2@@ABVTDesC16@@H@Z @ 15 NONAME ; void VerboseMsgPanic(class TDesC8 const &, char *, int, class RMessage2 const &, class TDesC16 const &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/eabi/usbloggeru.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,19 @@
+EXPORTS
+	_Z12VerbosePanicRK6TDesC8PciiPhRK7TDesC16 @ 1 NONAME
+	_Z20VerboseLeaveIfErrorLRK6TDesC8Pcii @ 2 NONAME
+	_ZN15TFunctionLoggerC1ERK6TDesC8S2_Pv @ 3 NONAME
+	_ZN15TFunctionLoggerC2ERK6TDesC8S2_Pv @ 4 NONAME
+	_ZN15TFunctionLoggerD1Ev @ 5 NONAME
+	_ZN15TFunctionLoggerD2Ev @ 6 NONAME
+	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16ERSt9__va_list @ 7 NONAME
+	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16Ez @ 8 NONAME
+	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_ERSt9__va_list @ 9 NONAME
+	_ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_Ez @ 10 NONAME
+	_ZN7CUsbLog5CloseEv @ 11 NONAME
+	_ZN7CUsbLog5WriteERK6TDesC8RK7TDesC16 @ 12 NONAME
+	_ZN7CUsbLog5WriteERK6TDesC8S2_ @ 13 NONAME
+	_ZN7CUsbLog7ConnectEv @ 14 NONAME
+	_ZN7CUsbLog7HexDumpERK6TDesC8PKtS4_PKhi @ 15 NONAME
+	_Z13VerboseLeaveLRK6TDesC8Pcii @ 16 NONAME
+	_Z15VerboseMsgPanicRK6TDesC8PciRK9RMessage2RK7TDesC16i @ 17 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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:
+* Logging engine for USB.
+*
+*/
+
+/**
+ @file
+*/
+
+PRJ_TESTEXPORTS
+//../public/usblogger.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usblogger.h)
+//usblogger.mmh					/epoc32/include/usb/usblogger.mmh
+
+PRJ_TESTMMPFILES
+//usblogger.MMP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/group/usblogger.mmh	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* 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:
+* Logging engine for USB.
+*
+*/
+
+// Uncomment next line to temporarily engage logging for release builds.
+#define __FLOGGER_UREL
+// Comment next line to temporarily disengage logging for debug builds
+#define __FLOGGER_UDEB
+
+// Determine whether, and how, flogger is to be included
+#ifdef __FLOGGER_UREL
+	#ifdef __FLOGGER_UDEB
+	#define __FLOGGER_INCLUDED
+	MACRO __FLOG_UREL
+	#endif
+#endif
+#ifdef __FLOGGER_UREL
+	#ifndef __FLOGGER_UDEB
+	#define __FLOGGER_INCLUDED
+	MACRO __FLOG_UREL
+	MACRO __FLOG_NO_UDEB
+	#endif
+#endif
+#ifndef __FLOGGER_UREL
+	#ifndef __FLOGGER_UDEB
+	MACRO __FLOG_NO_UDEB
+	#endif
+#endif
+#ifndef __FLOGGER_UREL
+	#ifdef __FLOGGER_UDEB
+	#define __FLOGGER_INCLUDED
+	#define __FLOGGER_DEBUGGERLIBRARY
+	#endif
+#endif
+
+
+#ifdef __FLOGGER_INCLUDED
+	#ifndef __FLOGGER_SUPPRESS_LIBRARY
+		#ifdef __FLOGGER_DEBUGGERLIBRARY
+			DEBUGLIBRARY usblogger.lib
+		#else
+			LIBRARY usblogger.lib
+		#endif
+	#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/group/usblogger.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:
+* Logging engine for USB.
+*
+*/
+
+/**
+ @file
+*/
+
+target usblogger.dll
+
+CAPABILITY All -Tcb
+TARGETTYPE	dll
+
+uid			0x1000008d 0x10281A7D
+
+// MACRO __USB_DEBUG_RDEBUG__
+// Define this macro to get output through the serial port (COM0) 
+
+SOURCEPATH 	../src
+SOURCE 		usblogger.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+library			euser.lib
+
+VENDORID 0x70000001
+
+#include <comms-infras/commsdebugutility.mmh>
+
+UNPAGED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/public/usblogger.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,184 @@
+/*
+* 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:
+* Logging engine for USB.
+*
+*/
+
+/**
+ @file
+ @internalTechnology
+*/
+
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include <e32base.h>
+
+// Control function entry and exit logging using a compile-time switch.
+#define __LOG_FUNCTIONS__
+
+class TFunctionLogger;
+
+#ifndef __COMMSDEBUGUTILITY_H__		// comms-infras/commsdebugutility.h not included
+#ifdef _DEBUG						// If this is a debug build...
+// Set flogging active.
+#define __FLOG_ACTIVE
+#endif
+#endif
+
+#ifdef __FLOG_ACTIVE
+#define IF_FLOGGING(a) a
+#else
+#define IF_FLOGGING(a)
+#endif
+
+_LIT8(KDefaultLogFile, "USB");
+
+#ifdef __FLOG_ACTIVE
+#define LEAVEIFERRORL(a)				VerboseLeaveIfErrorL(KLogComponent, __FILE__, __LINE__, a)
+#define LEAVEL(a)						VerboseLeaveL(KLogComponent, __FILE__, __LINE__, a)
+#define _USB_PANIC(CAT, CODE) 			VerbosePanic(KLogComponent, __FILE__, __LINE__, CODE, (TText8*)#CODE, CAT)
+#define PANIC_MSG(msg, cat, code)		VerboseMsgPanic(KLogComponent, __FILE__, __LINE__, msg, cat, code);
+#define FLOG(a)							CUsbLog::Write(KDefaultLogFile, a);
+#define FTRACE(a)						{a;}
+#define LOGTEXT(text)						CUsbLog::Write(KLogComponent, text);
+#define LOGTEXT2(text, a)					CUsbLog::WriteFormat(KLogComponent, text, a);
+#define LOGTEXT3(text, a, b)				CUsbLog::WriteFormat(KLogComponent, text, a, b);
+#define LOGTEXT4(text, a, b, c)				CUsbLog::WriteFormat(KLogComponent, text, a, b, c);
+#define LOGTEXT5(text, a, b, c, d)			CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d);
+#define LOGTEXT6(text, a, b, c, d, e)		CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e);
+#define LOGTEXT7(text, a, b, c, d, e, f)	CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e, f);
+#define LOGHEXDESC(desc)				CUsbLog::HexDump(KLogComponent, 0, 0, desc.Ptr() , desc.Length());
+#define LOGHEXRAW(data, len)			CUsbLog::HexDump(KLogComponent, 0, 0, data, len);
+#else
+#define LEAVEIFERRORL(a)				static_cast<void>(User::LeaveIfError(a))
+#define LEAVEL(a)						User::Leave(a)
+#define _USB_PANIC(CAT, CODE) 			User::Panic(CAT, CODE)
+#define PANIC_MSG(msg, cat, code)		msg.Panic(cat, code);
+#define FLOG(a)
+#define FTRACE(a)
+#define LOGTEXT(text)
+#define LOGTEXT2(text, a)
+#define LOGTEXT3(text, a, b)
+#define LOGTEXT4(text, a, b, c)
+#define LOGTEXT5(text, a, b, c, d)			
+#define LOGTEXT6(text, a, b, c, d, e)		
+#define LOGTEXT7(text, a, b, c, d, e, f)
+#define LOGHEXDESC(desc)
+#define LOGHEXRAW(data, len)
+#endif // __FLOG_ACTIVE
+
+#define FORCED_LOG_FUNC					TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)this);
+#define FORCED_LOG_STATIC_FUNC_ENTRY	TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)NULL);
+
+#if ( defined __FLOG_ACTIVE && defined __LOG_FUNCTIONS__ )
+#define LOG_LINE						CUsbLog::Write(KLogComponent, KNullDesC8());
+#define LOG_FUNC						FORCED_LOG_FUNC
+#define LOG_STATIC_FUNC_ENTRY			FORCED_LOG_STATIC_FUNC_ENTRY
+#else
+#define LOG_LINE
+#define LOG_FUNC
+#define LOG_STATIC_FUNC_ENTRY
+#endif
+
+
+
+NONSHARABLE_CLASS(CUsbLog) : public CBase
+	{
+public:
+	IMPORT_C static TInt Connect();
+	IMPORT_C static void Close();
+	
+	IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC8& aText);
+	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC8> aFmt, ...);
+	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC8> aFmt, VA_LIST& aList);
+	IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC16& aText);
+	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC16> aFmt, ...);
+	IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue<const TDesC16> aFmt, VA_LIST& aList);
+	IMPORT_C static void HexDump(const TDesC8& aCmpt, const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen);
+	};
+
+
+#ifndef NO_FPRINT
+inline void FPrint(const TRefByValue<const TDesC> IF_FLOGGING(aFmt), ...)
+	{
+#ifdef __FLOG_ACTIVE
+	VA_LIST list;
+	VA_START(list,aFmt);
+	CUsbLog::WriteFormat(KDefaultLogFile, aFmt, list);
+#endif
+	}
+#endif
+
+
+#ifndef NO_FHEX_PTR
+inline void FHex(const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen))
+	{
+#ifdef __FLOG_ACTIVE
+	CUsbLog::HexDump(KDefaultLogFile, 0, 0, aPtr, aLen);
+#endif
+	}
+#endif
+
+
+#ifndef NO_FHEX_DESC
+inline void FHex(const TDesC8& IF_FLOGGING(aDes))
+	{
+#ifdef __FLOG_ACTIVE
+	FHex(aDes.Ptr(), aDes.Length());
+#endif
+	}
+#endif
+
+
+IMPORT_C void VerboseLeaveIfErrorL(const TDesC8& aCpt, 
+						  char* aFile, 
+						  TInt aLine, 
+						  TInt aReason);
+						  
+IMPORT_C void VerboseLeaveL(const TDesC8& aCpt, 
+						  char* aFile, 
+						  TInt aLine, 
+						  TInt aReason);
+						  
+IMPORT_C void VerbosePanic(const TDesC8& aCpt, 
+				  char* aFile, 
+				  TInt aLine, 
+				  TInt aPanicCode, 
+				  TText8* aPanicName,
+				  const TDesC& aPanicCategory);
+
+IMPORT_C void VerboseMsgPanic(const TDesC8& aCpt, 
+								char* aFile, 
+								TInt  aLine,
+								const RMessage2& aMsg,
+								const TDesC& aCat, 
+								TInt  aPanicCode);
+
+
+NONSHARABLE_CLASS(TFunctionLogger)
+	{
+public:
+	IMPORT_C TFunctionLogger(const TDesC8& aCpt, const TDesC8& aString, TAny* aThis);
+	IMPORT_C ~TFunctionLogger();
+	
+private:
+	TPtrC8 iCpt;
+	TPtrC8 iString;
+	};
+
+#endif	// LOGGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/logger/src/usblogger.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,601 @@
+/*
+* 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:
+* Logging engine for USB.
+*
+*/
+
+/**
+ @file
+ @internalTechnology
+*/
+
+
+#include <e32base.h>
+#include <comms-infras/commsdebugutility.h>
+#include <usb/usblogger.h>
+
+
+#ifdef __USB_DEBUG_RDEBUG__
+#include <e32debug.h>
+const TInt KUSBLogBufferSize=255;
+class TUSBFlogOverflow8  : public TDes8Overflow
+     {
+public:
+     void Overflow(TDes8& /*aDes*/) { }
+     };
+
+class TUSBFlogOverflow16  : public TDes16Overflow
+     {
+public:
+     void Overflow(TDes16& /*aDes*/) { }
+     };
+void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin);
+#endif //__USB_DEBUG_RDEBUG__
+
+
+
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KSubsystem, "USB");
+_LIT8(KLogCmpt, "logengine");
+#endif
+
+
+NONSHARABLE_CLASS(TLogData)
+	{
+	public:
+#ifdef __FLOG_ACTIVE
+		TLogData();
+
+		void SetLogTags(const TDesC8& aCmpt);
+
+		TInt iAccessCount;
+
+		RFileLogger iLogEngine;
+		TBuf8<KMaxTagLength> iCurrentComponent;
+#endif
+	};
+
+
+#ifdef __FLOG_ACTIVE
+TLogData::TLogData()
+	: iAccessCount(0), iCurrentComponent(KNullDesC8)
+	{}
+
+void TLogData::SetLogTags(const TDesC8& aCmpt)
+	{
+	if (aCmpt != iCurrentComponent)
+		{
+		iLogEngine.SetLogTags(KSubsystem, aCmpt.Left(KMaxTagLength));
+		iCurrentComponent = aCmpt.Left(KMaxTagLength);
+		}
+	}
+#endif
+
+#define GETLOG TLogData* __logger = static_cast<TLogData*>(Dll::Tls());
+
+
+
+EXPORT_C /*static*/ TInt CUsbLog::Connect()
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+	if (!__logger)
+		{
+
+		CUsbLog::Write(KLogCmpt, _L8("Opening new logger connection"));
+		__logger = new TLogData();
+		if (!__logger)
+			{
+			CUsbLog::Write(KLogCmpt, _L8("Opening logger connection failed, no memory"));
+			return KErrNoMemory;
+			}
+
+		__logger->iLogEngine.Connect();
+		Dll::SetTls(__logger);
+		}
+
+	__logger->iAccessCount++;
+	CUsbLog::WriteFormat(KLogCmpt, _L8("Opening -- %d instances now open"), __logger->iAccessCount);
+
+	return KErrNone;
+#else
+	return KErrNotSupported;
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::Close()
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+	if (__logger)
+		{
+		TInt& count = __logger->iAccessCount;
+
+		if (count)
+			{
+			count--;
+			CUsbLog::WriteFormat(KLogCmpt, _L8("Closing -- %d instance(s) left open"), count);
+			if (!count)
+				{
+				__logger->iLogEngine.Close();
+				delete __logger;
+				Dll::SetTls(NULL);
+				CUsbLog::Write(KLogCmpt, _L8("Fully closed and deleted, now flogging statically."));
+				}
+			}
+		else
+			{
+			CUsbLog::Write(KLogCmpt, _L8("Not closing -- not opened"));
+			}
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC8& IF_FLOGGING(aText))
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TBuf8<KUSBLogBufferSize> buf;
+		RThread thread;
+		buf.AppendFormat(_L8("%S\t%S\t%LX\t%S\r\n"), &KSubsystem(), &aCmpt, thread.Id().Id(), &aText);
+		RDebug::RawPrint(buf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.Write(aText);
+		}
+	else
+		{
+		RFileLogger::Write(KSubsystem, aCmpt, aText);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC8> IF_FLOGGING(aFmt), ...)
+	{
+#ifdef __FLOG_ACTIVE
+	VA_LIST list;
+	VA_START(list, aFmt);
+
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TUSBFlogOverflow8 objFlogBody8;
+		TBuf8<KUSBLogBufferSize> buf;
+		RThread thread;
+		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
+		buf.AppendFormatList(aFmt, list, &objFlogBody8);
+		buf.Append(_L8("\r\n"));
+		RDebug::RawPrint(buf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.WriteFormat(aFmt, list);
+		}
+	else
+		{
+		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC8> IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList))
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TUSBFlogOverflow8 objFlogBody8;
+		TBuf8<KUSBLogBufferSize> buf;
+		RThread thread;
+		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
+		buf.AppendFormatList(aFmt, aList, &objFlogBody8);
+		buf.Append(_L8("\r\n"));
+		RDebug::RawPrint(buf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.WriteFormat(aFmt, aList);
+		}
+	else
+		{
+		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC16& IF_FLOGGING(aText))
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TBuf16<KUSBLogBufferSize> buf;
+		buf.AppendFormat(_L16("(TDesC16): %S\r\n"), &aText);
+		RDebug::RawPrint(buf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.Write(aText);
+		}
+	else
+		{
+		RFileLogger::WriteFormat(KSubsystem, aCmpt, aText);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC16> IF_FLOGGING(aFmt), ...)
+	{
+#ifdef __FLOG_ACTIVE
+	VA_LIST list;
+	VA_START(list, aFmt);
+
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TUSBFlogOverflow16 objFlogBody16;
+		TBuf16<KUSBLogBufferSize> wideBuf;
+		wideBuf.Append(_L16("(TDesC16): "));
+		wideBuf.AppendFormatList(aFmt, list, &objFlogBody16);
+		wideBuf.Append(_L16("\r\n"));
+		RDebug::RawPrint(wideBuf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.WriteFormat(aFmt, list);
+		}
+	else
+		{
+		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue<const TDesC16> IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList))
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+		TUSBFlogOverflow16 objFlogBody16;
+		TBuf16<KUSBLogBufferSize> wideBuf;
+		wideBuf.Append(_L16("(TDesC16): "));
+		wideBuf.AppendFormatList(aFmt, aList, &objFlogBody16);
+		wideBuf.Append(_L16("\r\n"));
+		RDebug::RawPrint(wideBuf);
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.WriteFormat(aFmt, aList);
+		}
+	else
+		{
+		RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList);
+		}
+#endif
+	}
+
+
+EXPORT_C /*static*/ void CUsbLog::HexDump(const TDesC8& IF_FLOGGING(aCmpt), const TText* IF_FLOGGING(aHeader), const TText* IF_FLOGGING(aMargin), const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen))
+	{
+#ifdef __FLOG_ACTIVE
+	GETLOG;
+
+#ifdef __USB_DEBUG_RDEBUG__
+	__CUsbLog_DoHexDump(aCmpt, TPtrC8(aPtr, aLen), TPtrC8(NULL,0), TPtrC8(NULL,0));
+#endif // __USB_DEBUG_RDEBUG
+
+	if (__logger)
+		{
+		__logger->SetLogTags(aCmpt);
+		__logger->iLogEngine.HexDump(aHeader, aMargin, aPtr, aLen);
+		}
+	else
+		{
+		RFileLogger::HexDump(KSubsystem, aCmpt, TPtrC8(aPtr, aLen), KNullDesC8);
+		}
+#endif
+	}
+
+
+#ifdef __USB_DEBUG_RDEBUG__
+
+#define BLANK	_S("")
+const TInt KHexDumpWidth=16;			///< Number of bytes written per line when formatting as hex.
+const TInt KLowestPrintableCharacter = 32; ///< In Hex output, replace chars below space with a dot.
+const TInt KHighestPrintableCharacter = 126; ///< In Hex output, replace chars above 7-bits with a dot.
+
+_LIT8(KFirstFormatString8,"%04x : ");   ///< Format string used in Hexdump to format first part: header and byte numbers.
+_LIT8(KSecondFormatString8,"%02x ");      ///< Format string used in Hexdump to format mid part: each of the 16 bytes as hex
+_LIT8(KThirdFormatString8,"%c");          ///< Format string used in Hexdump to format the last part: each of the 16 bytes as characters
+_LIT8(KThreeSpaces8,"   ");               ///< Format string used in Hexdump to define padding between first and mid parts
+_LIT8(KTwoSpaces8," ");                   ///< Format string used in Hexdump to define padding between hex and char bytes.
+const TText8 KFullStopChar8='.';
+
+void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin)
+	{
+#ifdef __FLOG_ACTIVE
+	HBufC8* marginStr = NULL;
+	TBuf8<KMaxHexDumpWidth> buf;
+	TInt aRemainingLen = aData.Length();
+	TInt aHeaderLen = aHeader.Length();
+	TUSBFlogOverflow8 objFlogBody8;
+
+	if (aData.Length()==0)		// nothing to do
+		{
+		return;
+		}
+
+
+	if (aHeaderLen > 0)
+		{
+
+		if (aMargin.Length() == 0)
+			{
+			marginStr = HBufC8::New(aHeader.Length());
+			if (marginStr == NULL)
+				{
+				return;		// abort if No memory
+				}
+			TPtr8 marginStrPtr(marginStr->Des());
+			marginStrPtr.AppendFill(' ',aHeader.Length());
+			}
+		else
+			{
+			marginStr = aMargin.Alloc();
+			}
+		}
+
+
+
+	TUint blockStartPos = 0;
+	while (aRemainingLen>0)
+		{
+		RThread thread;
+		buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id());
+		TInt blockLength = (aRemainingLen>KHexDumpWidth ? KHexDumpWidth : aRemainingLen);
+
+		// write the header/margin and print in hex which bytes we are about to write
+		if (blockStartPos == 0)
+			{
+			if (aHeaderLen > 0)
+				{
+				buf.Append(aHeader);
+				}
+			buf.AppendFormat(KFirstFormatString8,&objFlogBody8, blockStartPos);
+			}
+		else
+			{
+			if (marginStr)
+				{
+				buf.Append(*marginStr);
+				}
+			buf.AppendFormat(KFirstFormatString8,&objFlogBody8,blockStartPos);
+			}
+
+		TInt bytePos;
+		// write the bytes as hex
+		for (bytePos = 0; bytePos < blockLength; bytePos++)
+			{
+			buf.AppendFormat(KSecondFormatString8,aData[blockStartPos + bytePos]);
+			}
+		while (bytePos++ < KHexDumpWidth)
+			{
+			buf.Append(KThreeSpaces8);
+			}
+		buf.Append(KTwoSpaces8);
+		// print the bytes as characters, or full stops if outside printable range
+		for (bytePos = 0; bytePos < blockLength; bytePos++)
+			{
+			buf.AppendFormat(KThirdFormatString8,(aData[blockStartPos + bytePos] < KLowestPrintableCharacter || aData[blockStartPos + bytePos] > KHighestPrintableCharacter) ? KFullStopChar8 : aData[blockStartPos + bytePos]);
+			}
+
+		buf.Append(_L8("\r\n"));
+		RDebug::RawPrint(buf);
+
+		buf.SetLength(0);
+		aRemainingLen -= blockLength;
+		blockStartPos += blockLength;
+		}
+	delete marginStr;
+#endif // __FLOG_ACTIVE
+	}
+
+
+
+#endif // __USB_DEBUG_RDEBUG
+
+
+/**
+Leave (if error) verbosely- log name of file and line number just before
+leaving.
+@param aFile The file we're leaving from.
+@param aLine The line number we're leaving from.
+@param aReason The leave code.
+*/
+EXPORT_C void VerboseLeaveIfErrorL(const TDesC8& IF_FLOGGING(aCpt),
+						  char* IF_FLOGGING(aFile),
+						  TInt IF_FLOGGING(aLine),
+						  TInt aReason)
+	{
+	// only leave negative value
+	if ( aReason >= 0 )
+		{
+		return;
+		}
+
+#ifdef __FLOG_ACTIVE
+	_LIT8(KLeavePrefix, "LEAVE: ");
+
+	TPtrC8 fullFileName((const TUint8*)aFile);
+	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+
+	TBuf8<256> buf;
+	buf.Append(KLeavePrefix);
+	buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName,
+		aLine);
+	CUsbLog::Write(aCpt, buf);
+#endif
+
+	// finally
+	User::Leave(aReason);
+	}
+
+/**
+Leave verbosely- log name of file and line number just before
+leaving.
+@param aFile The file we're leaving from.
+@param aLine The line number we're leaving from.
+@param aReason The leave code.
+*/
+EXPORT_C void VerboseLeaveL(const TDesC8& IF_FLOGGING(aCpt),
+						  char* IF_FLOGGING(aFile),
+						  TInt IF_FLOGGING(aLine),
+						  TInt aReason)
+	{
+#ifdef __FLOG_ACTIVE
+	_LIT8(KLeavePrefix, "LEAVE: ");
+
+	TPtrC8 fullFileName((const TUint8*)aFile);
+	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+
+	TBuf8<256> buf;
+	buf.Append(KLeavePrefix);
+	buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName,
+		aLine);
+	CUsbLog::Write(aCpt, buf);
+#endif
+
+	// finally
+	User::Leave(aReason);
+	}
+
+/**
+Panic verbosely- log name of file and line number just before panicking.
+@param aFile The file that's panicking.
+@param aLine The line number that's panicking.
+@param aReason The panic code.
+@param aPanicName The text of the panic code.
+@param aPanicCategory The panic category.
+*/
+EXPORT_C void VerbosePanic(const TDesC8& IF_FLOGGING(aCpt),
+				  char* IF_FLOGGING(aFile),
+				  TInt IF_FLOGGING(aLine),
+				  TInt aPanicCode,
+				  TText8* IF_FLOGGING(aPanicName),
+				  const TDesC& aPanicCategory)
+	{
+#ifdef __FLOG_ACTIVE
+	_LIT8(KPanicPrefix, "PANIC: code ");
+
+	TPtrC8 fullFileName((const TUint8*)aFile);
+	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+
+	TBuf8<256> buf;
+	buf.Append(KPanicPrefix);
+	buf.AppendFormat(_L8("%d = %s [file %S, line %d]"),
+		aPanicCode,
+		aPanicName,
+		&fileName,
+		aLine);
+	CUsbLog::Write(aCpt, buf);
+#endif
+
+	// finally
+	User::Panic(aPanicCategory, aPanicCode);
+	}
+
+
+/**
+Panic the given message verbosely- log name of file and line number just
+before panicking.
+@param aMsg Message to panic.
+@param aFile The file that's panicking.
+@param aLine The line number that's panicking.
+@param aReason The panic code.
+@param aPanicName The text of the panic code.
+@param aPanicCategory The panic category.
+*/
+EXPORT_C void VerboseMsgPanic(const TDesC8& IF_FLOGGING(aCpt),
+								char* IF_FLOGGING(aFile),
+								TInt  IF_FLOGGING(aLine),
+								const RMessage2& aMsg,
+								const TDesC& aCat,
+								TInt  aPanicCode)
+	{
+#ifdef __FLOG_ACTIVE
+	_LIT8(KPanicPrefix, "PANICKING CLIENT: code ");
+
+	TPtrC8 fullFileName((const TUint8*)aFile);
+	TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+
+	TBuf8<256> buf;
+	buf.Append(KPanicPrefix);
+	buf.AppendFormat(_L8("%d [file %S, line %d]"),
+		aPanicCode,
+		&fileName,
+		aLine);
+	CUsbLog::Write(aCpt, buf);
+#endif
+	// finally
+	aMsg.Panic(aCat, aPanicCode);
+	}
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KInstrumentIn, ">>%S this = [0x%08x]");
+_LIT8(KInstrumentOut, "<<%S");
+#endif
+
+EXPORT_C TFunctionLogger::TFunctionLogger(const TDesC8& IF_FLOGGING(aCpt), const TDesC8& IF_FLOGGING(aString), TAny* IF_FLOGGING(aThis))
+	{
+#ifdef __FLOG_ACTIVE
+	iCpt.Set(aCpt);
+	iString.Set(aString);
+	CUsbLog::WriteFormat(iCpt, KInstrumentIn, &iString, aThis);
+#endif
+	}
+
+EXPORT_C TFunctionLogger::~TFunctionLogger()
+	{
+#ifdef __FLOG_ACTIVE
+	CUsbLog::WriteFormat(iCpt, KInstrumentOut, &iString);
+#endif
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,18 @@
+/*
+* 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:
+*
+*/
+
+#include "client/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/bwins/usbman_over_dummyusbdiu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,52 @@
+EXPORTS
+	??0RUsb@@QAE@XZ @ 1 NONAME ; RUsb::RUsb(void)
+	??1RUsb@@QAE@XZ @ 2 NONAME ; RUsb::~RUsb(void)
+	?BusDrop@RUsb@@QAEHXZ @ 3 NONAME ; int RUsb::BusDrop(void)
+	?BusRespondSrp@RUsb@@QAEHXZ @ 4 NONAME ; int RUsb::BusRespondSrp(void)
+	?BusRequest@RUsb@@QAEHXZ @ 5 NONAME ; int RUsb::BusRequest(void)
+	?CancelInterest@RUsb@@QAEHW4TUsbReqType@1@@Z @ 6 NONAME ; int RUsb::CancelInterest(enum RUsb::TUsbReqType)
+	?ClassSupported@RUsb@@QAEHHVTUid@@AAH@Z @ 7 NONAME ; int RUsb::ClassSupported(int, class TUid, int &)
+	?Connect@RUsb@@QAEHXZ @ 8 NONAME ; int RUsb::Connect(void)
+	?DeviceStateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RUsb::DeviceStateNotification(unsigned int, enum TUsbDeviceState &, class TRequestStatus &)
+	?DeviceStateNotificationCancel@RUsb@@QAEXXZ @ 10 NONAME ; void RUsb::DeviceStateNotificationCancel(void)
+	?DisableFunctionDriverLoading@RUsb@@QAEXXZ @ 11 NONAME ; void RUsb::DisableFunctionDriverLoading(void)
+	?EnableFunctionDriverLoading@RUsb@@QAEHXZ @ 12 NONAME ; int RUsb::EnableFunctionDriverLoading(void)
+	?GetCurrentPersonalityId@RUsb@@QAEHAAH@Z @ 13 NONAME ; int RUsb::GetCurrentPersonalityId(int &)
+	?GetCurrentState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 14 NONAME ; int RUsb::GetCurrentState(enum TUsbServiceState &)
+	?GetDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 15 NONAME ; int RUsb::GetDescription(int, class HBufC16 * &)
+	?GetDeviceState@RUsb@@QAEHAAW4TUsbDeviceState@@@Z @ 16 NONAME ; int RUsb::GetDeviceState(enum TUsbDeviceState &)
+	?GetManufacturerStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 17 NONAME ; int RUsb::GetManufacturerStringDescriptor(unsigned int, unsigned int, class TBuf<128> &)
+	?GetPersonalityIds@RUsb@@QAEHAAV?$RArray@H@@@Z @ 18 NONAME ; int RUsb::GetPersonalityIds(class RArray<int> &)
+	?GetProductStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 19 NONAME ; int RUsb::GetProductStringDescriptor(unsigned int, unsigned int, class TBuf<128> &)
+	?GetServiceState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 20 NONAME ; int RUsb::GetServiceState(enum TUsbServiceState &)
+	?GetSupportedClasses@RUsb@@QAEHHAAV?$RArray@VTUid@@@@@Z @ 21 NONAME ; int RUsb::GetSupportedClasses(int, class RArray<class TUid> &)
+	?GetSupportedLanguages@RUsb@@QAEHIAAV?$RArray@I@@@Z @ 22 NONAME ; int RUsb::GetSupportedLanguages(unsigned int, class RArray<unsigned int> &)
+	?HostEventNotification@RUsb@@QAEXAAVTRequestStatus@@AAVTDeviceEventInformation@@@Z @ 23 NONAME ; void RUsb::HostEventNotification(class TRequestStatus &, class TDeviceEventInformation &)
+	?HostEventNotificationCancel@RUsb@@QAEXXZ @ 24 NONAME ; void RUsb::HostEventNotificationCancel(void)
+	?MessageNotification@RUsb@@QAEXAAVTRequestStatus@@AAH@Z @ 25 NONAME ; void RUsb::MessageNotification(class TRequestStatus &, int &)
+	?MessageNotificationCancel@RUsb@@QAEXXZ @ 26 NONAME ; void RUsb::MessageNotificationCancel(void)
+	?ServiceStateNotification@RUsb@@QAEXAAW4TUsbServiceState@@AAVTRequestStatus@@@Z @ 27 NONAME ; void RUsb::ServiceStateNotification(enum TUsbServiceState &, class TRequestStatus &)
+	?ServiceStateNotificationCancel@RUsb@@QAEXXZ @ 28 NONAME ; void RUsb::ServiceStateNotificationCancel(void)
+	?SetCtlSessionMode@RUsb@@QAEHH@Z @ 29 NONAME ; int RUsb::SetCtlSessionMode(int)
+	?Start@RUsb@@QAEXAAVTRequestStatus@@@Z @ 30 NONAME ; void RUsb::Start(class TRequestStatus &)
+	?StartCancel@RUsb@@QAEXXZ @ 31 NONAME ; void RUsb::StartCancel(void)
+	?StateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 32 NONAME ; void RUsb::StateNotification(unsigned int, enum TUsbDeviceState &, class TRequestStatus &)
+	?StateNotificationCancel@RUsb@@QAEXXZ @ 33 NONAME ; void RUsb::StateNotificationCancel(void)
+	?Stop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 34 NONAME ; void RUsb::Stop(class TRequestStatus &)
+	?Stop@RUsb@@QAEXXZ @ 35 NONAME ; void RUsb::Stop(void)
+	?StopCancel@RUsb@@QAEXXZ @ 36 NONAME ; void RUsb::StopCancel(void)
+	?TryStart@RUsb@@QAEXHAAVTRequestStatus@@@Z @ 37 NONAME ; void RUsb::TryStart(int, class TRequestStatus &)
+	?TryStop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 38 NONAME ; void RUsb::TryStop(class TRequestStatus &)
+	?Version@RUsb@@QBE?AVTVersion@@XZ @ 39 NONAME ; class TVersion RUsb::Version(void) const
+	?__DbgAlloc@RUsb@@QAEHXZ @ 40 NONAME ; int RUsb::__DbgAlloc(void)
+	?__DbgCheckHeap@RUsb@@QAEHH@Z @ 41 NONAME ; int RUsb::__DbgCheckHeap(int)
+	?__DbgFailNext@RUsb@@QAEHH@Z @ 42 NONAME ; int RUsb::__DbgFailNext(int)
+	?__DbgMarkEnd@RUsb@@QAEHH@Z @ 43 NONAME ; int RUsb::__DbgMarkEnd(int)
+	?__DbgMarkHeap@RUsb@@QAEHXZ @ 44 NONAME ; int RUsb::__DbgMarkHeap(void)
+	?panic@@YAXXZ @ 45 NONAME ; void panic(void)
+	?RequestSession@RUsb@@QAEHXZ @ 46 NONAME ; int RUsb::RequestSession(void)
+	?BusClearError@RUsb@@QAEHXZ @ 47 NONAME ; int RUsb::BusClearError(void)
+	?GetOtgDescriptor@RUsb@@QAEHIAAVTOtgDescriptor@@@Z @ 48 NONAME ; int RUsb::GetOtgDescriptor(unsigned int, class TOtgDescriptor &)
+	?GetDetailedDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 49 NONAME ; int RUsb::GetDetailedDescription(int, class HBufC16 * &)
+	?GetPersonalityProperty@RUsb@@QAEHHAAK@Z @ 50 NONAME ; int RUsb::GetPersonalityProperty(int, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/bwins/usbmanu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,52 @@
+EXPORTS
+	??0RUsb@@QAE@XZ @ 1 NONAME ; public: __thiscall RUsb::RUsb(void)
+	??1RUsb@@QAE@XZ @ 2 NONAME ; public: __thiscall RUsb::~RUsb(void)
+	?panic@@YAXXZ @ 3 NONAME ; public: static int __cdecl UsbMan::Run(class UsbMan::TSignal &)
+	?Stop@RUsb@@QAEXXZ @ 4 NONAME ; public: void __thiscall RUsb::Stop(void)
+	?Version@RUsb@@QBE?AVTVersion@@XZ @ 5 NONAME ; public: class TVersion  __thiscall RUsb::Version(void)const 
+	?Connect@RUsb@@QAEHXZ @ 6 NONAME ; public: int __thiscall RUsb::Connect(void)
+	?Start@RUsb@@QAEXAAVTRequestStatus@@@Z @ 7 NONAME ; public: void __thiscall RUsb::Start(class TRequestStatus &)
+	?StateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 8 NONAME ; public: void __thiscall RUsb::StateNotification(unsigned int,enum TUsbDeviceState &,class TRequestStatus &)
+	?GetCurrentState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 9 NONAME ; public: int __thiscall RUsb::GetCurrentState(enum TUsbServiceState &)
+	?StartCancel@RUsb@@QAEXXZ @ 10 NONAME ; public: void __thiscall RUsb::StartCancel(void)
+	?StateNotificationCancel@RUsb@@QAEXXZ @ 11 NONAME ; public: void __thiscall RUsb::StateNotificationCancel(void)
+	?GetDeviceState@RUsb@@QAEHAAW4TUsbDeviceState@@@Z @ 12 NONAME ; public: int __thiscall RUsb::GetDeviceState(enum TUsbDeviceState &)
+	?ServiceStateNotification@RUsb@@QAEXAAW4TUsbServiceState@@AAVTRequestStatus@@@Z @ 13 NONAME ; public: void __thiscall RUsb::ServiceStateNotification(enum TUsbServiceState &,class TRequestStatus &)
+	?ServiceStateNotificationCancel@RUsb@@QAEXXZ @ 14 NONAME ; public: void __thiscall RUsb::ServiceStateNotificationCancel(void)
+	?Stop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 15 NONAME ; public: void __thiscall RUsb::Stop(class TRequestStatus &)
+	?StopCancel@RUsb@@QAEXXZ @ 16 NONAME ; public: void __thiscall RUsb::StopCancel(void)
+	?DeviceStateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 17 NONAME ; public: void __thiscall RUsb::DeviceStateNotification(unsigned int,enum TUsbDeviceState &,class TRequestStatus &)
+	?DeviceStateNotificationCancel@RUsb@@QAEXXZ @ 18 NONAME ; public: void __thiscall RUsb::DeviceStateNotificationCancel(void)
+	?GetServiceState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 19 NONAME ; public: int __thiscall RUsb::GetServiceState(enum TUsbServiceState &)
+	?__DbgCheckHeap@RUsb@@QAEHH@Z @ 20 NONAME ; public: int __thiscall RUsb::__DbgCheckHeap(int)
+	?__DbgFailNext@RUsb@@QAEHH@Z @ 21 NONAME ; public: int __thiscall RUsb::__DbgFailNext(int)
+	?__DbgMarkEnd@RUsb@@QAEHH@Z @ 22 NONAME ; public: int __thiscall RUsb::__DbgMarkEnd(int)
+	?__DbgMarkHeap@RUsb@@QAEHXZ @ 23 NONAME ; public: int __thiscall RUsb::__DbgMarkHeap(void)
+	?CancelInterest@RUsb@@QAEHW4TUsbReqType@1@@Z @ 24 NONAME ; int RUsb::CancelInterest(enum RUsb::TUsbReqType)
+	?ClassSupported@RUsb@@QAEHHVTUid@@AAH@Z @ 25 NONAME ; int RUsb::ClassSupported(int, class TUid, int &)
+	?GetCurrentPersonalityId@RUsb@@QAEHAAH@Z @ 26 NONAME ; int RUsb::GetCurrentPersonalityId(int &)
+	?GetDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 27 NONAME ; int RUsb::GetDescription(int, class HBufC16 * &)
+	?GetPersonalityIds@RUsb@@QAEHAAV?$RArray@H@@@Z @ 28 NONAME ; int RUsb::GetPersonalityIds(class RArray<int> &)
+	?GetSupportedClasses@RUsb@@QAEHHAAV?$RArray@VTUid@@@@@Z @ 29 NONAME ; int RUsb::GetSupportedClasses(int, class RArray<class TUid> &)
+	?TryStart@RUsb@@QAEXHAAVTRequestStatus@@@Z @ 30 NONAME ; void RUsb::TryStart(int, class TRequestStatus &)
+	?TryStop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 31 NONAME ; void RUsb::TryStop(class TRequestStatus &)
+	?BusDrop@RUsb@@QAEHXZ @ 32 NONAME ; int RUsb::BusDrop(void)
+	?BusRespondSrp@RUsb@@QAEHXZ @ 33 NONAME ; int RUsb::BusRespondSrp(void)
+	?BusRequest@RUsb@@QAEHXZ @ 34 NONAME ; int RUsb::BusRequest(void)
+	?DisableFunctionDriverLoading@RUsb@@QAEXXZ @ 35 NONAME ; void RUsb::DisableFunctionDriverLoading(void)
+	?EnableFunctionDriverLoading@RUsb@@QAEHXZ @ 36 NONAME ; int RUsb::EnableFunctionDriverLoading(void)
+	?GetManufacturerStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 37 NONAME ; int RUsb::GetManufacturerStringDescriptor(unsigned int, unsigned int, class TBuf<128> &)
+	?GetProductStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 38 NONAME ; int RUsb::GetProductStringDescriptor(unsigned int, unsigned int, class TBuf<128> &)
+	?GetSupportedLanguages@RUsb@@QAEHIAAV?$RArray@I@@@Z @ 39 NONAME ; int RUsb::GetSupportedLanguages(unsigned int, class RArray<unsigned int> &)
+	?HostEventNotification@RUsb@@QAEXAAVTRequestStatus@@AAVTDeviceEventInformation@@@Z @ 40 NONAME ; void RUsb::HostEventNotification(class TRequestStatus &, class TDeviceEventInformation &)
+	?HostEventNotificationCancel@RUsb@@QAEXXZ @ 41 NONAME ; void RUsb::HostEventNotificationCancel(void)
+	?MessageNotification@RUsb@@QAEXAAVTRequestStatus@@AAH@Z @ 42 NONAME ; void RUsb::MessageNotification(class TRequestStatus &, int &)
+	?MessageNotificationCancel@RUsb@@QAEXXZ @ 43 NONAME ; void RUsb::MessageNotificationCancel(void)
+	?SetCtlSessionMode@RUsb@@QAEHH@Z @ 44 NONAME ; int RUsb::SetCtlSessionMode(int)
+	?__DbgAlloc@RUsb@@QAEHXZ @ 45 NONAME ; int RUsb::__DbgAlloc(void)
+	?RequestSession@RUsb@@QAEHXZ @ 46 NONAME ; int RUsb::RequestSession(void)
+	?BusClearError@RUsb@@QAEHXZ @ 47 NONAME ; int RUsb::BusClearError(void)
+	?GetOtgDescriptor@RUsb@@QAEHIAAVTOtgDescriptor@@@Z @ 48 NONAME ; int RUsb::GetOtgDescriptor(unsigned int, class TOtgDescriptor &)
+	?GetDetailedDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 49 NONAME ; int RUsb::GetDetailedDescription(int, class HBufC16 * &)
+	?GetPersonalityProperty@RUsb@@QAEHHAAK@Z @ 50 NONAME ; int RUsb::GetPersonalityProperty(int, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/eabi/usbmanu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,54 @@
+EXPORTS
+	_Z5panicv @ 1 NONAME
+	_ZN4RUsb10StopCancelEv @ 2 NONAME
+	_ZN4RUsb11StartCancelEv @ 3 NONAME
+	_ZN4RUsb12__DbgMarkEndEi @ 4 NONAME
+	_ZN4RUsb13__DbgFailNextEi @ 5 NONAME
+	_ZN4RUsb13__DbgMarkHeapEv @ 6 NONAME
+	_ZN4RUsb14GetDeviceStateER15TUsbDeviceState @ 7 NONAME
+	_ZN4RUsb14__DbgCheckHeapEi @ 8 NONAME
+	_ZN4RUsb15GetCurrentStateER16TUsbServiceState @ 9 NONAME
+	_ZN4RUsb15GetServiceStateER16TUsbServiceState @ 10 NONAME
+	_ZN4RUsb17StateNotificationEjR15TUsbDeviceStateR14TRequestStatus @ 11 NONAME
+	_ZN4RUsb23DeviceStateNotificationEjR15TUsbDeviceStateR14TRequestStatus @ 12 NONAME
+	_ZN4RUsb23StateNotificationCancelEv @ 13 NONAME
+	_ZN4RUsb24ServiceStateNotificationER16TUsbServiceStateR14TRequestStatus @ 14 NONAME
+	_ZN4RUsb29DeviceStateNotificationCancelEv @ 15 NONAME
+	_ZN4RUsb30ServiceStateNotificationCancelEv @ 16 NONAME
+	_ZN4RUsb4StopER14TRequestStatus @ 17 NONAME
+	_ZN4RUsb4StopEv @ 18 NONAME
+	_ZN4RUsb5StartER14TRequestStatus @ 19 NONAME
+	_ZN4RUsb7ConnectEv @ 20 NONAME
+	_ZN4RUsbC1Ev @ 21 NONAME
+	_ZN4RUsbC2Ev @ 22 NONAME
+	_ZN4RUsbD1Ev @ 23 NONAME
+	_ZN4RUsbD2Ev @ 24 NONAME
+	_ZNK4RUsb7VersionEv @ 25 NONAME
+	_ZN4RUsb14CancelInterestENS_11TUsbReqTypeE @ 26 NONAME
+	_ZN4RUsb14ClassSupportedEi4TUidRi @ 27 NONAME
+	_ZN4RUsb14GetDescriptionEiRP7HBufC16 @ 28 NONAME
+	_ZN4RUsb17GetPersonalityIdsER6RArrayIiE @ 29 NONAME
+	_ZN4RUsb19GetSupportedClassesEiR6RArrayI4TUidE @ 30 NONAME
+	_ZN4RUsb23GetCurrentPersonalityIdERi @ 31 NONAME
+	_ZN4RUsb7TryStopER14TRequestStatus @ 32 NONAME
+	_ZN4RUsb8TryStartEiR14TRequestStatus @ 33 NONAME
+	_ZN4RUsb13BusRespondSrpEv @ 34 NONAME
+	_ZN4RUsb10BusRequestEv @ 35 NONAME
+	_ZN4RUsb17SetCtlSessionModeEi @ 36 NONAME
+	_ZN4RUsb19MessageNotificationER14TRequestStatusRi @ 37 NONAME
+	_ZN4RUsb21GetSupportedLanguagesEjR6RArrayIjE @ 38 NONAME
+	_ZN4RUsb21HostEventNotificationER14TRequestStatusR23TDeviceEventInformation @ 39 NONAME
+	_ZN4RUsb25MessageNotificationCancelEv @ 40 NONAME
+	_ZN4RUsb26GetProductStringDescriptorEjjR4TBufILi128EE @ 41 NONAME
+	_ZN4RUsb27EnableFunctionDriverLoadingEv @ 42 NONAME
+	_ZN4RUsb27HostEventNotificationCancelEv @ 43 NONAME
+	_ZN4RUsb28DisableFunctionDriverLoadingEv @ 44 NONAME
+	_ZN4RUsb31GetManufacturerStringDescriptorEjjR4TBufILi128EE @ 45 NONAME
+	_ZN4RUsb7BusDropEv @ 46 NONAME
+	_ZN4RUsb10__DbgAllocEv @ 47 NONAME
+	_ZN4RUsb14RequestSessionEv @ 48 NONAME
+	_ZN4RUsb13BusClearErrorEv @ 49 NONAME
+	_ZN4RUsb16GetOtgDescriptorEjR14TOtgDescriptor @ 50 NONAME
+	_ZN4RUsb22GetDetailedDescriptionEiRP7HBufC16 @ 51 NONAME
+	_ZN4RUsb22GetPersonalityPropertyEiRm @ 52 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,58 @@
+;
+; 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:
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"UsbManStub"},(0x00000001),11,1,0,TYPE=SA, RU
+
+; Series60 product id for S60 5.1
+[0x10283160], 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\usbman.dll"-"c:\Sys\Bin\usbman.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,34 @@
+;
+; 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:
+;
+
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"UsbManStub"},(0x00000001),10,1,0,TYPE=SA
+
+; Series60 product id for S60 5.1
+;[0x10283160], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\usbman.dll"
Binary file tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/group/Usbman.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+#include <platform_paths.hrh>
+/**
+ @file
+*/
+
+target			usbman.dll
+CAPABILITY All -Tcb
+targettype		dll
+
+//
+// We have a laggard, ill-defined UID3 which must be kept
+// for old platforms for BC.  For newer platforms, we use
+// KUidUsbmanClient = 0x101FE1DA
+//
+ uid			0x1000008d 0x101fe1da
+
+sourcepath		../SRC
+source			RUsb.cpp
+
+USERINCLUDE 	../inc
+userinclude		../../server/public
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE 	/epoc32/include/mw/stubsrv
+
+library			euser.lib
+library			efsrv.lib
+LIBRARY			stubber.lib
+LIBRARY 		apibehavior.lib
+
+#include <usb/usblogger.mmh>
+
+VENDORID 0x70000001
+
+UNPAGED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+
+PRJ_TESTEXPORTS
+//../public/usbman.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbman.h)
+//../public/usbstates.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbstates.h)
+../inc/usbmandll_stub.h 		/epoc32/include/mw/taf/usbmandll_stub.h
+
+
+../rom/usbManStubSIS.iby		/epoc32/rom/include/core/mw/usbman_stub.iby
+UsbManStub_empty.sis			/epoc32/data/z/system/install/UsbMan_stub.sis
+
+PRJ_TESTMMPFILES
+//Usbman.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/inc/usbmandll_stub.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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 USBMANDLL_STUB_H_
+#define USBMANDLL_STUB_H_
+
+static const TUint KUsbManStubAgentDll = 0x00000033;
+
+enum TUsbManStubAgentApi
+    {
+    EConnect,
+    EGetDeviceState,
+    EStart,
+    EStop,
+    ETryStartAsync,
+    ETryStopAsync,
+    EDeviceStateNotification,
+    EGetCurrentPersonalityId,
+    ECancelInterest,
+    EDeviceStateNotificationCancel,
+    EServiceState,
+    ESetCtlSessionMode,
+    EGetPersonalityProperty
+    };
+
+#endif /*USBMANDLL_STUB_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/public/usbman.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,705 @@
+/*
+* 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:
+*
+*/
+
+/**
+ @file
+*/
+
+#ifndef __USBMAN_H__
+#define __USBMAN_H__
+
+#include <e32std.h>
+#include <usberrors.h>
+#include <usbstates.h>
+#include <usb/usbshared.h>
+
+// The propery of a personality is a bitmap, and bit 0 is used to identify
+// whether a personality is hidden.
+const TUint32 KUsbPersonalityPropertyHidden = 0x00000001;
+
+NONSHARABLE_CLASS(RUsb) : public RSessionBase
+/**
+The RUsb class implements the Symbian OS USB Management API RUsb
+
+@publishedPartner
+@released
+*/
+	{
+public:
+
+	// Request types, the interest of which can be cancelled by clients
+	enum TUsbReqType
+		{
+		EStart,
+		EStop,
+		ETryStart,
+		ETryStop
+		};
+		
+	/**
+	Constructor
+
+	
+	@since	7.0
+
+	@publishedPartner
+	@released
+	 */
+	IMPORT_C RUsb();
+
+	/**
+	Destructor
+
+	
+	@since	7.0
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C ~RUsb();
+
+	/**
+	Extract the version of the server providing the RUsb API
+
+	
+	@since	7.0
+
+	@return	Version of the server
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TVersion Version() const;
+
+	/**
+	Connect the Handle to the Server
+	Must be called before all other methods except Version()
+
+	
+	@since	7.0
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt Connect();
+
+	/**
+	Start the device's USB service. Should not be called if the USB services
+	have already been started
+	Note: Asynchonous Version, outcome returned when the status is completed
+	
+	
+	@since	7.0
+	@param	aStatus		Status to complete once the start operation has completed
+	@capability NetworkControl
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void Start(TRequestStatus& aStatus);
+
+	/**
+	Cancels the pending start operation of the device's USB service.
+
+	
+	@since	7.0
+	@capability NetworkControl
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void StartCancel();
+
+	/**
+	Stops the device's USB service. Should not be called if the USB services
+	have not been started. This is the synchronous variant of this function.
+	This function is deprecated- use the asynchronous version.
+	
+	
+	@since	7.0
+	@capability NetworkControl
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void Stop();
+
+	/**
+	Stops the device's USB service. Should not be called if the USB services
+	have not been started. This is the asynchronous variant of this function.
+	
+	
+	@since	7.0s
+	@param	aStatus		Status to complete once the stop operation has completed
+	@capability NetworkControl
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void Stop(TRequestStatus& aStatus);
+
+	/**
+	Cancels the pending stop operation of the device's USB service.
+
+	
+	@since	7.0s
+	@capability NetworkControl
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void StopCancel();
+
+	/**
+	Get the current state of the device's USB service.
+
+	
+	@since	7.0s
+	@param	aState	Set by the method to the current state of the USB service
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetServiceState(TUsbServiceState& aState);
+
+	/**
+	Request to be notified of a change in service state of the USB device. The
+	request only completes when the service state changes.
+
+	
+	@since	7.0s
+	@param	aState		State variable to be written to upon completion of the request
+	@param	aStatus		Status to complete when required state change occurs
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void ServiceStateNotification(
+		TUsbServiceState& aState,
+		TRequestStatus& aStatus
+	);
+
+	/**
+	Cancel the outstanding service state notification request.
+
+	
+	@since 7.0s
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void ServiceStateNotificationCancel();
+
+	/**
+	Gets the current device state (eg. powered, configured...).
+
+	
+	@since	7.0s
+	@param	aState	Set by the method to the current state of the USB device
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetDeviceState(TUsbDeviceState& aState);
+
+	/**
+	Request to be notified of a change in state of the USB device.
+
+	
+	@since	7.0s
+	@param	aStateMask	State mask of the states the client is interested in	
+	@param	aState		State variable to be written to upon completion of the request
+	@param	aStatus		Status to complete when required state change occurs
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void DeviceStateNotification(
+		TUint aStateMask,
+		TUsbDeviceState& aState,
+		TRequestStatus& aStatus
+	);
+
+	/**
+	Cancel the outstanding device state notification request.
+
+	
+	@since 7.0s
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void DeviceStateNotificationCancel();
+	
+	/**
+	Try to start the device's USB service. It starts the current personality
+	only if the service is in the idle state. Calling this API while the server
+	is in any other states has no any effect on the service state.
+	 
+	Note: Asynchonous version, outcome returned when the status is completed
+	
+	@param aPersonalityId 	a personality id
+	@param aStatus			Status to complete once the start operation has completed.
+							It may be one of the following:	
+								KErrNotSupported
+								KErrAccessDenied
+								KErrServerBusy
+								KErrAbort
+								KErrNone
+	@capability NetworkControl
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void TryStart(TInt aPersonalityId, TRequestStatus& aStatus);
+
+	/**
+	Try to stop the device's USB service. It stops the service only if the serice
+	is in the started state. Calling this API while the server is in the other states 
+	has no any effect on the service state.
+
+	Note: Asynchonous version, outcome returned when the status is completed
+	
+	@param	aStatus		Status to complete once the stop operation has completed.
+						It may be one of the following:
+								KErrNotSupported
+								KErrAccessDenied
+								KErrServerBusy
+								KErrNone
+	@capability NetworkControl
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C void TryStop(TRequestStatus& aStatus);
+
+	/**
+	Cancels the interest of the pending operation of the device's USB service, 
+	either starting or stopping. The pending request will run to the completion.
+	The caller of this function receives a status of KErrCancel.
+	
+	@param  aMessageId	a message id to identify the request to be cancelled
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt CancelInterest(TUsbReqType aMessageId);
+
+	/**
+	Gets the textual description of the personality identified by the aPersonalityId.
+	Caller is repsonsible for freeing up memories allocated to 
+	aLocalizedPersonalityDescriptor.
+
+	@param	aPersonalityId a personality id
+	@param  aLocalizedPersonalityDescriptor a localize text string
+	@return	KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor);
+
+	/**
+	Gets the current personality id of the device's USb service
+	
+	@param	aPersonalityId set to the current personality of USB device
+	@return	KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetCurrentPersonalityId(TInt& aPersonalityId);
+	
+	/**
+	Gets supported classes by the given personality identified by the aPersonalityId
+
+	@param aPersonalityId a personality id 
+	@param aClassUids an array of class uids
+	@return	KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetSupportedClasses(TInt aPersonalityId, RArray<TUid>& aClassUids);
+
+	/** 
+	Queries the USB manager to determine if a given class is supported
+	
+	@param aPersonalityId a personality id
+	@param aClassUid a class uid
+	@param aSupported set upon return
+	@return	KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt ClassSupported(TInt aPersonalityId, TUid aClassUid, TBool& aSupported);
+	
+	/**
+	Gets all supported personality ids of the device's USB service.
+
+	@param	aPersonalityIds populated with all supported personality ids of the USB device
+	@return	KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetPersonalityIds(RArray<TInt>& aPersonalityIds);
+
+	/**
+	Marks the start of heap cell checking for the USB Manager. This function is only defined
+	in debug builds.
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt __DbgMarkHeap();
+
+	/**
+	Checks that the number of allocated cells on the USB Manager's heap is correct. The USB
+	Manager will be panicked if it is not. This function is only defined in debug builds.
+	
+	@param	aCount	The expected number of heap cells allocated
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
+
+	/**
+	Marks the end of heap cell checking for the USB Manager. Checks that the number of heap
+	cells allocated since the last __DbgMarkHeap() is aCount; the most common value to pass
+	here is zero. This function is only defined in debug builds.
+
+	@param	aCount	The expected number of heap cells allocated
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
+
+	/**
+	Simulates memory allocation failure in the USB Manager. This function is only defined in
+	debug builds.
+
+	@param	aCount	The number of allocations after which memory allocation should fail
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt __DbgFailNext(TInt aCount);
+	
+	/**
+	Functions below this point are deprecated and should not be used.
+	*/
+
+	/**
+	Get the current state of the device's USB service. This function is deprecated and has been
+	replaced by the GetServiceState function from version 7.0s onwards.
+
+	
+	@since	7.0
+	@param	aState	Set by the method to the current state of the USB service
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@deprecated
+	*/
+	IMPORT_C TInt GetCurrentState(TUsbServiceState& aState);
+
+	/**
+	Request to be notified of a change in state of the USB device. This function is deprecated
+	and has been replaced by the DeviceStateNotification function from version 7.0s onwards.
+
+	
+	@since	7.0
+	@param	aStateMask	State mask of the states the client is interested in	
+	@param	aState		State variable to be written to upon completion of the request
+	@param	aStatus		Status to complete when required state change occurs
+
+	@publishedPartner
+	@deprecated
+	*/
+	IMPORT_C void StateNotification(
+		TUint aStateMask,
+		TUsbDeviceState& aState,
+		TRequestStatus& aStatus
+	);
+
+	/**
+	Cancel the outstanding device state notification request. This function is deprecated and
+	has been replaced by the DeviceStateNotificationCancel function from version 7.0s onwards.
+
+	
+	@since 7.0
+
+	@publishedPartner
+	@deprecated
+	*/
+	IMPORT_C void StateNotificationCancel();
+
+	/**
+	* Set or reset the mode in which current RUsb session operates.
+	* Recent implementation assumes that there is the one and only application
+	* which controls USBMAN, all other clients act as listeners to notification 
+	* requests. Only application which was previously granted 'control' mode is 
+	* allowed to reset it at later stage. Any calls from other applications will
+	* generate an error.
+	*
+	* @param	aValue		True to inform USBMAN that Application wants to 'control' 
+	*						USBMAN
+	*						False otherwise
+	*
+	* @capability NetworkControl
+	* @return	KErrNone		 if successful
+	*			KErrAccessDenied otherwise
+	*/
+	IMPORT_C TInt SetCtlSessionMode(TBool aValue);
+
+	/**
+	* Cable watcher wants to assert Bus_request.
+	* If ID-Pin is present this is an A-Device and this will result in an attempt 
+	* to raise VBus. Second attempt to raise VBus causes KErrUsbOtgVbusAlreadyRaised
+	* error.
+	* If ID-Pin is absent this is a B-Device and this will result in an attempt to 
+	* use SRP. Recently does nothing
+	* 
+	* When BusRequest() returns an error, VBus remains low until the errors are cleared by
+	* BusDrop() or BusClearErr() calls 
+	* 
+	* @capability NetworkControl
+	* @return KErrNone if successful, otherwise an error code returned by OTGDI
+	*/
+	IMPORT_C TInt BusRequest();
+
+	/**
+	* Cable watcher wants to assert Bus_request after SRP.
+	* If ID-Pin is present this is an A-Device and this will result in an attempt 
+	* to raise VBus
+	* 
+	* @capability NetworkControl
+	* @return KErrNone if successful, otherwise an error code returned by OTGDI
+	*/
+	IMPORT_C TInt BusRespondSrp();
+
+	/**
+	* Cable watcher wants to clear the Bus Error after A_VBUS_ERR
+	* Only works if ID-Pin is present (this is an A-Device) and there
+	* has already been a bus erorr.
+	* This will not result in any attempt to raise or drop VBus
+	* 
+	* @capability NetworkControl
+	* @return KErrNone if successful, otherwise an error code returned by OTGDI
+	*/
+	IMPORT_C TInt BusClearError();
+
+	/**
+	* Cable watcher wants to drop VBus.
+	* If ID-Pin is present this is an A-Device and this will result in stopping VBus 
+	* power-up
+	* 
+	* @capability NetworkControl
+	* @return KErrNone if successful, otherwise an error code returned by OTGDI
+	*/
+	IMPORT_C TInt BusDrop();
+	
+	/**
+	* Register for Messages notifications
+	* The request only completes when the new message arrives.
+	* Calling this function the first time initializes Messages queue
+	* 
+	*
+	* @param	aMessage	UI Message variable to be written to upon completion 
+	* 						of the request
+	* @param	aStatus		Status to complete when required state change occurs
+	*			KErrNone	- if successful
+	*			KErrInUse	- if there is another outstanding nofitication request 
+	* 						  for the same session
+	*			otherwise an error code returned by OTGDI or Host
+	*/
+	IMPORT_C void MessageNotification(TRequestStatus& aStatus, TInt& aMessage);
+
+	/**
+	* Cancel the outstanding Messages notification request.
+	*/
+	IMPORT_C void MessageNotificationCancel();
+
+	/**
+	* Register for Host Device Event notifications.
+	* The request only completes when the host event occurs.
+	* Calling this function the first time initializes Host Events queue
+	*
+	* @param	aStatus		Status to complete when required event occurs
+	* 
+	*			KErrNone	- if successful
+	*			KErrInUse	- if there is another outstanding nofitication 
+	*						  request for the same session
+	*			otherwise an error code returned by FDF
+	* @param	aDeviceInformation	device info to be written to upon completion 
+	*								of the request
+	*/
+	IMPORT_C void HostEventNotification(TRequestStatus& aStatus,
+										TDeviceEventInformation& aDeviceInformation);
+	/**
+	* Cancel the outstanding FDF Device Event notification request.
+	*/
+	IMPORT_C void HostEventNotificationCancel();
+
+	/**
+	* Enable Function Driver Loading.
+	*
+	* @capability NetworkControl
+	* @return	KErrNone		 - if successful
+	*			KErrNotSupported - if FDF is not included in current configuration
+	*			otherwise an error code returned by FDF
+	*/
+	IMPORT_C TInt EnableFunctionDriverLoading();
+
+	/**
+	* Disable Function Driver Loading.
+	*
+	* @capability NetworkControl
+	*/
+	IMPORT_C void DisableFunctionDriverLoading();
+
+	/**
+	* Get Supported Languages from USB Device
+	*
+	* @param	aDeviceId	DeviceID of given device
+	* @param	aLangIds	an array of language IDs supported by given device.
+	*						These language IDs are supplied by USB-IF and are 
+	*						different from standard Symbian TLanguage enumeration
+	*
+	* @return	KErrNone		 - if successful
+	*			otherwise an error code returned by FDF
+	*/
+	IMPORT_C TInt GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds);
+
+	/**
+	* Get Manufacturer Descriptor
+	*
+	* @param	aDeviceId	DeviceID of given device
+	* @param	aLangId		required language ID which is supplied by USB-IF and is 
+	*						different from standard Symbian TLanguage enumeration
+	* @param	aString		manufacturer descriptor value at output
+	*
+	* @return	KErrNone		 - if successful
+	*			otherwise an error code returned by FDF
+	*/
+	IMPORT_C TInt GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString);
+
+	/**
+	* Get Product Descriptor
+	*
+	* @param	aDeviceId	DeviceID of given device
+	* @param	aLangId		required language ID which is supplied by USB-IF and is 
+	*						different from standard Symbian TLanguage enumeration
+	* @param	aString		product descriptor value at output
+	*
+	* @return	KErrNone		 - if successful
+	*			otherwise an error code returned by FDF
+	*/
+	IMPORT_C TInt GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString);
+		
+	/**
+	* Retrieve Otg Descriptor for device which has given device Id.
+	* Currently TOtgDescriptor has following fields:
+	*  - HNP supported
+	*  - SRP supported
+	* An OTG device should support them both. 
+	*
+	* @param	aDeviceId	DeviceID of given device
+	* @param	aDescriptor OTG descriptor value at output
+	*
+	* @return	KErrNone		 - if successful
+	*			otherwise an error code returned by FDF
+	*/
+	IMPORT_C TInt GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor);
+	
+	/**
+	Simulates memory allocation in the USB Manager. This function is only defined in
+	debug builds.
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt __DbgAlloc();
+	
+	/**
+	Informs USB Manager that the client would like to initialte USB session.
+	On A-Device, it results in sending a notification to 'controller' application
+	On B-Device, it may trigger either SRP or HNP sequence depending on the state of VBus 
+
+	@return	KErrNone if successful, otherwise the error that occurred
+
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt RequestSession();
+	
+
+	/**
+	Gets the property of the personality identified by the aPersonalityId.
+
+	@param  aPersonalityId a personality id
+	@return the personality property
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty);
+
+	/**
+	Gets the detailed textual description of the personality identified by the aPersonalityId.
+	Caller is repsonsible for freeing up memories allocated to 
+	aLocalizedPersonalityDescriptor.
+
+	@param  aPersonalityId a personality id
+	@param  aLocalizedPersonalityDescriptor a localize text string
+	@return KErrNone if successful, otherwise the error that occurred
+	@publishedPartner
+	@released
+	*/
+	IMPORT_C TInt GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor);
+	
+private:
+	/** 
+	Used to register device state notifications.
+	*/
+	TPckg<TUint32> iDeviceStatePkg;
+
+	/** 
+	Used to register service state notifications.
+	*/
+	TPckg<TUint32> iServiceStatePkg;
+
+	/**
+	Used to register OTG/Host message notifications.
+	*/
+	TPckg<TUint32> iMessagePkg;
+
+	/**
+	Used to register Host state notifications.
+	*/
+	TPckg<TDeviceEventInformation> iHostPkg;
+	};
+
+#endif //__USBMAN_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/public/usbstates.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* 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:
+*
+*/
+
+/**
+ @file
+*/
+
+#ifndef __USBSTATES_H__
+#define __USBSTATES_H__
+
+#include <e32def.h>
+
+/** TUsbServiceState
+
+	Enumeration of all the USB service states.
+
+	@publishedPartner
+	@released
+*/
+enum TUsbServiceState
+	{
+	/** EUsbServiceIdle 
+		The service is not started.
+	*/
+	EUsbServiceIdle        = 0x01,
+	
+	/** EUsbServiceStarting */
+	EUsbServiceStarting    = 0x02,
+	
+	/** EUsbServiceStarted */
+	EUsbServiceStarted     = 0x04,
+	
+	/** EUsbServiceStopping */
+	EUsbServiceStopping    = 0x08,
+
+	/** EUsbServiceFatalError */
+	EUsbServiceFatalError  = 0x10
+	};
+
+/** TUsbDeviceState
+
+	Enumeration of all of the states of the USB device.
+	The states reported are dependent on the hardware.
+
+	*** If this changes update KUsbDeviceStates below ***
+
+	@publishedPartner
+	@released
+*/
+enum TUsbDeviceState
+	{
+	/** EUsbDeviceStateUndefined */
+	EUsbDeviceStateUndefined  = 0x00,
+
+	/** EUsbDeviceStateDefault */
+	EUsbDeviceStateDefault    = 0x01,
+
+	/** EUsbDeviceStateAttached */
+	EUsbDeviceStateAttached   = 0x02,
+
+	/** EUsbDeviceStatePowered */
+	EUsbDeviceStatePowered    = 0x04,
+
+	/** EUsbDeviceStateConfigured */
+	EUsbDeviceStateConfigured = 0x08,
+
+	/** EUsbDeviceStateAddress */
+	EUsbDeviceStateAddress    = 0x10,
+
+	/** EUsbDeviceStateSuspended */
+	EUsbDeviceStateSuspended  = 0x20
+	};
+
+/**
+Number of different USB Device States
+
+@publishedPartner
+*/
+const TInt KUsbDeviceStates = 7;
+
+
+#endif //__USBSTATES_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/rom/usbManStubSIS.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* 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 USBMANSISECLIPSING_IBY
+#define USBMANSISECLIPSING_IBY
+
+data=DATAZ_\system\install\UsbMan_stub.sis  		System\Install\usbman_stub.sis
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/client/src/RUsb.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,1031 @@
+/*
+* 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:
+*
+*/
+
+#include <e32uid.h>
+#include <f32file.h>
+#include <usbman.h>
+#include <usb.h>
+#include <e32base.h>
+#include "rusb.h"
+#include <usb/usblogger.h>
+#include <stubber.h>
+#include "usbmandll_stub.h"
+#include <usbpersonalityids.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "USBMAN");
+#endif
+
+#ifdef __USBMAN_NO_PROCESSES__
+#include <e32math.h>
+#endif
+
+// CONSTANTS
+//const TUint KUsbAllStates = 0xFFFFFFFF;
+
+_LIT8(KLogStub, "[USBMAN] [Stub]");
+
+static TInt StartServer()
+//
+// Start the server process or thread
+//
+	{
+	const TUidType serverUid(KNullUid, KNullUid, KUsbmanSvrUid);
+
+#ifdef __USBMAN_NO_PROCESSES__
+	//
+	// In EKA1 WINS the server is a DLL, the exported entrypoint returns a TInt
+	// which represents the real entry-point for the server thread
+	//
+	RLibrary lib;
+	TInt err = lib.Load(KUsbmanImg, serverUid);
+	
+	if (err != KErrNone)
+		{
+		return err;
+		}
+
+	TLibraryFunction ordinal1 = lib.Lookup(1);
+	TThreadFunction serverFunc = reinterpret_cast<TThreadFunction>(ordinal1());
+
+	//
+	// To deal with the unique thread (+semaphore!) naming in EPOC, and that we may
+	// be trying to restart a server that has just exited we attempt to create a
+	// unique thread name for the server.
+	// This uses Math::Random() to generate a 32-bit random number for the name
+	//
+	TName name(KUsbServerName);
+	name.AppendNum(Math::Random(),EHex);
+	
+	RThread server;
+	err = server.Create (
+		name,
+		serverFunc,
+		KUsbmanStackSize,
+		NULL,
+		&lib,
+		NULL,
+		KUsbmanMinHeapSize,
+		KUsbmanMaxHeapSize,
+		EOwnerProcess
+	);
+
+	lib.Close();	// if successful, server thread has handle to library now
+#else
+	//
+	// EPOC and EKA2 is easy, we just create a new server process. Simultaneous
+	// launching of two such processes should be detected when the second one
+	// attempts to create the server object, failing with KErrAlreadyExists.
+	//
+	RProcess server;
+	TInt err = server.Create(KUsbmanImg, KNullDesC, serverUid);
+#endif //__USBMAN_NO_PROCESSES__
+	
+	if (err != KErrNone)
+		{
+		return err;
+		}
+
+	TRequestStatus stat;
+	server.Rendezvous(stat);
+	
+	if (stat!=KRequestPending)
+		server.Kill(0);		// abort startup
+	else
+		server.Resume();	// logon OK - start the server
+
+	User::WaitForRequest(stat);		// wait for start or death
+
+	// we can't use the 'exit reason' if the server panicked as this
+	// is the panic 'reason' and may be '0' which cannot be distinguished
+	// from KErrNone
+	err = (server.ExitType() == EExitPanic) ? KErrServerTerminated : stat.Int();
+
+	server.Close();
+	
+	LOGTEXT2(_L8("USB server started successfully: err = %d\n"),err);
+
+	return err;
+	}
+
+
+
+
+EXPORT_C RUsb::RUsb() 
+	: iDeviceStatePkg(0), iServiceStatePkg(0), iMessagePkg(0), 
+	  iHostPkg(TDeviceEventInformation())
+	{
+	LOG_LINE
+	LOG_FUNC
+	}
+
+EXPORT_C RUsb::~RUsb()
+	{
+	LOG_LINE
+	LOG_FUNC
+	}
+
+EXPORT_C TVersion RUsb::Version() const
+	{
+	return(TVersion(KUsbSrvMajorVersionNumber,KUsbSrvMinorVersionNumber,KUsbSrvBuildVersionNumber));
+	}
+
+EXPORT_C TInt RUsb::Connect()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	TInt retry = 2;
+	
+	FOREVER
+		{
+		// Create the session to UsbSrv with 10 asynchronous message slots
+		TInt err = CreateSession(KUsbServerName, Version(), 10);
+
+		if ((err != KErrNotFound) && (err != KErrServerTerminated))
+			{
+			return err;
+			}
+
+		if (--retry == 0)
+			{
+			return err;
+			}
+
+		err = StartServer();		
+		
+		if ((err != KErrNone) && (err != KErrAlreadyExists))
+			{
+			return err;
+			}
+		}
+	}
+
+EXPORT_C void RUsb::Start(TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbStart, aStatus);
+	}
+
+EXPORT_C void RUsb::StartCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbStartCancel);
+	}
+
+EXPORT_C void RUsb::Stop()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbStop);
+	}
+
+EXPORT_C void RUsb::Stop(TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbStop, aStatus);
+	}
+
+EXPORT_C void RUsb::StopCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbStopCancel);
+	}
+
+EXPORT_C TInt RUsb::GetServiceState(TUsbServiceState& aState)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	CStubber* stubber = CStubber::NewL();
+	TApiBehavior beh( KUsbManStubAgentDll, EServiceState, 0, 0, KNullDesC8 );
+	stubber -> InvokeApi( beh );
+
+	delete stubber;
+	stubber = NULL;
+
+	if ( beh.iOutput != KNullDesC8 )
+	    {           
+	    if ( !beh.iOutput.Compare( _L8( "EUsbServiceIdle" ) ) )
+	        aState = EUsbServiceIdle;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarting" ) ) )
+            aState = EUsbServiceStarting;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarted" ) ) )
+            aState = EUsbServiceStarted;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStopping" ) ) )
+            aState = EUsbServiceStopping;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbServiceFatalError" ) ) )
+            aState = EUsbServiceFatalError;
+	    else
+	    	{}
+	    }
+    else
+        {
+		TPckg<TUint32> pkg(aState);
+		TInt ret=SendReceive(EUsbGetCurrentState, TIpcArgs(&pkg));
+		aState=(TUsbServiceState)pkg();
+		return ret;
+        }
+	return beh.iCompleteCode;
+	}
+
+EXPORT_C TInt RUsb::GetCurrentState(TUsbServiceState& aState)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return GetServiceState(aState);
+	}
+
+EXPORT_C void RUsb::ServiceStateNotification(TUsbServiceState& aState,
+	TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	iServiceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32));
+
+	SendReceive(EUsbRegisterServiceObserver, TIpcArgs(&iServiceStatePkg), aStatus);
+	}
+
+EXPORT_C void RUsb::ServiceStateNotificationCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbCancelServiceObserver);
+	}
+
+EXPORT_C TInt RUsb::GetDeviceState(TUsbDeviceState& aState)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	_LIT8( KLogStubConfigured, "[USBMAN] [StubConfigured]");
+	CUsbLog::Write(KLogStub, KNullDesC8());
+	
+	CStubber* stubber = CStubber::NewL();
+	TApiBehavior beh( KUsbManStubAgentDll, EGetDeviceState, 0, 0, KNullDesC8 );
+	stubber -> InvokeApi( beh );
+
+	delete stubber;
+	stubber = NULL;
+
+	if ( beh.iOutput != KNullDesC8 )
+	    {           
+	    CUsbLog::Write(KLogStub, KNullDesC8());
+	    if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateUndefined" ) ) )
+	        aState = EUsbDeviceStateUndefined;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateDefault" ) ) )
+            aState = EUsbDeviceStateDefault;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAttached" ) ) )
+            aState = EUsbDeviceStateAttached;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStatePowered" ) ) )
+            aState = EUsbDeviceStatePowered;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateConfigured" ) ) )
+	    	{
+            aState = EUsbDeviceStateConfigured;
+    	    CUsbLog::Write(KLogStubConfigured, KNullDesC8());
+	    	}
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAddress" ) ) )
+            aState = EUsbDeviceStateAddress;
+	    else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateSuspended" ) ) )
+            aState = EUsbDeviceStateSuspended;
+	    else
+	    	{}
+	    }
+    else
+        {
+        _LIT8(KLogNoStub, "[USBMAN] [NoStub]");
+        CUsbLog::Write(KLogNoStub, KNullDesC8());
+		TPckg<TUint32> pkg(aState);
+		TInt ret=SendReceive(EUsbGetCurrentDeviceState, TIpcArgs(&pkg));
+		aState=(TUsbDeviceState)pkg();
+		return ret;
+        }
+		
+	return beh.iCompleteCode;
+	}
+
+EXPORT_C void RUsb::DeviceStateNotification(TUint aEventMask, TUsbDeviceState& aState,
+											TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CUsbLog::Write(KLogStub, KNullDesC8());
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+
+    delete stubber;
+    stubber = NULL;
+    
+    TRequestStatus* stat = &aStatus;
+    
+    if ( beh.iOutput != KNullDesC8 )
+        {                        
+        if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateUndefined" ) ) )
+            aState = EUsbDeviceStateUndefined;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateDefault" ) ) )
+            aState = EUsbDeviceStateDefault;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAttached" ) ) )
+            aState = EUsbDeviceStateAttached;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStatePowered" ) ) )
+            aState = EUsbDeviceStatePowered;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateConfigured" ) ) )
+            aState = EUsbDeviceStateConfigured;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAddress" ) ) )
+            aState = EUsbDeviceStateAddress;
+        else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateSuspended" ) ) )
+            aState = EUsbDeviceStateSuspended;
+        else
+            {}
+        User::RequestComplete( stat, beh.iAsyncCompleteCode );
+        }
+    else
+        {
+        iDeviceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32));
+        SendReceive(EUsbRegisterObserver, TIpcArgs(aEventMask, &iDeviceStatePkg), aStatus);
+        }
+
+	}
+
+EXPORT_C void RUsb::DeviceStateNotificationCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, EDeviceStateNotificationCancel, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+
+    delete stubber;
+    stubber = NULL;
+    
+    if ( beh.iOutput != KNullDesC8 )
+        {        
+        
+        }
+    else 
+    	{
+    	SendReceive(EUsbCancelObserver);
+    	}
+	}
+
+EXPORT_C void RUsb::StateNotification(TUint aEventMask, TUsbDeviceState& aState, TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	DeviceStateNotification(aEventMask, aState, aStatus);
+	}
+
+EXPORT_C void RUsb::StateNotificationCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	DeviceStateNotificationCancel();
+	}
+	
+EXPORT_C void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, ETryStartAsync, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+    
+    delete stubber;
+    stubber = NULL;
+    
+    if ( beh.iOutput != KNullDesC8 )
+        {
+        TRequestStatus* stat = &aStatus;
+        User::RequestComplete( stat, beh.iAsyncCompleteCode );
+        }
+    else
+        {    
+		TIpcArgs ipcArgs(aPersonalityId);
+		SendReceive(EUsbTryStart, ipcArgs, aStatus);
+        }
+	}
+
+EXPORT_C void RUsb::TryStop(TRequestStatus& aStatus)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, ETryStopAsync, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+    
+    delete stubber;
+    stubber = NULL;
+    
+    if ( beh.iOutput != KNullDesC8 )
+        {
+        TRequestStatus* stat = &aStatus;
+        User::RequestComplete( stat, beh.iAsyncCompleteCode );
+        }
+    else
+    	SendReceive(EUsbTryStop, aStatus);
+	}
+	
+EXPORT_C TInt RUsb::CancelInterest(TUsbReqType aMessageId)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, ECancelInterest, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+    
+    delete stubber;
+    stubber = NULL;
+	
+    if ( beh.iOutput != KNullDesC8 )
+        {
+        
+        }
+    else
+        {
+		TInt messageId;
+		switch (aMessageId)
+			{
+		case EStart:
+			messageId = EUsbStart;
+			break;
+		case EStop:
+			messageId = EUsbStop;
+			break;
+		case ETryStart:
+			messageId = EUsbTryStart;
+			break;
+		case ETryStop:
+			messageId = EUsbTryStop;
+			break;
+		default:
+			return KErrNotSupported;
+			}
+			
+		TIpcArgs ipcArgs(messageId);
+		return SendReceive(EUsbCancelInterest, ipcArgs);
+        }
+
+    return beh.iCompleteCode;
+	}
+
+EXPORT_C TInt RUsb::GetDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	TInt ret = KErrNone;
+	// caller is responsible for freeing up memory allocatd for aLocalizedPersonalityDescriptor
+	TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize));
+	if (ret == KErrNone)
+		{
+		TPtr ptr = aLocalizedPersonalityDescriptor->Des();
+		TIpcArgs ipcArgs(0, &ptr);
+		ipcArgs.Set(0, aPersonalityId);
+		ret = SendReceive(EUsbGetDescription, ipcArgs);
+		}
+	else
+		{
+		// just in case caller tries to free the memory before checking the return code
+		aLocalizedPersonalityDescriptor = NULL;
+		}
+
+	return ret;	
+	}
+	
+EXPORT_C TInt RUsb::GetCurrentPersonalityId(TInt& aPersonalityId)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CUsbLog::Write(KLogStub, KNullDesC8());
+    CStubber* stubber = CStubber::NewL();
+    TApiBehavior beh( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, KNullDesC8 );
+    stubber -> InvokeApi( beh );
+    
+    delete stubber;
+    stubber = NULL;    
+    
+    if ( beh.iOutput != KNullDesC8 )
+        {
+        if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPCSuite" ) ) )
+            aPersonalityId = KUsbPersonalityIdPCSuite;
+        else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdMS" ) ) )
+            aPersonalityId = KUsbPersonalityIdMS;
+        else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPTP" ) ) )
+            aPersonalityId = KUsbPersonalityIdPTP;
+        else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdMTP" ) ) )
+            aPersonalityId = KUsbPersonalityIdMTP;
+        else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPCSuite" ) ) )
+            aPersonalityId = KUsbPersonalityIdPCSuite;
+        else
+        	{}
+        }
+    else
+        {
+		TPckg<TInt> pkg0(aPersonalityId);
+		TInt ret = SendReceive(EUsbGetCurrentPersonalityId, TIpcArgs(&pkg0));
+		aPersonalityId = static_cast<TInt>(pkg0());
+		return ret;	
+        }
+
+    return beh.iCompleteCode;
+	}
+
+EXPORT_C TInt RUsb::GetSupportedClasses(TInt aPersonalityId, RArray<TUid>& aClassUids)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	TInt ret = KErrNone;
+	HBufC8* buf = NULL;
+	// +1 for the actual count of personality ids
+	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedClasses + 1)*sizeof (TInt32)));
+	if (ret != KErrNone)
+		{
+		return ret;
+		}
+
+	TPtr8 ptr8 = buf->Des();
+	ret = SendReceive(EUsbGetSupportedClasses, TIpcArgs(aPersonalityId, &ptr8));
+		
+	if (ret == KErrNone)
+		{
+		const TInt32* recvedIds = reinterpret_cast<const TInt32*>(buf->Ptr());
+		if (!recvedIds)
+			{
+			delete buf;
+			return KErrCorrupt;
+			}
+			
+		TInt arraySize = *recvedIds++;
+		// Copy received supported class ids to aClassUids
+		for (TInt i = 0; i < arraySize; i++)
+			{
+			if (recvedIds)
+				{
+				ret = aClassUids.Append(TUid::Uid(*recvedIds++));
+				if(ret!=KErrNone)
+					{
+					//Remove all the ids appended so far (assume the last append failed, because
+					//the only reason to fail is if the array couldn't grow to accommodate another
+					//element).
+					//It would be easier to just reset the array, but we never specified that
+					//aClassUids should be an empty array, nor did we specify that this method
+					//might empty the array. To maintain exisiting behaviour we should return
+					//aClassUids to the state it was in when this method was called.
+					TInt last = aClassUids.Count() - 1;
+					while(i>0)
+						{
+						aClassUids.Remove(last);
+						i--;
+						last--;
+						}	
+					break;
+					}
+				}
+			else
+				{
+				ret = KErrCorrupt;
+				break;
+				}
+			}
+		}
+		
+	delete buf;
+	return ret;
+	}
+	
+EXPORT_C TInt RUsb::ClassSupported(TInt aPersonalityId, TUid aClassUid, TBool& aSupported)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	TPckg<TInt32>  	pkg2(aSupported);
+	TIpcArgs ipcArgs(aPersonalityId, aClassUid.iUid, &pkg2);
+	
+	TInt ret = SendReceive(EUsbClassSupported, ipcArgs);
+	
+	if (ret == KErrNone)
+		{
+		aSupported = static_cast<TBool>(pkg2());		
+		}
+		
+	return ret;
+	}
+	
+EXPORT_C TInt RUsb::GetPersonalityIds(RArray<TInt>& aPersonalityIds)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	TInt ret = KErrNone;
+	HBufC8* buf = NULL;
+	// +1 for the actual count of personality ids
+	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedPersonalities + 1)*sizeof (TInt)));
+	if (ret != KErrNone)
+		{
+		return ret;
+		}
+
+	TPtr8 ptr8 = buf->Des();
+	ret = SendReceive(EUsbGetPersonalityIds, TIpcArgs(&ptr8));
+		
+	if (ret == KErrNone)
+		{
+		const TInt* recvedIds = reinterpret_cast<const TInt*>(buf->Ptr());
+		if (!recvedIds)
+			{
+			delete buf;
+			return KErrCorrupt;
+			}
+			
+		TInt arraySize = *recvedIds++;
+		// Copy received personality ids to aPersonalityIds
+		for (TInt i = 0; i < arraySize; i++)
+			{
+			if (recvedIds)
+				{		
+				ret = aPersonalityIds.Append(*recvedIds++);
+				
+				if(ret!=KErrNone)
+					{
+					//Remove all the ids appended so far (assume the last append failed, because
+					//the only reason to fail is if the array couldn't grow to accommodate another
+					//element).
+					//It would be easier to just reset the array, but we never specified that
+					//aPersonalityIds should be an empty array, nor did we specify that this method
+					//might empty the array. To maintain exisiting behaviour we should return
+					//aPersonalityIds to the state it was in when this method was called.
+					TInt last = aPersonalityIds.Count() - 1;
+					while(i>0)
+						{
+						aPersonalityIds.Remove(last);
+						i--;
+						last--;
+						}	
+					break;
+					}
+				}
+			else
+				{
+				ret = KErrCorrupt;
+				break;
+				}
+			}
+		}
+		
+	delete buf;
+	return ret;
+	}
+	
+EXPORT_C TInt RUsb::__DbgMarkHeap()
+	{
+#ifdef _DEBUG
+    return SendReceive(EUsbDbgMarkHeap);
+#else
+    return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RUsb::__DbgCheckHeap(TInt aCount)
+	{
+#ifdef _DEBUG
+    return SendReceive(EUsbDbgCheckHeap, TIpcArgs(aCount));
+#else
+	(void)aCount; // not used for Release builds
+    return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RUsb::__DbgMarkEnd(TInt aCount)
+	{
+#ifdef _DEBUG
+    return SendReceive(EUsbDbgMarkEnd, TIpcArgs(aCount));
+#else
+	(void)aCount; // not used for Release builds
+    return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RUsb::__DbgFailNext(TInt aCount)
+	{
+#ifdef _DEBUG
+    return SendReceive(EUsbDbgFailNext, TIpcArgs(aCount));
+#else
+	(void)aCount; // not used for Release builds
+    return KErrNone;
+#endif
+	}
+
+EXPORT_C TInt RUsb::__DbgAlloc()
+	{
+#ifdef _DEBUG
+    return SendReceive(EUsbDbgAlloc);
+#else
+    return KErrNone;
+#endif
+	}
+
+EXPORT_C void panic()
+	{
+	_USB_PANIC(KUsbCliPncCat, EUsbPanicRemovedExport);
+	}
+
+EXPORT_C TInt RUsb::SetCtlSessionMode(TBool aValue)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+//    CUsbLog::Write(KLogStub, KNullDesC8());
+//    CStubber* stubber = CStubber::NewL();
+//    TApiBehavior beh( KUsbManStubAgentDll, ESetCtlSessionMode, 0, 0, KNullDesC8 );
+//    stubber -> InvokeApi( beh );
+//    
+//    delete stubber;
+//    stubber = NULL;    
+//    
+//    if ( beh.iOutput != KNullDesC8 )
+//        {
+//        return KErrNone;
+//        }
+//    else
+//        {
+        TPckg<TBool> pkg(aValue);
+        return SendReceive(EUsbSetCtlSessionMode, TIpcArgs(&pkg)); 
+//        }
+    
+	}
+
+EXPORT_C TInt RUsb::BusRequest()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbBusRequest);
+	}
+
+EXPORT_C TInt RUsb::BusRespondSrp()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbBusRespondSrp);
+	}
+
+EXPORT_C TInt RUsb::BusClearError()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbBusClearError);
+	}
+
+
+EXPORT_C TInt RUsb::BusDrop()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbBusDrop);
+	}
+
+EXPORT_C void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	iMessagePkg.Set((TUint8*)&aMessage, sizeof(TInt), sizeof(TInt));
+
+	SendReceive(EUsbRegisterMessageObserver, TIpcArgs(&iMessagePkg), aStatus);
+	}
+
+EXPORT_C void RUsb::MessageNotificationCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbCancelMessageObserver);
+	}
+
+EXPORT_C void RUsb::HostEventNotification(TRequestStatus& aStatus,
+										  TDeviceEventInformation& aDeviceInformation)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	iHostPkg.Set((TUint8*)&aDeviceInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation));
+
+	SendReceive(EUsbRegisterHostObserver, TIpcArgs(&iHostPkg), aStatus);
+	}
+	
+EXPORT_C void RUsb::HostEventNotificationCancel()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbCancelHostObserver);
+	}
+
+EXPORT_C TInt RUsb::EnableFunctionDriverLoading()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbEnableFunctionDriverLoading);
+	}
+
+EXPORT_C void RUsb::DisableFunctionDriverLoading()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	SendReceive(EUsbDisableFunctionDriverLoading);
+	}
+
+EXPORT_C TInt RUsb::GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	aLangIds.Reset();
+
+	TInt ret = KErrNone;
+	HBufC8* buf = NULL;
+	// +1 for the actual count of language ids
+	TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedLanguageIds + 1)*sizeof (TUint)));
+	if (ret != KErrNone)
+		{
+		return ret;
+		}
+
+	TPtr8 ptr8 = buf->Des();
+	ret = SendReceive(EUsbGetSupportedLanguages, TIpcArgs(aDeviceId, &ptr8));
+		
+	if (ret == KErrNone)
+		{
+		const TUint* recvedIds = reinterpret_cast<const TUint*>(buf->Ptr());
+		if (!recvedIds)
+			{
+			delete buf;
+			return KErrCorrupt;
+			}
+			
+		TInt arraySize = *recvedIds++;
+		// Copy received language ids to aLangIds
+		for (TInt i = 0; i < arraySize; i++)
+			{
+			ret = aLangIds.Append(*recvedIds++); // increments by sizeof(TUint)
+			if ( ret )
+				{
+				aLangIds.Reset();
+				break;
+				}
+			}
+		}
+		
+	delete buf;	
+	return ret;
+	}
+	
+EXPORT_C TInt RUsb::GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbGetManufacturerStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
+	}
+
+EXPORT_C TInt RUsb::GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbGetProductStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString));
+	}
+
+EXPORT_C TInt RUsb::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor)
+	{
+	LOG_LINE
+	LOG_FUNC
+		
+	TPckg<TOtgDescriptor> otgDescPkg(aDescriptor);
+	
+	TIpcArgs args;
+	args.Set(0, aDeviceId);
+	args.Set(1, &otgDescPkg);
+
+	return SendReceive(EUsbGetOtgDescriptor, args);
+	}
+
+
+EXPORT_C TInt RUsb::RequestSession()
+	{
+	LOG_LINE
+	LOG_FUNC
+
+	return SendReceive(EUsbRequestSession);
+	}
+
+EXPORT_C TInt RUsb::GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+ 	TInt ret = KErrNone;
+	// caller is responsible for freeing up memory allocated for aLocalizedPersonalityDescriptor
+	TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize));
+	if (ret == KErrNone)
+		{
+		TPtr ptr = aLocalizedPersonalityDescriptor->Des();
+		TIpcArgs ipcArgs(0, &ptr);
+		ipcArgs.Set(0, aPersonalityId);
+		ret = SendReceive(EUsbGetDetailedDescription, ipcArgs);
+		}
+	else
+		{
+		// just in case caller tries to free the memory before checking the return code
+		aLocalizedPersonalityDescriptor = NULL;
+		}
+
+	return ret; 
+	}
+
+EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty)
+	{
+	LOG_LINE
+	LOG_FUNC
+
+    CUsbLog::Write(KLogStub, KNullDesC8());
+	TPckg<TUint32> pkg(aProperty);
+	TInt ret = SendReceive(EUsbGetPersonalityProperty, TIpcArgs(aPersonalityId, &pkg));
+	if (ret == KErrNone)
+		{
+		aProperty = static_cast<TUint32>(pkg());
+		}
+
+//    CUsbLog::Write(KLogStub, KNullDesC8());
+//    CStubber* stubber = CStubber::NewL();
+//    TApiBehavior beh( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, KNullDesC8 );
+//    stubber -> InvokeApi( beh );
+//    
+//    delete stubber;
+//    stubber = NULL;
+//
+//    if ( beh.iOutput != KNullDesC8 )
+//        {
+//        if ( !beh.iOutput.Compare( _L8( "stub" ) ) )
+//            {
+//            CUsbLog::Write(KLogStub, KNullDesC8());
+//            TRequestStatus stat;
+//            TInt message;
+//            MessageNotification(stat,message);
+//            DeviceStateNotificationCancel();
+//            TUsbDeviceState aState;
+//            GetDeviceState(aState);
+//            DeviceStateNotification( KUsbAllStates, aState, stat );
+//            TryStop(stat);
+//            User::WaitForRequest(stat);
+//            TInt personalityId;
+//            GetCurrentPersonalityId(personalityId);
+//            TryStart(personalityId,stat);
+//            User::WaitForRequest(stat);
+//            }
+//        else
+//            {}
+//        }
+    
+	return ret;	
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/server/public/rusb.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* 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:
+*
+*/
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef __RUSB_H__
+#define __RUSB_H__
+
+#include <e32std.h>
+#include <usb/usbshared.h>
+
+const TInt KUsbSrvMajorVersionNumber = 1;
+const TInt KUsbSrvMinorVersionNumber = 1;
+const TInt KUsbSrvBuildVersionNumber = 0;
+
+const TInt KUsbMaxSupportedClasses = 64;		// Max number of supported USB classes by a personality
+
+const TInt KUsbMaxSupportedPersonalities = 64;	// Max number of supported personalities
+
+_LIT(KUsbServerName, "!usbman");
+
+enum TUsbMessages
+	{
+	EUsbStart,
+	EUsbStop,
+	EUsbRegisterObserver,
+	EUsbGetCurrentState,
+	EUsbStartCancel,
+	EUsbCancelObserver,
+	EUsbStopCancel,
+	EUsbGetCurrentDeviceState,
+	EUsbRegisterServiceObserver,
+	EUsbCancelServiceObserver,
+	EUsbDbgMarkHeap,
+	EUsbDbgCheckHeap,
+	EUsbDbgMarkEnd,
+	EUsbDbgFailNext,
+	EUsbTryStart,
+	EUsbTryStop,
+	EUsbCancelInterest,
+	EUsbGetCurrentPersonalityId,
+	EUsbGetSupportedClasses,
+	EUsbGetPersonalityIds,
+	EUsbGetDescription,
+	EUsbClassSupported,
+
+	
+	EUsbSetCtlSessionMode,
+	EUsbBusRequest,
+	EUsbBusRespondSrp,
+	EUsbBusClearError,
+
+	EUsbBusDrop,
+	EUsbRegisterMessageObserver,
+	EUsbCancelMessageObserver,
+	EUsbRegisterHostObserver,
+	EUsbCancelHostObserver,
+	EUsbEnableFunctionDriverLoading,
+	EUsbDisableFunctionDriverLoading,
+	EUsbGetSupportedLanguages,
+	EUsbGetManufacturerStringDescriptor,
+	EUsbGetProductStringDescriptor,
+	EUsbGetOtgDescriptor,
+	EUsbDbgAlloc,
+	EUsbRequestSession,
+	EUsbGetDetailedDescription,
+	EUsbGetPersonalityProperty
+	};
+
+_LIT(KUsbCliPncCat, "UsbMan-Client");
+
+enum TUsbPanicClient
+	{
+	EUsbCreateFailure,
+	EUsbPanicIllegalIPC,
+	EUsbPanicRemovedExport
+	};
+
+const TUid KUsbmanSvrUid = {0x101fe1db};
+
+#ifdef __USBMAN_NO_PROCESSES__
+
+const TUint KUsbmanStackSize = 0x3000;			//  12KB
+const TUint KUsbmanMinHeapSize = 0x1000;		//   4KB
+const TUint KUsbmanMaxHeapSize = 0x40000;		// 256KB
+
+_LIT(KUsbmanImg, "usbsvr");
+
+#else
+
+#ifndef __OVER_DUMMYUSBDI__
+_LIT(KUsbmanImg, "z:\\system\\programs\\usbsvr.exe");
+#else
+_LIT(KUsbmanImg, "z:\\system\\programs\\usbsvr_over_dummyusbdi.exe");
+#endif
+
+#endif //__USBMAN_NO_PROCESSES__
+
+#endif //__RUSB_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/testtools/usbman_stub/usbman/server/public/usbman.rh	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* 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:
+* Resource header for usbman configuration.
+*
+*/
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+STRUCT usb_configuration
+	{
+	/** 
+		vendorId is the 16-bit number that is assigned by USB-ORG.
+	 */
+	WORD	vendorId		= 0x0e22;
+
+	/** 
+		productId is a 16-bit number that is assigned by the licensee to 
+		uniquely identify this particular type of device.
+	 */
+	WORD	productId		= 0x000b;
+
+	/** 
+		bcdDevice may be optionally used during enumeration, this depends on 
+		the licensee's policy regarding device upgrades (new versions of a 
+		device may require to use new host driver files)
+	 */
+	WORD	bcdDevice		= 0x0000;
+
+	/** 
+		manufacturerString is displayed on the Windows screen during first 
+		enumeration of the device, and should identify the same company that 
+		owns the USB vendorId given above
+	 */
+	LTEXT	manufacturer	= "Symbian Ltd.";
+
+	/** 
+		productString is displayed on the Windows screen during first 
+		enumeration of the device, and should identify the same device that is 
+		implied by the productId given above
+	 */
+	LTEXT	product			= "Symbian OS";
+	}
+
+STRUCT PERSONALITY
+	{
+	/** 	Class code (assigned by the USB-IF). If this field is set to zero, each interface within 
+		a configuration specifies its own class information and the various interfaces operate independently. 
+
+		If this field is set to a value between 1 and FEH, the device supports different class
+		specifications on different interfaces and the interfaces may not operate independently.
+		This value identifies the class definition used for the aggregate interfaces.
+
+		If this field is set to FFH, the device class is vendor-specific. */
+	BYTE	bDeviceClass;
+
+	/** 	Subclass code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass field.
+		If the bDeviceClass field is set to zero, this field must also be set to zero.
+		If the bDeviceClass field is not set to FFH, all values are reserved for assignment by the USB-IF. */
+	BYTE	bDeviceSubClass;
+
+	/**	Protocol code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass and the
+		bDeviceSubClass fields. If a device supports class-specific protocols on a device basis as opposed to an 
+		interface basis, this code identifies the protocols that the device uses as defined by the specification of the device class.
+		If this field is set to zero, the device does not use class-specific protocols on a device basis. However, it may use 
+		classspecific protocols on an interface basis.
+		If this field is set to FFH, the device uses a vendor-specific protocol on a device basis. */
+	BYTE 	protocol;
+
+	/**	Number of possible configurations */
+	BYTE	numConfigurations;
+
+	/** vendorId is the 16-bit number that is assigned by USB-ORG. */
+	WORD 	vendorId;
+
+	/** productId is a 16-bit number that is assigned by the licensee to 
+	uniquely identify this particular personality as type of device . */
+	WORD 	productId;
+
+	/** 	bcdDevice may be optionally used during enumeration, this depends on 
+		the licensee's policy regarding device upgrades */
+	WORD 	bcdDevice;
+
+	/** 	manufacturerString is displayed on the Windows screen during first 
+		enumeration of the device, and should identify the same company that 
+		owns the USB vendorId given above */
+	LTEXT 	manufacturer;
+	
+	/** 	productString is displayed on the Windows screen during first 
+		enumeration of the device, and should identify the same device that is 
+		implied by the productId given above */
+	LTEXT 	product;
+
+	/**	personality id - UID which identified this personality */
+	WORD 	id;					 
+	
+	/**	list of Class Controllers UIDs associated with this personality.
+		UIDs shoud be provided as list of hexadecimal numbers separated by space or comma.
+		Note Do not provide leading 0x or any trailing characters!
+		Example "1Abc3422, 12345678  FE43bc33"
+		Incorrect example "1abc3422, 0x12345678," */
+	LTEXT	class_uids;			
+	
+	/** 	free text description of this personality. */
+	LTEXT 	description;
+
+	/**     free text detailed description of this personality. */
+	LTEXT   detailedDescription;
+
+	/**	personality property - the property of this personality */
+	LONG 	property;					 
+
+	}
+	
+STRUCT PERSONALITY_ARRAY
+	{
+	STRUCT	personalities[];	// STRUCT PERSONALITY
+	}	 
--- a/usbclasses/group/bld.inf	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -19,4 +19,8 @@
 #include "../usbobexclasscontroller/group/bld.inf"
 #include "../usbbasicpersonality/group/bld.inf"
 #include "../usbmscpersonality/group/bld.inf"
+//#include "../ptpstack/group/bld.inf"
+//#include "../sicdusbplugin/group/bld.inf"
+//#include "../ptpserver/group/bld.inf"
+#include "../pictbridgeengine/group/bld.inf"
 #include "../usbphoneasmodem/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/BWINS/pictbridgeU.DEF	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,27 @@
+EXPORTS
+	?CancelDpsEventNotify@CDpsEngine@@QAEXXZ @ 1 NONAME ; void CDpsEngine::CancelDpsEventNotify(void)
+	?CancelDpsRequest@CDpsEngine@@QAEXXZ @ 2 NONAME ; void CDpsEngine::CancelDpsRequest(void)
+	?CancelPrintMode@CDpsEngine@@QAEXXZ @ 3 NONAME ; void CDpsEngine::CancelPrintMode(void)
+	?ConnectStateNotify@CDpsEngine@@QAEXAAVTRequestStatus@@@Z @ 4 NONAME ; void CDpsEngine::ConnectStateNotify(class TRequestStatus &)
+	?CreateReqScriptL@TDpsGetCapability@@EAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 5 NONAME ; void TDpsGetCapability::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
+	?CreateReqScriptL@TDpsStartJob@@EAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 6 NONAME ; void TDpsStartJob::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
+	?CreateReqScriptL@TMDpsOperation@@MAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 7 NONAME ; void TMDpsOperation::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
+	?Delete@CDpsEngine@@QAEXXZ @ 8 NONAME ; void CDpsEngine::Delete(void)
+	?DoDpsRequestL@CDpsEngine@@QAEXPAVTMDpsOperation@@AAVTRequestStatus@@@Z @ 9 NONAME ; void CDpsEngine::DoDpsRequestL(class TMDpsOperation *, class TRequestStatus &)
+	?DpsEventNotify@CDpsEngine@@QAEXAAVTDpsEvents@@AAVTRequestStatus@@@Z @ 10 NONAME ; void CDpsEngine::DpsEventNotify(class TDpsEvents &, class TRequestStatus &)
+	?DpsFolder@CDpsEngine@@QBEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CDpsEngine::DpsFolder(void) const
+	?FillRepArgs@TDpsConfigPrintService@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 12 NONAME ; int TDpsConfigPrintService::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
+	?FillRepArgs@TDpsGetCapability@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 13 NONAME ; int TDpsGetCapability::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
+	?FillRepArgs@TDpsGetJobStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 14 NONAME ; int TDpsGetJobStatus::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
+	?FillRepArgs@TDpsGetPrinterStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 15 NONAME ; int TDpsGetPrinterStatus::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
+	?FillReqArgs@TDpsAbortJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 16 NONAME ; int TDpsAbortJob::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
+	?FillReqArgs@TDpsConfigPrintService@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 17 NONAME ; int TDpsConfigPrintService::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
+	?FillReqArgs@TDpsGetCapability@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 18 NONAME ; int TDpsGetCapability::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
+	?FillReqArgs@TDpsStartJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 19 NONAME ; int TDpsStartJob::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
+	?GetDpsConfigL@CDpsEngine@@QAEXAAVTDpsConfigPrintReq@@@Z @ 20 NONAME ; void CDpsEngine::GetDpsConfigL(class TDpsConfigPrintReq &)
+	?GetEngineL@CDpsEngine@@SAPAV1@XZ @ 21 NONAME ; class CDpsEngine * CDpsEngine::GetEngineL(void)
+	?GetParamNum@TDpsStartJobReq@@QAEHXZ @ 22 NONAME ; int TDpsStartJobReq::GetParamNum(void)
+	?Reset@TDpsJobStatusRep@@QAEXXZ @ 23 NONAME ; void TDpsJobStatusRep::Reset(void)
+	?Reset@TDpsPrintInfo@@QAEXXZ @ 24 NONAME ; void TDpsPrintInfo::Reset(void)
+	?SetPrintMode@CDpsEngine@@QAEXAAVTRequestStatus@@@Z @ 25 NONAME ; void CDpsEngine::SetPrintMode(class TRequestStatus &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/EABI/pictbridgeU.DEF	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,41 @@
+EXPORTS
+	_ZN10CDpsEngine10GetEngineLEv @ 1 NONAME
+	_ZN10CDpsEngine12SetPrintModeER14TRequestStatus @ 2 NONAME
+	_ZN10CDpsEngine13DoDpsRequestLEP14TMDpsOperationR14TRequestStatus @ 3 NONAME
+	_ZN10CDpsEngine13GetDpsConfigLER18TDpsConfigPrintReq @ 4 NONAME
+	_ZN10CDpsEngine14DpsEventNotifyER10TDpsEventsR14TRequestStatus @ 5 NONAME
+	_ZN10CDpsEngine15CancelPrintModeEv @ 6 NONAME
+	_ZN10CDpsEngine16CancelDpsRequestEv @ 7 NONAME
+	_ZN10CDpsEngine18ConnectStateNotifyER14TRequestStatus @ 8 NONAME
+	_ZN10CDpsEngine20CancelDpsEventNotifyEv @ 9 NONAME
+	_ZN10CDpsEngine6DeleteEv @ 10 NONAME
+	_ZN12TDpsAbortJob11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 11 NONAME
+	_ZN12TDpsStartJob11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 12 NONAME
+	_ZN12TDpsStartJob16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 13 NONAME
+	_ZN13TDpsPrintInfo5ResetEv @ 14 NONAME
+	_ZN14TMDpsOperation16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 15 NONAME
+	_ZN15TDpsStartJobReq11GetParamNumEv @ 16 NONAME
+	_ZN16TDpsGetJobStatus11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 17 NONAME
+	_ZN16TDpsJobStatusRep5ResetEv @ 18 NONAME
+	_ZN17TDpsGetCapability11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 19 NONAME
+	_ZN17TDpsGetCapability11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 20 NONAME
+	_ZN17TDpsGetCapability16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 21 NONAME
+	_ZN20TDpsGetPrinterStatus11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 22 NONAME
+	_ZN22TDpsConfigPrintService11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 23 NONAME
+	_ZN22TDpsConfigPrintService11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 24 NONAME
+	_ZNK10CDpsEngine9DpsFolderEv @ 25 NONAME
+	_ZTI12TDpsAbortJob @ 26 NONAME ; #<TI>#
+	_ZTI12TDpsStartJob @ 27 NONAME ; #<TI>#
+	_ZTI14TMDpsOperation @ 28 NONAME ; #<TI>#
+	_ZTI16TDpsGetJobStatus @ 29 NONAME ; #<TI>#
+	_ZTI17TDpsGetCapability @ 30 NONAME ; #<TI>#
+	_ZTI20TDpsGetPrinterStatus @ 31 NONAME ; #<TI>#
+	_ZTI22TDpsConfigPrintService @ 32 NONAME ; #<TI>#
+	_ZTV12TDpsAbortJob @ 33 NONAME ; #<VT>#
+	_ZTV12TDpsStartJob @ 34 NONAME ; #<VT>#
+	_ZTV14TMDpsOperation @ 35 NONAME ; #<VT>#
+	_ZTV16TDpsGetJobStatus @ 36 NONAME ; #<VT>#
+	_ZTV17TDpsGetCapability @ 37 NONAME ; #<VT>#
+	_ZTV20TDpsGetPrinterStatus @ 38 NONAME ; #<VT>#
+	_ZTV22TDpsConfigPrintService @ 39 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2006-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 the build info file for PictBridge engine. 
+*
+*/
+
+
+#include <platform_paths.hrh>
+PRJ_MMPFILES
+pictbridge.mmp
+
+PRJ_EXPORTS
+../rom/pictbridge.iby CORE_MW_LAYER_IBY_EXPORT_PATH(pictbridge.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/group/pictbridge.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006, 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 the project file for PictBridge engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET        	pictbridge.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10274798
+CAPABILITY 	    CAP_GENERAL_DLL
+VENDORID 	    VID_DEFAULT
+
+USERINCLUDE 	../inc
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/xml 
+
+SOURCEPATH      ../src
+SOURCE          pictbridge.cpp
+SOURCE          dpsxmlstring.cpp
+SOURCE		    dpsxmlparser.cpp
+SOURCE		    dpsxmlgenerator.cpp
+SOURCE          dpsstatemachine.cpp
+SOURCE          dpsoperation.cpp
+SOURCE          dpsparam.cpp
+SOURCE          dpstransaction.cpp
+SOURCE          dpsstate.cpp
+SOURCE			dpsfile.cpp
+SOURCE			dpsusbnotifier.cpp
+SOURCE 			dpsscriptsender.cpp
+SOURCE			dpsscriptreceiver.cpp
+SOURCE			dpsptpnotifier.cpp
+SOURCE			dpsconnectnotifier.cpp
+
+START RESOURCE dps.rss
+TARGETPATH resource
+HEADER
+END
+
+LIBRARY     euser.lib xmlframework.lib efsrv.lib bafl.lib platformenv.lib
+LIBRARY     rptp.lib usbman.lib usbwatcher.lib centralrepository.lib estor.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dps.rh	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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:  The resource header file for Dps configuration. 
+*
+*/
+
+
+STRUCT dps_configuration
+    {
+    BYTE numOfVersions = 1;
+    BYTE versionMajor = 1;
+    BYTE versionMinor = 0;
+    LTEXT vendorName = "Nokia";
+    BYTE vendorSpecificVersionMajor = 1;
+    BYTE vendorSpecificVersionMinor = 0;
+    LTEXT productName = "S60";
+    LTEXT serialNo = "0123456";
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsconnectnotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006, 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 class defines functions of the notification of the 
+*                PTP printer connction and disconnection. 
+*
+*/
+
+
+#ifndef DPSCONNECTNOTIFIER_H
+#define DPSCONNECTNOTIFIER_H
+
+#include <e32base.h>
+#include <usbstates.h>
+
+class CDpsUsbNotifier;
+
+/**
+*   Class for monitoring usb cable connection/disconnection 
+*/
+NONSHARABLE_CLASS(CDpsConnectNotifier) : public CActive
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aParent the pointer to UsbNotifier object
+        *   @return a new created ConnectNotifier object
+        */
+        static CDpsConnectNotifier* NewL(CDpsUsbNotifier* aParent);
+        
+        /**
+        *   Destructor
+        */
+        ~CDpsConnectNotifier();
+        
+        /**
+        *   Called by UsbNotifier to subscribe connection notification
+        */
+        void ConnectNotify();
+        
+    private: // Functions derived from CActive.
+	    /**
+	    *   @see CActive
+	    */
+    	void RunL();
+    	
+    	/**
+    	*   @see CActive
+    	*/
+	    void DoCancel();
+	    
+	    /**
+	    *   @see CActive
+	    */
+	    TInt RunError(TInt aError);
+	    
+	private:
+	    /**
+	    *   Second phase constructor
+	    */
+		void ConstructL();
+	    
+	    /**
+	    *   Default constructor
+	    */
+	    CDpsConnectNotifier(CDpsUsbNotifier* aParent);
+	    
+	private:
+	    // not owned by this class
+	    CDpsUsbNotifier* iNotifier;    
+    };
+    
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsconst.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps constance. 
+*
+*/
+
+
+
+#ifndef DPSCONST_H
+#define DPSCONST_H
+#include <e32base.h>
+#include <usbpersonalityids.h>
+
+_LIT(KDpsEnginePanicCat, "Dps Engine");
+const TInt KShiftLength = 16;
+const TInt KFullWordWidth = 8;
+
+// <dps><input|output><operation|event|result></result|/event|/operation>
+//	</output|/input></dps> 
+enum TDpsXmlAction
+    {
+    EDpsXmlEmpty = 0,
+    EDpsXmlStart,
+    EDpsXmlInput,
+    EDpsXmlOutput,
+    EDpsXmlOperation,
+    EDpsXmlEvent,
+    EDpsXmlResult
+    };    
+
+enum TDpsOperation
+    {
+    EDpsOpEmpty = 0,
+    EDpsOpConfigPrintService,
+    EDpsOpGetCapability,
+    EDpsOpGetJobStatus,
+    EDpsOpGetDeviceStatus,
+    EDpsOpStartJob,
+    EDpsOpAbortJob,
+    EDpsOpContinueJob,
+    EDpsOpGetFileID,
+    EDpsOpGetFileInfo,
+    EDpsOpGetFile,
+    EDpsOpGetPartialFile,
+    EDpsOpGetFileList,
+    EDpsOpGetThumb,
+    EDpsOpMax
+    };
+
+_LIT8(KDpsXmlResult, "result");
+_LIT8(KDpsXmlInput, "input");
+_LIT8(KDpsXmlOutput, "output");
+_LIT8(KDpsXmlPaperTypes, "paperTypes");
+_LIT8(KDpsXmlLayouts, "layouts");
+_LIT8(KDpsXmlPaperSize, "paperSize");
+_LIT8(KDpsXml, "dps");
+
+_LIT8(KDpsXmlHeader, "<?xml version=\"1.0\"?>");
+_LIT8(KDpsXmlNS, "<dps xmlns=\"http://www.cipa.jp/dps/schema/\">");
+_LIT8(KDpsXmlBraceOpen, "<");
+_LIT8(KDpsXmlBraceClose, ">");
+_LIT8(KDpsXmlSlash, "/");
+_LIT8(KDpsXmlSpace, " ");
+_LIT8(KDpsXmlEqual, "=");
+_LIT8(KDpsXmlQuote, "\"");
+
+const TUint KSlash = 0x2F;
+const TUint KBackSlash = 0x5C;
+const TUint KSOH = 0x1;
+const TUint KSpace = 0x20;
+
+const TUint32 KDpsMajorMask = 0xffff0000;
+const TUint32 KDpsMinorMask = 0x0000ffff;
+
+
+_LIT8(KDpsLowZero, "0000");
+_LIT(KDpsScriptFile, ".DPS" );
+_LIT(KDpsDeviceResponseFileName, "DRSPONSE.DPS");
+_LIT(KDpsDeviceRequestFileName, "DREQUEST.DPS");
+_LIT(KDpsHostResponseFileName, "HRSPONSE.DPS");
+_LIT(KDpsHostRequestFileName, "HREQUEST.DPS");
+_LIT8(KDpsXmlMimeType, "text/xml");
+
+const TInt KDpsResourceVersion = 0;
+_LIT(KDpsResource, "resource\\dps.rsc");
+
+
+#endif // DPSDEFS_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsdefs.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,483 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps definations. 
+*
+*/
+
+
+#ifndef DPSDEFS_H
+#define DPSDEFS_H
+
+#include <e32base.h>
+
+const TInt KMaxArgLen = 256;
+const TInt KDateLen = 32;
+
+// special element which has sub-elements, only startJob and 
+// getCapability have this field
+enum TDpsElement
+    {
+    EDpsEleEmpty = 0,
+    EDpsCapability,
+    EDpsJobConfig,
+    EDpsPrintInfo,
+    KDpsEleMax
+    };
+    
+enum TDpsEvent
+    {
+    EDpsEvtEmpty = 0,
+    EDpsEvtNotifyJobStatus,
+    EDpsEvtNotifyDeviceStatus,
+    KDpsEvtMax
+    };
+	
+enum TDpsArgument
+    {
+    EDpsArgDpsVersions = 0,
+    EDpsArgVendorName,
+    EDpsArgVendorSpecificVersion,
+    EDpsArgProductName,
+    EDpsArgSerialNo,
+    EDpsArgPrintServiceAvailable,
+    EDpsArgQualities,
+    EDpsArgPaperSizes,
+    EDpsArgPaperTypes,
+    EDpsArgFileTypes,
+    EDpsArgDatePrints,
+    EDpsArgFileNamePrints,
+    EDpsArgImageOptimizes,
+    EDpsArgLayouts,
+    EDpsArgFixedSizes,
+    EDpsArgChroppings,
+    EDpsArgPrtPID,
+    EDpsArgFilePath,
+    EDpsArgCopyID,
+    EDpsArgProgress,
+    EDpsArgImagePrinted,
+    EDpsArgDpsPrintServiceStatus,
+    EDpsArgJobEndReason,
+    EDpsArgErrorStatus,
+    EDpsArgErrorReason,
+    EDpsArgDisconnectEnable,
+    EDpsArgCapabilityChanged,
+    EDpsArgNewJobOk,
+    EDpsArgQuality,
+    EDpsArgPaperSize,
+    EDpsArgPaperType,
+    EDpsArgFileType,
+    EDpsArgDatePrint,
+    EDpsArgFileNamePrint,
+    EDpsArgImageOptimize,
+    EDpsArgLayout,
+    EDpsArgFixedSize,
+    EDpsArgCropping,
+    EDpsArgCroppingArea,
+    EDpsArgFileID,
+    EDpsArgFileName,
+    EDpsArgDate,
+    EDpsArgCopies,
+    EDpsArgAbortStyle,
+    EDpsArgImagesPrinted,
+    EDpsArgBasePathID,
+    EDpsArgFileSize,
+    EDpsArgThumbFormat,
+    EDpsArgThumbSize,
+    EDpsArgBytesRead,
+    EDpsArgOffset,
+    EDpsArgMaxSize,
+    EDpsArgParentFileID,
+    EDpsArgMaxNumIDs,
+    EDpsArgFileIDs,
+    EDpsArgNumIDs,
+    EDpsArgMax
+    };
+
+// define the DPS action result
+// ref: DPS spec page 52
+// high bits
+enum TDpsResultMajorCode
+    {
+    EDpsResultOk = 0x1000,
+    EDpsResultNotExecuted = 0x1001,
+    EDpsResultNotSupported = 0x1002,
+    EDpsResultNotRecognized = 0x1003
+    };
+	
+// define the DPS action result minor code
+// ref: DPS spec page 52
+// low bits
+enum TDpsResultMinorCode
+    {
+    EDpsResultNone = 0x0000,
+    EDpsResultUnrecognizedParam = 0x0001,
+    EDpsResultillegalParam = 		0x0002,
+    EDpsResultMissingParam = 		0x0003,
+    EDpsResultBufferOverflow = 	0x0004	
+    };
+
+// define the DPS service availability
+// ref: DPS spec page 53
+// only high bits are useful
+enum TDpsServiceAvailability
+    {
+    EDpsPrintServiceAvailableFalse = 0x3000,
+    EDpsPrintServiceAvailableTrue = 0x3001	
+    };
+
+// define printing qualities
+// ref: DPS spec page 54
+// only high bits are useful
+enum TDpsPrintQuality
+    {
+    EDpsPrintQualityDefault = 0x5000,
+    EDpsPrintQualityNormal = 	0x5001,
+    EDpsPrintQualityDraft = 	0x5002,
+    EDpsPrintQualityFine = 	0x5003	
+    };
+
+// define paper sizes
+// ref: DPS spec page 54
+// only high bits are useful
+enum TDpsPaperSizes
+    {
+    EDpsPaperSizeDefault = 	0x5100,
+    EDpsPaperSizeL = 		0x5101,
+    EDpsPaperSize2L = 		0x5102,
+    EDpsPaperSizePostcard = 0x5103,
+    EDpsPaperSizeCard = 	0x5104,
+    EDpsPaperSize100x150 = 	0x5105,
+    EDpsPaperSize4x6 = 		0x5106,
+    EDpsPaperSize8x10 = 	0x5107,
+    EDpsPaperSizeLetter = 	0x5108,
+    EDpsPaperSize11x17 = 	0x510A,
+    EDpsPaperSizeA0 = 		0x5110,
+    EDpsPaperSizeA1 = 		0x5111,
+    EDpsPaperSizeA2 = 		0x5112,
+    EDpsPaperSizeA3 = 		0x5113,
+    EDpsPaperSizeA4 = 		0x5114,
+    EDpsPaperSizeA5 = 		0x5115,
+    EDpsPaperSizeA6 = 		0x5116,
+    EDpsPaperSizeA7 = 		0x5117,
+    EDpsPaperSizeA8 = 		0x5118,
+    EDpsPaperSizeA9 = 		0x5119,
+    EDpsPaperSizeB0 = 		0x5120,
+    EDpsPaperSizeB1 = 		0x5121,
+    EDpsPaperSizeB2 = 		0x5122,
+    EDpsPaperSizeB3 = 		0x5123,
+    EDpsPaperSizeB4 = 		0x5124,
+    EDpsPaperSizeB5 = 		0x5125,
+    EDpsPaperSizeB6 = 		0x5126,
+    EDpsPaperSizeB7 = 		0x5127,
+    EDpsPaperSizeB8 = 		0x5128,
+    EDpsPaperSizeB9 = 		0x5129,
+    EDpsPaperSize89 = 		0x5181,
+    EDpsPaperSize127 = 		0x5182,
+    EDpsPaperSize100 = 		0x5186,
+    EDpsPaperSize210 = 		0x5194
+    };
+// define paper types
+// ref: DPS spec page 54
+// only high bits are useful
+enum TDpsPaperTypeMajor
+    {
+    EDpsPaperTypeDefault = 		0x5200,
+    EDpsPaperTypePlainPaper = 	0x5201,
+    EDpsPaperTypePhotoPaper = 	0x5202,
+    EDpsPaperTypeFastPhotopaper = 	0x5203	
+    };
+
+enum TDpsPaperTypeMinor
+    {
+    EDpsPaperTypeStationery = 1,
+    EDpsPaperTypeStationeryCoated,
+    EDpsPaperTypeStationeryInkjet,
+    EDpsPaperTypeStationeryPreprinted,
+    EDpsPaperTypeStationeryLetterhead,
+    EDpsPaperTypeStationeryPrepunched,
+    EDpsPaperTypeStationeryFine,
+    EDpsPaperTypeStationeryHeavyweight,
+    EDpsPaperTypeStationeryLightweight,
+    EDpsPaperTypeTransparency,
+    EDpsPaperTypeEnvelope,
+    EDpsPaperTypeEnvelopePlain,
+    EDpsPaperTypeEnvelopeWindow,
+    EDpsPaperTypeContinuous,
+    EDpsPaperTypeContinuousLong,
+    EDpsPaperTypeContinuousShort,
+    EDpsPaperTypeTabStock,
+    EDpsPaperTypePreCutTabs,
+    EDpsPaperTypeFullCutTabs,
+    EDpsPaperTypeMultiPartForm,
+    EDpsPaperTypeLabels,
+    EDpsPaperTypeMultiLayer,
+    EDpsPaperTypeScreen,
+    EDpsPaperTypeScreenPaged,
+    EDpsPaperTypePhotographic,
+    EDpsPaperTypePhotographicGlossy,
+    EDpsPaperTypePhotographicHighGloss,
+    EDpsPaperTypePhotographicSemiGloss,
+    EDpsPaperTypePhotographicSatin,
+    EDpsPaperTypePhotographicMatte,
+    EDpsPaperTypePhotographicFilm,
+    EDpsPaperTypeBackPrintFilm,
+    EDpsPaperTypeCardStock
+    };
+    
+struct TDpsPaperType
+    {
+    TDpsPaperTypeMajor iMajor;
+    TDpsPaperTypeMinor iMinor;
+    };
+
+// define file types
+// ref: DPS sepc page 55
+// only high bits are useful
+enum TDpsFileType
+    {
+    EDpsFileTypeDefault =   0x5300,
+    EDpsFileTypeEXIF =      0x5301,
+    EDpsFileTypeJPEG =      0x5303	
+    };
+
+// define date print
+// ref: DPS sepc page 55
+// only high bits are useful
+enum TDpsDatePrint
+    {
+    EDpsDatePrintDefault = 0x5400,
+    EDpsDatePrintOff = 0x5401,
+    EDpsDatePrintOn = 0x5402
+    };
+
+// define fle name print
+// ref: DPS sepc page 56
+// only high bits are useful
+enum TDpsFileNamePrint
+    {
+    EDpsFileNamePrintDefault = 	0x5500,
+    EDpsFileNamePrintOff = 		0x5501,
+    EDpsFileNamePrintOn = 		0x5503	
+    };
+
+// define image optimization
+// ref: DPS sepc page 56
+// only high bits are useful
+enum TDpsImageOptimize
+    {
+    EDpsImageOptimizeDefault = 	0x5600,
+    EDpsImageOptimizeOff = 		0x5601,
+    EDpsImageOptimizeOn = 		0x5603	
+    };
+
+// define layouts
+// ref: DPS sepc page 56
+// only high bits are useful
+enum TDpsLayout
+    {
+    EDpsLayoutDefault = 	0x5700,
+    EDpsLayout1Up = 		0x5701,
+    EDpsLayout2Up = 		0x5702,
+    EDpsLayout3Up = 		0x5703,
+    EDpsLayout4Up = 		0x5704,
+    EDpsLayout5Up = 		0x5705,
+    EDpsLayout6Up = 		0x5706,
+    EDpsLayout7Up = 		0x5707,
+    EDpsLayout8Up = 		0x5708,
+    EDpsLayout9Up = 		0x5709,
+    EDpsLayoutIndex = 		0x57FE,
+    EDpsLayoutBorderless =  0x57FF	
+    };
+
+// define fixed sizes
+// ref: DPS sepc page 57
+// only high bits are useful
+enum TDpsFixedSizes
+    {
+    EDpsFixedSizeDefault =  0x5800,
+    EDpsFixedSize4x6 =      0x5803,
+    EDpsFixedSize5x7 =      0x5804,
+    EDpsFixedSizeA4 =       0x5811,
+    EDpsFixedSizeLetter =   0x5812
+    };
+
+// define croppings
+// ref: DPS sepc page 57
+// only high bits are useful
+enum TDpsCropping
+    {
+    EDpsCroppingDefault = 	0x5900,
+    EDpsCroppingOff = 		0x5901,
+    EDpsCroppingOn = 		0x5902	
+    };
+
+// define Device status
+// ref: DPS sepc page 61
+// only high bits are useful
+// 1. Print service status
+enum TDpsPrintServiceStatus
+    {
+    EDpsPrintServiceStatusInit = 0,
+    EDpsPrintServiceStatusPrinting = 	0x7000,
+    EDpsPrintServiceStatusIdle = 		0x7001,
+    EDpsPrintServiceStatusPaused = 		0x7002
+    };
+    
+enum TDpsJobStatus
+    {
+    // 2. Job end reasons
+    EDpsJobStatusNotEnded = 					0x7100,
+    EDpsJobStatusEndedOk = 						0x7101,
+    EDpsJobStatusEndedAbortImmediately = 		0x7102,
+    EDpsJobStatusEndedAbortCompleteCurrent = 	0x7103,
+    EDpsJobStatusEndedOther = 					0x7104    
+    };	
+	
+	// 3. Error status
+enum TDpsErrorStatus
+    {
+    EDpsErrorStatusOk =         0x7200,
+    EDpsErrorStatusWarning = 	0x7201,
+    EDpsErrorStatusFatal = 	    0x7202
+    };
+         
+enum TDpsJobEndReasonMajor
+    {
+    // 4. Job end reasons
+    EDpsJobErrorNone = 		0x7300,
+    EDpsJobErrorPaper = 	0x7301,
+    EDpsJobErrorInk = 		0x7302,
+    EDpsJobErrorHardware = 	0x7303,
+    EDpsJobErrorFile = 		0x7304    
+    };
+
+enum TDpsJobEndReasonPaper
+    {
+    EDpsPaperDefault = 0,
+    EDpsPaperEmpty = 0x0100,
+    EDpsPaperLoad = 0x200,
+    EDpsPaperEject = 0x300,
+    EDpsPaperMedia = 0x400,
+    EDpsPaperJam = 0x500,
+    EDpsPaperNearlyEmpty = 0x600,
+    EDpsPaperTypeSizeNoMatch = 0x700
+    };
+ 
+enum TDpsJobEndReasonInk
+    {
+    EDpsInkDefault = 0,
+    EDpsInkEmpty = 0x100,
+    EDpsInkLow = 0x200,
+    EDpsInkWaste = 0x300   
+    };
+   
+enum TDpsJobEndReasonHard
+    {
+    EDpsHardDefault = 0,
+    EDpsHardFatal = 0x0100,
+    EDpsHardServiceCall = 0x0200,
+    EDpsHardNotAvailable = 0x0300,
+    EDpsHardBusy = 0x0400,
+    EDpsHardLever = 0x0500,
+    EDpsHardCoverOpen = 0x0600,
+    EDpsHardNoMarkingHead = 0x0700,
+    EDpsHardInkCoverOpen = 0x0800,
+    EDpsHardNoInkCartridge = 0x0900
+    };
+    
+enum TDpsJobEndReasonFile
+    {
+    EDpsFileDefault = 0,
+    EDpsFilePrintInfo = 0x0100,
+    EDpsFileDecode = 0x0200
+    };
+    
+struct TDpsJobEndReason 
+    {
+    TDpsJobEndReasonMajor iMajor;
+    TDpsJobEndReasonPaper iPaperMinor;
+    TDpsJobEndReasonInk iInkMinor;
+    TDpsJobEndReasonHard iHardMinor;
+    TDpsJobEndReasonFile iFileMinor;
+    };
+    
+enum TDpsDisconnectEnable
+    {
+    // 5. Disconnect Enable
+    EDpsDisconnectEnableFalse = 0x7400,
+    EDpsDisconnectEnableTrue = 	0x7401    
+    };
+    
+enum TDpsCapabilityChanged
+    {
+	// 6. Capability changes
+    EDpsCapabilityChangedFalse = 	0x7500,
+    EDpsCapabilityChangedTrue = 	0x7501
+    };
+    
+enum TDpsNewJobOk
+    {
+    // 7. New Job Ok
+    EDpsNewJobOkFalse = 	0x7600,
+    EDpsNewJobOkTrue = 		0x7601	
+    };
+
+
+// define error reason minor codes
+// ref: DPS sepc page 62
+enum TDpsErrorMinorCode
+    {
+    EDpsErrorPaperEmpty =       0x0100,
+    EDpsErrorPaperJam =         0x0500,
+    EDpsErrorPaperUnsupport =   0x0700,
+    EDpsErrorInkEmpty =         0x0100
+    };
+
+// define About style
+// ref: DPS spec page 68
+// only high bits are useful
+enum TDpsAbortStyle
+    {
+    EDpsAbortStyleImmediately = 		0x9000,
+    EDpsAbortStyleCompleteCurrent = 	0x9001	
+    };
+
+typedef TUint TDpsAttribute;
+
+struct TDpsEle
+    {
+    TDpsElement iElement;
+    // number of arguments included in this element
+    TInt		iNum;
+    };
+    
+typedef RArray<TDpsEle> TDpsEleArray;
+
+struct TDpsArg
+    {
+    TDpsArgument 	iElement;
+    TBuf8<KMaxArgLen>		iContent;
+    };
+	 
+// used for get DPS respond	
+typedef RArray<TDpsArg> TDpsArgArray;
+
+struct TDpsResult
+    {
+    TDpsResultMajorCode iMajorCode;
+    TDpsResultMinorCode iMinorCode;	
+    };
+	
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsfile.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2006, 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 class reads and writes the file content. 
+*
+*/
+
+
+#ifndef DPSFILE_H
+#define DPSFILE_H
+
+#include <e32base.h>
+#include <f32file.h>
+
+/**
+*   This class creates, reads, writes and deletes dps files.
+*/
+NONSHARABLE_CLASS(CDpsFile) : public CBase
+    {
+public:
+    /**
+    * Two-phased constructor.
+    * @return An instance of CDpsFile.
+    */
+    static CDpsFile* NewL();
+	
+    /**
+    * C++ destructor.
+    */
+    ~CDpsFile();
+
+public: 
+    /**
+    *   Creates the dps script file
+    *   @param aFileName the script file name
+    *   @param aScript the script file content
+    *   @aFileSize the file size
+    *   @return KErrNone if successful or systme wide error if failed
+    */
+    TInt CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript, 
+                          const TInt aFileSize);
+
+    /**
+    *   Gets the content of the script file
+    *   @param aFileName the file name
+    *   @param aScript the file content. It has the valid content after this 
+    *   call is returned.
+    *   @return KErrNone if successful or systme wide error if failed
+    */						  
+    void GetContentL(const TDesC& aFileName, TDes8& aScript);
+	
+    /**
+    *   Deletes the file
+    *   @param aFileName the name of the file to be delted.
+    *   @return KErrNone if successful or systme wide error if failed
+    */
+    TInt Delete(const TDesC& aFileName);
+    
+    /**
+    *   @return RFs& the reference to the file server session, which
+    *   is shared by the whole component (dps engine binary)
+    */
+    inline RFs& FileSession();
+    
+    void FileSizeL(const TDesC& aFileName, TInt& aSize);
+	
+private:
+    
+    /**
+    *   Second phase constructor
+    */
+    void ConstructL();
+    
+private:
+    // file server session, owned by this class
+    RFs iFs;
+    };
+    
+#include "dpsfile.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsfile.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006, 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 class reads and writes the file content. 
+*
+*/
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+RFs& CDpsFile::FileSession()
+    {
+    return iFs;
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsoperation.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,312 @@
+/*
+* Copyright (c) 2006, 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 classes define dps operations requests and replys. 
+*
+*/
+
+
+#ifndef DPSOPERATION_H
+#define DPSOPERATION_H
+
+#include <s32file.h>
+#include "dpsparam.h"
+
+class CDpsTransaction;
+/**
+*   This is the base class for all dps operations. 
+*/
+class TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        inline TMDpsOperation();
+        /**
+        *   Fills in dps operation request parameters. Dps engine must
+        *   call this function to fill the dps operation request parameters.
+        *   @param aArgs the dps operation request arguments
+        *   @param aElems the dps operation elements
+        *   @param aAttrib the dps operation attributes
+        *   @param aTrader the pointer to CDpsTransaction object for filling 
+        *   the request arguments for Dps Engine
+        *   @return TInt KErrNone if successful or other system error if failed
+        */
+    
+    protected:
+        inline virtual TInt FillReqArgs(TDpsArgArray& aArgs, 
+                                        TDpsEleArray& aElems,
+                                        TDpsAttribute& aAttrib, 
+                                        CDpsTransaction* aTrader);
+            
+       
+        /**
+        *   Fills in the dps operation reply parameters. Dps engine uses this
+        *   function after the dps operation gets responsed. After this call,
+        *   dps engine will call RequestComplete() to inform the client the
+        *   completion of the dps operation.
+        *   @param aArgs dps operation reply arguments.
+        *   @param aParam the pointer to CDpsTransacton object for filling 
+        *   the reply arguments for the client (print UI engine)
+        *   @return TInt KErrNone if successful or other system error if failed
+        */    
+        inline virtual TInt FillRepArgs(const TDpsArgArray& aArguments, 
+                                        CDpsTransaction* aTrader);
+                                        
+           
+        /**
+        *   Creates the Dps request script
+        *   @param aArgs the arguments of the Dps request
+        *   @param aElements the elements of the Dps request
+        *   @param aAttribute the attribute of the Dps request
+        *   @param aScript the buffer of the script
+        *   @param aTrader the pointer to the CDpsTransaction object for 
+        *   creating the Dps script
+        */
+        IMPORT_C virtual void CreateReqScriptL(const TDpsArgArray& aArguments, 
+                                              const TDpsEleArray& aElements,
+                                              TDpsAttribute aAttribute, 
+                                              RWriteStream& aScript, 
+                                              CDpsTransaction* aTrader); 
+        
+        
+    public:
+        // the dps operation result
+        TDpsResult iResult;
+        // the dps operaton enumeration
+        TDpsSupportedOp iOperation;
+    };
+
+/**
+*   The class for dps startJob operation
+*/
+class TDpsStartJob : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        /**
+        *   Default constructor
+        */
+        inline TDpsStartJob();
+            
+    private:
+        /**
+        *   @see TMDpsOperation 
+        */
+        IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
+                                  TDpsAttribute& aAttrib, 
+                                  CDpsTransaction* aTrader);
+        
+        /**
+        *   @see TMDpsOperation 
+        */                          
+        IMPORT_C void CreateReqScriptL(const TDpsArgArray& aArgs, 
+                                      const TDpsEleArray& aElements, 
+                                      TDpsAttribute aAttribute, 
+                                      RWriteStream& aScript, 
+                                      CDpsTransaction* aTrader); 
+        
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client    
+        TDpsStartJobReq iReqParam;
+        
+    };
+
+/**
+*   The class for dps abortJob operation
+*/    
+class TDpsAbortJob : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        /**
+        *   Default constructor
+        */
+        inline TDpsAbortJob();
+        
+    private:
+        /**
+        *   @see TMDpsOperation 
+        */
+        IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
+                                 TDpsAttribute& aAttrib, 
+                                 CDpsTransaction* aTrader);
+        
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client        
+        TDpsAbortJobReq iReqParam;
+        
+    };
+
+/**
+*   The class for dps continueJob operation
+*/        
+class TDpsContinueJob : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        /**
+        *   Default constructor
+        */
+        inline TDpsContinueJob();           
+    };
+
+/**
+*   The class for dps continueJob operation
+*/    
+class TDpsGetJobStatus : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:    
+        /**
+        *   Default constructor
+        */
+        inline TDpsGetJobStatus();
+        
+    private:        
+        /**
+        *   @see TMDpsOperation 
+        */    
+        IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs, 
+                                  CDpsTransaction* aTrader);
+        
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsJobStatusRep iRepParam;
+        
+    };
+ 
+/**
+*   The class for dps continueJob operation
+*/    
+class TDpsGetPrinterStatus : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:    
+        /**
+        *   Default constructor
+        */
+        inline TDpsGetPrinterStatus();
+        
+    private:        
+        /**
+        *   @see TMDpsOperation 
+        */    
+        IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs, 
+                                  CDpsTransaction* aTrader);
+        
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsPrinterStatusRep iRepParam;
+        
+    };
+    
+/**
+*   The class for dps continueJob operation
+*/
+class TDpsGetCapability : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        /**
+        *   Default constructor
+        */
+        inline TDpsGetCapability();
+        
+    private:        
+        /**
+        *   @see TMDpsOperation 
+        */
+        IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
+                                 TDpsAttribute& aAttrib, 
+                                 CDpsTransaction* aTrader);
+        /**
+        *   @see TMDpsOperation 
+        */                                 
+        IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs, 
+                                  CDpsTransaction* aParam);
+        
+        /**
+        *   @see TMDpsOperation 
+        */                          
+        IMPORT_C void CreateReqScriptL(const TDpsArgArray& aArgs, 
+                                       const TDpsEleArray& aElements,
+                                       TDpsAttribute aAttribute, 
+                                       RWriteStream& aScript, 
+                                       CDpsTransaction* aTrader);
+        
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsCapReq iReqParam;
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsCapRep iRepParam;
+        
+    };
+
+/**
+*   The class for dps continueJob operation
+*/    
+class TDpsConfigPrintService : public TMDpsOperation
+    {
+    friend class CDpsTransaction;
+    public:
+        /**
+        *   Default constructor
+        */
+        inline TDpsConfigPrintService();
+        
+    private:        
+        /**
+        *   @see TMDpsOperation 
+        */
+        IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
+                                 TDpsAttribute& aAttrib, 
+                                 CDpsTransaction* aTrader);
+        /**
+        *   @see TMDpsOperation 
+        */                                 
+        IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs, 
+                                  CDpsTransaction* aTrader);
+                                                                           
+    public:    
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsConfigPrintReq iReqParam;
+        
+        // the request operation parameter which needed to be filled by 
+        // the client
+        TDpsConfigPrintRep iRepParam;
+
+    };
+
+/**
+*   The class defines dps events
+*/    
+NONSHARABLE_CLASS(TDpsEvents) 
+	{
+	public:
+	    // the event enumeration
+		TDpsEvent iEvent;
+		// jobStatus event
+		TDpsGetJobStatus iJobEvent;
+		// printerStatus event
+		TDpsGetPrinterStatus iPrinterEvent;
+	};    
+	
+#include "dpsoperation.inl"	
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsoperation.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006, 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:  inline functions of TMDpsOperation
+*
+*/
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TMDpsOperation::TMDpsOperation()
+    {
+    iOperation = EDpsEmptyRequest;
+    iResult.iMajorCode = EDpsResultOk;
+    iResult.iMinorCode = EDpsResultNone;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt TMDpsOperation::FillReqArgs(TDpsArgArray&, TDpsEleArray&,
+                                 TDpsAttribute&, CDpsTransaction*)
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt TMDpsOperation::FillRepArgs(const TDpsArgArray&, CDpsTransaction*)
+     {
+     return KErrNone;
+     } 
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsStartJob::TDpsStartJob() : TMDpsOperation()
+    {
+    iOperation = EDpsStartJob;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsAbortJob::TDpsAbortJob() : TMDpsOperation()
+    {
+    iOperation = EDpsAbortJob;
+    iReqParam.iAbortStyle = EDpsAbortStyleImmediately;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsContinueJob::TDpsContinueJob() : TMDpsOperation()
+    {
+    iOperation = EDpsContinueJob;
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsGetJobStatus::TDpsGetJobStatus() : TMDpsOperation()
+    {
+    iOperation = EDpsGetJobStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsGetPrinterStatus::TDpsGetPrinterStatus() : TMDpsOperation()
+    {
+    iOperation = EDpsGetPrinterStatus;
+    iRepParam = TDpsPrinterStatusRep();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsGetCapability::TDpsGetCapability() : TMDpsOperation()
+    {
+    iOperation = EDpsGetCapability;
+    iReqParam = TDpsCapReq();
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsConfigPrintService::TDpsConfigPrintService() : TMDpsOperation()
+    {
+    iOperation = EDpsConfigPrintService;         
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsparam.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2006, 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:  These classes define the dps operation parameters. 
+*
+*/
+
+
+#ifndef DPSPARAM_H
+#define DPSPARAM_H
+
+#include "dpsdefs.h"
+
+enum TDpsSupportedOp
+    {
+    EDpsEmptyRequest = 0,
+    EDpsConfigPrintService,
+    EDpsGetCapability,
+    EDpsGetJobStatus,
+    EDpsGetPrinterStatus,
+    EDpsStartJob,
+    EDpsAbortJob,
+    EDpsContinueJob
+    };
+
+struct TDpsArgsInt
+    {
+    TDpsArgument 	iElement;
+    TUint32		iContent;
+    };
+
+/**
+*   The class defines the print job information which is needed by
+*   startJob operation
+*/
+NONSHARABLE_CLASS(TDpsPrintInfo)
+    {
+public:
+    /**
+    *
+    */
+    inline TDpsPrintInfo();
+    
+    /**
+    *   Resets all parameters
+    */    
+    IMPORT_C  void Reset();
+    
+    // the file name        
+    TBuf<KMaxArgLen> iFile; 
+               
+    TBool isDPOF;
+    // this is 0 when UI passed it to dps. Dps engine must find the ID
+    // for this file by asking ptp server
+    TUint32 iFileID; 
+    // if don't need to print file name, this is EFalse
+    TBool iFileName;
+    // if don't need to print date, this is empty
+    TBuf<KDateLen> iDate;
+    // if only one cope, this is emtpy
+    TInt iCopies;
+    // if not DPOF, this is emtpy
+    TInt iPrtPID;
+    // if not DPOF, this is emtpy
+    TInt iCopyID;
+    };
+
+/**
+*   Dps version defination
+*/
+NONSHARABLE_CLASS(TDpsVersion)
+    {
+    public:
+        TInt iMajor;
+        TInt iMinor;
+    };
+
+/**
+*   AbortJob request
+*/	
+NONSHARABLE_CLASS(TDpsAbortJobReq)
+    {
+    public:
+        TInt iAbortStyle;
+    };
+    
+/**
+*   ConfigurePrintService request
+*/
+class TDpsConfigPrintReq
+    {
+    public:
+        RArray<TDpsVersion> iDpsVersions;
+        TBuf8<KMaxArgLen> iVendorName;
+        TDpsVersion iVendorVersion;
+        TBuf8<KMaxArgLen> iProductName;
+        TBuf8<KMaxArgLen> iSerialNo;
+        
+        /**
+        *   Destructor. Declared as virtual so that it will be called by 
+        *   its derived class.
+        */
+        inline virtual ~TDpsConfigPrintReq();
+        
+        /**
+        *   Resets all class variables.
+        */
+        inline void Reset();        
+    };
+
+/**
+*   ConfigurePrintService reply
+*/
+NONSHARABLE_CLASS(TDpsConfigPrintRep) : public TDpsConfigPrintReq
+    {
+    public:
+        TInt iPrintAvailable;      
+    };
+    
+/**
+*	GetCapability request.
+*/
+NONSHARABLE_CLASS(TDpsCapReq)
+    {
+    public:
+        TDpsArgument iCap;
+        // layouts and paperTypes requests attributes
+        TDpsAttribute iAttribute;
+    };	
+	    
+/**
+*   GetCapability reply
+*/
+NONSHARABLE_CLASS(TDpsCapRep) : public TDpsCapReq
+    {
+    public:
+        RArray<TUint> iContent;
+        RArray<TDpsPaperType> iPaperType;
+        /**
+        *   Destructor
+        */
+        inline ~TDpsCapRep();
+        
+        /**
+        *   Resets all class variables
+        */ 
+        inline void Reset();
+    };
+                                	
+/**
+*	StartJob request has printInfo and jobConfig parameters.
+*/
+NONSHARABLE_CLASS(TDpsStartJobReq)
+    {
+    public:
+        /**
+	    *   Resets all member variables
+        */
+        inline void Reset();
+	    	        
+        /**
+        *   Gets the number of all parameters, including ones under elements
+        *   @return the number of parameters
+        */
+        IMPORT_C TInt GetParamNum();
+		
+        /**
+        *   Destructor
+        */    
+        inline ~TDpsStartJobReq(); 
+        RArray<TDpsArgsInt> iJobConfig;
+        //there might be multiple printInfo in case of several pictures are 
+        //selected to be printed 
+        RArray<TDpsPrintInfo> iPrintInfo;		
+    };	
+
+/**
+*   This class is for job status reply
+*/	
+NONSHARABLE_CLASS(TDpsJobStatusRep)
+    {
+    public:
+        
+        /**
+        *   
+        */
+        inline TDpsJobStatusRep();
+        /**
+        *   Resets all memeber variables
+        */
+        IMPORT_C void Reset();
+        
+        TInt iProgress;
+        TInt iImagesPrinted;
+        TFileName iFilePath;
+        TInt iPrtPID;
+        TInt iCopyID;
+    };
+    
+/**
+*   This class is for device status reply
+*/    
+NONSHARABLE_CLASS(TDpsPrinterStatusRep)
+    {
+    public:
+        TDpsPrintServiceStatus iPrintStatus;
+        TDpsJobStatus iJobStatus;
+        TDpsErrorStatus iErrorStatus;
+        TDpsJobEndReason iJobEndReason;
+        TBool iDisconnectEnable;
+        TBool iCapabilityChange;
+        TBool  iNewJobOk;
+    };
+#include "dpsparam.inl"    
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsparam.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006, 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:  inline functions of dps parameter. 
+*
+*/
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsPrintInfo::TDpsPrintInfo()
+    {
+    Reset();
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void TDpsConfigPrintReq::Reset()
+    {
+    iDpsVersions.Reset();
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsConfigPrintReq::~TDpsConfigPrintReq()
+    {
+    iDpsVersions.Close();
+    }       
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsCapRep::~TDpsCapRep()    
+    {
+    Reset();
+    }    
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void TDpsStartJobReq::Reset()
+    {
+    iJobConfig.Reset();
+    iPrintInfo.Reset();
+    }   
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TDpsStartJobReq::~TDpsStartJobReq() 
+    {
+	iJobConfig.Close();
+	iPrintInfo.Close();
+	}
+	
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//			    
+void TDpsCapRep::Reset()
+    {
+    iContent.Reset();
+    iPaperType.Close();
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//			        
+TDpsJobStatusRep::TDpsJobStatusRep()    
+    {
+    Reset();
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsptpnotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006, 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 class defines functions of setting personality to 
+*                PTP. 
+*
+*/
+
+
+#ifndef DPSPTPNOTIFIER_H
+#define DPSPTPNOTIFIER_H
+
+#include <e32base.h>
+
+class CDpsUsbNotifier;
+
+/**
+*   Class for monitoring Ptp personality setting
+*/
+NONSHARABLE_CLASS(CDpsPtpNotifier) : public CActive
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aParent the pointer to UsbNotifier object
+        *   @return a new created PtpNotifier object
+        */
+        static CDpsPtpNotifier* NewL(CDpsUsbNotifier* aParent);
+        
+        /**
+        *   Destructor
+        */
+        ~CDpsPtpNotifier();
+        
+        /**
+        *   Called by UsbNotifier to subscribe set personality notification
+        */
+        void ChangePtpPersonality();
+                            
+    private: // Functions derived from CActive.
+	    /**
+	    *   @see CActive
+	    */
+    	void RunL();
+    	
+    	/**
+    	*   @see CActive
+    	*/
+	    void DoCancel();
+	    
+	    /**
+	    *   @see CActive
+	    */
+	    TInt RunError(TInt aError);
+	    
+	private:
+	    /**
+	    * Default constructor
+	    */
+	    CDpsPtpNotifier(CDpsUsbNotifier* aParent);
+	    
+	private:
+	    // not owned by this class
+	    CDpsUsbNotifier* iNotifier;  
+	    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsscriptreceiver.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps script receiving function. 
+*
+*/
+
+
+#ifndef DPSSCRIPTRECEIVER_H
+#define DPSSCRIPTRECEIVER_H
+
+#include <e32base.h>
+
+class CDpsEngine;
+class CDpsStateMachine;
+
+/**
+*   This class is an active object. It listens on the ptp server
+*   object receiving notification.
+*/
+NONSHARABLE_CLASS(CDpsScriptReceiver) : public CActive
+    {	
+    public:
+       /**
+        *   Two phase constructor
+        *   
+        *   @param aOperator the pointer to the dps state machine
+        *   @return a CDpsScriptReceiver instance
+        */
+        static CDpsScriptReceiver* NewL(CDpsStateMachine* aOperator);
+								       
+        /**
+        *   Destructor
+        */								       
+        ~CDpsScriptReceiver();
+		
+        /**
+        *   Issues the request of receiving.
+        */
+        void WaitForReceive();
+		
+        /**
+        *   @return the file name of the object been received
+        */
+        const TDesC& FileNameAndPath();
+			
+    private: // Functions derived from CActive.
+        /**
+        *   @see CActive
+        */
+    	void RunL();
+    	
+    	/**
+    	*   @see CActive
+    	*/
+        void DoCancel();
+	    
+        /**
+        *   @see CActive
+        */
+        TInt RunError(TInt aError);
+	    
+    private:
+        
+        /**
+        *   Default constructor
+        *   
+        *   @param aOperator the pointer to the dps state machine
+        */
+        CDpsScriptReceiver(CDpsStateMachine* aOperator);    
+	    
+        /**
+        *   Gets the file name from the full filename
+        *   @param aFileName the full filename including file path
+        *   @return KErrNone if Ok, otherwise the system wide error
+        */
+        TInt GetFileName(TDes& aFileName);
+		
+    private:
+        
+        // not owned by this class
+        CDpsStateMachine* iOperator;   
+        // file name of received script file 
+        TFileName iFileNameAndPath;
+    };
+						
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsscriptsender.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps script sending function. 
+*
+*/
+
+
+#ifndef DPSSCRIPTSENDER_H
+#define DPSSCRIPTSENDER_H
+
+#include <e32base.h>
+
+class CDpsEngine;
+class CDpsStateMachine;
+
+/**
+*   This class is an active object. It sends the script to ptp server and 
+*   listens on the ptp server for notification of sending result.
+*/
+NONSHARABLE_CLASS(CDpsScriptSender) : public CActive
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   
+        *   @param aOperator the pointer to the dps state machine
+        *   @return a CDpsScriptSender instance
+        */
+        static CDpsScriptSender* NewL(CDpsStateMachine* aOperator);
+		
+        /**
+        *   Destructor
+        */
+        ~CDpsScriptSender();
+		
+        /**
+        *   Issues sending request
+        *   @param aReply ETrue is the script is the reply, EFalse if the 
+        *   script is the request.
+        */
+        TInt SendScript(TBool aReply);
+	
+    private: // Functions derived from CActive.
+        /**
+        *   @see CActive
+        */
+    	void RunL();
+    	
+        /**
+        *   @see CActive
+        */
+        void DoCancel();
+	    
+        /**
+        *   @see CActive
+        */
+        TInt RunError(TInt aError);
+	    
+    private:
+        /**
+        *   Default constructor
+        *   
+        *   @param aOperator the pointer to the dps state machine
+        */
+        CDpsScriptSender(CDpsStateMachine* aOperator);    
+	
+    private:
+        
+        // not owned by this class
+        CDpsStateMachine* iOperator;
+	   
+        // telling if the current sending session is a reply or a request
+        TBool iReply;
+    };
+				
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsstate.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2006, 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:  These classes define the dps states. 
+*
+*/
+
+
+#ifndef DPSSTATE_H
+#define DPSSTATE_H
+
+#include <e32base.h>
+class CDpsStateMachine;
+
+/**
+*   This class is the base classes for all dps state classes.
+*   We follow state design pattern here so the state class defines all
+*   transactions among states as member functions.
+*/
+class MDpsState
+    {
+    public:
+                
+        /**
+        *   Script sent notification
+        */
+        virtual void ScriptSentNotifyL(TBool aReply) = 0;
+        
+        /**
+        *   Script received notification
+        */
+        virtual void ScriptReceivedNotifyL(TBool aReply) = 0;
+        
+        /**
+        *   Error handling of the transaction
+        */
+        virtual void Error(TInt aErr) = 0; 
+    };
+
+/**
+*   Idle state class
+*/
+NONSHARABLE_CLASS(TDpsIdleState) : public MDpsState
+    {
+    public:
+        /**
+        *   Constructor
+        */
+        TDpsIdleState(CDpsStateMachine* aStateMachine);
+    public:
+                
+        /**
+        *   @see MDpsState
+        */
+        void ScriptSentNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */
+        void ScriptReceivedNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */    
+        void Error(TInt aErr);
+
+        
+    private:
+        CDpsStateMachine* iStateMachine;
+    };
+
+/**
+*   Sending Request state class. Device sending request starts form this state
+*/
+NONSHARABLE_CLASS(TDpsSendingReqState) : public MDpsState
+    {
+    public:
+        /**
+        *   Constructor
+        */
+        TDpsSendingReqState(CDpsStateMachine* aStateMachine);
+            
+    public:
+        
+        /**
+        *   @see MDpsState
+        */    
+        void ScriptSentNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */    
+        void ScriptReceivedNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */    
+        void Error(TInt aErr);        
+            
+    private:
+        CDpsStateMachine* iStateMachine;
+    };
+
+/**
+*   Waiting Reply state class (script has been sent)
+*/    
+NONSHARABLE_CLASS(TDpsWaitingRepState) : public MDpsState
+    {
+    public:
+        /**
+        *   Constructor
+        */
+        TDpsWaitingRepState(CDpsStateMachine* aStateMachine);
+            
+    public:
+               
+        /**
+        *   @see MDpsState
+        */    
+        void ScriptSentNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */
+        void ScriptReceivedNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */    
+        void Error(TInt aErr);        
+            
+    private:
+        CDpsStateMachine* iStateMachine;
+    };
+    
+/**
+*   Sending Reply state class. The device starts replying the host request 
+*   in this state.
+*/     
+NONSHARABLE_CLASS(TDpsSendingRepState) : public MDpsState
+    {
+    public:
+        /**
+        *   Constructor
+        */
+        TDpsSendingRepState(CDpsStateMachine* aStateMachine);
+            
+    public:
+          
+        /**
+        *   @see MDpsState
+        */    
+        void ScriptSentNotifyL(TBool aReply);
+         
+        /**
+        *   @see MDpsState
+        */    
+        void ScriptReceivedNotifyL(TBool aReply);
+        
+        /**
+        *   @see MDpsState
+        */    
+        void Error(TInt aErr);
+                    
+    private:
+        CDpsStateMachine* iStateMachine;
+    };
+    
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsstatemachine.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps state machine. 
+*
+*/
+
+
+#ifndef DPSSTATEMACHINE_H
+#define DPSSTATEMACHINE_H
+
+#include "dpsconst.h"
+#include "dpsdefs.h"
+
+class CDpsTransaction;
+class CDpsEngine;
+class CDpsScriptReceiver;
+class MDpsState;
+class TMDpsOperation;
+class CDpsScriptSender;
+
+/**
+*   This class defines the dps state machine using the state design pattern
+*/
+NONSHARABLE_CLASS(CDpsStateMachine) : public CBase
+    {
+	    
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aEngine a pointer to dps engine object
+        *   @return the CDpsOperator instance
+        */
+        static CDpsStateMachine* NewL(CDpsEngine *aEngine);
+        
+        /**
+        *   Destructor
+        */
+        ~CDpsStateMachine();   
+        
+        /**
+        *   Creates the dps transaction. It further calls CreateRequest()
+        *   to create dps device request script.
+        *   @param aParam the dps operation object, passed from UI
+        */
+        void StartTransactionL(TMDpsOperation* aOperation);
+        
+        /**
+        *   Initializes the state machine
+        */
+        void Initialize();
+        
+        /**
+        *   Handles errors
+        */    
+        inline void Error(TInt err);
+                
+        /**
+        *   Notifies script sent
+        */
+        inline void ScriptSentNotifyL(TBool aReply);
+            
+        /**
+        *   Notifies script received
+        */    
+        inline void ScriptReceivedNotifyL(TBool aReply);
+         
+        /**
+        *   Sets the current state
+        *   @param aState the state to be set
+        */    
+        inline void SetState(MDpsState* aState);
+          
+        /**
+        *   Gets the idle state
+        */    
+        inline MDpsState* IdleState() const; 
+          
+        /**
+        *   @return the sending request state object
+        */    
+        inline MDpsState* SendingReqState() const;
+          
+        /**
+        *   @return the waiting for reply state object
+        */    
+        inline MDpsState* WaitingRepState() const;
+             
+        /**
+        *   @return the sending reply state object
+        */    
+        inline MDpsState* SendingRepState() const;
+          
+        /**
+        *   @return the CDpsScriptReceiver object
+        */    
+        inline CDpsScriptReceiver* ScriptReceiver() const;
+        
+        /**
+        *   @return CDpsScriptSender pointer 
+        */
+        inline CDpsScriptSender* ScriptSender() const;
+          
+        /**
+        *   @return the CDpsTransaction object
+        */    
+        inline CDpsTransaction* Trader() const;
+          
+        /**
+        *   @return the current Dps operation enum 
+        */    
+        inline TDpsOperation Operation() const;
+          
+        /**
+        *   Sets the current Dps operation enum
+        *   @param aOp the Dps operation enum to be set
+        */    
+        inline void SetOperation(TDpsOperation aOp);
+          
+        /**
+        *   @return the Dps operation object
+        */    
+        inline TMDpsOperation* MOperation() const;
+          
+        /**
+        *   @return the Dps event enum
+        */    
+        inline TDpsEvent Event() const;
+          
+        /**
+        *   Sets the current Dps event
+        *   @param aEvent the Dps event to be set
+        */    
+        inline void SetEvent(TDpsEvent aEvent);
+        
+        /**
+        *   @return the current state.
+        */
+        inline MDpsState* CurState() const;
+        
+        /**
+        *   @return the dps engine object.
+        */
+        inline CDpsEngine* DpsEngine() const;
+        
+        /**
+        *
+        */
+        inline TInt CurError() const;
+            
+    private:
+        /**
+        *   Default constructor
+        *   @param aEngine a pointer to dps engine object
+        */
+        CDpsStateMachine(CDpsEngine* aEngine);
+        
+        /**
+        *   Two phase constructor. The functions which called in constructor
+        *   and might leave should be called here
+        */
+        void ConstructL();     
+        
+                                    
+    private:
+        // owned by this class
+        MDpsState* iIdleState;
+        // owned by this class
+        MDpsState* iSendingReqState;
+        // owned by this class
+        MDpsState* iWaitingRepState;
+        // owned by this class
+        MDpsState* iSendingRepState;
+        // pointer to the current state object
+        MDpsState* iCurState;
+        // not owned by this class
+        TMDpsOperation* iMOperation;
+     
+        // not owned by this class  
+        CDpsEngine  *iEngine;
+        // the current dps operation, can be empty
+        TDpsOperation iOperation;
+        // the current dps event, can be empty
+        TDpsEvent iEvent;
+        // the pointer to dps operation object, which takes
+        // care of creating and parsing dps script
+         // owned by this class
+        CDpsTransaction *iTrader;
+        // the pointer to dps script receiving notifier
+        // owned by this class
+        CDpsScriptReceiver* iScriptReceiver;
+        
+        // the pointer to script sender object, owned by this class
+        CDpsScriptSender* iScriptSender;
+        TInt iCurError;
+    };
+
+#include "dpsstatemachine.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsstatemachine.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2006, 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:  inline functions of CDpsStatemachine
+*
+*/
+
+
+#include "dpsstate.h"
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsStateMachine::ScriptSentNotifyL(TBool aReply)
+    {
+    iCurState->ScriptSentNotifyL(aReply);
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::ScriptReceivedNotifyL(TBool aReply)
+    {
+    iCurState->ScriptReceivedNotifyL(aReply);
+    }
+        
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::Error(TInt err)
+    {
+    iCurError = err;
+    iCurState->Error(err);
+    }
+        
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsStateMachine::SetState(MDpsState* aState)
+    {
+    iCurState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+MDpsState* CDpsStateMachine::IdleState() const
+    {
+    return iIdleState;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+MDpsState* CDpsStateMachine::SendingReqState() const
+    {
+    return iSendingReqState;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+MDpsState* CDpsStateMachine::WaitingRepState() const
+    {
+    return iWaitingRepState; 
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+MDpsState* CDpsStateMachine::SendingRepState() const
+    {
+    return iSendingRepState;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsScriptReceiver* CDpsStateMachine::ScriptReceiver() const
+    {
+    return iScriptReceiver;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//                
+CDpsScriptSender* CDpsStateMachine::ScriptSender() const
+    {
+    return iScriptSender;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsTransaction* CDpsStateMachine::Trader() const
+    {
+    return iTrader;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsOperation CDpsStateMachine::Operation() const
+    {
+    return iOperation;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::SetOperation(TDpsOperation aOp)
+    {
+    iOperation = aOp;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TMDpsOperation* CDpsStateMachine::MOperation() const
+    {
+    return iMOperation;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsEvent CDpsStateMachine::Event() const
+    {
+    return iEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsStateMachine::SetEvent(TDpsEvent aEvent)
+    {
+    iEvent = aEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+MDpsState* CDpsStateMachine::CurState() const
+    {
+    return iCurState;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//        
+CDpsEngine* CDpsStateMachine::DpsEngine() const
+    {
+    return iEngine;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//            
+TInt CDpsStateMachine::CurError() const
+    {
+    return iCurError;
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpstransaction.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2006, 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 class creates and parses dps operations. 
+*
+*/
+
+
+#ifndef DPSTRANSACTION_H
+#define DPSTRANSACTION_H
+
+#include <e32base.h>
+#include "dpsdefs.h"
+#include "dpsoperation.h"
+
+class 	CDpsFile;
+class 	CDpsEngine;
+class   CDpsXmlGenerator;
+class	CDpsXmlParser;
+class 	CDpsScriptSender;
+class   TDpsVersion;
+class   CDpsStateMachine;
+class   TMDpsOperation;
+
+/**
+*   This class creates and parses dps operation (request and reply)
+*/
+NONSHARABLE_CLASS(CDpsTransaction) : public CBase
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   
+        *   @param iOperator the pointer to dps operation object
+        *   @return the dps transaction instance
+        */
+        static CDpsTransaction* NewL(CDpsStateMachine* iOperator);    
+
+        /**
+        *   Destructor
+        */        							 
+        ~CDpsTransaction();
+        
+    public:
+        /**
+        *   Creates the dps operation request
+        *   @param aParam the dps operation parameters
+        */
+    	void CreateRequestL(TMDpsOperation* aOperation);
+    	
+    	/**
+    	*   Parses dps operation script
+    	*   @param aReply if the script is the reply from the host
+    	*   aReply is ETrue, otherwise the script must be the request
+    	*   from the device and aReply is EFalse
+    	*/
+    	void ParseScriptL(TBool aReply);
+    	
+    	/**
+    	*   @return ETrue if the script is the reply from the host,
+    	*   EFalse if the script is the request from the host
+    	*/
+    	inline TBool IsReply();
+    	
+    	/**
+    	*   @return the CDpsXmlParser object
+    	*/
+    	inline CDpsXmlParser* Parser();
+    	    
+    	/**
+    	*   @return the CDpsXmlGenerator object
+    	*/
+    	inline CDpsXmlGenerator* Generator();    
+    	    
+    	/**
+    	*   @return the CDpsEngine object
+    	*/    
+        inline CDpsEngine* Engine();
+    	
+    	    					 
+		/**
+    	*   Converts the version in descriptor tpye to TDpsVersion type
+    	*   @param aParser the version in descriptor 
+    	*   @param aVersoin the version in TDpsVersion and will be returned
+    	*   @return KErrNone if OK, other system error if failed
+    	*/        
+        TInt ConvertVersion(TLex8& aParser, TDpsVersion& aVersion);    
+        
+        /**
+        *   @return CDpsStateMachine pointer to dps state machine object
+        */
+        inline CDpsStateMachine* Operator();
+        
+        /**
+        *   Parses the string of percentage to integer
+        *   @param aPer the string of percentage to be parsed
+        *   @return TInt the percentage in integer
+        */    			
+        TInt ParsePercentage(const TDes8& aPer);
+        
+        /**
+        *   @return the error of result in integer
+        */
+        inline TInt ResultErr();
+                    
+            
+        /**
+        *   @return CDpsFile pointer to dps file object
+        */
+        inline CDpsFile* FileHandle();
+        
+        /**
+        *
+        */
+        void HandleHostRequestError(TInt aErr);
+                    
+    private:
+        /**
+        *   Default constructor
+        *   
+        *   @param iOperator the pointer to the dps operator 
+        */	
+    	CDpsTransaction(CDpsStateMachine* iOperator);    
+    	
+    	/**
+    	*   Second phase constructor. 
+    	*/
+    	void ConstructL();
+    	
+    	/**
+    	*   Creates the dps event reply.
+    	*   @param aArguments dps event arguments
+    	*   @param aResult the result of the reply. See Dps spec for
+    	*   detail result value
+    	*/
+    	void CreateEventReplyL(TDpsEvent aEvent, const TDpsResult& aResult);
+    	
+    	/**
+    	*   Creates the dps request reply based on host dps request.
+    	*   There is only one dps request from host (others are from device) -
+    	*   GetFileID
+    	*   @param aArgs the dps argument from the dps xml script
+    	*   @param aResult the reply result to be filling to the dps xml script
+    	*/
+    	void CreateRequestReplyL(const TDpsArgArray& aArgs, 
+                                 const TDpsResult& result);
+        
+        /**
+        *   Removes the unprintable chars (LF, CR, TAB and spaces) between 
+        *   two XML attributes. It seems
+        *   sybmian XML framework does filter out these character even though
+        *   they are not belong to the attribute. Some printers (Cannon) send
+        *   Dps request (XML script) in human readable format, e.g. including
+        *   LF, CR and spaces among XML attributes.
+        *   @param aScript the XML script to be filtered out
+        */
+    	void Filter(TDes8& aScript);
+    	
+    	/**
+    	*   Changes the file path for GetFileID request
+    	*
+    	*/
+    	void SubstitutePath(TDes8& aPath);
+    	
+    private:
+        
+    	// the pointer to dps operator object
+    	// not owned by this class
+        CDpsStateMachine* iOperator;
+        // the pointer to xml generator object, owned by this class
+        CDpsXmlGenerator *iXmlGen;
+        // the pointer to xml parser object, owned by this class
+        CDpsXmlParser *iXmlPar; 
+        // the pointer to file generator object, owned by this class
+        CDpsFile *iFile;
+                
+        // the current parsed script is reply or request
+        TBool iReply;  
+    };
+
+#include "dpstransaction.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpstransaction.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006, 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 class creates and parses dps operations. 
+*
+*/
+
+#include "dpsstatemachine.h"
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TBool CDpsTransaction::IsReply()
+	{
+	return iReply;
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+CDpsXmlParser* CDpsTransaction::Parser()
+    {
+    return iXmlPar;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//        
+CDpsEngine* CDpsTransaction::Engine()
+    {
+    return iOperator->DpsEngine();
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//        
+CDpsXmlGenerator* CDpsTransaction::Generator()
+    {
+    return iXmlGen;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//        
+CDpsStateMachine* CDpsTransaction::Operator()
+    {
+    return iOperator;
+    }
+          
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//            
+CDpsFile* CDpsTransaction::FileHandle()
+    {
+    return iFile;
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsusbnotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2006, 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 class implements functions of set ptp personality, the 
+*                notification of the PTP printer connection and the
+*				 notification of the PTP printer disconnection. 
+*
+*/
+
+
+#ifndef DPSUSBNOTIFIER_H
+#define DPSUSBNOTIFIER_H
+
+#include <e32base.h>
+#include <usbstates.h>
+#include "pictbridge.h"
+#include <usbman.h>
+#include <usbwatcher.h>
+
+class CDpsPtpNotifier;
+class CDpsConnectNotifier;
+class CDpsPersonalityWatcher;
+
+/**
+*   Class for monitoring the usb personality change and cable 
+*   connection/disconnectin
+*/
+NONSHARABLE_CLASS(CDpsUsbNotifier) : public CActive
+    {
+    friend class CDpsPtpNotifier;
+    friend class CDpsConnectNotifier;
+    friend class CDpsPersonalityWatcher;
+	
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aEngine the pointer to the dps engine object
+        *   @param the CDpsUsbNotifier instance 
+        */
+        static CDpsUsbNotifier* NewL(CDpsEngine* aEngine);
+		
+        /**
+        *   Destructor
+        */
+        ~CDpsUsbNotifier();
+		
+        /**
+        *   Issues the request for printer connection notification
+        */
+        void WaitForPrinterNotify();
+		
+        /**
+        *   Cancels the request for printer connection notification
+        */
+        void CancelPrinterNotify();
+		
+        /**
+        *   Issues the request for printer connect/disconnect notification
+        */
+        void ConnectNotify();
+		
+		/**
+		*   @return TBool Checks if the PTP printer is connected
+		*/		
+	    TBool IsConfigured() const;
+	    
+	    /**
+	    *
+	    */
+	    TBool IsSetPrintModeIssued();
+	    
+    private:
+        /**
+        *   Second phase constructor
+        */
+        void ConstructL();
+		
+        /**
+        *   Default constructor
+        *   @param aEngine the pointer to the dps engine
+        */
+        CDpsUsbNotifier(CDpsEngine *aEngine);
+		
+        /**
+        *   Called by PtpNotifier to indicate a ptp printer/pc is connected
+        */
+        void PtpNotify(TInt aErr);
+		
+		/**
+		*
+		*/
+		void PersonalityChanged();
+		
+        /**
+        *   Called by ConnectNotifier to indeicate the cable disconnect
+        */
+        void DisconnectNotify(TUsbDeviceState aState);
+		
+        /**
+        *   Updates the current device state
+        *   @return ETrue if OK, EFalse if failed
+        */
+        TInt ConnectState();
+		        
+        /**
+        *   Changes back to the previous personality       
+        */
+        void Rollback();
+        
+    private: // from CActive		
+        /**
+        *   @See CActive::RunL
+        */
+        void RunL();
+		
+        /**
+        *   @See CActive::RunError
+        */
+        TInt RunError(TInt aErr);
+		
+        /**
+        *   @See CActive::DoCancel
+        */
+        void DoCancel();
+		
+    private:
+        // not owned by this class
+        CDpsEngine* iEngine;
+        // owned by this class
+        CDpsPtpNotifier* iPtpP;
+        // owned by this class
+        CDpsConnectNotifier* iConnectP;
+        // owned by this class
+        CDpsPersonalityWatcher* iPersonalityWatcher;
+        TInt	iPersonality;
+        TUsbDeviceState iConnectState;
+        // indication of whether the PTP printer has connected
+        TBool iConfigured;	
+        CDpsEngine::TConnectionStatus iConnection;	
+        // owned by this class
+        RUsbWatcher iUsbW;
+        // owned by this class
+        RUsb    iUsbM;
+        // if rollback to previous personality is needed when application quits
+        TBool iRollback;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsxmlgenerator.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2006, 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 class creates the dps xml script. 
+*
+*/
+
+
+#ifndef DPSXMLGENERATOR_H
+#define DPSXMLGENERATOR_H
+
+#include <e32base.h>
+#include <s32file.h>
+#include "dpsdefs.h"
+#include "dpsconst.h"
+
+class CDpsEngine;
+
+/**
+*   This class creates dps scripts.
+*/
+NONSHARABLE_CLASS(CDpsXmlGenerator) : public CBase
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aEngine a pointer to dps engine
+        *   @return a CDpsXmlGenerator instance
+        */
+        static CDpsXmlGenerator* NewL(CDpsEngine* aEngine);    
+    	
+        /**
+        *   Destructor
+        */
+        ~CDpsXmlGenerator();
+    	
+        /**
+        *	Creates the Dps result script
+        *   @param aEvent a dps event, can be empty
+        *   @param aScript dps script content. after this function is
+        *   returned, aScript has the valid content
+        *   @param aResult the operation result
+        */
+        void CreateResultScriptL(TDpsEvent aEvent,
+		                         RWriteStream& aScript,
+	           		             const TDpsResult& aResult) const;
+	    
+        /**
+        *   Creates the dps reply script
+        */ 
+        void CreateReplyScriptL(TDpsOperation aOperation, 
+                               RWriteStream& aScript,
+                               const TDpsResult& aResult,
+                               const TDpsArg& aArg) const;
+       		         	
+    private:
+        /**
+        *   Default constructor
+        *   @param aEngine a pointer to dps engine
+        */
+        CDpsXmlGenerator(CDpsEngine* aEngine);
+	      
+    public:	      
+        /**
+        *   Fillin the start part of a script
+        *   @param aScript the content of a script
+        */                 
+        void StartDocumentL(RWriteStream& aScript) const;
+	    
+        /**
+        *   Fillin the end part of a script
+        *   @param aScript the content of a script
+        */
+        void EndDocumentL(RWriteStream& aScript) const;
+	    
+        /**
+        *   Fillin the start part of a input in the script
+        *   @param aScript the content of a script
+        */
+        void StartInputL(RWriteStream& aScript) const;          	 
+		
+        /**
+        *   Fillin the end part of a input in the script
+        *   @param aScript the content of a script
+        */
+        void EndInputL(RWriteStream& aScript) const;
+		
+        /**
+        *   Fillin the start part of the result in the script
+        *   @param aScript the content of a script
+        *   @param aResult the result to be filled
+        */
+        void StartResultL(RWriteStream& aScript, const TDpsResult& aResult) const;
+		
+        /**
+        *   Fillin the end part of the result in the script
+        *   @param aScript the content of a script
+        */
+        void EndResultL(RWriteStream& aScript) const;
+		
+        /**
+        *   Fillin the start part of the operation in the script
+        *   @param aOperation the operation enumeration
+        *   @param aScript the content of a script
+        *   @param aEnd ETrue if the operation does not have an argument,
+        *   EFalse otherwise	       
+        */
+        void StartOperationL(TDpsOperation aOperation, RWriteStream& aScript, 
+                            TBool aEnd = EFalse) const; 
+		
+        /**
+        *   Fillin the end part of the operation in the script
+        *   @param aOperation the operation enumeration
+        *   @param aScript the content of a script
+        */
+        void EndOperationL(TDpsOperation aOperation, RWriteStream& aScript) const;
+		
+        /**
+        *   Fillin the event parameter in the script
+        *   @param aScript the content of a script.
+        *   @param aEvent the event enumeration
+        */
+        void CreateEventL(RWriteStream& aScript, TDpsEvent aEvent) const;
+		
+        /**
+        *   Fillin the arguments
+        *   @param aScript the content of a script
+        *   @param aArgument arguments to be used to fill the script
+        *   @param aAttrib the attribute
+        */
+        void CreateArgL(RWriteStream& aScript, const TDpsArg& aArgument, 
+                        TDpsAttribute aAttrib = 0) const;
+        
+        /**
+        *   Fillin the start part of an element
+        *   @param aElement the element enumeration
+        *   @param aScript the content of a script
+        */
+        void StartElementL(TDpsElement aElement, RWriteStream& aScript) const;
+		
+        /**
+        *   Fillin the end part of an element
+        *   @param aElement the element enumeration
+        *   @param aScript the content of a script
+        */
+        void EndElementL(TDpsElement aElement, RWriteStream& aScript) const;
+							
+    private:
+        // not owned by this class
+        CDpsEngine* iEngine;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsxmlparser.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2006, 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 class parses the dps xml script. 
+*
+*/
+
+
+#ifndef DPSXMLPARSER_H
+#define DPSXMLPARSER_H
+
+#include <e32base.h>
+#include <xml/wbxmlextensionhandler.h>
+#include <contenthandler.h>
+#include "dpsdefs.h"
+#include "dpsconst.h"
+
+using namespace Xml;
+
+class CDpsEngine;
+
+/**
+*   The interface acts as a hook between the xml framework and the detailed 
+*   implementation
+*/
+class MDpsExtensionHandler
+    {
+    public:
+        enum 
+        {
+        // dps engine dll uid 
+        EInterfaceUid = 0x10274798
+        };
+    };
+
+/**
+*   The parser for dps script
+*/
+NONSHARABLE_CLASS(CDpsXmlParser) : public CBase, public MContentHandler, 
+                                   public MDpsExtensionHandler
+    {
+    public:
+        /**
+        *   Two phase constructor
+        *   @param aEngine the dps engine pointer
+        *   @return a CDpsXmlParaser instance
+        */
+        static CDpsXmlParser* NewL(CDpsEngine* aEngine);
+    	
+        /**
+        *   Destructor
+        */
+        ~CDpsXmlParser();  
+    	
+        /**
+        *   @return ETrue if the script is a dps notification, 
+        *   otherwise EFalse
+        */
+        inline TBool IsEvent() const;
+    	
+        /**
+        *   Gets the dps operation result from the parser and sets it to the 
+        *   dps reply
+        *   @param aResult the dps operatoin result
+        */
+        inline void SetOperationResult(TDpsResult& aResult) const;
+    	
+        /**
+        *   Gets the dps operation enumeration of this script
+        *   @return the dps operation enumeration
+        */
+        inline TDpsOperation Operation() const;
+    	    
+        /**
+        *   Sets the dps operation arguments
+        *   @param aParams the arguments to be set
+        */
+        inline void SetParameters(TDpsArgArray& aParams);
+    	
+        /**
+        *   Gets the dps event of this script
+        *   @return the dps event enumeration
+        */
+        inline TDpsEvent Event() const;
+    	    
+        /**
+        *   Gets the dps attribute
+        *   @param aAttrib the attribute got
+        */
+        inline void GetAttribute(TDpsAttribute& aAttrib) const;
+    	
+        /**
+        *   @return ETrue if this dps operation has attribue, othewise EFalse
+        */
+        inline TBool HasAttribute() const;
+    	
+        /**
+        *   Gets the dps arguments
+        *   @param aParams the arguments to be returned
+        */
+        inline void GetParameters(TDpsArgArray& aParams) const;
+        
+        /**
+        *   Resets the member variables 
+        */
+        void Reset();
+		
+    	    
+    private:
+    // From MContentHandler
+        /**
+        *   @see MContentHandler
+        */
+        void OnStartDocumentL(const RDocumentParameters& aDocParam, 
+                              TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnEndDocumentL(TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnStartElementL(const RTagInfo& aElement, 
+                             const RAttributeArray& aAttributes, 
+                             TInt aErrCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnStartPrefixMappingL(const RString& aPrefix, 
+                                   const RString& aUri, 
+                                   TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, 
+                                      TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        void OnError(TInt aErrorCode);
+		
+        /**
+        *   @see MContentHandler
+        */
+        TAny* GetExtendedInterface(const TInt32 aUid); 
+		        				
+    private:
+        /**
+        *   Default constructor
+        *   @param aEngine a pointer to the dps engine
+        */
+        CDpsXmlParser(CDpsEngine* aEngine);
+        
+        /**
+        *
+        */
+        void ParseAttributesL(const RAttributeArray& aAttributes, 
+                              const TDesC8& aTag);
+
+		
+    private:
+        TDpsXmlAction iAction;
+        TDpsAttribute iAttrib;
+		
+        TDpsEvent iDpsEvent;
+        TDpsOperation iDpsOperation;	
+        TDpsResult iDpsResult;
+        // only one
+        TDpsElement iElement; 
+        TDpsArgArray iDpsArgs;
+        // not owned by this class
+        CDpsEngine* iEngine;
+    };
+#include "dpsxmlparser.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsxmlparser.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006, 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 class parses the dps xml script. 
+*
+*/
+
+
+#ifdef _DEBUG
+#	define __IF_DEBUG(t) {RDebug::t;}
+#else
+#	define __IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::GetAttribute(TDpsAttribute& aAttrib) const
+    {
+    aAttrib = iAttrib;
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+TBool CDpsXmlParser::HasAttribute() const
+    {
+    return iAttrib != 0;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TDpsOperation CDpsXmlParser::Operation() const
+    {
+    return iDpsOperation;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsEvent CDpsXmlParser::Event() const
+    {
+    return iDpsEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::GetParameters(TDpsArgArray& aParams) const
+    {
+    aParams = iDpsArgs;
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CDpsXmlParser::IsEvent() const
+	{
+	return iDpsEvent != EDpsEvtEmpty;
+	}
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::SetParameters(TDpsArgArray& aParams)
+    {
+    iDpsArgs = aParams;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::SetOperationResult(TDpsResult& aResult) const
+    {
+    aResult.iMajorCode = iDpsResult.iMajorCode;
+    aResult.iMinorCode = iDpsResult.iMinorCode;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/dpsxmlstring.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2006, 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 class defines the dps constant strings. 
+*
+*/
+
+
+#ifndef DPSXMLSTRING_H
+#define DPSXMLSTRING_H
+
+#include <e32base.h>
+
+typedef RArray<TPtrC8> TDpsStrings;
+
+/**
+* The class for the dps string
+*/
+class TDpsXmlString
+    {
+    public:
+        /**
+        *
+        */
+        static TDpsXmlString* NewL();
+        
+        /**
+        *
+        */
+        ~TDpsXmlString();
+        
+    private:
+        /**
+        *
+        */
+        void ConstructL();
+        
+        /**
+        *
+        */
+        TDpsXmlString();    
+        
+    public:    
+        TDpsStrings iDpsOperationStrings;
+        TDpsStrings iDpsElementStrings;
+        TDpsStrings iDpsEventStrings;
+        TDpsStrings iDpsArgStrings;
+    };
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/inc/pictbridge.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2006, 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 class defines and implements the API for UI engine. 
+*
+*/
+
+
+#ifndef PICTBRIDGE_H
+#define PICTBRIDGE_H
+
+#include "dpsdefs.h"
+#include <rptp.h>
+
+class TDpsXmlString;
+class CDpsUsbNotifier;
+class TMDpsOperation;
+class TDpsEvents;
+class CDpsStateMachine;
+class TDpsConfigPrintReq;
+
+NONSHARABLE_CLASS(CDpsEngine) : public CBase
+    {
+    public:
+        enum TConnectionStatus
+            {
+            ENotConnected = 1,
+            // ptp printer is connected
+            EPrinterConnected,
+            // ptp printer is disconnected
+            EPrinterDisconnected,
+            // in ptp personality, but device other than printer connected
+            EOtherConnected,
+            // in personality other than ptp and device is connected 
+            EWrongPrintModeConnected
+            };
+	        
+    public:
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   The client should always call this function to get the Dps 
+        *   engine object.
+        *   This function guarantees there is only one engine in the 
+        *   thread, a singleton.  	
+        *   @return CDpsEngine* the only Dps Engine instance in a thread
+        *   
+        */
+        IMPORT_C static CDpsEngine* GetEngineL();
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *	Deletes the dps engine object. 
+        */
+        IMPORT_C void Delete();
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *	Sets the personality to PTP. This must be the first call after 
+        *   the client has got the CDpsEngine object and should only be
+        *   called once.
+        *   @param aStatus the asynchronous request and it has the connect
+        *   state after returned. The client can use this value to get the
+        *   current connect status.        
+        */
+        IMPORT_C void SetPrintMode(TRequestStatus& aStatus);
+        							 
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Cancels the SetPrintMode request        
+        */        							 
+        IMPORT_C void CancelPrintMode();
+						     
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Registers connection notification. This function can inform 
+        *   the connection and the disconnect, two states. Connection: the
+        *   personality has been set to PTP by SetPrintMode, but the cable
+        *   is not connected at the moment. The connection will be informed
+        *   by this function. 
+        *   Disconnect: the user has unplugged the cable or changed 
+        *   personality.    
+        *   
+        *   @param aStatus the asynchronous request status and it has the 
+        *   connect state after returned.
+        */     
+        IMPORT_C void ConnectStateNotify(TRequestStatus& aStatus);
+				     					
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Registers Dps event notification. There are two events: jobStatus
+        *   and deviceStatus. This function is called immediately after 
+        *   ConnecSatetNotify call. After this call, the client should issue 
+        *   ConfigPrintService request to configure the printer.
+        *   @param aParam this parameter serves as out parameter. After
+        *   processing the event from the printer, Dps engine will put
+        *   the correct value to this parameter. As the result, the client
+        *   can get the event by accessing this parameter after this request
+        *   gets answered. So the client should have it as a class variable
+        *   @param aStatus the asynchronous status. 
+        */
+        IMPORT_C void DpsEventNotify(TDpsEvents& aParam, 
+                                     TRequestStatus& aStatus);
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Cancels Dps event notification. The client only needs to call
+        *   this to reset the state of the dps engine and it must be called
+        *   after CancelDpsRequest().
+        */
+        IMPORT_C void CancelDpsEventNotify();
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Starts a Dps operation.
+        *   If this function returned with error, e.g. leaving, the client
+        *   should call CancelDpsRequest(), to cancel the pending request.
+        *   @param aRequest the Dps operation. It includes both request and 
+        *   reply. The client should fill in the request parameter and the 
+        *   Dps engine will fill in the reply paramter when this operation
+        *   is finished. The client should declare it as a class variable.
+        *   @param aStatus the asynchronous status
+        */
+        IMPORT_C void DoDpsRequestL(TMDpsOperation* aRequest, 
+                                    TRequestStatus& aStatus);
+		
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Cancels the dps operation. Calling this will reset the state of 
+        *   the dps engine, either because of error happened or the client
+        *   wants to do this on purpose. In most cases, the client never need
+        *   to cancel the ongoing request because the request will end very 
+        *   quick, normally within several million seconds. The client normally
+        *   waits until the request is finished, either succesfully or
+        *   failed indicated by timeout.
+        */        
+        IMPORT_C void CancelDpsRequest();
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Reads the phone dps configuration from the resource file
+        *   @param aConfig the dps configuration is returned by this parameter
+        */
+        IMPORT_C void GetDpsConfigL(TDpsConfigPrintReq& aConfig);
+        
+        /**
+        *   @since 3.2
+        *   @lib pictbridge.lib
+        *
+        *   Gets the folder where the printer configure file should be kept. 
+        *   The print App needs a file to store the printer configure when it
+        *   first calls configPrintService Dps request. The print app can 
+        *   quit at anytime while the ptpserver (stack) is still running. 
+        *   Since the ptpstack is keeping the session with the printer, the 
+        *   printer always does not excute the second onward 
+        *   configPrintService request. As the result, the restarted print app
+        *   cannot get the printer configure. So there must be a file for 
+        *   keeping this information and it will be deleted by ptpserver when
+        *   it quits, e.g. when the connection with the printer is lost.
+        *   @return TDesC& the folder descriptor
+        */
+        IMPORT_C const TDesC& DpsFolder() const;
+            
+        /**
+        *   Gets the Dps event object
+        *   @return TDpsEvents* the pointer to the Dps event.
+        */
+        TDpsEvents* Event() const;
+            
+        /**
+        *  Gets the ptp server reference
+        *  @return RPtp& the reference to ptp server.
+        */
+        RPtp& Ptp();
+            
+        /**
+        *  Gets the dps constant strings
+        *  @return TDpsGlobalData* the pointer to dps constant strings.
+        */
+        TDpsXmlString* DpsParameters() const;
+         
+        /**
+        * @return dps event notify AO status
+        *   
+        */
+        TRequestStatus*& EventRequest();
+            
+        /**
+        * @return dps request AO status
+        */
+        TRequestStatus*& OperationRequest();
+         
+        /**
+        * @return connection notify AO status
+        */               
+        TRequestStatus*& PrinterConnectRequest();
+        
+        /**
+        *  Sets the Dps file folder. 
+        *  @param aFolder the foler location, readed from Ptp server/stack 
+        */
+        void SetDpsFolder(const TDesC& aFolder);
+        
+            
+    private:
+        
+        /**
+        *   Prohibits the destructor called by the client. To delete engine object
+        *   Delete() must be called
+        */
+        ~CDpsEngine();  
+        
+        /**
+        *   Second phase constructor. Operations which might leave should 
+        *   be called here
+        */
+        void ConstructL();
+              
+    private:
+        // string constant, owned by this class
+        TDpsXmlString* iDpsParameters;
+        // dps engine state machine, owned by this class
+        CDpsStateMachine *iDpsOperator;
+        // dps operation AO request, owned by this class
+        TRequestStatus* iDpsOperationRequest;
+        // dps event AO request, owned by this class
+        TRequestStatus* iDpsEventRequest;
+        // printer connection/disconnection AO request, owned by this class
+        TRequestStatus* iPrinterConnectRequest;
+        
+        // usb cable connection/disconnection notifier, owned by this class
+        CDpsUsbNotifier *iUsbNotifier;
+                
+        // out parameter for events (NotifyJobStatus and
+        // NotifyDeviceStauts), it is
+        // passed from UI engine, not owned by this class  
+        TDpsEvents* iOutEvent;
+        
+        // Ptp Server session, owned by this class
+        RPtp    iPtp;
+        // the folder where all dps releated files should be stored              
+        TFileName iDpsFolder;  
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/rom/pictbridge.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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:  iby file for pictbrige engine
+*
+*/
+
+#ifndef __PICTBRIDGE_IBY
+#define __PICTBRIDGE_IBY
+#ifdef __USB_PICTBRIDGE
+file=ABI_DIR\BUILD_DIR\pictbridge.dll			SHARED_LIB_DIR\pictbridge.dll
+
+data=DATAZ_\RESOURCE_FILES_DIR\dps.RSC         RESOURCE_FILES_DIR\dps.RSC
+#endif __USB_PICTBRIDGE
+#endif __PICTBRIDGE_IBY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dps.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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:  The dps resource file. 
+*
+*/
+
+
+#include <badef.rh>
+#include "dps.rh"
+
+
+RESOURCE BA_RSS_SIGNATURE
+	{
+	signature = 1;
+	}
+
+RESOURCE dps_configuration dps_config
+	{
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2006, 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 class implements functions of the notification of the 
+*                PTP printer connction and disconnection. 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsconnectnotifier.h"
+#include "dpsusbnotifier.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TUint KUsbAllStates = 0xFFFFFFFF;
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+// 
+CDpsConnectNotifier* CDpsConnectNotifier::NewL(CDpsUsbNotifier* aParent)
+    {
+    IF_DEBUG(Print(_L("CDpsConnectNotifier::NewL")));
+    CDpsConnectNotifier* self = new(ELeave) CDpsConnectNotifier(aParent);
+    return self;	    
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//     
+CDpsConnectNotifier::CDpsConnectNotifier(CDpsUsbNotifier* aParent) :
+    CActive(EPriorityNormal), iNotifier(aParent) 
+    {
+    IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::Ctor")));    
+    CActiveScheduler::Add(this);
+    IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::Ctor")));    
+    }
+   
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//     
+CDpsConnectNotifier::~CDpsConnectNotifier()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::~")));   
+    Cancel();
+    IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::~")));   
+    }
+   
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//     
+void CDpsConnectNotifier::ConnectNotify()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::ConnectNotify")));    
+    if (!IsActive())
+        {
+	    iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates, 
+	                                             iNotifier->iConnectState, 
+	                                             iStatus);
+        SetActive();			
+        }
+    IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::ConnectNotify")));    	
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+// 
+void CDpsConnectNotifier::RunL()
+    {
+    IF_DEBUG(Print(_L
+        (">>>CDpsConnectNotifier::RunL %x"), iNotifier->iConnectState));
+    if (KErrNone == iStatus.Int())
+        {
+        
+        // notify connect (by set personality)
+        if (iNotifier->iConnectState == EUsbDeviceStateConfigured && 
+            !iNotifier->iConfigured)
+            {
+            iNotifier->PtpNotify(KErrNone);
+            }
+        // Notify disconnect on cable disconnection and for compatible printer
+        // also when other device state than configured or suspended is entered. 
+        else if (  (iNotifier->iConnectState == EUsbDeviceStateUndefined) ||
+                ( iNotifier->IsConfigured() && 
+                        (iNotifier->iConnectState != EUsbDeviceStateConfigured) &&
+                        (iNotifier->iConnectState != EUsbDeviceStateSuspended) )  )
+            {
+            iNotifier->DisconnectNotify(iNotifier->iConnectState);
+            } 
+        else // not the state we are interested, keep on listening
+            {
+            iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates, 
+	                                                 iNotifier->iConnectState, 
+	                                                 iStatus);
+            SetActive();	                                             
+            }
+        
+        }
+    else
+        {
+        IF_DEBUG(Print(_L("\tthe iStatus is wrong!!!")));
+        }    
+    IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::RunL")));    
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+// 
+void CDpsConnectNotifier::DoCancel()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::DoCancel")));    
+    iNotifier->iUsbM.DeviceStateNotificationCancel();
+    IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::DoCancel")));
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+// 
+TInt CDpsConnectNotifier::RunError(TInt aErr)
+    {
+    IF_DEBUG(Print(_L("CDpsConnectNotifier::RunError is %d"), aErr));    
+    return aErr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsfile.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2006, 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 class reads and writes the file content. 
+*
+*/
+
+
+#include "dpsfile.h"
+#include "dpsdefs.h"
+#include "dpsconst.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+    
+// --------------------------------------------------------------------------
+// 
+// --------------------------------------------------------------------------
+//
+CDpsFile* CDpsFile::NewL()
+	{
+	IF_DEBUG(Print(_L("CDpsFile::NewL")));
+	CDpsFile* self = new (ELeave) CDpsFile();
+	CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); 
+	return self;
+	}
+
+// --------------------------------------------------------------------------
+// 
+// --------------------------------------------------------------------------
+//
+void CDpsFile::ConstructL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsFile::ConstructL")));    
+	User::LeaveIfError(iFs.Connect());
+    IF_DEBUG(Print(_L("<<<CDpsFile::ConstructL")));    
+    }
+    
+// --------------------------------------------------------------------------
+// 
+// --------------------------------------------------------------------------
+//
+CDpsFile::~CDpsFile()
+	{
+	IF_DEBUG(Print(_L(">>>CDpsFile::~")));        
+	iFs.Close();
+	IF_DEBUG(Print(_L("<<<CDpsFile::~")));        
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CDpsFile::CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript,
+								const TInt aFileSize)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsFile::CreateScriptFile size %d"), aFileSize));            
+    RFile file;
+    TInt err = file.Replace(iFs, aFileName, EFileShareExclusive);
+    IF_DEBUG(Print(_L("---the error is %d"), err));
+    if (err != KErrNone)
+        {
+        return err;
+        }
+        
+    TInt fileSize = aScript.Size();
+    if (!fileSize)
+        {
+        err = file.Write(_L8(""), 0);
+        }
+    else if ( fileSize <= aFileSize)
+        {
+        err = file.Write(aScript, fileSize);
+        }
+    else
+        {
+        err = file.Write(aScript, aFileSize);
+        }
+        
+    file.Close();
+    IF_DEBUG(Print(_L("<<<CDpsFile::CreateScriptFile %d"), err));            
+    return err;   
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsFile::GetContentL(const TDesC& aFileName, TDes8& aScript)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsFile::GetContent %S"), &aFileName));                
+    RFile file;
+    CleanupClosePushL(file);
+    User::LeaveIfError(file.Open(iFs, aFileName, EFileRead));
+    User::LeaveIfError(file.Read(aScript));
+    CleanupStack::PopAndDestroy();
+    IF_DEBUG(Print(_L("<<<CDpsFile::GetContent")));                       
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsFile::FileSizeL(const TDesC& aFileName, TInt& aSize)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsFile::FileSize %S"), &aFileName));       
+    RFile file;
+    CleanupClosePushL(file);
+    User::LeaveIfError(file.Open(iFs, aFileName, EFileRead)); 
+    User::LeaveIfError(file.Size(aSize));    
+    CleanupStack::PopAndDestroy();
+    IF_DEBUG(Print(_L("<<<CDpsFile::FileSize %d"), aSize));                
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TInt CDpsFile::Delete(const TDesC& aFileName)
+    {
+    IF_DEBUG(Print(_L("CDpsFile::Delete")));                    
+    return iFs.Delete(aFileName);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsoperation.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,1033 @@
+/*
+* Copyright (c) 2006, 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:  These classes implement dps operations replies. 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsoperation.h"
+#include "dpsconst.h"
+#include "dpstransaction.h"
+#include "pictbridge.h"
+#include "dpsxmlparser.h"
+#include "dpsxmlgenerator.h"
+#include "dpsstatemachine.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TInt KConfigPrintService = 5;
+const TInt KCopyFileWidth = 3;
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void TMDpsOperation::CreateReqScriptL(
+                                      const TDpsArgArray& aArguments, 
+                                      const TDpsEleArray& /*aElements*/,
+                                      TDpsAttribute /*aAttribute*/, 
+                                      RWriteStream& aScript, 
+                                      CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TMDpsOperation::CreateReqScript")));        
+    CDpsXmlGenerator* g = aTrader->Generator();
+    g->StartDocumentL(aScript);
+    g->StartInputL(aScript);
+    TInt count = aArguments.Count();
+    if (!count)
+	    {
+		g->StartOperationL((TDpsOperation)iOperation, aScript, ETrue);
+		}
+	else
+		{
+		g->StartOperationL((TDpsOperation)iOperation, aScript);
+		for (TInt i = 0; i < count; i++)
+			{
+			g->CreateArgL(aScript, aArguments[i]);
+			}
+		g->EndOperationL((TDpsOperation)iOperation, aScript);	
+		}
+			
+    g->EndInputL(aScript);
+	g->EndDocumentL(aScript);	
+	IF_DEBUG(Print(_L("<<<TMDpsOperation::CreateReqScript")));        	
+    }
+    
+// ---------------------------------------------------------------------------
+// Some request parameters should be checked
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TDpsStartJob::FillReqArgs(TDpsArgArray& aArgs, 
+                                        TDpsEleArray& aElements,
+                                        TDpsAttribute& /*aAttrib*/, 
+                                        CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsStartJob::FillReqArgs")));                    
+    TInt imageCount = iReqParam.iPrintInfo.Count();
+    if (!imageCount) 
+        {
+        return KErrUnknown;
+        }
+    TUint32* objectHandles = new TUint32[imageCount];
+    if (!objectHandles)
+        {
+        return KErrNoMemory;
+        }
+    for (TInt i = 0; i < imageCount; i++)
+        {
+        TInt err = aTrader->Engine()->Ptp().
+             GetObjectHandleByName(
+                 iReqParam.iPrintInfo[i].iFile, objectHandles[i], ETrue); 
+        if (err != KErrNone)
+            {
+            IF_DEBUG(Print(_L("---error %d"), err));
+            
+            delete[] objectHandles;
+            return err;
+            }
+        }
+    TDpsArg* argsP = new TDpsArg[iReqParam.GetParamNum()];
+    if (!argsP)
+        {
+		delete[] objectHandles;
+        return KErrNoMemory;
+        }
+    TDpsEle* elemsP = new TDpsEle[1 + imageCount];
+    if (!elemsP)
+        {
+		delete[] argsP;
+		delete[] objectHandles;
+        return KErrNoMemory;
+        }
+    // jobConfig    
+    TInt count = iReqParam.iJobConfig.Count();
+              
+    TInt ret = KErrNone;
+    
+    elemsP[0].iElement = EDpsJobConfig;
+    elemsP[0].iNum = count;
+    if ( (ret = aElements.Append(elemsP[0])) != KErrNone )
+        {
+        IF_DEBUG(Print(_L("*** append error")));
+        return ret;
+        }
+    for (TInt i = 0; i < count; i++)
+        {
+        argsP[i].iElement = iReqParam.iJobConfig[i].iElement;
+    	// the parameter only has high bytes (0x1234)
+    	argsP[i].iContent.AppendNumUC(iReqParam.iJobConfig[i].iContent, EHex);
+    	// we have to append the low bytes (0000)
+    	argsP[i].iContent.Append(KDpsLowZero);
+    	if ( (ret = aArgs.Append(argsP[i])) != KErrNone ) 
+    	    {
+    	    IF_DEBUG(Print(_L("*** append error")));
+    	    return ret;
+    	    }
+    	IF_DEBUG(Print(_L("the element is %d"), argsP[i].iElement));
+    	IF_DEBUG(Print(_L("the content is %S"), &(argsP[i].iContent)));
+    	}    
+    // printInfo
+    for (TInt j = 0; j < imageCount; j++)
+        {
+    	// there is at least one argument for fileID
+    	TInt k = 1;
+    	elemsP[j + 1].iElement = EDpsPrintInfo;
+    	argsP[count].iElement = EDpsArgFileID;
+    	argsP[count].iContent.AppendNumFixedWidth(objectHandles[j], EHex, 
+    	                                          KFullWordWidth);
+    	if ( (ret = aArgs.Append(argsP[count])) != KErrNone )
+    	    {
+    	    IF_DEBUG(Print(_L("*** append error")));
+    	    return ret;
+    	    }
+    	
+    
+    	IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+    	count++;
+    	
+    	// not empty
+    	if (iReqParam.iPrintInfo[j].iFileName)
+    	    {
+    	    argsP[count].iElement = EDpsArgFileName;
+    	    argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iFile);
+    	    if ( (ret = aArgs.Append(argsP[count])) != KErrNone)
+    	        {
+                IF_DEBUG(Print(_L("*** append error")));
+    	        return ret;
+    	        }
+    	    
+    	    IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	    IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+    	    
+    	    k++; count++;
+    	    }
+    	// not empty    
+    	if (iReqParam.iPrintInfo[j].iDate.Size())
+    	    {
+            argsP[count].iElement = EDpsArgDate;
+            argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iDate);
+            if ( (ret = aArgs.Append(argsP[count])) != KErrNone) 
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	    IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+            k++; count++;
+    	    }
+    	if (iReqParam.iPrintInfo[j].iCopies != 0)
+    	    {
+            argsP[count].iElement = EDpsArgCopies;
+            argsP[count].iContent.AppendNumFixedWidthUC(
+                iReqParam.iPrintInfo[j].iCopies, EDecimal, KCopyFileWidth);
+            if ( (ret = aArgs.Append(argsP[count])) != KErrNone) 
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	    IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+    	    k++; count++;
+    	    }    
+    	if (iReqParam.iPrintInfo[j].iPrtPID != 0)
+    	    {
+            argsP[count].iElement = EDpsArgPrtPID;
+            argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iPrtPID);
+            if ( (ret = aArgs.Append(argsP[count])) != KErrNone) 
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	    IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+    	    k++; count++;
+    	    }
+    	if (iReqParam.iPrintInfo[j].iCopyID != 0)
+    	    {
+            argsP[count].iElement = EDpsArgCopyID;
+            argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iCopyID);
+            if ( (ret = aArgs.Append(argsP[count])) != KErrNone) 
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
+    	    IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
+    	    k++; count++;
+    	    }
+        
+    	elemsP[j + 1].iNum = k;
+    	if ( (ret = aElements.Append(elemsP[j + 1])) != KErrNone) 
+    	    {
+            IF_DEBUG(Print(_L("*** append error")));
+    	    return ret;
+    	    }
+    	}
+    	        
+    delete[] objectHandles;	
+    delete[] argsP;
+    delete[] elemsP;
+    IF_DEBUG(Print(_L("<<<TDpsStartJob::FillReqArgs")));                        
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C void TDpsStartJob::CreateReqScriptL(const TDpsArgArray& aArguments, 
+                                            const TDpsEleArray& aElements,
+                                            TDpsAttribute /*aAttribute*/,  
+                                            RWriteStream& aScript, 
+                                            CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsStartJob::CreateReqScript")));                        
+    CDpsXmlGenerator* g = aTrader->Generator();
+    g->StartDocumentL(aScript);
+    g->StartInputL(aScript);
+    g->StartOperationL((TDpsOperation)iOperation, aScript);
+    TInt count = aElements.Count();
+    TInt limit = 0;
+    for (TInt i = 0; i < count; i++)
+	    {
+		g->StartElementL(aElements[i].iElement, aScript);
+		TInt init = limit;
+		limit = (i == 0 ? aElements[0].iNum : limit + aElements[i].iNum);
+		for (TInt j = init; j < limit; j++)
+			{
+			g->CreateArgL(aScript,aArguments[j]);
+			}
+		g->EndElementL(aElements[i].iElement, aScript);	
+		}
+	g->EndOperationL((TDpsOperation)iOperation, aScript);
+	g->EndInputL(aScript);
+	g->EndDocumentL(aScript);	
+	IF_DEBUG(Print(_L("<<<TDpsStartJob::CreateReqScript")));                        	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsAbortJob::FillReqArgs(TDpsArgArray& aArgs, 
+                                        TDpsEleArray& /*aElems*/,
+                                        TDpsAttribute& /*aAttrib*/, 
+                                        CDpsTransaction* /*aParam*/)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsAbortJob::FillReqArgs")));                            
+    TDpsArg arg;
+    arg.iElement = EDpsArgAbortStyle;
+    arg.iContent.AppendNumUC(iReqParam.iAbortStyle, EHex);
+    arg.iContent.Append(KDpsLowZero);
+    TInt ret = aArgs.Append(arg);
+    if (ret != KErrNone) 
+        {
+        IF_DEBUG(Print(_L("*** append error")));
+        }
+    IF_DEBUG(Print(_L("<<<TDpsAbortJob::FillReqArgs")));                            
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// Some request parameters should be checked
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsGetCapability::FillReqArgs(TDpsArgArray& aArgs, 
+                                             TDpsEleArray& aElements,
+                                             TDpsAttribute& aAttrib, 
+                                             CDpsTransaction* /*aParam*/)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillReqArgs")));                                
+    // only one element
+    TDpsEle elems;
+    elems.iElement = EDpsCapability;
+    elems.iNum = 1;
+    TInt ret = KErrNone;
+    if ( (ret = aElements.Append(elems)) != KErrNone)
+        {
+        IF_DEBUG(Print(_L("*** append error")));
+        return ret;
+        }
+    
+    // only one parameter
+    TDpsArg argsP;
+    argsP.iElement = iReqParam.iCap;
+    if ( (ret = aArgs.Append(argsP)) != KErrNone)
+        {
+        IF_DEBUG(Print(_L("*** append error")));
+        return ret;
+        }
+    if (EDpsArgPaperTypes == iReqParam.iCap || EDpsArgLayouts == iReqParam.iCap)
+        {
+        if (iReqParam.iAttribute != 0)
+            {
+            aAttrib = iReqParam.iAttribute;
+            }
+        }
+    IF_DEBUG(Print(_L("<<<TDpsGetCapability::FillReqArgs")));                                    
+    return KErrNone;    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void TDpsGetCapability::CreateReqScriptL(
+                                             const TDpsArgArray& aArguments, 
+                                             const TDpsEleArray& aElements,
+                                             TDpsAttribute aAttribute, 
+                                             RWriteStream& aScript, 
+                                             CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsGetCapability::CreateReqScript")));    
+    CDpsXmlGenerator* g = aTrader->Generator();
+    g->StartDocumentL(aScript);
+    g->StartInputL(aScript);
+    g->StartOperationL((TDpsOperation)iOperation, aScript);
+	g->StartElementL(aElements[0].iElement, aScript);
+	const TInt count = aArguments.Count();
+	for (TInt i = 0; i < count; i++)
+		{
+		g->CreateArgL(aScript, aArguments[i], aAttribute);
+		}
+	g->EndElementL(aElements[0].iElement, aScript);
+	g->EndOperationL((TDpsOperation)iOperation, aScript);	
+	g->EndInputL(aScript);
+	g->EndDocumentL(aScript);
+	IF_DEBUG(Print(_L("<<<TDpsGetCapability::CreateReqScript")));    		
+    }
+        
+// ---------------------------------------------------------------------------
+// Some request parameters should be checked
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsConfigPrintService::FillReqArgs(TDpsArgArray& aArgs, 
+                                                  TDpsEleArray& /*aElems*/,
+                                                  TDpsAttribute& /*aAttrib*/, 
+                                                  CDpsTransaction* /*aParam*/)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsConfigPrintService::FillReqArgs")));
+    TDpsArg* argsP = new TDpsArg[KConfigPrintService]; 
+    if (!argsP)
+        {
+        return KErrNoMemory;
+        }
+    TInt count;
+    TInt ret = KErrNone;     
+    for (TInt i = 0; i < KConfigPrintService; i++)
+        {
+        switch (i)
+            {
+        // there might be several versions
+        case EDpsArgDpsVersions:
+            argsP[i].iElement = EDpsArgDpsVersions;
+            count = iReqParam.iDpsVersions.Count();
+            for (TInt j = 0; j < count; j++)
+                {
+                argsP[i].iContent.AppendNumUC
+                    (iReqParam.iDpsVersions[j].iMajor);
+                argsP[i].iContent.Append(_L("."));    
+                argsP[i].iContent.AppendNumUC
+                    (iReqParam.iDpsVersions[j].iMinor);    
+                }
+            ret = aArgs.Append(argsP[i]);
+        break;    
+        
+        case EDpsArgVendorName: // vender name
+            
+            argsP[i].iElement = EDpsArgVendorName;
+            argsP[i].iContent.Append(iReqParam.iVendorName);
+            ret = aArgs.Append(argsP[i]);
+                        
+        break;  
+        
+        case EDpsArgVendorSpecificVersion: // vender version (optional)
+            if (iReqParam.iVendorVersion.iMajor && 
+                iReqParam.iVendorVersion.iMinor)
+                {
+                argsP[i].iElement = EDpsArgVendorSpecificVersion;
+                argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMajor);
+                argsP[i].iContent.Append(_L("."));    
+                argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMinor);
+                ret = aArgs.Append(argsP[i]);        
+                }
+            
+        break;
+        
+        case EDpsArgProductName: // produce name
+            argsP[i].iElement = EDpsArgProductName;
+            argsP[i].iContent.Append(iReqParam.iProductName);
+            ret = aArgs.Append(argsP[i]);
+        break;
+        
+        case EDpsArgSerialNo: // serialNo (optional)
+            if (iReqParam.iSerialNo.Length())
+                {
+                argsP[i].iElement = EDpsArgSerialNo;
+                argsP[i].iContent.Append(iReqParam.iSerialNo);    
+                ret = aArgs.Append(argsP[i]);
+                }
+            
+        break;
+        
+        default:
+            IF_DEBUG(Print(_L("***Wrong parameter")));
+            delete[] argsP;
+            return KErrArgument;
+            }
+        
+        }
+    
+    if (ret != KErrNone) 
+        {
+        IF_DEBUG(Print( _L("***TDpsConfigPrintService::FillReqArgs append error = %d"), ret));
+        }
+    
+    delete[] argsP;
+    IF_DEBUG(Print(_L("<<<TDpsConfigPrintService::FillReqArgs")));    
+    return ret;    
+    }
+
+// ---------------------------------------------------------------------------
+//  Not all parameters are checked. If the invalid parameter can pass the 
+//  the complaint test, it should not be checked. Instead, the client will see
+//  it as unknown error. Otherwise, there might be unnecessary code and the
+//  client cannot be informed. 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsGetCapability::FillRepArgs(const TDpsArgArray& aArgs, 
+                                             CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillRepArgs")));    
+    CDpsXmlParser* XmlPar = aTrader->Parser();
+    
+    TInt ret = KErrNone;
+    
+    if (aArgs.Count())
+        {
+        if (EDpsArgPaperTypes == aArgs[0].iElement || 
+            EDpsArgLayouts == aArgs[0].iElement)
+            {
+            if (XmlPar->HasAttribute())
+                {
+                TDpsAttribute attrib;
+		        XmlPar->GetAttribute(attrib);
+		        ret = iRepParam.iContent.Append(attrib);            
+                }
+            else
+                {
+                ret = iRepParam.iContent.Append(0);
+                }
+            
+            if (ret != KErrNone)
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            }
+        TUint32 value;
+        TLex8 converter;
+        TLex8 parser(aArgs[0].iContent);
+        parser.SkipSpace();
+        while (!parser.Eos())
+            {
+            parser.Mark();
+            parser.SkipCharacters();
+            if (KFullWordWidth == parser.TokenLength())
+                {
+                TPtrC8 token = parser.MarkedToken();
+                converter.Assign(token);
+                parser.SkipSpace();  
+                }
+            else
+                {
+                IF_DEBUG(Print(_L("***Wrong argument")));
+                return KErrArgument;
+                }
+            TInt error = converter.Val(value, EHex);
+            if (error != KErrNone)
+                {
+                IF_DEBUG(Print(_L("convert error %d"), error));
+                return error;
+                }
+            if (EDpsArgPaperTypes == aArgs[0].iElement)
+                {
+                TDpsPaperType paperType;
+                TInt major = value >> KShiftLength;
+                paperType.iMajor = (TDpsPaperTypeMajor)major;
+                paperType.iMinor = (TDpsPaperTypeMinor)(value & KDpsMinorMask);
+                ret = iRepParam.iPaperType.Append(paperType);
+                }
+            else
+                {
+                // remove the extra zeros
+                value = value >> KShiftLength; 
+                ret = iRepParam.iContent.Append(value);
+                IF_DEBUG(Print(_L("the value is %x"), value));
+                }
+            
+            if (ret != KErrNone) 
+                {
+                IF_DEBUG(Print(_L("*** append error")));
+                return ret;
+                }
+            }
+        iRepParam.iCap = aArgs[0].iElement;
+           
+        }
+    
+    IF_DEBUG(Print(_L("<<<TDpsGetCapability::FillRepArgs")));
+    return KErrNone;    
+    }
+
+// ---------------------------------------------------------------------------
+//  Not all parameters are checked. If the invalid parameter can pass the 
+//  the complaint test, it should not be checked. Instead, the client will see
+//  it as unknown error. Otherwise, there might be unnecessary code and the
+//  client cannot be informed. 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsConfigPrintService::FillRepArgs(const TDpsArgArray& aArgs, 
+                                                  CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsConfigPrintService::FillRepArgs")));    
+    TInt error = KErrNone;
+    TLex8 converter, parser;
+    const TInt count = aArgs.Count();
+    
+    for (TInt i = 0; i < count; i++)
+        {
+        switch (aArgs[i].iElement)
+            {
+            case EDpsArgPrintServiceAvailable: 
+                converter.Assign(aArgs[i].iContent);
+                TInt64 result;
+                error = converter.Val(result, EHex);
+                if (error != KErrNone)
+                    {
+                    IF_DEBUG(Print(_L("*** convert error")));
+                    return error;
+                    }
+                // removes the low four bytes zeros. 
+                IF_DEBUG(Print(_L("--Printer available is %x"), result));   
+                result = result >> KShiftLength;    
+                iRepParam.iPrintAvailable = result;
+            break;
+        
+            case EDpsArgDpsVersions:
+                TDpsVersion version;
+            
+                parser.Assign(aArgs[i].iContent);
+                while (!parser.Eos())
+                    {
+                    parser.Mark();
+                    parser.SkipCharacters();
+                    if (parser.TokenLength())
+                        {
+                        TPtrC8 token = parser.MarkedToken();
+                        converter.Assign(token);
+                        parser.SkipSpace();
+                        }
+                    else
+                        {
+                        IF_DEBUG(Print(_L("***wrong !!!")));
+                        return KErrArgument;
+                        }
+                    error = aTrader->ConvertVersion(converter, version);
+                    if (error != KErrNone)
+                        {
+                        return error;
+                        }
+                    error = iRepParam.iDpsVersions.Append(version);
+                    if (error != KErrNone)
+                        {
+                        IF_DEBUG(Print(_L("*** append error")));
+                        return error;
+                        }
+                    }
+            break;
+        
+            case EDpsArgVendorName:
+                iRepParam.iVendorName.Copy(aArgs[i].iContent);
+                IF_DEBUG(Print(_L
+                                ("vendor name is %S"), &iRepParam.iVendorName));
+            break;
+        
+            case EDpsArgVendorSpecificVersion:
+                parser.Assign(aArgs[i].iContent);
+                aTrader->ConvertVersion(parser, version);
+                iRepParam.iVendorVersion = version;
+                IF_DEBUG(Print(_L
+                        ("vendor version is %x"), iRepParam.iVendorVersion));
+            break;
+       
+            case EDpsArgProductName:
+                iRepParam.iProductName.Copy(aArgs[i].iContent);
+                IF_DEBUG(Print(_L
+                        ("product name is %S"), &iRepParam.iProductName));
+            break;
+        
+            case EDpsArgSerialNo:
+                iRepParam.iSerialNo.Copy(aArgs[i].iContent);
+                IF_DEBUG(Print(_L("SerialNo is %S"), &iRepParam.iSerialNo));
+            break;
+        
+            default:
+                IF_DEBUG(Print(_L("--Unknown param!!")));
+                return KErrArgument;
+            }
+        }
+        
+    IF_DEBUG(Print(_L("<<<TDpsConfigPrintService::FillRepArgs")));
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+//  Not all parameters are checked. If the invalid parameter can pass the 
+//  the complaint test, it should not be checked. Instead, the client will see
+//  it as unknown error. Otherwise, there might be unnecessary code and the
+//  client cannot be informed. 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TDpsGetJobStatus::FillRepArgs(const TDpsArgArray& aArgs, 
+                                            CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsGetJobStatus::FillRepArgs")));
+    TInt value, error, per;
+    TBuf<KMaxArgLen> fileName;
+    TLex8 converter;    
+    TInt count = aArgs.Count();
+    TBool reply = aTrader->IsReply();
+    if (!reply)
+        {
+        aTrader->Engine()->Event()->iEvent = EDpsEvtNotifyJobStatus;
+        }
+    else
+        {
+        aTrader->Engine()->Event()->iEvent = EDpsEvtEmpty;
+        }
+    for (TInt i = 0; i < count; i++)
+        {
+        switch (aArgs[i].iElement)
+            {
+            case EDpsArgPrtPID:
+                converter.Assign(aArgs[i].iContent);
+                error = converter.Val(value);
+                if (error != KErrNone)
+                    {
+                    return error;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iPrtPID = value;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iJobEvent.iRepParam.iPrtPID = 
+                        value;
+                    }
+            break;
+                
+            case EDpsArgFilePath:
+                if (reply)
+                    {
+                    iRepParam.iFilePath.Copy(aArgs[i].iContent);
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iJobEvent.iRepParam.iFilePath. 
+                    Copy(aArgs[i].iContent);
+                    }
+            break;
+                
+            case EDpsArgCopyID:
+                converter.Assign(aArgs[i].iContent);
+                error = converter.Val(value);
+                if (error != KErrNone)
+                    {
+                     return error;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iCopyID = value;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iJobEvent.iRepParam.iCopyID = 
+                        value;
+                    }    
+            break;
+                
+            case EDpsArgProgress:
+                per = aTrader->ParsePercentage(aArgs[i].iContent);
+                if (per < KErrNone)
+                    {
+                    return per;
+                    }
+                
+                if (reply)
+                    {
+                    iRepParam.iProgress = per;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iJobEvent.iRepParam.iProgress = 
+                        per;
+                    }
+            break;
+               
+            case EDpsArgImagesPrinted:
+                converter.Assign(aArgs[i].iContent);
+                error = converter.Val(value);
+                if (error != KErrNone)
+                    {
+                     return error;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iImagesPrinted = value;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iJobEvent.iRepParam.
+                        iImagesPrinted = value;
+                    }                                                                  
+            break;
+            
+            default:
+                IF_DEBUG(Print(_L("***wrong param!!!")));
+                return KErrArgument;                
+            }
+        }
+    IF_DEBUG(Print(_L("<<<TDpsGetJobStatus::FillRepArgs")));    
+    return KErrNone;    
+    }
+
+// ---------------------------------------------------------------------------
+//  Not all parameters are checked. If the invalid parameter can pass the 
+//  the complaint test, it should not be checked. Instead, the client will see
+//  it as unknown error. Otherwise, there might be unnecessary code and the
+//  client cannot be informed. 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsGetPrinterStatus::FillRepArgs(const TDpsArgArray& aArgs, 
+                                                CDpsTransaction* aTrader)
+    {
+    IF_DEBUG(Print(_L(">>>TDpsGetPrinterStatus::FillRepArgs")));
+    // if UI has not pass the event pointer, we do need to fill in it
+    if (!aTrader->Engine()->Event())
+        {
+        return KErrNone;
+        }
+    TLex8 converter;
+    TDpsPrinterStatusRep param;
+    const TInt count = aArgs.Count();
+    TUint32 value, temp;
+    TBool reply = aTrader->IsReply();
+    if (!reply)
+        {
+        aTrader->Engine()->Event()->iEvent = EDpsEvtNotifyDeviceStatus;
+        }
+    else
+        {
+        aTrader->Engine()->Event()->iEvent = EDpsEvtEmpty;
+        }
+    for (TInt i = 0; i < count; i++)
+        {
+        converter.Assign(aArgs[i].iContent);
+        TInt error = converter.Val(value, EHex);
+        if (error != KErrNone)
+            {
+            return error;
+            }
+        IF_DEBUG(Print(_L("--the value is %x"), value));
+        
+        switch (aArgs[i].iElement)
+            {
+            case EDpsArgDpsPrintServiceStatus:
+                value = value >> KShiftLength;
+                if (EDpsPrintServiceStatusPrinting == value ||
+                    EDpsPrintServiceStatusIdle == value ||
+                    EDpsPrintServiceStatusPaused == value)
+                    {
+                    if (reply)
+                        {
+                        iRepParam.iPrintStatus = 
+                            (TDpsPrintServiceStatus)(value);
+                        }
+                    else
+                        {
+                        aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                            iPrintStatus = (TDpsPrintServiceStatus)(value);
+                        }
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                    
+            break;
+            
+            case EDpsArgJobEndReason:
+                value = value >> KShiftLength;
+                if (EDpsJobStatusNotEnded == value ||
+                    EDpsJobStatusEndedOk == value ||
+                    EDpsJobStatusEndedAbortImmediately == value ||
+                    EDpsJobStatusEndedAbortCompleteCurrent == value ||
+                    EDpsJobStatusEndedOther == value)
+                    {
+                    if (reply)
+                        {
+                        iRepParam.iJobStatus = (TDpsJobStatus)(value);    
+                        }
+                    else
+                        {
+                        aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                            iJobStatus = (TDpsJobStatus)(value);    
+                        }    
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                
+            break;
+            
+            case EDpsArgErrorStatus:
+                value = value >> KShiftLength;
+                if (EDpsErrorStatusOk == value ||
+                    EDpsErrorStatusWarning == value ||
+                    EDpsErrorStatusFatal == value)
+                    {
+                    if (reply)
+                        {
+                        iRepParam.iErrorStatus = (TDpsErrorStatus)(value);    
+                        }
+                    else
+                        {
+                        aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                            iErrorStatus = (TDpsErrorStatus)(value);
+                        }    
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                
+            break;
+            
+            case EDpsArgErrorReason:
+                temp = value >> KShiftLength;
+                if (EDpsJobErrorNone == temp ||
+                    EDpsJobErrorPaper == temp ||
+                    EDpsJobErrorInk == temp ||
+                    EDpsJobErrorHardware == temp ||
+                    EDpsJobErrorFile == temp)
+                    {
+                    param.iJobEndReason.iMajor = 
+                        (TDpsJobEndReasonMajor)(temp);
+                    IF_DEBUG(Print(_L("the end reason is %x"), temp));
+                    value = value & KDpsMinorMask;
+                    switch (param.iJobEndReason.iMajor)
+                        {
+                        case EDpsJobErrorPaper:
+                            param.iJobEndReason.iPaperMinor = 
+                                (TDpsJobEndReasonPaper)(value);
+                        break;
+        
+                        case EDpsJobErrorInk:
+                            param.iJobEndReason.iInkMinor = 
+                                (TDpsJobEndReasonInk)(value);
+                        break;
+        
+                        case EDpsJobErrorHardware:
+                            param.iJobEndReason.iHardMinor = 
+                                (TDpsJobEndReasonHard)(value);
+                        break;
+        
+                        case EDpsJobErrorFile:
+                            param.iJobEndReason.iFileMinor = 
+                                (TDpsJobEndReasonFile)(value);
+                        break;
+        
+                        default:
+                            IF_DEBUG(Print(_L("no minor error")));
+                        break; 
+                        }
+                    if (reply)
+                        {
+                        iRepParam.iJobEndReason = param.iJobEndReason;
+                        }
+                    else
+                        {
+                        aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                            iJobEndReason = param.iJobEndReason;
+                        }
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                
+            break;
+            
+            case EDpsArgDisconnectEnable:
+                value = value >> KShiftLength;
+                if (EDpsDisconnectEnableFalse == value)
+                    {
+                    param.iDisconnectEnable = EFalse;    
+                    }
+                else if (EDpsDisconnectEnableTrue == value)
+                    {
+                    param.iDisconnectEnable = ETrue;
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iDisconnectEnable = param.iDisconnectEnable; 
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                        iDisconnectEnable = param.iDisconnectEnable; 
+                    }    
+            break;
+            
+            case EDpsArgCapabilityChanged:
+                value = value >> KShiftLength;
+                if (EDpsCapabilityChangedFalse == value)
+                    {
+                    param.iCapabilityChange = EFalse;    
+                    }
+                else if (EDpsCapabilityChangedTrue == value)
+                    {
+                    param.iCapabilityChange = ETrue;
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iCapabilityChange = param.iCapabilityChange;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                        iCapabilityChange = param.iCapabilityChange;
+                    }
+            break;
+            
+            case EDpsArgNewJobOk:
+                value = value >> KShiftLength;
+                if (EDpsNewJobOkTrue == value)
+                    {
+                    param.iNewJobOk = ETrue;    
+                    }
+                else if (EDpsNewJobOkFalse == value)
+                    {
+                    param.iNewJobOk = EFalse;   
+                    }
+                else
+                    {
+                    return KErrArgument;
+                    }
+                if (reply)
+                    {
+                    iRepParam.iNewJobOk = param.iNewJobOk;
+                    }
+                else
+                    {
+                    aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
+                        iNewJobOk = param.iNewJobOk;
+                    }    
+            break;
+            
+            default:
+                IF_DEBUG(Print(_L("***wrong param")));
+                return KErrArgument;
+            }
+        }
+ 
+    IF_DEBUG(Print(_L("<<<TDpsGetPrinterStatus::FillRepArgs")));    
+    return KErrNone;    
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsparam.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2006, 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:  inline functions of dps parameter. 
+*
+*/
+
+
+#include "dpsparam.h"
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void TDpsPrintInfo::Reset()
+    {
+    isDPOF = EFalse; iFileID = 0; iFileName = EFalse; iDate.Zero(); 
+    iCopies = 0; iPrtPID = 0; iCopyID = 0;
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt TDpsStartJobReq::GetParamNum()
+    {
+    TInt num = iJobConfig.Count(), count = iPrintInfo.Count();
+	for (TInt i = 0; i < count; i++)
+	    {
+	    // there is always fileID field
+	    num++;
+	    if (iPrintInfo[i].iFileName)
+	        {
+	        num++;
+	        }
+	    if (iPrintInfo[i].iDate.Size())
+	        {
+	        num++;
+	        }
+	    if (iPrintInfo[i].iCopies !=0)
+	        {
+	        num++;
+	        }
+	    if (iPrintInfo[i].iPrtPID != 0)
+	        {
+	        num++;
+	        }             
+	        
+	    if (iPrintInfo[i].iCopyID != 0)
+	        {
+	        num++;
+	        }    
+	    }
+	return num;   
+	}
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    	
+EXPORT_C void TDpsJobStatusRep::Reset()
+    {
+    iProgress = 0; iImagesPrinted = 0; iFilePath.Zero(); 
+    iPrtPID = 0; iCopyID = 0;
+    }    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsptpnotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2006, 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 class implements functions of setting personality to 
+*                MTP. 
+*  Version     : %version: 10.1.4 % 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsptpnotifier.h"
+#include "dpsusbnotifier.h"
+#include "dpsconst.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsPtpNotifier* CDpsPtpNotifier::NewL(CDpsUsbNotifier* aParent)
+    {
+    IF_DEBUG(Print(_L("CDpsPtpNotifier::NewL")));
+    CDpsPtpNotifier* self = new(ELeave) CDpsPtpNotifier(aParent);
+    return self;	    
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsPtpNotifier::CDpsPtpNotifier(CDpsUsbNotifier* aParent) :
+    CActive(EPriorityNormal), iNotifier(aParent)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::Ctor")));    
+    CActiveScheduler::Add(this);
+    IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::Ctor")));    
+    }    
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsPtpNotifier::~CDpsPtpNotifier()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::")));        
+    Cancel();
+    IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::~")));        
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsPtpNotifier::ChangePtpPersonality()    
+    {
+    IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::ChangePtpPersonality")));            
+    if (!IsActive())
+        {
+        TInt personalityId = KUsbPersonalityIdMTP;
+        iNotifier->iUsbM.GetCurrentPersonalityId(personalityId);
+        IF_DEBUG(Print(_L("CDpsPtpNotifier::ChangePtpPersonality, current personality= %d"), personalityId));
+        if(KUsbPersonalityIdPCSuiteMTP == personalityId)
+            {
+            TRequestStatus* statusPtr = &iStatus;
+            User::RequestComplete(statusPtr, KErrNone);
+            SetActive();            
+            }
+        else                
+            {
+            iNotifier->iUsbW.SetPersonality(iStatus, KUsbPersonalityIdMTP, ETrue);
+            SetActive();
+            }
+        }
+    IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::ChangePtpPersonality")));        
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsPtpNotifier::RunL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::RunL %d"), iStatus.Int()));            
+    if (KErrNone == iStatus.Int())
+        {
+        iNotifier->iPersonality = KUsbPersonalityIdMTP;
+        TInt ret = iNotifier->ConnectState();
+        if (ret != KErrNone)
+            {
+            IF_DEBUG(Print(_L("error happened %d"), ret));
+            }
+        }
+    iNotifier->PtpNotify(iStatus.Int());        
+    IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::RunL")));
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsPtpNotifier::DoCancel()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::DoCancel")));                
+    iNotifier->iUsbW.CancelSetPersonality();
+    IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::DoCancel")));                
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CDpsPtpNotifier::RunError(TInt aErr)
+    {
+    IF_DEBUG(Print(_L("CDpsPtpNotifier::RunError")));                    
+    return aErr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsscriptreceiver.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2006, 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 class implements the dps script receiving function. 
+*
+*/
+
+
+#include <e32debug.h>
+#include <f32file.h>
+#include "dpsscriptreceiver.h"
+#include "dpsstatemachine.h"
+#include "pictbridge.h"
+#include "dpsconst.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsScriptReceiver* CDpsScriptReceiver::NewL(CDpsStateMachine* aOperator)								 	     
+    {
+    IF_DEBUG(Print(_L("CDpsScriptReceiver::NewL")));
+    CDpsScriptReceiver* self = new(ELeave) CDpsScriptReceiver(aOperator);
+    return self;	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsScriptReceiver::CDpsScriptReceiver(CDpsStateMachine* aOperator) :
+    CActive(EPriorityNormal), iOperator(aOperator),
+    iFileNameAndPath(KDpsHostResponseFileName)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::Ctor")));
+    CActiveScheduler::Add(this);  
+    WaitForReceive();
+    IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::Ctor")));
+    }  
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsScriptReceiver::~CDpsScriptReceiver()
+    {
+    IF_DEBUG(Print(_L(">>>~CDpsScriptReceiver")));
+    Cancel();
+    IF_DEBUG(Print(_L("<<<~CDpsScriptReceiver")));
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//   
+void CDpsScriptReceiver::WaitForReceive()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::WaitForReceive"))); 
+    if (!IsActive())
+        {	
+        iOperator->DpsEngine()->Ptp().ObjectReceivedNotify(KDpsScriptFile, 
+            iFileNameAndPath, iStatus, EFalse);        
+        SetActive();		    	
+        }
+    IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::WaitForReceive"))); 		
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TInt CDpsScriptReceiver::GetFileName(TDes& aFileName)
+    {
+    TParse p;
+    TInt err = p.Set(iFileNameAndPath, NULL, NULL);
+    if (KErrNone == err)
+        {
+        aFileName.Copy(p.NameAndExt());
+        }
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+const TDesC& CDpsScriptReceiver::FileNameAndPath()
+    {
+    return iFileNameAndPath;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsScriptReceiver::RunL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::RunL %S"), &iFileNameAndPath));
+    // in the certain error case, it is possible that the printer sending
+    // the device status before the UI is ready to receive this event.
+    // in this case, pictbridge engine still does not get the ptp folder
+    // setting from the stack. 
+    // if we receive script from host, the stack has started. so we check if
+    // we already get the ptp folder here.
+    if (!iOperator->DpsEngine()->DpsFolder().Length())
+        {
+        iOperator->DpsEngine()->SetDpsFolder(
+            iOperator->DpsEngine()->Ptp().PtpFolder());
+        }
+    if (KErrNone == iStatus.Int())
+        {
+        TFileName receive;
+        User::LeaveIfError(GetFileName(receive));
+        IF_DEBUG(Print(_L("received file is %S"), &receive));
+         // reply from Host is received    
+        if (!receive.Compare(KDpsHostResponseFileName))
+            {
+            iOperator->ScriptReceivedNotifyL(ETrue);    
+            }
+        // request from Host is received    
+        else if (!receive.Compare(KDpsHostRequestFileName))
+            {
+            iOperator->ScriptReceivedNotifyL(EFalse);    
+            }
+        WaitForReceive();    
+        }                
+    else
+    	{
+        IF_DEBUG(Print(_L("the iStatus is wrong!!! %d"), iStatus.Int()));
+        iOperator->Error(iStatus.Int());
+        }    
+    IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::RunL")));
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsScriptReceiver::DoCancel()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::DoCancel")));
+    iOperator->DpsEngine()->Ptp().CancelObjectReceivedNotify();
+    IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::DoCancel")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TInt CDpsScriptReceiver::RunError(TInt aError)	
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::RunError is %d"), aError));
+    // if error happened cancel the outstanding request
+    Cancel();
+    iOperator->Error(aError);
+    IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::RunError")));
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsscriptsender.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2006, 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 class implements the dps script sending function. 
+*
+*/
+
+
+#include <e32debug.h>
+#include <f32file.h>
+#include "dpsscriptsender.h"
+#include "dpsstatemachine.h"
+#include "pictbridge.h"
+#include "dpstransaction.h"
+#include "dpsfile.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsScriptSender* CDpsScriptSender::NewL(CDpsStateMachine* aOperator)
+    {
+    IF_DEBUG(Print(_L("CDpsScriptSender::NewL")));
+    CDpsScriptSender* self = new(ELeave) CDpsScriptSender(aOperator);
+    return self;	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsScriptSender::CDpsScriptSender(CDpsStateMachine* aOperator) : 
+    CActive(EPriorityNormal), iOperator(aOperator), 
+    iReply(EFalse) 
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptSender::Ctor")));
+    CActiveScheduler::Add(this);  
+    IF_DEBUG(Print(_L("<<<CDpsScriptSender::Ctor")));
+    }  
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsScriptSender::~CDpsScriptSender()
+    {
+    IF_DEBUG(Print(_L(">>>~CDpsScriptSender")));
+    Cancel();
+    IF_DEBUG(Print(_L("<<<~CDpsScriptSender")));	
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+TInt CDpsScriptSender::SendScript(TBool aReply)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptSender::SendScript")));  
+    if (!IsActive())
+        {
+        iReply = aReply;  
+        TFileName file(iOperator->DpsEngine()->DpsFolder());
+        RFile script;
+        if (aReply)
+            {
+            file.Append(KDpsDeviceResponseFileName);
+            }
+        else
+            {
+            file.Append(KDpsDeviceRequestFileName);
+            }
+        TInt err = script.Open(iOperator->Trader()->
+            FileHandle()->FileSession(), file, EFileRead);
+        if (err != KErrNone)
+            {
+            return err;
+            }
+        TInt size;    
+        script.Size(size);
+        script.Close();
+        if (aReply)
+            {
+            iOperator->DpsEngine()->
+                Ptp().SendObject(file, iStatus, EFalse, size);       
+            }
+        else
+            {            
+            iOperator->DpsEngine()->
+                Ptp().SendObject(file, iStatus, ETrue, size);
+            }
+        SetActive();    
+        IF_DEBUG(Print(_L("<<<CDpsScriptSender::SendScript")));
+	    return KErrNone;
+        }
+    else
+        {
+        return KErrInUse;
+        }
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsScriptSender::RunL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptSender::RunL")));
+    
+    if (KErrNone == iStatus.Int())
+        {
+        // the device request is sent
+        if (!iReply)
+            {
+            iOperator->ScriptSentNotifyL(EFalse);      
+            }    
+        // the device response is sent    
+        else 
+            {
+            iOperator->ScriptSentNotifyL(ETrue);      
+            }
+        }                
+    else
+    	{
+        IF_DEBUG(Print(_L("the iStatus is wrong %d!!!"), iStatus.Int()));
+        iOperator->Error(iStatus.Int());
+    	}
+    IF_DEBUG(Print(_L("<<<CDpsScriptSender::RunL")));
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+void CDpsScriptSender::DoCancel()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptSender::DoCancel")));
+    iOperator->DpsEngine()->Ptp().CancelSendObject();
+    IF_DEBUG(Print(_L("<<<CDpsScriptSender::DoCancel")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TInt CDpsScriptSender::RunError(TInt aError)	
+    {
+    IF_DEBUG(Print(_L(">>>CDpsScriptSender::RunError is %d"), aError));
+    Cancel();
+    iOperator->Error(aError);
+    IF_DEBUG(Print(_L("<<<CDpsScriptSender::RunError")));
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsstate.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2006, 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:  These classes implement dps states. 
+*
+*/
+
+#include <e32debug.h>
+#include "dpsstate.h"
+#include "dpsstatemachine.h"
+#include "dpstransaction.h"
+#include "dpsscriptreceiver.h"
+#include <pictbridge.h>
+ 
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsIdleState::TDpsIdleState(CDpsStateMachine* aStateMachine) :
+    iStateMachine(aStateMachine) {}
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsIdleState::ScriptSentNotifyL(TBool /*aReply*/)
+    {
+    IF_DEBUG(Print(_L("TDpsIdleState::ScriptSentNotify")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsIdleState::ScriptReceivedNotifyL(TBool aReply)
+    {
+    if (!aReply)
+        {
+        IF_DEBUG(Print(_L("TDpsIdleState::ScriptReceived request got")));            
+        iStateMachine->Trader()->ParseScriptL(aReply);    
+        iStateMachine->SetState(iStateMachine->SendingRepState());
+        }
+    else
+        {
+        IF_DEBUG(Print(_L(
+            "TDpsIdleState::ScriptReceived should not get reply!!!")));    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsIdleState::Error(TInt aErr)
+    {
+    IF_DEBUG(Print(_L("TDpsIdleState::Error %d"), aErr));
+    if ((aErr != KErrCancel) && (aErr != KErrNotReady))
+        {
+        iStateMachine->Trader()->HandleHostRequestError(aErr);
+        iStateMachine->SetState(iStateMachine->SendingRepState());    
+        }
+    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsSendingReqState::TDpsSendingReqState(CDpsStateMachine* aStateMachine) :
+    iStateMachine(aStateMachine) {}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingReqState::ScriptSentNotifyL(TBool aReply)
+    {
+    if (!aReply)
+        {
+        IF_DEBUG(Print(_L("TDpsSendingReqState::ScriptSent request")));
+        iStateMachine->SetState(iStateMachine->WaitingRepState());
+        }
+    else
+        {
+        IF_DEBUG(Print(_L(
+            "TDpsSendingReqState::ScriptSent should not get reply!!")));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingReqState::ScriptReceivedNotifyL(TBool /*aReply*/)
+    {
+    IF_DEBUG(Print(_L("TDpsSendingReqState::ScriptReceived")));
+    IF_DEBUG(Print(_L("**should not reply to the request/reply from host")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingReqState::Error(TInt aErr)
+    {
+    User::RequestComplete(iStateMachine->DpsEngine()->OperationRequest(), 
+                          aErr);
+    iStateMachine->Initialize();                          
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsWaitingRepState::TDpsWaitingRepState(CDpsStateMachine* aStateMachine) :
+    iStateMachine(aStateMachine) {}
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsWaitingRepState::ScriptSentNotifyL(TBool /*aReply*/)
+    {    
+    IF_DEBUG(Print(_L("TDpsWaitingRepState::ScriptSent")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsWaitingRepState::ScriptReceivedNotifyL(TBool aReply)
+    {
+    if (aReply)
+        {
+        IF_DEBUG(Print(_L("WaitingRepState reply")))
+        
+        iStateMachine->Trader()->ParseScriptL(aReply);      
+        User::RequestComplete(
+            iStateMachine->DpsEngine()->OperationRequest(), KErrNone);        
+        iStateMachine->Initialize();        
+        }
+    else
+        {
+        IF_DEBUG(Print(_L("WaitingRepState should not get request")));
+        // collision happened, we do nothing because the host will
+        // eventually handle this by sending the correct response. but we need
+        // to subscribe for the event again.
+        iStateMachine->ScriptReceiver()->WaitForReceive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsWaitingRepState::Error(TInt aErr)
+    {
+    // this is not tested
+    User::RequestComplete(iStateMachine->DpsEngine()->OperationRequest(), 
+                          aErr);
+    iStateMachine->Initialize();                          
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsSendingRepState::TDpsSendingRepState(CDpsStateMachine* aStateMachine) :
+    iStateMachine(aStateMachine) {}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingRepState::ScriptSentNotifyL(TBool aReply)
+    {
+    if (aReply)
+        {
+        IF_DEBUG(Print(_L("TDpsSendingRepState::ScriptSent reply")));
+        if (KErrNone == iStateMachine->CurError())
+            {
+            // this is the normal situation, inform the client
+            User::RequestComplete(iStateMachine->DpsEngine()->EventRequest(), 
+                              KErrNone);    
+            }
+        else
+            {
+            // this is the error situation, do not inform the client. and
+            // we need to subscribe for the new event.
+            iStateMachine->ScriptReceiver()->WaitForReceive();
+            }
+        iStateMachine->Initialize();
+        }
+    else
+        {
+        IF_DEBUG(Print(_L(
+            "TDpsSendingRepState::ScriptSent shoul not get request!!!")));
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingRepState::ScriptReceivedNotifyL(TBool /*aReply*/)
+    {
+    IF_DEBUG(Print(_L("TDpsSendingRepState::ScriptReceived")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsSendingRepState::Error(TInt /*aErr*/)
+    {
+    return;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsstatemachine.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2006, 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 class implements the dps state machine. 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsstatemachine.h"
+#include "dpsscriptreceiver.h"
+#include "dpsscriptsender.h"
+#include "dpstransaction.h"
+#include "dpsconst.h"
+#include "pictbridge.h"
+#include "dpsparam.h"
+#include "dpsoperation.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsStateMachine* CDpsStateMachine::NewL(CDpsEngine* aEngine)
+    {
+    IF_DEBUG(Print(_L("CDpsStateMachine::NewL")));
+    CDpsStateMachine* self = new(ELeave) CDpsStateMachine(aEngine);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;	
+    }
+	
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsStateMachine::~CDpsStateMachine()
+    {
+    IF_DEBUG(Print(_L(">>>~CDpsStateMachine")));
+    delete iTrader;
+    iTrader = NULL;
+    delete iScriptReceiver;
+    iScriptReceiver = NULL;
+    delete iScriptSender;
+    iScriptSender = NULL;
+    
+    delete iIdleState; iIdleState = NULL;
+    delete iSendingReqState; iSendingReqState = NULL;
+    delete iWaitingRepState; iWaitingRepState = NULL;
+    delete iSendingRepState; iSendingRepState = NULL;	
+    IF_DEBUG(Print(_L("<<<~CDpsStateMachine")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsStateMachine::CDpsStateMachine(CDpsEngine* aEngine) : 
+    iEngine(aEngine),iOperation(EDpsOpEmpty), iEvent(EDpsEvtEmpty), 
+    iCurError(KErrNone)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsStateMachine::Ctor")));
+    
+    IF_DEBUG(Print(_L("<<<CDpsStateMachine::Ctor")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::ConstructL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsStateMachine::ConstructL")));	
+    iIdleState = new(ELeave) TDpsIdleState(this);
+    iSendingReqState = new(ELeave) TDpsSendingReqState(this);
+    iWaitingRepState = new(ELeave) TDpsWaitingRepState(this);
+    iSendingRepState = new(ELeave) TDpsSendingRepState(this);
+    iCurState = iIdleState;
+    iTrader = CDpsTransaction::NewL(this);
+    iScriptReceiver = CDpsScriptReceiver::NewL(this);
+    iScriptSender = CDpsScriptSender::NewL(this);	
+    IF_DEBUG(Print(_L("<<<CDpsOperator::ConstructL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::StartTransactionL(TMDpsOperation* aRequest)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsStateMachine::StartTransaction")));
+    iMOperation = aRequest;
+    iOperation = (TDpsOperation)iMOperation->iOperation;    
+    iTrader->CreateRequestL(aRequest);
+    iCurState = iSendingReqState;
+    IF_DEBUG(Print(_L("<<<CDpsStateMachine::StartTransaction")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsStateMachine::Initialize()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsStateMachine::Initialize")));
+    iOperation = EDpsOpEmpty;
+    iEvent = EDpsEvtEmpty;
+    iCurError = KErrNone;
+    if (CurState() != IdleState())
+        {
+        SetState(IdleState());
+        }
+    IF_DEBUG(Print(_L("<<<CDpsStateMachine::Initialize")));    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpstransaction.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,455 @@
+/*
+* Copyright (c) 2006, 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 class creates and parses dps operations. 
+*
+*/
+
+
+#include <e32base.h>
+#include <e32debug.h>
+#include <pathinfo.h>
+#include <s32file.h>
+#include "dpstransaction.h"
+#include "dpsscriptsender.h"
+#include "dpsdefs.h"
+#include "dpsxmlparser.h"
+#include "dpsxmlgenerator.h"
+#include "dpsconst.h"
+#include "dpsfile.h"
+#include "dpsstatemachine.h"
+#include "dpsscriptreceiver.h"
+#include "pictbridge.h"
+#include <xml/parser.h>
+#include "dpsparam.h"
+#include "dpsoperation.h"
+#include "dpsxmlstring.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TInt KPathLength = 3;
+const TInt KPercentagePosition = 3;
+const TInt KPercentage = 100;
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsTransaction* CDpsTransaction::NewL(CDpsStateMachine* aOperator)
+    {
+    IF_DEBUG(Print(_L("CDpsTransaction::NewL")));
+    CDpsTransaction* self = new(ELeave) CDpsTransaction(aOperator);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsTransaction::CDpsTransaction(CDpsStateMachine* aOperator) :
+    iOperator(aOperator), iReply(EFalse)
+	{
+    IF_DEBUG(Print(_L("CDpsTransaction::Ctor")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsTransaction::ConstructL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::ConstructL")));	
+    iFile = CDpsFile::NewL();
+    iXmlGen = CDpsXmlGenerator::NewL(iOperator->DpsEngine());
+    iXmlPar = CDpsXmlParser::NewL(iOperator->DpsEngine());
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::ConstructL")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsTransaction::~CDpsTransaction()
+	{
+    IF_DEBUG(Print(_L(">>>~CDpsTransaction")));
+    delete iXmlPar;
+    iXmlPar = NULL;
+	
+    delete iXmlGen;
+    iXmlGen = NULL;
+	
+    delete iFile;
+    iFile = NULL;
+	
+    IF_DEBUG(Print(_L("<<<~CDpsTransaction")));
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsTransaction::CreateRequestL(TMDpsOperation* aOperation)
+	{
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateRequest ")));
+    IF_DEBUG(Print(_L("  the request is %d"), aOperation->iOperation));
+    TDpsArgArray args;
+    TDpsEleArray elements; 
+    TDpsAttribute attrib = 0;
+    CleanupClosePushL(args);
+    CleanupClosePushL(elements);
+    RFileWriteStream writer;
+    writer.PushL();
+    TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
+    defaultPath.Append(KDpsDeviceRequestFileName);
+    User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath, 
+                                      EFileWrite));
+    IF_DEBUG(Print(_L("*** file created  ")));                                  
+    User::LeaveIfError(aOperation->FillReqArgs(args, elements, attrib, this));
+    aOperation->CreateReqScriptL(args, elements, attrib, writer, this);    
+    writer.CommitL();
+    writer.Pop();
+    writer.Release();
+    User::LeaveIfError(iOperator->ScriptSender()->SendScript(EFalse));
+    CleanupStack::PopAndDestroy(&elements);
+    CleanupStack::PopAndDestroy(&args);
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateRequest "))); 
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsTransaction::Filter(TDes8& aScript)
+    {    
+    TInt size = aScript.Size();
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::Filter size %d"), size));
+    
+    for (TInt i = 0; i < size; )
+        {
+        // removes any unprintalbe char between two XML attributes, e.g. 
+        // between > and <            
+        if (aScript[i] >= KSOH && aScript[i] <= KSpace && aScript[i -1] == '>')    
+            {
+            aScript.Delete(i, 1);
+            size--;
+            }
+        else
+            {
+            i++;
+            }
+        }
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::Filter size %d"), size));
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsTransaction::ParseScriptL(TBool aReply)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::ParseScript")));
+    iReply = aReply;
+    TInt size;
+    iFile->FileSizeL(iOperator->ScriptReceiver()->FileNameAndPath(), size);
+    HBufC8* script = HBufC8::NewLC(size);
+    TPtr8 ptr_script = script->Des();
+    iFile->GetContentL(iOperator->ScriptReceiver()->FileNameAndPath(), 
+                       ptr_script);
+    Filter(ptr_script);    
+	iXmlPar->Reset();
+    CParser* parser = CParser::NewLC(KDpsXmlMimeType, *iXmlPar);
+    Xml::ParseL(*parser, ptr_script);
+    TDpsArgArray args; iXmlPar->GetParameters(args);
+    
+#ifdef _DEBUG
+    //print what we get now
+    TBuf<KMaxArgLen> print;
+    for (TInt i = 0; i < args.Count(); i++)
+        {
+        print.Copy(args[i].iContent);
+        IF_DEBUG(Print(_L("element %d content %S"), 
+            args[i].iElement, &print));
+        }
+#endif
+   
+    if (aReply)
+        {
+        TMDpsOperation* op = iOperator->MOperation();
+        User::LeaveIfError(op->FillRepArgs(args, this));
+        iXmlPar->SetOperationResult(op->iResult);    
+        }  
+    else 
+        {
+        TDpsResult result; 
+   	    result.iMajorCode = EDpsResultOk; 
+        result.iMinorCode = EDpsResultNone;       			
+        if (iXmlPar->IsEvent())
+            {
+            TDpsEvent event = iXmlPar->Event();
+            iOperator->SetEvent(event);
+            if (event == EDpsEvtNotifyJobStatus)
+                {
+                User::LeaveIfError(iOperator->DpsEngine()->Event()->
+                    iJobEvent.FillRepArgs(args, this));
+                }
+            else
+                {
+                User::LeaveIfError(iOperator->DpsEngine()->Event()->
+                    iPrinterEvent.FillRepArgs(args, this));
+                }
+            CreateEventReplyL(event, result);    
+            }
+        else
+            {
+            // the request from the host is only this one:
+            // GetFileID and used by DPOF printing 
+            TDpsOperation ope = iXmlPar->Operation();
+            iOperator->SetOperation(ope);
+            if (iOperator->Operation() != EDpsOpGetFileID)
+                {
+                User::Leave(KErrNotSupported);
+                }    		    
+            CreateRequestReplyL(args, result);    
+            }	
+        }
+    CleanupStack::PopAndDestroy(parser);
+    CleanupStack::PopAndDestroy(script);
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::ParseScript")));	
+    }
+        
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsTransaction::HandleHostRequestError(TInt aErr)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::HandleHostRequestError %d"), aErr));
+    TDpsResult result; 
+    // here we need to map the aErr to Dps standard error
+    switch (aErr)
+        {
+        case KErrNotSupported: 
+            result.iMajorCode = EDpsResultNotRecognized; 
+            result.iMinorCode = EDpsResultNone;         
+        break;
+        
+        case KErrArgument:
+            result.iMajorCode = EDpsResultNotSupported; 
+            result.iMinorCode = EDpsResultillegalParam;         
+        break;
+        
+        default:
+            IF_DEBUG(Print(_L("unknown err")));
+            return;    
+        }
+    TRAP_IGNORE(CreateEventReplyL(iXmlPar->Event(), result));
+    
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::HandleHostRequestError")));    
+    return;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TInt CDpsTransaction::ConvertVersion(TLex8& aParser, TDpsVersion& aVersion)
+    {
+    aParser.Mark();
+    while (!aParser.Eos())
+        {
+        TChar c = aParser.Peek();
+        if (!c.IsDigit())
+            {
+            break;
+            }
+        aParser.Inc();    
+        }
+    TPtrC8 token = aParser.MarkedToken();
+    TLex8 converter(token);    
+    TInt error = converter.Val(aVersion.iMajor);
+                        
+    if (error != KErrNone)
+        {
+         IF_DEBUG(Print(_L("\t convert error 1")));
+         return error;
+        }
+    IF_DEBUG(Print(_L("verion major %d"), aVersion.iMajor));
+    aParser.Inc();
+    TPtrC8 tokenDe = aParser.Remainder();
+    converter.Assign(tokenDe);
+    error = converter.Val(aVersion.iMinor);
+    if (error != KErrNone)
+        {
+        IF_DEBUG(Print(_L("\t convert error 2")));
+        return error;
+        }
+    IF_DEBUG(Print(_L("verion minor %d"), aVersion.iMinor));        
+    return KErrNone;
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+TInt CDpsTransaction::ParsePercentage(const TDes8& aPer)  
+    {
+    TLex8 parser(aPer);
+    parser.Mark();
+    parser.Inc(KPercentagePosition);
+    TPtrC8 digital = parser.MarkedToken();
+    TLex8 converter(digital);
+    TInt num1; 
+    TInt error = converter.Val(num1);
+    if (error != KErrNone)
+        {
+        return error;
+        }
+    
+    parser.Inc(1);
+    parser.Mark();
+    parser.Inc(KPercentagePosition);
+    digital.Set(parser.MarkedToken());
+    converter.Assign(digital);
+    TInt num2; 
+    error = converter.Val(num2);    
+    if (error != KErrNone)
+        {
+        return error;
+        }
+    
+    TReal per = (TReal)num1 / (TReal)num2 * KPercentage;
+    return (TInt)per;
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsTransaction::CreateEventReplyL(TDpsEvent aEvent, 
+                                        const TDpsResult& aResult)
+                                   
+	{
+	IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateReply")));
+	IF_DEBUG(Print(_L
+	    ("  the operation reply is %d"), iOperator->Operation()));
+	IF_DEBUG(Print(_L("\t the event reply is %d"), iOperator->Event()));
+    RFileWriteStream writer;
+    writer.PushL();
+    TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
+    defaultPath.Append(KDpsDeviceResponseFileName);
+    User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath, 
+                                      EFileWrite));
+    IF_DEBUG(Print(_L("*** file created  ")));     
+    iXmlGen->CreateResultScriptL(aEvent, writer, aResult);
+    writer.CommitL();
+    writer.Pop();
+    writer.Release();
+	User::LeaveIfError(iOperator->ScriptSender()->SendScript(ETrue));
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateReply")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsTransaction::CreateRequestReplyL(const TDpsArgArray& aArgs, 
+                                          const TDpsResult& aResult)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateRequestReply")));
+    TInt count = aArgs.Count();
+    TInt basePathId;
+    TBuf8<KMaxArgLen> filePath;
+    TLex8 converter;
+    
+    for (TInt i = 0; i < count; i++)
+        {
+        switch (aArgs[i].iElement)
+            {
+            case EDpsArgBasePathID:
+                converter.Assign(aArgs[i].iContent);
+                User::LeaveIfError(converter.Val(basePathId));
+            break;
+            
+            case EDpsArgFilePath:
+                filePath.Copy(aArgs[i].iContent);
+            break;
+            
+            default:
+                __IF_DEBUG(Print(_L("***wrong args")));
+                User::Leave(KErrArgument);
+            break;
+            }
+        TUint32 fileId;
+        
+        SubstitutePath(filePath);
+        TBuf<KMaxArgLen> file;  
+        file.Copy(filePath);
+        User::LeaveIfError(iOperator->DpsEngine()->
+            Ptp().GetObjectHandleByName(file, fileId));
+        TDpsArg arg;
+        arg.iElement = EDpsArgFileID;
+        arg.iContent.AppendNumFixedWidth(fileId, EHex, KFullWordWidth);
+        RFileWriteStream writer;
+        writer.PushL();
+        TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
+        defaultPath.Append(KDpsDeviceResponseFileName);
+        User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath, 
+                                          EFileWrite));
+        IF_DEBUG(Print(_L("*** file created  ")));        
+        iXmlGen->CreateReplyScriptL(EDpsOpGetFileID, writer, aResult, arg);   
+	    User::LeaveIfError(iOperator->ScriptSender()->SendScript(ETrue));
+	    writer.CommitL();
+        writer.Pop();
+        writer.Release();    
+        } 
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateRequestReply")));
+    }
+    
+// ---------------------------------------------------------------------------
+// The aPath is not the full file path, at least the
+// driver letter is not included. The structure of the DPOF filePath is
+// ../path/childpath/imagePrinted.jpg and GetObjectHandleByName
+// requires the full path file as e:\images\image1.jpg
+// the basePathId is not useful because it is always the fileId
+// of AUTPRINT.MRK. But since DPOF is always used for the removable
+// media, we assume that images are only stored in removable media.
+// If the assumption is true (must be true), we need here first to
+// get the removable drive (hopefully only one). Then substitute
+// the / by the \ in the filePath. Finally, insert the removable drive
+// letter and : at the beginning of the filePath. The new full path
+// file can be used by GetObjectHandleByName
+// ---------------------------------------------------------------------------
+//        
+void CDpsTransaction::SubstitutePath(TDes8& aPath)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsTransaction::SubstitutePath %S"), &aPath));
+    TInt size = aPath.Size();
+    for (TInt i = 0; i < size; i++)
+        {
+        if (aPath[i] == KSlash)
+            {
+            aPath[i] = KBackSlash;
+            }
+        }
+    TBuf<KPathLength> driveEWide = PathInfo::MemoryCardRootPath();
+    TBuf8<KPathLength> driveENarrow;
+    driveENarrow.Copy(driveEWide);    
+    aPath.Replace(0, KPathLength - 1, driveENarrow);
+    IF_DEBUG(Print(_L("<<<CDpsTransaction::SubstitutePath %S"), &aPath));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsusbnotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,329 @@
+/*
+* Copyright (c) 2006, 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 class implements functions of set mtp personality, the 
+*                notification of the MTP printer connection and the
+*				 notification of the MTP printer disconnection. 
+*
+*/
+
+
+#include <e32debug.h>
+#include <usbstates.h>
+#include <rptp.h>
+#include "dpsusbnotifier.h"
+#include "dpsconst.h"
+#include "dpsptpnotifier.h"
+#include "dpsconnectnotifier.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TInt KUnknownPersonality = 0;
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsUsbNotifier* CDpsUsbNotifier::NewL(CDpsEngine* aEngine)
+	{
+	IF_DEBUG(Print(_L("CDpsUsbNotifier::NewL")));
+	CDpsUsbNotifier* self = new(ELeave) CDpsUsbNotifier(aEngine);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop();
+	return self;	
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsUsbNotifier::CDpsUsbNotifier(CDpsEngine* aEngine) :
+    CActive(EPriorityNormal), iEngine(aEngine), 
+    iPersonality(KUnknownPersonality), 
+    iConnectState(EUsbDeviceStateUndefined), iConfigured(EFalse), 
+    iConnection(CDpsEngine::ENotConnected), iRollback(EFalse)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::Ctor")));
+    CActiveScheduler::Add(this);        
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::Ctor")));
+    }  
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsUsbNotifier::~CDpsUsbNotifier()
+	{
+	IF_DEBUG(Print(_L(">>>~CDpsUsbNotifier")));
+	Cancel();
+	Rollback();
+    delete iPtpP; iPtpP = NULL;
+    delete iConnectP; iConnectP = NULL;	
+    iUsbM.Close();
+    iUsbW.Close();
+    IF_DEBUG(Print(_L("<<<~CDpsUsbNotifier")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsUsbNotifier::ConstructL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConstructL")));
+    User::LeaveIfError(iUsbM.Connect());
+    User::LeaveIfError(iUsbW.Connect());
+    iPtpP = CDpsPtpNotifier::NewL(this);
+    iConnectP = CDpsConnectNotifier::NewL(this);
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConstructL")));
+    }    
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsUsbNotifier::WaitForPrinterNotify()
+    {
+    IF_DEBUG(Print(_L("CDpsUsbNotifier::WaitForPrinterNotify")));
+    iPtpP->ChangePtpPersonality();
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+void CDpsUsbNotifier::CancelPrinterNotify()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::CancelPrinterNotify")));
+    if (CDpsEngine::ENotConnected == iConnection)
+        {
+        iPtpP->Cancel(); 
+        iConfigured = EFalse;    
+        }
+    else if (CDpsEngine::EPrinterConnected == iConnection)
+        {
+        iConnectP->Cancel();
+        }
+    // if the request is replied through RunL before the cancel
+    // iPrinterConnectRequest will be NULL and we don't need to cancel anything
+    if (iEngine->PrinterConnectRequest())
+        {
+	    User::RequestComplete(iEngine->PrinterConnectRequest(), KErrCancel);   
+        }    
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::CancelWaitForPrinterNotify")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsUsbNotifier::ConnectNotify()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConnectNotify")));
+    iConnectP->ConnectNotify();
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConnectNotify")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsUsbNotifier::Rollback()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::Rollback")));
+    // only when the personality has changed, we switch back to the previous
+    // personality
+    if (iPersonality)
+        {
+        TInt personalityId = KUsbPersonalityIdMTP;
+        iUsbM.GetCurrentPersonalityId(personalityId);
+        IF_DEBUG(Print(_L("CDpsUsbNotifier::Rollback, current personality= %d"), personalityId));
+        if(KUsbPersonalityIdPCSuiteMTP != personalityId)
+            {
+            if (!iConfigured || iRollback)
+                {
+                iUsbW.SetPreviousPersonality();
+                }
+            else
+                {
+                iUsbW.SetPreviousPersonalityOnDisconnect();
+                }
+            }
+        }
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::Rollback")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsUsbNotifier::PtpNotify(TInt aErr)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PtpNotify %x %d"), 
+        iConnectState, aErr));
+    if (aErr == KErrNone)
+        {
+        // personality changed to MTP, but cable is not connected        
+        if (iConnectState != EUsbDeviceStateUndefined)
+            {
+            if (!IsActive())
+                {
+                iEngine->Ptp().IsDpsPrinter(iStatus);
+                SetActive();    
+                }
+            }
+        else
+            {
+            iConnection = CDpsEngine::ENotConnected;
+            User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);
+            }    
+        }
+    else
+        {
+        iConnection = CDpsEngine::EWrongPrintModeConnected;
+        User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection); 
+        }
+        	
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::PtpNotify")));        
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsUsbNotifier::PersonalityChanged()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PersonalityChanged %x"), 
+                                                              iPersonality));     
+    if (iPersonality != KUsbPersonalityIdMTP)
+        {
+        iConnection = CDpsEngine::EWrongPrintModeConnected;
+        iConfigured = EFalse;
+        if (iEngine->PrinterConnectRequest())
+            {
+            User::RequestComplete(iEngine->PrinterConnectRequest(), 
+                iConnection);     
+            }
+        }
+    // when UI gets this notification, it must quit. As the result, the dps 
+    // engine will be deleted so we do not need to care the further change.
+    
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PersonalityChanged ")));     
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsUsbNotifier::RunL()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::RunL")));
+    
+    if (EPrinterAvailable == iStatus.Int())
+        {
+        iConnection = CDpsEngine::EPrinterConnected;
+        iConfigured = ETrue;	
+        iEngine->SetDpsFolder(iEngine->Ptp().PtpFolder());			            
+        }
+    else if (iStatus.Int() != KErrCancel)
+        {
+        iConnection = CDpsEngine::EOtherConnected;
+        }
+    User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);    
+        
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::RunL")));
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//       
+void CDpsUsbNotifier::DoCancel()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DoCancel")));
+    iEngine->Ptp().CancelIsDpsPrinter();
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DoCancel")));
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//       
+TInt CDpsUsbNotifier::RunError(TInt aErr)
+    {
+    IF_DEBUG(Print(_L("CDpsUsbNotifier::RunError is %d"), aErr));
+    return aErr;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CDpsUsbNotifier::DisconnectNotify(TUsbDeviceState aState)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DisconnectNotify %d"), aState));
+    if (iConfigured)
+        {
+        iConnection = CDpsEngine::EPrinterDisconnected;
+        }
+    else
+        {
+        iConnection = CDpsEngine::ENotConnected;
+        }
+    iConfigured = EFalse;
+    if (EUsbDeviceStateUndefined == aState)
+        {
+        iRollback = ETrue;
+        }
+    if (iEngine->PrinterConnectRequest())
+        {
+        User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);    
+        }
+    
+    IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::DisconnectNotify")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CDpsUsbNotifier::ConnectState()
+    {
+    IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConnectState")));    
+    TInt ret = iUsbM.GetDeviceState(iConnectState);
+	IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConnectState %x"), iConnectState));    
+	return ret;    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CDpsUsbNotifier::IsSetPrintModeIssued()
+    {
+    return (iPersonality != KUnknownPersonality);
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CDpsUsbNotifier::IsConfigured() const
+    {
+    return iConfigured;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsxmlgenerator.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2006, 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 class creates the dps xml script. 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsxmlgenerator.h"
+#include "pictbridge.h"
+#include "dpsconst.h"
+#include "dpsxmlstring.h"
+#include <e32debug.h>
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TInt KCodeSize = 4;
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsXmlGenerator* CDpsXmlGenerator::NewL(CDpsEngine* aEngine)
+    {
+    IF_DEBUG(Print(_L("CDpsXmlGenerator::NewL")));
+    CDpsXmlGenerator* self= new (ELeave) CDpsXmlGenerator(aEngine);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsXmlGenerator::~CDpsXmlGenerator()
+    {
+    IF_DEBUG(Print(_L("~CDpsXmlGenerator")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsXmlGenerator::CDpsXmlGenerator(CDpsEngine* aEngine) : 
+    iEngine(aEngine)
+    {        
+    IF_DEBUG(Print(_L("CDpsXmlGenerator::Ctor")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::CreateResultScriptL(TDpsEvent aEvent,
+		                     			  RWriteStream& aScript,
+	           		         			  const TDpsResult& aResult) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreateResultScript")));    
+    StartDocumentL(aScript);       
+    StartResultL(aScript, aResult);       
+    if (aEvent != EDpsEvtEmpty)
+        {
+        CreateEventL(aScript, aEvent);          
+        }    
+    EndResultL(aScript);    
+    EndDocumentL(aScript);    
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreateResultScript")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::CreateReplyScriptL(TDpsOperation aOperation, 
+                                         RWriteStream& aScript,
+                                         const TDpsResult& aResult,
+                                         const TDpsArg& aArg) const
+    {
+    StartDocumentL(aScript);
+    StartResultL(aScript, aResult);
+    StartOperationL(aOperation, aScript);
+    CreateArgL(aScript, aArg);
+    EndOperationL(aOperation, aScript);
+    EndResultL(aScript);
+    EndDocumentL(aScript);
+    }                                            
+                                            
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//		           		         		
+void CDpsXmlGenerator::StartDocumentL(RWriteStream& aScript) const
+	{
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StatrDocument")));
+    aScript.WriteL(KDpsXmlHeader);
+    aScript.WriteL(KDpsXmlNS);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartDocument")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlGenerator::EndDocumentL(RWriteStream& aScript) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndDocument")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(KDpsXml);
+    aScript.WriteL(KDpsXmlBraceClose);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndDocument")));		
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlGenerator::StartInputL(RWriteStream& aScript) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartInput")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlInput);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartInput")));	
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+void CDpsXmlGenerator::EndInputL(RWriteStream& aScript) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndInput")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(KDpsXmlInput);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndInput")));		
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+void CDpsXmlGenerator::StartResultL(RWriteStream& aScript, 
+								   const TDpsResult& aResult) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartResult")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlOutput);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlResult);
+    aScript.WriteL(KDpsXmlBraceClose);
+    TBuf8<KCodeSize> major;
+    major.NumUC(aResult.iMajorCode, EHex);
+    aScript.WriteL(major);
+    major.Zero();
+    major.NumFixedWidthUC(aResult.iMinorCode, EHex, KCodeSize);
+    aScript.WriteL(major);    
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(KDpsXmlResult);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartResult")));		
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlGenerator::EndResultL(RWriteStream& aScript) const
+	{
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndResult")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(KDpsXmlOutput);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndResult")));		
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::StartOperationL(TDpsOperation aOperation, 
+                                       RWriteStream& aScript, 
+									   TBool aEnd) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartOperation %d"), aOperation));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsOperationStrings[aOperation - 1]);
+    if (aEnd)
+        {
+        aScript.WriteL(KDpsXmlSlash);
+        }
+    aScript.WriteL(KDpsXmlBraceClose);	
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartOperation")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//			
+void CDpsXmlGenerator::EndOperationL(TDpsOperation aOperation, 
+                                     RWriteStream& aScript) const 
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndOperation")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(KDpsXmlSlash);
+    // there is an empty op in the op enum so we must reduce one
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsOperationStrings[aOperation - 1]);
+    aScript.WriteL(KDpsXmlBraceClose);	
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndOperation")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::CreateEventL(RWriteStream& aScript, TDpsEvent aEvent) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreatEvent")));
+    aScript.WriteL(KDpsXmlBraceOpen);
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsEventStrings[aEvent - 1]);
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(KDpsXmlBraceClose);
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreatEvent")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlGenerator::CreateArgL(RWriteStream& aScript, 
+								  const TDpsArg& aArgument, 
+					   			  TDpsAttribute aAttribute) const           
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreatArg")));
+    aScript.WriteL(KDpsXmlBraceOpen); //<
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsArgStrings[aArgument.iElement]);	
+    if (aAttribute != 0)
+        {
+        aScript.WriteL(KDpsXmlSpace); // space
+        aScript.WriteL(KDpsXmlPaperSize); // paperSize
+        aScript.WriteL(KDpsXmlEqual); // =
+        aScript.WriteL(KDpsXmlQuote); // "
+        // patch the lower four bytes zero
+        aAttribute = aAttribute << KShiftLength;
+        TBuf8<KFullWordWidth> string;
+        string.AppendNumUC(aAttribute, EHex);
+        aScript.WriteL(string); // 12345678
+        aScript.WriteL(KDpsXmlQuote); // "
+        }
+    if (!aArgument.iContent.Compare(KNullDesC8))
+        {
+        aScript.WriteL(KDpsXmlSlash); // /
+        aScript.WriteL(KDpsXmlBraceClose); // >
+        }
+    else
+        {
+        aScript.WriteL(KDpsXmlBraceClose); // >
+        aScript.WriteL(aArgument.iContent); // 123 345 567
+        aScript.WriteL(KDpsXmlBraceOpen); // <
+        aScript.WriteL(KDpsXmlSlash); // /
+        aScript.WriteL(iEngine->DpsParameters()->
+            iDpsArgStrings[aArgument.iElement]);
+        aScript.WriteL(KDpsXmlBraceClose); // >
+        }
+    aScript.WriteL(KDpsXmlSpace);	
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreatArg")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::StartElementL(TDpsElement aElement, 
+                                     RWriteStream& aScript) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartElement")));
+    aScript.WriteL(KDpsXmlBraceOpen); //<
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsElementStrings[aElement - 1]);	
+    aScript.WriteL(KDpsXmlBraceClose); // >
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartElement")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlGenerator::EndElementL(TDpsElement aElement, 
+                                   RWriteStream& aScript) const
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndElement")));
+    aScript.WriteL(KDpsXmlBraceOpen); //<
+    aScript.WriteL(KDpsXmlSlash);
+    aScript.WriteL(iEngine->DpsParameters()->
+        iDpsElementStrings[aElement - 1]);	
+    aScript.WriteL(KDpsXmlBraceClose); // >
+    aScript.WriteL(KDpsXmlSpace);
+    IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndElement")));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsxmlparser.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2006, 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 class parses the dps xml script. 
+*
+*/
+
+
+#include <e32debug.h>
+#include "dpsxmlparser.h"
+#include "dpsconst.h"
+#include "pictbridge.h"
+#include "dpsxmlstring.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#   define PRINT_DES(t)\
+ {TBuf<KMaxArgLen> _buf; _buf.Copy(t);RDebug::Print(_L("---%S"), &_buf);}
+#else
+#	define IF_DEBUG(t)
+#   define PRINT_DES(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CDpsXmlParser* CDpsXmlParser::NewL(CDpsEngine* aEngine)
+	{
+    IF_DEBUG(Print(_L("CDpsXmlParser::NewL")));
+    CDpsXmlParser* self = new (ELeave) CDpsXmlParser(aEngine);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsXmlParser::~CDpsXmlParser()
+    {
+    IF_DEBUG(Print(_L(">>>~CDpsXmlParser")));
+    iDpsArgs.Close();
+    __IF_DEBUG(Print(_L("<<<~CDpsXmlParser")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsXmlParser::CDpsXmlParser(CDpsEngine* aEngine) : iEngine(aEngine)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::Ctor")));
+	Reset();
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::Ctor")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::OnStartDocumentL(
+		const RDocumentParameters& /*aDocParam*/, TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartDocumentL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("---, error code is %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartDocumentL")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::OnEndDocumentL(TInt aErrorCode)
+	{
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndDocumentL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("---, error code is %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndDocumentL")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnStartElementL(const RTagInfo& aElement, 
+									const RAttributeArray& aAttributes, 
+									TInt aErrCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartElementL")));
+    
+    if (aErrCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("---, error code is %d"), aErrCode));
+        User::Leave(aErrCode);
+        }
+    if (aAttributes.Count() > 1)
+        {
+        IF_DEBUG(Print(_L("---cannot have more than one attribute!")));
+        User::Leave(KErrArgument);
+        }
+    	
+    // Gets the name of the tag
+    const TDesC8& name = aElement.LocalName().DesC();
+    
+    IF_DEBUG(Print(_L("---Start"))); PRINT_DES(name);
+	
+    //Checks the element
+    // this is the first layer <dps>
+    if (!name.Compare(KDpsXml))
+        {
+        iAction = EDpsXmlStart;
+        }
+    // this is the second layer	<input|output>
+    else if (!name.Compare(KDpsXmlOutput))
+        {
+        iAction = EDpsXmlOutput;
+        }
+    else if (!name.Compare(KDpsXmlInput))
+        {
+        // operation and event cannot be distiguised here
+        iAction = EDpsXmlInput;
+        }
+    // this is the third layer <operation|event|result>	
+    else if (iAction == EDpsXmlOutput && !name.Compare(KDpsXmlResult))
+        {
+        // output must be result
+        iAction = EDpsXmlResult;
+        }		
+    else if (iAction == EDpsXmlInput &&
+        (!name.Compare(iEngine->DpsParameters()->iDpsEventStrings[0]) ||
+        !name.Compare(iEngine->DpsParameters()->iDpsEventStrings[1])))
+        {
+        if (!name.Compare(iEngine->DpsParameters()->iDpsEventStrings[0]))
+            {
+            iDpsEvent = EDpsEvtNotifyJobStatus;
+            }
+        else
+            {
+            iDpsEvent = EDpsEvtNotifyDeviceStatus;	
+            }
+        iAction = EDpsXmlEvent;	
+        }
+    else if (iAction == EDpsXmlInput || iAction == EDpsXmlResult)
+        {
+        iAction = EDpsXmlOperation;
+        for (TInt i= 0; i < EDpsOpMax-1; i++) //i=0 as AppendL() method adds item on first free position in array
+            {
+            if (!name.Compare(iEngine->DpsParameters()->iDpsOperationStrings[i]))
+                {
+                IF_DEBUG(Print(_L("---found the operation")));
+                PRINT_DES(name);
+                iDpsOperation = (TDpsOperation)(i+1);// i+1 to by pass first operation EDpsOpEmpty in enum which is not added to array
+                break;
+                }
+            }
+        }
+		
+    // below is the fourth layer, e.g. the argument list/element. there
+    // could be many arugments, but only one element	
+    else if (iAction == EDpsXmlOperation || iAction == EDpsXmlEvent)
+        {
+        // only element in output is capability
+        if (!name.Compare(iEngine->DpsParameters()->iDpsElementStrings[0]))
+            {
+            IF_DEBUG(Print(_L("---the element is")));
+            PRINT_DES(name);
+            iElement = EDpsCapability;
+            }
+        else
+            {
+            for (TInt i = 0; i < EDpsArgMax; i++)
+                {
+                if (!name.Compare(iEngine->DpsParameters()->iDpsArgStrings[i]))
+                    {
+                    IF_DEBUG(Print(_L("---the argument is ")));
+                    PRINT_DES(name);	
+                    TDpsArg arg;
+                    arg.iElement = (TDpsArgument)i;
+                    arg.iContent.Copy(_L(""));
+                    iDpsArgs.AppendL(arg);
+                    break;
+                    }
+                }
+            }
+		
+        }
+    else
+        {
+        // something wrong
+        IF_DEBUG(Print(_L("--- non-PB element! %S"), &name));
+        User::Leave(KErrNotSupported);
+        }
+    if (aAttributes.Count() == 1)
+        {
+        ParseAttributesL(aAttributes, name);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartElementL")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	     
+void CDpsXmlParser::ParseAttributesL(const RAttributeArray& aAttributes, 
+                                     const TDesC8& tag)
+    {
+    // element
+    const TDesC8& name = aAttributes[0].Attribute().LocalName().DesC();
+    // only "layouts" and "paperTypes" have attributes
+    if (tag.Compare(KDpsXmlPaperTypes) && tag.Compare(KDpsXmlLayouts))
+        {
+        // error
+        IF_DEBUG(Print(_L("--- this tag have no attribute")));
+        PRINT_DES(name);
+        User::Leave(KErrArgument);
+        }
+    // the element of the attributes must be "paperSize"	
+    if (name.Compare(KDpsXmlPaperSize))
+        {
+        // error
+        IF_DEBUG(Print(_L("--- wrong attribute")))
+        PRINT_DES(name);
+        User::Leave(KErrArgument);
+        }
+    // value
+    HBufC8* value = aAttributes[0].Value().DesC().AllocLC();
+    TUint32 result;    
+    TLex8 converter(*value);
+    TInt error = converter.Val(result, EHex);
+    if (error != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- convert error %d"), error));
+        User::Leave(error);
+        }
+    iAttrib = result >> KShiftLength; 
+    CleanupStack::PopAndDestroy(value);
+    IF_DEBUG(Print(_L("--- attribte value %x"), result));
+     
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnEndElementL(const RTagInfo& aElement, 
+								  TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndElementL")));
+    
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- error code is %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+        
+    // Get the name of the tag
+    const TDesC8& name = aElement.LocalName().DesC();
+    PRINT_DES(name);
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndElementL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
+	{
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnContentL content is")));
+    PRINT_DES(aBytes);
+    
+    if (aErrorCode != KErrNone)
+   	    {
+        IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }	
+    if (aBytes[0] >= KSOH && aBytes[0] <= KSpace)
+        {
+        IF_DEBUG(Print(_L("the unprintable char %d"), aBytes[0]));
+        return; 
+        }
+    // parses the result	
+    if (iAction == EDpsXmlResult)
+        {
+        TUint32 value;
+        TLex8 converter(aBytes);
+        TInt error = converter.Val(value, EHex);
+        if (error != KErrNone)
+            {
+            IF_DEBUG(Print(_L("--- convert error %d"), error));
+            User::Leave(error);
+            }
+        IF_DEBUG(Print(_L("--- result %x"), value));
+        // we have got the result
+        iDpsResult.iMajorCode = 
+            static_cast<TDpsResultMajorCode>(value >> KShiftLength);
+        iDpsResult.iMinorCode = 
+            static_cast<TDpsResultMinorCode>(value & KDpsMinorMask);
+        }
+    // gets the argument	
+    else if (iAction == EDpsXmlOperation || iAction == EDpsXmlEvent)
+        {
+        iDpsArgs[iDpsArgs.Count() - 1].iContent.Copy(aBytes);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnContentL")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::OnStartPrefixMappingL(const RString& /*aPrefix*/, 
+										  const RString& /*aUri*/, 
+										  TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartPrefixMappingL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartPrefixMappingL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, 
+									    TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndPrefixMappingL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndPrefixMappingL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CDpsXmlParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, 
+                                           TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnIgnorableWhiteSpaceL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("---error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnIgnorableWhiteSpaceL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnSkippedEntityL(const RString& /*aName*/, 
+								     TInt aErrorCode)
+	{
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnSkippedEntityL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnSkippedEntityL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/, 
+											 const TDesC8& /*aData*/, 
+											 TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnProcessingInstructionL")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
+        User::Leave(aErrorCode);
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnProcessingInstructionL")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsXmlParser::OnError(TInt aErrorCode)
+    {
+    IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnError()")));
+    if (aErrorCode != KErrNone)
+        {
+        IF_DEBUG(Print(_L("---error code %d"), aErrorCode));
+        }
+    IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnError()")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+
+TAny* CDpsXmlParser::GetExtendedInterface(const TInt32 aUid)
+    {
+    return aUid == MDpsExtensionHandler::EInterfaceUid ?
+    static_cast<MDpsExtensionHandler*>(this) : 0;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+void CDpsXmlParser::Reset()
+    {
+    iDpsArgs.Reset();
+    iAction = EDpsXmlEmpty;
+    iDpsEvent = EDpsEvtEmpty; 
+    iDpsOperation = EDpsOpEmpty;
+    iElement = EDpsEleEmpty; 
+    iAttrib = 0;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/dpsxmlstring.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2006, 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 class implements the dps constant strings. 
+*
+*/
+
+
+#include "dpsxmlstring.h"
+#include "dpsdefs.h"
+#include "dpsconst.h"
+#include <e32debug.h>
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsXmlString* TDpsXmlString::NewL()
+    {
+    TDpsXmlString* self = new (ELeave) TDpsXmlString();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsXmlString::TDpsXmlString() 
+    {
+    iDpsOperationStrings = TDpsStrings(EDpsOpMax - 1);
+    iDpsElementStrings = TDpsStrings(KDpsEleMax - 1);
+    iDpsEventStrings = TDpsStrings(KDpsEvtMax - 1);
+    iDpsArgStrings = TDpsStrings(EDpsArgMax);
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void TDpsXmlString::ConstructL()
+    {
+    // define Print Service Operations
+    // ref: DPS spec page 14
+    for (TInt i = 1; i < EDpsOpMax; i++)
+        {
+        switch (i)
+            {
+            case EDpsOpConfigPrintService:
+                iDpsOperationStrings.AppendL(_L8("configurePrintService"));           
+            break;
+            
+            case EDpsOpGetCapability:
+                iDpsOperationStrings.AppendL(_L8("getCapability"));           
+            break;
+            
+            case EDpsOpGetJobStatus:
+                iDpsOperationStrings.AppendL(_L8("getJobStatus"));           
+            break;
+            
+            case EDpsOpGetDeviceStatus:
+                iDpsOperationStrings.AppendL(_L8("getDeviceStatus"));           
+            break;
+            
+            case EDpsOpStartJob:
+                iDpsOperationStrings.AppendL(_L8("startJob"));           
+            break;
+            
+            case EDpsOpAbortJob:
+                iDpsOperationStrings.AppendL(_L8("abortJob"));           
+            break;
+            
+    // define Storage Service Operation
+    // ref: DPS spec page 34
+            case EDpsOpContinueJob:
+                iDpsOperationStrings.AppendL(_L8("continueJob"));           
+            break;
+            
+            case EDpsOpGetFileID:
+                iDpsOperationStrings.AppendL(_L8("getFileID"));           
+            break;
+            
+            case EDpsOpGetFileInfo:
+                iDpsOperationStrings.AppendL(_L8("getFileInfo"));           
+            break;
+            
+            case EDpsOpGetFile:
+                iDpsOperationStrings.AppendL(_L8("getFile"));           
+            break;
+            
+            case EDpsOpGetPartialFile:
+                iDpsOperationStrings.AppendL(_L8("getPartialFile"));           
+            break;
+            
+            case EDpsOpGetFileList:
+                iDpsOperationStrings.AppendL(_L8("getFileList"));           
+            break;
+            
+            case EDpsOpGetThumb:
+                iDpsOperationStrings.AppendL(_L8("getThumb"));           
+            break;
+            
+            default:
+                IF_DEBUG(Print(_L("wrong in OperationString")));
+                User::Leave(KErrArgument);
+            break;                        
+            }
+        }
+        
+    // define the special element which includes other elements
+    for (TInt i = 1; i < KDpsEleMax; i++)
+        {
+        switch(i)
+            {
+            case EDpsCapability:
+                iDpsElementStrings.AppendL(_L8("capability")); 
+            break;
+            
+            case EDpsJobConfig:
+                iDpsElementStrings.AppendL(_L8("jobConfig")); 
+            break;
+            
+            case EDpsPrintInfo:
+                iDpsElementStrings.AppendL(_L8("printInfo")); 
+            break;
+                
+            default:
+                IF_DEBUG(Print(_L("wrong in ElementString")));
+                User::Leave(KErrArgument);
+            break;    
+            }
+        }
+        
+    // define Print Service Event Notification
+    // ref: DPS spec page 14
+    for (TInt i = 1; i < KDpsEvtMax; i++)
+        {
+        switch(i)
+            {
+            case EDpsEvtNotifyJobStatus:
+                iDpsEventStrings.AppendL(_L8("notifyJobStatus")); 
+            break;
+            
+            case EDpsEvtNotifyDeviceStatus:
+                iDpsEventStrings.AppendL(_L8("notifyDeviceStatus")); 
+            break;
+               
+            default:
+                IF_DEBUG(Print(_L("wrong in Event String")));
+                User::Leave(KErrArgument);
+            break;    
+            }
+        }
+     
+    for (TInt i = 0; i < EDpsArgMax; i++)
+        {
+        switch (i)
+            {
+            case EDpsArgDpsVersions:
+                iDpsArgStrings.AppendL(_L8("dpsVersions")); 
+            break;
+        
+            case EDpsArgVendorName:
+                iDpsArgStrings.AppendL(_L8("vendorName")); 
+            break;
+        
+            case EDpsArgVendorSpecificVersion:
+                iDpsArgStrings.AppendL(_L8("vendorSpecificVersion")); 
+            break;
+        
+            case EDpsArgProductName:
+                iDpsArgStrings.AppendL(_L8("productName")); 
+            break;
+        
+            case EDpsArgSerialNo:
+                iDpsArgStrings.AppendL(_L8("serialNo")); 
+            break;
+        
+            case EDpsArgPrintServiceAvailable:
+                iDpsArgStrings.AppendL(_L8("printServiceAvailable")); 
+            break;
+        
+            case EDpsArgQualities:
+                iDpsArgStrings.AppendL(_L8("qualities")); 
+            break;
+        
+            case EDpsArgPaperSizes:
+                iDpsArgStrings.AppendL(_L8("paperSizes")); 
+            break;
+        
+            case EDpsArgPaperTypes:
+                iDpsArgStrings.AppendL(_L8("paperTypes")); 
+            break;
+        
+            case EDpsArgFileTypes:
+                iDpsArgStrings.AppendL(_L8("fileTypes")); 
+            break;
+        
+            case EDpsArgDatePrints:
+                iDpsArgStrings.AppendL(_L8("datePrints")); 
+            break;
+        
+            case EDpsArgFileNamePrints:
+                iDpsArgStrings.AppendL(_L8("fileNamePrints")); 
+            break;
+        
+            case EDpsArgImageOptimizes:
+                iDpsArgStrings.AppendL(_L8("imageOptimizes")); 
+            break;
+        
+            case EDpsArgLayouts:
+                iDpsArgStrings.AppendL(_L8("layouts")); 
+            break;
+        
+            case EDpsArgFixedSizes:
+                iDpsArgStrings.AppendL(_L8("fixedSizes")); 
+            break;
+        
+            case EDpsArgChroppings:
+                iDpsArgStrings.AppendL(_L8("chroppings")); 
+            break;
+        
+            case EDpsArgPrtPID:
+                iDpsArgStrings.AppendL(_L8("prtPID")); 
+            break;
+        
+            case EDpsArgFilePath:
+                iDpsArgStrings.AppendL(_L8("filePath")); 
+            break;
+        
+            case EDpsArgCopyID:
+                iDpsArgStrings.AppendL(_L8("copyID")); 
+            break;
+        
+            case EDpsArgProgress:
+                iDpsArgStrings.AppendL(_L8("progress")); 
+            break;
+        
+            case EDpsArgImagePrinted:
+                iDpsArgStrings.AppendL(_L8("imagePrinted")); 
+            break;
+        
+            case EDpsArgDpsPrintServiceStatus:
+                iDpsArgStrings.AppendL(_L8("dpsPrintServiceStatus")); 
+            break;
+        
+            case EDpsArgJobEndReason:
+                iDpsArgStrings.AppendL(_L8("jobEndReason")); 
+            break;
+        
+            case EDpsArgErrorStatus:
+                iDpsArgStrings.AppendL(_L8("errorStatus")); 
+            break;
+        
+            case EDpsArgErrorReason:
+                iDpsArgStrings.AppendL(_L8("errorReason")); 
+            break;
+        
+            case EDpsArgDisconnectEnable:
+                iDpsArgStrings.AppendL(_L8("disconnectEnable")); 
+            break;
+        
+            case EDpsArgCapabilityChanged:
+                iDpsArgStrings.AppendL(_L8("capabilityChanged")); 
+            break;
+        
+            case EDpsArgNewJobOk:
+                iDpsArgStrings.AppendL(_L8("newJobOK")); 
+            break;
+        
+            case EDpsArgQuality:
+                iDpsArgStrings.AppendL(_L8("quality")); 
+            break;
+        
+            case EDpsArgPaperSize:
+                iDpsArgStrings.AppendL(_L8("paperSize")); 
+            break;
+        
+            case EDpsArgPaperType:
+                iDpsArgStrings.AppendL(_L8("paperType")); 
+            break;
+        
+            case EDpsArgFileType:
+                iDpsArgStrings.AppendL(_L8("fileType")); 
+            break;
+        
+            case EDpsArgDatePrint:
+                iDpsArgStrings.AppendL(_L8("datePrint")); 
+            break;
+        
+            case EDpsArgFileNamePrint:
+                iDpsArgStrings.AppendL(_L8("fileNamePrint")); 
+            break;
+        
+            case EDpsArgImageOptimize:
+                iDpsArgStrings.AppendL(_L8("imageOptimize")); 
+            break;
+        
+            case EDpsArgLayout:
+                iDpsArgStrings.AppendL(_L8("layout")); 
+            break;
+        
+            case EDpsArgFixedSize:
+                iDpsArgStrings.AppendL(_L8("fixedSize")); 
+            break;
+        
+            case EDpsArgCropping:
+                iDpsArgStrings.AppendL(_L8("cropping")); 
+            break;
+        
+            case EDpsArgCroppingArea:
+                iDpsArgStrings.AppendL(_L8("croppingArea")); 
+            break;
+        
+            case EDpsArgFileID:
+                iDpsArgStrings.AppendL(_L8("fileID")); 
+            break;
+        
+            case EDpsArgFileName:
+                iDpsArgStrings.AppendL(_L8("fileName")); 
+            break;
+        
+            case EDpsArgDate:
+                iDpsArgStrings.AppendL(_L8("date")); 
+            break;
+        
+            case EDpsArgCopies:
+                iDpsArgStrings.AppendL(_L8("copies")); 
+            break;
+        
+            case EDpsArgAbortStyle:
+                iDpsArgStrings.AppendL(_L8("abortStyle")); 
+            break;
+        
+            case EDpsArgImagesPrinted:
+                iDpsArgStrings.AppendL(_L8("imagesPrinted")); 
+            break;
+        
+            case EDpsArgBasePathID:
+                iDpsArgStrings.AppendL(_L8("basePathID")); 
+            break;
+        
+            case EDpsArgFileSize:
+                iDpsArgStrings.AppendL(_L8("fileSize")); 
+            break;
+        
+            case EDpsArgThumbFormat:
+                iDpsArgStrings.AppendL(_L8("thumbFormat")); 
+            break;
+        
+            case EDpsArgThumbSize:
+                iDpsArgStrings.AppendL(_L8("thumbSize")); 
+            break;
+ 
+            case EDpsArgBytesRead:
+                iDpsArgStrings.AppendL(_L8("bytesRead")); 
+            break;
+        
+            case EDpsArgOffset:
+                iDpsArgStrings.AppendL(_L8("offset")); 
+            break;
+        
+            case EDpsArgMaxSize:
+                iDpsArgStrings.AppendL(_L8("maxSize")); 
+            break;
+        
+            case EDpsArgParentFileID:
+                iDpsArgStrings.AppendL(_L8("parentFileID")); 
+            break;
+        
+            case EDpsArgMaxNumIDs:
+                iDpsArgStrings.AppendL(_L8("maxNumIDs")); 
+            break;
+        
+            case EDpsArgFileIDs:
+                iDpsArgStrings.AppendL(_L8("fileIDs")); 
+            break;
+        
+            case EDpsArgNumIDs:
+                iDpsArgStrings.AppendL(_L8("numIDs")); 
+            break;
+        
+            default:
+                IF_DEBUG(Print(_L("wrong in ArgString")));
+                User::Leave(KErrArgument);
+            break;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsXmlString::~TDpsXmlString()
+    {
+    iDpsArgStrings.Close();
+    iDpsElementStrings.Close();
+    iDpsEventStrings.Close();
+    iDpsOperationStrings.Close();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/pictbridgeengine/src/pictbridge.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2006, 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 class defines and implements the API for UI engine. 
+*
+*/
+
+
+#include <e32base.h>
+#include <e32debug.h>
+#include <dps.rsg>
+#include <f32file.h>
+#include <barsc.h>
+#include <barsread.h>
+#include <bautils.h>
+#include <pathinfo.h>
+
+#include "pictbridge.h"
+#include "dpsdefs.h"
+#include "dpsxmlstring.h"
+#include "dpsconst.h"
+#include "dpsstatemachine.h"
+#include "dpsscriptreceiver.h"
+#include "dpsusbnotifier.h"
+#include "dpsparam.h"
+#include "dpsscriptsender.h"
+#include "dpstransaction.h"
+#include "dpsfile.h"
+
+#ifdef _DEBUG
+#	define IF_DEBUG(t) {RDebug::t;}
+#else
+#	define IF_DEBUG(t)
+#endif
+
+const TInt KResource = 32;
+const TInt KDriver = 3;
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CDpsEngine* CDpsEngine::GetEngineL()
+    {
+    IF_DEBUG(Print(_L("CDpsEngine::GetEngineL")));
+    CDpsEngine* me;
+    me = static_cast<CDpsEngine*>(Dll::Tls());
+    if (!me)
+        {
+        CDpsEngine* self = new(ELeave) CDpsEngine();
+        
+        CleanupStack::PushL(self);
+        self->ConstructL();
+        CleanupStack::Pop();
+        User::LeaveIfError(Dll::SetTls(self));
+        return self;	
+        }
+    else
+        {
+        return me;	
+        }			    
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+EXPORT_C void CDpsEngine::Delete()
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::Delete")));
+    CDpsEngine *me; me = static_cast<CDpsEngine*>(Dll::Tls());
+    if (me)
+        {
+        delete me;
+        Dll::SetTls(NULL);
+        }
+    IF_DEBUG(Print(_L("<<<DpsEngine::Delete")));	
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+void CDpsEngine::ConstructL()	
+    {
+    IF_DEBUG(Print(_L(">>>CDpsEngine::ConstructL")));
+    iDpsParameters = TDpsXmlString::NewL();
+    User::LeaveIfError(iPtp.Connect());    
+    iDpsOperator = CDpsStateMachine::NewL(this);
+    iUsbNotifier = CDpsUsbNotifier::NewL(this);
+    IF_DEBUG(Print(_L("<<<DpsEngine::ConstructL")));		
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+CDpsEngine::~CDpsEngine()
+	{
+    IF_DEBUG(Print(_L(">>>~CDpsEngine")));
+	
+    delete iDpsOperator;
+    iDpsOperator = NULL;
+	
+    delete iUsbNotifier;
+    iUsbNotifier = NULL;
+		
+    if (iDpsOperationRequest)
+        {
+        User::RequestComplete(iDpsOperationRequest, KErrCancel);
+        }
+    if (iDpsEventRequest)
+        {
+        User::RequestComplete(iDpsEventRequest, KErrCancel);
+        }    
+    if (iPrinterConnectRequest)
+        {
+        User::RequestComplete(iPrinterConnectRequest, KErrCancel);
+        }	    
+    delete iDpsParameters;
+    iDpsParameters = NULL;
+    iPtp.Close();
+    IF_DEBUG(Print(_L("<<<~CDpsEngine")));
+	}
+	
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CDpsEngine::SetPrintMode(TRequestStatus& aStatus)
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::SearchPrinter")));
+    
+    iPrinterConnectRequest = &aStatus;
+    *iPrinterConnectRequest = KRequestPending;		
+    iUsbNotifier->WaitForPrinterNotify();
+    IF_DEBUG(Print(_L("<<<DpsEngine::SearchPrinter")));
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+EXPORT_C void CDpsEngine::CancelPrintMode()
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::CancelSearchPrinter")));
+    iUsbNotifier->CancelPrinterNotify();				
+    IF_DEBUG(Print(_L("<<<DpsEngine::CancelSearchPrinter")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CDpsEngine::ConnectStateNotify(TRequestStatus& aStatus)
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::ConnectStateNotifyL")));
+    // SetPrintMode must be finished
+    if (!iUsbNotifier->IsSetPrintModeIssued())
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete(status, KErrNotReady);
+        return;
+        }
+    
+    iPrinterConnectRequest = &aStatus;
+    *iPrinterConnectRequest = KRequestPending;		
+    iUsbNotifier->ConnectNotify();
+    IF_DEBUG(Print(_L("<<<DpsEngine::ConnecStatetNotifyL")));
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+EXPORT_C void CDpsEngine::DoDpsRequestL(TMDpsOperation* aRequest, 
+                                       TRequestStatus& aStatus)
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::DoDpsRequestL")));
+    // the ptp printer must be connected and registered for the dps event
+    if (!iUsbNotifier->IsConfigured() || !iDpsEventRequest)
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete(status, KErrNotReady);
+        return;
+        }
+        
+    // there is a request from the host received and the reply has been
+    // sending out, but the host has not received it yet. we can not send
+    // the device request now
+    IF_DEBUG(Print(_L("curState is %x, idleState is %x"), 
+        iDpsOperator->CurState(), iDpsOperator->IdleState()));    
+    if (iDpsOperator->CurState() != iDpsOperator->IdleState())
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete(status, KErrInUse);        
+        return;
+        }
+    
+    iDpsOperator->StartTransactionL(aRequest);
+    iDpsOperationRequest = &aStatus;
+    *iDpsOperationRequest = KRequestPending;    
+    IF_DEBUG(Print(_L("<<<DpsEngine::DoDpsRequestL")));           
+	}
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//	
+EXPORT_C void CDpsEngine::CancelDpsRequest()
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::CancelDpsOperation")));
+    if (iDpsOperationRequest)
+        {
+        iDpsOperator->ScriptSender()->Cancel();
+        User::RequestComplete(iDpsOperationRequest, KErrCancel);
+        }
+    iDpsOperator->Initialize();
+    IF_DEBUG(Print(_L("<<<DpsEngine::CancelDpsOperation")));
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C void CDpsEngine::DpsEventNotify(TDpsEvents& aParam,
+                                         TRequestStatus& aStatus)
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::DpsEventNotify")));
+    // the PTP printer must be connected and registered for the disconnect
+    if (!iUsbNotifier->IsConfigured() || !iPrinterConnectRequest)
+        {
+        TRequestStatus* status = &aStatus;
+        User::RequestComplete(status, KErrNotReady);
+        return;
+        }
+    
+    iOutEvent = &aParam;
+    iDpsEventRequest = &aStatus;
+    *iDpsEventRequest = KRequestPending;
+    iDpsOperator->ScriptReceiver()->WaitForReceive();
+    IF_DEBUG(Print(_L("<<<DpsEngine::DpsEventNotify")));
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//       
+EXPORT_C void CDpsEngine::CancelDpsEventNotify()
+    {
+    IF_DEBUG(Print(_L("DpsEngine::CancelDpsEventNotify")));
+    if (iDpsEventRequest)
+        {
+        User::RequestComplete(iDpsEventRequest, KErrCancel);
+        iDpsOperator->ScriptReceiver()->Cancel();
+        }  
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//     
+EXPORT_C void CDpsEngine::GetDpsConfigL(TDpsConfigPrintReq& aConfig)
+    {
+    IF_DEBUG(Print(_L(">>>DpsEngine::GetDpsConfigL")));
+
+    RFs fs = iDpsOperator->Trader()->FileHandle()->FileSession();
+    RResourceFile resource;
+    
+    TBuf<KResource> resourceFile(PathInfo::RomRootPath());
+    TBuf<KResource> length(KDpsResource);    
+    resourceFile.SetLength(KDriver + length.Length());
+    resourceFile.Replace(KDriver, length.Length(), KDpsResource);
+    IF_DEBUG(Print(_L("file is %S"), &resourceFile));
+    resource.OpenL(fs, resourceFile);
+    CleanupClosePushL(resource);
+    resource.ConfirmSignatureL(KDpsResourceVersion);
+    HBufC8* id = resource.AllocReadLC(DPS_CONFIG);
+    TResourceReader reader;
+    reader.SetBuffer(id);
+    TInt count = static_cast<TInt>(reader.ReadUint8());
+    for (TInt i = 0; i < count; i++)
+        {
+        TDpsVersion version;
+        version.iMajor = static_cast<TInt>(reader.ReadUint8());
+        version.iMinor = static_cast<TInt>(reader.ReadUint8());
+        aConfig.iDpsVersions.AppendL(version); 
+        }
+    TPtrC vendorString = reader.ReadTPtrC(); 
+    aConfig.iVendorName.Copy(vendorString);
+    TDpsVersion vendorVersion;
+    vendorVersion.iMajor = static_cast<TInt>(reader.ReadUint8());
+    vendorVersion.iMinor = static_cast<TInt>(reader.ReadUint8());
+    aConfig.iVendorVersion = vendorVersion;
+    TPtrC productString = reader.ReadTPtrC();
+    aConfig.iProductName.Copy(productString);
+    TPtrC SerialNo = reader.ReadTPtrC();
+    aConfig.iSerialNo.Copy(SerialNo);
+    CleanupStack::PopAndDestroy(id); 
+    CleanupStack::PopAndDestroy(&resource);
+    IF_DEBUG(Print(_L("<<<DpsEngine::GetDpsConfigL")));
+    }
+   
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CDpsEngine::DpsFolder() const
+    {
+    return iDpsFolder;
+    }
+           
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TDpsEvents* CDpsEngine::Event() const
+    {
+    return iOutEvent;
+    }
+ 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//         
+RPtp& CDpsEngine::Ptp()
+    {
+    return iPtp;
+    }
+  
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//         
+TDpsXmlString* CDpsEngine::DpsParameters() const
+    {
+    return iDpsParameters;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+TRequestStatus*& CDpsEngine::EventRequest()
+    {
+    return iDpsEventRequest;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//            
+TRequestStatus*& CDpsEngine::OperationRequest()
+    {
+    return iDpsOperationRequest;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//                
+TRequestStatus*& CDpsEngine::PrinterConnectRequest()
+    {
+    return iPrinterConnectRequest;
+    }
+    
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//               
+void CDpsEngine::SetDpsFolder(const TDesC& aFolder)
+    {
+    iDpsFolder.Copy(aFolder);
+    }
+
--- a/usbclasses/usbbasicpersonality/src/10274797.rss	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbbasicpersonality/src/10274797.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -76,6 +76,15 @@
 					default_data = "80000006"; //
 					opaque_data = " ";
 					}
+				,
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0xA000EA04;
+					version_no = 1;
+					display_name = "RNDIS";
+					default_data = "80000008";
+					opaque_data = " ";
+					}
 				};
 			}
 		};
--- a/usbclasses/usbbasicpersonality/src/UsbActiveBasicHandlerImp.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbbasicpersonality/src/UsbActiveBasicHandlerImp.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -33,6 +33,7 @@
 	,IMPLEMENTATION_PROXY_ENTRY(0x10282C70, CUsbActiveBasicHandler::NewL)
     ,IMPLEMENTATION_PROXY_ENTRY(0x2000B5D2, CUsbActiveBasicHandler::NewL) // PCS+MTP
     ,IMPLEMENTATION_PROXY_ENTRY(0x20029E41, CUsbActiveBasicHandler::NewL) // PhoneAsModem
+    ,IMPLEMENTATION_PROXY_ENTRY(0xA000EA04, CUsbActiveBasicHandler::NewL) // RNDIS
     };
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bmarm/UsbBasicPersonalityTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bwins/UsbBasicPersonalityTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/conf/UsbBasicPersonalityTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* 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:
+*
+*/
+
+[StifSettings]
+CapsModifier= UsbBasicPersonalityTest.exe
+[EndStifSettings]
+
+// UsbBasicPersonalityTest Module - total 12 tc
+
+// UsbBasicPersonalityTest Api Tests (12 tc)
+
+[Test]
+title Create And Delete Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest CreateAndDeleteTest
+delete tester
+[Endtest] 
+
+[Test]
+title Is Active Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest IsActiveTest
+delete tester
+[Endtest] 
+
+[Test]
+title Is Added Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest IsAddedTest
+delete tester
+[Endtest] 
+
+[Test]
+title Priority Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest PriorityTest
+delete tester
+[Endtest] 
+
+[Test]
+title Prepare Personality Start Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest PreparePersonalityStartTest
+delete tester
+[Endtest] 
+
+[Test]
+title Confirm Personality Unload Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest ConfirmPersonalityUnloadTest
+delete tester
+[Endtest] 
+
+[Test]
+title State Change Notify Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest StateChangeNotifyTest
+delete tester
+[Endtest] 
+
+[Test]
+title Finish Personality Start Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest FinishPersonalityStartTest
+delete tester
+[Endtest] 
+
+[Test]
+title Finish Personality Stop Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest FinishPersonalityStopTest
+delete tester
+[Endtest] 
+
+[Test]
+title Prepare Personality Stop Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest PreparePersonalityStopTest
+delete tester
+[Endtest] 
+
+[Test]
+title Set Priority Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest SetPriorityTest
+delete tester
+[Endtest] 
+
+[Test]
+title Show Usb Connection Note Test
+create UsbBasicPersonalityTest tester
+tester ExecuteApiTest ShowUsbConnectionNoteTest
+delete tester
+[Endtest] 
+
+
+// Add new api tests here
+// ...
+
+
+// UsbBasicPersonalityTest Module Tests (... tc)
+
+
+// Add new module tests here
+// ...
+
+
+// UsbBasicPersonalityTest Branch Tests (... tc)
+
+
+// Add new branch tests here
+// ...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/eabi/UsbBasicPersonalityTestu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbBasicPersonalityTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+
+DEFFILE         UsbBasicPersonalityTest.def
+
+
+USERINCLUDE	../inc	
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	../../../inc
+
+
+SOURCEPATH      ../src
+SOURCE          UsbBasicPersonalityTest.cpp
+SOURCE          UsbBasicPersonalityTestBlocks.cpp UsbBasicPersonalityTest_exe.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY		ecom.lib
+LIBRARY		usbman.lib
+LIBRARY		usbpersonality.lib
+
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,63 @@
+;
+; 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:
+;
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 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\UsbBasicPersonalityTest.dll"-"c:\Sys\Bin\UsbBasicPersonalityTest.dll"
+"\epoc32\release\armv5\udeb\UsbBasicPersonalityTest.exe"-"c:\Sys\Bin\UsbBasicPersonalityTest.exe"
+
+"..\init\UsbBasicPersonalityTest_ats.ini"-"e:\testing\init\UsbBasicPersonalityTest.ini"
+"..\conf\UsbBasicPersonalityTest.cfg"-"e:\testing\conf\UsbBasicPersonalityTest.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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_exe.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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:
+*
+*/
+
+
+#if defined(__S60_)
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbBasicPersonalityTest.exe
+TARGETTYPE      exe
+
+CAPABILITY      LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+
+UID		0 0xEF4892C6
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          UsbBasicPersonalityTest_exe.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,63 @@
+;
+; 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:
+;
+
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x1028315F], 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\UsbBasicPersonalityTest.dll"-"c:\Sys\Bin\UsbBasicPersonalityTest.dll"
+"\epoc32\release\armv5\urel\UsbBasicPersonalityTest.exe"-"c:\Sys\Bin\UsbBasicPersonalityTest.exe"
+
+"..\init\UsbBasicPersonalityTest_phone.ini"-"c:\testframework\testframework.ini"
+"..\conf\UsbBasicPersonalityTest.cfg"-"c:\testframework\UsbBasicPersonalityTest.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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+UsbBasicPersonalityTest.mmp
+UsbBasicPersonalityTest_exe.mmp
+
+PRJ_MMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,22 @@
+@rem
+@rem Copyright (c) 2010 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
+
+call sbs -c armv5.test
+call sbs freeze
+call sbs -c armv5.test
+
+call makesis UsbBasicPersonalityTest_ats.pkg
+call signsis UsbBasicPersonalityTest_ats.sis UsbBasicPersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,22 @@
+@rem
+@rem Copyright (c) 2010 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
+
+call sbs -c armv5.test
+call sbs freeze
+call sbs -c armv5.test
+
+call makesis UsbBasicPersonalityTest_phone.pkg
+call signsis UsbBasicPersonalityTest_phone.sis UsbBasicPersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/inc/UsbBasicPersonalityTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,231 @@
+/*
+* 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 USBBASICPERSONALITYTEST_H
+#define USBBASICPERSONALITYTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>             
+#include <TestclassAssert.h>
+#include <cusbpersonalityplugin.h>
+#include "TUsbPersonalityParams.h"
+
+class RUsb;
+class CUsbPersonalityNotifier;
+
+
+// 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( KUsbBasicPersonalityTestLogPath, "\\logs\\testframework\\UsbBasicPersonalityTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+_LIT( KUsbBasicPersonalityTestLogPath, "e:\\testing\\stiflogs\\" ); 
+
+// Log file
+_LIT( KUsbBasicPersonalityTestLogFile, "UsbBasicPersonalityTest.txt" ); 
+_LIT( KUsbBasicPersonalityTestLogFileWithTitle, "UsbBasicPersonalityTest_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CUsbBasicPersonalityTest;
+
+// DATA TYPES
+//enum ?declaration
+
+enum TUsbBasicPersonalityTestResult
+    {
+    ETestCasePassed,
+    ETestCaseFailed
+    };
+
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CUsbBasicPersonalityTest test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CUsbBasicPersonalityTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CUsbBasicPersonalityTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUsbBasicPersonalityTest();
+
+    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.
+        */
+        CUsbBasicPersonalityTest( 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 ExecuteApiTest( CStifItemParser& aItem );
+        virtual TInt ExecuteModuleTest( CStifItemParser& aItem );
+        virtual TInt ExecuteBranchTest( CStifItemParser& aItem );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+	void DoExecuteApiTestL( TPtrC aApiTestName, TUsbBasicPersonalityTestResult& aTestResult );
+	void ExampleApiTestL( TUsbBasicPersonalityTestResult& aTestResult );
+	
+	void DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbBasicPersonalityTestResult& aTestResult );
+	void ExampleModuleTestL( TUsbBasicPersonalityTestResult& aTestResult );
+
+	void DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbBasicPersonalityTestResult& aTestResult );
+	void ExampleBranchTestL( TUsbBasicPersonalityTestResult& aTestResult );	
+
+    TInt CreateAndDeleteTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt StateChangeNotifyTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt IsActiveTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt IsAddedTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt PriorityTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt ConfirmPersonalityUnloadTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt PreparePersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt ShowUsbConnectionNoteTest( TUsbBasicPersonalityTestResult& aTestResult ); //TODO Check
+    TInt FinishPersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt FinishPersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt PreparePersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult );
+    TInt SetPriorityTest( TUsbBasicPersonalityTestResult& aTestResult );
+
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+		CActiveScheduler* iScheduler;
+		TRequestStatus iStatus;
+		
+		RUsb iUsb;
+		CUsbPersonalityNotifier *iNotifier;
+		TUsbPersonalityParams *iParams;
+		CUsbPersonalityPlugin *iPlugin;
+		
+        // 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;
+
+    };
+
+#endif      // USBBASICPERSONALITYTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_ats.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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:
+#
+#
+
+#
+# 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= UsbBasicPersonalityTest_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= UsbBasicPersonalityTestUsbBasicPersonalityTestUsbBasicPersonalityTest
+# 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\UsbBasicPersonalityTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbBasicPersonalityTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbBasicPersonalityTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbBasicPersonalityTest 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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_phone.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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:
+#
+#
+
+#
+# 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\UsbBasicPersonalityTest\
+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= UsbBasicPersonalityTestUsbBasicPersonalityTestUsbBasicPersonalityTest
+# 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\UsbBasicPersonalityTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbBasicPersonalityTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbBasicPersonalityTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbBasicPersonalityTest 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/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,213 @@
+/*
+* 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:
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>            
+#include "UsbBasicPersonalityTest.h"
+#include <SettingServerClient.h>
+#include <ecom/ecom.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 ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::CUsbBasicPersonalityTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbBasicPersonalityTest::CUsbBasicPersonalityTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::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(KUsbBasicPersonalityTestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KUsbBasicPersonalityTestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KUsbBasicPersonalityTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+
+    if (!CActiveScheduler::Current())
+    {
+    	iScheduler = new ( ELeave ) CActiveScheduler();
+    	CActiveScheduler::Install( iScheduler );
+    }
+
+	iNotifier = CUsbPersonalityNotifier::NewL();
+	iParams = new ( ELeave )TUsbPersonalityParams( iUsb, *iNotifier );
+    iPlugin = CUsbPersonalityPlugin::NewL( *iParams, TUid::Uid(0x102068DF) );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbBasicPersonalityTest* CUsbBasicPersonalityTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CUsbBasicPersonalityTest* self = new (ELeave) CUsbBasicPersonalityTest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CUsbBasicPersonalityTest::~CUsbBasicPersonalityTest()
+    { 
+    // Delete resources allocated from test methods
+    Delete();
+    
+    // Delete logger
+    delete iLog; 
+    iLog = NULL;
+    }
+
+//-----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::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("UsbBasicPersonalityTest.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* ) CUsbBasicPersonalityTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,646 @@
+/*
+* 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:
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>                                           
+#include <Stiftestinterface.h>
+#include "UsbBasicPersonalityTest.h"
+#include <usbpersonalityids.h>
+
+#include <ecom/ecom.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 ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::Delete() 
+    {
+    iUsb.Close();	
+    
+    delete iScheduler;
+	iScheduler = NULL; 
+	
+	delete iPlugin;
+	iPlugin = NULL;
+	REComSession::FinalClose();	
+	
+	delete iNotifier;
+	iNotifier = NULL;	
+	
+	delete iParams;
+	iParams = NULL;	
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+		ENTRY( "ExecuteApiTest", CUsbBasicPersonalityTest::ExecuteApiTest ),
+        ENTRY( "ExecuteModuleTest", CUsbBasicPersonalityTest::ExecuteModuleTest ),
+        ENTRY( "ExecuteBranchTest", CUsbBasicPersonalityTest::ExecuteBranchTest ),
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ExecuteApiTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::ExecuteApiTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteApiTest" );
+	
+	TInt res;
+    TUsbBasicPersonalityTestResult testResult;
+    TPtrC apiTestName( KNullDesC );
+	
+	res = aItem.GetString( _L( "ExecuteApiTest" ), apiTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+		
+	TRAP( res, DoExecuteApiTestL( apiTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteApiTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteApiTest" );
+    return KErrNone;
+    }
+	
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::DoExecuteApiTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::DoExecuteApiTestL( TPtrC aApiTestName, TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteApiTestL" );
+    if ( !aApiTestName.Compare( _L( "ExampleApiTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        ExampleApiTestL( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "CreateAndDeleteTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: CreateAndDeleteTest" );
+        CreateAndDeleteTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "IsActiveTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: IsActiveTest" );
+        IsActiveTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "IsAddedTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: IsAddedTest" );
+        IsAddedTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "PriorityTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: PriorityTest" );
+        PriorityTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "PreparePersonalityStartTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: PreparePersonalityStartTest" );
+        PreparePersonalityStartTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "ConfirmPersonalityUnloadTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: ConfirmPersonalityUnloadTest" );
+        ConfirmPersonalityUnloadTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "StateChangeNotifyTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: StateChangeNotifyTest" );
+        StateChangeNotifyTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "FinishPersonalityStartTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: FinishPersonalityStartTest" );
+        FinishPersonalityStartTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "FinishPersonalityStopTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: FinishPersonalityStopTest" );
+        FinishPersonalityStopTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "PreparePersonalityStopTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: PreparePersonalityStopTest" );
+        PreparePersonalityStopTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "SetPriorityTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: SetPriorityTest" );
+        SetPriorityTest ( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "ShowUsbConnectionNoteTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: ShowUsbConnectionNoteTest" );
+        ShowUsbConnectionNoteTest ( aTestResult );
+        }
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteApiTestL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::ExampleApiTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::ExampleApiTestL( TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleApiTestL" );
+	
+    aTestResult = ETestCasePassed;
+	
+	STIF_LOG( "[STIF_LOG] <<<ExampleApiTestL" );
+    }
+	
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ExecuteModuleTest
+// -----------------------------------------------------------------------------	
+//
+TInt CUsbBasicPersonalityTest::ExecuteModuleTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteModuleTest" );
+	
+    TInt res;
+    TUsbBasicPersonalityTestResult testResult;
+    TPtrC moduleTestName( KNullDesC );
+
+    res = aItem.GetString( _L( "ExecuteModuleTest" ), moduleTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+
+    TRAP( res, DoExecuteModuleTestL( moduleTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteModuleTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteModuleTest" );
+    return KErrNone;
+    }	
+	
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::DoExecuteModuleTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteModuleTestL" );
+    if ( !aModuleTestName.Compare( _L( "ExampleModuleTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Module test type: ExampleModuleTest" );
+        ExampleModuleTestL( aTestResult );
+        }
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Module test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteModuleTestL" );
+    }
+	
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::ExampleModuleTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::ExampleModuleTestL( TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleModuleTestL" );
+	
+    aTestResult = ETestCasePassed;
+	
+	STIF_LOG( "[STIF_LOG] <<<ExampleModuleTestL" );
+    }
+	
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ExecuteBranchTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::ExecuteBranchTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteBranchTest" );
+	
+    TInt res;
+    TUsbBasicPersonalityTestResult testResult;
+    TPtrC branchTestName( KNullDesC );
+
+    res = aItem.GetString( _L( "ExecuteBranchTest" ), branchTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+
+    TRAP( res, DoExecuteBranchTestL( branchTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteBranchTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteBranchTest" );
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::DoExecuteBranchTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteBranchTestL" );
+    if ( !aBranchTestName.Compare( _L( "ExampleBranchTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Branch test type: ExampleBranchTest" );
+        ExampleBranchTestL( aTestResult );
+        }
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Branch test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteBranchTestL" );
+    }
+	
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::ExampleBranchTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbBasicPersonalityTest::ExampleBranchTestL( TUsbBasicPersonalityTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleBranchTestL" );
+	
+    aTestResult = ETestCasePassed;
+    
+	STIF_LOG( "[STIF_LOG] <<<ExampleBranchTestL" );
+	}
+
+// -----------------------------------------------------------------------------
+// CusbBasicPersonalityApiTest::CreateAndDeleteTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::CreateAndDeleteTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("CreateAndDeleteTest: Started");
+	
+	//PC Suite
+	CUsbPersonalityPlugin* plugin1 = CUsbPersonalityPlugin::NewL( *iParams, TUid::Uid(0x102068DF) );
+	CleanupStack::PushL( plugin1 );
+	
+	//Media Transfer
+	CUsbPersonalityPlugin* plugin3 = CUsbPersonalityPlugin::NewL( *iParams, TUid::Uid(0x10282C70) );
+	CleanupStack::PushL( plugin3 );
+	
+	//PC Suite
+	CUsbPersonalityPlugin* plugin4 = CUsbPersonalityPlugin::NewL( *iParams, TUid::Uid(0x2000B5D2) );
+	CleanupStack::PushL( plugin4 );
+	
+	CleanupStack::PopAndDestroy( 3 );
+
+    aTestResult = ETestCasePassed;
+    
+    STIF_LOG("CreateAndDeleteTest: End ");
+    
+	return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ShowUsbConnectionNoteTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::ShowUsbConnectionNoteTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+		STIF_LOG("ShowUsbConnectionNoteTest: Started");
+		
+		iPlugin->ShowUsbConnectionNote();
+		
+	    aTestResult = ETestCasePassed;
+
+	    STIF_LOG("ShowUsbConnectionNoteTest: End ");
+	    
+	    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::SetPriorityTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::SetPriorityTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("SetPriorityTest:> Started");
+	
+	TRequestStatus status;	
+
+	iPlugin->SetPriority( CActive::EPriorityStandard );
+	
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("SetPriorityTest:> End ");
+    
+    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::PreparePersonalityStopTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::PreparePersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("PreparePersonalityStopTest:> Started");
+	
+	TRequestStatus status;	
+
+	iPlugin->PreparePersonalityStop( status );
+	User::WaitForRequest( iStatus );
+	
+	REComSession::FinalClose();
+	
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("PreparePersonalityStopTest:> End ");
+    
+    return KErrNone;	
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::FinishPersonalityStopTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::FinishPersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("FinishPersonalityStopTest:> Started");
+	
+	TRequestStatus status;	
+
+	iPlugin->FinishPersonalityStop( status );
+	User::WaitForRequest( iStatus );
+	
+	REComSession::FinalClose();
+	
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("FinishPersonalityStopTets:> End ");
+    
+    return KErrNone;	
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::FinishPersonalityStartTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::FinishPersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("FinishPersonalityStartTest:> Started");
+	
+	TRequestStatus status;	
+
+	iPlugin->FinishPersonalityStart( status );
+	User::WaitForRequest( iStatus );
+	
+	REComSession::FinalClose();
+	
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("FinishPersonalityStartTest:> End ");
+    
+    return KErrNone;
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::ConfirmPersonalityUnloadTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::ConfirmPersonalityUnloadTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+		STIF_LOG("ConfirmPersonalityUnloadTest: Started");
+		
+		iPlugin->ConfirmPersonalityUnload( iStatus );
+		User::WaitForRequest( iStatus );
+	
+		REComSession::FinalClose();
+		
+	    aTestResult = ETestCasePassed;
+
+	    STIF_LOG("ConfirmPersonalityUnloadTest: End ");
+	    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::PreparePersonalityStartTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::PreparePersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+		STIF_LOG("PreparePersonalityStartTest: Started");
+		
+		iPlugin->PreparePersonalityStart( iStatus );
+		User::WaitForRequest( iStatus );
+		
+		REComSession::FinalClose();
+		
+	    aTestResult = ETestCasePassed;
+
+	    STIF_LOG("PreparePersonalityStartTest: End ");
+	    
+	    return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::StateChangeNotifyTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::StateChangeNotifyTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("StateChangeNotifyTest:> Started");
+	
+	TUsbDeviceState state = EUsbDeviceStateDefault;
+	iPlugin->StateChangeNotify( state );
+	
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("StateChangeNotifyTest:> End ");
+    return KErrNone;	
+	
+	}
+
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::IsActiveTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::IsActiveTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("IsActiveTest:> Started");
+	
+	_LIT(KIsActive,"IsActiveTest:> Is Active? %d");
+	iLog->Log(KIsActive, iPlugin->IsActive() );
+		
+    aTestResult = ETestCasePassed;
+
+    STIF_LOG("IsActiveTest:> End ");
+    
+    return KErrNone;	
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::IsAddedTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::IsAddedTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("IsAddedTest:> Started");
+
+	_LIT(KIsActive,"IsAddedTest:> Is Added? %d");
+	iLog->Log(KIsActive, iPlugin->IsAdded() );
+
+	aTestResult = ETestCasePassed;
+		
+    STIF_LOG("IsAddedTest:> End ");
+    
+    return KErrNone;
+	
+	}
+
+// -----------------------------------------------------------------------------
+// CUsbBasicPersonalityTest::PriorityTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbBasicPersonalityTest::PriorityTest( TUsbBasicPersonalityTestResult& aTestResult )
+	{
+	STIF_LOG("PriorityTest:> Started");
+
+	iPlugin->SetPriority( CActive::EPriorityLow );
+	TInt priority;
+	priority = iPlugin->Priority();	
+	
+	priority == CActive::EPriorityLow ?
+			aTestResult = ETestCasePassed :
+			aTestResult = ETestCaseFailed;
+
+    STIF_LOG("PriorityTest:> End ");
+    
+    return KErrNone;
+	
+	}
+	
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest_exe.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* 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:
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>                  
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // UsbBasicPersonalityTest_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- a/usbclasses/usbmscpersonality/group/UsbMscPersonality.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbmscpersonality/group/UsbMscPersonality.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -41,6 +41,11 @@
 target usbmscpersonality.rsc
 end
 
+start resource usbms.rss
+targetpath /private/10204bbb
+header
+end
+
 LIBRARY euser.lib
 LIBRARY usbpersonality.lib
 LIBRARY usbman.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/src/usbms.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* 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
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bmarm/UsbMscPersonalityTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bwins/UsbMscPersonalityTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/conf/UsbMscPersonalityTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* 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:
+*
+*/
+
+[StifSettings]
+CapsModifier = UsbMscPersonalityTest.exe
+[EndStifSettings]
+
+// UsbMscPersonalityTest Module - total 13 tc
+
+
+// UsbHidClassDriverTest Api Tests (8 tc)
+
+[Test]
+title Initialization Test
+create UsbMscPersonalityTest tester
+tester InitializationTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Prepare Personality Start
+create UsbMscPersonalityTest tester
+tester PreparePersonalityStartTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Finish Personality Start
+create UsbMscPersonalityTest tester
+tester FinishPersonalityStartTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Prepare Personality Stop
+create UsbMscPersonalityTest tester
+tester PreparePersonalityStopTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Finish Personality Stop
+create UsbMscPersonalityTest tester
+tester FinishPersonalityStopTestL API
+delete tester
+[Endtest]
+
+[Test]
+title State Change Notify
+create UsbMscPersonalityTest tester
+tester StateChangeNotifyTestL API
+delete tester
+[Endtest]
+
+[Test]
+title State Change Notify Undefined
+create UsbMscPersonalityTest tester
+tester StateChangeNotifyUndefinedTestL API
+delete tester
+[Endtest]
+
+[Test]
+title State Change Notify State Address
+create UsbMscPersonalityTest tester
+tester StateChangeNotifyStateAddressTestL API
+delete tester
+[Endtest]
+
+// UsbHidClassDriverTest Module Tests (5 tc)
+// Add new module tests here
+// ...
+
+[Test]
+title Confirm Personality Unload
+create UsbMscPersonalityTest tester
+tester ConfirmPersonalityUnloadTestL MODULE
+delete tester
+[Endtest]
+
+[Test]
+title Allow Dismount 2 sec
+create UsbMscPersonalityTest tester
+tester AllowDismountAfter2SecTestL MODULE
+delete tester
+[Endtest]
+
+[Test]
+title Allow Dismount
+create UsbMscPersonalityTest tester
+tester AllowDismountTestL MODULE
+delete tester
+[Endtest]
+
+[Test]
+title Not Allow Dismount
+create UsbMscPersonalityTest tester
+tester NotAllowDismountTestL MODULE
+delete tester
+[Endtest]
+
+[Test]
+title Allow Dismount Late
+create UsbMscPersonalityTest tester
+tester AllowDismountTooLateTestL MODULE
+delete tester
+[Endtest]
+// Add new module tests here
+// ...
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/eabi/UsbMscPersonalityTestu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,7 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI15CDismountClient @ 2 NONAME
+	_ZTI34CUsbMscPersonalityTestActiveObject @ 3 NONAME
+	_ZTV15CDismountClient @ 4 NONAME
+	_ZTV34CUsbMscPersonalityTestActiveObject @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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:
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbMscPersonalityTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY  LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+
+DEFFILE         UsbMscPersonalityTest.def
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE		../inc 
+
+SOURCEPATH      ../src
+SOURCE          UsbMscPersonalityTest.cpp
+SOURCE          UsbMscPersonalityTestBlocks.cpp DismountClient.cpp UsbMscPersonalityTestActiveObject.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			ecom.lib
+LIBRARY			usbman.lib
+LIBRARY			usbpersonality.lib
+LIBRARY         platformver.lib
+LIBRARY         efsrv.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+;
+; 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:
+;
+
+; 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/UsbMscPersonalityTest.dll"-"c:/Sys/Bin/UsbMscPersonalityTest.dll"
+"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.exe"-"c:/Sys/Bin/UsbMscPersonalityTest.exe"
+
+"../init/UsbMscPersonalityTest_ats.ini"-"e:/testing/init/UsbMscPersonalityTest.ini"
+"../conf/UsbMscPersonalityTest.cfg"-"e:/testing/conf/UsbMscPersonalityTest.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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_exe.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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:
+*
+*/
+
+#if defined(__S60_)
+        // To get the OS_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbMscPersonalityTest.exe
+TARGETTYPE      exe
+UID		0 	0xEF4892C6
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY      LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+MW_LAYER_SYSTEMINCLUDE
+SOURCEPATH      ../src
+
+
+SOURCE          UsbMscPersonalityTest_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,63 @@
+;
+; 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:
+;
+
+; 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/UsbMscPersonalityTest.dll"-"c:/Sys/Bin/UsbMscPersonalityTest.dll"
+"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.exe"-"c:/Sys/Bin/UsbMscPersonalityTest.exe"
+
+"../init/UsbMscPersonalityTest_phone.ini"-"c:/testframework/testframework.ini"
+"../conf/UsbMscPersonalityTest.cfg"-"c:/testframework/UsbMscPersonalityTest.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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+UsbMscPersonalityTest.mmp
+UsbMscPersonalityTest_exe.mmp
+
+PRJ_MMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,20 @@
+@rem
+@rem Copyright (c) 2010 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
+
+
+call sbs -c armv5.test
+call makesis UsbMscPersonalityTest_ats.pkg
+call signsis UsbMscPersonalityTest_ats.sis UsbMscPersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,21 @@
+@rem
+@rem Copyright (c) 2010 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
+
+call sbs -c armv5.test
+call sbs freeze
+call sbs -c armv5.test
+call makesis UsbMscPersonalityTest_phone.pkg
+call signsis UsbMscPersonalityTest_phone.sis UsbMscPersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/DismountClient.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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 DISMOUNTCLIENT_H
+#define DISMOUNTCLIENT_H
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+#include <StifLogger.h>
+#include <f32file.h>
+
+enum TAllowDismountOption
+{
+    EAllowDismount,
+    EAllowDismountAfter2Sec,
+    EAllowDismountTooLate,
+    ENotAllowDismount
+};
+
+class CDismountClient : public CActive
+    {
+public:
+    // Cancel and destroy
+    ~CDismountClient();
+
+    // Two-phased constructor.
+    static CDismountClient* NewL(CStifLogger *aLog);
+
+    // Two-phased constructor.
+    static CDismountClient* NewLC(CStifLogger *aLog);
+
+public:
+    // New functions
+    // Function for making the initial request
+    void StartL(TAllowDismountOption aAllowDismountOption);
+
+private:
+    // C++ constructor
+    CDismountClient();
+
+    // Second-phase constructor
+    void ConstructL(CStifLogger *aLog);
+
+private:
+    // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+    // Override to handle leaves from RunL(). Default implementation causes
+    // the active scheduler to panic.
+    TInt RunError(TInt aError);
+
+private:
+    enum TDismountClientState
+        {
+        EWaitForDelay,
+        EDelay,
+        EUninitialized, // Uninitialized
+        EInitialized, // Initalized
+        EError // Error condition
+        };
+  
+private:
+    TInt iState; // State of the active object
+    RFs iFs;
+    CStifLogger *iLog;
+    RTimer iTimer;
+    TAllowDismountOption iAllowDismountOption;
+    
+    };
+
+#endif // DISMOUNTCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,269 @@
+/*
+* 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 USBMSCPERSONALITYTEST_H
+#define USBMSCPERSONALITYTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include <cusbpersonalityplugin.h>
+#include <cusbpersonalitynotifier.h>
+
+#include "UsbMscPersonalityTestActiveObject.h"
+#include <tusbpersonalityparams.h>
+#include "DismountClient.h"
+
+// CONSTANTS
+// Logging path
+_LIT( KUsbMscPersonalityTestLogPath, "\\logs\\testframework\\UsbMscPersonalityTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+//_LIT( KUsbMscPersonalityTestLogPath, "e:\\testing\\stiflogs\\" ); 
+
+// Log file
+_LIT( KUsbMscPersonalityTestLogFile, "UsbMscPersonalityTest.txt" ); 
+_LIT( KUsbMscPersonalityTestLogFileWithTitle, "UsbMscPersonalityTest_[%S].txt" );
+
+// MACROS
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Macros used to extract test block parameters
+#define TESTENTRY( A, B )\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\
+        { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )
+
+#define TESTPARAM( A, B )\
+    GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B );
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// Enum type used to determine test block execution result
+enum TUsbMscPersonalityTestResult
+    {
+    ETestCasePassed,
+    ETestCaseFailed
+    };
+
+// Enum type indicating test block parameter which should be used to store
+// data extracted from test script
+enum TTestBlockParamName
+    {
+    eTestOption1,
+    eTestOption2,
+    eTestOption3,    
+    eTestIntOption1,
+    eTestIntOption2,
+    eTestIntOption3,   
+    eTestCharOption1,
+    eTestCharOption2,
+    eTestCharOption3
+    };
+
+// Enum type used to indicate which get parameter function should be used
+enum TGetTestBlockParamOperation
+    {
+    eGetString,
+    eGetInt,
+    eGetChar
+    };
+
+// CLASS DECLARATION
+/**
+*  TUsbMscPersonalityTestBlockParams test class for storing test block parameters.
+*/
+NONSHARABLE_CLASS( TUsbMscPersonalityTestBlockParams )
+    {
+    public:
+        TPtrC iTestBlockName;
+        
+        TPtrC iTestOption1;
+        TPtrC iTestOption2;
+        TPtrC iTestOption3;
+        
+        TInt iTestIntOption1;
+        TInt iTestIntOption2;
+        TInt iTestIntOption3;
+        
+        TChar iTestCharOption1;
+        TChar iTestCharOption2;
+        TChar iTestCharOption3;
+    };
+
+/**
+*  CUsbMscPersonalityTest test class for STIF Test Framework TestScripter.
+*/
+NONSHARABLE_CLASS( CUsbMscPersonalityTest ) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CUsbMscPersonalityTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUsbMscPersonalityTest();
+
+    public: // New functions
+    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
+    protected:  // Functions from base classes
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUsbMscPersonalityTest( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void TestDelete();
+        
+        /**
+        * Constructs all test resources for test methods.
+        */
+        void TestConstructL();
+        
+        /**
+        * Extracts test block parameters from script file
+        */
+        void TestBlocksInfoL();
+        
+        /**
+        * Executes test block
+        */
+        TInt ExecuteTestBlock( CStifItemParser& aItem );
+        
+        /**
+        * Executes proper get parameter function indicated by its arguments
+        */
+        void GetTestBlockParamL( TGetTestBlockParamOperation aOperation,
+                                TTestBlockParamName aParamName );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        // ADD NEW METHOD DEC HERE
+        // [TestMethods] - Do not remove 
+        void ExampleTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                            TUsbMscPersonalityTestResult& aTestResult );
+	
+        void ExecuteDismounting();
+        
+        void PreparePersonalityStartTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void FinishPersonalityStartTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void PreparePersonalityStopTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void FinishPersonalityStopTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void InitializationTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void StateChangeNotifyTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void StateChangeNotifyUndefinedTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                        TUsbMscPersonalityTestResult& aTestResult );
+        void StateChangeNotifyStateAddressTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                        TUsbMscPersonalityTestResult& aTestResult );
+        void ConfirmPersonalityUnloadTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void AllowDismountAfter2SecTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void AllowDismountTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void NotAllowDismountTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+        void AllowDismountTooLateTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult );
+                
+    
+        void InitializeTestObjectsL();
+        void DeleteTestObjects();
+        
+        
+    public:     // Data
+    protected:  // Data
+    private:    // Data
+        
+        // Member object used to store test block parameters
+        TUsbMscPersonalityTestBlockParams iTestBlockParams;
+        
+        // Used to indicate if test block with specified parameters exist
+        TBool iTestBlockFound;
+        
+        // Function pointer used to call proper test block methods
+        void ( CUsbMscPersonalityTest::*iTestBlockFunction )
+            ( TUsbMscPersonalityTestBlockParams&, TUsbMscPersonalityTestResult& );
+        
+        // Not own
+        CStifItemParser* iItem;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+        // ADD NEW DATA DEC HERE
+        
+        RUsb* iUsb;
+        CUsbPersonalityNotifier* iNotifier;
+        TRequestStatus iRequestStatus;
+        CActiveScheduler* iScheduler;
+        CUsbMscPersonalityTestActiveObject* iActive;
+        CUsbPersonalityPlugin* iPlugin;
+        TUsbPersonalityParams* iParams;
+        CDismountClient* iDismountClient;
+        
+    public:     // Friend classes
+    protected:  // Friend classes
+    private:    // Friend classes
+        
+    };
+#endif      // USBMSCPERSONALITYTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTestActiveObject.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* 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 USBMSCPERSONALITYTESTACTIVEOBJECT_H
+#define USBMSCPERSONALITYTESTACTIVEOBJECT_H
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+#include <tusbpersonalityparams.h>
+#include <cusbpersonalityplugin.h>
+
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+class CUsbMscPersonalityTestActiveObject : public CActive
+    {
+public:
+    // Cancel and destroy
+    ~CUsbMscPersonalityTestActiveObject();
+
+    // Two-phased constructor.
+    static CUsbMscPersonalityTestActiveObject* NewL( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+    // Two-phased constructor.
+    static CUsbMscPersonalityTestActiveObject* NewLC( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+public:
+   
+    void PreparePersonalityStart( TRequestStatus& aStatus);
+    void FinishPersonalityStart( TRequestStatus& aStatus);
+    void PreparePersonalityStop( TRequestStatus& aStatus);
+    void FinishPersonalityStop( TRequestStatus& aStatus);
+    void ConfirmPersonalityUnload( TRequestStatus& aStatus);
+
+private:
+    // C++ constructor
+    CUsbMscPersonalityTestActiveObject( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+    // Second-phase constructor
+    void ConstructL();
+
+private:
+    // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+    // Override to handle leaves from RunL(). Default implementation causes
+    // the active scheduler to panic.
+    TInt RunError(TInt aError);
+
+private:
+    
+
+private:
+    
+    CUsbPersonalityPlugin* iPlugin;
+    CStifLogger* iLog; 
+    TUsbPersonalityParams* iParams;
+
+    };
+
+#endif // USBMSCPERSONALITYTESTACTIVEOBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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 TESTDEBUG_H_
+#define TESTDEBUG_H_
+
+//  INCLUDES
+#include <e32debug.h>
+#include <e32def.h>
+
+// CONSTANTS
+_LIT8(KStifTestPrefix8, "[STIF_LOG] ");
+_LIT( KStifTestPrefix, "[STIF_LOG] ");
+_LIT8( KStifEntryPrefix8, ">>> %S" );
+_LIT8( KStifExitPrefix8, "<<< %S" );
+
+const TInt KMaxLogLineLength = 512;
+typedef TBuf8< KMaxLogLineLength > TLogBuf8;
+typedef TBuf16< KMaxLogLineLength > TLogBuf16;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( TTestLogger )
+    {
+public:
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... );
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... );
+    static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf );
+    };
+
+// MACROS
+#define TRACE( p ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_INFO( p, args... ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_ENTRY {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_EXIT {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+
+#include "testdebug.inl"
+
+#endif /* TESTDEBUG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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:
+*
+*/
+
+#include <e32debug.h>
+
+NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow
+    {
+public:
+    void Overflow( TDes8& /*aDes*/ ) {}
+    }; 
+
+NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow
+    {
+public:
+    void Overflow( TDes16& /*aDes*/ ) {}
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate8 overflow;   
+    TLogBuf8 buf8;
+    TLogBuf16 buf16;
+    buf8.AppendFormatList( aFmt, list, &overflow );
+    buf16.Copy( buf8 );
+    return buf16;
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate16 overflow;
+    TLogBuf16 buf16;
+    buf16.AppendFormatList( aFmt, list, &overflow );
+    return buf16;
+    };
+
+void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf )
+    {    
+    RBuf16 buf;
+    RBuf16 bufStifLog;
+    
+    buf.Create( KMaxLogLineLength );
+    buf.Append( KStifTestPrefix );
+    buf.Append( aLogBuf );
+    bufStifLog.Create( KMaxLogLineLength );
+    bufStifLog.Append( aLogBuf );
+    
+    RDebug::Print( buf );
+    aLog.Log( bufStifLog );
+    buf.Close();
+    bufStifLog.Close();
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_ats.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,233 @@
+# 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:
+#
+
+#
+# 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= UsbMscPersonalityTest_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= UsbMscPersonalityTestUsbMscPersonalityTestUsbMscPersonalityTest
+# 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\UsbMscPersonalityTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbMscPersonalityTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbMscPersonalityTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbMscPersonalityTest 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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_phone.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,234 @@
+# 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:
+#
+
+
+#
+# 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\UsbMscPersonalityTest\
+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= UsbMscPersonalityTestUsbMscPersonalityTestUsbMscPersonalityTest
+# 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\UsbMscPersonalityTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbMscPersonalityTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbMscPersonalityTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbMscPersonalityTest 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/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/DismountClient.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* 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:
+*
+*/
+
+#include "DismountClient.h"
+
+CDismountClient::CDismountClient() :
+    CActive(EPriorityStandard) // Standard priority
+    {
+    }
+
+CDismountClient* CDismountClient::NewLC(CStifLogger *aLog)
+    {
+    CDismountClient* self = new (ELeave) CDismountClient();
+    CleanupStack::PushL(self);
+    self->ConstructL(aLog);
+    return self;
+    }
+
+CDismountClient* CDismountClient::NewL(CStifLogger *aLog)
+    {
+    CDismountClient* self = CDismountClient::NewLC(aLog);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+void CDismountClient::ConstructL(CStifLogger *aLog)
+    {
+    User::LeaveIfError(iTimer.CreateLocal());
+    iLog = aLog;
+    User::LeaveIfError( iFs.Connect() );
+    
+    CActiveScheduler::Add(this); // Add to scheduler
+    }
+
+CDismountClient::~CDismountClient()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    // Delete instance variables if any
+    iTimer.Close();
+    iFs.NotifyDismountCancel();
+    iFs.Close();
+    }
+
+void CDismountClient::DoCancel()
+    {
+    iTimer.Cancel();
+    iFs.NotifyDismountCancel();
+    }
+
+void CDismountClient::StartL(TAllowDismountOption aAllowDismountOption)
+    {
+    Cancel();
+    
+    iAllowDismountOption = aAllowDismountOption;
+    if (iAllowDismountOption == EAllowDismountTooLate || 
+            iAllowDismountOption == EAllowDismountAfter2Sec)
+        {
+        iState = EDelay;
+        }
+    
+    iFs.NotifyDismount(EDriveE,iStatus,EFsDismountRegisterClient);
+    RDebug::Printf( " DiscmountClient StartL ");
+    iFs.NotifyDismountCancel();
+    SetActive();
+    }
+
+void CDismountClient::RunL()
+    {
+    
+    switch (iAllowDismountOption)
+        {
+        case EAllowDismount:
+            iFs.AllowDismount(EDriveE);
+            break;
+            
+        case EAllowDismountAfter2Sec:
+            if (iState ==EDelay)
+                {
+                iTimer.After(iStatus,(TTimeIntervalMicroSeconds32)2000000);
+                iState=EWaitForDelay;
+                SetActive();
+                }
+            else
+                if(iState==EWaitForDelay)
+                    {
+                    iFs.AllowDismount(EDriveE);
+                    iState=EDelay;
+                    }
+            break;
+            
+        case EAllowDismountTooLate:
+            if (iState == EDelay)
+                {
+            iTimer.After(iStatus,(TTimeIntervalMicroSeconds32)8000000);
+            iState=EWaitForDelay;
+            SetActive();
+                }
+            else
+                if(iState==EWaitForDelay)
+                    {
+                    iFs.AllowDismount(EDriveE);
+                    iState=EDelay;
+                    }
+            break;
+            
+        case ENotAllowDismount:
+        default:
+            break;
+        }
+    }
+
+TInt CDismountClient::RunError(TInt aError)
+    {
+    return aError;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,326 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "UsbMscPersonalityTest.h"
+#include <SettingServerClient.h>
+#include "testdebug.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::CUsbMscPersonalityTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbMscPersonalityTest::CUsbMscPersonalityTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbMscPersonalityTest::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( KUsbMscPersonalityTestLogFileWithTitle, &title );
+        }
+    else
+        {
+        logFileName.Copy( KUsbMscPersonalityTestLogFile );
+        }
+
+    iLog = CStifLogger::NewL( KUsbMscPersonalityTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    TestConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbMscPersonalityTest* CUsbMscPersonalityTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CUsbMscPersonalityTest* self = new (ELeave) CUsbMscPersonalityTest( aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CUsbMscPersonalityTest::~CUsbMscPersonalityTest()
+    { 
+
+    // Delete resources allocated from test methods
+    TestDelete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+
+TInt CUsbMscPersonalityTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+    return ExecuteTestBlock( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::ExecuteTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbMscPersonalityTest::ExecuteTestBlock( CStifItemParser& aItem )
+    {
+    TRACE_FUNC_ENTRY
+    iItem = &aItem;    
+    TInt res;
+    TUsbMscPersonalityTestResult testResult = ETestCaseFailed;
+    
+    res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Getting test block name failed with: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName )
+    
+    TRACE( "Extracting test block parameters..." )
+    TRAP( res, TestBlocksInfoL() );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Extracting parameters failed: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    if ( !iTestBlockFound )
+        {
+        TRACE( "Test block not found!" )
+        TRACE_FUNC_EXIT
+        return KErrNotFound;
+        }    
+    TRACE( "Extracting parameters successful" )
+    
+    TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "ExecuteTestBlockL error: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    TRACE( "Test block passed!" );
+    TRACE_FUNC_EXIT 
+    return KErrNone;
+    } 
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::GetTestBlockParamL
+// -----------------------------------------------------------------------------
+
+void CUsbMscPersonalityTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName )
+    {    
+    switch( aOperation )
+        {
+        case eGetString:
+            {
+            switch ( aParamName )
+                {
+                case eTestOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) );
+                    break;
+                    }
+                case eTestOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) );
+                    break;
+                    }
+                case eTestOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetInt:
+            {
+            switch ( aParamName )
+                {
+                case eTestIntOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) );
+                    break;
+                    }
+                case eTestIntOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) );
+                    break;
+                    }
+                case eTestIntOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetChar:            
+            {
+            switch ( aParamName )
+                {
+                case eTestCharOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) );
+                    break;
+                    }
+                case eTestCharOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) );
+                    break;
+                    }
+                case eTestCharOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    }
+
+//-----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbMscPersonalityTest::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("UsbMscPersonalityTest.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* ) CUsbMscPersonalityTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestActiveObject.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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:
+*
+*/
+#include "UsbMscPersonalityTestActiveObject.h"
+#include <e32debug.h>
+
+CUsbMscPersonalityTestActiveObject::CUsbMscPersonalityTestActiveObject( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams ) :
+    CActive(EPriorityStandard) // Standard priority
+    {
+    iPlugin = aPlugin;
+    iLog = aLog;
+    iParams = aParams;
+    }
+
+CUsbMscPersonalityTestActiveObject* CUsbMscPersonalityTestActiveObject::NewLC( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams )
+    {
+    CUsbMscPersonalityTestActiveObject* self =
+            new (ELeave) CUsbMscPersonalityTestActiveObject( aPlugin, aLog, aParams );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CUsbMscPersonalityTestActiveObject* CUsbMscPersonalityTestActiveObject::NewL( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams )
+    {
+    CUsbMscPersonalityTestActiveObject* self =
+            CUsbMscPersonalityTestActiveObject::NewLC( aPlugin, aLog, aParams );
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+void CUsbMscPersonalityTestActiveObject::ConstructL()
+    {
+    CActiveScheduler::Add(this); // Add to scheduler
+    }
+
+CUsbMscPersonalityTestActiveObject::~CUsbMscPersonalityTestActiveObject()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    
+    // Delete instance variables if any
+    }
+
+void CUsbMscPersonalityTestActiveObject::DoCancel()
+    {
+    }
+
+void CUsbMscPersonalityTestActiveObject::RunL()
+    {
+    CActiveScheduler::Stop();
+    }
+
+TInt CUsbMscPersonalityTestActiveObject::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+void CUsbMscPersonalityTestActiveObject::PreparePersonalityStart( TRequestStatus& aStatus)
+    {
+    iPlugin->PreparePersonalityStart(aStatus);
+    RDebug::Printf( "prepare personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbMscPersonalityTestActiveObject::FinishPersonalityStart( TRequestStatus& aStatus)
+    {
+    iPlugin->FinishPersonalityStart(aStatus);
+    RDebug::Printf( "finish personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbMscPersonalityTestActiveObject::PreparePersonalityStop( TRequestStatus& aStatus)
+    {
+    iPlugin->PreparePersonalityStop(aStatus);
+    RDebug::Printf( "prepare personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbMscPersonalityTestActiveObject::FinishPersonalityStop( TRequestStatus& aStatus)
+    {
+    iPlugin->FinishPersonalityStop(aStatus);
+    RDebug::Printf( "finish personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbMscPersonalityTestActiveObject::ConfirmPersonalityUnload( TRequestStatus& aStatus)
+    {
+    iPlugin->ConfirmPersonalityUnload(aStatus);
+    RDebug::Printf( "confirm personality unload, status: %d", aStatus.Int());
+    
+    iParams->PersonalityNotifier().CancelQuery(KQueriesNotifier);
+    SetActive();
+    CActiveScheduler::Start();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,497 @@
+/*
+ * 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:
+ *
+ */
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "UsbMscPersonalityTest.h"
+#include "testdebug.h"
+#include <ecom/ecom.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::TestConstructL
+// Construct here all test resources for test methods. 
+// Called from ConstructL. 
+// -----------------------------------------------------------------------------
+
+void CUsbMscPersonalityTest::TestConstructL()
+    {
+    TRACE_FUNC_ENTRY
+
+    if (!CActiveScheduler::Current())
+        {
+        iScheduler = new (ELeave) CActiveScheduler;
+        CActiveScheduler::Install(iScheduler);
+        }
+
+    iUsb = new (ELeave) RUsb;
+    iNotifier = CUsbPersonalityNotifier::NewL();
+    iParams = new (ELeave) TUsbPersonalityParams(*iUsb, *iNotifier);
+    //    iParams->SetPersonalityId(2);
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, TUid::Uid(0x1020DF7B));
+    
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::TestDelete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+
+void CUsbMscPersonalityTest::TestDelete()
+    {
+    TRACE_FUNC_ENTRY
+
+    if (iScheduler)
+        {
+        iScheduler->Stop();
+        delete iScheduler;
+        iScheduler = NULL;
+        }
+
+    if (iUsb)
+        {
+        delete iUsb;
+        iUsb = NULL;
+        }
+
+    if (iNotifier)
+        {
+        delete iNotifier;
+        }
+
+    if (iParams)
+        {
+        delete iParams;
+        iParams = NULL;
+        }
+
+    if (iPlugin)
+        {
+        iPlugin->Cancel();
+        delete iPlugin;
+        iPlugin = NULL;
+        }
+
+    if (iActive)
+        {
+        delete iActive;
+        iActive = NULL;
+        }
+    
+    if (iDismountClient)
+        {
+        delete iDismountClient;
+        iDismountClient = NULL;
+        }
+    
+    REComSession::FinalClose();
+
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::TestBlocksInfoL
+// Add new test block parameter entries below
+// -----------------------------------------------------------------------------
+
+void CUsbMscPersonalityTest::TestBlocksInfoL()
+    {
+
+    TESTENTRY( "ExampleTestL", CUsbMscPersonalityTest::ExampleTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        TESTPARAM( eGetInt, eTestIntOption1 )
+        TESTPARAM( eGetChar, eTestCharOption1 )
+        }
+    TESTENTRY( "PreparePersonalityStartTestL", CUsbMscPersonalityTest::PreparePersonalityStartTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "FinishPersonalityStartTestL", CUsbMscPersonalityTest::FinishPersonalityStartTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "PreparePersonalityStopTestL", CUsbMscPersonalityTest::PreparePersonalityStopTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "FinishPersonalityStopTestL", CUsbMscPersonalityTest::FinishPersonalityStopTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "InitializationTestL", CUsbMscPersonalityTest::InitializationTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "StateChangeNotifyTestL", CUsbMscPersonalityTest::StateChangeNotifyTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "StateChangeNotifyUndefinedTestL", CUsbMscPersonalityTest::StateChangeNotifyUndefinedTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "StateChangeNotifyStateAddressTestL", CUsbMscPersonalityTest::StateChangeNotifyStateAddressTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "ConfirmPersonalityUnloadTestL", CUsbMscPersonalityTest::ConfirmPersonalityUnloadTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "AllowDismountAfter2SecTestL", CUsbMscPersonalityTest::AllowDismountAfter2SecTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "AllowDismountTestL", CUsbMscPersonalityTest::AllowDismountTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "NotAllowDismountTestL", CUsbMscPersonalityTest::NotAllowDismountTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "AllowDismountTooLateTestL", CUsbMscPersonalityTest::AllowDismountTooLateTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+
+    }
+
+// Add test block methods implementation here
+// -----------------------------------------------------------------------------
+// CUsbMscPersonalityTest::ExampleTestL
+// -----------------------------------------------------------------------------
+
+void CUsbMscPersonalityTest::ExampleTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+
+    if (!aParams.iTestOption1.Compare(_L( "API" )))
+        {
+        TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if (!aParams.iTestOption1.Compare(_L( "MODULE" )))
+        {
+        TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if (!aParams.iTestOption1.Compare(_L( "BRANCH" )))
+        {
+        TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else
+        {
+        TRACE( "Invalid test parameter" )
+        TRACE_FUNC_EXIT
+        User::Leave(KErrNotFound);
+        }
+
+    aTestResult = ETestCasePassed;
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbMscPersonalityTest::InitializeTestObjectsL()
+    {
+    iActive
+            = CUsbMscPersonalityTestActiveObject::NewL(iPlugin, iLog, iParams);
+    iDismountClient = CDismountClient::NewL(iLog);
+    TRACE ( " test objects initialized " );
+    }
+
+void CUsbMscPersonalityTest::DeleteTestObjects()
+    {
+    delete iActive;
+    iActive = NULL;
+    delete iDismountClient;
+    iDismountClient = NULL;
+    TRACE ( " test objects deleted " );
+    }
+
+void CUsbMscPersonalityTest::InitializationTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+    TRACE( "checking iPlugin")
+    if (iPlugin)
+        {
+        aTestResult = ETestCasePassed;
+        }
+    else
+        {
+        TRACE( "no iplugin instance")
+        }
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::ExecuteDismounting()
+    {
+    iActive->PreparePersonalityStart(iRequestStatus);
+    iActive->FinishPersonalityStart(iRequestStatus);
+    iActive->PreparePersonalityStop(iRequestStatus);
+    iActive->FinishPersonalityStop(iRequestStatus);
+    }
+
+void CUsbMscPersonalityTest::PreparePersonalityStartTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+    
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::FinishPersonalityStartTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    iActive->FinishPersonalityStart(iRequestStatus);
+    User::LeaveIfError(iRequestStatus.Int());
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::PreparePersonalityStopTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+        
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::FinishPersonalityStopTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->FinishPersonalityStop(iRequestStatus);
+    TRACE_INFO( "finish personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+        
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::ConfirmPersonalityUnloadTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+
+    iActive->ConfirmPersonalityUnload(iRequestStatus);
+    User::After(5000);
+    TRACE_INFO( "confirm personality unload status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError( iRequestStatus.Int() );
+        
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::StateChangeNotifyTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+
+    TUsbDeviceState state = EUsbDeviceStateDefault;
+    iPlugin->StateChangeNotify(state);
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::StateChangeNotifyUndefinedTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult )
+    {
+    InitializeTestObjectsL();
+
+    TUsbDeviceState state = EUsbDeviceStateUndefined;
+    iPlugin->StateChangeNotify(state);
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::StateChangeNotifyStateAddressTestL( TUsbMscPersonalityTestBlockParams& aParams, 
+                TUsbMscPersonalityTestResult& aTestResult )
+    {
+    InitializeTestObjectsL();
+
+    TUsbDeviceState state = EUsbDeviceStateAddress;
+    iPlugin->StateChangeNotify(state);
+
+    User::After( 2000000 );
+    iPlugin->Cancel();
+    
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::AllowDismountAfter2SecTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+    iDismountClient->StartL(EAllowDismountAfter2Sec);
+    iActive->PreparePersonalityStart(iRequestStatus);
+    ExecuteDismounting();
+
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::AllowDismountTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+    iDismountClient->StartL(EAllowDismount);
+    iActive->PreparePersonalityStart(iRequestStatus);
+    ExecuteDismounting();
+
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::NotAllowDismountTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+    iDismountClient->StartL(ENotAllowDismount);
+    iActive->PreparePersonalityStart(iRequestStatus);
+    ExecuteDismounting();
+
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    }
+
+void CUsbMscPersonalityTest::AllowDismountTooLateTestL(
+        TUsbMscPersonalityTestBlockParams& aParams,
+        TUsbMscPersonalityTestResult& aTestResult)
+    {
+    InitializeTestObjectsL();
+    iDismountClient->StartL(EAllowDismountTooLate);
+    iActive->PreparePersonalityStart(iRequestStatus);
+    ExecuteDismounting();
+
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    }
+// Add other member functions implementation here
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest_exe.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // usbmscpersonalitytest_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- a/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -47,4 +47,4 @@
 LIBRARY         usbclasscontroller.lib //General Class Controller API
 LIBRARY         obexusbapi.lib // Obex Service Manager Client API
 
-
+#include <usb/usblogger.mmh>
--- a/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h	Wed Sep 01 12:20:49 2010 +0100
@@ -22,9 +22,9 @@
 #include <e32std.h>
 #include <cusbclasscontrollerplugin.h>
 #include <usbobex.h>
+#include <usb/usblogger.h>
 #include "obexsmwatcher.h"
 
-
 const TInt KObexClassPriority = 2;
 const TInt KObexNumInterfaces = 2;
 
--- a/usbclasses/usbobexclasscontroller/inc/debug.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
-* 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:  Debug macros and declarations. 
-*
-*/
-
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-//////////////////////////////////////////////////////////////////////////////
-// Here are parameters need to be modified. 
-// Component name 
-#define MODULE_NAME "UsbObexCc"
-//////////////////////////////////////////////////////////////////////////////
-
-
-// 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
-
-// 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
-
-#include <flogger.h>
-
-#define DESC( x ) TPtrC( ( const TText* ) ( x ) )
-#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) )
-_LIT( KUsbLogDir, "USB" );
-_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" );
-
-// s: c string. 
-#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \
-                KUsbLogFile, EFileLoggingModeAppend, \
-                DESC8( "["MODULE_NAME"] "##s ) )
-
-// 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)
-
-// 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 )
-
-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>
-
-// Paramters same as above.
-#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str  ); }
-
-#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); }
-
-#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); }
-
-inline void LogBuf(const TDesC8& aBuf8)
-    {
-    LOG1("Buffer length = %d Buffer content:", aBuf8.Length());
-
-    TInt len(aBuf8.Length());
-    for (TInt i(0); i < len; ++i)
-        RDebug::Print(_L("Buffer[%d] = 0x%x"), i, aBuf8[i]);
-    }
-
-class TFuncLogger
-    {
-public:
-    TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName )
-        {
-        RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr());
-        }
-    ~TFuncLogger()
-        {
-        RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr());
-        }
-private:
-    TPtrC8 iFuncName;
-    };
-#endif // LOG_TO_FILE
-
-#define LEAVE( exp )  {volatile TInt err_ = exp; \
-        LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
-        User::Leave( err_ );}
-
-#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \
-        if(err__ < 0) LEAVE(err__);}
-
-#define PANIC( exp ) {volatile TInt err_ = exp; \
-        LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
-        User::Panic( KUsbPanicModule, err_ );} 
-
-#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
-
-#define ASSERT_DEBUG( exp, code ) {if(!(exp)) PANIC(code)}
-
-#else // _DEBUG not defined 
-// ===========================================================================
-
-#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_DEBUG( exp, code )
-inline void LogBuf(const TDesC8& /*aBuf8*/)
-    {}
-// ===========================================================================
-#endif // _DEBUG
-// ===========================================================================
-#endif // DEBUG_H
-
-// End of File
--- a/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -22,8 +22,15 @@
 #include <SrcsInterface.h>
 #include <mmf/common/mmfcontrollerpluginresolver.h> //for CleanupResetAndDestroyPushL
 #include <musbclasscontrollernotify.h>
-#include "debug.h"
 
+// Panic category only used in debug builds
+#ifdef _DEBUG
+_LIT( KObexCcPanicCategory, "OBEXCC" );
+#endif
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbObexCc");
+#endif
 
 /**
  * Panic codes for the USB OBEX Class Controller.
@@ -36,8 +43,6 @@
   EBadApiCallStart = 1,
   /** Stop() called while in an illegal state */
   EBadApiCallStop = 2,
-  /** Request completes in uknown state */
-  EUnkownState = 3
   };
 
 // ---------------------------------------------------------------------------
@@ -47,7 +52,7 @@
 CUsbObexClassController* CUsbObexClassController::NewL(
   MUsbClassControllerNotify& aOwner)
   {
-  LOG_FUNC
+  LOG_STATIC_FUNC_ENTRY
 
   CUsbObexClassController* self = new (ELeave) CUsbObexClassController(aOwner);
   CleanupStack::PushL(self);
@@ -102,13 +107,13 @@
 
   LOG_FUNC
   //Start() should never be called if started, starting or stopping (or in state EUsbServiceFatalError)
-  ASSERT_DEBUG(iState == EUsbServiceIdle, EBadApiCallStart );
+  __ASSERT_DEBUG(iState == EUsbServiceIdle, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStart));
 
   // Start OBEX SM
   iRequestStatus = &aStatus;
   iState = EUsbServiceStarting;
   aStatus = KRequestPending;
-  LOG("CUsbObexClassController::Start() calling ManageUSBService(ETrue)"); 
+  LOGTEXT(_L8("CUsbObexClassController::Start() calling ManageUSBService(ETrue)")); 
   iObexSM->ManageUSBServices(ETrue, iStatus);
   SetActive();
   }
@@ -122,10 +127,10 @@
   {
 
   LOG_FUNC
-  LOG1("CUsbObexClassController::Stop iState = %d", iState);
+  LOGTEXT2(_L8("CUsbObexClassController::Stop iState = %d"), iState);
   
   //Stop() should never be called if stopping or starting (or in state EUsbServiceFatalError)
-  ASSERT_DEBUG(iState == EUsbServiceStarted || iState == EUsbServiceIdle, EBadApiCallStop );
+  __ASSERT_DEBUG(iState == EUsbServiceStarted || iState == EUsbServiceIdle, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStop));
 
   //state may be idle after Cancel
   if ( iState == EUsbServiceIdle )
@@ -139,7 +144,7 @@
     iRequestStatus = &aStatus;
     iState = EUsbServiceStopping;   
     aStatus = KRequestPending;
-    LOG("CUsbObexClassController::Stop() calling ManageUSBService(EFalse)"); 
+    LOGTEXT(_L8("CUsbObexClassController::Stop() calling ManageUSBService(EFalse)")); 
     iObexSM->ManageUSBServices(EFalse, iStatus);
     SetActive();
     }
@@ -155,11 +160,11 @@
   LOG_FUNC
   if (iStatus != KErrNone)
     {
-    LOG1("CUsbObexClassController::RunL() iStatus = %d", iStatus.Int());
+    LOGTEXT2(_L8("CUsbObexClassController::RunL() Error = %d"), iStatus.Int());
     User::RequestComplete(iRequestStatus, iStatus.Int());
     return;
     }
-  LOG1("CUsbObexClassController::RunL() State is %d", iState);
+  LOGTEXT2(_L8("CUsbObexClassController::RunL() State is %d"), iState);
 
             switch (iState)
                 {
@@ -177,8 +182,7 @@
                 case EUsbServiceIdle:
 
                 default:
-            	     LOG("CUsbObexClassController::RunL() Unknown State");
-            		 PANIC(EUnkownState);
+            LOGTEXT(_L8("CUsbObexClassController::RunL() Error or Unknown State"));
                     break;
                 }
   }
@@ -194,7 +198,7 @@
   TRAPD(ret, DoGetDescriptorInfoL(aDescriptorInfo));
         if(ret!=KErrNone)
           {
-                 LOG1("CUsbObexClassController::GetDescriptorInfo leave with code: %d", ret);
+                 LOGTEXT2(_L8("CUsbObexClassController::GetDescriptorInfo leave with code: %d"), ret);
           }
         }
 
@@ -213,7 +217,7 @@
         resolverParams.SetWildcardMatch(EFalse);
         REComSession::ListImplementationsL(KCSrcsInterfaceUid, resolverParams, implInfoArray);
 
-        LOG1("CUsbObexClassController::DoGetDescriptorInfoL Number of Interfaces is %d",
+        LOGTEXT2(_L8("CUsbObexClassController::DoGetDescriptorInfoL Number of Interfaces is %d"),
                    implInfoArray.Count());
         aDescriptorInfo.iNumInterfaces = (implInfoArray.Count())*KObexNumInterfaces;
         aDescriptorInfo.iLength = 0;
@@ -238,7 +242,7 @@
       break;
 
     default:
-      ASSERT_DEBUG( EFalse,  EBadAsynchronousCall );
+      __ASSERT_DEBUG( EFalse, _USB_PANIC(KObexCcPanicCategory, EBadAsynchronousCall) );
       break;
     }
 
@@ -255,14 +259,14 @@
 TInt CUsbObexClassController::RunError(TInt aError)
   {
   LOG_FUNC
-  LOG1("CUsbObexClassController::RunError aError=%d", aError);
+  LOGTEXT2(_L8("CUsbObexClassController::RunError aError=%d"), aError);
   return KErrNone;
   }
 
 void CUsbObexClassController::MosmError(TInt aError)
     {
     LOG_FUNC
-    LOG1("CUsbObexClassController::MosmError aError=%d", aError);
+    LOGTEXT2(_L8("CUsbObexClassController::MosmError aError=%d"), aError);
     Owner().UccnError(aError);
     }
 
--- a/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -18,15 +18,18 @@
 #include "obexsmwatcher.h"
 #include <e32base.h>
 #include <obexservicemanprop.h>
-#include "debug.h"
+#include <usb/usblogger.h>
 
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbObexCcSMW");
+#endif
 
 /**
  * @since S60 V5.2
  */
 CObexSMWatcher* CObexSMWatcher::NewL(MObexSMObserver& aObserver)
     {
-    LOG_FUNC
+    LOG_STATIC_FUNC_ENTRY
 
     CObexSMWatcher* self = new (ELeave) CObexSMWatcher(aObserver);
     CleanupStack::PushL( self);
@@ -76,7 +79,7 @@
     {
     LOG_FUNC 
     
-    LOG1("iStatus=%d", iStatus.Int());
+    LOGTEXT2(_L8(">>CObexSMWatcher::RunL [iStatus=%d]"), iStatus.Int());
     
     iObexSMPostInit.Subscribe( iStatus );
     SetActive();
@@ -86,8 +89,9 @@
     if (err == KErrNone && value != KErrNone)
         {
         iObserver.MosmError(value);
-        }    
-
+        }
+    
+    LOGTEXT(_L8("<<CObexSMWatcher::RunL"));
     }
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bmarm/UsbObexClassControllerTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bwins/UsbObexClassControllerTestu.def	Wed Sep 01 12:20:49 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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/conf/UsbObexClassControllerTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* 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:
+*
+*/
+
+
+[StifSettings]
+CapsModifier= UsbObexClassControllerTest.exe
+[EndStifSettings]
+
+// UsbObexClassControllerTest Module - total 9 tc
+
+// UsbObexClassControllerTest Api Tests (9 tc)
+
+[Test]
+title Initialization Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest InitializationTest
+delete tester
+[Endtest] 
+
+[Test]
+title Start Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest StartTest
+delete tester
+[Endtest] 
+
+[Test]
+title Stop Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest StopTest
+delete tester
+[Endtest] 
+
+[Test]
+title InterfaceInfo Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest InterfaceInfoTest
+delete tester
+[Endtest] 
+
+[Test]
+title InterfaceLengthInfo Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest InterfaceLengthInfoTest
+delete tester
+[Endtest] 
+
+[Test]
+title NumberOfInterfacesInfo Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest NumberOfInterfacesInfoTest
+delete tester
+[Endtest] 
+
+[Test]
+title StartupPriorityInfo Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest StartupPriorityInfoTest
+delete tester
+[Endtest] 
+
+[Test]
+title StateInfo Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest StateInfoTest
+delete tester
+[Endtest] 
+
+[Test]
+title Owner Test
+create UsbObexClassControllerTest tester
+tester ExecuteApiTest OwnerTest
+delete tester
+[Endtest] 
+
+// Add new api tests here
+// ...
+
+
+// UsbObexClassControllerTest Module Tests (... tc)
+
+
+// Add new module tests here
+// ...
+
+
+// UsbObexClassControllerTest Branch Tests (... tc)
+
+
+// Add new branch tests here
+// ...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/eabi/UsbObexClassControllerTestu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI27CUSBObexApiTestActiveObject @ 2 NONAME
+	_ZTV27CUSBObexApiTestActiveObject @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* 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:	TYPE TESTCLASS
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbObexClassControllerTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      NetworkControl LocalServices NetworkServices CommDD ProtServ
+
+DEFFILE         UsbObexClassControllerTest.def
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE	../inc 
+
+SOURCEPATH      ../src
+SOURCE          UsbObexClassControllerTest.cpp
+SOURCE          UsbObexClassControllerTestBlocks.cpp USBObexApiTestActiveObject.cpp UsbObexClassControllerTest_exe.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY		usbclasscontroller.lib 
+LIBRARY		ecom.lib
+
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+;
+; 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: 
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 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\UsbObexClassControllerTest.dll"-"c:\Sys\Bin\UsbObexClassControllerTest.dll"
+"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.exe"-"c:\Sys\Bin\UsbObexClassControllerTest.exe"
+
+"..\init\UsbObexClassControllerTest_ats.ini"-"e:\testing\init\UsbObexClassControllerTest.ini"
+"..\conf\UsbObexClassControllerTest.cfg"-"e:\testing\conf\UsbObexClassControllerTest.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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_exe.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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:	TYPE TESTCLASS
+*
+*/
+
+
+#if defined(__S60_)
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbObexClassControllerTest.exe
+TARGETTYPE      exe
+
+CAPABILITY     NetworkControl LocalServices NetworkServices CommDD ProtServ
+
+UID		0 0xEF4892C6
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          UsbObexClassControllerTest_exe.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+;
+; 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: 
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x1028315F], 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\UsbObexClassControllerTest.dll"-"c:\Sys\Bin\UsbObexClassControllerTest.dll"
+"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.exe"-"c:\Sys\Bin\UsbObexClassControllerTest.exe"
+
+"..\init\UsbObexClassControllerTest_phone.ini"-"c:\testframework\testframework.ini"
+"..\conf\UsbObexClassControllerTest.cfg"-"c:\testframework\UsbObexClassControllerTest.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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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:   ?Description
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+UsbObexClassControllerTest.mmp
+UsbObexClassControllerTest_exe.mmp
+
+PRJ_MMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,23 @@
+@rem
+@rem Copyright (c) 2010 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
+
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
+call makesis UsbObexClassControllerTest_ats.pkg
+call signsis UsbObexClassControllerTest_ats.sis UsbObexClassControllerTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,25 @@
+@rem
+@rem Copyright (c) 2010 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
+
+
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
+
+call makesis UsbObexClassControllerTest_phone.pkg
+call signsis UsbObexClassControllerTest_phone.sis UsbObexClassControllerTest_phone.sisx x:\rd.cer x:\rd-key.pem
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/USBObexApiTestActiveObject.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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 USBOBEXAPITESTACTIVEOBJECT_H_
+#define USBOBEXAPITESTACTIVEOBJECT_H_
+
+#include <e32base.h>
+#include <StifLogger.h>
+#include <CUsbClassControllerPlugIn.h>
+
+class CStifLogger;
+class CUsbClassControllerPlugIn;
+
+class CUSBObexApiTestActiveObject : public CActive
+{
+public:
+	static CUSBObexApiTestActiveObject* NewL
+	    (CStifLogger* aLog, 
+	     CUsbClassControllerPlugIn* aUsbClassControllerPlugIn);
+	virtual ~CUSBObexApiTestActiveObject();
+	
+	void Start();
+	void Stop();
+
+private:
+    CUSBObexApiTestActiveObject
+        (CStifLogger* aLog, 
+         CUsbClassControllerPlugIn* aUsbClassControllerPlugIn);
+    void RunL();
+    void DoCancel();
+    void ConstructL();
+  
+    
+private:
+    CStifLogger* iLog;
+    CUsbClassControllerPlugIn* iUsbClassControllerPlugIn;
+    TUsbServiceState iUsbServiceState;
+};
+
+#endif /*USBOBEXAPITESTACTIVEOBJECT_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/UsbObexClassControllerTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,240 @@
+/*
+* 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:   ?Description
+*
+*/
+
+
+
+
+#ifndef USBOBEXCLASSCONTROLLERTEST_H
+#define USBOBEXCLASSCONTROLLERTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include "USBObexApiTestActiveObject.h"
+#include <musbclasscontrollernotify.h>
+#include <cusbclasscontrollerplugin.h>
+#include <usbobex.h>
+#include <usb_std.h>
+#include <ecom/ecom.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( KUsbObexClassControllerTestLogPath, "\\logs\\testframework\\UsbObexClassControllerTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+//_LIT( KUsbObexClassControllerTestLogPath, "e:\\testing\\stiflogs\\" ); 
+
+// Log file
+_LIT( KUsbObexClassControllerTestLogFile, "UsbObexClassControllerTest.txt" ); 
+_LIT( KUsbObexClassControllerTestLogFileWithTitle, "UsbObexClassControllerTest_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CUsbObexClassControllerTest;
+class CUsbClassControllerIterator;              
+
+// DATA TYPES
+//enum ?declaration
+
+enum TUsbObexClassControllerTestResult
+    {
+    ETestCasePassed,
+    ETestCaseFailed
+    };
+
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CUsbObexClassControllerTest test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CUsbObexClassControllerTest) : 
+										public CScriptBase,
+										public MUsbClassControllerNotify
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CUsbObexClassControllerTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUsbObexClassControllerTest();
+
+    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 );
+        
+        /**
+        * overrider of pure virtual functions from MUsbClassControllerNotify class
+        */ 
+        CUsbClassControllerIterator* UccnGetClassControllerIteratorL();
+        void UccnError(TInt aError);
+
+    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.
+        */
+        CUsbObexClassControllerTest( 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 ExecuteApiTest( CStifItemParser& aItem );
+        virtual TInt ExecuteModuleTest( CStifItemParser& aItem );
+        virtual TInt ExecuteBranchTest( CStifItemParser& aItem );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+		void DoExecuteApiTestL( TPtrC aApiTestName, TUsbObexClassControllerTestResult& aTestResult );
+	
+		void ExampleApiTestL( TUsbObexClassControllerTestResult& aTestResult );
+		
+		void DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbObexClassControllerTestResult& aTestResult );
+	
+		void ExampleModuleTestL( TUsbObexClassControllerTestResult& aTestResult );
+	
+		void DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbObexClassControllerTestResult& aTestResult );
+	
+		void ExampleBranchTestL( TUsbObexClassControllerTestResult& aTestResult );
+		
+		void InitializeTestObjectL();
+		void DeleteTestObject();
+		TInt InitializationTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt StartTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt StopTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt InterfaceInfoTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt InterfaceLengthInfoTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt NumberOfInterfacesInfoTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt StartupPriorityInfoTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt StateInfoTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt OwnerTestL( TUsbObexClassControllerTestResult& aTestResult );
+		TInt CompareTestL( TUsbObexClassControllerTestResult& aTestResult );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        CUsbClassControllerPlugIn* iUsbClassControllerPlugIn;
+        CActiveScheduler* iScheduler;
+        TRequestStatus iRequestStatus;
+        TUsbServiceState iUsbServiceState;
+
+        // 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;
+
+    };
+
+#endif      // USBOBEXCLASSCONTROLLERTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_ats.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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:
+#
+
+
+#
+# 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= UsbObexClassControllerTest_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= UsbObexClassControllerTestUsbObexClassControllerTestUsbObexClassControllerTest
+# 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\UsbObexClassControllerTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbObexClassControllerTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbObexClassControllerTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbObexClassControllerTest 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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_phone.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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:
+#
+
+
+#
+# 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\UsbObexClassControllerTest\
+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= UsbObexClassControllerTestUsbObexClassControllerTestUsbObexClassControllerTest
+# 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\UsbObexClassControllerTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbObexClassControllerTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbObexClassControllerTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbObexClassControllerTest 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/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,107 @@
+/*
+* 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:
+*
+*/
+
+#include "USBObexApiTestActiveObject.h"
+
+// -----------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject( CStifLogger* aLog,
+        CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) :
+    CActive( EPriorityStandard )
+    {
+    iUsbClassControllerPlugIn = aUsbClassControllerPlugIn;
+    iLog = aLog;
+    }
+
+// Destructor
+CUSBObexApiTestActiveObject::~CUSBObexApiTestActiveObject()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::RunL
+// ---------------------------------------------------------------------------
+//
+void CUSBObexApiTestActiveObject::RunL()
+    {
+    iLog->Log( _L("ActiveTestObject::RunL"));
+    CActiveScheduler::Stop();
+    iLog->Log( _L("ActiveScheduler Stopped"));
+    iUsbServiceState = iUsbClassControllerPlugIn -> State();
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUSBObexApiTestActiveObject* CUSBObexApiTestActiveObject::NewL(
+        CStifLogger* aLog, CUsbClassControllerPlugIn* aUsbClassControllerPlugIn )
+    {
+    CUSBObexApiTestActiveObject* self = new ( ELeave )CUSBObexApiTestActiveObject( aLog, aUsbClassControllerPlugIn );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUSBObexApiTestActiveObject::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CUSBObexApiTestActiveObject::DoCancel()
+    {
+    iLog->Log( _L("ActiveTestObject::DoCancel"));
+    }
+
+// ---------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::Start
+// ---------------------------------------------------------------------------
+//
+void CUSBObexApiTestActiveObject::Start()
+    {
+    iUsbClassControllerPlugIn -> Start( iStatus );
+    SetActive();
+    iLog->Log( _L("Obex Controller Started"));
+    }
+
+// ---------------------------------------------------------------------------
+// CUSBObexApiTestActiveObject::Stop
+// ---------------------------------------------------------------------------
+//
+void CUSBObexApiTestActiveObject::Stop()
+    {
+    iUsbClassControllerPlugIn -> Stop( iStatus );
+    SetActive();
+    iLog->Log( _L("Obex Controller Stopped"));
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,202 @@
+/*
+* 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:   ?Description
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "UsbObexClassControllerTest.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 ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::CUsbObexClassControllerTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbObexClassControllerTest::CUsbObexClassControllerTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::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(KUsbObexClassControllerTestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KUsbObexClassControllerTestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KUsbObexClassControllerTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbObexClassControllerTest* CUsbObexClassControllerTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CUsbObexClassControllerTest* self = new (ELeave) CUsbObexClassControllerTest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CUsbObexClassControllerTest::~CUsbObexClassControllerTest()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::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("UsbObexClassControllerTest.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* ) CUsbObexClassControllerTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,681 @@
+/*
+* 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:   ?Description
+*
+*/
+
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "UsbObexClassControllerTest.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+const TUid KCSrcsInterfaceUid = {0x101F7C8C};
+const TInt KObexNumInterfaces = 2;
+
+// 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 ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+		ENTRY( "ExecuteApiTest", CUsbObexClassControllerTest::ExecuteApiTest ),
+        ENTRY( "ExecuteModuleTest", CUsbObexClassControllerTest::ExecuteModuleTest ),
+        ENTRY( "ExecuteBranchTest", CUsbObexClassControllerTest::ExecuteBranchTest ),
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExecuteApiTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::ExecuteApiTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteApiTest" );
+	
+	TInt res;
+    TUsbObexClassControllerTestResult testResult = ETestCaseFailed;
+    TPtrC apiTestName( KNullDesC );
+	
+	res = aItem.GetString( _L( "ExecuteApiTest" ), apiTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+		
+	TRAP( res, DoExecuteApiTestL( apiTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteApiTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteApiTest" );
+    return KErrNone;
+    }
+	
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::DoExecuteApiTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::DoExecuteApiTestL( TPtrC aApiTestName, TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteApiTestL" );
+    if ( !aApiTestName.Compare( _L( "ExampleApiTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        ExampleApiTestL( aTestResult );
+        }
+    else if ( !aApiTestName.Compare( _L( "InitializationTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        InitializationTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "StartTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        StartTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "StopTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        StopTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "InterfaceInfoTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        InterfaceInfoTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "InterfaceLengthInfoTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        InterfaceLengthInfoTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "NumberOfInterfacesInfoTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        NumberOfInterfacesInfoTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "StartupPriorityInfoTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        StartupPriorityInfoTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "StateInfoTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        StateInfoTestL( aTestResult );    	
+    	}
+    else if ( !aApiTestName.Compare( _L( "OwnerTest" ) ) )
+    	{
+        STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" );
+        OwnerTestL( aTestResult );    	
+    	}
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Api test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteApiTestL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExecuteApiTest
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::ExampleApiTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleApiTestL" );
+	
+    aTestResult = ETestCasePassed;
+	
+	STIF_LOG( "[STIF_LOG] <<<ExampleApiTestL" );
+    }
+	
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExecuteModuleTest
+// -----------------------------------------------------------------------------	
+//
+TInt CUsbObexClassControllerTest::ExecuteModuleTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteModuleTest" );
+	
+    TInt res;
+    TUsbObexClassControllerTestResult testResult;
+    TPtrC moduleTestName( KNullDesC );
+
+    res = aItem.GetString( _L( "ExecuteModuleTest" ), moduleTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+
+    TRAP( res, DoExecuteModuleTestL( moduleTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteModuleTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteModuleTest" );
+    return KErrNone;
+    }		
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::DoExecuteModuleTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteModuleTestL" );
+    if ( !aModuleTestName.Compare( _L( "ExampleModuleTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Module test type: ExampleModuleTest" );
+        ExampleModuleTestL( aTestResult );
+        }
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Module test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteModuleTestL" );
+    }
+	
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExampleModuleTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::ExampleModuleTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleModuleTestL" );
+	
+    aTestResult = ETestCasePassed;
+	
+	STIF_LOG( "[STIF_LOG] <<<ExampleModuleTestL" );
+    }
+	
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExecuteBranchTest
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::ExecuteBranchTest( CStifItemParser& aItem )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExecuteBranchTest" );
+	
+    TInt res;
+    TUsbObexClassControllerTestResult testResult;
+    TPtrC branchTestName( KNullDesC );
+
+    res = aItem.GetString( _L( "ExecuteBranchTest" ), branchTestName );   
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "GetString failed with value: %d" ), res );
+        return res;
+        }
+
+    TRAP( res, DoExecuteBranchTestL( branchTestName, testResult ) );
+    if ( res != KErrNone )
+        {
+        iLog -> Log( _L( "DoExecuteBranchTestL error: %d"), res );
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    STIF_LOG( "[STIF_LOG] Test case passed" );
+	STIF_LOG( "[STIF_LOG] <<<ExecuteBranchTest" );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::DoExecuteBranchTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>DoExecuteBranchTestL" );
+    if ( !aBranchTestName.Compare( _L( "ExampleBranchTest" ) ) )
+        {
+        STIF_LOG( "[STIF_LOG] Branch test type: ExampleBranchTest" );
+        ExampleBranchTestL( aTestResult );
+        }
+    else
+        {
+        STIF_LOG( "[STIF_LOG] Branch test type: not found" );
+        User::Leave( KErrNotFound );
+        }
+	STIF_LOG( "[STIF_LOG] <<<DoExecuteBranchTestL" );
+    }	
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::ExampleBranchTestL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::ExampleBranchTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+	STIF_LOG( "[STIF_LOG] >>>ExampleBranchTestL" );
+	
+    aTestResult = ETestCasePassed;
+    
+	STIF_LOG( "[STIF_LOG] <<<ExampleBranchTestL" );
+	}
+	
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::InitializationTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::InitializationTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {    
+    InitializeTestObjectL();
+    STIF_ASSERT_NOT_NULL( iUsbClassControllerPlugIn );
+    DeleteTestObject();    
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::StartTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::StartTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    iUsbServiceState = EUsbServiceStarted;
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject = 
+            CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    iLog->Log( _L("UsbServiceState = %d, expected %d"), 
+                        iUsbServiceState, iUsbClassControllerPlugIn -> State());
+    STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() );    
+    DeleteTestObject();
+    activeTestObject -> Cancel();
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::StopTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::StopTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    iUsbServiceState = EUsbServiceIdle;
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject = 
+            CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    activeTestObject -> Stop();
+    CActiveScheduler::Start();
+    iLog->Log( _L("UsbServiceState = %d, expected %d"), 
+                           iUsbServiceState, iUsbClassControllerPlugIn -> State());
+    STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() );    
+    DeleteTestObject();
+    activeTestObject -> Cancel();
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::InterfaceInfoTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::InterfaceInfoTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    TUsbDescriptor aDescriptorInfo;
+    RImplInfoPtrArray implInfoArray;
+    CleanupClosePushL(implInfoArray);
+    TEComResolverParams resolverParams;
+    TInt numberOfInterfaces;
+    
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject = 
+            CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); 
+    resolverParams.SetDataType( KSrcsTransportUSB );
+    resolverParams.SetWildcardMatch( EFalse );
+    REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray );
+    numberOfInterfaces = implInfoArray.Count() * KObexNumInterfaces;
+    
+    iLog->Log( _L("Number of interfaces = %d, expected %d"), 
+                        numberOfInterfaces, aDescriptorInfo.iNumInterfaces);
+    STIF_ASSERT_EQUALS( numberOfInterfaces, aDescriptorInfo.iNumInterfaces );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();
+    CleanupStack::PopAndDestroy(&implInfoArray);    
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::InterfaceLengthInfoTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::InterfaceLengthInfoTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    TUsbDescriptor aDescriptorInfo;
+    RImplInfoPtrArray implInfoArray;
+    CleanupClosePushL(implInfoArray);
+    TEComResolverParams resolverParams;
+    TInt interfaceLength = 0;
+    
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject = 
+            CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo );
+    resolverParams.SetDataType( KSrcsTransportUSB );
+    resolverParams.SetWildcardMatch( EFalse );
+    REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray );
+    
+    iLog->Log( _L("Interface Length = %d, expected %d"), 
+                                    interfaceLength, aDescriptorInfo.iLength);
+    STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();
+    CleanupStack::PopAndDestroy(&implInfoArray);    
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    TUsbDescriptor aDescriptorInfo;
+    RImplInfoPtrArray implInfoArray;
+    CleanupClosePushL(implInfoArray);
+    TEComResolverParams resolverParams;
+    TInt interfaceLength = 0;
+    
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject =
+									CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo );
+    resolverParams.SetDataType( KSrcsTransportUSB );
+    resolverParams.SetWildcardMatch( EFalse );
+    REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray );
+    
+    iLog->Log( _L("Number of Interfaces this class controller is responsible for  = %d, expected %d"), 
+                                    interfaceLength, aDescriptorInfo.iNumInterfaces);
+    STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();
+    CleanupStack::PopAndDestroy(&implInfoArray);    
+    
+    // Case was executed
+    iLog->Log( _L("Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::StartupPriorityInfoTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::StartupPriorityInfoTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    TInt priority = 0;
+    
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject =
+									CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    priority = iUsbClassControllerPlugIn -> StartupPriority();
+
+    iLog->Log( _L("StartupPriorityInfoTestL:> Priority = %d "),priority );                                
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();    
+    
+    // Case was executed
+    iLog->Log( _L("StartupPriorityInfoTestL:> Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::StateInfoTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::StateInfoTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    TUsbServiceState state;
+    
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject =
+									CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    state = iUsbClassControllerPlugIn -> State();
+
+    iLog->Log( _L("StateTestL:> State = 0x%x "), state );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();    
+    
+    // Case was executed
+    iLog->Log( _L("StateInfoTestL:> Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::OwnerTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::OwnerTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {   
+    InitializeTestObjectL();
+    CUSBObexApiTestActiveObject* activeTestObject =
+									CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    (iUsbClassControllerPlugIn -> Owner()).UccnGetClassControllerIteratorL();
+
+    (iUsbClassControllerPlugIn -> Owner()).UccnError( KErrNone );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();    
+    
+    // Case was executed
+    iLog->Log( _L("OwnerTestL:> Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::CompareTestL
+// -----------------------------------------------------------------------------
+//
+TInt CUsbObexClassControllerTest::CompareTestL( TUsbObexClassControllerTestResult& aTestResult )
+    {
+    InitializeTestObjectL();   
+    
+    CUSBObexApiTestActiveObject* activeTestObject =
+									CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn );
+    activeTestObject -> Start();
+    CActiveScheduler::Start();
+    
+    //result = iUsbClassControllerPlugIn -> Compare( 	this, iUsbClassControllerPlugIn );
+    //iLog->Log( _L("CompareTestL:> Comparition Result = %d "),result );
+    
+    DeleteTestObject();
+    activeTestObject -> Cancel();    
+    
+    // Case was executed
+    iLog->Log( _L("CompareTestL:> Test Case Passed"));
+    aTestResult = ETestCasePassed;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::InitializeTestObjectL
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::InitializeTestObjectL()
+    {
+    iUsbClassControllerPlugIn = CUsbClassControllerPlugIn::NewL( TUid::Uid( 0x10281F2A ), *this);
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::DeleteTestObject
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::DeleteTestObject()
+    {
+    delete iUsbClassControllerPlugIn;
+    iUsbClassControllerPlugIn = NULL;
+    REComSession::FinalClose();
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::UccnGetClassControllerIteratorL
+// -----------------------------------------------------------------------------
+//
+CUsbClassControllerIterator* CUsbObexClassControllerTest::UccnGetClassControllerIteratorL()
+    {
+    iLog->Log( _L("get class controller iterator"));
+	return (CUsbClassControllerIterator *)NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbObexClassControllerTest::UccnError
+// -----------------------------------------------------------------------------
+//
+void CUsbObexClassControllerTest::UccnError( TInt aError )
+    {
+    iLog->Log( _L("class controller iterator error: %d"), aError );
+    }
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest_exe.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:   ?Description
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // UsbObexClassControllerTest_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- a/usbclasses/usbphoneasmodem/classcontroller/data/usbpammscfile.rss	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* 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/usbmscfileclasscontroller.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbphoneasmodem/classcontroller/group/usbmscfileclasscontroller.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -42,11 +42,6 @@
 TARGET          usbmscfileclasscontroller.rsc
 END
 
-start resource usbpammscfile.rss
-HEADER
-targetpath /private/101fe1db
-end
-
 LIBRARY         euser.lib
 LIBRARY         usbclasscontroller.lib
 LIBRARY         efsrv.lib
--- a/usbclasses/usbphoneasmodem/classcontroller/inc/usbpammscfile.rh	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbphoneasmodem/classcontroller/rom/usbmscfileclasscontroller.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -23,7 +23,6 @@
 #ifdef FF_USB_MODEM
 
 ECOM_PLUGIN(usbmscfileclasscontroller.dll, usbmscfileclasscontroller.rsc)
-data=DATAZ_\private\101fe1db\usbpammscfile.rsc    \private\101fe1db\usbpammscfile.rsc
 
 #endif
 
--- a/usbclasses/usbphoneasmodem/classcontroller/src/usbmscfileclasscontroller.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbphoneasmodem/classcontroller/src/usbmscfileclasscontroller.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -19,7 +19,7 @@
 #include <usb_std.h>
 #include <cusbclasscontrollerplugin.h>
 #include <centralrepository.h>
-#include <usbpammscfile.rsg>
+#include <usbms.rsg>
 #include <data_caging_path_literals.hrh> 
 #include "usbmscfileclasscontroller.h"
 #include "usbmscfile.h"
@@ -31,7 +31,7 @@
 _LIT( KMsCcPanicCategory, "UsbMscFileCc" );
 #endif
 
-_LIT( KUsbMsResource, "\\private\\101fe1db\\usbpammscfile.rsc" );
+_LIT( KUsbMsResource, "\\private\\101fe1db\\usbms.rsc" );
 
 /**
  Panic codes for the USB MSC File Class Controller.
--- a/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h	Wed Sep 01 12:20:49 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -21,21 +21,24 @@
 
 // USB masss storage Server Security Policy Definition
 
-const TUint KUsbMsServerRangeCount = 2;
+const TUint KUsbMsServerRangeCount = 3;
 
 const TInt KUsbMsServerRanges[KUsbMsServerRangeCount] = 
 	{
-	EMscFileSetupLu,              // NetworkControl	[SetupLogicalUnitL/StartL/Stop/Shutdown]
+	EMscFileStart,                // NetworkControl	[StartL/Stop]
+	EMscFileShutdown,				// DiskAdmin		[Shutdown]
     EMscFileShutdown + 1,         // fail (to KMaxInt)
 	};
 
 // Index numbers into KUsbMsServerElements[]
 const TInt KPolicyNetworkControl = 0;
+const TInt KPolicyDiskAdmin = 1;
 
 // Mapping IPCs to poicy element
 const TUint8 KUsbMsServerElementsIndex[KUsbMsServerRangeCount] = 
 	{
-	KPolicyNetworkControl,          // EMscFileSetupLu, EMscFileStart, EMscFileStop, EMscFileShutdown
+	KPolicyNetworkControl,          // EMscFileStart & EMscFileStop 
+	KPolicyDiskAdmin,			 	// EMscFileShutdown 
 	CPolicyServer::ENotSupported,   // EMscFileShutdown + 1 to KMaxTInt    
 	};
 
@@ -43,6 +46,7 @@
 const CPolicyServer::TPolicyElement KUsbMsServerElements[] = 
 	{
   		{ _INIT_SECURITY_POLICY_C1(ECapabilityNetworkControl), CPolicyServer::EFailClient },
+		{ _INIT_SECURITY_POLICY_C1(ECapabilityDiskAdmin), CPolicyServer::EFailClient},
 		// the EFailClient means that if the check fails 
         // the CheckFailed method with return KErrPermissionDenied
 	};
--- a/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/src/filesystemimage.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/src/filesystemimage.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -88,7 +88,7 @@
 
 TInt64 CFileSystemImage::Size()
 	{
-	TInt size = 0;
+	TInt size;
 	iFile.Size( size );
 	return size;
 	}
--- a/usbengines/usblocodplugin/group/usblocodplugin.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/group/usblocodplugin.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -48,3 +48,4 @@
 LIBRARY                 ECom.lib   // ECOM framework API
 LIBRARY                 usbman.lib // RUSB API (USB Manager)
 
+#include <usb/usblogger.mmh>
--- a/usbengines/usblocodplugin/inc/debug.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
-* 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:  Debug macros and declarations. 
-*
-*/
-
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-//////////////////////////////////////////////////////////////////////////////
-// Here are parameters need to be modified. 
-// Component name 
-#define MODULE_NAME "USBLcdPlugin"
-//////////////////////////////////////////////////////////////////////////////
-
-
-// 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
-
-// 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
-
-#include <flogger.h>
-
-#define DESC( x ) TPtrC( ( const TText* ) ( x ) )
-#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) )
-_LIT( KUsbLogDir, "USB" );
-_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" );
-
-// s: c string. 
-#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \
-                KUsbLogFile, EFileLoggingModeAppend, \
-                DESC8( "["MODULE_NAME"] "##s ) )
-
-// 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)
-
-// 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 )
-
-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>
-
-// Paramters same as above.
-#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str  ); }
-
-#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); }
-
-#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); }
-
-inline void LogBuf(const TDesC8& aBuf8)
-    {
-    LOG1("Buffer length = %d Buffer content:", aBuf8.Length());
-
-    TInt len(aBuf8.Length());
-    for (TInt i(0); i < len; ++i)
-        RDebug::Print(_L("Buffer[%d] = 0x%x"), i, aBuf8[i]);
-    }
-
-class TFuncLogger
-    {
-public:
-    TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName )
-        {
-        RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr());
-        }
-    ~TFuncLogger()
-        {
-        RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr());
-        }
-private:
-    TPtrC8 iFuncName;
-    };
-#endif // LOG_TO_FILE
-
-#define LEAVE( exp )  {volatile TInt err_ = exp; \
-        LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
-        User::Leave( err_ );}
-
-#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \
-        if(err__ < 0) LEAVE(err__);}
-
-#define PANIC( exp ) {volatile TInt err_ = exp; \
-        LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\
-        User::Panic( KUsbPanicModule, err_ );} 
-
-#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
-
-#define ASSERT_DEBUG( exp, code ) {if(!(exp)) PANIC(code)}
-
-#else // _DEBUG not defined 
-// ===========================================================================
-
-#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_DEBUG( exp, code )
-inline void LogBuf(const TDesC8& /*aBuf8*/)
-    {}
-// ===========================================================================
-#endif // _DEBUG
-// ===========================================================================
-#endif // DEBUG_H
-
-// End of File
--- a/usbengines/usblocodplugin/inc/usblcdactive.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/inc/usblcdactive.h	Wed Sep 01 12:20:49 2010 +0100
@@ -21,7 +21,7 @@
 #define USBLCDACTIVE_H
 
 #include <locodbearerpluginobserver.h>
-
+#include <usb/usblogger.h>
 
 /**
  *  Base Active Object class 
--- a/usbengines/usblocodplugin/inc/usblcdplugin.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/inc/usblcdplugin.h	Wed Sep 01 12:20:49 2010 +0100
@@ -22,7 +22,7 @@
 #include <e32property.h>
 #include <locodbearerplugin.h>
 #include "usblcdactive.h"
-
+#include <usb/usblogger.h>
 
 /**
  *  Class of EComm interface implementation
--- a/usbengines/usblocodplugin/src/usblcdactive.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/src/usblcdactive.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -20,8 +20,10 @@
 #include "usblcdactive.h"
 #include <UsbWatcherInternalPSKeys.h>
 #include <usbpersonalityids.h>
-#include "debug.h"
 
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "USBLcdPlugin");
+#endif
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -31,7 +33,7 @@
 //
 CUsbLcdActive* CUsbLcdActive::NewL(MLocodBearerPluginObserver& aObserver)
     {
-    LOG_FUNC
+    LOG_STATIC_FUNC_ENTRY
     CUsbLcdActive* self = new (ELeave) CUsbLcdActive(aObserver);
     CleanupStack::PushL(self);
     self->ConstructL();
@@ -72,13 +74,13 @@
     
     if( iStatus != KErrNone )
        {
-       LOG1("CUsbLcdActive::RunL() iStatus = %d",iStatus.Int());
+       LOGTEXT2(_L8("CUsbLcdActive::RunL() error = %d"),iStatus.Int());
        }
     else
        {
 
         TInt ret = iProperty.Get( value );
-        LOG2("Personality: %d, ret: %d", value, ret);  
+        LOGTEXT3(_L8("Personality: %d, ret: %d"), value, ret);  
         iProperty.Subscribe(iStatus);
         SetActive();
         if (ret == KErrNone)
@@ -150,7 +152,7 @@
 void CUsbLcdActive::HandleUsbPersonalityChange( TInt aNewPersonalityId )
     {
     LOG_FUNC
-    LOG1( "aNewPersonalityId: %d", aNewPersonalityId );
+    LOGTEXT2( _L8( "aNewPersonalityId: %d"), aNewPersonalityId );
     TBool isPcSuiteActive( EFalse );
     if ( ( aNewPersonalityId == KUsbPersonalityIdPCSuite ) ||
          ( aNewPersonalityId == KUsbPersonalityIdPCSuiteMTP ) )
--- a/usbengines/usblocodplugin/src/usblcdplugin.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/src/usblcdplugin.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -18,12 +18,14 @@
 
 
 #include "usblcdplugin.h"
-#include "debug.h"
 
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "USBLcdPlugin");
+#endif
 
 CUsbLcdPlugin* CUsbLcdPlugin::NewL(TLocodBearerPluginParams& aParams)
     {
-    LOG_FUNC
+    LOG_STATIC_FUNC_ENTRY
     CUsbLcdPlugin* self = new (ELeave) CUsbLcdPlugin(aParams);
     CleanupStack::PushL(self);
     self->ConstructL();
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -44,7 +44,7 @@
 ; None
 
 ; Install files
-"\epoc32\release\armv5\urel\USBLocodPluginTest.dll"-"c:\Sys\Bin\USBLocodPluginTest.dll"
+"\epoc32\release\armv5\udeb\USBLocodPluginTest.dll"-"c:\Sys\Bin\USBLocodPluginTest.dll"
 "..\init\USBLocodPluginTest_phone.ini"-"c:\testframework\testframework.ini"
 "..\conf\USBLocodPluginTest.cfg"-"c:\testframework\USBLocodPluginTest.cfg"
   
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -14,7 +14,10 @@
 @rem Description: 
 @rem
 
-call bldmake bldfiles
-call abld test build armv5
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
 call makesis USBLocodPluginTest_ats.pkg
-call signsis USBLocodPluginTest_ats.sis USBLocodPluginTest_ats.sisx rd.cer rd-key.pem
+call signsis USBLocodPluginTest_ats.sis USBLocodPluginTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -14,7 +14,10 @@
 @rem Description: 
 @rem
 
-call bldmake bldfiles
-call abld test build armv5
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
 call makesis USBLocodPluginTest_phone.pkg
-call signsis USBLocodPluginTest_phone.sis USBLocodPluginTest_phone.sisx rd.cer rd-key.pem
+call signsis USBLocodPluginTest_phone.sis USBLocodPluginTest_phone.sisx x:\rd.cer x:\rd-key.pem
--- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -68,6 +68,6 @@
 LIBRARY                 usbdescriptors.lib
 LIBRARY                 usbdi_utils.lib
 #endif
-LIBRARY                 hbcore.lib
+LIBRARY                 aknnotify.lib
 
 DEBUGLIBRARY            flogger.lib
--- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * 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"
@@ -19,32 +19,20 @@
 #define C_USBINDICATORNOTIFIER_H
 
 #include <e32base.h>
+#include <AknNotifyStd.h>       // SAknSmallIndicatorParams
+#include <AknNotifySignature.h> // SAknNotifierPackage
+#include <avkon.hrh>            // EAknIndicatorUSBConnection
 
 #include "cusbnotifier.h"
 #include "cusbvbusobserver.h"
 #include "cusbotgwatcher.h"
 
-class CHbIndicatorSymbian;
-
-_LIT(KUsbConnectingIndicator, "com.nokia.hb.indicator.usb.device.inprogress/1.0");  
-
-// indicator states
-enum  
-    {
-    EIndicatorStateOff,
-    EIndicatorStateOn,
-    EIndicatorConnecting
-    };
-  
 /**
  * Class implements functionality of showing/blinking usb indicator
  * Class does not provide method to get response from the user
  */
-NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public MUsbOtgWatcherStateObserver, MUsbVBusObserver
+NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbOtgWatcherStateObserver, MUsbVBusObserver
     {
-
-    friend class CtUsbOtgWatcher;
-    
 public:
     /**
      * Two-phased constructor.
@@ -81,6 +69,12 @@
      */
     virtual void VBusObserverErrorL(TInt aError);
 
+    // From base class CUsbNotifier
+    /**
+     * Start to show notifier
+     */
+    virtual void ShowL();
+
     /**
      * Stop showing notifier
      */
@@ -101,15 +95,28 @@
     void ConstructL();
 
     /**
-     * Set USB Connecting indicator On or Off
+     * Set USB indicator On or Off
      * @param aState Indicator states 
      */
-    void ToggleConnectingIndicator(TBool aEnable);
+    void SetIndicatorStateL(const TInt aState);
+
+    /**
+     * Show/hide static icon of the indicator. 
+     * If the indicator is blinking, stop blinking it and show/hide the static 
+     * form of the indicator.
+     * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator 
+     */
+    void ShowStaticL(TBool aVisible);
+
+    /**
+     * Blinks indicator
+     */
+    void BlinkL();
 
     /**
      * Sets indicator accordingly
      */
-    void SetIndicator();
+    void SetIndicatorL();
 
 private:
     // data
@@ -120,17 +127,11 @@
      */
     CUsbOtgWatcher& iOtgWatcher;
 
+    /**
+     * Current indicator state
+     */
+    TInt iIndicatorState;
 
-    /**    
-    * Pointer to a class for using Orbit indicator framework
-    * Owned  
-    */
-    CHbIndicatorSymbian* iUsbConnectingIndicator;
-    
-    /**    
-    * Whether we have activated the connecting indicator 
-    */    
-    TBool iConnectingIndicatorOn;
     };
 
 #endif // C_USBINDICATORNOTIFIER_H
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * 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"
@@ -15,8 +15,9 @@
  *
  */
 
+#include <AknSmallIndicator.h>
+#include <avkon.hrh>
 #include <usbuinotif.h>
-#include <hb/hbcore/hbindicatorsymbian.h>
 
 #include "cusbindicatornotifier.h"
 #include "cusbstate.h"
@@ -61,8 +62,6 @@
 
     // Unsubscribe from otg watcher states change notifications
     TRAP_IGNORE(iOtgWatcher.UnsubscribeL(*this));
-
-    delete iUsbConnectingIndicator; 
     }
 
 // ---------------------------------------------------------------------------
@@ -71,10 +70,14 @@
 //
 CUsbIndicatorNotifier::CUsbIndicatorNotifier(CUsbNotifManager& aNotifManager,
         CUsbOtgWatcher& aOtgWatcher) :
-        iOtgWatcher(aOtgWatcher)
+    CUsbNotifier(aNotifManager, KUsbUiNotifOtgIndicator, NULL), iOtgWatcher(
+            aOtgWatcher)
     {
     LOG_FUNC
-    
+
+    //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer
+    //when AVKON implements animation form of usb indicator.
+    iIndicatorState = EAknIndicatorStateOn;
     }
 
 // ---------------------------------------------------------------------------
@@ -85,21 +88,54 @@
     {
     LOG_FUNC
 
-    iUsbConnectingIndicator = CHbIndicatorSymbian::NewL();
-    
     // Subscribe for VBus change notifications
     iOtgWatcher.VBusObserver()->SubscribeL(*this);
 
     // Subscribe for otg watcher states change notifications
     iOtgWatcher.SubscribeL(*this);
 
-    iConnectingIndicatorOn = EFalse;
+    // check here for condition to set usb indicator
+    SetIndicatorL();
+    }
 
-    // check here for condition to set usb indicator
-    SetIndicator();
-   
+// ---------------------------------------------------------------------------
+// Show/hide static icon of the indicator. 
+// If the indicator is blinking, stop blinking it and show/hide the static 
+// form of the indicator.
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible)
+    {
+    LOG_FUNC
+
+    LOG1("aVisible = %d" , aVisible);
+
+    SetIndicatorStateL(aVisible
+                                ? EAknIndicatorStateOn
+                                   : EAknIndicatorStateOff);
     }
 
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::BlinkL()
+    {
+    LOG_FUNC
+
+    SetIndicatorStateL( EAknIndicatorStateAnimate );
+    }
+
+// ---------------------------------------------------------------------------
+// From base class CUsbNotifier
+// ---------------------------------------------------------------------------
+//
+void CUsbIndicatorNotifier::ShowL()
+    {
+    LOG_FUNC
+
+    ShowStaticL(ETrue);
+    }
 
 // ---------------------------------------------------------------------------
 // From CUsbNotifier
@@ -109,56 +145,31 @@
     {
     LOG_FUNC
 
-    ToggleConnectingIndicator( EFalse );
+    TRAP_IGNORE( ShowStaticL(EFalse) );
     }
 
 // ---------------------------------------------------------------------------
 // Set USB indicator On or Off
 // ---------------------------------------------------------------------------
 //
-void CUsbIndicatorNotifier::ToggleConnectingIndicator(TBool aEnable)
+void CUsbIndicatorNotifier::SetIndicatorStateL(const TInt aState)
     {
-    LOG1( "toggle connecting indicator = %d" , aEnable);
-    
-    TBool success = ETrue;
-    
-    if (aEnable && !iConnectingIndicatorOn)
-        {
-        success = iUsbConnectingIndicator->Activate(KUsbConnectingIndicator);   
-        LOG1( "calling CHbIndicatorSymbian::Activate(), returned %d", success);   
-        if (success)
-            {
-            iConnectingIndicatorOn = ETrue;
-            }  
-                   
-        }
-   
-    if (!aEnable && iConnectingIndicatorOn)
-        {
-        success = iUsbConnectingIndicator->Deactivate(KUsbConnectingIndicator); 
-        if (success)
-            {
-            iConnectingIndicatorOn = EFalse;
-            }  
-        LOG1( "calling CHbIndicatorSymbian::Deactivate(), returned %d", success);                  
-        }   
-        
-    // if success became false loading the indicator failed, log the error    
-    if (!success)
-        {
-        TInt error = iUsbConnectingIndicator->Error();
-        LOG1( "indicator error is %d", error);       
-        }         
+
+    LOG1( "USB indicator State = %d" , aState);
+
+    CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid(
+            EAknIndicatorUSBConnection));
+    indicator->SetIndicatorStateL(aState);
+    CleanupStack::PopAndDestroy(indicator); //indicator    
     }
-       
+
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
 void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState)
     {
-     LOG_FUNC
-    SetIndicator();
+    SetIndicatorL();
     }
 
 // ---------------------------------------------------------------------------
@@ -167,8 +178,7 @@
 //
 void CUsbIndicatorNotifier::VBusDownL()
     {
-     LOG_FUNC
-    SetIndicator();
+    SetIndicatorL();
     }
 
 // ---------------------------------------------------------------------------
@@ -177,8 +187,7 @@
 //
 void CUsbIndicatorNotifier::VBusUpL()
     {
-     LOG_FUNC
-    SetIndicator();
+    SetIndicatorL();
     }
 
 // ---------------------------------------------------------------------------
@@ -187,7 +196,6 @@
 //  
 void CUsbIndicatorNotifier::VBusObserverErrorL(TInt aError)
     {
-    LOG_FUNC
     // do nothing
     }
 
@@ -195,9 +203,8 @@
 // 
 // ---------------------------------------------------------------------------
 //  
-void CUsbIndicatorNotifier::SetIndicator()
+void CUsbIndicatorNotifier::SetIndicatorL()
     {
-    LOG_FUNC
     if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral)
         {
         // if B or peripheral, than other party (usbwatcher) takes care of usb indicator
@@ -205,16 +212,22 @@
         return;
         }
 
-    // if VBus up and we are not host -> show connecting indicator
+    // if VBus Up and we are host -> show indicator
     if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
+            && (iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAHost))
+        {
+        ShowStaticL(ETrue);
+        }
+    // if VBus up and we are not host -> Blink indicator
+    else if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp)
             && (iOtgWatcher.CurrentHostState()->Id() != EUsbStateHostAHost))
         {
-        ToggleConnectingIndicator( ETrue );
+        BlinkL();
         }
     else
     // Otherwise do not show indicator
         {
-        ToggleConnectingIndicator( EFalse );
+        ShowStaticL(EFalse);
         }
     }
 
--- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -37,10 +37,8 @@
 #include "errors.h"
 #include "debug.h"
 #include "panic.h"
-#ifndef STIF
 _LIT_SECURITY_POLICY_PASS( KAlwaysPassPolicy );
 _LIT_SECURITY_POLICY_C1( KLocalServicesPolicy, ECapabilityLocalServices );
-#endif
 
 // ---------------------------------------------------------------------------
 // 
@@ -900,7 +898,7 @@
 
     iUsbServiceRequest = CUsbServiceControl::ERequestUndefined;
 
-    TUsbServiceState serviceState = EUsbServiceIdle;
+    TUsbServiceState serviceState;
     TInt err = iUsb.GetServiceState(serviceState);
 
     if (KErrNone != err)
--- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -80,7 +80,7 @@
 
     LOG1( "aPersonalityId = %d" , aPersonalityId);
 
-    TUsbServiceState serviceState = EUsbServiceIdle;
+    TUsbServiceState serviceState;
     TInt err = iUsb.GetServiceState(serviceState);
 
     if (KErrNone != err)
@@ -182,7 +182,7 @@
     {
     LOG_FUNC
 
-    TUsbServiceState serviceState = EUsbServiceIdle;
+    TUsbServiceState serviceState;
     TInt err = iUsb.GetServiceState(serviceState);
 
     LOG2("err = %d; serviceState = %d" , err, serviceState);
@@ -270,7 +270,7 @@
         return;
         }
 
-    TUsbServiceState serviceState = EUsbServiceIdle;
+    TUsbServiceState serviceState;
     TInt err = iUsb.GetServiceState(serviceState);
 
     if (KErrNone != err)
--- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -189,7 +189,7 @@
         case KErrUsbBadDevice: // = -6656
         case KErrUsbBadHub:
         case KErrUsbEventOverflow:
-        case KErrUsbBadDeviceAttached:
+        
 
             // hosterrors.h
         case KErrUsbUnsupportedDevice:
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -245,9 +245,10 @@
             }
         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
+            LOG( "KErrUsbDeviceDetachedDuringDriverLoading" );
+            // do not show error, due to device is already detached
+            // Device Detachment will not come after this (it was not 
+            // normally attached yet), therefore emulate detachment 
             // content of aTdi is not important, due to detachment anyway
             DeviceDetachedL(aTdi);
             break;
--- a/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -17,6 +17,7 @@
 
 #include <usbuinotif.h>
 #include <d32usbdi_errors.h>
+#include <d32otgdi_errors.h>
 
 #include "cusbotgwatcher.h"
 #include "cusbstatehosthandledropping.h"
@@ -385,8 +386,8 @@
 
     switch (aMessage)
         {
-        // USBDI
-        case KEventUsbBadDeviceDetached:
+        // OTGDI
+        case KEventUsbOtgBadDeviceDetached:
             {
             LOG("BadDeviceDetached" );
             ChangeHostStateL( EUsbStateHostUndefined);
--- a/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -15,6 +15,7 @@
  *
  */
 
+#include <d32otgdi_errors.h>
 #include "cusbotgwatcher.h"
 #include "cusbstatehostundefined.h"
 
@@ -168,7 +169,8 @@
 // 
 // ---------------------------------------------------------------------------
 //
-void CUsbStateHostUndefined::DriverLoadPartialSuccessL(TDeviceEventInformation)
+void CUsbStateHostUndefined::DriverLoadPartialSuccessL(
+        TDeviceEventInformation)
     {
     LOG_FUNC
     }
@@ -208,7 +210,25 @@
 void CUsbStateHostUndefined::MessageNotificationReceivedL(TInt aMessage)
     {
     LOG_FUNC
-    LOG1( "Unhandled message aMessage = %d" , aMessage);
+    LOG1( "aMessage = %d" , aMessage);
+
+    switch (aMessage)
+        {
+        // OTGDI
+        case KErrUsbOtgBadDeviceAttached:
+            {
+            LOG( "BadDeviceAttached" );
+            HandleL(EUsbWatcherErrUnsupportedDevice,
+                    EUsbStateHostHandleDropping);
+            break;
+            }
+        default:
+            {
+            LOG1( "Unhandled message = %d" , aMessage);
+            break;
+            }
+
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/conf/UsbOtgWatcherTest.cfg	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/conf/UsbOtgWatcherTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -104,12 +104,6 @@
 delete tester
 [Endtest]
 
-[Test]
-title IndicatorNotifier_IndicatorActivateL
-create UsbOtgWatcherTest tester
-tester IndicatorNotifier_IndicatorActivateL MODULE
-delete tester
-[Endtest]
 
 
 // UsbOtgWatcherTest Branch Tests (... tc)
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -25,9 +25,7 @@
 TARGETTYPE      dll
 UID             0x1000008D 0x101FB3E3
 
-CAPABILITY      ALL -TCB
-//CAPABILITY	LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ CommDD
-//CAPABILITY CommDD NetworkControl WriteDeviceData NetworkServices LocalServices ProtServ	
+CAPABILITY CommDD NetworkControl WriteDeviceData NetworkServices LocalServices ProtServ	
 VENDORID                VID_DEFAULT
 
 DEFFILE         UsbOtgWatcherTest.def
@@ -56,7 +54,6 @@
 SOURCE                  mockrusb.cpp 
 SOURCE                  mockcusbtimer.cpp 
 SOURCE                  mockcusbnotifmanager.cpp
-SOURCE                  mockchbindicatorsymbian.cpp
 
 // real classes to be tested
 SOURCEPATH ../../../src
@@ -78,7 +75,6 @@
 SOURCE          CUsbStateHostDelayAttachedHandle.cpp
 SOURCE          CUsbStateHostUndefined.cpp
 SOURCE          cusbstatehostdelayhandle.cpp
-SOURCE          cusbindicatornotifier.cpp
 
 
 
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_ats.pkg	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -54,7 +54,7 @@
 "/epoc32/release/armv5/udeb/UsbOtgWatcherTest.exe"-"C:/Sys/Bin/UsbOtgWatcherTest.exe"
 
 "../conf/UsbOtgWatcherTest.cfg"-"E:/testing/conf/UsbOtgWatcherTest.cfg"
-"../init/UsbOtgWatcherTest.ini"-"E:/testing/init/UsbOtgWatcherTest_ats.ini"
+"../init/UsbOtgWatcherTest_ats.ini"-"E:/testing/init/UsbOtgWatcherTest.ini"
   
 ; Embedded SIS 
 ; None
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/UsbOtgWatcherTest.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/UsbOtgWatcherTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -232,9 +232,6 @@
         
         void DeviceDetached_SupportedDeviceL( TUsbOtgWatcherTestBlockParams& aParams,
                             TUsbOtgWatcherTestResult& aTestResult );
-   
-        void IndicatorNotifier_IndicatorActivateL( TUsbOtgWatcherTestBlockParams& aParams,
-                            TUsbOtgWatcherTestResult& aTestResult );
         
         //others method
         void SetupL();
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTestBlocks.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -26,7 +26,6 @@
 #include "mockusbman.h"
 #include "mockcusbnotifmanager.h"
 #include <usbpersonalityids.h>
-#include "cusbindicatornotifier.h"
 
 // EXTERNAL DATA STRUCTURES
 
@@ -146,11 +145,6 @@
                 {
                 TESTPARAM( eGetString, eTestOption1 )
                 }
- 
-     TESTENTRY( "IndicatorNotifier_IndicatorActivateL", CtUsbOtgWatcher::IndicatorNotifier_IndicatorActivateL )
-                {
-                TESTPARAM( eGetString, eTestOption1 )
-                }
     }
 
 // Add test block methods implementation here
@@ -619,29 +613,6 @@
     TRACE("<<CtUsbOtgWatcher::DeviceDetached_SupportedDeviceL");
     }
 
-void CtUsbOtgWatcher::IndicatorNotifier_IndicatorActivateL( TUsbOtgWatcherTestBlockParams& aParams,
-                            TUsbOtgWatcherTestResult& aTestResult )
-    {
-    TRACE(">> IndicatorNotifier_IndicatorActivateL"); 
-     
-    SetupL();
-    
-    CUsbNotifManager* notifManager = CUsbNotifManager::NewL(*iWatcher);
-    CleanupStack::PushL(notifManager);
-    CUsbIndicatorNotifier* notifier = CUsbIndicatorNotifier::NewL(*notifManager, *iWatcher);
-    CleanupStack::PushL(notifier);        
-    
-    notifier->ToggleConnectingIndicator(ETrue);
-    
-    STIF_ASSERT_TRUE(notifier->iConnectingIndicatorOn);
-                                
-    CleanupStack::PopAndDestroy(2);         
-    
-    TearDown();
-      
-    aTestResult = ETestCasePassed;                         
-    TRACE("<< IndicatorNotifier_IndicatorActivateL");                                   
-    }
 
 // Add other member functions implementation here
 
--- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockchbindicatorsymbian.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include <hb/hbcore/hbindicatorsymbian.h>
-#include "debug.h"
-
-EXPORT_C CHbIndicatorSymbian* CHbIndicatorSymbian::NewL()
-    {
-    CHbIndicatorSymbian *me = new CHbIndicatorSymbian();
-    me->ConstructL();
-    return me;
-    }
-
-EXPORT_C CHbIndicatorSymbian::~CHbIndicatorSymbian()
-{
-    delete d;
-}
-
-/*!
-    Activates an indicator of type \a aIndicatorType.
-    An extra parameter can be passed along to the indicator plugin.
-    Returns true, if the indicator is activated, false, if an error occurred.  
-
-    \sa Deactivate
- */
-EXPORT_C TBool CHbIndicatorSymbian::Activate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter)
-{
-    LOG( (" MockCHbIndicatorSymbian::Activate"));
-    return true;
-}
-
-/*!
-    Deactivates an indicator of type \a indicatorType.
-    An extra parameter can be passed along to the indicator plugin.
-    If indicator is not currently active, does nothing and returns true.
-    Returns false, if error occurred.
-
-    \sa Activate
- */
-EXPORT_C TBool CHbIndicatorSymbian::Deactivate(const TDesC& aIndicatorType, const CHbSymbianVariant* aParameter)
-{
-    return true;
-}
-
-/*!
-    Returns the last error code. The code is cleared when any other API function than error() is called.
-*/
-EXPORT_C TInt CHbIndicatorSymbian::Error() const
-{
-    return 0;
-}
-
-EXPORT_C void CHbIndicatorSymbian::SetObserver(MHbIndicatorSymbianObserver* aObserver)
-{
-	
-}
-
-CHbIndicatorSymbian::CHbIndicatorSymbian()
-{
-}
-
-void CHbIndicatorSymbian::ConstructL()
-{
-   
-}
\ No newline at end of file
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -92,14 +92,6 @@
 
 // USBRemotePersonalityTest Module Tests (... tc)
 
-/*
-[Test]
-title Example Api Test
-create USBRemotePersonalityTest tester
-tester ExecuteModuleTest ExampleModuleTest
-delete tester
-[Endtest]
-*/
 
 // Add new module tests here
 // ...
@@ -107,14 +99,6 @@
 
 // USBRemotePersonalityTest Branch Tests (... tc)
 
-/*
-[Test]
-title Example Api Test
-create USBRemotePersonalityTest tester
-tester ExecuteBranchTest ExampleBranchTest
-delete tester
-[Endtest]
-*/
 
 // Add new branch tests here
 // ...
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -14,7 +14,10 @@
 @rem Description: 
 @rem
 
-call bldmake bldfiles
-call abld test build armv5
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
 call makesis USBRemotePersonalityTest_ats.pkg
-call signsis USBRemotePersonalityTest_ats.sis USBRemotePersonalityTest_ats.sisx rd.cer rd-key.pem
+call signsis USBRemotePersonalityTest_ats.sis USBRemotePersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -14,7 +14,10 @@
 @rem Description: 
 @rem
 
-call bldmake bldfiles
-call abld test build armv5
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
 call makesis USBRemotePersonalityTest_phone.pkg
-call signsis USBRemotePersonalityTest_phone.sis USBRemotePersonalityTest_phone.sisx rd.cer rd-key.pem
+call signsis USBRemotePersonalityTest_phone.sis USBRemotePersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem
Binary file usbengines/usbwatcher/conf/usbwatcher.confml has changed
Binary file usbengines/usbwatcher/conf/usbwatcher_101F8801.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/data/numberofacmfunctions.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,9 @@
+[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	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -32,11 +32,23 @@
 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
+../rom/usbwatcher_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbwatcher_resources.iby)
 
-../rom/usbwatcher.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbwatcher.iby)
+//Usbmanrsc.iby is included by Symbian usbman.iby.
+// For l10n reaon it is not used but just to overwrite possible existing one
+../rom/usbmanrsc.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbmanrsc.iby)
 
 ../conf/usbwatcher.confml MW_LAYER_CONFML(usbwatcher.confml)
 ../conf/usbwatcher_101F8801.crml MW_LAYER_CRML(usbwatcher_101F8801.crml)
 
+../rom/mtp_symbian_temp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_symbian_temp.iby)
+
+// usbacmconfiguration.hby is included by usbacm.iby to define ACM configuration
+// We use this one to overwrite the os default one
+../rom/usbacmconfiguration.hby CORE_MW_LAYER_IBY_EXPORT_PATH(usbacmconfiguration.hby)
+
 // End of file
-
--- a/usbengines/usbwatcher/group/usbwatcherserver.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/group/usbwatcherserver.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -37,7 +37,7 @@
 SOURCE      cusbdevicelock.cpp
 SOURCE      cusbdevconstarter.cpp
 SOURCE      cusbglobalsystemstateobserver.cpp
-SOURCE      cusbindicatorhandler.cpp
+SOURCE      tusbindicatorhandler.cpp
 
 
 USERINCLUDE   ../inc
@@ -45,7 +45,36 @@
 MW_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE ../../usbotgwatcher/inc
 SYSTEMINCLUDE   /epoc32/include/usb
-SYSTEMINCLUDE   /epoc32/include/mw/hb/hbcore
+
+
+START RESOURCE usbman_pcsmtp.rss
+TARGET	usbman_pcsmtp
+TARGETPATH /private/101fe1db
+HEADER
+LANGUAGE_IDS
+END
+
+START RESOURCE usbman_pcs.rss
+TARGET	usbman_pcs
+TARGETPATH /private/101fe1db
+HEADER
+LANGUAGE_IDS
+END
+
+START RESOURCE usbman_pcspam.rss
+TARGET	usbman_pcspam
+TARGETPATH /private/101fe1db
+HEADER
+LANGUAGE_IDS
+END
+
+START RESOURCE usbman_pcsmtppam.rss
+TARGET	usbman_pcsmtppam
+TARGETPATH /private/101fe1db
+HEADER
+LANGUAGE_IDS
+END
+
 
 LIBRARY       euser.lib             // Kernel API
 LIBRARY       usbman.lib            // RUsb API (i.e. USB Manager's client API)
@@ -55,6 +84,5 @@
 LIBRARY       centralrepository.lib // Central Repository (USB Personality API)
 LIBRARY       featmgr.lib
 LIBRARY       usbotgwatcher.lib  //OTG
-LIBRARY       hbcore.lib
 
 DEBUGLIBRARY  flogger.lib            // File logging
--- a/usbengines/usbwatcher/inc/cusbindicatorhandler.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2009-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:  Header file for class CUsbIndicatorHandler
-*
-*/
-
-
-#ifndef CUSBINDICATORHANDLER_H
-#define CUSBINDICATORHANDLER_H
-
-#include <bldvariant.hrh>
-#include <usbstates.h>
-#include <e32std.h>
-#include <e32base.h>
-
-class CHbIndicatorSymbian;
-class CHbSymbianVariant;
-
-/**
-*  USB indicator handler class for device side.
-*
-*  This class shows USB indicator when device state changes to Configured, 
-*  and hides USB indicator when device leaves Configured state. Suspended 
- * state does not change the indicator.
-*
-*  @since TB9.2
-*/
-NONSHARABLE_CLASS( CUsbIndicatorHandler ) : public CBase
-    {
-    friend class CtTUsbIndicatorHandler;
-
-public:
-    // Constructors and destructor
-
-    /**
-     * Destructor.
-     */
-    ~CUsbIndicatorHandler();
-
-    /**
-     * Two-phased constructor.
-     */
-    static CUsbIndicatorHandler* NewL();
-
-    /**
-     * Two-phased constructor.
-     */
-    static CUsbIndicatorHandler* NewLC();
-
-private:
-
-    /**
-     * Constructor for performing 1st stage construction
-     */
-    CUsbIndicatorHandler();
-
-    /**
-     * EPOC default constructor for performing 2nd stage construction
-     */
-    void ConstructL();
-
-
-public:
-        
-	/**
-     * Set USB indicator (On/Off, maybe more in future) according to 
-     * the change of USB device state
-     *
-     * @param aStateOld previous USB device state
-     * @param aStateNew current USB device state
-     */
-    void HandleDeviceStateChangeL( TUsbDeviceState aStateOld, 
-            TUsbDeviceState aStateNew, TInt aPersonality );
-            
-private:
-	/**
-     * Show USB connected indicator (On/Off, maybe more in future)
-     *
-     * @since TB9.2
-     * @param aActivate activate or deactivate the indicator
-     * @param aPersonality the personality id
-     */
-    void ShowUsbConnectedIndicatorL( TBool aActivate, TInt aPersonality );
-
-	/**
-     * Show USB addressed state indicator (On/Off, maybe more in future)
-     *
-     * @since TB9.2
-     * @param aActivate activate or deactivate the indicator
-     */    
-    void ShowUsbAddressedIndicator( TBool aActivate );
-	
-private:
-    /**
-     * The device state before suspend.
-     * Used to filter out suspend from others;
-     */
-    TUsbDeviceState iDevStateB4Suspend;
-    
-    CHbIndicatorSymbian* iSymbianIndicator;
-    
-    CHbSymbianVariant* iIndicatorParameters;
-    
-    // remember whether indicators are active or not
-    // simplifies little bit the state handling in HandleDeviceStateChange 
-    TBool iAddressedIndicatorActive;
-    TBool iConnectedIndicatorActive;
-  
-    };
-    
-
-#endif   // CUSBINDICATORHANDLER_H
-
-// End of File
--- a/usbengines/usbwatcher/inc/cusbwatcher.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/inc/cusbwatcher.h	Wed Sep 01 12:20:49 2010 +0100
@@ -30,7 +30,7 @@
 #include "debug.h"
 #include "musbwatchernotify.h"
 #include "cusbwatchersession.h"
-#include "cusbindicatorhandler.h"
+#include "tusbindicatorhandler.h"
 
 
 class CUsbActiveState;
@@ -180,7 +180,7 @@
      * @param aStateOld old device state
      * @param aStateNew new device state
      */
-    void StateChangeNotifyL( TUsbDeviceState aStateOld, 
+    void StateChangeNotify( TUsbDeviceState aStateOld, 
             TUsbDeviceState aStateNew );
     
    
@@ -427,7 +427,7 @@
     /*
      * USB indicator handler to handle device side indicator
      */
-    CUsbIndicatorHandler* iUsbIndicatorHandler;
+    TUsbIndicatorHandler iUsbIndicatorHandler;
     
     /*
      * Starting mode is normal?
--- a/usbengines/usbwatcher/inc/usbvariation.rh	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/inc/usbvariation.rh	Wed Sep 01 12:20:49 2010 +0100
@@ -29,6 +29,7 @@
 #define per_productId_MediaTransfer 0x4A4
 #define per_productId_PCSuiteMTP per_productId_PCSuite
 #define per_productId_ModemInstall      0x0396
+#define per_productId_RNDIS 0x03A3
 
 #define per_bcdDevice 0x0100
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/loc/usbman.loc	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* 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:  Localization strings for project usbwatcher
+*
+*/
+
+
+//d: List item text of USBUI Setting view
+//d: for "Ovi suite". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_ovisuite "Ovi Suite"
+
+//d: List item text of USBUI Setting view
+//d: for "Mass storage". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_mass_storage "Mass storage"
+
+//d: List item text of USBUI Setting view
+//d: for "Image print". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_ptp "Image print"
+
+//d: List item text of USBUI Setting view
+//d: for "Media transfer". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_mtp "Media transfer"
+
+//d: List item text of USBUI Setting view
+//d: for "Ovi Suite". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_ovisuite_mtp "Ovi Suite"
+
+//d: List item text of USBUI Setting view
+//d: for "Connect to internet". 
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_quickconnect "Connect PC to Web"
+
+//d: List item text of USBUI Setting view, not to be localized
+//d: for "RNDIS"
+//d: This text is also used in USB connected popup
+//l: list_double_large_graphic_pane_t1_cp2
+//w:
+//r: 5.2
+//
+#define qtn_usb_mode_rndis "Connect PC with RNDIS"
+
+//d: text describing the mass storage mode, shown in preview pop up in USB UI Setting 
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_mass_storage "Access your phone’s memory card from the device you are connected to."
+
+//d: text describing the ovi suite mode, shown in preview pop up in USB UI setting
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_ovi_suite "Manage your phone with Ovi Suite and sync your media content."
+
+//d: text describing the media transfer mode, shown in preview pop up in USB UI setting
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_mtp "Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos."
+
+//d: text describing the picture transfer mode, shown in preview pop up in USB UI setting
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_ptp "Print pictures with a compatible printer."
+
+//d: text describing the Phone as modem mode, shown in preview pop up in USB UI setting
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_pam "Use your mobile phone as a modem"
+
+//d: text describing the Phone as RNDIS mode, shown in preview pop up in USB UI setting, not to be localized
+//l: popup_preview_text_window/opt6
+//r: 5.2
+#define qtn_usb_mode_msg_rndis "Use your mobile phone as RNDIS"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,211 @@
+/*
+* 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: Temporary include MTP components released by ex-Symbian
+*
+*/
+
+
+#ifndef MTPSYMBIANTEMP_IBY__
+#define MTPSYMBIANTEMP_IBY__
+
+// mtp_framework.iby
+#ifndef MTP_FRAMEWORK_IBY
+#define MTP_FRAMEWORK_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Framework cenrep file (temporary until this can be described in ConfML)
+//data=ZPRIVATE\10202be9\10282fcc.cre					private\10202be9\10282fcc.cre
+// MTP Data Types Library
+file=ABI_DIR\BUILD_DIR\mtpdatatypes.dll    system\libs\mtpdatatypes.dll
+// MTP Framework Library
+file=ABI_DIR\BUILD_DIR\mtpframework.dll    			system\libs\mtpframework.dll
+// MTP SERVER
+file=ABI_DIR\BUILD_DIR\mtpserver.exe    system\libs\mtpserver.exe
+// MTP Client
+file=ABI_DIR\BUILD_DIR\mtpclient.dll    system\libs\mtpclient.dll
+// MTP Generic Transport API
+file=ABI_DIR\DEBUG_DIR\mtptransportapi.dll  system\libs\mtptransportapi.dll
+// MTP Data Provider API
+file=ABI_DIR\BUILD_DIR\mtpdataproviderapi.dll    system\libs\mtpdataproviderapi.dll
+// MTP Device Data Provider Extension API
+file=ABI_DIR\BUILD_DIR\mtpdevdpextnapi.dll    system\libs\mtpdevdpextnapi.dll
+// MTP Data Provider Utility
+file=ABI_DIR\BUILD_DIR\mtpdataproviderutility.dll    system\libs\mtpdataproviderutility.dll
+// MTP Proxy Data Provider
+ECOM_PLUGIN(mtpproxydp.dll, mtpproxydp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\102827B1.rsc  resource\mtp\102827B1.rsc 
+// MTP dummydp resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\dummydp.rsc  resource\mtp\dummydp.rsc 
+// MTP Service Config resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\services.rsc  resource\mtp\services.rsc 
+// MTP Backup registration file
+data=EPOCROOT##epoc32\data\Z\private\102827a2\backup_registration.xml  private\102827a2\backup_registration.xml
+//MTP device icon property file 
+data=EPOCROOT##epoc32\data\Z\private\102827a2\mtpdevice.ico  private\102827a2\mtpdevice.ico
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_FRAMEWORK_IBY
+
+// mtp_filedp.iby
+#ifndef MTP_FILEDP_IBY
+#define MTP_FILEDP_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtpfiledp.dll, mtpfiledp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\102827B0.rsc  resource\mtp\102827B0.rsc 
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_FILEDP_IBY
+
+// mtp_usbsic.iby
+#ifndef MTP_USBSIC_IBY
+#define MTP_USBSIC_IBY
+#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB)
+//MTP USB Data Types Library
+file=ABI_DIR\BUILD_DIR\mtpusbdatatypes.dll				system\libs\mtpusbdatatypes.dll
+//MTP USB Still Image Class Controller
+ECOM_PLUGIN(mtpusbsiccc.dll, mtpusbsiccc.rsc)
+//MTP USB SIC transport plugin
+ECOM_PLUGIN(mtpusbsicimp.dll, mtpusbsicimp.rsc)
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_USBSIC_IBY
+
+// mtppictbridgedp.iby
+#ifndef MTPPICTBRIDGEDP_IBY
+#define MTPPICTBRIDGEDP_IBY
+#ifdef __USB_PICTBRIDGE 
+// MTP data provider
+ECOM_PLUGIN(mtppictbridgedp.dll, mtppictbridgedp.rsc)
+data=EPOCROOT##epoc32\data\Z\resource\mtp\2001FE3C.rsc  resource\mtp\2001FE3C.rsc   
+#endif
+#endif //MTPPICTBRIDGEDP_IBY
+
+// rptp.iby
+#ifndef RPTP_IBY
+#define RPTP_IBY
+file=ABI_DIR\BUILD_DIR\rptp.dll        system\libs\rptp.dll
+#endif //RPTP_IBY
+
+// mtp_imagedp.iby
+#ifndef MTPIMAGEDP_IBY
+#define MTPIMAGEDP_IBY
+ECOM_PLUGIN(mtpimagedp.dll,mtpimagedp.rsc)
+data=EPOCROOT##epoc32\data\Z\resource\mtp\2001FCAE.rsc  resource\mtp\2001FCAE.rsc 
+#endif MTPIMAGEDP_IBY
+
+// mtp_statusservice.iby
+#ifndef MTP_STATUSSERVICE_IBY
+#define MTP_STATUSSERVICE_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtpstatusservice.dll, mtpstatusservice.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\2001a97f.rsc  resource\mtp\2001a97f.rsc 
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_STATUSSERVICE_IBY
+
+// mtp_metadataservice.iby
+#ifndef MTP_METADATAERVICE_IBY
+#define MTP_METADATASERVICE_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtpmetadataservice.dll, mtpmetadataservice.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\2001A9A3.rsc  resource\mtp\2001A9A3.rsc
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_METADATASERVICE_IBY
+
+// mtp_wmpextndp.iby
+#ifndef MTP_WMPEXTNDP_IBY
+#define MTP_WMPEXTNDP_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtpwmpextndp.dll, mtpwmpextndp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\1028716c.rsc  resource\mtp\1028716c.rsc 
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_WMPEXTNDP_IBY
+
+// devicedp
+#ifndef MTP_DEVICEDP_IBY
+#define MTP_DEVICEDP_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Device Data Provider
+ECOM_PLUGIN(mtpdevicedp.dll, mtpdevicedp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\102827AF.rsc  resource\mtp\102827AF.rsc 
+#endif //SYMBIAN_EXCLUDE_MTP
+#endif  //MTP_DEVICEDP_IBY
+
+// pimproxy
+#ifndef MTP_PIMPROXY_IBY
+#define MTP_PIMPROXY_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP PIM proxy
+file=ABI_DIR\BUILD_DIR\mtppimproxy.dll    system\libs\mtppimproxy.dll
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_PIMPROXY_IBY
+
+// calendardp
+#ifndef MTP_CALENDARDP_IBY
+#define MTP_CALENDARDP_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtpcalendardp.dll, mtpcalendardp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\102871B8.rsc  resource\mtp\102871B8.rsc 
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif // MTP_CALENDARDP_IBY
+
+// taskdp
+#ifndef MTP_TASKDP_IBY
+#define MTP_TASKDP_IBY
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+// MTP Data Provider API
+ECOM_PLUGIN(mtptaskdp.dll, mtptaskdp.rsc)
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\10287013.rsc  resource\mtp\10287013.rsc 
+#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
+#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB)
+//MTP over Bluetooth Data Types Library
+file=ABI_DIR\BUILD_DIR\mtpbtdatatypes.dll               system\libs\mtpbtdatatypes.dll
+//MTP over Bluetooth transport plugin
+ECOM_PLUGIN(mtpbt.dll, mtpbt.rsc)
+#endif // SYMBIAN_EXCLUDE_MTP
+#endif// MTP_BT_IBY
+
+#ifndef MTP_CONTROLLER_IBY
+#define MTP_CONTROLLER_IBY
+#if !defined (SYMBIAN_EXCLUDE_MTP)
+//MTP Controller LOCOD service plugin
+ECOM_PLUGIN(mtpcontroller.dll, mtpcontroller.rsc)
+#endif// SYMBIAN_EXCLUDE_MTP
+#endif// MTP_CONTROLLER_IBY
+#endif // MTPSYMBIANTEMP_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/rom/usbacmconfiguration.hby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Configuration for ACM functions
+*
+*/
+
+#ifndef USBACMCONFIGURATION_HBY
+#define USBACMCONFIGURATION_HBY
+
+#define USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS  2
+
+// USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM[X] is referring to the Xth ACM *function*
+// which is accessed by the (X-1)th ACM *port*
+
+#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM1  1
+//0x01 - code taken from USBCDC 1.1 Table 17- Hayes compatible modem
+
+#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM2  255
+//0xFF - Vendor-specific
+
+//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM3  1
+//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM4  1
+//#define USBACM_PATCHDATA_KUSBACMPROTOCOLNUMACM5  1
+
+// To enable an ACM function, you need to change the 
+// value of USBACM_PATCHDATA_KUSBACMNUMBEROFACMFUNCTIONS,
+// uncomment one define line then replace the protocol number with
+// the ACM protocol number expected.
+//
+
+#endif // USBACMCONFIGURATION_HBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/rom/usbmanrsc.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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 Manager resource IBY dummy
+*
+*/
+
+
+#ifndef __USBMANRSC_IBY__
+#define __USBMANRSC_IBY__
+
+//This file replaces the Symbian usbmanrsc.iby.
+
+#endif // __USBMANRSC_IBY__
--- a/usbengines/usbwatcher/rom/usbwatcher.iby	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/rom/usbwatcher.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -24,6 +24,7 @@
 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/rom/usbwatcher_resources.iby	Wed Sep 01 12:20:49 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: personality resources for UsbMan.
+*
+*/
+#ifndef __USBWATCHERRESOURCES_IBY__
+#define __USBWATCHERRESOURCES_IBY__
+
+#ifdef __USB
+
+#ifdef __MEDIA_TRANSFER_PROTOCOL
+
+#ifdef FF_USB_MODEM
+data=DATAZ_\private\101fe1db\usbman_pcsmtppam.rsc    \private\101fe1db\usbman.rsc
+#else // !FF_USB_MODEM
+data=DATAZ_\private\101fe1db\usbman_pcsmtp.rsc    \private\101fe1db\usbman.rsc
+#endif // FF_USB_MODEM
+
+#else // !__MEDIA_TRANSFER_PROTOCOL
+
+#ifdef FF_USB_MODEM
+data=DATAZ_\private\101fe1db\usbman_pcspam.rsc    \private\101fe1db\usbman.rsc
+#else // !FF_USB_MODEM
+data=DATAZ_\private\101fe1db\usbman_pcs.rsc    \private\101fe1db\usbman.rsc
+#endif // FF_USB_MODEM
+
+#endif // __MEDIA_TRANSFER_PROTOCOL
+
+#endif // __USB
+
+#endif // __USBWATCHERRESOURCES_IBY__
\ No newline at end of file
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -268,9 +268,10 @@
     iDeviceState = aStateNew;        
     switch ( aStateNew )
         {
-        case EUsbDeviceStateConfigured:
+        case EUsbDeviceStateAddress:
             {
-            if ((aStateOld != EUsbDeviceStateSuspended) && (ESwStateCharging
+            if ((aStateOld != EUsbDeviceStateSuspended) && (aStateOld
+                    != EUsbDeviceStateConfigured) && (ESwStateCharging
                     != CUsbGlobalSystemStateObserver::GlobalSystemState()))
                 {
                 iPersonalityParams->PersonalityNotifier().ShowQuery(
--- a/usbengines/usbwatcher/src/cusbactivestate.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/src/cusbactivestate.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -56,7 +56,7 @@
     // start USB if cable is pluged-in at bootup
     if( EUsbDeviceStateUndefined != iCurrentState )
         {
-        iOwner.StateChangeNotifyL( iPreviousState, iCurrentState );
+        iOwner.StateChangeNotify( iPreviousState, iCurrentState );
         iPreviousState = iCurrentState;
         }
     iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState, iStatus );
@@ -106,7 +106,7 @@
         {
         LOG2( "USB device state changed: %d ==> %d", iPreviousState,
             newState );
-        iOwner.StateChangeNotifyL( iPreviousState, newState );
+        iOwner.StateChangeNotify( iPreviousState, newState );
         iPreviousState = newState;
         }
      else
--- a/usbengines/usbwatcher/src/cusbindicatorhandler.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-* Copyright (c) 2009-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:  This implements TUsbIndicatorHandler class.
-*
-*/
-
-#include <e32std.h>
-#include <hbindicatorsymbian.h>
-#include <hbsymbianvariant.h>
-#include <usbman.h>
-#include "debug.h"
-#include "cusbindicatorhandler.h"
-
-
-// ---------------------------------------------------------------------------
-// C++ Constructor 
-// ---------------------------------------------------------------------------
-//
-
-CUsbIndicatorHandler::CUsbIndicatorHandler()
-    {
-    // No implementation required
-    }
-
-CUsbIndicatorHandler::~CUsbIndicatorHandler()
-    {
-    delete iSymbianIndicator;  
-
-    }
-
-CUsbIndicatorHandler* CUsbIndicatorHandler::NewLC()
-    {
-    CUsbIndicatorHandler* self = new (ELeave) CUsbIndicatorHandler();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    return self;
-    }
-
-CUsbIndicatorHandler* CUsbIndicatorHandler::NewL()
-    {
-    CUsbIndicatorHandler* self = CUsbIndicatorHandler::NewLC();
-    CleanupStack::Pop(); // self;
-    return self;
-    }
-
-void CUsbIndicatorHandler::ConstructL()
-    {
-     LOG_FUNC    
-        
-    iDevStateB4Suspend = EUsbDeviceStateUndefined;
-    iSymbianIndicator = CHbIndicatorSymbian::NewL();
-    }
-
-// ---------------------------------------------------------------------------
-// Change USB Indicator 
-// ---------------------------------------------------------------------------
-//
-void CUsbIndicatorHandler::HandleDeviceStateChangeL( TUsbDeviceState aStateOld, 
-            TUsbDeviceState aStateNew, TInt aPersonality )
-    {
-    LOG_FUNC
-
-    LOG2( "USB device state changed: %d ==> %d", aStateOld, aStateNew );
-    
-    if ( EUsbDeviceStateAddress == aStateNew ) // Entering addressed state
-        {
-       // going down configured -> addressed     
-       if( ( EUsbDeviceStateConfigured == aStateOld ) ||
-            ( ( EUsbDeviceStateSuspended == aStateOld ) &&
-              ( EUsbDeviceStateConfigured == iDevStateB4Suspend ) ) ) 
-            {
-            ShowUsbConnectedIndicatorL( EFalse, aPersonality );
-            }
-        
-        // connecting indicator will be shown when addressed state is entered going up or down
-        // note that when disconnecting the cable (no need to show connecting indicator)
-        // the state change is CONFIGURED => SUSPENDED => POWERED => UNDEFINED    
-        // filter out case of addressed -> suspended -> addressed
-        if ( ( EUsbDeviceStateSuspended != aStateOld ) || 
-             ( EUsbDeviceStateAddress != iDevStateB4Suspend) )
-            {
-            ShowUsbAddressedIndicator( ETrue );
-            }
-        }
-    
-    else if ( EUsbDeviceStateConfigured == aStateNew ) // Entering configured state 
-        {
-        // filter out case of configed -> suspended -> configed
-        if ( ( EUsbDeviceStateSuspended != aStateOld ) || 
-             ( EUsbDeviceStateConfigured != iDevStateB4Suspend) )
-            {
-            ShowUsbAddressedIndicator( EFalse );    
-            ShowUsbConnectedIndicatorL( ETrue, aPersonality );
-            }
-        }
-     
-    else if ( EUsbDeviceStateUndefined == aStateNew ) // Entering undefined
-        {
-        ShowUsbAddressedIndicator( EFalse );
-        ShowUsbConnectedIndicatorL( EFalse, aPersonality );
-        }   
-        
-        
-    else if ( EUsbDeviceStateSuspended == aStateNew )
-    // If current state is suspend, we do not change the indicator, but save
-    // the previous state
-        {
-        iDevStateB4Suspend = aStateOld;
-        }
-    else // New device state is not configured, nor suspended, nor addressed
-        {
-        ShowUsbConnectedIndicatorL( EFalse, aPersonality );       
-        } 
-  
-    }
-    
-// ---------------------------------------------------------------------------
-// Show USB Indicator
-// ---------------------------------------------------------------------------
-//
-void CUsbIndicatorHandler::ShowUsbConnectedIndicatorL( TBool aActivate, TInt aPersonality )
-    {
-     LOG_FUNC    
-     TBool success = EFalse;
-     _LIT(KUsbIndicator, "com.nokia.hb.indicator.usb.device.connected/1.0");  
-     
-     if (aActivate)
-        {
-        RUsb usbman;
-        User::LeaveIfError(usbman.Connect());
-        CleanupClosePushL(usbman);
-        HBufC* description = NULL;
-        User::LeaveIfError(usbman.GetDescription(aPersonality,
-             description));
-        CleanupStack::PopAndDestroy(&usbman);
-        CleanupStack::PushL(description);
-        CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(description, CHbSymbianVariant::EDes);
-        CleanupStack::PopAndDestroy(description);       
-        success = iSymbianIndicator->Activate(KUsbIndicator, parameters);   
-        LOG1( "calling CHbIndicatorSymbian::Activate(), returned %d", success);
-        if (!success)
-            {
-            TInt indicatorerror = iSymbianIndicator->Error();
-            LOG1( "activating the indicator failed with %d", indicatorerror);
-            }
-        else
-            {
-            iConnectedIndicatorActive = ETrue;    
-            }    
-        delete parameters;  
-        }    
-     else if (iConnectedIndicatorActive)
-        {
-        success = iSymbianIndicator->Deactivate(KUsbIndicator); 
-        LOG1( "calling CHbIndicatorSymbian::Deactivate(), returned %d", success);
-        if (success)
-            {
-            iConnectedIndicatorActive = EFalse;    
-            }        
-        LOG( "calling CHbIndicatorSymbian::Deactivate()");
-        }
-   
-   }
-
-void CUsbIndicatorHandler::ShowUsbAddressedIndicator( TBool aActivate  )
-    {
-     LOG_FUNC    
-     TBool success = EFalse;
-     _LIT(KUsbIndicator, "com.nokia.hb.indicator.usb.device.inprogress/1.0");  
-     if (aActivate)
-        {
-        success = iSymbianIndicator->Activate(KUsbIndicator);   
-        LOG1( "calling CHbIndicatorSymbian::Activate(), returned %d", success);
-        if (!success)
-            {
-            TInt indicatorerror = iSymbianIndicator->Error();
-            LOG1( "activating the indicator failed with %d", indicatorerror);
-            }
-        else
-            {
-            iAddressedIndicatorActive = ETrue;    
-            }
-        }    
-     else if (iAddressedIndicatorActive)
-        {
-        success = iSymbianIndicator->Deactivate(KUsbIndicator); 
-        LOG1( "calling CHbIndicatorSymbian::Deactivate(), returned %d", success);
-        if (success)
-            {
-            iAddressedIndicatorActive = EFalse;    
-            }
-        LOG( "calling CHbIndicatorSymbian::Deactivate()");
-        }
-   }
-   
-
-
-// End of file
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -26,6 +26,7 @@
 #include <UsbWatcherInternalPSKeys.h>
 #include <e32property.h>
 #include <startupdomainpskeys.h> //for global system state
+#include <featmgr.h> //FeatureManager
 
 #include "cusbwatcher.h"
 #include "cusbactivestate.h"
@@ -106,7 +107,6 @@
     iGlobalStateObserver = CUsbGlobalSystemStateObserver::NewL( *this );
     iUsbDevConStarter = CUsbDevConStarter::NewL();
     iActiveState = CUsbActiveState::NewL( iUsbMan, *this );
-    iUsbIndicatorHandler   = CUsbIndicatorHandler::NewL();
     }
 
 // ----------------------------------------------------------------------------
@@ -148,7 +148,6 @@
     delete iUsbDeviceLock;
     delete iGlobalStateObserver;
     iSupportedPersonalities.Close();
-    delete iUsbIndicatorHandler;
     }
 
 // ----------------------------------------------------------------------------
@@ -219,7 +218,7 @@
 // This method notifies CUsbWatcher class about USB state changes.
 // ----------------------------------------------------------------------------
 //
-void CUsbWatcher::StateChangeNotifyL( TUsbDeviceState aStateOld,  
+void CUsbWatcher::StateChangeNotify( TUsbDeviceState aStateOld,  
         TUsbDeviceState aStateNew )
     {
     LOG_FUNC
@@ -228,7 +227,7 @@
     // Not show USB indicator in charging mode
     if ( iNormalStart ) 
         {
-        iUsbIndicatorHandler->HandleDeviceStateChangeL( aStateOld, aStateNew, iPersonalityId );
+        iUsbIndicatorHandler.HandleDeviceStateChange( aStateOld, aStateNew );
         }
         
     if ( IsDeviceA() ) // Will be handled by UsbOtgWatcher
@@ -984,14 +983,31 @@
 TInt CUsbWatcher::GetChargingPersonalityId( TInt& aPersonalityId )
     {
     LOG_FUNC
+    
+    TUint32 chargingKey( KUsbWatcherChargingDefaultPersonality );
+    // Check if it is now in certificate test mode
+    TRAPD(ret, FeatureManager::InitializeLibL());
+    LOG1( "FeatureManager::InitializeLibL(): %d", ret );
+    if ( KErrNone == ret )
+        {
+        if( FeatureManager::FeatureSupported(
+             KFeatureIdEnableIsiCommunicationInUsbChargingMode  ) )
+            {
+            chargingKey = KUsbWatcherCertTestChargingPersonality;
+            LOG( "KFeatureIdEnableIsiCommunicationInUsbChargingMode true" );
+            }
+        else
+            {
+            LOG( "KFeatureIdEnableIsiCommunicationInUsbChargingMode false" );
+            }
+        FeatureManager::UnInitializeLib();
+        }
 
-    TInt ret = iPersonalityRepository->Get(
-            KUsbWatcherChargingDefaultPersonality, aPersonalityId );
+    ret = iPersonalityRepository->Get( chargingKey, aPersonalityId );
+    LOG2( "ret = %d ( aPersonalityId: %d )", ret, aPersonalityId );
     return ret;
     }
 
-
-
 // ----------------------------------------------------------------------------
 // Check current A or B device state
 // ----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/tusbindicatorhandler.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* 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:  This implements TUsbIndicatorHandler class.
+*
+*/
+
+
+#include <e32std.h>
+#include <AknNotifySignature.h> // SAknNotifierPackage
+#include <avkon.hrh> //EAknIndicatorUSBConnection
+#include "tusbindicatorhandler.h"
+#include "debug.h"
+
+// ---------------------------------------------------------------------------
+// C++ Constructor 
+// ---------------------------------------------------------------------------
+//
+TUsbIndicatorHandler::TUsbIndicatorHandler() 
+    : iDevStateB4Suspend( EUsbDeviceStateUndefined )
+    , iUsbIndicator(EFalse)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Change USB Indicator 
+// ---------------------------------------------------------------------------
+//
+void TUsbIndicatorHandler::HandleDeviceStateChange( TUsbDeviceState aStateOld, 
+            TUsbDeviceState aStateNew )
+    {
+    LOG_FUNC
+
+    LOG2( "USB device state changed: %d ==> %d", aStateOld, aStateNew );
+    
+    if ( EUsbDeviceStateConfigured == aStateNew ) // Entering configed state 
+        {
+        // filter out case of configed -> suspended -> configed
+        if ( ( EUsbDeviceStateSuspended != aStateOld ) || 
+             ( EUsbDeviceStateConfigured != iDevStateB4Suspend) )
+            {
+            ShowUsbIndicator( ETrue );
+            }
+        }
+    else if ( EUsbDeviceStateSuspended == aStateNew )
+    // If current state is suspend, we do not change the indicator, but save
+    // the previous state
+        {
+        iDevStateB4Suspend = aStateOld;
+        }
+    else // New device state is not configured, nor suspended
+        {
+        // Hide USB indicator if previous state is either configured, or
+        // suspended AND state before is not configured
+        if( ( EUsbDeviceStateConfigured == aStateOld ) ||
+            ( ( EUsbDeviceStateSuspended == aStateOld ) &&
+              ( EUsbDeviceStateConfigured == iDevStateB4Suspend ) ) ) 
+            {
+            ShowUsbIndicator( EFalse );
+            }
+        } 
+    }
+    
+// ---------------------------------------------------------------------------
+// Show USB Indicator
+// ---------------------------------------------------------------------------
+//
+void TUsbIndicatorHandler::ShowUsbIndicator( TInt aUsbIndicatorState )
+    {
+    LOG_FUNC
+    
+    iUsbIndicator = aUsbIndicatorState;
+    LOG1( "USB indicator state %d", aUsbIndicatorState );
+    RNotifier notifier;
+    TInt err = notifier.Connect();
+    if ( KErrNone == err )
+        {
+        TPckgBuf< SAknNotifierPackage<SAknSmallIndicatorParams> > pckg;
+        pckg().iParamData.iSmallIndicatorUid =
+            TUid::Uid( EAknIndicatorUSBConnection );
+        pckg().iParamData.iValue = aUsbIndicatorState ? 
+            EAknIndicatorStateOn : EAknIndicatorStateOff ;
+        notifier.StartNotifier( KAknSmallIndicatorUid, pckg );
+        notifier.Close();
+        }
+    else
+        {
+        LOG1( "RNotifier::Connect error: %d", err );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/usbman_pcs.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* 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:  Resource file for usbman configuration.
+*
+*/
+
+
+NAME USBM
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include <usbpersonalityids.h>
+#include <usbman.loc>
+#include "usbman.rh"
+#include "usbvariation.rh"
+
+RESOURCE BA_RSS_SIGNATURE
+    {
+    signature = 3;
+    }
+
+RESOURCE usb_configuration usb_config
+    {
+    }
+    
+        
+RESOURCE PERSONALITY_ARRAY device_personalities
+    {
+    personalities = 
+        {
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PCSuite;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPCSuite;
+            class_uids = "101fbf22, 101fbf24, 10281F2A";
+            description = qtn_usb_mode_ovisuite;
+            detailedDescription = qtn_usb_mode_msg_ovi_suite;
+            property = 0x00000000;
+			
+
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MassStorage;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMS;
+            class_uids = "10204bbc";
+            description = qtn_usb_mode_mass_storage;
+            detailedDescription = qtn_usb_mode_msg_mass_storage;
+            property = 0x00000000;
+			
+
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_RNDIS;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdRNDIS;
+            class_uids = "20013d2f";
+            description = qtn_usb_mode_rndis;
+            detailedDescription = qtn_usb_mode_msg_rndis;
+            property = 0x00000001;
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/usbman_pcsmtp.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* 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:  Resource file for usbman configuration.
+*
+*/
+
+
+NAME USBM
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include <usbpersonalityids.h>
+#include <usbman.loc>
+#include "usbman.rh"
+#include "usbvariation.rh"
+
+
+
+RESOURCE BA_RSS_SIGNATURE
+    {
+    signature = 3;
+    }
+
+RESOURCE usb_configuration usb_config
+    {
+    }
+    
+        
+RESOURCE PERSONALITY_ARRAY device_personalities
+    {
+    personalities = 
+        {
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PCSuiteMTP;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPCSuiteMTP;
+            class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A";
+            description = qtn_usb_mode_ovisuite_mtp;
+            detailedDescription = qtn_usb_mode_msg_ovi_suite;
+            property = 0x00000000;
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MassStorage;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMS;
+            class_uids = "10204bbc";
+            description = qtn_usb_mode_mass_storage;
+            detailedDescription = qtn_usb_mode_msg_mass_storage;
+            property = 0x00000000;
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MediaTransfer;  
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMTP;
+            class_uids = "102827B3";
+            description = qtn_usb_mode_mtp;
+            detailedDescription = qtn_usb_mode_msg_mtp;
+            property = 0x00000000;
+            }
+		,
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_RNDIS;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdRNDIS;
+            class_uids = "20013d2f";
+            description = qtn_usb_mode_rndis;
+            detailedDescription = qtn_usb_mode_msg_rndis;
+            property = 0x00000001;
+            }
+        };
+    }
+            
+// End o file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/usbman_pcsmtppam.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* 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:  Resource file for usbman configuration.
+*
+*/
+
+
+NAME USBM
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include <usbpersonalityids.h>
+#include <usbman.loc>
+#include "usbman.rh"
+#include "usbvariation.rh"
+
+
+RESOURCE BA_RSS_SIGNATURE
+    {
+    signature = 3;
+    }
+
+RESOURCE usb_configuration usb_config
+    {
+    }
+    
+        
+RESOURCE PERSONALITY_ARRAY device_personalities
+    {
+    personalities = 
+        {
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PCSuiteMTP;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPCSuiteMTP;
+            class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A";
+            description = qtn_usb_mode_ovisuite_mtp;
+            detailedDescription = qtn_usb_mode_msg_ovi_suite;
+            property = 0x00000000;
+			
+
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MassStorage;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMS;
+            class_uids = "10204bbc";
+            description = qtn_usb_mode_mass_storage;
+            detailedDescription = qtn_usb_mode_msg_mass_storage;
+            property = 0x00000000;
+			
+
+            }
+#ifdef __USB_PTP        
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PTP;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPTP;
+            class_uids = "1020df81";
+            description = qtn_usb_mode_ptp;
+            detailedDescription = qtn_usb_mode_msg_ptp;
+            property = 0x00000000;
+			
+
+            }
+#endif // __USB_PTP
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MediaTransfer;  
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMTP;
+            class_uids = "102827B3";
+            description = qtn_usb_mode_mtp;
+            detailedDescription = qtn_usb_mode_msg_mtp;
+            property = 0x00000000;
+			
+
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_ModemInstall;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdModemInst;                   
+            class_uids = "2000FDA9";            
+            description = qtn_usb_mode_quickconnect;
+            detailedDescription = qtn_usb_mode_msg_pam;
+            property = 0x00000000;
+            }
+	    ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_RNDIS;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdRNDIS;
+            class_uids = "20013d2f";
+            description = qtn_usb_mode_rndis;
+            detailedDescription = qtn_usb_mode_msg_rndis;
+            property = 0x00000001;
+            }
+        };
+    }
+            
+// End o file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/usbman_pcspam.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* 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:  Resource file for usbman configuration.
+*
+*/
+
+
+NAME USBM
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include <usbpersonalityids.h>
+#include <usbman.loc>
+#include "usbman.rh"
+#include "usbvariation.rh"
+
+RESOURCE BA_RSS_SIGNATURE
+    {
+    signature = 3;
+    }
+
+RESOURCE usb_configuration usb_config
+    {
+    }
+    
+        
+RESOURCE PERSONALITY_ARRAY device_personalities
+    {
+    personalities = 
+        {
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PCSuite;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPCSuite;
+            class_uids = "101fbf22, 101fbf24, 10281F2A";
+            description = qtn_usb_mode_ovisuite;
+            detailedDescription = qtn_usb_mode_msg_ovi_suite;
+            property = 0x00000000;
+			
+
+            }
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_MassStorage;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdMS;
+            class_uids = "10204bbc";
+            description = qtn_usb_mode_mass_storage;
+            detailedDescription = qtn_usb_mode_msg_mass_storage;
+            property = 0x00000000;
+			
+
+            }
+#ifdef __USB_PTP
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_PTP;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdPTP;
+            class_uids = "1020df81";
+            description = qtn_usb_mode_ptp;
+            detailedDescription = qtn_usb_mode_msg_ptp;
+            property = 0x00000000;
+			
+
+            }
+#endif // __USB_PTP
+        ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x00;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_ModemInstall;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdModemInst;                   
+            class_uids = "2000FDA9";            
+            description = qtn_usb_mode_quickconnect;
+            detailedDescription = qtn_usb_mode_msg_pam;
+            property = 0x00000000;
+            }
+	    ,
+        PERSONALITY
+            {
+            bDeviceClass = 0x02;
+            bDeviceSubClass = 0x00;
+            protocol = 0x00;
+            numConfigurations = 0x01;
+            vendorId = per_vendorId;
+            productId = per_productId_RNDIS;
+            bcdDevice = per_bcdDevice;
+            manufacturer = per_manufacturer;
+            product = per_product;
+            id = KUsbPersonalityIdRNDIS;
+            class_uids = "20013d2f";
+            description = qtn_usb_mode_rndis;
+            detailedDescription = qtn_usb_mode_msg_rndis;
+            property = 0x00000001;
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/Bmarm/UsbWatcherTestu.def	Wed Sep 01 12:20:49 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/usbengines/usbwatcher/tsrc/UsbWatcherTest/Bwins/UsbWatcherTestu.def	Wed Sep 01 12:20:49 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/usbengines/usbwatcher/tsrc/UsbWatcherTest/conf/UsbWatcherTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* 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:
+*
+*/
+
+//[StifSettings]
+//CapsModifier= UsbWatcherTest.exe
+//[EndStifSettings]
+
+// UsbWatcherTest Module - total 23 tc
+
+// UsbWatcherTest Api Tests (23 tc)
+
+// USB watcher initialization tests (2)
+
+[Test]
+title Connect USB Watcher (USB Watcher Connection Test)
+create UsbWatcherTest tester
+tester InitializationTest SINGLE_CONN
+delete tester
+[Endtest] 
+
+[Test]
+title Return Server Version (USB Watcher Initialization Test)
+create UsbWatcherTest tester
+tester InitializationTest VERSION
+delete tester
+[Endtest]
+
+// USB personality management tests (18)
+
+[Test]
+title Set PCSuite Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest PCSUITE SET_PERSONALITY
+delete tester
+[Endtest]
+
+[Test]
+title Set MS Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PERSONALITY
+delete tester
+[Endtest]
+
+
+[Test]
+title Set Modem Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest Modem SET_PERSONALITY
+delete tester
+[Endtest]
+
+[Test]
+title Set MTP Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MTP SET_PERSONALITY
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality On Disconnect (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_ON_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality Sync (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_SYNC
+delete tester
+[Endtest]
+
+[Test]
+title Set PCSuite Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest PCSUITE SET_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set MS Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Modem Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest Modem SET_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set MTP Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MTP SET_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Cancel Set Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS CANCEL_SET_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality On Disconnect/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_ON_DISC_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Previous Personality Sync/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_SYNC_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Cancel Set Previous Personality/Cable Disconnected (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS CANCEL_SET_PREVIOUS_PERSONALITY_DISC
+delete tester
+[Endtest]
+
+[Test]
+title Set Unknown Personality (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS SET_UNKNOWN_PERSONALITY
+delete tester
+[Endtest]
+
+[Test]
+title Interrupt Personality Set (USB Personality Management Test)
+create UsbWatcherTest tester
+tester PersonalityManagementTest MS INTERRUPT_PERSONALITY_SET
+delete tester
+[Endtest]
+
+// USB watcher branch tests (3)
+
+[Test]
+title Set Same Personality (USB Watcher Branch Test)
+create UsbWatcherTest tester
+tester BranchTest SAME_PERSONALITY_SET
+delete tester
+[Endtest]
+
+[Test]
+title Set Personality/Personality Switch Blocking On (USB Watcher Branch Test)
+create UsbWatcherTest tester
+tester BranchTest NON_BLOCKING
+delete tester
+[Endtest]
+
+[Test]
+title Set Personality/Ask On Connection Not Shown(USB Watcher Branch Test)
+create UsbWatcherTest tester
+tester BranchTest FORCE_SWITCH
+delete tester
+[Endtest]
+
+// Add new api tests here
+// ...
+
+
+// UsbWatcherTest Module Tests (... tc)
+
+
+// Add new module tests here
+// ...
+
+
+// UsbWatcherTest Branch Tests (... tc)
+
+
+// Add new branch tests here
+// ...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/eabi/UsbWatcherTestu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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:
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the MW_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbWatcherTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+
+DEFFILE         UsbWatcherTest.def
+
+MW_LAYER_SYSTEMINCLUDE
+
+//includes for stubbing
+SYSTEMINCLUDE 	/epoc32/include/mw/stubsrv/
+SYSTEMINCLUDE 	/epoc32/include/mw/taf/
+
+USERINCLUDE	../inc
+USERINCLUDE	../../../inc
+SOURCEPATH 	../src
+
+SOURCE          UsbWatcherTest.cpp
+SOURCE          UsbWatcherTestBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+//standart lib for stif testing
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+//lib for stubbing
+LIBRARY		apibehavior.lib
+LIBRARY		stubber.lib
+
+
+//lib for component testing
+//LIBRARY
+LIBRARY 	usbman.lib
+LIBRARY 	usbwatcher.lib
+LIBRARY 	centralrepository.lib
+LIBRARY 	efsrv.lib
+
+LANG            SC
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,69 @@
+;
+; 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:  Installation file for STIF
+;
+
+
+;
+; Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"UsbWatcherTest"},(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/UsbWatcherTest.dll"-"C:/Sys/Bin/UsbWatcherTest.dll"
+;"/epoc32/release/armv5/udeb/UsbWatcherTest.exe"-"C:/Sys/Bin/UsbWatcherTest.exe"
+
+"../conf/UsbWatcherTest.cfg"-"E:/testing/conf/UsbWatcherTest.cfg"
+"../init/UsbWatcherTest_ats.ini"-"E:/testing/init/UsbWatcherTest.ini"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,64 @@
+
+; 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:  Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"UsbWatcherTest"},(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/UsbWatcherTest.dll"	-	"C:/Sys/Bin/UsbWatcherTest.dll"
+;"/epoc32/release/armv5/udeb/UsbWatcherTest.exe"   -   "C:/Sys/Bin/UsbWatcherTest.exe"
+
+"../conf/UsbWatcherTest.cfg"-"C:/testframework/UsbWatcherTest.cfg"
+"../init/UsbWatcherTest_phone.ini"-"C:/testframework/testframework.ini"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+UsbWatcherTest.mmp
+
+PRJ_MMPFILES
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,23 @@
+@rem
+@rem Copyright (c) 2010 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
+
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
+call makesis UsbWatcherTest_ats.pkg
+call signsis UsbWatcherTest_ats.sis UsbWatcherTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,25 @@
+@rem
+@rem Copyright (c) 2010 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
+
+
+call sbs -c armv5_udeb clean
+call sbs -c armv5_udeb.test
+call sbs -c armv5_udeb.test freeze
+call sbs -c armv5_udeb.test
+
+
+call makesis UsbWatcherTest_phone.pkg
+call signsis UsbWatcherTest_phone.sis UsbWatcherTest_phone.sisx x:\rd.cer x:\rd-key.pem
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* 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 TEMPLATESTUBSCRIPTUsbWatcherTest_H
+#define TEMPLATESTUBSCRIPTUsbWatcherTest_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include <usbwatcher.h>
+#include <UsbWatcherInternalCRKeys.h>
+#include <usbpersonalityids.h>
+#include <centralrepository.h>
+#include "usbwatchershared.h"
+//  INCLUDES FOR STUBS
+#include <stubber.h>
+#include <apibehavior.h>
+#include <usbmandll_stub.h>
+#include <usbman.h>
+
+// CONSTANTS
+// Logging path
+//_LIT( KUsbWatcherTestLogPath, "\\logs\\testframework\\UsbWatcherTest\\" );
+
+// Logging path for ATS - for phone builds comment this line
+_LIT( KUsbWatcherTestLogPath, "e:\\testing\\stiflogs\\" ); 
+
+// Log file
+_LIT( KUsbWatcherTestLogFile, "UsbWatcherTest.txt" ); 
+_LIT( KUsbWatcherTestLogFileWithTitle, "UsbWatcherTest_[%S].txt" );
+
+// MACROS
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Macros used to extract test block parameters
+#define TESTENTRY( A, B )\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\
+        { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )
+
+#define TESTPARAM( A, B )\
+    GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B );
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// Enum type used to determine test block execution result
+enum TUsbWatcherTestResult
+    {
+    ETestCasePassed,
+    ETestCaseFailed
+    };
+
+// Enum type indicating test block parameter which should be used to store
+// data extracted from test script
+enum TTestBlockParamName
+    {
+    eTestOption1,
+    eTestOption2,
+    eTestOption3,    
+    eTestIntOption1,
+    eTestIntOption2,
+    eTestIntOption3,   
+    eTestCharOption1,
+    eTestCharOption2,
+    eTestCharOption3
+    };
+
+// Enum type used to indicate which get parameter function should be used
+enum TGetTestBlockParamOperation
+    {
+    eGetString,
+    eGetInt,
+    eGetChar
+    };
+
+// CLASS DECLARATION
+/**
+*  TUsbWatcherTestBlockParams test class for storing test block parameters.
+*/
+NONSHARABLE_CLASS( TUsbWatcherTestBlockParams )
+    {
+    public:
+        TPtrC iTestBlockName;
+        
+        TPtrC iTestOption1;
+        TPtrC iTestOption2;
+        TPtrC iTestOption3;
+        
+        TInt iTestIntOption1;
+        TInt iTestIntOption2;
+        TInt iTestIntOption3;
+        
+        TChar iTestCharOption1;
+        TChar iTestCharOption2;
+        TChar iTestCharOption3;
+    };
+
+/**
+*  CUsbWatcherTest test class for STIF Test Framework TestScripter.
+*/
+NONSHARABLE_CLASS( CUsbWatcherTest ) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CUsbWatcherTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUsbWatcherTest();
+
+    public: // New functions
+    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
+    protected:  // Functions from base classes
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CUsbWatcherTest( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void TestDelete();
+        
+        /**
+        * Constructs all test resources for test methods.
+        */
+        void TestConstructL();
+        
+        /**
+        * Extracts test block parameters from script file
+        */
+        void TestBlocksInfoL();
+        
+        /**
+        * Executes test block
+        */
+        TInt ExecuteTestBlock( CStifItemParser& aItem );
+        
+        /**
+        * Executes proper get parameter function indicated by its arguments
+        */
+        void GetTestBlockParamL( TGetTestBlockParamOperation aOperation,
+                                TTestBlockParamName aParamName );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        // ADD NEW METHOD DEC HERE
+        // [TestMethods] - Do not remove 
+        void ExampleTestL( TUsbWatcherTestBlockParams& aParams, 
+                            TUsbWatcherTestResult& aTestResult );
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        void InitializationTestL( TUsbWatcherTestBlockParams& aParams, 
+                            TUsbWatcherTestResult& aTestResult );
+        
+        void PersonalityManagementTestL( TUsbWatcherTestBlockParams& aParams, 
+                            TUsbWatcherTestResult& aTestResult );
+        
+        void PersonalitySwitchTestL( TUsbWatcherTestBlockParams& aParams, 
+                            TUsbWatcherTestResult& aTestResult );  
+        
+        void BranchTestL( TUsbWatcherTestBlockParams& aParams, 
+                            TUsbWatcherTestResult& aTestResult ); 
+        
+        TInt BackupPersonalitySetting();
+        TInt RestorePersonalitySetting();
+        
+        TInt GetPersonalityIdFromString( TPtrC& aUsbPersonalityName, TInt& aUsbPersonalityId );
+        TUsbWatcherTestResult SetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult CancelSetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult SetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult SetPreviousPersonalityOnDiscTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult SetPreviousPersonalitySyncTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult CancelSetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected );
+        TUsbWatcherTestResult SetUnknownPersonalityTest();
+        TUsbWatcherTestResult InterruptPersonalitySetTest( TInt aNewPersonalityId );
+        
+        TUsbWatcherTestResult FastPersonalitySwitchTest();
+        TUsbWatcherTestResult DelayedPersonalitySwitchTest();
+        
+        TUsbWatcherTestResult SetSamePersonalityTest();
+        TUsbWatcherTestResult SetPersonalityBlockingOn();
+        TUsbWatcherTestResult SetPersonalityAskOnConnectionOff();
+        
+	
+    public:     // Data
+    protected:  // Data
+    private:    // Data
+        
+        // Member object used to store test block parameters
+        TUsbWatcherTestBlockParams iTestBlockParams;
+        
+        // Used to indicate if test block with specified parameters exist
+        TBool iTestBlockFound;
+        
+        // Function pointer used to call proper test block methods
+        void ( CUsbWatcherTest::*iTestBlockFunction )
+            ( TUsbWatcherTestBlockParams&, TUsbWatcherTestResult& );
+        
+        // Not own
+        CStifItemParser* iItem;
+        CStubber * iStubber;
+        RUsbWatcher* iWatcher;
+        RUsb* iUsbMan;
+        CRepository* iCenRep;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+        // ADD NEW DATA DEC HERE
+        
+        TInt iPersonalityIdBackup;
+
+        
+    public:     // Friend classes
+    protected:  // Friend classes
+    private:    // Friend classes
+        
+    };
+#endif      // TEMPLATESTUBSCRIPTUsbWatcherTest_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTestDebug.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* 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:
+*
+*/
+
+#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] ");
+_LIT8( KStifEntryPrefix8, ">>> %S" );
+_LIT8( KStifExitPrefix8, "<<< %S" );
+
+const TInt KMaxLogLineLength = 512;
+
+#define TRACE_INFO( p ) { Trace p; }
+#define TRACE_FUNC_ENTRY { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifEntryPrefix8, &ptr8 ); }
+#define TRACE_FUNC_EXIT { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifExitPrefix8, &ptr8 ); }
+
+void CUsbWatcherTest::Trace(TRefByValue<const TDesC8> aFmt, ...)
+	{
+	VA_LIST list;
+	VA_START( list, aFmt );
+	TOverflowTruncate8 overflow;   
+	
+	RBuf8 buf8;
+	RBuf8 bufStifLog8;
+	
+	buf8.Create( KMaxLogLineLength );
+	buf8.Append( KStifTestPrefix8 );
+	buf8.AppendFormatList( aFmt, list, &overflow );	
+	bufStifLog8.Create( KMaxLogLineLength );
+	bufStifLog8.AppendFormatList( aFmt, list, &overflow );
+			
+	RBuf16 buf16;
+	RBuf16 bufStifLog16;
+	
+	buf16.Create( KMaxLogLineLength );
+	buf16.Copy( buf8 );
+	bufStifLog16.Create( KMaxLogLineLength );
+	bufStifLog16.Copy( bufStifLog8 );
+	
+	RDebug::Print( buf16 );
+	iLog->Log( bufStifLog16 );
+	buf8.Close();
+	bufStifLog8.Close();
+	buf16.Close();
+	bufStifLog16.Close();
+	};
+
+void CUsbWatcherTest::Trace(TRefByValue<const TDesC16> aFmt, ...)
+	{
+	VA_LIST list;
+	VA_START(list,aFmt);
+	TOverflowTruncate16 overflow;
+	
+	RBuf16 buf;
+	RBuf16 bufStifLog;
+	
+	buf.Create( KMaxLogLineLength );
+	buf.Append( KStifTestPrefix );
+	buf.AppendFormatList( aFmt, list, &overflow );
+	bufStifLog.Create( KMaxLogLineLength );
+	bufStifLog.AppendFormatList( aFmt, list, &overflow );
+	
+	RDebug::Print( buf );
+	iLog->Log( bufStifLog );
+	buf.Close();
+	bufStifLog.Close();
+	};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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 TESTDEBUG_H_
+#define TESTDEBUG_H_
+
+//  INCLUDES
+#include <e32debug.h>
+#include <e32def.h>
+
+// CONSTANTS
+_LIT8(KStifTestPrefix8, "[STIF_LOG] ");
+_LIT( KStifTestPrefix, "[STIF_LOG] ");
+_LIT8( KStifEntryPrefix8, ">>> %S" );
+_LIT8( KStifExitPrefix8, "<<< %S" );
+
+const TInt KMaxLogLineLength = 512;
+typedef TBuf8< KMaxLogLineLength > TLogBuf8;
+typedef TBuf16< KMaxLogLineLength > TLogBuf16;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( TTestLogger )
+    {
+public:
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... );
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... );
+    static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf );
+    };
+
+// MACROS
+#define TRACE( p ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_INFO( p, args... ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_ENTRY {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_EXIT {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+
+#include "testdebug.inl"
+
+#endif /* TESTDEBUG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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:
+*
+*/
+
+#include <e32debug.h>
+
+NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow
+    {
+public:
+    void Overflow( TDes8& /*aDes*/ ) {}
+    }; 
+
+NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow
+    {
+public:
+    void Overflow( TDes16& /*aDes*/ ) {}
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate8 overflow;   
+    TLogBuf8 buf8;
+    TLogBuf16 buf16;
+    buf8.AppendFormatList( aFmt, list, &overflow );
+    buf16.Copy( buf8 );
+    return buf16;
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate16 overflow;
+    TLogBuf16 buf16;
+    buf16.AppendFormatList( aFmt, list, &overflow );
+    return buf16;
+    };
+
+void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf )
+    {    
+    RBuf16 buf;
+    RBuf16 bufStifLog;
+    
+    buf.Create( KMaxLogLineLength );
+    buf.Append( KStifTestPrefix );
+    buf.Append( aLogBuf );
+    bufStifLog.Create( KMaxLogLineLength );
+    bufStifLog.Append( aLogBuf );
+    
+    RDebug::Print( buf );
+    aLog.Log( bufStifLog );
+    buf.Close();
+    bufStifLog.Close();
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_ats.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,232 @@
+# 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:  Installation file for STIF
+#
+
+
+#
+# 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'.
+#
+# 	- 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= UsbWatcherTest_TestReport.log
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+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= UsbWatcherTestUsbWatcherTestUsbWatcherTest
+# 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/UsbWatcherTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbWatcherTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbWatcherTest used initialization file
+#IniFile= c:/testframework/init.txt
+
+#TestModuleUsbWatcherTest 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
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_phone.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,233 @@
+# 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:  Installation file for STIF
+#
+
+
+
+#
+# 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'.
+#
+# 	- 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\TemplateScriptUsbWatcherTest\
+TestReportFileName= UsbWatcherTest_TestReport.log
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+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= UsbWatcherTestUsbWatcherTestUsbWatcherTest
+# 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\UsbWatcherTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbWatcherTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbWatcherTest used initialization file
+#IniFile= c:/testframework/init.txt
+
+#TestModuleUsbWatcherTest 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
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,326 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "UsbWatcherTest.h"
+#include <SettingServerClient.h>
+#include "testdebug.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::CUsbWatcherTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbWatcherTest::CUsbWatcherTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbWatcherTest::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( KUsbWatcherTestLogFileWithTitle, &title );
+        }
+    else
+        {
+        logFileName.Copy( KUsbWatcherTestLogFile );
+        }
+
+    iLog = CStifLogger::NewL( KUsbWatcherTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    TestConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbWatcherTest* CUsbWatcherTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CUsbWatcherTest* self = new (ELeave) CUsbWatcherTest( aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CUsbWatcherTest::~CUsbWatcherTest()
+    { 
+
+    // Delete resources allocated from test methods
+    TestDelete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+
+TInt CUsbWatcherTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+    return ExecuteTestBlock( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::ExecuteTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbWatcherTest::ExecuteTestBlock( CStifItemParser& aItem )
+    {
+    TRACE_FUNC_ENTRY
+    iItem = &aItem;    
+    TInt res;
+    TUsbWatcherTestResult testResult = ETestCaseFailed;
+    
+    res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Getting test block name failed with: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName )
+    
+    TRACE( "Extracting test block parameters..." )
+    TRAP( res, TestBlocksInfoL() );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Extracting parameters failed: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    if ( !iTestBlockFound )
+        {
+        TRACE( "Test block not found!" )
+        TRACE_FUNC_EXIT
+        return KErrNotFound;
+        }    
+    TRACE( "Extracting parameters successful" )
+    
+    TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "ExecuteTestBlockL error: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    TRACE( "Test block passed!" );
+    TRACE_FUNC_EXIT 
+    return KErrNone;
+    } 
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::GetTestBlockParamL
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName )
+    {    
+    switch( aOperation )
+        {
+        case eGetString:
+            {
+            switch ( aParamName )
+                {
+                case eTestOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) );
+                    break;
+                    }
+                case eTestOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) );
+                    break;
+                    }
+                case eTestOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetInt:
+            {
+            switch ( aParamName )
+                {
+                case eTestIntOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) );
+                    break;
+                    }
+                case eTestIntOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) );
+                    break;
+                    }
+                case eTestIntOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetChar:            
+            {
+            switch ( aParamName )
+                {
+                case eTestCharOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) );
+                    break;
+                    }
+                case eTestCharOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) );
+                    break;
+                    }
+                case eTestCharOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    }
+
+//-----------------------------------------------------------------------------
+// CUsbWatcherTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbWatcherTest::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("UsbWatcherTest.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* ) CUsbWatcherTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,1126 @@
+/*
+* 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:
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "UsbWatcherTest.h"
+#include "testdebug.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::TestConstructL
+// Construct here all test resources for test methods. 
+// Called from ConstructL. 
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::TestConstructL()
+    {
+    TRACE_FUNC_ENTRY
+    
+    iStubber = CStubber::NewL();
+
+    iWatcher = new ( ELeave ) RUsbWatcher();
+    iCenRep = CRepository::NewL( KCRUidUsbWatcher );
+    STIF_LOG( "Usb man initialization" );
+    iUsbMan = new ( ELeave ) RUsb();
+    User::LeaveIfError( iUsbMan -> Connect() );  
+    User::LeaveIfError( BackupPersonalitySetting() );
+    
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::TestDelete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::TestDelete() 
+    {
+    TRACE_FUNC_ENTRY
+
+    if ( RestorePersonalitySetting() != KErrNone )
+        STIF_LOG( "Warning: personality restore failed" );
+    
+    delete iWatcher;
+    iWatcher = NULL;
+    
+    delete iCenRep;
+    iCenRep = NULL;
+    
+    iUsbMan -> Close();
+    delete iUsbMan;
+    iUsbMan = NULL;
+    
+    delete iStubber;
+    iStubber = NULL;
+    
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::TestBlocksInfoL
+// Add new test block parameter entries below
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::TestBlocksInfoL()
+    {
+    
+    TESTENTRY( "ExampleTestL", CUsbWatcherTest::ExampleTestL )
+            {
+            TESTPARAM( eGetString, eTestOption1 )
+            TESTPARAM( eGetString, eTestOption2 )
+            TESTPARAM( eGetInt, eTestIntOption1 )
+            TESTPARAM( eGetChar, eTestCharOption1 )
+            }
+    
+    TESTENTRY( "InitializationTest", CUsbWatcherTest::InitializationTestL )
+            {
+            TESTPARAM( eGetString, eTestOption1 )
+            }
+
+    TESTENTRY( "PersonalityManagementTest", CUsbWatcherTest::PersonalityManagementTestL )
+            {
+            TESTPARAM( eGetString, eTestOption1 )
+            TESTPARAM( eGetString, eTestOption2 )
+            }
+    
+    TESTENTRY( "PersonalitySwitchTest", CUsbWatcherTest::PersonalitySwitchTestL )
+            {
+            TESTPARAM( eGetString, eTestOption1 )
+            }
+
+    TESTENTRY( "BranchTest", CUsbWatcherTest::BranchTestL )
+            {
+            TESTPARAM( eGetString, eTestOption1 )
+            }
+    }
+
+// Add test block methods implementation here
+// -----------------------------------------------------------------------------
+// CUsbWatcherTest::ExampleTestL
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::ExampleTestL( TUsbWatcherTestBlockParams& aParams, TUsbWatcherTestResult& aTestResult )
+    {
+    TRACE_FUNC_ENTRY
+    
+    //iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+
+    if ( !aParams.iTestOption1.Compare( _L( "API" ) ) )
+        {
+		TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 )
+		TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 )
+		TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 )
+		TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if ( !aParams.iTestOption1.Compare( _L( "MODULE" ) ) )
+        {
+		TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 )
+		TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 )
+		TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 )
+		TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if ( !aParams.iTestOption1.Compare( _L( "BRANCH" ) ) )
+        {
+		TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 )
+		TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 )
+		TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 )
+		TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else
+        {
+        TRACE( "Invalid test parameter" )
+        TRACE_FUNC_EXIT
+        User::Leave( KErrNotFound );
+        }
+    
+    aTestResult = ETestCasePassed;
+    TRACE_FUNC_EXIT
+    }
+
+
+// Add other member functions implementation here
+
+// -----------------------------------------------------------------------------
+// CUSBWatcherApiTest::InitializationTest
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::InitializationTestL( TUsbWatcherTestBlockParams& aParams, 
+                                            TUsbWatcherTestResult& aTestResult )
+    {
+    TInt res;   
+    TPtrC testOptionName( aParams.iTestOption1 );
+        
+    if ( !testOptionName.Compare( _L( "VERSION" ) ) )
+        {
+        TRACE( "Test option: VERSION" );
+        TVersion returnedVersion;
+        TVersion expectedVersion( KUsbWatcherSrvMajorVersionNumber,
+                                KUsbWatcherSrvMinorVersionNumber,
+                                KUsbWatcherSrvBuildVersionNumber );
+        TRACE( "  >Version" );
+        returnedVersion = iWatcher -> Version();
+        TRACE( "  <Version" );
+        if( expectedVersion.iMajor != returnedVersion.iMajor )
+            User::Leave(KErrNotFound);
+        if( expectedVersion.iMinor != returnedVersion.iMinor )
+            User::Leave(KErrNotFound);
+        if( expectedVersion.iBuild != returnedVersion.iBuild )
+            User::Leave(KErrNotFound);
+        }
+    else if ( !testOptionName.Compare( _L( "SINGLE_CONN" ) ) )
+        {
+        TRACE( "Test option: SINGLE_CONN" );
+        TRACE( ">Connect" );
+        res = iWatcher -> Connect();
+        TRACE( "  <Connect" );
+        TRACE_INFO( "USB watcher connection value: %d, expected: %d", res, KErrNone );
+        User::LeaveIfError( res );
+        }
+    else
+        {
+        TRACE( "Test option: not supported" );
+        User::Leave( KErrNotFound );
+        }
+        
+    aTestResult = ETestCasePassed;
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBWatcherApiTest::PersonalityManagementTest
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::PersonalityManagementTestL( TUsbWatcherTestBlockParams& aParams, 
+                                                    TUsbWatcherTestResult& aTestResult )
+    {
+    TInt res;
+    TInt newPersonalityId;
+    TPtrC testOptionName( aParams.iTestOption2 );
+    TPtrC usbPersonalityName( aParams.iTestOption1 );
+    TInt currentPersonalityId;
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, _L8( "stub" ) ) );
+    
+    res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "GetCurrentPersonalityId failed with value: %d", res );
+        User::Leave(res);
+        }
+        
+    res = GetPersonalityIdFromString( usbPersonalityName, newPersonalityId );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "GetPersonalityIdFromString failed with value: %d", res );
+        User::Leave(res);
+        }
+    
+    TRACE( "  >Connect" );
+    res = iWatcher -> Connect();
+    TRACE( "  <Connect" );
+    TRACE_INFO( "USB watcher connection value: %d, expected: %d", res, KErrNone );
+    User::LeaveIfError( res );
+    
+    if ( !testOptionName.Compare( _L( "SET_PERSONALITY" ) ) && newPersonalityId == KUsbPersonalityIdPCSuiteMTP )
+        {     
+        TRequestStatus status;
+        TInt setPersonalityId;
+        
+        if ( currentPersonalityId != newPersonalityId )
+            {
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            }
+                
+        res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId );
+        
+        TRACE( "  >SetPersonality" );
+        iWatcher -> SetPersonality( status, KUsbPersonalityIdMS, EFalse, EFalse );
+        User::WaitForRequest( status );
+        TRACE( "  <SetPersonality" );
+        TRACE_INFO( "Set initial test personality value: %d", status.Int() );
+        res = iCenRep -> Get( KUsbWatcherPersonality, setPersonalityId );
+        TRACE_INFO( "Set initial test personality value: %d, personality ID: %d", status.Int(), setPersonalityId );
+        User::LeaveIfError( status.Int() );
+        if( KUsbPersonalityIdMS != setPersonalityId )
+            User::Leave(KErrNotFound); 
+        }
+    else
+        {
+        TRequestStatus status;
+        TInt setPersonalityId;
+        
+        if ( currentPersonalityId != newPersonalityId )
+            {
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+            }
+        
+        TRACE( "  >SetPersonality" );
+        iWatcher -> SetPersonality( status, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse );
+        User::WaitForRequest( status );        
+        TRACE( "  <SetPersonality" );
+        res = iCenRep -> Get( KUsbWatcherPersonality, setPersonalityId );
+        TRACE_INFO( "Set initial test personality value: %d, personality ID: %d", status.Int(), setPersonalityId );
+        User::LeaveIfError( status.Int() ); 
+        if( KUsbPersonalityIdPCSuiteMTP != setPersonalityId )
+            User::Leave(KErrNotFound);
+        }
+        
+    if ( !testOptionName.Compare( _L( "SET_PERSONALITY" ) ) )
+        {
+        TRACE( "Test option: SET_PERSONALITY" );
+        aTestResult = SetPersonalityTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "CANCEL_SET_PERSONALITY" ) ) )
+        {
+        TRACE( "Test option: CANCEL_SET_PERSONALITY" );
+        aTestResult = CancelSetPersonalityTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY" );
+        aTestResult = SetPreviousPersonalityTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_ON_DISC" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY_ON_DISC" );
+        aTestResult = SetPreviousPersonalityOnDiscTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_SYNC" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY_SYNC" );
+        aTestResult = SetPreviousPersonalitySyncTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "CANCEL_SET_PREVIOUS_PERSONALITY" ) ) )
+        {
+        TRACE( "Test option: CANCEL_SET_PREVIOUS_PERSONALITY" );
+        aTestResult = CancelSetPreviousPersonalityTest( newPersonalityId, ETrue );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PERSONALITY_DISC" ) ) )
+        {
+        TRACE( "Test option: SET_PERSONALITY_DISC" );
+        aTestResult = SetPersonalityTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "CANCEL_SET_PERSONALITY_DISC" ) ) )
+        {
+        TRACE( "Test option: CANCEL_SET_PERSONALITY_DISC" );
+        aTestResult = CancelSetPersonalityTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_DISC" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY_DISC" );
+        aTestResult = SetPreviousPersonalityTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_ON_DISC_DISC" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY_ON_DISC_DISC" );
+        aTestResult = SetPreviousPersonalityOnDiscTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_SYNC_DISC" ) ) )
+        {
+        TRACE( "Test option: SET_PREVIOUS_PERSONALITY_SYNC_DISC" );
+        aTestResult = SetPreviousPersonalitySyncTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "CANCEL_SET_PREVIOUS_PERSONALITY_DISC" ) ) )
+        {
+        TRACE( "Test option: CANCEL_SET_PREVIOUS_PERSONALITY_DISC" );
+        aTestResult = CancelSetPreviousPersonalityTest( newPersonalityId, EFalse );
+        }
+    else if ( !testOptionName.Compare( _L( "SET_UNKNOWN_PERSONALITY" ) ) )
+        {
+        TRACE( "Test option: SET_UNKNOWN_PERSONALITY" );
+        aTestResult = SetUnknownPersonalityTest();
+        }
+    else if ( !testOptionName.Compare( _L( "INTERRUPT_PERSONALITY_SET" ) ) )
+        {
+        TRACE( "Test option: INTERRUPT_PERSONALITY_SET" );
+        aTestResult = InterruptPersonalitySetTest( newPersonalityId );
+        }
+    else
+        {
+        TRACE( "Test option: not supported" );
+        User::Leave(KErrNotFound);
+        }
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    TRACE( "Checking test results:" );
+    
+    if ( aCableConnected )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        }
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );   
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed;    
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::CancelSetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    TRACE( "Checking test results:" );
+    
+    if ( aCableConnected )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, _L8( "stub" ) ) );
+        }
+    
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    TRACE( "  >CancelSetPersonality" );
+    iWatcher -> CancelSetPersonality();
+    User::WaitForRequest( stat );
+    TRACE( "  <CancelSetPersonality" );
+    TRACE_INFO("Cancel set personality request status: %d", stat.Int() );
+     
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d", currentPersonalityId );
+    
+    if ( aCableConnected )
+        {
+        if ( stat.Int() != KErrCancel || res != KErrNone || currentPersonalityId != previousPersonalityId )
+            return ETestCaseFailed;
+        }
+    else
+        {
+        if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+            return ETestCaseFailed;
+        }
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    TRACE( "  >SetPersonality" );
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+    
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+        return ETestCaseFailed;
+    
+    TRACE( "Checking test results:" );
+    
+    if ( aCableConnected )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        }
+    
+    TRACE( "  >SetPreviousPersonality" );
+    iWatcher -> SetPreviousPersonality( stat );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPreviousPersonality" );
+    TRACE_INFO("Set previous personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalityOnDiscTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    if ( aCableConnected )    
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    
+    TRACE( "  >SetPreviousPersonalityOnDisconnect" );   
+    iWatcher -> SetPreviousPersonalityOnDisconnect();
+    TRACE( "  <SetPreviousPersonalityOnDisconnect" );
+    
+    // disconnect cable here
+    
+    TRACE( "Checking test results:" );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalitySyncTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+        return ETestCaseFailed;
+    
+    TRACE( "Checking test results:" );
+    
+    if ( aCableConnected )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        }
+    
+    TRACE( "  >SetPreviousPersonality" );
+    iWatcher -> SetPreviousPersonality();
+    TRACE( "  <SetPreviousPersonality" );
+    TRACE("Set previous personality sync invoked"  );
+    
+    User::After( 10*1000*1000 );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId );
+    
+    if ( res != KErrNone || currentPersonalityId != previousPersonalityId )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::CancelSetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected )
+    {
+    TRequestStatus stat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+        return ETestCaseFailed;
+    
+    TRACE( "Checking test results:" );
+    
+    if ( aCableConnected )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        }
+    
+    TRACE( "  >SetPreviousPersonality" );
+    iWatcher -> SetPreviousPersonality( stat );
+    TRACE( "  >CancelSetPreviousPersonality" );
+    iWatcher -> CancelSetPreviousPersonality();
+    User::WaitForRequest( stat );
+    TRACE( "  <CancelSetPreviousPersonality" );
+    TRACE_INFO("Cancel set previous personality request status: %d", stat.Int() );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d", currentPersonalityId );
+    
+    if ( aCableConnected )
+        {
+        if ( stat.Int() != KErrCancel || res != KErrNone || currentPersonalityId != aNewPersonalityId )
+            return ETestCaseFailed;
+        }
+    else
+        {
+        if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId )
+            return ETestCaseFailed;
+        }
+    
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetUnknownPersonalityTest()
+    {
+    TRequestStatus stat;
+    TInt unknownPersonalityId = 0xFFFF;
+    
+    TRACE( "Checking test results:" );
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, unknownPersonalityId, EFalse, EFalse );   
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNotFound );
+    
+    if ( stat.Int() != KErrNotFound )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::InterruptPersonalitySetTest( TInt aNewPersonalityId )
+    {
+    TRequestStatus stat;
+    TRequestStatus secondStat;
+    TInt previousPersonalityId;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Original personality ID: %d", previousPersonalityId );
+    if ( res != KErrNone )
+        return ETestCaseFailed;
+    
+    TRACE( "Checking test results:" );
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse );
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( secondStat, previousPersonalityId, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    User::WaitForRequest( secondStat );
+    TRACE( "  <SetPersonality" );
+    
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    TRACE_INFO("Interrupt set personality request status: %d, expected %d", secondStat.Int(), KErrNone );
+
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId );
+    
+    if ( stat.Int() != KErrNone || secondStat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TInt CUsbWatcherTest::GetPersonalityIdFromString( TPtrC& aUsbPersonalityName, TInt& aUsbPersonalityId )
+    {
+    if ( !aUsbPersonalityName.Compare( _L( "PCSUITE" ) ) )
+        {
+        TRACE( "Test personality ID setting: PCSUITE" );
+        aUsbPersonalityId = KUsbPersonalityIdPCSuiteMTP;
+        }
+    else if ( !aUsbPersonalityName.Compare( _L( "MS" ) ) )
+        {
+        TRACE( "Test personality ID setting: MS" );
+        aUsbPersonalityId = KUsbPersonalityIdMS;
+        }
+    else if ( !aUsbPersonalityName.Compare( _L( "PTP" ) ) )
+        {
+        TRACE( "Test personality ID setting: PTP" );
+        aUsbPersonalityId = KUsbPersonalityIdPTP;
+        }
+    else if ( !aUsbPersonalityName.Compare( _L( "MTP" ) ) )
+        {
+        TRACE( "Test personality ID setting: MTP" );
+        aUsbPersonalityId = KUsbPersonalityIdMTP;
+        }
+    else if ( !aUsbPersonalityName.Compare( _L( "Modem" ) ) )
+        {
+        TRACE( "Test personality ID setting: Modem" );
+        aUsbPersonalityId = KUsbPersonalityIdModemInst;
+        }
+    else
+        {
+        TRACE( "Test personality ID setting: not supported" );
+        return KErrNotFound;
+        }
+ 
+    return KErrNone;   
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBWatcherTest::PersonalitySwitchTest
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::PersonalitySwitchTestL( TUsbWatcherTestBlockParams& aParams, 
+                                                TUsbWatcherTestResult& aTestResult )
+    {
+    TInt res;
+    TRequestStatus stat;
+    TPtrC testOptionName( aParams.iTestOption1 );
+    TInt currentPersonalityId;
+    
+    res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "GetCurrentPersonalityId failed with value: %d" , res );
+        User::Leave( res );
+        }
+    
+    TRACE( "  >Connect" );
+    res = iWatcher -> Connect();
+    TRACE( "  <Connect" );
+    TRACE_INFO( "USB watcher connection value: %d, expected: %d" , res, KErrNone );
+    User::LeaveIfError( res );
+    
+    if ( currentPersonalityId != KUsbPersonalityIdPCSuiteMTP )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+        }   
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    
+    TRACE_INFO( "Set initial test personality value: %d" , stat.Int() );
+    User::LeaveIfError( stat.Int() ); 
+        
+    if ( !testOptionName.Compare( _L( "FAST_SWITCH" ) ) )
+        {
+        TRACE( "Test option: FAST_SWITCH" );
+        aTestResult = FastPersonalitySwitchTest();
+        }
+    else if ( !testOptionName.Compare( _L( "DELAYED_SWITCH" ) ) )
+        {
+        TRACE( "Test option: DELAYED_SWITCH" );
+        aTestResult = DelayedPersonalitySwitchTest();
+        }
+    else
+        {
+        TRACE( "Test option: not supported" );
+        User::Leave(KErrNotFound);
+        }
+    
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::FastPersonalitySwitchTest()
+    {
+    TInt res;
+    TInt testLoopCounter = 3;
+    TInt numberOfPersonalities = 4;
+    TInt currentPersonalityId;
+    TInt setPersonalityId;
+    TRequestStatus stat;
+    
+    TRACE( "Checking test results:" );
+    
+    for ( int i = 0; i< testLoopCounter; i++ )
+        {
+        currentPersonalityId = KUsbPersonalityIdMS;
+        for ( int j = 0; j< numberOfPersonalities; j++ )
+            {
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+            iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+            
+            TRACE( "  >SetPersonality" );
+            iWatcher -> SetPersonality( stat, currentPersonalityId, EFalse, EFalse );
+            User::WaitForRequest( stat );
+            TRACE( "  <SetPersonality" );
+            
+            res = iCenRep -> Get( KUsbWatcherPersonality, setPersonalityId );
+            TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+            TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+            TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, setPersonalityId );
+            if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != setPersonalityId )
+                return ETestCaseFailed;
+            currentPersonalityId++;
+            }
+        }
+    return ETestCasePassed;
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::DelayedPersonalitySwitchTest()
+    {
+    TInt res;
+    TInt numberOfPersonalities = 4;
+    TInt currentPersonalityId;
+    TInt setPersonalityId;
+    TRequestStatus stat;
+    
+    TRACE( "Checking test results:" );
+    currentPersonalityId = KUsbPersonalityIdMS;
+    
+    for ( int j = 0; j< numberOfPersonalities; j++ )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+        
+        TRACE( "  >SetPersonality" );
+        iWatcher -> SetPersonality( stat, currentPersonalityId, EFalse, EFalse );
+        User::WaitForRequest( stat );
+        TRACE( "  <SetPersonality" );
+        
+        res = iCenRep -> Get( KUsbWatcherPersonality, setPersonalityId );
+        TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+        TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+        TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, setPersonalityId );
+        if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != setPersonalityId )
+            return ETestCaseFailed;
+        currentPersonalityId++;
+        User::After( 7000*1000 );
+        }
+    return ETestCasePassed;
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBWatcherTest::BranchTest
+// -----------------------------------------------------------------------------
+
+void CUsbWatcherTest::BranchTestL( TUsbWatcherTestBlockParams& aParams, 
+                                    TUsbWatcherTestResult& aTestResult )
+    {
+    TInt res;
+    TRequestStatus stat;
+    TPtrC testOptionName( aParams.iTestOption1 );
+    TInt currentPersonalityId;
+    
+    res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "GetCurrentPersonalityId failed with value: %d", res );
+        User::Leave( res );
+        }
+        
+    TRACE( "  >Connect" );
+    res = iWatcher -> Connect();
+    TRACE( "  <Connect" );
+    TRACE_INFO( "USB watcher connection value: %d, expected: %d", res, KErrNone );
+    User::LeaveIfError( res );
+    
+    if ( currentPersonalityId != KUsbPersonalityIdPCSuiteMTP )
+        {
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+        }   
+    
+    TRACE( "Initial SetPersonality" );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse );
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    
+    TRACE_INFO( "Set initial test personality value: %d", stat.Int() );
+    User::LeaveIfError( stat.Int() ); 
+        
+    if ( !testOptionName.Compare( _L( "SAME_PERSONALITY_SET" ) ) )
+        {
+        TRACE( "Test option: SAME_PERSONALITY_SET" );
+        aTestResult = SetSamePersonalityTest();
+        }
+    else if ( !testOptionName.Compare( _L( "NON_BLOCKING" ) ) )
+        {
+        TRACE( "Test option: NON_BLOCKING" );
+        aTestResult = SetPersonalityBlockingOn();
+        }
+    else if ( !testOptionName.Compare( _L( "FORCE_SWITCH" ) ) )
+        {
+        TRACE( "Test option: FORCE_SWITCH" );
+        aTestResult = SetPersonalityAskOnConnectionOff();
+        }
+    else
+        {
+        TRACE( "Test option: not supported" );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetSamePersonalityTest()
+    {
+    TRequestStatus stat;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    TRACE( "Checking test results:" );
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse );   
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdPCSuiteMTP );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdPCSuiteMTP )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed;  
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityBlockingOn()
+    {
+    TRequestStatus stat;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    TRACE( "Checking test results:" );
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, KUsbPersonalityIdMS, EFalse, ETrue );   
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdMS );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdMS )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityAskOnConnectionOff()
+    {
+    TRequestStatus stat;
+    TInt currentPersonalityId;
+    TInt res;
+    
+    TRACE( "Checking test results:" );
+    
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+    iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); 
+    
+    TRACE( "  >SetPersonality" );
+    iWatcher -> SetPersonality( stat, KUsbPersonalityIdMS, ETrue, EFalse );   
+    User::WaitForRequest( stat );
+    TRACE( "  <SetPersonality" );
+    TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone );
+    
+    res = iCenRep -> Get( KUsbWatcherPersonality, currentPersonalityId );
+    TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone );
+    TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdMS );
+    
+    if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdMS )
+        return ETestCaseFailed;
+    
+    return ETestCasePassed; 
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBWatcherTest:: Other functions
+// -----------------------------------------------------------------------------
+
+TInt CUsbWatcherTest::BackupPersonalitySetting()
+    {
+    TRACE( "><Backup personality setting" )
+    return iUsbMan -> GetCurrentPersonalityId( iPersonalityIdBackup );
+    }
+
+TInt CUsbWatcherTest::RestorePersonalitySetting()
+    {
+    TRequestStatus stat;
+    TInt currentPersonalityId;
+    
+    TRACE( ">Restore personality setting" )
+    TRACE( "  >Close" );
+    iWatcher -> Close();
+    TRACE( "  <Close" );
+    
+    iUsbMan -> GetCurrentPersonalityId( currentPersonalityId );
+    if ( currentPersonalityId != iPersonalityIdBackup )
+        {   
+        TRACE( "  >Connect" );
+        iWatcher -> Connect();
+        TRACE( "  <Connect" );
+        
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) );
+        iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) );
+        
+        TRACE( "  >SetPersonality" );
+        iWatcher -> SetPersonality( stat, iPersonalityIdBackup, EFalse, EFalse );
+        User::WaitForRequest( stat );
+        TRACE( "  <SetPersonality" );
+        
+        TRACE( "  >Close" );
+        iWatcher -> Close();
+        TRACE( "  <Close" );
+        }
+    
+    TRACE( "<Restore personality setting" )
+    return stat.Int();
+    }
+
+
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest_exe.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // UsbWatcherTest_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- a/usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2007 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"
@@ -30,6 +30,8 @@
 
 const TUint32 KUsbWatcherChargingDefaultPersonality = 0x00000003;
 
+const TUint32 KUsbWatcherCertTestChargingPersonality = 0x00000004;
+
 #endif      // USBWATCHERINTERNALCRKEYS_H
 
 // End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bmarm/UsbPersonalityPluginTestu.def	Wed Sep 01 12:20:49 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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bwins/UsbPersonalityPluginTestu.def	Wed Sep 01 12:20:49 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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/conf/UsbPersonalityPluginTest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* 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:
+*
+*/
+
+[StifSettings]
+CapsModifier = UsbPersonalityPluginTest.exe
+[EndStifSettings]
+
+
+// UsbPersonalityPluginTest Module - total ... tc
+
+// UsbPersonalityPluginTest Api Tests (... tc)
+
+[Test]
+title Initialization Test
+create UsbPersonalityPluginTest tester
+tester InitializationTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Set Personality ID
+create UsbPersonalityPluginTest tester
+tester SetPersonalityTestL API MS
+delete tester
+[Endtest]
+
+[Test]
+title Show Query
+create UsbPersonalityPluginTest tester
+tester ShowQueryTestL API
+delete tester
+[Endtest]
+
+[Test]
+title Show Connection Note
+create UsbPersonalityPluginTest tester
+tester ShowConnectionNoteTestL API MTP
+delete tester
+[Endtest]
+
+[Test]
+title Create Mass Storage Plugin
+create UsbPersonalityPluginTest tester
+tester CreatePersonalityPluginTestL API MS
+delete tester
+[Endtest]
+
+[Test]
+title Create PC Suite Plugin
+create UsbPersonalityPluginTest tester
+tester CreatePersonalityPluginTestL API PCS
+delete tester
+[Endtest]
+
+[Test]
+title Create Media Transfer Plugin
+create UsbPersonalityPluginTest tester
+tester CreatePersonalityPluginTestL API MTP
+delete tester
+[Endtest]
+
+[Test]
+title Prepare Personality Start
+create UsbPersonalityPluginTest tester
+tester PreparePersonalityStartTestL API PCS
+delete tester
+[Endtest]
+
+[Test]
+title Finish Personality Start
+create UsbPersonalityPluginTest tester
+tester FinishPersonalityStartTestL API PCS
+delete tester
+[Endtest]
+
+[Test]
+title Prepare Personality Stop
+create UsbPersonalityPluginTest tester
+tester PreparePersonalityStopTestL API PCS
+delete tester
+[Endtest]
+
+[Test]
+title Finish Personality Stop
+create UsbPersonalityPluginTest tester
+tester FinishPersonalityStopTestL API PCS
+delete tester
+[Endtest]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/eabi/UsbPersonalityPluginTestu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI33CUsbPersonalityPluginActiveObject @ 2 NONAME
+	_ZTV33CUsbPersonalityPluginActiveObject @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest.mmp	Wed Sep 01 12:20:49 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:
+*
+*/
+
+
+#if defined(__S60_)
+        // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbPersonalityPluginTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+//CAPABILITY      ALL -TCB
+CAPABILITY  LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+
+DEFFILE         UsbPersonalityPluginTest.def
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE		../inc 
+
+SOURCEPATH      ../src
+SOURCE          UsbPersonalityPluginTest.cpp
+SOURCE          UsbPersonalityPluginTestBlocks.cpp UsbPersonalityPluginActiveObject.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			usbman.lib
+LIBRARY			usbpersonality.lib
+LIBRARY         platformver.lib
+LIBRARY         efsrv.lib
+LIBRARY			ecom.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_ats.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,60 @@
+;
+; 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:
+;
+
+; 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/UsbPersonalityPluginTest.dll"-"c:/Sys/Bin/UsbPersonalityPluginTest.dll"
+"../init/UsbPersonalityPluginTest_ats.ini"-"e:/testing/init/UsbPersonalityPluginTest.ini"
+"../conf/UsbPersonalityPluginTest.cfg"-"e:/testing/conf/UsbPersonalityPluginTest.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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_exe.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#if defined(__S60_)
+        // To get the OS_LAYER_SYSTEMINCLUDE-definition
+        #include <platform_paths.hrh>
+#endif
+
+TARGET          UsbPersonalityPluginTest.exe
+TARGETTYPE      exe
+UID		0 	0xEF4892C6
+
+/* Specify the capabilities according to your test environment */
+CAPABILITY      LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+MW_LAYER_SYSTEMINCLUDE
+SOURCEPATH      ../src
+
+
+SOURCE          UsbPersonalityPluginTest_exe.cpp
+
+/* Used libraries */
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+
+EPOCSTACKSIZE   40960
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_phone.pkg	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+;
+; 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:
+;
+
+; 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/UsbPersonalityPluginTest.dll"-"c:/Sys/Bin/UsbPersonalityPluginTest.dll"
+"/epoc32/release/armv5/urel/UsbPersonalityPluginTest.exe"-"c:/Sys/Bin/UsbPersonalityPluginTest.exe"
+
+"../init/UsbPersonalityPluginTest_phone.ini"-"c:/testframework/testframework.ini"
+"../conf/UsbPersonalityPluginTest.cfg"-"c:/testframework/UsbPersonalityPluginTest.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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+UsbPersonalityPluginTest.mmp
+UsbPersonalityPluginTest_exe.mmp
+
+PRJ_MMPFILES
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_ats.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,20 @@
+@rem
+@rem Copyright (c) 2010 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
+
+
+call sbs -c armv5.test
+call makesis UsbPersonalityPluginTest_ats.pkg
+call signsis UsbPersonalityPluginTest_ats.sis UsbPersonalityPluginTest_ats.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,20 @@
+@rem
+@rem Copyright (c) 2010 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
+
+
+call sbs -c armv5.test
+call makesis UsbPersonalityPluginTest_phone.pkg
+call signsis UsbPersonalityPluginTest_phone.sis UsbPersonalityPluginTest_phone.sisx x:\rd.cer x:\rd-key.pem
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginActiveObject.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * 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 USBPERSONALITYPLUGINACTIVEOBJECT_H
+#define USBPERSONALITYPLUGINACTIVEOBJECT_H
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+
+#include <cusbpersonalityplugin.h>
+#include <tusbpersonalityparams.h>
+
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+
+class CUsbPersonalityPluginActiveObject : public CActive
+    {
+public:
+    // Cancel and destroy
+    ~CUsbPersonalityPluginActiveObject();
+
+    // Two-phased constructor.
+    static CUsbPersonalityPluginActiveObject* NewL( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+    // Two-phased constructor.
+    static CUsbPersonalityPluginActiveObject* NewLC( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+public:
+    // New functions
+    // Function for making the initial request
+    void PreparePersonalityStart( TRequestStatus& aStatus);
+
+    void FinishPersonalityStart( TRequestStatus& aStatus);
+
+    void PreparePersonalityStop( TRequestStatus& aStatus);
+
+    void FinishPersonalityStop( TRequestStatus& aStatus);
+
+    void ConfirmPersonalityUnload( TRequestStatus& aStatus);
+private:
+    // C++ constructor
+    CUsbPersonalityPluginActiveObject( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* );
+
+    // Second-phase constructor
+    void ConstructL();
+
+private:
+    // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+    // Override to handle leaves from RunL(). Default implementation causes
+    // the active scheduler to panic.
+    TInt RunError(TInt aError);
+
+private:
+
+private:
+    CUsbPersonalityPlugin* iPlugin;
+    CStifLogger* iLog;
+    TUsbPersonalityParams* iParams;
+    };
+
+#endif // USBPERSONALITYPLUGINACTIVEOBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,271 @@
+/*
+ * 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 USBPERSONALITYPLUGINTEST_H
+#define USBPERSONALITYPLUGINTEST_H
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+#include <usbman.h>
+#include <cusbpersonalitynotifier.h>
+#include <cusbpersonalityplugin.h>
+#include <tusbpersonalityparams.h>
+#include <usbuinotif.h>
+#include "UsbPersonalityPluginActiveObject.h"
+
+// CONSTANTS
+// Logging path
+_LIT( KUsbPersonalityPluginTestLogPath, "\\logs\\testframework\\UsbPersonalityPluginTest\\" );
+// Logging path for ATS - for phone builds comment this line
+//_LIT( KUsbPersonalityPluginTestLogPath, "e:\\testing\\stiflogs\\" ); 
+// Log file
+_LIT( KUsbPersonalityPluginTestLogFile, "UsbPersonalityPluginTest.txt" );
+_LIT( KUsbPersonalityPluginTestLogFileWithTitle, "UsbPersonalityPluginTest_[%S].txt" );
+
+// MACROS
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Macros used to extract test block parameters
+#define TESTENTRY( A, B )\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\
+        { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\
+    if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )
+
+#define TESTPARAM( A, B )\
+    GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B );
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// Enum type used to determine test block execution result
+enum TUsbPersonalityPluginTestResult
+    {
+    ETestCasePassed, ETestCaseFailed
+    };
+
+// Enum type indicating test block parameter which should be used to store
+// data extracted from test script
+enum TTestBlockParamName
+    {
+    eTestOption1,
+    eTestOption2,
+    eTestOption3,
+    eTestIntOption1,
+    eTestIntOption2,
+    eTestIntOption3,
+    eTestCharOption1,
+    eTestCharOption2,
+    eTestCharOption3
+    };
+
+// Enum type used to indicate which get parameter function should be used
+enum TGetTestBlockParamOperation
+    {
+    eGetString, eGetInt, eGetChar
+    };
+
+enum TUsbPersonalityIds
+    {
+    EMassStorage = 2, EMediaTransfer = 4, EPCSuite = 5
+    };
+// CLASS DECLARATION
+/**
+ *  TUsbPersonalityPluginTestBlockParams test class for storing test block parameters.
+ */
+NONSHARABLE_CLASS( TUsbPersonalityPluginTestBlockParams )
+    {
+public:
+    TPtrC iTestBlockName;
+
+    TPtrC iTestOption1;
+    TPtrC iTestOption2;
+    TPtrC iTestOption3;
+
+    TInt iTestIntOption1;
+    TInt iTestIntOption2;
+    TInt iTestIntOption3;
+
+    TChar iTestCharOption1;
+    TChar iTestCharOption2;
+    TChar iTestCharOption3;
+    };
+
+/**
+ *  CUsbPersonalityPluginTest test class for STIF Test Framework TestScripter.
+ */
+NONSHARABLE_CLASS( CUsbPersonalityPluginTest ) : public CScriptBase
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUsbPersonalityPluginTest* NewL(CTestModuleIf& aTestModuleIf);
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUsbPersonalityPluginTest();
+
+public:
+    // New functions
+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
+protected:
+    // Functions from base classes
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CUsbPersonalityPluginTest(CTestModuleIf& aTestModuleIf);
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Frees all resources allocated from test methods.
+     * @since ?Series60_version
+     */
+    void TestDelete();
+
+    /**
+     * Constructs all test resources for test methods.
+     */
+    void TestConstructL();
+
+    /**
+     * Extracts test block parameters from script file
+     */
+    void TestBlocksInfoL();
+
+    /**
+     * Executes test block
+     */
+    TInt ExecuteTestBlock(CStifItemParser& aItem);
+
+    /**
+     * Executes proper get parameter function indicated by its arguments
+     */
+    void GetTestBlockParamL(TGetTestBlockParamOperation aOperation,
+            TTestBlockParamName aParamName);
+
+    /**
+     * Method used to log version of test class
+     */
+    void SendTestClassVersion();
+
+    // ADD NEW METHOD DEC HERE
+    // [TestMethods] - Do not remove 
+    void ExampleTestL(TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void InitializationTestL(TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void SetPersonalityTestL(TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void ShowNoteTestL(TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void ShowQueryTestL(TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void ShowConnectionNoteTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void CreatePersonalityPluginTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void PreparePersonalityStartTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void FinishPersonalityStartTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void PreparePersonalityStopTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    void FinishPersonalityStopTestL(
+            TUsbPersonalityPluginTestBlockParams& aParams,
+            TUsbPersonalityPluginTestResult& aTestResult);
+    
+    TInt GetIdFromString(TPtrC aBuffer);
+    TUid GetUidFromId(TInt aId);
+    
+    void InitializeTestObjectsL();
+    void DeleteTestObjects();  
+    
+public:
+    // Data
+protected:
+    // Data
+private:
+    // Data
+
+    // Member object used to store test block parameters
+    TUsbPersonalityPluginTestBlockParams iTestBlockParams;
+
+    // Used to indicate if test block with specified parameters exist
+    TBool iTestBlockFound;
+
+    // Function pointer used to call proper test block methods
+    void (CUsbPersonalityPluginTest::*iTestBlockFunction)(
+            TUsbPersonalityPluginTestBlockParams&,
+            TUsbPersonalityPluginTestResult&);
+
+    // Not own
+    CStifItemParser* iItem;
+
+    RUsb* iUsbMan;
+    CUsbPersonalityNotifier* iNotifier;
+    TUsbPersonalityParams* iParams;
+    CUsbPersonalityPlugin* iPlugin;
+    CUsbPersonalityPluginActiveObject* iActive;
+    TRequestStatus iRequestStatus;
+    // Reserved pointer for future extension
+    //TAny* iReserved;
+
+    // ADD NEW DATA DEC HERE
+
+
+public:
+    // Friend classes
+protected:
+    // Friend classes
+private:
+    // Friend classes
+
+    };
+#endif      // USBPERSONALITYPLUGINTEST_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTestDebug.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* 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:
+*
+*/
+
+#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] ");
+_LIT8( KStifEntryPrefix8, ">>> %S" );
+_LIT8( KStifExitPrefix8, "<<< %S" );
+
+const TInt KMaxLogLineLength = 512;
+
+#define TRACE_INFO( p ) { Trace p; }
+#define TRACE_FUNC_ENTRY { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifEntryPrefix8, &ptr8 ); }
+#define TRACE_FUNC_EXIT { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifExitPrefix8, &ptr8 ); }
+
+void CUsbPersonalityPluginTest::Trace(TRefByValue<const TDesC8> aFmt, ...)
+	{
+	VA_LIST list;
+	VA_START( list, aFmt );
+	TOverflowTruncate8 overflow;   
+	
+	RBuf8 buf8;
+	RBuf8 bufStifLog8;
+	
+	buf8.Create( KMaxLogLineLength );
+	buf8.Append( KStifTestPrefix8 );
+	buf8.AppendFormatList( aFmt, list, &overflow );	
+	bufStifLog8.Create( KMaxLogLineLength );
+	bufStifLog8.AppendFormatList( aFmt, list, &overflow );
+			
+	RBuf16 buf16;
+	RBuf16 bufStifLog16;
+	
+	buf16.Create( KMaxLogLineLength );
+	buf16.Copy( buf8 );
+	bufStifLog16.Create( KMaxLogLineLength );
+	bufStifLog16.Copy( bufStifLog8 );
+	
+	RDebug::Print( buf16 );
+	iLog->Log( bufStifLog16 );
+	buf8.Close();
+	bufStifLog8.Close();
+	buf16.Close();
+	bufStifLog16.Close();
+	};
+
+void CUsbPersonalityPluginTest::Trace(TRefByValue<const TDesC16> aFmt, ...)
+	{
+	VA_LIST list;
+	VA_START(list,aFmt);
+	TOverflowTruncate16 overflow;
+	
+	RBuf16 buf;
+	RBuf16 bufStifLog;
+	
+	buf.Create( KMaxLogLineLength );
+	buf.Append( KStifTestPrefix );
+	buf.AppendFormatList( aFmt, list, &overflow );
+	bufStifLog.Create( KMaxLogLineLength );
+	bufStifLog.AppendFormatList( aFmt, list, &overflow );
+	
+	RDebug::Print( buf );
+	iLog->Log( bufStifLog );
+	buf.Close();
+	bufStifLog.Close();
+	};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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 TESTDEBUG_H_
+#define TESTDEBUG_H_
+
+//  INCLUDES
+#include <e32debug.h>
+#include <e32def.h>
+
+// CONSTANTS
+_LIT8(KStifTestPrefix8, "[STIF_LOG] ");
+_LIT( KStifTestPrefix, "[STIF_LOG] ");
+_LIT8( KStifEntryPrefix8, ">>> %S" );
+_LIT8( KStifExitPrefix8, "<<< %S" );
+
+const TInt KMaxLogLineLength = 512;
+typedef TBuf8< KMaxLogLineLength > TLogBuf8;
+typedef TBuf16< KMaxLogLineLength > TLogBuf16;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( TTestLogger )
+    {
+public:
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... );
+    static inline TLogBuf16 CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... );
+    static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf );
+    };
+
+// MACROS
+#define TRACE( p ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_INFO( p, args... ) {\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_ENTRY {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+#define TRACE_FUNC_EXIT {\
+        TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\
+        TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\
+        TTestLogger::Trace( *iLog, buf );\
+        }
+
+#include "testdebug.inl"
+
+#endif /* TESTDEBUG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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:
+*
+*/
+
+#include <e32debug.h>
+
+NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow
+    {
+public:
+    void Overflow( TDes8& /*aDes*/ ) {}
+    }; 
+
+NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow
+    {
+public:
+    void Overflow( TDes16& /*aDes*/ ) {}
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC8> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate8 overflow;   
+    TLogBuf8 buf8;
+    TLogBuf16 buf16;
+    buf8.AppendFormatList( aFmt, list, &overflow );
+    buf16.Copy( buf8 );
+    return buf16;
+    };
+
+TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue<const TDesC16> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TOverflowTruncate16 overflow;
+    TLogBuf16 buf16;
+    buf16.AppendFormatList( aFmt, list, &overflow );
+    return buf16;
+    };
+
+void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf )
+    {    
+    RBuf16 buf;
+    RBuf16 bufStifLog;
+    
+    buf.Create( KMaxLogLineLength );
+    buf.Append( KStifTestPrefix );
+    buf.Append( aLogBuf );
+    bufStifLog.Create( KMaxLogLineLength );
+    bufStifLog.Append( aLogBuf );
+    
+    RDebug::Print( buf );
+    aLog.Log( bufStifLog );
+    buf.Close();
+    bufStifLog.Close();
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_ats.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,233 @@
+# 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:
+#
+
+#
+# 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= UsbPersonalityPluginTest_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= UsbPersonalityPluginTestUsbPersonalityPluginTestUsbPersonalityPluginTest
+# 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\UsbPersonalityPluginTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbPersonalityPluginTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbPersonalityPluginTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbPersonalityPluginTest 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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_phone.ini	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,234 @@
+# 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:
+#
+
+
+#
+# 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\UsbPersonalityPluginTest\
+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= UsbPersonalityPluginTestUsbPersonalityPluginTestUsbPersonalityPluginTest
+# 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\UsbPersonalityPluginTest.cfg
+[End_Module]
+
+
+# Load testmoduleUsbPersonalityPluginTest, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleUsbPersonalityPluginTest used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleUsbPersonalityPluginTest 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/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginActiveObject.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,113 @@
+/*
+ * 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:
+ *
+ */
+
+#include "UsbPersonalityPluginActiveObject.h"
+
+CUsbPersonalityPluginActiveObject::CUsbPersonalityPluginActiveObject( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams) : CActive( EPriorityStandard ) // Standard priority
+    {
+    iPlugin = aPlugin;
+    iLog = aLog;
+    iParams = aParams;
+    }
+
+CUsbPersonalityPluginActiveObject* CUsbPersonalityPluginActiveObject::NewLC(CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams)
+    {
+    CUsbPersonalityPluginActiveObject* self =
+            new (ELeave) CUsbPersonalityPluginActiveObject( aPlugin, aLog, aParams);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CUsbPersonalityPluginActiveObject* CUsbPersonalityPluginActiveObject::NewL(CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams)
+    {
+    CUsbPersonalityPluginActiveObject* self =
+            CUsbPersonalityPluginActiveObject::NewLC( aPlugin, aLog, aParams);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+void CUsbPersonalityPluginActiveObject::ConstructL()
+    {
+    CActiveScheduler::Add(this); // Add to scheduler
+    }
+
+CUsbPersonalityPluginActiveObject::~CUsbPersonalityPluginActiveObject()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    // Delete instance variables if any
+    }
+
+void CUsbPersonalityPluginActiveObject::DoCancel()
+    {
+    }
+
+void CUsbPersonalityPluginActiveObject::RunL()
+    {
+    CActiveScheduler::Stop();
+    }
+
+TInt CUsbPersonalityPluginActiveObject::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+void CUsbPersonalityPluginActiveObject::PreparePersonalityStart( TRequestStatus& aStatus)
+    {
+    iPlugin->PreparePersonalityStart(aStatus);
+    RDebug::Printf( "prepare personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbPersonalityPluginActiveObject::FinishPersonalityStart( TRequestStatus& aStatus)
+    {
+    iPlugin->FinishPersonalityStart(aStatus);
+    RDebug::Printf( "finish personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbPersonalityPluginActiveObject::PreparePersonalityStop( TRequestStatus& aStatus)
+    {
+    iPlugin->PreparePersonalityStop(aStatus);
+    RDebug::Printf( "prepare personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbPersonalityPluginActiveObject::FinishPersonalityStop( TRequestStatus& aStatus)
+    {
+    iPlugin->FinishPersonalityStop(aStatus);
+    RDebug::Printf( "finish personality start, status: %d", aStatus.Int());
+    
+    SetActive();
+    CActiveScheduler::Start();
+    }
+
+void CUsbPersonalityPluginActiveObject::ConfirmPersonalityUnload( TRequestStatus& aStatus)
+    {
+    iPlugin->ConfirmPersonalityUnload(aStatus);
+    RDebug::Printf( "confirm personality unload, status: %d", aStatus.Int());
+    
+    iParams->PersonalityNotifier().CancelQuery(KQueriesNotifier);
+    SetActive();
+    CActiveScheduler::Start();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,326 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "UsbPersonalityPluginTest.h"
+#include <SettingServerClient.h>
+#include "testdebug.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::CUsbPersonalityPluginTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUsbPersonalityPluginTest::CUsbPersonalityPluginTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUsbPersonalityPluginTest::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( KUsbPersonalityPluginTestLogFileWithTitle, &title );
+        }
+    else
+        {
+        logFileName.Copy( KUsbPersonalityPluginTestLogFile );
+        }
+
+    iLog = CStifLogger::NewL( KUsbPersonalityPluginTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    TestConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUsbPersonalityPluginTest* CUsbPersonalityPluginTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CUsbPersonalityPluginTest* self = new (ELeave) CUsbPersonalityPluginTest( aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CUsbPersonalityPluginTest::~CUsbPersonalityPluginTest()
+    { 
+
+    // Delete resources allocated from test methods
+    TestDelete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+
+TInt CUsbPersonalityPluginTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+    return ExecuteTestBlock( aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::ExecuteTestBlock
+// -----------------------------------------------------------------------------
+
+TInt CUsbPersonalityPluginTest::ExecuteTestBlock( CStifItemParser& aItem )
+    {
+    TRACE_FUNC_ENTRY
+    iItem = &aItem;    
+    TInt res;
+    TUsbPersonalityPluginTestResult testResult;
+    
+    res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Getting test block name failed with: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName )
+    
+    TRACE( "Extracting test block parameters..." )
+    TRAP( res, TestBlocksInfoL() );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "Extracting parameters failed: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    if ( !iTestBlockFound )
+        {
+        TRACE( "Test block not found!" )
+        TRACE_FUNC_EXIT
+        return KErrNotFound;
+        }    
+    TRACE( "Extracting parameters successful" )
+    
+    TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) );
+    if ( res != KErrNone )
+        {
+        TRACE_INFO( "ExecuteTestBlockL error: %d", res )
+        TRACE_FUNC_EXIT
+        return res;
+        }
+    
+    STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
+    TRACE( "Test block passed!" );
+    TRACE_FUNC_EXIT 
+    return KErrNone;
+    } 
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::GetTestBlockParamL
+// -----------------------------------------------------------------------------
+
+void CUsbPersonalityPluginTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName )
+    {    
+    switch( aOperation )
+        {
+        case eGetString:
+            {
+            switch ( aParamName )
+                {
+                case eTestOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) );
+                    break;
+                    }
+                case eTestOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) );
+                    break;
+                    }
+                case eTestOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetInt:
+            {
+            switch ( aParamName )
+                {
+                case eTestIntOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) );
+                    break;
+                    }
+                case eTestIntOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) );
+                    break;
+                    }
+                case eTestIntOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    break;
+                    }
+                }
+            break;
+            }
+        case eGetChar:            
+            {
+            switch ( aParamName )
+                {
+                case eTestCharOption1:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) );
+                    break;
+                    }
+                case eTestCharOption2:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) );
+                    break;
+                    }
+                case eTestCharOption3:
+                    {
+                    User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) );
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    }
+
+//-----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CUsbPersonalityPluginTest::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("UsbPersonalityPluginTest.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* ) CUsbPersonalityPluginTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTestBlocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,508 @@
+/*
+ * 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:
+ *
+ */
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "UsbPersonalityPluginTest.h"
+#include "testdebug.h"
+#include <ecom/ecom.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+const TInt KIdPCSuite = 5;
+const TInt KIdMediaTransfer = 4;
+const TInt KIdMassStorage = 2;
+
+const TUid KUidPCSuite =
+    {
+    0x102068DF
+    };
+const TUid KUidMediaTransfer =
+    {
+    0x10282C70
+    };
+//const TUid KUidPCSuite2 =
+//    {
+//    0x2000B5D2
+//    };
+//const TUid KUidPhoneAsModem =
+//    {
+//    0x20029E41
+//    };
+const TUid KUidMassStorage =
+    {
+    0x1020DF7B
+    };
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::TestConstructL
+// Construct here all test resources for test methods. 
+// Called from ConstructL. 
+// -----------------------------------------------------------------------------
+
+void CUsbPersonalityPluginTest::TestConstructL()
+    {
+    TRACE_FUNC_ENTRY
+
+    iUsbMan = new (ELeave) RUsb;
+    iUsbMan->Connect();
+    iNotifier = CUsbPersonalityNotifier::NewL();
+    iParams = new (ELeave) TUsbPersonalityParams(*iUsbMan, *iNotifier);
+
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::TestDelete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+
+void CUsbPersonalityPluginTest::TestDelete()
+    {
+    TRACE_FUNC_ENTRY
+
+    if (iUsbMan)
+        {
+        iUsbMan->Close();
+        delete iUsbMan;
+        iUsbMan = NULL;
+        }
+    if (iNotifier)
+        {
+        delete iNotifier;
+        iNotifier = NULL;
+        }
+    if (iParams)
+        {
+        delete iParams;
+        iParams = NULL;
+        }
+    if (iPlugin)
+        {
+        delete iPlugin;
+        iPlugin = NULL;
+        }
+
+    REComSession::FinalClose();
+
+    TRACE_FUNC_EXIT
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::TestBlocksInfoL
+// Add new test block parameter entries below
+// -----------------------------------------------------------------------------
+
+void CUsbPersonalityPluginTest::TestBlocksInfoL()
+    {
+
+    TESTENTRY( "InitializationTestL", CUsbPersonalityPluginTest::InitializationTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "SetPersonalityTestL", CUsbPersonalityPluginTest::SetPersonalityTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "ShowQueryTestL", CUsbPersonalityPluginTest::ShowQueryTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        }
+    TESTENTRY( "ShowConnectionNoteTestL", CUsbPersonalityPluginTest::ShowConnectionNoteTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "CreatePersonalityPluginTestL", CUsbPersonalityPluginTest::CreatePersonalityPluginTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "PreparePersonalityStartTestL", CUsbPersonalityPluginTest::PreparePersonalityStartTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "FinishPersonalityStartTestL", CUsbPersonalityPluginTest::FinishPersonalityStartTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "PreparePersonalityStopTestL", CUsbPersonalityPluginTest::PreparePersonalityStopTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    TESTENTRY( "FinishPersonalityStopTestL", CUsbPersonalityPluginTest::FinishPersonalityStopTestL )
+        {
+        TESTPARAM( eGetString, eTestOption1 )
+        TESTPARAM( eGetString, eTestOption2 )
+        }
+    }
+
+// Add test block methods implementation here
+// -----------------------------------------------------------------------------
+// CUsbPersonalityPluginTest::ExampleTestL
+// -----------------------------------------------------------------------------
+
+void CUsbPersonalityPluginTest::ExampleTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+
+    if (!aParams.iTestOption1.Compare(_L( "API" )))
+        {
+        TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if (!aParams.iTestOption1.Compare(_L( "MODULE" )))
+        {
+        TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else if (!aParams.iTestOption1.Compare(_L( "BRANCH" )))
+        {
+        TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 )
+        TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 )
+        TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 )
+        TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) )
+        }
+    else
+        {
+        TRACE( "Invalid test parameter" )
+        TRACE_FUNC_EXIT
+        User::Leave(KErrNotFound);
+        }
+
+    aTestResult = ETestCasePassed;
+    TRACE_FUNC_EXIT
+    }
+
+// Add other member functions implementation here
+void CUsbPersonalityPluginTest::InitializeTestObjectsL()
+    {
+    iActive = CUsbPersonalityPluginActiveObject::NewL(iPlugin, iLog, iParams);
+    TRACE ( " test objects initialized " );
+    }
+
+void CUsbPersonalityPluginTest::DeleteTestObjects()
+    {
+    delete iActive;
+    iActive = NULL;
+    }
+
+void CUsbPersonalityPluginTest::InitializationTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    aTestResult = ETestCaseFailed;
+
+    if (iNotifier)
+        {
+        aTestResult = ETestCasePassed;
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::SetPersonalityTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    aTestResult = ETestCaseFailed;
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TRACE_INFO( " Set personality ID: %d", id );
+
+    iParams->SetPersonalityId(id);
+    if (iParams->PersonalityId() == id)
+        {
+        aTestResult = ETestCasePassed;
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::ShowQueryTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    aTestResult = ETestCaseFailed;
+
+    TBuf8<8> iDummyBuf;
+
+    TUSBQueriesNotifierParamsPckg queryParams;
+    queryParams().iQuery = EUSBNotEnoughRam;
+
+    TInt res = iNotifier->ShowQuery(KQueriesNotifier, queryParams, iDummyBuf);
+    User::After(3000000);
+    TRACE_INFO( " Query show ret %d ", res )
+    if (res == KErrNone)
+        {
+        aTestResult = ETestCasePassed;
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::ShowConnectionNoteTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    aTestResult = ETestCaseFailed;
+
+    TBuf8<8> iDummyBuf;
+
+    TUSBConnectionNotifierParamsPckg noteParams;
+//    noteParams().iPersonalityId = personalityId;
+
+    TInt res = iNotifier->ShowQuery(KCableConnectedNotifierUid, noteParams,
+            iDummyBuf);
+    User::After(3000000);
+    TRACE_INFO( " Connection note show ret %d ", res )
+    if (res == KErrNone)
+        {
+        aTestResult = ETestCasePassed;
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+TInt CUsbPersonalityPluginTest::GetIdFromString(TPtrC aBuffer)
+    {
+
+    if (!aBuffer.Compare(_L("MS")))
+        {
+        TRACE( " mass storage " );
+        return KIdMassStorage;
+        }
+    else if (!aBuffer.Compare(_L("PCS")))
+        {
+        TRACE( " pc suite " );
+        return KIdPCSuite;
+        }
+    else if (!aBuffer.Compare(_L("MTP")))
+        {
+        TRACE( " media transfer " );
+        return KIdMediaTransfer;
+        }
+    else
+        {
+        TRACE( " not found " );
+        return 0;
+        }
+    }
+
+TUid CUsbPersonalityPluginTest::GetUidFromId(TInt aId)
+    {
+    switch (aId)
+        {
+        case KIdMassStorage:
+            return KUidMassStorage;
+        case KIdPCSuite:
+            return KUidPCSuite;
+        case KIdMediaTransfer:
+            return KUidMediaTransfer;
+        default:
+            return TUid::Uid(0x0);
+        }
+    }
+
+void CUsbPersonalityPluginTest::CreatePersonalityPluginTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    aTestResult = ETestCaseFailed;
+
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TUid uid = GetUidFromId(id);
+
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid);
+
+    if (iPlugin)
+        {
+        TRACE( " plugin created ")
+        aTestResult = ETestCasePassed;
+        }
+
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::PreparePersonalityStartTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    
+    aTestResult = ETestCaseFailed;
+    
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TUid uid = GetUidFromId(id);
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid);
+
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    aTestResult = ETestCasePassed;
+    DeleteTestObjects();
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::FinishPersonalityStartTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    
+    aTestResult = ETestCaseFailed;
+    
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TUid uid = GetUidFromId(id);
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid);
+
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    iActive->FinishPersonalityStart(iRequestStatus);
+    User::LeaveIfError(iRequestStatus.Int());
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::PreparePersonalityStopTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    
+    aTestResult = ETestCaseFailed;
+    
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TUid uid = GetUidFromId(id);
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid);
+
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    
+    TRACE_FUNC_EXIT
+    }
+
+void CUsbPersonalityPluginTest::FinishPersonalityStopTestL(
+        TUsbPersonalityPluginTestBlockParams& aParams,
+        TUsbPersonalityPluginTestResult& aTestResult)
+    {
+    TRACE_FUNC_ENTRY
+    
+    aTestResult = ETestCaseFailed;
+    
+    TInt id = GetIdFromString(aParams.iTestOption2);
+    TUid uid = GetUidFromId(id);
+    iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid);
+
+    InitializeTestObjectsL();
+
+    iActive->PreparePersonalityStart(iRequestStatus);
+    TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->FinishPersonalityStart(iRequestStatus);
+    TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->PreparePersonalityStop(iRequestStatus);
+    TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    iActive->FinishPersonalityStop(iRequestStatus);
+    TRACE_INFO( "finish personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone );
+    User::LeaveIfError(iRequestStatus.Int());
+
+    aTestResult = ETestCasePassed;
+
+    DeleteTestObjects();
+    
+    TRACE_FUNC_EXIT
+    }
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest_exe.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+#include <StifTestInterface.h>
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: -
+
+    Method: E32Main
+
+    Description: 
+
+    Parameters: None
+
+    Return Values: TInt: Symbian error code
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+GLDEF_C TInt E32Main()
+    {
+    _LIT( KProcessMsgStart, "New process starting" );
+    RDebug::Print( KProcessMsgStart );
+
+
+    // This starts a new session that get capabilites that is used in 
+    // usbpersonalityplugintest_exe.mmp file.
+    TInt r = StartSession();
+
+    _LIT( KProcessMsgEnd, "New process ends" );
+    RDebug::Print( KProcessMsgEnd );
+
+    return r;
+
+    }
+
+// End of File
--- a/usbservices_plat/usb_watcher_api/inc/usbpersonalityids.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbservices_plat/usb_watcher_api/inc/usbpersonalityids.h	Wed Sep 01 12:20:49 2010 +0100
@@ -25,6 +25,7 @@
 #define KUsbPersonalityIdMTP          0x04
 #define KUsbPersonalityIdPCSuiteMTP  0x05
 #define KUsbPersonalityIdModemInst  0x06
+#define KUsbPersonalityIdRNDIS       0x08
 
 #endif   // USBPERSONALITYIDS_H
 
--- a/usbuis/group/bld.inf	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -15,5 +15,8 @@
 *
 */
 
+
+#include "../usbui/group/bld.inf"
+#include "../usbuinotif/group/bld.inf"
 #include "../imageprintuiprovider/group/bld.inf"
-#include "../imageprintui/group/bld.inf"
+#include "../imageprintui/group/bld.inf"
\ No newline at end of file
--- a/usbuis/imageprintui/src/notes.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/imageprintui/src/notes.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -192,6 +192,7 @@
     FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL; PrepareLC next"));	
    	iProgressDialog->PrepareLC(R_PROGRESS_NOTE);
 	CEikProgressInfo* progressBar = iProgressDialog->GetProgressInfoL(); // not taking ownership
+	progressBar = iProgressDialog->GetProgressInfoL();
 	FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL; progressinfo got"));	
 	
     progressBar->SetFinalValue( KProgressFinishValue );
--- a/usbuis/imageprintui/src/settingscontainer.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/imageprintui/src/settingscontainer.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -36,7 +36,7 @@
 #include "settingsitems.h"
 #include "settingstables.h"
 #ifdef __SERIES60_HELP
-//#include <csxhelp/usb.hlp.hrh>   // Help id
+#include <csxhelp/usb.hlp.hrh>   // Help id
 #endif
 
 
@@ -254,12 +254,10 @@
 //
 void CSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
 	{
- /*
     FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::GetHelpContext"));
 	aContext.iMajor = KUidUSB; 
 	aContext.iContext = KUSB_HLP_PRINT_SETTINGS;
     FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::GetHelpContext complete"));
-*/
 	}
 
 
--- a/usbuis/usbindicatorplugin/inc/usbaddressedindicator.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* 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 USBADDRESSEDINDICATOR_H
-#define USBADDRESSEDINDICATOR_H
-
-
-#include <hbindicatorinterface.h>
-
-/**
- * USB indicator class. 
- * Handles client request and showing the indications. 
- */
-class UsbAddressedIndicator : public HbIndicatorInterface
-{
-    friend class TestUsbIndicatorPlugin;
-
-public:
-    /**
-     * Constructor
-     */
-    UsbAddressedIndicator(const QString &indicatorType);
-    
-    /**
-     * Destructor
-     */
-    ~UsbAddressedIndicator();
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleInteraction(InteractionType type);
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    QVariant indicatorData(int role) const;
-    
-    
-protected:
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleClientRequest(RequestType type, const QVariant &parameter);
-    
-private: 
-
-    QString mSecDisplayName;
-    
-};
-
-#endif /* USBADDRESSEDINDICATOR_H */
-
-
-
-
--- a/usbuis/usbindicatorplugin/inc/usbdebug.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2009-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 USBDEBUG_H
-#define USBDEBUG_H
-
-#include <QtDebug>
-
-#if defined(_DEBUG)
-    inline QDebug myDebug()
-    {
-        return qDebug();
-    }
-#else
-    inline QNoDebug myDebug()
-    {
-        return QNoDebug();
-    }
-#endif
-
-
-#endif // USBDEBUG_H
--- a/usbuis/usbindicatorplugin/inc/usbdisconnectingindicator.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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 USBDISCONNECTINGINDICATOR_H
-#define USBDISCONNECTINGINDICATOR_H
-
-#include <hbindicatorinterface.h>
-#include "usbindicatorplugin.h"
-
-/**
- * USB indicator class. 
- * Handles client request and showing the indications. 
- */
-class USBDisconnectingIndicator : public HbIndicatorInterface
-{
-    friend class TestUsbIndicatorPlugin;
-
-public:
-    /**
-     * Constructor
-     */
-    USBDisconnectingIndicator(const QString &indicatorType);
-    
-    /**
-     * Destructor
-     */
-    ~USBDisconnectingIndicator();
-       
-    /**
-     * @see HbIndicatorInterface
-     */
-    QVariant indicatorData(int role) const;
-    
-    
-protected:
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleClientRequest(RequestType type, const QVariant &parameter);
-    
-    
-};
-
-#endif /* USBDISCONNECTINGINDICATOR_H */
-
-
-
-
--- a/usbuis/usbindicatorplugin/inc/usbindicator.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* 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: USB Indicator Class
-*
-*/
-
-#ifndef USBINDICATOR_H
-#define USBINDICATOR_H
-
-#include "usbindicatorplugin.h"
-#include <hbindicatorinterface.h>
-
-#define KUsbIconFile "qtg_large_usb"
-
-/**
- * USB indicator class. 
- * Handles client request and showing the indications. 
- */
-class USBIndicator : public HbIndicatorInterface
-{
-    friend class TestUsbIndicatorPlugin;
-    
-public:
-    /**
-     * Constructor
-     */
-    USBIndicator(const QString &indicatorType);
-    
-    /**
-     * Destructor
-     */
-    ~USBIndicator();
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleInteraction(InteractionType type);
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    QVariant indicatorData(int role) const;
-    
-protected:
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleClientRequest(RequestType type, const QVariant &parameter);
-    
-private: 
-
-    QString mSecDisplayName;
-};
-
-#endif /* USBINDICATOR_H*/
-
-
-
-
--- a/usbuis/usbindicatorplugin/inc/usbindicatorplugin.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
-* 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: USB Indicator Plugin Class
-*
-*/
-
-#ifndef USBINDICATORPLUGIN_H
-#define USBINDICATORPLUGIN_H
-
-
-#include <hbindicatorplugininterface.h>
-#include <hbindicatorinterface.h>
-#include <QTranslator>
-
-const QString ConnectedIndicator = ("com.nokia.hb.indicator.usb.device.connected/1.0");
-const QString AddressedIndicator = ("com.nokia.hb.indicator.usb.device.inprogress/1.0" );
-const QString MassStorageIndicator = ("com.nokia.hb.indicator.usb.host.massstorage/1.0" );
-const QString UsbDisconnectingIndicator = ("com.nokia.hb.indicator.usb.host.disconnecting/1.0" );
-
-_LIT(KUSBExe, "USBSettingsApp.exe");
-const TInt KUSBUIUid = 0x2002E70C;
-
-/*!
-   USB indicator plugin class. 
-   Main class of USB indicator plugin. 
- */
-class UsbIndicatorPlugin : public QObject, public HbIndicatorPluginInterface
-{
-    Q_OBJECT
-    Q_INTERFACES(HbIndicatorPluginInterface)
-
-public:
-    /*!
-       Constructor
-     */
-    UsbIndicatorPlugin();
-     
-     /*!
-        Destructor
-      */
-    ~UsbIndicatorPlugin();
-    
-    /*!
-       @see HbIndicatorPluginInterface
-     */
-    QStringList indicatorTypes() const;
-    
-    /*!
-       @see HbIndicatorPluginInterface
-     */
-    inline bool accessAllowed(const QString &indicatorType,
-            const QVariantMap &securityInfo) const;   
-    /*!
-       @see HbIndicatorPluginInterface
-     */
-    HbIndicatorInterface* createIndicator(const QString &indicatorType);
-    
-    /*!
-       @see HbIndicatorPluginInterface
-     */
-    inline int error() const;
-    
-private:
-    Q_DISABLE_COPY(UsbIndicatorPlugin)
-    
-    /*!
-       Error value
-     */
-    int mError;
-    
-    /*!
-       Indicator types 
-       supported indicator types. 
-     */
-    QStringList mIndicatorTypes;
-    
-    bool mTranslatorLoaded;
-    
-    QTranslator mTranslator;
-};
-
-// ----------------------------------------------------------------------------
-// UsbIndicatorPlugin::accessAllowed
-// ----------------------------------------------------------------------------
-bool UsbIndicatorPlugin::accessAllowed(const QString &indicatorType,
-    const QVariantMap &securityInfo) const
-{
-    Q_UNUSED(indicatorType)
-    Q_UNUSED(securityInfo)
-
-    // This plugin doesn't perform operations that may compromise security.
-    // All clients are allowed to use.
-    return true;
-}
-
-// ----------------------------------------------------------------------------
-// UsbIndicatorPlugin::error
-// ----------------------------------------------------------------------------
-inline int UsbIndicatorPlugin::error() const
-{
-    return mError;
-}
-
-
-#endif /* USBIndicatorPlugin_H */
--- a/usbuis/usbindicatorplugin/inc/usbmassstorageindicator.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* 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: USB Mass Storage Indicator Class
-*
-*/
-
-#ifndef USBMASSSTORAGEINDICATOR_H
-#define USBMASSSTORAGEINDICATOR_H
-
-#include <hbindicatorinterface.h>
-#include "usbindicatorplugin.h"
-
-/**
- * USB mass storage indicator class. 
- * Handles client request and showing the indications. 
- */
-class UsbMassStorageIndicator : public HbIndicatorInterface
-{
-    friend class TestUsbIndicatorPlugin;
-    
-public:
-    /**
-     * Constructor
-     */
-    UsbMassStorageIndicator(const QString &indicatorType);
-    
-    /**
-     * Destructor
-     */
-    ~UsbMassStorageIndicator();
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleInteraction(InteractionType type);
-    
-    /**
-     * @see HbIndicatorInterface
-     */
-    QVariant indicatorData(int role) const;
-    
-protected:
-    /**
-     * @see HbIndicatorInterface
-     */
-    bool handleClientRequest(RequestType type, const QVariant &parameter);
-    
-private: 
-
-    QString mSecDisplayName;
-    
-    bool mEjectStarted;
-};
-
-#endif /* USBMASSSTORAGEINDICATOR_H */
--- a/usbuis/usbindicatorplugin/rom/usbindicatorplugin.iby	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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 __USBINDICATORPLUGIN_IBY__
-#define __USBINDICATORPLUGIN_IBY__
-
-REM DLL
-
-#ifdef __USB
-file=ABI_DIR\UREL\USBIndicatorPlugin.dll               SHARED_LIB_DIR\USBIndicatorPlugin.dll UNPAGED
-data=\epoc32\data\z\pluginstub\USBIndicatorPlugin.qtplugin   \resource\plugins\indicators\USBIndicatorPlugin.qtplugin
-#endif
-#endif
\ No newline at end of file
--- a/usbuis/usbindicatorplugin/rom/usbindicatorpluginresources.iby	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* 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 USBINDICATORPLUGINRESOURCES_IBY
-#define USBINDICATORPLUGINRESOURCES_IBY
-// Use standard macros
-#include <data_caging_paths_for_iby.hrh>
-
-data=DATAZ_\QT_TRANSLATIONS_DIR\usbindimenu.qm QT_TRANSLATIONS_DIR\usbindimenu.qm
-
-#endif
\ No newline at end of file
--- a/usbuis/usbindicatorplugin/src/usbaddressedindicator.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include "usbaddressedindicator.h" 
-#include <QVariant>
-#include <e32uid.h>
-#include <apadef.h>
-#include "usbindicatorplugin.h"
-#include "usbindicator.h"
-#include "usbdebug.h"
-
-
-/*!
-   UsbAddressedIndicator::UsbAddressedIndicator
-*/ 
-UsbAddressedIndicator::UsbAddressedIndicator(const QString &indicatorType) :
-HbIndicatorInterface(indicatorType,
-        HbIndicatorInterface::ProgressCategory,
-        InteractionActivated)
-{
-}
-
-/*!
-   UsbAddressedIndicator::~UsbAddressedIndicator
-*/
-UsbAddressedIndicator::~UsbAddressedIndicator()
-{
-}
-
-
-/*!
-   UsbAddressedIndicator::handleInteraction
-*/
-bool UsbAddressedIndicator::handleInteraction(InteractionType type)
-{ 
-    myDebug() << ">>> UsbAddressedIndicator::handleInteraction";
-    bool handled = false;
-    TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
-                            TUid::Uid(KUSBUIUid));    
-    if (type == InteractionActivated) {
-        RProcess usbUiProcess;                
-        TInt result = usbUiProcess.Create(KUSBExe(), KNullDesC, uidtype);
-        if (result == KErrNone) {
-            usbUiProcess.Resume();
-        }
-        usbUiProcess.Close();         
-        handled = true;                
-    }
-    myDebug() << "<<< UsbAddressedIndicator::handleInteraction";
-    return handled;
-}
-
-/*!
-   UsbAddressedIndicator::indicatorData
-   returns the data and icon that needs to be displayed in the universal pop up and indicator menu 
-*/
-QVariant UsbAddressedIndicator::indicatorData(int role) const
-{
-    myDebug() << ">>> UsbAddressedIndicator::indicatorData";
-    switch (role) {
-    	case PrimaryTextRole:
-		{ 
-        	QString text = QString(hbTrId("txt_usb_dblist_usb_connecting"));
-        	return text;
-    	}
-		case DecorationNameRole:
-    	{
-	    	QString iconName(KUsbIconFile);
-        	return iconName;
-    	}
-		default: 
-        	return QVariant();      
-    }
-}
-
-/*!
-   UsbAddressedIndicator::handleClientRequest
-   handles client's activate and deactivate request
-*/
-bool UsbAddressedIndicator::handleClientRequest( RequestType type, 
-        const QVariant &parameter)
-{ 
-    myDebug() << ">>> UsbAddressedIndicator::handleClientRequest";
-    switch (type) {
-    	case RequestActivate:
-    		emit dataChanged();
-        	break;
-    	default:
-    		emit deactivate();
-        	break;
-    }
-   	myDebug() << "<<< UsbAddressedIndicator::handleClientRequest";
-   	//request always handled
-   	return true;
-}
-
-
--- a/usbuis/usbindicatorplugin/src/usbdisconnectingindicator.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include "usbdisconnectingindicator.h" 
-#include <QVariant>
-#include "usbindicatorplugin.h"
-#include "usbindicator.h"
-
-
-/*!
-   UsbDisconnectingIndicator::UsbDisconnectingIndicator
-*/ 
-USBDisconnectingIndicator::USBDisconnectingIndicator(const QString &indicatorType) :
-HbIndicatorInterface(indicatorType,
-        HbIndicatorInterface::ProgressCategory,
-        NoInteraction)
-{
-}
-
-/*!
-   USBDisconnectingIndicator::~USBDisconnectingIndicator
-*/
-USBDisconnectingIndicator::~USBDisconnectingIndicator()
-{
-}
-
-
-/*!
-   USBDisconnectingIndicator::indicatorData
-   returns the data and icon that needs to be displayed in the universal pop up and indicator menu 
-*/
-QVariant USBDisconnectingIndicator::indicatorData(int role) const
-{
-    switch(role) {
-   		case PrimaryTextRole: 
-    	{
-        	QString text = QString(hbTrId("txt_usb_dblist_usb_disconnecting"));
-        	return text;
-    	}
-    	case DecorationNameRole:
-    	{
-        	QString iconName(KUsbIconFile);
-        	return iconName;
-    	}
-    	default: 
-        	return QVariant();      
-    }
-}
-
-/*!
-   UsbDisconnectingIndicator::handleClientRequest
-   handles client's activate and deactivate request
-*/
-bool USBDisconnectingIndicator::handleClientRequest( RequestType type, 
-        const QVariant &parameter)
-{ 
-    switch (type) {
-    	case RequestActivate:
-			emit dataChanged();
-			break;
-        default:
-            emit deactivate();
-            break;
-    }
-    //request always handled
-    return true;
-}
-
-
--- a/usbuis/usbindicatorplugin/src/usbindicator.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include "usbindicator.h" 
-#include <QVariant>
-#include <e32uid.h>
-#include <apadef.h>
-#include "usbdebug.h"
-
-const QString TextIdPrefix = ("txt_usb_dblist_usb_connected_val_");
-/*!
-   USBIndicator::USBIndicator
-*/ 
-USBIndicator::USBIndicator(const QString &indicatorType) :
-HbIndicatorInterface(indicatorType,
-        HbIndicatorInterface::SettingCategory,
-        InteractionActivated)
-{
-}
-
-/*!
-   USBIndicator::~USBIndicator
-*/
-USBIndicator::~USBIndicator()
-{
-}
-
-
-/*!
-   USBIndicator::handleInteraction
-*/
-bool USBIndicator::handleInteraction(InteractionType type)
-{
-    myDebug() << ">>> USBIndicator::handleInteraction";
-    bool handled = false;
-    TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
-                            TUid::Uid(KUSBUIUid));    
-    if (type == InteractionActivated) {
-        RProcess usbUiProcess;                
-        TInt result = usbUiProcess.Create(KUSBExe(), KNullDesC, uidtype);
-        if (result == KErrNone) {
-            usbUiProcess.Resume();
-        }
-        usbUiProcess.Close();         
-        handled = true;                
-    }
-    myDebug() << "<<< USBIndicator::handleInteraction";
-    return handled;
-}
-
-/*!
-   USBIndicator::indicatorData
-   returns the data and icon that needs to be displayed in the universal pop up and indicator menu 
-*/
-QVariant USBIndicator::indicatorData(int role) const
-{
-    myDebug() << ">>> USBIndicator::indicatorData, role is " << role;
-    switch(role) {
-    	case PrimaryTextRole: 
-        {
-        	QString text = QString(hbTrId("txt_usb_dblist_usb_connected"));
-        	return text;
-        }
-    	case SecondaryTextRole:
-        {
-        	return mSecDisplayName;
-        }
-   	 	case DecorationNameRole:
-        {
-        	QString iconName(KUsbIconFile);
-        	return iconName;
-        }
-    	default: 
-        	return QVariant();      
-    }
-}
-
-/*!
-   USBIndicator::handleClientRequest
-   handles client's activate and deactivate request
-*/
-bool USBIndicator::handleClientRequest( RequestType type, 
-        const QVariant &parameter)
-{ 
-    myDebug() << ">>> USBIndicator::handleClientRequest";
-    switch (type) {
-        case RequestActivate:
-            {
-            QString friendlyName = parameter.toString();
-            friendlyName.replace( QChar(' '), QChar('_') );
-            QString textId = TextIdPrefix + friendlyName;
-            mSecDisplayName = hbTrId(textId.toAscii());  
-            emit dataChanged();
-            }
-            break;
-        default:
-            mSecDisplayName.clear();
-            emit deactivate();
-            break;
-    }
-    //request always handled
-   	myDebug() << "<<< USBIndicator::handleClientRequest";
-    return true;
-}
--- a/usbuis/usbindicatorplugin/src/usbindicatorplugin.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include "usbindicatorplugin.h"
-#include <QString>
-#include <QLocale>
-#include <QApplication>
-#include "usbindicator.h"
-#include "usbaddressedindicator.h"
-#include "usbmassstorageindicator.h"
-#include "usbdisconnectingindicator.h"
-#include "usbdebug.h"
-
-Q_EXPORT_PLUGIN(UsbIndicatorPlugin)
-
-/*!
-   UsbIndicatorPlugin::UsbIndicatorPlugin
-*/
-UsbIndicatorPlugin::UsbIndicatorPlugin() : mError(0), mTranslatorLoaded(0)
-{
-}
-
-/*!
-   UsbIndicatorPlugin::~UsbIndicatorPlugin
-*/
-UsbIndicatorPlugin::~UsbIndicatorPlugin()
-{
-    if (mTranslatorLoaded) {
-        QApplication::removeTranslator(&mTranslator); 
-    }
-}
-
-/*!
-   UsbIndicatorPlugin::indicatorTypes
-   Return notification types this plugin implements
-*/
-QStringList UsbIndicatorPlugin::indicatorTypes() const
-{
-    myDebug() << ">>> UsbIndicatorPlugin::indicatorTypes";
-    QStringList types; 
-    types << ConnectedIndicator;
-    types << AddressedIndicator;
-    types << MassStorageIndicator;
-    types << UsbDisconnectingIndicator;
-    return types;
-}
-
-
-
-/*!
-   UsbIndicatorPlugin::createIndicator
-   Creates and returns the HbIndicatorInterface
-*/
-HbIndicatorInterface* UsbIndicatorPlugin::createIndicator(const QString &indicatorType)
-{  
-    myDebug() << ">>> UsbIndicatorPlugin::createIndicator";
-    if (!mTranslatorLoaded) {
-        // add translator for application library
-        QString locale = QLocale::system().name();
-        QString filename = QString("usbindimenu_") + locale;             
-        bool success = mTranslator.load(filename, QString("z:/resource/qt/translations"));
-        QApplication::installTranslator(&mTranslator);
-        mTranslatorLoaded = true;    
-    }
-        
-    HbIndicatorInterface *indicator = NULL;    
-    if (indicatorType == ConnectedIndicator) {
-        indicator  = new USBIndicator(indicatorType);
-    }
-    else if (indicatorType == AddressedIndicator) {
-        indicator = new UsbAddressedIndicator(indicatorType); 
-    }
-    else if (indicatorType == MassStorageIndicator) {
-        indicator = new UsbMassStorageIndicator(indicatorType); 
-    }
-    else if (indicatorType == UsbDisconnectingIndicator) {
-        indicator = new USBDisconnectingIndicator(indicatorType); 
-    }    
-    myDebug() << "<<< UsbIndicatorPlugin::createIndicator";
-    return indicator;
-}
-
-
--- a/usbuis/usbindicatorplugin/src/usbmassstorageindicator.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* 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: USB Mass Storage indicator implementation 
-*
-*/
-
-#include "usbmassstorageindicator.h" 
-#include <QVariant>
-#include <e32uid.h>
-#include <apadef.h>
-#include <usb/hostms/msmmindicatorclient.h>
-#include "usbdebug.h"
-
-// icon name for mass storage
-const QString KUsbIconFile("qtg_large_usb_memory");
-
-/*!
-   Constructor
-   @param indicatorType The indicator type name
-*/ 
-UsbMassStorageIndicator::UsbMassStorageIndicator(const QString &indicatorType) :
-HbIndicatorInterface(indicatorType,
-        HbIndicatorInterface::SettingCategory,
-        InteractionActivated),
-        mEjectStarted(false)
-{
-}
-
-/*!
-   Destructor
-*/
-UsbMassStorageIndicator::~UsbMassStorageIndicator()
-{
-    myDebug() << ">>> UsbMassStorageIndicator::~UsbMassStorageIndicator";
-}
-
-
-/*!
-   Handle user interaction
-   Request eject for all USB drives.
-*/
-bool UsbMassStorageIndicator::handleInteraction(InteractionType type)
-{
-    myDebug() << ">>> UsbMassStorageIndicator::handleInteraction";
-    bool handled = false;
-    if (type == InteractionActivated) {
-        if (!mEjectStarted) {
-            mEjectStarted = true;
-            // dismount all drives without waiting for result
-            RHostMassStorage hostMassStorage;
-            myDebug() << "    UsbMassStorageIndicator::handleInteraction hostMassStorage connecting";
-            TInt err = hostMassStorage.Connect();
-            myDebug() << "    UsbMassStorageIndicator::handleInteraction hostMassStorage connected";
-            if (err == KErrNone) {
-                hostMassStorage.EjectUsbDrives();
-                myDebug() << "UsbMassStorageIndicator::handleInteraction EjectUsbDrives called";
-            }
-            else {
-                myDebug() << "    UsbMassStorageIndicator::handleInteraction "
-                        <<"RHostMassStorage Connect fail " << err;
-            }
-            hostMassStorage.Disconnect();
-            myDebug() << ">>> UsbMassStorageIndicator::handleInteraction disconnected";
-            hostMassStorage.Close();
-            myDebug() << ">>> UsbMassStorageIndicator::handleInteraction closed";
-        }
-        handled = true;                
-    }
-    myDebug() << "<<< UsbMassStorageIndicator::handleInteraction";
-    return handled;
-}
-
-/*!
-   Return the data and icon that needs to be displayed in the universal indicator menu 
-*/
-QVariant UsbMassStorageIndicator::indicatorData(int role) const
-{
-    myDebug() << ">>> UsbMassStorageIndicator::indicatorData";
-    switch (role) {
-        case PrimaryTextRole: 
-            return QString(hbTrId("txt_usb_dblist_usb_connected"));
-        case SecondaryTextRole:
-            return QString(hbTrId("txt_usb_dpinfo_click_to_eject"));;
-        case DecorationNameRole:
-            return KUsbIconFile;
-        default: 
-            return QVariant(); //empty variant      
-    }
-}
-
-/*!
-   USBIndicator::handleClientRequest
-   handles client's activate and deactivate request
-*/
-bool UsbMassStorageIndicator::handleClientRequest( RequestType type, 
-        const QVariant &parameter)
-{ 
-    myDebug() << ">>> UsbMassStorageIndicator::handleClientRequest";
-    Q_UNUSED(parameter);
-    if (type == RequestDeactivate) {
-        myDebug() << "    UsbMassStorageIndicator::handleClientRequest deactivate";
-        mEjectStarted = false;
-        emit deactivate();        
-    }
-    myDebug() << "<<< UsbMassStorageIndicator::handleClientRequest";
-    return true;
-}
--- a/usbuis/usbindicatorplugin/usbindicatorplugin.pro	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-TEMPLATE = lib
-TARGET = usbindicatorplugin
-CONFIG += plugin
-CONFIG += hb
-HEADERS += inc/usbindicatorplugin.h \
-    inc/usbindicator.h \
-    inc/usbaddressedindicator.h \
-    inc/usbmassstorageindicator.h \
-    inc/usbdisconnectingindicator.h
-	
-SOURCES += src/usbindicatorplugin.cpp \
-    src/usbindicator.cpp \
-    src/usbaddressedindicator.cpp \
-    src/usbmassstorageindicator.cpp \
-    src/usbdisconnectingindicator.cpp
-
-LIBS += -lmsmmindicatorsession
-
-SYMBIAN_PLATFORMS = ARMV5
-
-TRANSLATIONS = usbindimenu.ts	
-
-symbian { 
-    TARGET.EPOCALLOWDLLDATA = 1
-    TARGET.CAPABILITY = CAP_GENERAL_DLL
-    TARGET.UID3 = 0x2002E70D
-    pluginstub.sources = usbindicatorplugin.dll
-    pluginstub.path = /resource/plugins/indicators
-    DEPLOYMENT += pluginstub
-}
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "qmakepluginstubs/usbindicatorplugin.qtplugin /epoc32/data/z/pluginstub/usbindicatorplugin.qtplugin" \
-    "rom/usbindicatorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(usbindicatorplugin.iby)" \
-     "rom/usbindicatorpluginresources.iby   LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbindicatorpluginresources.iby)"
--- a/usbuis/usbsettingsapp/USBSettingsApp.pro	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-TEMPLATE = app
-TARGET = USBSettingsApp
-QT += core \
-    gui
-CONFIG += no_icon    
-HEADERS += inc/usbsettingsapp.h \
-    inc/usbuimodelactive.h \
-    inc/usbuisettingmodel.h
-SOURCES += src/usbuimodelactive.cpp \
-    src/usbuisettingmodel.cpp \
-    src/main.cpp \
-    src/usbsettingsapp.cpp
-LIBS += -lusbwatcher
-LIBS += -lxqsettingsmanager
-LIBS += -lusbman
-FORMS += src/USBSettingsApp.ui
-CONFIG += hb
-TRANSLATIONS = usbview.ts
-RESOURCES += src/usbsettinglayout.qrc \
-    src/usbsettingsapp.qrc
-symbian: { 
-    TARGET.UID3 = 0x2002E70C
-    TARGET.CAPABILITY = LocalServices WriteDeviceData
-}
-
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-        "rom/usbsettingsapp.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsapp.iby)" \
-        "rom/usbsettingsappresources.iby   LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsappresources.iby)"
\ No newline at end of file
--- a/usbuis/usbsettingsapp/inc/ui_USBSettingsApp.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/********************************************************************************
-** Form generated from reading UI file 'USBSettingsApp.ui'
-**
-** Created: Fri Mar 5 17:51:29 2010
-**      by: Qt User Interface Compiler version 4.6.2
-**
-** WARNING! All changes made in this file will be lost when recompiling UI file!
-********************************************************************************/
-
-#ifndef UI_USBSETTINGSAPP_H
-#define UI_USBSETTINGSAPP_H
-
-#include <QtCore/QVariant>
-#include <QtGui/QAction>
-#include <QtGui/QApplication>
-#include <QtGui/QButtonGroup>
-#include <QtGui/QHeaderView>
-#include <QtGui/QMainWindow>
-#include <QtGui/QMenuBar>
-#include <QtGui/QStatusBar>
-#include <QtGui/QWidget>
-
-QT_BEGIN_NAMESPACE
-
-class Ui_USBSettingsApp
-{
-public:
-    QWidget *centralwidget;
-    QMenuBar *menubar;
-    QStatusBar *statusbar;
-
-    void setupUi(QMainWindow *USBSettingsApp)
-    {
-        if (USBSettingsApp->objectName().isEmpty())
-            USBSettingsApp->setObjectName(QString::fromUtf8("USBSettingsApp"));
-        USBSettingsApp->resize(800, 600);
-        centralwidget = new QWidget(USBSettingsApp);
-        centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
-        USBSettingsApp->setCentralWidget(centralwidget);
-        menubar = new QMenuBar(USBSettingsApp);
-        menubar->setObjectName(QString::fromUtf8("menubar"));
-        menubar->setGeometry(QRect(0, 0, 800, 21));
-        USBSettingsApp->setMenuBar(menubar);
-        statusbar = new QStatusBar(USBSettingsApp);
-        statusbar->setObjectName(QString::fromUtf8("statusbar"));
-        USBSettingsApp->setStatusBar(statusbar);
-
-        retranslateUi(USBSettingsApp);
-
-        QMetaObject::connectSlotsByName(USBSettingsApp);
-    } // setupUi
-
-    void retranslateUi(QMainWindow *USBSettingsApp)
-    {
-        USBSettingsApp->setWindowTitle(QApplication::translate("USBSettingsApp", "USBSettingsApp", 0, QApplication::UnicodeUTF8));
-    } // retranslateUi
-
-};
-
-namespace Ui {
-    class USBSettingsApp: public Ui_USBSettingsApp {};
-} // namespace Ui
-
-QT_END_NAMESPACE
-
-#endif // UI_USBSETTINGSAPP_H
--- a/usbuis/usbsettingsapp/inc/usbdebug.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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: 
-*
-*/
-
-
-#ifndef USBDEBUG_H
-#define USBDEBUG_H
-
-#include <QtDebug>
-
-#if defined(_DEBUG)
-    inline QDebug myDebug()
-    {
-        return qDebug();
-    }
-#else
-    inline QNoDebug myDebug()
-    {
-        return QNoDebug();
-    }
-#endif
-
-
-#endif // MYDEBUG_H
--- a/usbuis/usbsettingsapp/inc/usbsettingsapp.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* 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 USBSETTINGSAPP_H
-#define USBSETTINGSAPP_H
-
-#include <QObject>
-#include <hbmainwindow.h>
-
-const int KUSBPortrateMinLine = 4;
-const int KUSBPortrateMaxLine = 4;
-const int KUSBLandscapeMinLine = 2;
-const int KUSBLandscapeMaxLine = 2;
-
-class UsbUiSettingModel;
-class QItemSelectionModel;
-class HbView;
-class HbDocumentLoader;
-class HbListViewItem;
-
-class USBSettingsApp : public HbMainWindow
-{
-    Q_OBJECT
-
-public:
-	USBSettingsApp(QWidget *parent = 0);
-    ~USBSettingsApp();
-
-public slots:
-		/*
-		 * Handles the orientation change
-		 * @param orientation is teh new orientation to be set
-     */
-    void setOrientation(Qt::Orientation orientation);
-
-private:
-		/*
-		 * Loads the DOCML and build the view by finding the widgets from it 
-		 * @param Orientation at loading time
-		 */
-    void load(Qt::Orientation);
-
-private:
-		// pointer to the HbDocumentLoader to load the DOCML owned by this class
-    HbDocumentLoader *mDocumentLoader;
-    // Pointer to the view, owned
-    HbView *mView;
-    //Pointer to model, owned
-    UsbUiSettingModel *mModel;
-    //Pointer to selection model, owned
-    QItemSelectionModel *mSelectionModel;
-    HbListViewItem *mListViewItem;
-};
-
-#endif // USBSETTINGSAPP_H
--- a/usbuis/usbsettingsapp/inc/usbuimodelactive.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
-* 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 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:
-    /*
-     * Sets the the selected personality through usbwatcher
-     * @param personality is the personality to be set
-     */
-    void SetUsbPersonality(int personality);
-    /*
-     * cancels the personality set in usbwatcher
-     */
-    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 */
--- a/usbuis/usbsettingsapp/inc/usbuisettingmodel.h	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
-* Copyright (c) 2009-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 USBUISETTINGMODEL_H
-#define USBUISETTINGMODEL_H
-
-
-#include <e32base.h>
-#include <e32property.h>
-#include <QStringList>
-#include <QAbstractItemModel>
-#include <XQSettingsManager>
-
-typedef QList< QMap< int, QVariant > > UsbUiModelDataSource;
-
-class RUsb;
-class UsbUiModelActive;
-class QItemSelection;
-class QItemSelectionModel;
-
-class UsbUiSettingModel : public QAbstractItemModel
-{
-    Q_OBJECT
-    friend class TestUsbUiModelActive;
- 
-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;
-
-    const QModelIndex* sourceData() const;
-   
-    /*
-     * informs the model of the changes in selectionModel and the new mode 
-     * will be Handeled by the Model
-     */
-    void  setSelectionModel(QItemSelectionModel *selectionModel);
-
-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 cenrepChanged( 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 successful
-     * @param status is the error code returned from usbwatcher
-     */
-    void personalitySetCompleted (int status );
-    
-    /**
-     * This slot handles selection change from the selection model.
-     * The personality is set according to the selection.
-     * @param selected Item selection of selected items
-     * @param deselected Item selection of deselected items
-     */
-    void handleSelectionChange(const QItemSelection &selected, 
-            const QItemSelection &deselected );
-    
-private:
-	/*
-	 * Get the translated mode name
-	 * @param friendlyName is the usb personality friendly name
-	 */   
-    QString modeName( QString &friendlyName );
-
-    /*
-     * 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(); 
-
-    /**
-     * Initialize the model data
-     * @param modeId The current mode ID
-     */
-    void initializeModelData( int modeId );
-
-    /**
-     * Update the selection model
-     * @param newPersonality is the new personality id
-     */
-    void updateSelectionModel(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);
-    
-    /**
-     * Get the personality friendly name from USB Manager
-     * The friendly name can be used in text IDs.
-     * @param usbman The open USB Manager session
-     * @param personalityId The ID of the personality
-     * @return Friendly name for personality
-     */
-    QString getFriendlyName(RUsb &usbman, TInt personalityId);
-    
-private:
-       
-    UsbUiModelDataSource mSettingsList;
- 
-    // current USB personality
-    int mCurrentMode;
-
-    //variable to access central repository
-    XQSettingsManager mSettingsManager;
-    
-    QList<int> mPersonalityIds;
-    //owned by the class
-    // modelactive is used for the interaction with the usbwatcher
-    UsbUiModelActive *mModelActive;
-    
-    QItemSelectionModel *mSelectionModel;
-};
-
-#endif // USBUISETTINGMODEL_H
--- a/usbuis/usbsettingsapp/rom/usbsettingsapp.iby	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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 USBSETTINGSAPP_IBY
-#define USBSETTINGSAPP_IBY
-// Use standard macros
-#include <data_caging_paths_for_iby.hrh>
-
-#ifdef __USB
-file=/epoc32/release/armv5/urel/usbsettingsapp.exe      PROGRAMS_DIR/usbsettingsapp.exe
-data=/epoc32/data/z/private/10003a3f/import/apps/usbsettingsapp_reg.rsc /private/10003a3f/import/apps/usbsettingsapp_reg.rsc
-#endif
-
-#endif
--- a/usbuis/usbsettingsapp/rom/usbsettingsappresources.iby	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* 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 USBSETTINGSAPPRESOURCES_IBY
-#define USBSETTINGSAPPRESOURCES_IBY
-// Use standard macros
-#include <data_caging_paths_for_iby.hrh>
-
-#ifdef __USB
-S60_APP_RESOURCE(usbsettingsapp)
-data=DATAZ_\QT_TRANSLATIONS_DIR\usbview.qm QT_TRANSLATIONS_DIR\usbview.qm
-#endif
-
-#endif
\ No newline at end of file
--- a/usbuis/usbsettingsapp/src/USBSettingsApp.ui	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<ui version="4.0" >
- <class>USBSettingsApp</class>
- <widget class="QMainWindow" name="USBSettingsApp" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>800</width>
-    <height>600</height>
-   </rect>
-  </property>
-  <property name="windowTitle" >
-   <string>USBSettingsApp</string>
-  </property>
-  <widget class="QWidget" name="centralwidget" />
-  <widget class="QMenuBar" name="menubar" >
-   <property name="geometry" >
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>800</width>
-     <height>21</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QStatusBar" name="statusbar" />
- </widget>
- <resources/>
- <connections/>
-</ui>
--- a/usbuis/usbsettingsapp/src/hblistviewitem.css	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-
-/*
-    Layout selection
-*/
-
-HbListViewItem[layoutName="usb"]{
-	layout:usb-1;
-}
-
-/*
-    Standard primitive properties
-*/
-
-HbListViewItem::selection-icon{
-	fixed-height: var(hb-param-graphic-size-primary-small);
-	fixed-width: var(hb-param-graphic-size-primary-small);
-}
-
-HbListViewItem::selection-icon[graphicsSize="Image"][!selectionMode][icon-1]{
-        left: 0;
-}
-
-HbListViewItem::multiselection-toucharea{
-	fixed-width: 6.0un;
-}
-
-HbListViewItem::icon-1{
-	fixed-height: var(hb-param-graphic-size-primary-medium);
-	fixed-width: var(hb-param-graphic-size-primary-medium);
-}
-
-HbListViewItem::icon-1[graphicsSize="SmallIcon"]{
-	fixed-height: var(hb-param-graphic-size-primary-small);
-	fixed-width: var(hb-param-graphic-size-primary-small);
-}
-
-HbListViewItem::icon-1[graphicsSize="LargeIcon"]{
-	fixed-height: var(hb-param-graphic-size-primary-large);
-	fixed-width: var(hb-param-graphic-size-primary-large);
-}
-
-HbListViewItem::icon-1[graphicsSize="Image"]:portrait{
-	fixed-height: var(hb-param-graphic-size-image-portrait);
-	fixed-width: var(hb-param-graphic-size-image-portrait);
-}
-
-HbListViewItem::icon-1[graphicsSize="Image"]:landscape{
-	fixed-height: var(hb-param-graphic-size-image-landscape);
-	fixed-width: var(hb-param-graphic-size-image-landscape);
-}
-
-HbListViewItem::text-1{
-	text-height: var(hb-param-text-height-primary);
-	font-variant: primary;
-	pref-width:-1;
-	text-align: left;
-}
-
-HbListViewItem::text-1[modelItemType="StandardItem"][stretchingStyle="StretchLandscape"]:landscape{
-	pref-width: 30.0un;
-}
-
-HbListViewItem::text-1[modelItemType="SeparatorItem"]{
-	text-height: var(hb-param-text-height-secondary);
-	font-variant: secondary;
-	text-align: right;
-}
-
-HbListViewItem::text-2{
-	text-height: var(hb-param-text-height-secondary);
-	font-variant: secondary;
-	pref-width:-1;
-	text-align: left top;
-}
-
- HbListViewItem::text-2[stretchingStyle="StretchLandscape"]:landscape{
- 	pref-width: 30.0un;
- }
-
-HbListViewItem::text-3{
-	text-height: var(hb-param-text-height-secondary);
-	fixed-width: 18.0un;
-	font-variant: secondary;
-	text-align: right;
-}
-
-HbListViewItem::frame{
-	border-width: var(hb-param-background-list-main);
-}
-
-HbListViewItem::frame[insidePopup]{
-	border-width: var(hb-param-background-list-popup);
-}
-
-HbListViewItem::text-2[modelItemType="SeparatorItem"]{
-	minimum-height: 0.0un;
-	minimum-width: 0.0un;
-	fixed-height: 0.0un;
-	fixed-width: 0.0un;
-}
-
-HbListViewItem::text-3[modelItemType="SeparatorItem"]{
-	minimum-height: 0.0un;
-	minimum-width: 0.0un;
-	fixed-height: 0.0un;
-	fixed-width: 0.0un;
-}
-
-HbListViewItem::icon-1[modelItemType="SeparatorItem"]{
-	minimum-height: 0.0un;
-	minimum-width: 0.0un;
-	fixed-height: 0.0un;
-	fixed-width: 0.0un;
-}
-
-HbListViewItem::icon-2[modelItemType="SeparatorItem"]{
-	minimum-height: 0.0un;
-	minimum-width: 0.0un;
-	fixed-height: 0.0un;
-	fixed-width: 0.0un;
-}
--- a/usbuis/usbsettingsapp/src/hblistviewitem.widgetml	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<hbwidget version="0.1" type="HbListViewItem">
-
-<!-- usb-1 -->
-    <!--
-        Required items: 
-            text-1
-            
-        Items from left to right:
-            <- icon-1 <- text-1 -> selection icon ->
-                         text-2 ->
-                                         
-        Other:
-            icon-1: TOP aligned with item TOP
-            selection icon: connected from TOP to item TOP
-            
-            text-1: connected from TOP to item TOP and BOTTOM to text-2 TOP
-            text-2: connected BOTTOM to BOTTOM
-    -->
-    <layout name="usb-1" type="mesh">
-      <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-left)" />
-      <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-var(hb-param-margin-gene-top)" />
-      
-      <meshitem src="text-1" srcEdge="LEFT" dst="icon-1" dstEdge="RIGHT" spacing="-2.0un" />
-      <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-var(hb-param-margin-gene-top)"/>
-      <meshitem src="text-1" srcEdge="RIGHT" dst="selection-icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-middle-horizontal)" />
-      <meshitem src="text-1" srcEdge="BOTTOM" dst="text-2" dstEdge="TOP" spacing="var(hb-param-margin-gene-middle-vertical)" />
-      
-      <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="LEFT" />
-      <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-right)" />
-      <meshitem src="text-2" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="var(hb-param-margin-gene-middle-vertical)" />
-      
-      <meshitem src="selection-icon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-right)" />
-      <meshitem src="selection-icon" srcEdge="TOP" dst="" dstEdge="TOP" spacing="-var(hb-param-margin-gene-top)" />
-    
-      <meshitem src="background" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-      <meshitem src="background" srcEdge="TOP" dst="" dstEdge="TOP" />
-      <meshitem src="background" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-      <meshitem src="background" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-  
-      <meshitem src="frame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-      <meshitem src="frame" srcEdge="TOP" dst="" dstEdge="TOP" />
-      <meshitem src="frame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-      <meshitem src="frame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-      
-      <meshitem src="focus-indicator" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-      <meshitem src="focus-indicator" srcEdge="TOP" dst="" dstEdge="TOP" />
-      <meshitem src="focus-indicator" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-      <meshitem src="focus-indicator" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-      <meshitem src="multiselection-toucharea" srcEdge="CENTERH" dst="selection-icon" dstEdge="CENTERH" />
-      <meshitem src="multiselection-toucharea" srcEdge="TOP" dst="" dstEdge="TOP" />
-      <meshitem src="multiselection-toucharea" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    </layout>
-        
-</hbwidget>
\ No newline at end of file
--- a/usbuis/usbsettingsapp/src/main.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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 <QTranslator>
-#include <QString>
-#include <QLocale>
-#include "usbsettingsapp.h"
-#include <hbapplication.h>
-
-int main(int argc, char *argv[])
-{
-    HbApplication usbApp(argc, argv);
-    QTranslator translator;
-    
-     // add translator for application library
-    QString locale = QLocale::system().name();
-    QString filename = QString("usbview_") + locale; 
-    bool success = translator.load( filename, QString("/resource/qt/translations") ); 
-    if (success)
-        {
-        usbApp.installTranslator(&translator);
-        }
-  
-    USBSettingsApp settingsapp;
-    settingsapp.show();
-
-    return usbApp.exec();
-    
-}
--- a/usbuis/usbsettingsapp/src/usbsettinglayout.qrc	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
-        <file>hblistviewitem.widgetml</file>
-        <file>hblistviewitem.css</file>
-</qresource></RCC>
--- a/usbuis/usbsettingsapp/src/usbsettingsapp.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* 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: 
-*
-*/
-#include "usbsettingsapp.h"
-#include <hblistviewitem.h>
-#include <QItemSelectionModel>
-#include <hbstyleloader.h>
-#include <hbdocumentloader.h>
-#include <hbview.h>
-#include <hblistview.h>
-#include <hbgroupbox.h>
-#include "usbuisettingmodel.h"
-#include "usbdebug.h"
-
-#define DOCML ":/xml/usbsettingsapp.docml"
-
-USBSettingsApp::USBSettingsApp(QWidget *parent)
-    : HbMainWindow(parent), mView(NULL), mListViewItem(NULL)
-{
-    myDebug() << ">>> USBSettingsApp::USBSettingsApp";
-    //Init the document loader and we load the view
-    mModel = new UsbUiSettingModel(this);
-    mSelectionModel = new QItemSelectionModel(mModel);
-    mDocumentLoader = new HbDocumentLoader();
-    connect(this, SIGNAL(orientationChanged(Qt::Orientation)),
-    					this,SLOT(setOrientation(Qt::Orientation)));
-    load(orientation());
-    myDebug() << "<<< USBSettingsApp::USBSettingsApp";
-}
-
-USBSettingsApp::~USBSettingsApp()
-{
-    myDebug() << ">>> USBSettingsApp::~USBSettingsApp";
-    delete mView;
-    delete mModel;
-    delete mDocumentLoader;
-    myDebug() << "<<< USBSettingsApp::~USBSettingsApp";
-}
-/*!
-loads the DOCML and build the view by finding the widgets from it 
-*/
-void USBSettingsApp::load(Qt::Orientation orientation) 
-{
-    myDebug() << ">>> USBSettingsApp::load";
-    bool loaded = true;
- 
-   //Sets loader to initial state
-    mDocumentLoader->reset();
-    //Load the common section
-    mDocumentLoader->load(DOCML, &loaded);
-   
-    //Loads the view
-    if ( loaded ) {
-        myDebug() << "    USBSettingsApp::load DOCML loaded";
-        QGraphicsWidget *widget = mDocumentLoader->findWidget(QString("view"));
-        if (widget) {
-            myDebug() << "    USBSettingsApp::load view found";
-            mView = qobject_cast<HbView*>(widget);
-            this->addView(mView);
-            this->setCurrentView(mView);
-        }
-        QGraphicsWidget *listViewWidget = mDocumentLoader->findWidget(QString("listView"));
-        if (listViewWidget) {
-            myDebug() << "    USBSettingsApp::load listView found";
-            HbListView *listView = qobject_cast<HbListView*>(listViewWidget);
-            listView->setItemPixmapCacheEnabled(true);
-            listView->setModel(mModel);
-            listView->setSelectionMode(HbAbstractItemView::SingleSelection);
-            listView->setSelectionModel(mSelectionModel);
-            mModel -> setSelectionModel(mSelectionModel);
-            HbStyleLoader::registerFilePath(":/");
-            listView->setLayoutName("usb");
-            //scroll to the selected index, if not hidden personality
-            QModelIndexList indexList = mSelectionModel->selectedIndexes();
-            if ( !indexList.isEmpty() ) {
-                myDebug() << "    USBSettingsApp::load scrollTo " << indexList[0].row();
-                myDebug() << "    USBSettingsApp::load scrollTo disabled";
-                //listView->scrollTo(indexList[0]);
-            }
-        }
-
-        QGraphicsWidget *listViewItemWidget = mDocumentLoader->findWidget(QString("listItemPrototype"));
-        if (listViewItemWidget) {
-            myDebug() << "    USBSettingsApp::load mListViewItem found";
-            mListViewItem = qobject_cast<HbListViewItem*>(listViewItemWidget);
-            mListViewItem->setGraphicsSize(HbListViewItem::LargeIcon);
-            setOrientation(orientation);
-        }
-        
-        QGraphicsWidget *groupBoxWidget = mDocumentLoader->findWidget(QString("groupBox"));
-        if (groupBoxWidget) {
-            myDebug() << "    USBSettingsApp::load groupBox found";
-            HbGroupBox *groupBox = qobject_cast<HbGroupBox*>(groupBoxWidget);
-            groupBox->setHeading(QString(hbTrId("txt_usb_subhead_select_connection_type")));
-        }        
-    }  
-    myDebug() << "<<< USBSettingsApp::load";
-}
-/*!
-	Handles the orientation change
-*/
-void USBSettingsApp::setOrientation(Qt::Orientation orientation)
-{
-    myDebug() << ">>> USBSettingsApp::setOrientation";
-    if (mListViewItem) {
-        switch (orientation) {
-            case Qt::Horizontal:
-                mListViewItem->setSecondaryTextRowCount(KUSBLandscapeMinLine, KUSBLandscapeMaxLine);
-                break;
-            case Qt::Vertical:
-                mListViewItem->setSecondaryTextRowCount(KUSBPortrateMinLine, KUSBPortrateMaxLine);
-                break;
-            default:
-            		break;
-        }               
-    }    
-    myDebug() << "<<< USBSettingsApp::setOrientation";
-}
-
--- a/usbuis/usbsettingsapp/src/usbsettingsapp.docml	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.1">
-    <object name="qtl_toolbar_tiny1_4_left" type="HbAction">
-        <icon iconName="qgn_indi_nslider_muted" name="icon"/>
-        <string name="text"/>
-    </object>
-    <object name="qtl_toolbar_tiny1_4_middleLeft" type="HbAction">
-        <icon iconName="hb_vol_slider_unmuted" name="icon"/>
-        <string name="text"/>
-    </object>
-    <object name="qtl_toolbar_tiny1_4_middleRight" type="HbAction">
-        <icon iconName="qgn_indi_nslider_zoom_in" name="icon"/>
-        <string name="text"/>
-    </object>
-    <object name="qtl_toolbar_tiny1_4_Right" type="HbAction">
-        <icon iconName="qgn_indi_nslider_zoom_in_pressed" name="icon"/>
-        <string name="text"/>
-    </object>
-    <widget name="view" type="HbView">
-        <widget name="content" role="HbView:widget" type="HbWidget">
-            <widget name="listView" type="HbListView">
-                <widget name="listItemPrototype" role="HbAbstractView:prototype" type="HbListViewItem">
-                    <string name="state" value="normal"/>
-                </widget>
-                <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
-            </widget>
-            <widget name="groupBox" type="HbGroupBox">
-                <bool name="collapsable" value="FALSE"/>
-                <string name="heading" value="Group Box"/>
-            </widget>
-            <real name="z" value="0"/>
-            <layout orientation="Vertical" spacing="0un" type="linear">
-                <contentsmargins bottom="var(hb-param-margin-view-bottom)" left="var(hb-param-margin-view-left)" right="var(hb-param-margin-view-right)" top="var(hb-param-margin-view-top)"/>
-                <linearitem itemname="groupBox"/>
-                <linearitem itemname="listView"/>
-            </layout>
-        </widget>
-        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
-            <enums name="orientation" value="Horizontal"/>
-            <fontspec name="fontSpec" role="Primary" textheight="var(hb-param-text-height-primary)"/>
-        </widget>
-        <string locid="txt_usb_dblist_usb" name="title" value="USB"/>
-    </widget>
-    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
-        <resource location="TemplateIcons.qrc"/>
-        <uistate name="Common ui state" sections="#common"/>
-        <dummydata objectName="listView" section="#common" value="1"/>
-    </metadata>
-</hbdocument>
--- a/usbuis/usbsettingsapp/src/usbsettingsapp.qrc	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-<RCC>
-    <qresource prefix="/xml">
-        <file>usbsettingsapp.docml</file>
-    </qresource>
-</RCC>
\ No newline at end of file
--- a/usbuis/usbsettingsapp/src/usbsettingsapp.ts	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +0,0 @@
-<?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_dblist_usb_disconnecting">
-    <comment>The second line contains the progress indicator</comment>        
-    <source>USB disconnecting</source>
-    <translation variants="no">USB disconnecting</translation>
-    <extra-loc-layout_id>qtl_indimenu_pri_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_05</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_unable_to_eject_the_usb_device_some">
-    <comment></comment>        
-    <source>Unable to eject the USB device. Some of the applicatios may still be using it.</source>
-    <translation variants="no">Unable to eject the USB device. Some of the applicatios may still be using it.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_2">
-    <comment></comment>        
-    <source>Mass storage</source>
-    <translation variants="no">Mass storage</translation>
-    <extra-loc-layout_id>qtl_list_pri_large_graphic_add</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_2</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_5">
-    <comment>Note this is continuation from the heading. Tells which interface we show to the host device</comment>        
-    <source>to OVI suite</source>
-    <translation variants="no">to OVI suite</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_memory_full_close_some_applications">
-    <comment></comment>        
-    <source>Memory full. Close some applications and try to connect USB cable again.</source>
-    <translation variants="no">Memory full. Close some applications and try to connect USB cable again.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_problem_val_not_enough_memory">
-    <comment>When the selected UBS mode can&apos;t be loaded, because there is not enough memory</comment>        
-    <source>Not enough memory</source>
-    <translation variants="no">Not enough memory</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_2_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connected_val_5">
-    <comment></comment>        
-    <source>to OVI suite</source>
-    <translation variants="no">to OVI suite</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_6">
-    <comment></comment>        
-    <source>Use this phone to connect the other device to the Internet</source>
-    <translation variants="no">Use this phone to connect the other device to the Internet</translation>
-    <extra-loc-layout_id>txt_usb_dblist_usb_connected_val_access_this_phone</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_4_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connected">
-    <comment></comment>        
-    <source>USB connected</source>
-    <translation variants="no">USB connected</translation>
-    <extra-loc-layout_id>qtl_indimenu_pri_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_2">
-    <comment>Note this is continuation from the heading. Tells which interface we show to the host device</comment>        
-    <source>as mass storage</source>
-    <translation variants="no">as mass storage</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_unsupported_usb_device_disconnect_de">
-    <comment>Either the device uses too much power (always, nothing can be done to make it work) or the device is unsupported otherways (like wants to use interface we don&apos;t have)</comment>        
-    <source>Unsupported USB device. Disconnect device.</source>
-    <translation variants="no">Unsupported USB device. Disconnect device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_remove_usb_cable_or_connect_a_device">
-    <comment>There is only the USB cable, but no device in the other end.</comment>        
-    <source>Remove USB cable or connect a device.</source>
-    <translation variants="no">Remove USB cable or connect a device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_5">
-    <comment></comment>        
-    <source>OVI suite</source>
-    <translation variants="no">OVI suite</translation>
-    <extra-loc-layout_id>qtl_list_pri_large_graphic_add</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_subhead_select_connection_type">
-    <comment></comment>        
-    <source>Select connection type</source>
-    <translation variants="no">Select connection type</translation>
-    <extra-loc-layout_id>qtl_groupbox_simple_sec</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>subhead</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_partially_supported_usb_device_connec">
-    <comment>There is some parts of the USB device the phone doesn&apos;t recognize, but the device can still be used for some purposes</comment>        
-    <source>Partially supported USB device connected. All functionality might not work.</source>
-    <translation variants="no">Partially supported USB device connected. All functionality might not work.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_error_in_usb_connection_disconnect_d">
-    <comment>The USB device can&apos;t be used this time, but there is possibility that if one reconnects the cables that the device can be used.</comment>        
-    <source>Error in USB connection. Disconnect device.</source>
-    <translation variants="no">Error in USB connection. Disconnect device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_safe_to_remove">
-    <comment></comment>        
-    <source>Safe to remove</source>
-    <translation variants="no">Safe to remove</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_problem">
-    <comment></comment>        
-    <source>USB problem</source>
-    <translation variants="no">USB problem</translation>
-    <extra-loc-layout_id>qtl_indimenu_pri_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_2</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_2">
-    <comment></comment>        
-    <source>Use this phone like a memory stick on the other device</source>
-    <translation variants="no">Use this phone like a memory stick on the other device</translation>
-    <extra-loc-layout_id>txt_usb_dblist_usb_connected_val_access_this_phone</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_2_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connected_val_4">
-    <comment></comment>        
-    <source>as media transfer</source>
-    <translation variants="no">as media transfer</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_click_to_eject">
-    <comment>Tapping this item will start the safe removal process</comment>        
-    <source>Click to eject</source>
-    <translation variants="no">Click to eject</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_06</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connecting">
-    <comment>The second line contains the progress indicator</comment>        
-    <source>USB connecting</source>
-    <translation variants="no">USB connecting</translation>
-    <extra-loc-layout_id>qtl_indimenu_pri_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_05</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_unable_to_use_file_system_in_device">
-    <comment>The file system of the other device is recognized and accepted, but the file system may be e.g. corrupted, so it can&apos;t be used.</comment>        
-    <source>Unable to use file system in device. Disconnect device.</source>
-    <translation variants="no">Unable to use file system in device. Disconnect device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connected_val_2">
-    <comment></comment>        
-    <source>as mass storage</source>
-    <translation variants="no">as mass storage</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpophead_usb_connected">
-    <comment></comment>        
-    <source>USB connected</source>
-    <translation variants="no">USB connected</translation>
-    <extra-loc-layout_id>qtl_notifdialog_pri_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpophead</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb">
-    <comment>The name of the USB item in control panel connectivity section</comment>        
-    <source>USB</source>
-    <translation variants="no">USB</translation>
-    <extra-loc-layout_id>qtl_titlebar</extra-loc-layout_id>    
-    <extra-loc-viewid>usb</extra-loc-viewid>
-    <extra-loc-positionid>title</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_5">
-    <comment>Layout ID parent. There should be maximum of 4 lines of text and each line has the constraints same as qtl_list_sec_large_graphic</comment>        
-    <source>Access this phone’s information from OVI Suite</source>
-    <translation variants="no">Access this phone’s information from OVI Suite</translation>
-    <extra-loc-layout_id>txt_usb_dblist_usb_connected_val_access_this_phone</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_4">
-    <comment>Note this is continuation from the heading. Tells which interface we show to the host device</comment>        
-    <source>as media transfer</source>
-    <translation variants="no">as media transfer</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_6">
-    <comment></comment>        
-    <source>Web connection</source>
-    <translation variants="no">Web connection</translation>
-    <extra-loc-layout_id>qtl_list_pri_large_graphic_add</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_4</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_headset_in_use">
-    <comment>%1 is the type of the USB device, only in OTG</comment>        
-    <source>headset in use</source>
-    <translation variants="no">headset in use</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_4">
-    <comment></comment>        
-    <source>Use this phone as a music or image source to the other device</source>
-    <translation variants="no">Use this phone as a music or image source to the other device</translation>
-    <extra-loc-layout_id>txt_usb_dblist_usb_connected_val_access_this_phone</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_3_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_hubs_are_not_supported_disconnect_us">
-    <comment>The USB hubs can&apos;t be used with the phone</comment>        
-    <source>Hubs are not supported. Disconnect device.</source>
-    <translation variants="no">Hubs are not supported. Disconnect device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_connected_val_6">
-    <comment></comment>        
-    <source>as web connection</source>
-    <translation variants="no">as web connection</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_1_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpophead_usb_disconnected">
-    <comment>When use rhas selected to eject the other device and everythign has worked well, only in OTG</comment>        
-    <source>USB disconnected</source>
-    <translation variants="no">USB disconnected</translation>
-    <extra-loc-layout_id>qtl_notifdialog_pri_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpophead</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_4">
-    <comment></comment>        
-    <source>Media transfer</source>
-    <translation variants="no">Media transfer</translation>
-    <extra-loc-layout_id>qtl_list_pri_large_graphic_add</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_03</extra-loc-viewid>
-    <extra-loc-positionid>dblist_3</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_unknown_file_system_disconnect_devic">
-    <comment>The USB device uses file system that we don&apos;t support</comment>        
-    <source>Unknown file system. Disconnect device.</source>
-    <translation variants="no">Unknown file system. Disconnect device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_info_unable_to_show_a_memory_to_other_devi">
-    <comment>When the memory can&apos;t be unmounted from the phone and shown to the other device (e.g. PC). This may be due the corruption of the memory</comment>        
-    <source>Unable to show a memory to other device.</source>
-    <translation variants="no">Unable to show a memory to other device.</translation>
-    <extra-loc-layout_id>qtl_dialog_pri5_larger_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_04</extra-loc-viewid>
-    <extra-loc-positionid>info</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dblist_usb_problem_val_connection_type_not">
-    <comment>When the host doesn&apos;t recognize the interface we are offering to it</comment>        
-    <source>Connection type not supported</source>
-    <translation variants="no">Connection type not supported</translation>
-    <extra-loc-layout_id>qtl_indimenu_sec_medium_graphic</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_02</extra-loc-viewid>
-    <extra-loc-positionid>dblist_2_val</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_dpinfo_6">
-    <comment>Note this is continuation from the heading. Tells which interface we show to the host device</comment>        
-    <source>as web connection</source>
-    <translation variants="no">as web connection</translation>
-    <extra-loc-layout_id>qtl_notifdialog_sec_medium_graphics</extra-loc-layout_id>    
-    <extra-loc-viewid>usb_01</extra-loc-viewid>
-    <extra-loc-positionid>dpinfo</extra-loc-positionid>
-    <extra-loc-feature>us</extra-loc-feature>
-    <extra-loc-blank>False</extra-loc-blank>
-</message>
-</context>
-</TS>
--- a/usbuis/usbsettingsapp/src/usbuimodelactive.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
-* 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: 
-*
-*/
-
-#include "usbuimodelactive.h"
-#include "usbdebug.h"
-
-
-
-/*!
-    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";
-}
-
-/*!
- * Sets the the selected personality through usbwatcher
- */
-void 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";
-
-    }
-/*!
- * 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;
-}
--- a/usbuis/usbsettingsapp/src/usbuisettingmodel.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*
-* Copyright (c) 2009-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: 
-*
-*/
-
-#include "usbuisettingmodel.h"
-#include <QStringList>
-#include <UsbWatcherInternalCRKeys.h>
-#include <XQSettingsKey>
-#include <usbman.h>
-#include <HbIcon>
-#include <QItemSelection>
-#include <QItemSelectionModel>
-#include "usbuimodelactive.h"
-#include "usbdebug.h"
-
-
-const QString TextIdPrefix = ("txt_usb_dblist_");
-const QString DescriptionIdPostfix = ("_val");
-const QString ModeIconNamePrefix = ("qtg_large_");
-
-/*!
-    Constructor.
- */
-UsbUiSettingModel::UsbUiSettingModel( QObject *parent )
-    : QAbstractItemModel( parent), mSelectionModel(NULL)
-{
-    mModelActive = new UsbUiModelActive();
-    mCurrentMode = currentMode();
-    initializeModelData(mCurrentMode);
-  	bool ret = mSettingsManager.startMonitoring( 
-   	        XQSettingsKey( XQSettingsKey::TargetCentralRepository, 
-   	                KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
-    myDebug() << ">>> UsbUiSettingModel::startMonitoring value=" 
-              << ret; 
-                              
-   	// signal: personality changed in the central repository                
-   	ret = connect( &mSettingsManager, 
-   	        SIGNAL( valueChanged( const XQSettingsKey&, const QVariant& ) ), 
-   	        this, 
-   	        SLOT( cenrepChanged( const XQSettingsKey&, const QVariant& ) ) );
-    myDebug() << ">>> UsbUiSettingModel::UsbUiSettingModel connect valueChanged="
-            << ret;
-   	        
-    // signal: response from usbwatcher to our attempt to set the personality 	        
-   	ret = connect( mModelActive, 
-   	        SIGNAL( requestCompleted( int ) ), 
-   	        this, 
-   	        SLOT( personalitySetCompleted( int )));
-    myDebug() << ">>> UsbUiSettingModel::UsbUiSettingModel connect requestCompleted="
-            << ret;
-}
-
-/*!
-    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::cenrepChanged( const XQSettingsKey &key,  
-        const QVariant &value )  
-{
-    Q_UNUSED(key);
-    myDebug() << ">>> UsbUiSettingModel::cenrepChanged";
-    // key is not checked, as we monitor only one key
-    updateSelectionModel(value.toInt());                                 
-    myDebug() << "<<< UsbUiSettingModel::cenrepChanged"; 
-}
-
-/*!
- * updates the selection model
- * The selection model will signal the view.
- */
-void UsbUiSettingModel::updateSelectionModel(int newPersonality)
-{
-    myDebug() << ">>> UsbUiSettingModel::updateSelectionModel value=" 
-            << newPersonality; 
-            
-    mCurrentMode = newPersonality;
-    mSelectionModel->clear();    
-    int row = mPersonalityIds.indexOf(newPersonality);
-    myDebug() << ">>> UsbUiSettingModel::updateSelectionModel row=" 
-            << row; 
-    // in case of the hidden personality , the selection model is left empty
-    if ( row >= 0 ) {
-        //set selection model for the new selection
-        QModelIndex selectionIndex = index(row, 0, QModelIndex());
-        QItemSelection selection(selectionIndex, selectionIndex);
-        mSelectionModel->select(selection, QItemSelectionModel::Select);    
-    }
-    myDebug() << "<<< UsbUiSettingModel::updateSelectionModel"; 
-}
-
-/*!
- * 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 selection is changed in the view (selection model). 
- */
-void UsbUiSettingModel::handleSelectionChange(const QItemSelection &selected, 
-        const QItemSelection &deselected )
-{
-    Q_UNUSED( deselected );
-    myDebug() << ">>>  UsbUiSettingModel::handleSelectionChange";
-    QModelIndexList items = selected.indexes();
-    if (!items.isEmpty()) {
-        myDebug() << "     UsbUiSettingModel::handleSelectionChange item exists";
-        QModelIndex index = items[0];
-        int newPersonalityId = mPersonalityIds.at(index.row());
-        if ( newPersonalityId != mCurrentMode ) {
-            myDebug() << "     UsbUiSettingModel::handleSelectionChange setting personality";
-            mModelActive->SetUsbPersonality(newPersonalityId);
-        }
-    }
-    myDebug() << "<<<  UsbUiSettingModel::handleSelectionChange return";
-}
-
-/*!
- * Getter for the source data.
- */
-const QModelIndex* UsbUiSettingModel::sourceData() const
-{
-    return new QModelIndex( createIndex( 0, 0 ) );
-}
-
-void  UsbUiSettingModel::setSelectionModel(QItemSelectionModel *selectionModel)
-    {
-    myDebug() << ">>>  UsbUiSettingModel::setSelectionModel";
-    mSelectionModel = selectionModel;
-    connect( mSelectionModel, 
-                SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ), 
-                this, 
-                SLOT( handleSelectionChange( const QItemSelection &, const QItemSelection & ) ) );
-    updateSelectionModel(mCurrentMode);
-    myDebug() << "<<<  UsbUiSettingModel::setSelectionModel return";
-    }
-
-/*!
- * Get the translated mode name for the personality friendly name.
- */
-QString UsbUiSettingModel::modeName( QString &friendlyName )
-{
-    myDebug() << ">>>  UsbUiSettingModel::modeName";
-    QString textId = TextIdPrefix + friendlyName;
-    QString modeName = hbTrId( textId.toAscii() );
-    myDebug() << "<<< UsbUiSettingModel::modeName " << modeName;
-    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;
-}
-
-void UsbUiSettingModel::initializeModelData( int aModeId )
-{
-    myDebug() << ">>> UsbUiSettingModel::initializeModelData aModeId="
-            << aModeId;
-    RUsb usbMan;
-    if ( usbMan.Connect() == KErrNone ) {
-        RArray<TInt> personalityIds;
-        mPersonalityIds.clear();
-        if ( usbMan.GetPersonalityIds( personalityIds ) == KErrNone ) {
-            for ( int i = 0; i < personalityIds.Count(); i++ ) {
-                myDebug() << ">>> UsbUiSettingModel::initializeModelData personality ID ="
-                    << personalityIds[i];
-                if ( !isPersonalityHidden(usbMan, personalityIds[i]) ) {
-                    mPersonalityIds.append( personalityIds[i] );                    
-                    QString friendlyName = getFriendlyName(usbMan, personalityIds[i]);
-                    
-                    QStringList displayList;
-                    //text-1 mode name
-                    displayList.append( modeName( friendlyName ) );
-                    
-                    //text-2 description
-                    QString textId = TextIdPrefix + friendlyName + DescriptionIdPostfix;
-                    displayList.append( hbTrId(textId.toAscii()) );
-                    
-                    QMap< int, QVariant > dataRow;
-                    dataRow[ Qt::DisplayRole ] = QVariant( displayList );
-                    
-                    //icon-1
-                    QString iconName = ModeIconNamePrefix + friendlyName;
-                    HbIcon icon(iconName);
-                    QList<QVariant> icons;
-                    icons << icon;                    
-                    dataRow[ Qt::DecorationRole ] = QVariant( icons );
-                    
-                    mSettingsList << dataRow;
-                }
-            }
-        }
-        personalityIds.Close();
-        usbMan.Close();
-    }
-    myDebug() << "<<< UsbUiSettingModel::initializeModelData";
-}
-
-/*!
- * 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 successful
- */
-void UsbUiSettingModel::personalitySetCompleted (int status )
-{
-    myDebug() << ">>> UsbUiSettingModel::personalitySetCompleted 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  
-        updateSelectionModel(currentMode());
-    }
-   
-    myDebug() << "<<< UsbUiSettingModel::personalitySetCompleted";      
-}
-
-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;
-}
-
-QString UsbUiSettingModel::getFriendlyName(RUsb &usbman, TInt personalityId)
-{
-    myDebug() << ">>> UsbUiSettingModel::getFriendlyName";
-    QString friendlyName;
-    HBufC* description = NULL;
-    TInt err = usbman.GetDescription(personalityId, description);
-    if (err == KErrNone) {
-        friendlyName = QString::fromUtf16(description->Ptr(), description->Length());
-        friendlyName.replace( QChar(' '), QChar('_') );
-        delete description;
-    } else {
-        myDebug() << "    UsbUiSettingModel::getFriendlyName RUsb error "
-            << err;    
-    }
-    myDebug() << "    UsbUiSettingModel::getFriendlyName friendlyName=" << friendlyName;
-    myDebug() << "<<< UsbUiSettingModel::getFriendlyName";
-    return friendlyName;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/data/1020E472.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005, 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:  ECOM registry file for USB UI Plug-in
+*
+*/
+
+
+#include "registryinfo.rh"
+
+RESOURCE REGISTRY_INFO theInfo
+{
+  dll_uid = 0x1020E472;
+  interfaces =
+  {
+  INTERFACE_INFO
+    {
+    interface_uid = 0x10207236;
+    implementations =
+        {
+        IMPLEMENTATION_INFO
+          {
+          // This implementation is used by General Settings
+          // With this implementation the Right Softkey in the main
+          // view will be "Back".
+          // This way we will not cause the whole General Settings
+          // application to exit.
+          implementation_uid = 0x1020E473;
+          version_no = 1;
+          display_name = "GS USBClassChangeUI Plugin";
+          // Parent UID (USBCCUI is under "Connection setting")
+          default_data = "0x10207250";
+          opaque_data = "40";
+          },        
+        
+        IMPLEMENTATION_INFO
+          {
+            // This implementation is used by USBClassChangeUIAppUI
+            // With this implementation the Right Softkey in the main
+            // view will be "Exit")
+            implementation_uid = 0x1027478F;
+            version_no = 1;
+            display_name = "USBClassChangeUI Plugin"; 
+            default_data = "0";
+            opaque_data = "0";
+          }
+        };
+    }
+    
+    
+  };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/data/USBClassChangeUIPlugin.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,215 @@
+/*
+* 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:  Resources for USBClassChangeUIPlugin. 
+*
+*/
+
+
+#include <data_caging_paths_strings.hrh>
+
+//  RESOURCE IDENTIFIER
+NAME    USBP // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <appinfo.rh>
+
+#include "USBClassChangeUIPlugin.hrh"
+#include <usbclasschangeui.loc>
+
+//  RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf = "USBCLASSCHANGEUI"; }
+
+
+//-----------------------------------------------------------------------------
+//   
+// r_usbclasschangeui_menubar
+// Menubar for main view
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_usbclasschangeui_menubar
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane = r_usbui_menu; txt=""; }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//   
+// r_usbui_menu
+// Application level menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_usbui_menu
+    {
+    items =
+        {
+        MENU_ITEM { command = EUSBUICmdSelect; txt = qtn_cffh_options_select ; flags = EEikMenuItemAction;},
+        MENU_ITEM { command = EUSBUICmdHelp; txt = qtn_options_help; },
+        MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//   
+// r_usbclasschangeui_app_menu
+// application menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_usbclasschangeui_app_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EAknCmdExit; txt=text_softkey_exit; }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+// r_usb_mode_setting_editor
+// Editor for entering all settings
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_usb_mode_setting_editor
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
+//----------------------------------------------------
+//
+//  Hotkeys for USB UI
+//
+//----------------------------------------------------
+//
+RESOURCE HOTKEYS r_usbui_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EAknCmdExit; key='e'; }
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//  Softkeys for USB UI as application. 
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_usbui_softkeys_options_exit__select
+    {
+    flags = 0;
+    buttons = 
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyExit; txt = text_softkey_exit;},
+        CBA_BUTTON {id=EUSBUICmdMskSelect; txt = text_softkey_select ;}
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//  The main view of the USB UI application. Used when
+//  this .dll is loaded from the USBClassChangeUIAppUI
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_usbui_main_view
+    {
+    hotkeys = r_usbui_hotkeys;
+    menubar = r_usbclasschangeui_menubar;
+    cba     = r_usbui_softkeys_options_exit__select;
+    }
+
+//----------------------------------------------------
+//
+//  Title for the main view
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_usb_title { buf = qtn_usb_title; }
+
+//----------------------------------------------------
+//  r_gs_usbui_view_caption 
+// 
+// USBClassChangeUI view caption for GS plugin
+//----------------------------------------------------
+//
+RESOURCE TBUF r_gs_usbui_view_caption
+    {
+    buf = qtn_set_folder_usb;
+    }
+    
+//----------------------------------------------------
+//
+//  Softkeys for USB UI as GS plugin. 
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_usbui_softkeys_options_back__select
+    {
+    flags = 0;
+    buttons = 
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back;},
+        CBA_BUTTON {id=EUSBUICmdMskSelect; txt = text_softkey_select ;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//  The main view of the USB UI application as GS plugin
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_usbui_main_view_gs_plugin
+    {
+    hotkeys = r_usbui_hotkeys;
+    menubar = r_usbclasschangeui_menubar;
+    cba     = r_usbui_softkeys_options_back__select;
+    }
+
+//------------------------------------------------------------------------------
+//
+// Secondary status information
+//
+//------------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cp_detail_usb_not_connected { buf = qtn_cp_detail_usb_not_connected; }
+RESOURCE TBUF r_cp_detail_usb_otg_conn { buf = qtn_cp_detail_usb_otg_conn; }
+RESOURCE TBUF r_cp_detail_usb_conn_mass_storage { buf = qtn_cp_detail_usb_conn_mass_storage; }
+RESOURCE TBUF r_cp_detail_usb_conn_pc_suite { buf = qtn_cp_detail_usb_conn_ovi_suite; }
+RESOURCE TBUF r_cp_detail_usb_conn_picture_transfer { buf = qtn_cp_detail_usb_conn_picture_transfer; }
+RESOURCE TBUF r_cp_detail_usb_conn_media_transfer { buf = qtn_cp_detail_usb_conn_media_transfer; }
+RESOURCE TBUF r_cp_detail_usb_conn_modem_inst { buf = qtn_cp_detail_usb_conn_modem_inst; }
+RESOURCE TBUF r_cp_detail_usb_conn_rndis { buf = qtn_cp_detail_usb_conn_rndis; }
+
+RESOURCE TBUF r_usb_mode_default { buf = qtn_usb_settings_default ;} 
+RESOURCE TBUF r_usb_mode_active { buf = qtn_usb_settings_active;} 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/group/USBClassChangeUIPlugin.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2005-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:  Project specification file for the USBClassChangeUIPlugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          USBClassChangeUIPlugin.dll 
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D  0x1020E472
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE  USBClassChangeUIPluginImplementationTable.cpp
+SOURCE  USBClassChangeUIPluginView.cpp
+SOURCE  USBClassChangeUIPluginContainer.cpp
+SOURCE  USBClassChangeUIPluginModel.cpp
+SOURCE  USBClassChangeUIPluginCRWatcher.cpp
+SOURCE  USBDeviceStateWatcher.cpp 
+SOURCE  usbotghoststatewatcher.cpp
+
+// ECom resource file
+START RESOURCE ../data/1020E472.rss
+TARGET  USBClassChangeUIPlugin.rsc 
+END	
+
+START RESOURCE  ../data/USBClassChangeUIPlugin.rss
+TARGETPATH      RESOURCE_FILES_DIR
+HEADER
+LANGUAGE_IDS
+END
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+SYSTEMINCLUDE		../../../inc ../../../../inc     //for internal and private API headers
+SYSTEMINCLUDE   /epoc32/include/ecom
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib apparc.lib cone.lib eikcore.lib 
+LIBRARY eikcoctl.lib avkon.lib
+LIBRARY bafl.lib                            // Basic Application Framework 
+LIBRARY aknnotify.lib                       // Avkon global notes
+LIBRARY AknSkins.lib                        // Skinned icons
+LIBRARY aknicon.lib
+LIBRARY centralrepository.lib               // Central Repository
+LIBRARY commonengine.lib                    // Series 60 common components library
+LIBRARY eiksrv.lib      
+LIBRARY GSEcomPlugin.lib        
+LIBRARY ecom.lib
+LIBRARY usbman.lib
+LIBRARY usbwatcher.lib
+LIBRARY FeatMgr.lib                         // for fetching if help is supported
+LIBRARY hlplch.lib                          // Help library
+
+DEBUGLIBRARY flogger.lib                    // File logging services
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2005, 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 file provides building information for 
+*                 USBClassChangeUIPlugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// NOTE: this bld.inf is included from ../../../usbui/group/bld.inf
+// It defines _USBUI_BLF_INF_INCLUDED_ to prevent duplicate export error.
+#ifndef _USBUI_BLF_INF_INCLUDED_
+../../loc/USBClassChangeUI.loc  MW_LAYER_LOC_EXPORT_PATH(usbclasschangeui.loc)
+#endif // _USBUI_BLF_INF_INCLUDED_
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE usbui.mif
+OPTION HEADERFILE usbui.mbg
+OPTION SOURCES -c8,8 qgn_prop_set_apps_usb -c8,8 qgn_prop_set_apps_usb_off -c8,8 qgn_prop_usb_memc_large -c8,8 qgn_prop_usb_mtp -c8,8 qgn_prop_usb_pcsuite -c8,8 qgn_prop_usb_modem -c8,8 qgn_prop_usb_print
+END
+
+
+PRJ_MMPFILES
+
+../group/USBClassChangeUIPlugin.mmp
+
+// gnumakefile usbuiplugin_icons_dc.mk
+
+PRJ_TESTMMPFILES
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/group/usbuiplugin_icons_dc.mk	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,72 @@
+#
+# 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: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# TODO: Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\usbui.mif
+
+HEADERDIR=\epoc32\include
+HEADERFILENAME=$(HEADERDIR)\usbui.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# TODO: Configure these.
+#
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/c8,8 qgn_prop_set_apps_usb.svg \
+		/c8,8 qgn_prop_set_apps_usb_off.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2005, 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:  Common declarations for USBClassChange classes
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGIN_H
+#define USBCLASSCHANGEUIPLUGIN_H
+
+#include <e32svr.h> 	// For RDebug and Panic
+
+// Application name
+//
+_LIT( KUSBUIAppName, "USBClassChangeUIPlugin" );
+
+// UID of the application
+//
+const TUid KUidUSBClassChangeUI = { 0x102068E2 };
+
+// Panic values
+//
+enum TUSBUIPanics 
+    {
+    EUSBUIMainListNotEmpty = 10000,    
+    EUSBUIPanicIllegalValue,
+    };
+
+// MACROS
+//
+#define PANIC( aPanic ) User::Panic( KUSBUIAppName, aPanic )
+
+// UID of the main view
+//
+const TUid KUSBUIMainViewId = { 1 };
+
+// UID of the General Settings Plugin
+const TUid KGsUSBUiPluginUid = { 0x1020E473 };
+
+#endif //USBCLASSCHANGEUIPLUGIN
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.hrh	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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:  This file contains declarations for the resources
+                    of USBClassChangeUI.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGIN_HRH
+#define USBCLASSCHANGEUIPLUGIN_HRH
+
+// DATA TYPES
+
+enum TUSBUIMenuCommands
+    {
+    EUSBUICmdSelect = 1,
+    EUSBUICmdHelp,
+    EUSBUICmdMskSelect
+    };
+
+
+#endif      // USBCLASSCHANGEUIPLUGIN_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginCRWatcher.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2005, 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:  Central repository key watcher class.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGINCRWATCHER_H
+#define USBCLASSCHANGEUIPLUGINCRWATCHER_H
+
+// INCLUDES
+#include <centralrepository.h>
+
+// FORWARD DECLARATIONS
+class CRepository; 
+
+/**
+* A callback interface for informing change of a setting in Central Repository
+*/
+class MUSBUICRSettingObserver
+    {
+    public: // New functions
+        
+        /**
+        * Informs the observer that a setting has been changed. 
+        * @param aKey The changed key. 
+        * @return None.
+        */
+        virtual void SettingChangedL( TUint32 aKey ) = 0;
+    };
+
+
+/**
+* CUSBClassChangeUIPluginCRWatcher detects a change of the value of the CR key.
+* CUSBClassChangeUIPluginCRWatcher provides CActive object that is used to 
+* detect when the value of the selected key in Central Repository is changed 
+* by the USBWatcher. One observer can be notified by one or more
+* USBClassChangeUIPluginCRWatcher objects, each watching different keys. 
+*/
+class CUSBClassChangeUIPluginCRWatcher : public CActive
+    {
+        
+    public:
+
+        /**
+        * Factory method NewL
+        * @param aOwner     The observer to be notified on the change. 
+        * @param aKey       The Central Repository key to be watched. 
+        * @param aOneShot   If false, the listening is restarted after change.
+        * @return           The new watcher object. 
+        */
+        static CUSBClassChangeUIPluginCRWatcher* NewL( 
+            MUSBUICRSettingObserver& aOwner, TUint32 aKey, 
+            TBool aOneShot = EFalse);
+
+        /**
+        * Starts listening for notifications. If already listening, nothing 
+        * happens.
+        */
+        void StartListeningL();
+
+        /**
+        * Stops listening for notifications. If already stopped, nothing 
+        * happens.
+        * @param none
+        * @return none 
+        */
+        void StopListening();
+
+        /**
+        * C++ default constructor
+        * @param aOwner     The observer to be notified on the change. 
+        * @param aKey       The Central Repository key to be watched. 
+        * @param aOneShot   If false, the listening is restarted after change.
+        */
+        CUSBClassChangeUIPluginCRWatcher( 
+            MUSBUICRSettingObserver& aOwner, TUint32 aKey, 
+            TBool aOneShot = EFalse);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CUSBClassChangeUIPluginCRWatcher();
+
+    private:
+
+        /**
+        * Constructor.
+        * @param none
+        */
+
+        void ConstructL();
+
+        /**
+        *	Implements CActive
+        *   If this is not a one-shot CR watcher, the listening is restarted.
+        *	@param none
+        *	@return none
+        */
+        void RunL();
+    
+        /**
+        *	Implements CActive
+        *	@param aError the error returned
+        *	@return error
+        */
+        TInt RunError(TInt aError);
+
+        /**
+        *	Implements CActive
+        *	@param none
+        *	@return none
+        */
+        void DoCancel();
+
+     
+    private:
+        /** USB Watcher repository access */
+        CRepository* iPersonalityRepository;
+        /** The observer to be notified */
+        MUSBUICRSettingObserver& iOwner;
+        /** The repository key to be watcher */
+        TUint32 iKey;
+        /** If iOneShot is false, listening is restarted on notification */
+        TBool iOneShot;
+    };
+
+
+#endif      // USBCLASSCHANGEUIPLUGINCRWATCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginContainer.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,211 @@
+/*
+* 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:  Declares container control for application.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGINCONTAINER_H
+#define USBCLASSCHANGEUIPLUGINCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eikfrlb.h>
+#include <eikclb.h>
+#include <aknlists.h> 
+#include <AknInfoPopupNoteController.h>
+#include <AknIconArray.h>
+#include "USBClassChangeUIPlugin.hrh"
+
+// CONSTANTS
+/** number of controls inside this component */
+const TInt KUSBClassChangeUIComponentCount = 1;
+const TInt KUSBClassChangeUIIconGranularity = 3;
+const TInt KMaxVisibleTime = 3500;
+const TInt KMsToWaitBeforePopup = 1000;
+
+// FORWARD DECLARATIONS
+class CUSBClassChangeUIPluginView;
+class CUSBClassChangeUIPluginModel;
+
+// CLASS DECLARATION
+
+/**
+*  This class handles main view dependent requests from user and 
+*  contains listbox for main view items.
+*  @lib
+*/
+class CUSBClassChangeUIPluginContainer : public CCoeControl,                                   
+                                         public MEikListBoxObserver,
+                                         public MDesCArray
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Factory method NewL
+        * @return a pointer to itself
+        */
+        static CUSBClassChangeUIPluginContainer* NewL(
+            CUSBClassChangeUIPluginView* aView,
+            CUSBClassChangeUIPluginModel* aModel );
+        
+	    /**
+        * Destructor.
+        */
+        virtual ~CUSBClassChangeUIPluginContainer();
+
+	private:
+
+        /**
+        * C++ constructor.
+        */
+        CUSBClassChangeUIPluginContainer(
+            CUSBClassChangeUIPluginView* aView,
+            CUSBClassChangeUIPluginModel* aModel);
+
+	    /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+	public: // new functions
+	 
+        /**
+        * Handles setting changes.
+        */
+        void SettingChanged();
+ 
+        /**
+        * Handles screen resolution changes
+        * @param aType informs the type of resource change
+        */
+        void HandleResourceChange( TInt aType ); 
+        
+        /**
+        * Returns the current item index (highlight position) 
+        * for main setting list.
+        * @return Current item index.
+        */
+        TInt CurrentItemIndex();
+
+        // MDesCArray implementation
+
+        /**
+        * Returns number of items in array / main list.
+        * @return Number of items.
+        */
+        TInt MdcaCount() const;
+
+        /**
+        * Returns the current format string for the given item.
+        * @param aIndex Index of the item.
+        * @return Pointer to the format string.
+        */
+        TPtrC MdcaPoint( TInt aIndex ) const;
+        
+        /**
+        * selects the string to be passed to ShowPopUpL
+        * @param aValue is the index of the item in the list.
+        */
+        void ShowPopUpsL( TInt aIndex);
+             
+    private: // Functions from base classes
+        
+        /**
+        * From CoeControl Gets the number of controls contained 
+        * in a compound control.        
+        * @return The number of component controls contained by this control.
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CoeControl Gets the specified component of a compound control.
+        * @param aIndex The index of the control to get.
+        * @return Reference to the component control.
+        */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+
+        /**
+        * From CoeControl Handles key events.
+        * @param aKeyEvent The key event that occurred.
+        * @param aType The event type.
+        * @return Response to the key event.
+        */
+        TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent, TEventCode aType );        
+
+        /**
+        * From CoeControl Gets the control's help context.
+        * @param aContext The control's help context
+        */
+        void GetHelpContext(TCoeHelpContext& aContext) const;
+    
+        /**
+        * From CoeControl Responds to size changes. 
+        * Sets the size and position of the contents of this control.
+        */
+        void SizeChanged();
+        
+        /**
+        * From CoeControl Responds to a change in focus.
+        * @param aDrawnow Contains the value that was passed to it by 
+        *                 SetFocus(). 
+        */
+        void FocusChanged( TDrawNow aDrawnow );
+     
+  
+    protected:
+        /**
+        * From MEikListBoxObserver Handles list box events.
+        * @param aListBox The originating list box.
+        * @param aEventType The event type.
+        */
+        void HandleListBoxEventL(
+            CEikListBox* aListBox, TListBoxEvent aEventType );
+        
+    private: // Data
+
+        // The setting items listbox
+        // owned by this class
+        CAknDoubleLargeStyleListBox* iUSBMainListBox;		     
+        // Reference to appui object
+        CUSBClassChangeUIPluginView* iViewRef;
+        // To get personality IDs arrays
+        // not owned by this class
+        CUSBClassChangeUIPluginModel* iModelRef;
+        // All format string combinations 
+        // owned by this class              
+        CDesCArrayFlat* iUSBAllItemsArray; 
+        // All format string combinations 
+        // owned by this class 
+        CDesCArrayFlat* iUSBAllItemsArrayDefault; 
+        // All format string combinations 
+        // owned by this class 
+        CDesCArrayFlat* iUSBAllItemsArrayActive; 
+        // All format string combinations 
+        // owned by this class 
+        CDesCArrayFlat* iPopUpItems; 
+       
+        // Current highlighted main list item 
+        TInt iCurrentItemIndex;
+
+        // The controller for the PopUps (tooltips) in UI Setting view 
+        // owned by this class 
+        CAknInfoPopupNoteController* iPopupController;
+ 
+};
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginDebug.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2005, 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 file defines logging macros
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGINDEBUG_H
+#define USBCLASSCHANGEUIPLUGINDEBUG_H
+
+#ifdef _DEBUG
+
+#include <e32svr.h>
+#include <e32std.h>
+
+// ===========================================================================
+#ifdef __WINS__     // File logging for WINS
+// ===========================================================================
+#define FLOG(a)   { FPrint(a); }
+#define FTRACE(a) { a; }
+
+#include <f32file.h>
+#include <flogger.h>
+
+_LIT(KLogFile,"usbclasschangeuipluginlog.txt");
+_LIT(KLogDir,"USBUI");
+
+// Declare the FPrint function
+inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend,
+        aFmt, list);
+    }
+
+// ===========================================================================
+#else               // RDebug logging for target HW
+// ===========================================================================
+#define FLOG(a) { RDebug::Print(a);  }
+#define FTRACE(a) { a; }
+
+inline void FPrint(const TRefByValue<const TDesC16> 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);
+    }
+
+inline void FPrint(TRefByValue<const TDesC8> aFmt, ...)
+    {
+
+	VA_LIST list;
+	VA_START(list, aFmt);
+    TBuf8<256> buf8;
+	buf8.AppendFormatList(aFmt, list);
+
+    TBuf16<256> buf16(buf8.Length());
+    buf16.Copy(buf8);
+
+    TRefByValue<const TDesC> tmpFmt(_L("%S"));
+    RDebug::Print(tmpFmt, &buf16);
+    }
+
+#endif //__WINS__
+
+// ===========================================================================
+#else // // No loggings --> Reduced binary size
+// ===========================================================================
+#define FLOG(a)
+#define FTRACE(a)
+
+#endif // _DEBUG
+
+
+#endif // USBCLASSCHANGEUIPLUGINDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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: 
+*        Header file for CUSBClassChangeUIPluginInterface class.
+*
+*/
+
+#ifndef USBCLASSCHANGEUIPLUGININTERFACE_H
+#define USBCLASSCHANGEUIPLUGININTERFACE_H
+
+// System includes
+#include <gsplugininterface.h>
+
+
+/**
+ * ECOM plug-in creation for the standalone application. 
+ * The view class must inherit this class to be able to signal the
+ * destruction of the interface implementation. If this implementation
+ * was created in the GS application, the destruction must not be 
+ * signalled, since the view framework does it. If this implementation
+ * was created in the standalone USB UI application, the destruction
+ * must be signalled, since otherwise there will be memory leaks. 
+ * 
+ * The inherited CGSPluginInterface destructor does not signal the
+ * desctruction. Also, it cannot be signalled in the destructor of 
+ * this class, since it would be called while deleting the view. 
+ * This class stores the instance ID iDtor_ID_Key, because it can't
+ * access the private member variable of class CGSPluginInterface.
+ * 
+ * Note that the implementation is inline, because the concrete 
+ * plug-in has not been loaded. The implementation of this class can't
+ * reside in the plug-in to be loaded by the ECOM framework. 
+ * 
+ */ 
+class CUSBClassChangeUIPluginInterface	: public CGSPluginInterface
+    {    
+    public: // Constructors & destructors
+
+        /**
+         * Creates new USBClassChangeUI view plugin having the given UID.
+         * Uses Leave code KErrNotFound, if implementation is not found.
+         *
+         * @param aImplementationUid Implementation UID of the plugin to be 
+         *        created.
+         * @param aInitParams The AppUi of the USBClassChangeUI application.
+         * @return The new view. 
+         */                                                 
+        static CUSBClassChangeUIPluginInterface* NewL(
+            const TUid aImplementationUid, 
+            TAny* aInitParams);
+
+        /**
+         * Destructor
+         */
+        ~CUSBClassChangeUIPluginInterface();
+
+        /**
+         * Signal destruction of the interface implementation to ECOM.
+         * This should not be called from the GS plugin, since the 
+         * framework wants to do it itself. From the application, the
+         * view must call this before destruction. 
+         */
+        void SignalDestruction();
+            
+    protected: 
+
+        /**
+         * Default constructor
+         */    
+        CUSBClassChangeUIPluginInterface();
+        
+    private: // Data
+
+        /**
+         * ECOM plugin instance UID. 
+         * The inherited member variable with the same name is hidden, but
+         * there is no way to access it. 
+         */
+        TUid iDtor_ID_Key;
+    };
+
+
+#include "USBClassChangeUIPluginInterface.inl"
+
+#endif //USBCLASSCHANGEUIPLUGININTERFACE_H
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.inl	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:  Implementation for CUSBClassChangeUIPluginInterface class.
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+inline CUSBClassChangeUIPluginInterface::CUSBClassChangeUIPluginInterface()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor. 
+// -----------------------------------------------------------------------------
+//
+inline CUSBClassChangeUIPluginInterface::~CUSBClassChangeUIPluginInterface()
+    {
+    //REComSession::DestroyedImplementation can't be called, because the 
+    //GS framework wants to do it. 
+    }
+
+
+// -----------------------------------------------------------------------------
+// Create new plugin having the given UID.
+// -----------------------------------------------------------------------------
+//
+inline CUSBClassChangeUIPluginInterface* CUSBClassChangeUIPluginInterface::NewL( 
+    TUid aImplementationUid, 
+    TAny* aInitParams )
+    {
+    TAny* ptr;
+    TInt32 keyOffset = _FOFF( CUSBClassChangeUIPluginInterface, iDtor_ID_Key );
+
+    ptr = REComSession::CreateImplementationL(
+        aImplementationUid,
+        keyOffset,
+        aInitParams);    
+     
+    return static_cast< CUSBClassChangeUIPluginInterface* >( ptr );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// Signal destruction of interface implementation to ECOM.
+// -----------------------------------------------------------------------------
+//
+inline void CUSBClassChangeUIPluginInterface::SignalDestruction()
+    {
+    REComSession::DestroyedImplementation( iDtor_ID_Key );    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginModel.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,269 @@
+/*
+* 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:  Declares model class for application.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGINMODEL_H
+#define USBCLASSCHANGEUIPLUGINMODEL_H
+
+
+// INCLUDES
+#include <badesca.h>
+#include <usbman.h>
+#include <usbwatcher.h>
+#include <eikfrlb.h>
+#include <eikclb.h>
+#include <aknlists.h> 
+#include "USBClassChangeUIPlugin.hrh"
+#include "USBClassChangeUIPluginCRWatcher.h"
+#include "USBDeviceStateWatcher.h"
+#include "usbotghoststatewatcher.h"
+
+// CONSTANTS
+/** granularity for supported modes array */
+const TInt KUSBClassChangeUISupportedModesGranularity = 3;
+
+// FORWARD DECLARATIONS
+class CUSBDeviceStateWatcher;
+
+// CLASS DECLARATION
+
+/**
+ * A callback interface for informing change of settings and device state.
+ */
+class MUSBUIObserver : public MUSBDeviceStateObserver, 
+    public MUSBOtgHostStateObserver
+    {
+    public: // New functions
+        
+        /**
+        * Informs the observer that a setting has been changed. 
+        * The list should be refreshed.
+        */
+        virtual void SettingChanged() = 0;
+    };
+
+/**
+* This class has access to all data needed by this application.
+* All manipulation of data is done through this class.
+*/
+class CUSBClassChangeUIPluginModel : public CActive, 
+    public MUSBUICRSettingObserver, MUSBDeviceStateObserver, MUSBOtgHostStateObserver
+    {
+    public: // Constructors and destructor
+
+	    /**
+        * Destructor.
+        */
+        virtual ~CUSBClassChangeUIPluginModel(); 
+
+    public: // New functions
+        
+        
+        /**
+        * Factory method NewL
+        * @return a pointer to itself
+        */
+        static CUSBClassChangeUIPluginModel* NewL();
+        
+        
+        /**
+        * Sets the USB mode.
+        * @param aMode the id of the selected personality 
+        */
+        void SetUSBModeL( TInt aMode );
+
+        /**
+        * Gets the USB mode.
+        * @return the id of the personality
+        */
+        TInt USBMode();
+        
+        /**
+         * Gets the number of usb personalities.
+         * @return the number of existing personalities 
+         */
+        TInt PersonalityCount() ;
+        /**
+         * Gets the current device state.
+         * @param   aState  receives the current state of the USB device
+         * @return  KErrNone if successful, otherwise the error that occurred
+         */
+        TInt GetDeviceState(TUsbDeviceState& aState);
+
+        /**
+         * Gets description for the specified USB mode (personality ID)
+         * @param   aMode a personality id
+         * @param   aDescription a localized text string
+         * @return  KErrNone if successful, otherwise the error that occurred.
+         */
+        TInt GetDescription(TInt aMode, HBufC*& aDescription);
+
+        /**
+        * Updates temporary member variable data.        
+        * @param aObserver Reference to MUSBUIObserver instance.        
+        */
+        void SetSettingsObserver(MUSBUIObserver* aObserver);
+        
+        /*
+        * Reads the supported USB modes from the resource file and CenRep.
+        * Adds modes to the CDesCArrayFlat lists to be used either
+        * for list box or for setting page
+        * @param aListBox The list where the USB modes are appended for list box
+        * @param aListBoxDefault The list where the USB modes are appended with their secondary line "default" 
+        * @param aListBoxActive The list where the USB modes are appended with their secondary line "active" 
+        * @param aPopUpItems The list where the descriptive strings will be stored 
+        * @param aIconArray The list where icons for USB modes are stored
+        */
+        void SupportedUSBModeArraysL(  CDesCArrayFlat& aListBox, CDesCArrayFlat& aListBoxDefault,
+                CDesCArrayFlat& aListBoxActive, CDesCArrayFlat& aPopUpItems, CArrayPtrFlat<CGulIcon>& aIconArray );       
+        
+        /**
+        * From MUSBUICRSettingObserver.
+        * Changes the USB mode in the USB application. 
+        * Called by CUSBClassChangeUICenRepWatcher, when the key 
+        * KUsbWatcherPersonality is changed by the USBWatcher.
+        * @param aKey identifies the setting that has changed
+        */
+        void SettingChangedL( TUint32 aKey );
+
+        /**
+         * From MUSBOtgHostStateObserver
+         * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
+         */
+        void OtgHostIdPinStateChanged(TBool aIsIdPinOn);
+        
+        /**
+         * From MUSBOtgHostStateObserver
+         * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
+         */
+        void HostEventNotify(TDeviceEventInformation aEventInfo);
+        
+        /**
+         * From MUSBDeviceStateObserver.
+         * Informs the observer that USB device state has changed.
+         * @param aPreviousState previous device state.
+         * @param aCurrentState current device state.
+         */
+        void DeviceStateChanged(TUsbDeviceState aPreviousState,
+                                TUsbDeviceState aCurrentState);
+
+        
+        /**
+        * Gets the IDs of supported USB personalities.
+        * @return RArray of personality IDs
+        */
+        RArray<TInt>& GetUsbIds();
+             
+        /**
+         * Returns if it acts as a host and the driver to the attached pheripheral 
+         * is loaded successfully(or partially). 
+         * NOTE: Only single perihperal supported now.
+         * @param aHasPeripheralEnabled Is A-device is ready to be used or not
+         * @return KErrNone if successful, otherwise the error that occurred
+         */
+        TInt HasPeripheralEnabled(TBool& aHasPeripheralEnabled);
+        
+  
+    protected:
+        /**
+        * Default ConstructL can leave.
+        */
+        void ConstructL();
+
+	    /**
+        * C++ default constructor.
+        */
+        CUSBClassChangeUIPluginModel();        
+        
+        /**
+        * Derived from CActive
+        */
+        void RunL();
+
+        /**
+        * Derived from CActive
+        */
+        void DoCancel();
+        
+    private:
+        /**
+         * selects the icon related to each mode to be added into the iconlist
+         * @param aMode the mode id
+         * @param aIconArray The list where icons for USB modes are stored
+         */
+        void AddIconL (TInt aMode, CArrayPtrFlat<CGulIcon>& aIconArray);
+               
+        /**
+         * creats and append the icons to the list
+         * @param aID Item ID of the masked bitmap to be created.
+         * @param aFilename Filename to be used to construct the item.
+         * @param aBitmapId The ID if bitmap 
+         * @param aMaskId The ID of bitmap's mask
+         * @param aIconArray The list where icons for USB modes are stored
+         */
+        void CreateAndAppendIconL( const TAknsItemID& aID,
+                                   const TDesC& aFileName,
+                                   const TInt aBitmapId,
+                                   const TInt aMaskId,
+                                   CArrayPtrFlat<CGulIcon>& aIconArray);
+                 
+    private: // Data
+         // Reference to settings observer
+         MUSBUIObserver* iObserver;
+
+         // References to central repository watcher
+         // owned by this class
+         CUSBClassChangeUIPluginCRWatcher* iCRPersonalityWatcher;
+
+         // Reference to device state watcher
+         // owned by this class
+         CUSBDeviceStateWatcher* iDeviceStateWatcher;
+         
+         // Contains USB mode indexes
+         RArray<TInt> iUsbModeIndexes; 
+         
+         // Central repository handle 
+         // owned by this class
+         CRepository* iRepository; 
+         
+         /** Handle to usbman for retrieving the personalities */
+         RUsb iUsbman;
+         
+         /** Handle to USBWatcher for setting the personality */
+         RUsbWatcher iUsbWatcher;         
+         
+         /** Is connected to USB Watcher */
+         TBool iUsbWatcherConnected;
+         
+         /** UsbOtg status watcher */
+         CUSBOtgHostStateWatcher* iOtgHostStateWatcher;
+         
+         /**
+          * Ids of the devices for which host drivers have been loaded.
+          * When we start to support hubs, there may be more than one element
+          * in this array.
+          */
+         RArray<TInt> iDeviceIDs;
+		 
+         //Number of personalities
+         TInt iPersonalityCount;
+         
+    };
+
+#endif // USBCLASSCHANGEUIPLUGINMODEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* 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:  Declares container control for application.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIPLUGINVIEW_H
+#define USBCLASSCHANGEUIPLUGINVIEW_H
+
+// INCLUDES
+
+#include <aknview.h>            // AVKON components
+#include <AknQueryDialog.h>     // AVKON component
+#include <eikmenup.h>           // Menu pane definitions
+#include <gsplugininterface.h>  // General Settings plugin
+#include <ConeResLoader.h>
+#include <data_caging_path_literals.hrh> 
+
+#include "USBClassChangeUIPluginModel.h"   
+#include "USBClassChangeUIPluginInterface.h"
+
+// CONSTANTS
+/** implementation uid */
+const TUid KGsUSBUIPluginUid = { 0x1020E472 };
+
+_LIT(KFileDrive,"z:");
+_LIT(KResourceFileName, "USBClassChangeUIPlugin.rsc");
+_LIT(KUSBUIconFileName, "usbui.mif");
+
+/** USB modes are listed in the setting page */
+const TInt KSettingPageItemsGranularity = 3;
+
+// FORWARD DECLARATIONS
+class CUSBClassChangeUIPluginContainer;
+
+// CLASS DECLARATION
+ 
+/**
+* Main view of the application. Handles view activation, 
+* deactivation, commands and dynamic options menus.
+*/
+class CUSBClassChangeUIPluginView :
+    public CUSBClassChangeUIPluginInterface,
+    public MUSBUIObserver
+    {
+    public: // Constructors and destructor
+        	
+        /**
+        * Entry point for General Settings
+        */	
+        static CUSBClassChangeUIPluginView* NewPluginL();
+        
+        /**
+        * Entry point for USBClassChangeUIAppUi
+        */	
+        static CUSBClassChangeUIPluginView* NewL();
+        
+    	/**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+		/**
+        * Destructor.
+        */
+        virtual ~CUSBClassChangeUIPluginView();
+        
+    public: // Functions from base classes
+
+        /**
+        * From CAknView Returns view id.
+        * @param None.
+        * @return View id.
+        */
+        TUid Id() const;
+		
+		/**
+        * From CAknView Handles user commands.
+        * @param aCommand A command id.        
+        * @return None.
+        */
+        void HandleCommandL( TInt aCommand );
+        
+        /**
+        * From CGSPluginInterface
+        * Method for getting caption of this plugin. This should be the 
+        * localized name of the settings view to be shown in parent view.
+        *
+        * @param aCaption pointer to Caption variable
+        */
+        void GetCaptionL( TDes& aCaption ) const;
+        
+        /**
+        * From CGSPluginInterface.
+        * Function for getting plugin's value for a certain key.
+        *
+        * @param aKey Key for the value to be retrieved.
+        * @parem aValue Value for the given gey in TDes format.
+        */
+        void GetValue(const TGSPluginValueKeys aKey, TDes& aValue );
+
+        /**
+        * From CGSPluginInterface
+        * Creates a new icon of desired type.
+        *
+        * @param  aIconType UID Icon type UID of the icon to be created.
+        * @return Pointer of the icon. NOTE: Ownership of this icon is
+        *         transferred to the caller.
+        */
+        CGulIcon* CreateIconL( const TUid aIconType );
+   
+        /**
+        * Initialize options menu.
+        * Remove help option, if the feature is not supported.
+        * @param aResId Resource Id
+        * @param aMenu The menu pane.
+        */
+        void DynInitMenuPaneL( TInt aResId, CEikMenuPane* aMenu );
+        
+        /**
+        * From MUSBUIObserver.
+        * Informs the observer that a setting has been changed. 
+        */
+        void SettingChanged();
+
+        /**
+         * From MUSBUIObserver/MUSBDeviceStateObserver.
+         * Informs the observer that USB device state has changed.
+         * @param aState current device state.
+         */
+        void DeviceStateChanged(TUsbDeviceState aPrevState,
+                                TUsbDeviceState aState);
+
+        /**
+         * From MUSBUIObserver/MUSBOtgHostStateObserver.
+         * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
+         */
+        void OtgHostIdPinStateChanged(TBool aIsIdPinOn);
+
+        /**
+         * From MUSBOtgHostStateObserver
+         * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
+         */
+        void HostEventNotify(TDeviceEventInformation aEventInfo);
+        
+        // New functions
+        
+        /**
+        * Gets the USB mode (from model)
+        * @param None.
+        * @return the value of the personality ID
+        */
+        TInt USBMode() const;
+        
+        /**
+        * Sets the USB mode (through model)
+        * @param The value of the personality ID.
+        * @return None.
+        */
+        void SetUSBModeL( TInt );
+                          
+        /**
+         * Checks whether USB device is connected.
+         */
+        TBool IsUSBDeviceConnected();
+
+     private: 
+     
+        
+         /**
+         * Updates parent view if we are loaded by GS plugin.
+         */
+        void UpdateParentView();
+
+        /**
+        * Handle change command for USB mode
+        * @param aMode usb mode id
+        */
+        void HandleCmdChangeUSBModeL(TInt aMode);
+        
+     private: // Functions from base classes
+
+        /**
+        * From CAknView Activates view.
+        * @param aPrevViewId Id of previous view.
+        * @param aCustomMessageId Custom message id.
+        * @param aCustomMessage Custom message.
+        * @return None.
+        */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                                TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );		
+
+        /**
+        * From CAknView Deactivates view.        
+        * @param None.
+        * @return None.
+        */
+        void DoDeactivate();
+
+    private: // Data
+        //Reference to the UI container
+        //owned by this class
+        CUSBClassChangeUIPluginContainer*   iContainer;
+        
+        //reference to the AppUI
+        //not owned
+        CAknViewAppUi*              		iAppUIRef;
+        
+        //Reference to the Model
+        //owned by this class
+        CUSBClassChangeUIPluginModel*	    iModelRef;	
+        
+        // Flag used if it is needed to load 
+        // the UI plugin 
+        TBool                       		iLoadAsGSPlugin;
+        
+        CEikonEnv*                          iEikEnv;
+        // Flag for eikon env.
+        TInt                                iResourceFileFlag; 
+        // Previous view of GS ap
+        TVwsViewId 				    		iPrevViewId; 	   
+       
+        TBool                               iHelpSupported;
+
+    };
+
+#endif  // USBCLASSCHANGEUIPLUGINVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/USBDeviceStateWatcher.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Device state watcher class.
+ *
+*/
+
+
+#ifndef USBDEVICESTATEWATCHER_H
+#define USBDEVICESTATEWATCHER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <usbman.h>
+
+/**
+ * A callback interface for informing about device state changes
+ */
+class MUSBDeviceStateObserver
+    {
+    public:
+        
+        /**
+         * Informs the observer that USB device state has changed.
+         * @param aPreviousState previous device state.
+         * @param aCurrentState current device state.
+         */
+        virtual void DeviceStateChanged(TUsbDeviceState aPreviousState,
+                                        TUsbDeviceState aCurrentState) = 0;
+    };
+
+// CLASS DECLARATION
+
+/**
+ * Class that listens for USB device state changes and notifies
+ * the observer.
+ */
+class CUSBDeviceStateWatcher : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+         * Two-phased constructor. Uses existing usb manager session.
+         * Note that it's not possible (and usually not necessary) to attach
+         * more than one USBDeviceStateWatcher to the same session.
+         *
+         * @param aObserver  Reference to device state observer.
+         * @param aUsbMan    Existing usb manager session.
+         * @return Pointer to created object.
+         */
+        static CUSBDeviceStateWatcher* NewL(MUSBDeviceStateObserver& aObserver,
+            RUsb& aUsbMan);
+        
+        /**
+         * Two-phased constructor. Creates its own usb manager session.
+         *
+         * @param aObserver  Reference to device state observer.
+         * @return Pointer to created object.
+         */
+        static CUSBDeviceStateWatcher* NewL(MUSBDeviceStateObserver& aObserver);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CUSBDeviceStateWatcher();
+
+    public: // from base class CActive
+
+        /**
+        * From CActive.
+        * This method is called when device state has changed.
+        */
+        void RunL();
+
+        /**
+        * From CActive.
+        * In this implementation this method should never be called.
+        *
+        * @param aError the leave code
+        * @return KErrNone
+        */
+        TInt RunError(TInt aError);
+
+        /**
+        * From CActive
+        * If there is outstanding request pending when Cancel() is called then
+        * this method must cancel request.
+        */
+        void DoCancel();
+
+    private:
+
+        /**
+         * Private constructor.
+         *
+         * @param aObserver Reference to MUSBDeviceStateObserver.
+         */
+        CUSBDeviceStateWatcher(MUSBDeviceStateObserver& aObserver);
+
+        /**
+         * 2nd phase constructor.
+         * Creates its own usb manager session.
+         */
+        void ConstructL();
+        
+        /**
+         * 2nd phase constructor.
+         * Uses existing usb manager session.
+         *
+         * @param aUsbMan    Existing usb manager session.
+         */
+        void ConstructL(RUsb& aUsbMan);
+        
+        /**
+         * Code shared by all ConstructL methods.
+         */
+        void CommonConstructL();
+        
+        // Disable default C++ behavior that makes no sense
+        // for this implementation.
+        CUSBDeviceStateWatcher();
+        CUSBDeviceStateWatcher(const CUSBDeviceStateWatcher&);
+        CUSBDeviceStateWatcher& operator=(const CUSBDeviceStateWatcher&);
+
+    private: // Data
+
+        /**
+         * Handle to Usb Manager
+         */
+        RUsb iUsbMan;
+
+        /**
+         * Current device state
+         */
+        TUsbDeviceState iCurrentState;
+
+        /**
+         * Last known device state
+         */
+        TUsbDeviceState iPreviousState;
+
+        /**
+         * Refernce to the observer
+         */
+        MUSBDeviceStateObserver& iObserver;
+    };
+
+#endif   // USBDEVICESTATEWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/inc/usbotghoststatewatcher.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,267 @@
+/*
+* 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:  OtgHost state watcher class.
+ *
+*/
+
+
+#ifndef USBOTGHOSTSTATEWATCHER_H
+#define USBOTGHOSTSTATEWATCHER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+#include <usbman.h>
+#include <usbhostdefs.h>
+
+
+/**
+ * A callback interface for informing about OtgHost state changes
+ */
+class MUSBOtgHostStateObserver
+    {
+    public:
+        
+        /**
+         * Informs the observer that USB Otg Id Pin state has changed.
+         * @param aIsPinOn Id pin state - ETrue(On), EFalse(Off) 
+         */
+        virtual void OtgHostIdPinStateChanged(TBool aIsIdPinOn) = 0;
+
+        /**
+         * Informs the observer that USB host event.
+         * @param aEventInfo Device information related to this event
+         */
+        virtual void HostEventNotify(TDeviceEventInformation aEventInfo) = 0;
+    };
+
+// CLASS DECLARATION
+
+/**
+ * Class that listens for USB OtgHost state changes then notifies
+ * the observer.
+ */
+class CUSBOtgHostStateWatcher : CBase
+    {
+    class CUSBOtgIdPinStateWatcher : public CActive
+        {
+    public:
+        /**
+         * Two-phased constructor. 
+         *
+         * @param aOtgHostStateWatcher Reference to the owner - CUSBOtgHostStateWatcher.
+         * @return Pointer to created object.
+         */
+        static CUSBOtgIdPinStateWatcher* NewL(CUSBOtgHostStateWatcher& aOtgHostStateWatcher);
+
+        /** C++ destructor */
+        virtual ~CUSBOtgIdPinStateWatcher();
+
+        /**
+         * Get Id pin state
+         * @aIsIdPinOn Receive Id pin on/off state. ETrue: Id pin on, EFalse: Id pin off.
+         * @return KErrNone if successful, otherwise the error that occurred 
+         */
+        TInt IsIdPinOn(TBool &aIsIdPinOn);
+        
+    protected:
+        // from base class CActive
+        /**
+         * From CActive.
+         * This method is called when Id pin state has changed.
+         */
+        void RunL();
+
+        /**
+         * From CActive.
+         * In this implementation this method should never be called.
+         *
+         * @param aError the leave code
+         * @return KErrNone
+         */
+        TInt RunError(TInt aError);
+
+        /**
+         * From CActive
+         * If there is outstanding request pending when Cancel() is called then
+         * this method must cancel request.
+         */
+        void DoCancel();
+
+    private:
+        /**
+         * C++ constructor
+         * @param aOtgHostStateWatcher Reference to the owner - CUSBOtgHostStateWatcher.
+         */
+        CUSBOtgIdPinStateWatcher(CUSBOtgHostStateWatcher& aOtgHostStateWatcher);
+        
+        /**
+         * 2nd phase constructor.
+         */
+        void ConstructL();
+        
+    private: // Data
+        /**
+         * The observer observes property change
+         */
+        RProperty iIdPin;
+        
+        /**
+         * The owner - CUSBOtgHostStateWatcher
+         */
+        CUSBOtgHostStateWatcher& iOtgHostStateWatcher;
+        };
+
+    class CUSBHostEventNotifWatcher : public CActive
+        {
+    public:
+        /**
+         * Two-phased constructor. 
+         *
+         * @param aOtgHostStateWatcher Reference to the owner - CUSBOtgHostStateWatcher.
+         * @return Pointer to created object.
+         */
+        static CUSBHostEventNotifWatcher* NewL(CUSBOtgHostStateWatcher& aOtgHostStateWatcher);
+
+        /** C++ destructor */
+        virtual ~CUSBHostEventNotifWatcher();
+
+    protected:
+        // from base class CActive
+        /**
+         * From CActive.
+         * This method is called when host event emerged .
+         */
+        void RunL();
+
+        /**
+         * From CActive.
+         * In this implementation this method should never be called.
+         *
+         * @param aError the leave code
+         * @return KErrNone
+         */
+        TInt RunError(TInt aError);
+
+        /**
+         * From CActive
+         * If there is outstanding request pending when Cancel() is called then
+         * this method must cancel request.
+         */
+        void DoCancel();
+
+    private:
+        /**
+         * C++ constructor
+         * @param aOtgHostStateWatcher Reference to the owner - CUSBOtgHostStateWatcher.
+         */
+        CUSBHostEventNotifWatcher(CUSBOtgHostStateWatcher& aOtgHostStateWatcher);
+        
+        /**
+         * 2nd phase constructor.
+         */
+        void ConstructL();
+        
+    private: // Data
+        /**
+         * Notification info comes to this member
+         */
+        TDeviceEventInformation iEventInfo;
+        
+        /**
+         * The owner - CUSBOtgHostStateWatcher
+         */
+        CUSBOtgHostStateWatcher& iOtgHostStateWatcher;
+        };
+    
+    public:  // Constructors and destructor
+        
+        /**
+         * Two-phased constructor. Uses existing usb manager session.
+         * Note that it's not possible (and usually not necessary) to attach
+         * more than one USBOtgHostStateWatcher to the same session.
+         *
+         * @param aObserver  Reference to OtgHost state observer.
+         * @param aUsbMan    Existing usb manager session.
+         * @return Pointer to created object.
+         */
+        static CUSBOtgHostStateWatcher* NewL(MUSBOtgHostStateObserver& aObserver,
+            RUsb& aUsbMan);
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CUSBOtgHostStateWatcher();
+
+        /**
+         * Get Id pin state
+         * @aIsIdPinOn Receive Id pin on/off state. ETrue: Id pin on, EFalse: Id pin off.
+         * @return KErrNone if successful, otherwise the error that occurred 
+         * @see CUSBOtgIdPinStateWatcher::IsIdPinOn
+         */
+        TInt IsIdPinOn(TBool &aIsIdPinOn);
+        
+        /**
+         * Check wheather a pheripheral device is connected or not. 
+         * @aIsConnected A pheripheral device connected(ETrue) or not(EFailse).
+         * @return KErrNone if successful, otherwise the error that occurred 
+         */
+       TInt IsPeripheralConnected(TBool &aIsConnected);
+        
+    private:
+
+        /**
+         * Private constructor.
+         * @param aObserver Reference to MUSBOtgHostStateObserver.
+         * @param aUsbMan Existing usb manager session.
+         */
+        CUSBOtgHostStateWatcher(MUSBOtgHostStateObserver& aObserver, RUsb& aUsbMan);
+
+        /**
+         * 2nd phase constructor.
+         */
+        void ConstructL();
+        
+    private: // Data
+
+        /**
+         * Usb Manager
+         */
+        RUsb& iUsbMan;
+
+        /**
+         * Property of peripheral-connected
+         */
+        RProperty iPeripheral;
+        
+        /**
+         * The observer of OTG/host events
+         */
+        MUSBOtgHostStateObserver& iObserver;
+        
+        /**
+         * The watcher of Otg Id Pin state
+         * Own.
+         */
+        CUSBOtgIdPinStateWatcher* iOtgIdPinWatcher;
+        
+        /**
+         * The watcher of host event
+         * Own.
+         */
+        CUSBHostEventNotifWatcher* iHostEventWatcher;
+        
+    };
+
+#endif   // USBOTGHOSTSTATEWATCHER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginCRWatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2005, 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 implements USBClassChangeUIPluginCRWatcher class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "USBClassChangeUIPluginCRWatcher.h"
+#include "UsbWatcherInternalCRKeys.h"
+#include "USBClassChangeUIPluginModel.h"
+#include "USBClassChangeUIPluginDebug.h"
+
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginCRWatcher* CUSBClassChangeUIPluginCRWatcher::NewL(
+    MUSBUICRSettingObserver& aOwner, TUint32 aKey, TBool aOneShot)
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher:NewL"));
+    CUSBClassChangeUIPluginCRWatcher* self 
+        = new (ELeave) CUSBClassChangeUIPluginCRWatcher(aOwner, aKey, aOneShot);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::~CUSBClassChangeUIPluginCRWatcher
+// C++ default destructor
+// -----------------------------------------------------------------------------
+//    
+CUSBClassChangeUIPluginCRWatcher::~CUSBClassChangeUIPluginCRWatcher()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: desctructor"));
+    Cancel(); // cancels any existing active object orders for iStatus
+    delete iPersonalityRepository; // deletes CRepository* member object.
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: desctructor complete"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::CUSBClassChangeUIPluginCRWatcher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginCRWatcher::CUSBClassChangeUIPluginCRWatcher(
+    MUSBUICRSettingObserver& aOwner, TUint32 aKey, TBool aOneShot)
+    : CActive(EPriorityStandard), 
+    iOwner(aOwner),
+    iKey(aKey),
+    iOneShot(aOneShot)
+    {
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::RunError
+// Standard active object error function.
+// -----------------------------------------------------------------------------
+//
+
+TInt CUSBClassChangeUIPluginCRWatcher::RunError(TInt /*aError*/)
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher::RunError: ERROR %d \
+        from RunL.") );
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::RunL
+// This function will be called upon a change in the watched key.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginCRWatcher::RunL()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher::RunL"));
+
+    iOwner.SettingChangedL( iKey );        
+    if (!iOneShot)
+        {
+        StartListeningL(); 
+        }
+
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher::RunL complete."));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::ConstructL
+// Construct member variable iPersonalityRepository that is to access the
+// repository. Then start listening of the changes in the repository.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginCRWatcher::ConstructL()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: ConstructL"));
+    CActiveScheduler::Add(this);
+
+    iPersonalityRepository = CRepository::NewL( KCRUidUsbWatcher );
+    
+    StartListeningL();
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: ConstructL complete"));        
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::StopListening
+// Cancels notifications.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginCRWatcher::StopListening()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: StopListening"));
+    Cancel();
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: StopListening complete"));
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::StartListeningL
+// Orders notifications and sets the object active.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginCRWatcher::StartListeningL()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: StartListeningL"));
+    if(IsActive())
+        {
+        return;   
+        }
+
+    User::LeaveIfError(iPersonalityRepository->NotifyRequest(
+        iKey, 
+        iStatus ) );
+    SetActive();
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher: StartListening complete"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginCRWatcher::DoCancel
+// Standard active object cancellation function.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginCRWatcher::DoCancel()
+    {
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher::DoCancel"));
+    
+    if ( iPersonalityRepository )
+        {
+        // cancel the order for change notifications
+        iPersonalityRepository->NotifyCancel( iKey );
+        }
+    FLOG(_L("[USBCLASSCHANGEUIPLUGIN]\tCUSBClassChangeUIPluginCRWatcher::DoCancel complete"));
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,446 @@
+/*
+* 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:  Container that contains the USB mode listbox
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsread.h>	// Resource reader
+
+#include <usbpersonalityids.h>
+#include <USBClassChangeUIPlugin.rsg> // Resources
+#include <csxhelp/usb.hlp.hrh>   // Help id
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <eikmenub.h>
+#include <eikmobs.h>
+
+#include "USBClassChangeUIPlugin.h"
+#include "USBClassChangeUIPluginContainer.h"
+#include "USBClassChangeUIPluginModel.h"
+#include "USBClassChangeUIPluginView.h"
+#include "USBClassChangeUIPluginDebug.h"
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginContainer*
+CUSBClassChangeUIPluginContainer::NewL(
+    CUSBClassChangeUIPluginView* aView,
+    CUSBClassChangeUIPluginModel* aModel)
+    {
+    FLOG(_L("[USBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer:NewL"));
+    CUSBClassChangeUIPluginContainer* self 
+        = new (ELeave) CUSBClassChangeUIPluginContainer(aView, aModel);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self); 
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::ConstructL(const TRect& aRect)
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::ConstructL()
+    { 
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::ConstructL()"));
+    
+    CreateWindowL();
+    iPopupController = CAknInfoPopupNoteController::NewL();
+   
+    iUSBAllItemsArray = new ( ELeave ) CDesCArrayFlat( 
+        KUSBClassChangeUISupportedModesGranularity );
+    iUSBAllItemsArrayDefault = new ( ELeave ) CDesCArrayFlat( 
+            KUSBClassChangeUISupportedModesGranularity );
+    iUSBAllItemsArrayActive = new ( ELeave ) CDesCArrayFlat( 
+            KUSBClassChangeUISupportedModesGranularity );
+    iPopUpItems = new ( ELeave ) CDesCArrayFlat( 
+            KUSBClassChangeUISupportedModesGranularity );
+    CArrayPtrFlat<CGulIcon>* iconArray = new(ELeave) CArrayPtrFlat<CGulIcon>(KUSBClassChangeUIIconGranularity);  
+    CleanupStack::PushL( iconArray );
+       
+    // prepare the listbox items and the tooltip strings for the USB UI view
+    iModelRef->SupportedUSBModeArraysL( *iUSBAllItemsArray, *iUSBAllItemsArrayDefault, *iUSBAllItemsArrayActive, *iPopUpItems, *iconArray);
+
+    // Create DoubleLargeStyleListBox for USB UI view
+    //
+    iUSBMainListBox = new ( ELeave ) CAknDoubleLargeStyleListBox;
+    iUSBMainListBox->SetContainerWindowL( *this );
+    iUSBMainListBox->ConstructL( this, EAknListBoxMarkableList );
+
+    // Set up scroll bar for the Listbox
+    iUSBMainListBox->CreateScrollBarFrameL( ETrue );
+    iUSBMainListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+        CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto );
+    
+    // As soon as the list is created the tooltip info of the first item in the list is shown
+    
+   
+    //creating a handle to the icon array and passing its ownership to data object
+    //no need to handle its deletion
+    iUSBMainListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
+    CleanupStack::Pop(iconArray);
+    
+    iUSBMainListBox->Model()->SetItemTextArray( this );
+    iUSBMainListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    iUSBMainListBox->SetListBoxObserver( this );
+
+    SetRect( iViewRef->ClientRect() );
+   
+    const RArray<TInt> usbIds = iModelRef->GetUsbIds();
+    TInt currentMode = usbIds.Find(iViewRef->USBMode());
+    ShowPopUpsL(currentMode);
+    ActivateL();
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::ConstructL complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginContainer::CUSBClassChangeUIPluginContainer( 
+    CUSBClassChangeUIPluginView* aView,
+    CUSBClassChangeUIPluginModel* aModel) :
+    iViewRef(aView), iModelRef(aModel)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginContainer::~CUSBClassChangeUIPluginContainer()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::Destructor"));
+
+	delete iUSBMainListBox;
+	
+	delete iUSBAllItemsArray;
+	delete iUSBAllItemsArrayDefault;
+	delete iUSBAllItemsArrayActive;
+	delete iPopUpItems;
+	
+    delete iPopupController;
+	FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::Destructor complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::SizeChanged()
+// Called by framework when the view size is changed
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::SizeChanged()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::SizeChangedL()"));
+    
+    iUSBMainListBox->SetRect( Rect() ); 
+    iUSBMainListBox->SetFocus( ETrue );
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::SizeChangedL complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::FocusChanged()
+// Called by framework when the focus is changed
+// ----------------------------------------------------------------------------
+//    
+void CUSBClassChangeUIPluginContainer::FocusChanged( TDrawNow /*aDranow*/ )
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::FocusChanged()"));
+    if( iUSBMainListBox)
+        {
+        iUSBMainListBox->SetFocus( IsFocused() );
+        }
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::FocusChanged() complete"));    
+    }
+    
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::CountComponentControls() const
+// Returns the number of controls inside this container
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginContainer::CountComponentControls() const
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::CountComponentControls()"));
+    
+    return KUSBClassChangeUIComponentCount; 
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::ComponentControl(TInt aIndex) const
+// Returns the control inside this container. Note that this function is
+// inherited from CCoeControl and thus must be const even it returns a pointer,
+// which can be used for modifying the class. 
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CUSBClassChangeUIPluginContainer::ComponentControl( 
+    TInt aIndex ) const
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::ComponentControl()"));
+    
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            return iUSBMainListBox;
+            }
+        default:
+            {
+            return NULL;
+            }            
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::OfferKeyEventL
+// Redirects keypresses to the listbox
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CUSBClassChangeUIPluginContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,TEventCode aType )
+    {
+    TInt maxItemcount = iModelRef->PersonalityCount();
+    TInt maxIndex = maxItemcount-1;
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::OfferKeyEventL()"));
+    TBool isfocus =  iViewRef->MenuBar()->ItemSpecificCommandsEnabled();   
+    if ( isfocus && aType == EEventKey && 
+            (aKeyEvent.iCode == EKeyDownArrow || aKeyEvent.iCode == EKeyUpArrow) )
+            {
+            iCurrentItemIndex = iUSBMainListBox->CurrentItemIndex();
+            if( aKeyEvent.iCode == EKeyDownArrow )
+                {
+                if( iCurrentItemIndex >= maxIndex )
+                    {
+                    iCurrentItemIndex = 0;
+                    }
+                else
+                    {
+                    iCurrentItemIndex++;
+                    }
+                }
+            else // ( aKeyEvent.iCode == EKeyUpArrow )    
+                {
+                if( iCurrentItemIndex <= 0 )
+                    {
+                    iCurrentItemIndex = maxIndex;
+                    }
+                else
+                    {
+                    iCurrentItemIndex--;
+                    }
+                }
+            ShowPopUpsL( iCurrentItemIndex );
+            iCurrentItemIndex = iUSBMainListBox->CurrentItemIndex();
+            }
+
+   
+          TKeyResponse res = iUSBMainListBox->OfferKeyEventL( aKeyEvent, aType );
+           FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::OfferKeyEventL complete"));
+
+          return res;
+    }
+
+//------------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::showpopupsFinal(TInt &aValue)
+// Display the popups
+//------------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::ShowPopUpsL(TInt aIndex)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::ShowPopUpsL "));
+    if ( aIndex >= 0 && aIndex < iPopUpItems->Count() )
+        {
+        iPopupController->SetTimePopupInView( KMaxVisibleTime);
+        TPtrC chosen = iPopUpItems->MdcaPoint(aIndex);
+        iPopupController->SetTextL( chosen );
+        iPopupController->SetPositionByHighlight( TRect( 
+                   iUSBMainListBox->View()->ItemPos( aIndex + 1 ), 
+                   iUSBMainListBox->View()->ItemSize() ) );
+        iPopupController->SetTimeDelayBeforeShow( KMsToWaitBeforePopup );
+        iPopupController->ShowInfoPopupNote();
+        }
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::ShowPopUpsL complete"));
+  
+}
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::HandleListBoxEventL(
+//     CEikListBox* aListBox,TListBoxEvent aEventType)
+// Handle events from the ListBox
+// ----------------------------------------------------------------------------
+//    
+void CUSBClassChangeUIPluginContainer::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,TListBoxEvent aEventType )
+   {
+   FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::HandleListBoxEventL()"));
+   
+    __ASSERT_DEBUG( iViewRef!=0, PANIC( EUSBUIPanicIllegalValue ) );
+    
+    //Selection key pressed, when MSK is not enabled. Or touch stylus 
+    //double clicked.
+    //
+    if( AknLayoutUtils::PenEnabled() )
+           {
+           switch ( aEventType )
+               {
+               case EEventItemSingleClicked:
+                   {
+                   FLOG(_L("[CUSBClassChangeUIPlugin]\t HandleListBoxEventL()EEventItemSingleClicked"));
+                   iViewRef->HandleCommandL( EUSBUICmdSelect );
+                   break;
+                   }
+               case EEventPenDownOnItem:
+            	   {
+            	   ShowPopUpsL (CurrentItemIndex());
+            	   break;
+            	   }
+               case EEventPanningStarted:
+               case EEventPanningStopped:
+               case EEventFlickStarted:
+               case EEventFlickStopped:
+               case EEventItemDraggingActioned:
+            	   break;
+              default:
+                     break;
+                     }
+                }
+    if( (aEventType == EEventEnterKeyPressed) || 
+        (aEventType == EEventItemDoubleClicked) ) //for touch support
+            {
+            iViewRef->HandleCommandL( EUSBUICmdSelect );
+            }
+        
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::HandleListBoxEventL complete"));
+	}
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::MdcaCount()
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginContainer::MdcaCount() const
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::MdcaCount()"));
+    TInt numberOfMainViewItems =iModelRef->PersonalityCount();
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::MdcaCount()= %d"), numberOfMainViewItems));
+    return numberOfMainViewItems;
+    }
+    
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::MdcaPoint()
+// Main view listbox item formatter:
+// Returns the current format string depending value
+// of the item concerned.
+// ----------------------------------------------------------------------------
+//
+TPtrC CUSBClassChangeUIPluginContainer::MdcaPoint( TInt aIndex ) const
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::MdcaPoint()"));
+    
+    TPtrC chosen;
+    const RArray<TInt> usbIds = iModelRef->GetUsbIds();
+    TInt currentIndex = usbIds.Find(iViewRef->USBMode());
+    if (aIndex == currentIndex)
+        {
+        if(iViewRef->IsUSBDeviceConnected())
+            {
+            FLOG(_L("[CUSBClassChangeUIPlugin]\t MdcaPoint()The selected mode and usbconnected"));
+            chosen.Set(iUSBAllItemsArrayActive->MdcaPoint(aIndex));
+            }
+        else
+            {
+            FLOG(_L("[CUSBClassChangeUIPlugin]\t MdcaPoint()The selected mode and usb not connected"));
+            chosen.Set(iUSBAllItemsArrayDefault->MdcaPoint(aIndex));
+            }
+        }
+    else
+        {
+        FLOG(_L("[CUSBClassChangeUIPlugin]\t MdcaPoint()not selected mode"));
+        chosen.Set(iUSBAllItemsArray->MdcaPoint(aIndex));
+        }
+     
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::MdcaPoint complete"));
+    
+    return chosen;
+    }
+    
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::SettingChanged
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::SettingChanged()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::SettingChangedL()"));
+    
+	iUSBMainListBox->DrawDeferred();
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::SettingChangedL complete"));
+    }
+    
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::GetHelpContext
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::GetHelpContext(TCoeHelpContext& aContext) const
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::GetHelpContext()"));
+    
+    aContext.iMajor = KUidUSBClassChangeUI;
+    aContext.iContext = KUSB_HLP_MAIN;
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::GetHelpContext complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::HandleResourceChange
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType ); 
+    if( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iViewRef->ClientRect() );
+        DrawNow(); 
+        }
+    else 
+        {
+        if ( aType == KAknsMessageSkinChange )
+            {
+            iUSBMainListBox->HandleResourceChange( aType ); 
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginContainer::CurrentItemIndex
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginContainer::CurrentItemIndex()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginContainer::CurrentItemIndex()"));
+
+    return iUSBMainListBox->CurrentItemIndex();
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginImplementationTable.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005, 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:  ECOM proxy table for this plugin
+*
+*/
+
+
+// System includes
+#include <e32std.h>
+#include <implementationproxy.h>
+
+// User includes
+#include "USBClassChangeUIPluginView.h"
+
+const TImplementationProxy KUSBClassChangeUIPluginImplementationTable[] = 
+    {
+    // Uid for plugin implementation for General Settings application:
+    IMPLEMENTATION_PROXY_ENTRY( 0x1020E473,	CUSBClassChangeUIPluginView::NewPluginL ),
+    // Uid for plugin implementation for USBClassChangeUIAppUi:
+    IMPLEMENTATION_PROXY_ENTRY( 0x1027478F,	CUSBClassChangeUIPluginView::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof(KUSBClassChangeUIPluginImplementationTable) 
+        / sizeof(TImplementationProxy);
+    return KUSBClassChangeUIPluginImplementationTable;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginModel.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,615 @@
+/*
+* 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:  This is the interface to all the settings.
+*
+*/
+
+// INCLUDE FILES
+
+#include <centralrepository.h> 
+#include <usb.h>
+#include <usbwatcher.h>
+#include <UsbWatcherInternalCRKeys.h>
+#include <USBClassChangeUIPlugin.rsg> // Resources
+#include <coemain.h>
+#include <usbpersonalityids.h>
+#include <avkon.mbg>
+#include <usbui.mbg>
+#include <aknappui.h>
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <featmgr.h>
+
+#include "USBClassChangeUIPluginModel.h"
+#include "USBClassChangeUIPluginDebug.h"
+#include "USBClassChangeUIPlugin.h"
+#include "USBClassChangeUIPluginView.h"
+
+_LIT( KFirstTab, "%d\t" );
+_LIT( KSecondTab, "\t" );
+_LIT(KUSBUIEmptyString, "0\t \t "); 
+
+#if defined(__WINS__) && !defined(__USB_EMULATION__)
+    // There are two situations under emulator:
+    // 1. Do not use UsbManager and UsbWatcher, which is the normal case, and
+    // 2. Use UsbManagerDummy and UsbWatcherDummy, for UI testing.
+    // Comment the define line for case 2. 
+   #define NO_USBWATCHER_USBMANAGER  
+#endif //__WINS__
+
+// ================= MEMBER FUNCTIONS ==========================================
+//
+
+CUSBClassChangeUIPluginModel::CUSBClassChangeUIPluginModel()
+: CActive( EPriorityNormal ), iUsbWatcherConnected(EFalse)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginModel::~CUSBClassChangeUIPluginModel()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::Destructor"));
+    
+    Cancel();
+    delete iCRPersonalityWatcher;
+    delete iDeviceStateWatcher;
+    delete iOtgHostStateWatcher;
+    delete iRepository; 
+    iUsbModeIndexes.Close(); 
+#ifndef NO_USBWATCHER_USBMANAGER //UsbWatcher/UsbManager API N/A
+    iUsbman.Close();
+    iUsbWatcher.Close();  
+    iDeviceIDs.Close();
+#endif //NO_USBWATCHER_USBMANAGER
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::Destructor complete"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::ConstructL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::ConstructL()"));
+
+    iCRPersonalityWatcher = CUSBClassChangeUIPluginCRWatcher::NewL( *this, 
+        KUsbWatcherPersonality);
+
+    iUsbModeIndexes = RArray<TInt>(KUSBClassChangeUISupportedModesGranularity);
+    iRepository = CRepository::NewL( KCRUidUsbWatcher );
+
+#ifndef NO_USBWATCHER_USBMANAGER //UsbWatcher/UsbManager API N/A
+    User::LeaveIfError(iUsbman.Connect());
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::ConstructL() iUsbman OK"));
+    
+    iDeviceStateWatcher = CUSBDeviceStateWatcher::NewL(*this, iUsbman);
+    iOtgHostStateWatcher = CUSBOtgHostStateWatcher::NewL(*this, iUsbman);
+    iDeviceIDs.ReserveL(1);
+    
+#endif //NO_USBWATCHER_USBMANAGER
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::ConstructL() complete"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CUSBClassChangeUIPluginModel* CUSBClassChangeUIPluginModel::NewL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\tCUSBClassChangeUIPluginModel:NewL"));
+    CUSBClassChangeUIPluginModel* self 
+        = new (ELeave) CUSBClassChangeUIPluginModel();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self ); 
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::SetUSBModeL
+// Sets the Central Repository key to the parameter.
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::SetUSBModeL(TInt aMode)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetUSBModeL()"));
+    
+    // Only change the value if necessary
+    TInt usbMode = USBMode();
+    if (usbMode != aMode)
+        {
+#ifndef NO_USBWATCHER_USBMANAGER //UsbWatcher/UsbManager API N/A
+        // Change the personality asynchrously, result checked in RunL()
+        if( IsActive() ) 
+            {
+            Cancel();
+            }
+        if ( (!iUsbWatcherConnected) && (iUsbWatcher.Connect() == KErrNone) )
+            {
+            iUsbWatcherConnected = ETrue;
+            FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetUSBModeL iUsbWatcher connected"));
+            }
+        if (iUsbWatcherConnected)
+            {
+            FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetUSBModeL setting personality"));
+            iUsbWatcher.SetPersonality(iStatus, aMode);
+            SetActive();
+            }
+#endif //NO_USBWATCHER_USBMANAGER
+        }
+        
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetUSBModeL complete"));
+    }
+
+void CUSBClassChangeUIPluginModel::RunL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::RunL()"));
+    
+    //Check the return value of SetPersonality()
+    //Leave if KErrDiskFull
+    if( iStatus == KErrDiskFull ) // Other errors not leave
+        {
+        User::Leave( KErrDiskFull );    
+        }
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::RunL complete"));
+    }
+    
+void CUSBClassChangeUIPluginModel::DoCancel()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::DoCancel()"));
+    
+    if (iUsbWatcherConnected)
+        {
+        iUsbWatcher.CancelSetPersonality();
+        }
+
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::DoCancel complete()"));
+    }
+    
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::USBMode
+// Returns the value in Central Repository.
+// -----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginModel::USBMode()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::USBMode()"));
+    TInt mode = 0;
+    iRepository->Get(KUsbWatcherPersonality, mode);
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::USBMode complete"));
+    return mode;
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::GetDeviceState
+// Gets the current device state
+// -----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginModel::GetDeviceState(TUsbDeviceState& aState)
+    {
+#ifdef NO_USBWATCHER_USBMANAGER //UsbWatcher/UsbManager API N/A
+        aState = EUsbDeviceStateUndefined;
+        return KErrNone;
+#else
+        return iUsbman.GetDeviceState(aState);
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::GetDescription
+// Gets description for the specified USB mode (personality ID)
+// -----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginModel::GetDescription(TInt aMode, HBufC*& aDescription)
+    {
+        return iUsbman.GetDescription(aMode, aDescription);
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::UpdateMainContainerReference
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::SetSettingsObserver(MUSBUIObserver* aObserver)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetSettingsObserver()"));
+    iObserver = aObserver;
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SetSettingsObserver complete"));
+    }
+
+// -----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::GetSupportedUSBModesL
+// Reads the supported USB Modes from USBManager
+// The lists received as parameters are updated. 
+// -----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL( 
+        CDesCArrayFlat& aListBox,CDesCArrayFlat& aListBoxDefault,
+        CDesCArrayFlat& aListBoxActive, CDesCArrayFlat& aPopUpItems,
+        CArrayPtrFlat<CGulIcon>& aIconArray)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL()"));  
+    RArray<TInt> personalityIds;
+    CleanupClosePushL( personalityIds );
+    HBufC* usbModeListBox = NULL;
+    HBufC* usbModeListBoxActive = NULL;
+   
+    // Allocate memory for descriptors to hold texts for listbox 
+    usbModeListBox = HBufC::NewLC( KUsbStringDescStringMaxSize );
+    TPtr usbModeListBoxPtr = usbModeListBox->Des();
+       
+    usbModeListBoxActive = HBufC::NewLC( KUsbStringDescStringMaxSize );
+    TPtr usbModeListBoxActivePtr = usbModeListBoxActive->Des();
+
+    HBufC* usbDefaultText = NULL;
+    usbDefaultText = CCoeEnv::Static()->AllocReadResourceLC( R_USB_MODE_DEFAULT );
+   
+    HBufC* usbActiveText = NULL;
+    usbActiveText = CCoeEnv::Static()->AllocReadResourceLC( R_USB_MODE_ACTIVE );
+   
+    //Check phone as modem is supported or not
+    FeatureManager::InitializeLibL();
+    TBool phoneAsModemSupported = FeatureManager::FeatureSupported(
+        KFeatureIdUsbModem );
+    FeatureManager::UnInitializeLib();
+ 
+    // Get personality ids
+     iPersonalityCount = 0;
+#ifndef NO_USBWATCHER_USBMANAGER //UsbWatcher/UsbManager API N/A
+    if (iUsbman.GetPersonalityIds(personalityIds) == KErrNone)
+        {
+        FLOG(_L("CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL(): Personality Ids got"));              
+        for (TInt i = 0; i < personalityIds.Count(); i++)
+            {  
+            FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t i= %d "), i));
+            
+            if (personalityIds[i] == KUsbPersonalityIdModemInst)
+                {
+                if (!phoneAsModemSupported)
+                    {
+                    FLOG(_L("Phone as modem is not supported!"));    
+                    continue;
+                    }
+                }
+				
+			TUint32 property;
+			TInt ret  =  iUsbman.GetPersonalityProperty(personalityIds[i], property);
+			if (ret == KErrNone)
+				{
+				FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin] property\t i= 0x%x "), property));
+				if (property & KUsbPersonalityPropertyHidden)
+					{
+					FLOG(_L("CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL(): The Personality is hidden"));
+					continue;
+					}
+				}
+			else
+				{
+				FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin] Error to get the property\t i= %d "), ret));
+				}
+
+            HBufC* description = NULL;
+            HBufC* detailDescription = NULL;
+            
+            if (iUsbman.GetDescription(personalityIds[i], description) == KErrNone)
+                {
+                CleanupStack::PushL(description);
+                FLOG(_L("CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL(): Description read"));
+                //mode strings for setting page
+                TPtr descriptionPtr = description->Des();                                        
+                iUsbModeIndexes.Append(personalityIds[i]);
+ 
+                //modes with labels for list box
+                usbModeListBoxPtr.Zero();
+                usbModeListBoxActivePtr.Zero();
+                
+                usbModeListBoxPtr.Format(KFirstTab, iPersonalityCount);
+                usbModeListBoxPtr.Append(descriptionPtr);
+                usbModeListBoxPtr.Append(KSecondTab);
+                
+                usbModeListBoxActivePtr.Copy(usbModeListBoxPtr);
+                            
+                aListBox.AppendL(usbModeListBoxPtr);
+                                
+                usbModeListBoxPtr.Append(*usbDefaultText);
+                usbModeListBoxActivePtr.Append(*usbActiveText);
+               
+                aListBoxDefault.AppendL(usbModeListBoxPtr);
+                aListBoxActive.AppendL(usbModeListBoxActivePtr);
+                
+                CleanupStack::PopAndDestroy(description); 
+                //creating the icon list
+                AddIconL (personalityIds[i], aIconArray);
+                if (iUsbman.GetDetailedDescription(personalityIds[i], detailDescription) == KErrNone)
+                	{
+                	CleanupStack::PushL(detailDescription);
+                	aPopUpItems.AppendL(detailDescription->Des());
+                	CleanupStack::PopAndDestroy(detailDescription); 
+               		}
+                else
+                	{ 
+                	aPopUpItems.AppendL(KNullDesC);
+                	}
+                iPersonalityCount++;
+                }
+                
+            }
+        }
+#endif // NO_USBWATCHER_USBMANAGER
+ 
+    if (iPersonalityCount == 0)
+        {
+        // Add empty value
+        AddIconL (iPersonalityCount, aIconArray);
+        iUsbModeIndexes.AppendL(0);
+        aPopUpItems.AppendL(KNullDesC);
+        aListBox.AppendL(KUSBUIEmptyString);
+        aListBoxDefault.AppendL(KUSBUIEmptyString);
+        aListBoxActive.AppendL(KUSBUIEmptyString);
+        }
+    
+    CleanupStack::PopAndDestroy( usbActiveText ); 
+    CleanupStack::PopAndDestroy( usbDefaultText ); 
+    CleanupStack::PopAndDestroy( usbModeListBoxActive ); 
+    CleanupStack::PopAndDestroy( usbModeListBox ); 
+    CleanupStack::PopAndDestroy( &personalityIds ); 
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL() complete"));  
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::AddIconL()
+// creates the icon list 
+// 
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::AddIconL (TInt aMode, CArrayPtrFlat<CGulIcon>& aIconArray )
+    {
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::AddIconL()"));
+    TFileName usbUiIconFilename( KFileDrive );
+    usbUiIconFilename += KDC_APP_BITMAP_DIR;
+    usbUiIconFilename += KUSBUIconFileName;
+
+    switch (aMode)
+        {
+        case KUsbPersonalityIdPCSuite:
+        case KUsbPersonalityIdPCSuiteMTP:
+            CreateAndAppendIconL( KAknsIIDQgnPropUsbPcsuite,
+                    usbUiIconFilename,
+                    EMbmUsbuiQgn_prop_usb_pcsuite,
+                    EMbmUsbuiQgn_prop_usb_pcsuite_mask,
+                    aIconArray);
+            break;
+        case KUsbPersonalityIdMS:
+            CreateAndAppendIconL( KAknsIIDQgnPropUsbMemcLarge,
+                    usbUiIconFilename,
+                    EMbmUsbuiQgn_prop_usb_memc_large,
+                    EMbmUsbuiQgn_prop_usb_memc_large_mask,
+                    aIconArray);
+            break;
+        case KUsbPersonalityIdPTP:
+            CreateAndAppendIconL( KAknsIIDQgnPropUsbPrint,
+                    usbUiIconFilename,
+                    EMbmUsbuiQgn_prop_usb_print,
+                    EMbmUsbuiQgn_prop_usb_print_mask,
+                    aIconArray);
+            break;
+        case KUsbPersonalityIdMTP:
+            CreateAndAppendIconL( KAknsIIDQgnPropUsbMtp,
+                    usbUiIconFilename,
+                    EMbmUsbuiQgn_prop_usb_mtp,
+                    EMbmUsbuiQgn_prop_usb_mtp_mask,
+                    aIconArray);
+            break;
+        case KUsbPersonalityIdModemInst:
+            CreateAndAppendIconL( KAknsIIDQgnPropUsbModem,
+                    usbUiIconFilename,
+                    EMbmUsbuiQgn_prop_usb_modem,
+                    EMbmUsbuiQgn_prop_usb_modem_mask,
+                    aIconArray);
+            break;
+        default:
+            CreateAndAppendIconL( KAknsIIDQgnPropSetAppsUsb, 
+                    usbUiIconFilename, 
+                    EMbmUsbuiQgn_prop_set_apps_usb,
+                    EMbmUsbuiQgn_prop_set_apps_usb_mask,
+                    aIconArray);
+           break;
+       }
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::AddIconL() completed"));
+    }
+// ----------------------------------------------------
+// CUSBClassChangeUIPluginContainer::CreateAndAppendIconL
+// ----------------------------------------------------
+void CUSBClassChangeUIPluginModel::CreateAndAppendIconL( 
+    const TAknsItemID& aID,
+    const TDesC& aFileName,
+    const TInt aBitmapId,
+    const TInt aMaskId,
+    CArrayPtrFlat<CGulIcon>& aIconArray)
+    {    
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::CreateAndAppendIconL"));
+
+    CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(),
+                                    aID, aFileName, aBitmapId, aMaskId);
+    
+    CleanupStack::PushL(icon);    
+    aIconArray.AppendL(icon);
+    CleanupStack::Pop(icon);
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::CreateAndAppendIconL completed"));
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::GetPersonalityCount()
+// Informs the container, that a setting has changed. 
+// 
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginModel::PersonalityCount()
+    {
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t PersonalityCount= %d "), iPersonalityCount));
+       return iPersonalityCount;
+    }  
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::SettingChangedL()
+// Informs the container, that a setting has changed. 
+// 
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginModel::SettingChangedL( TUint32 /*aKey*/ )
+    {
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SettingChangedL()"));
+    
+    if ( iObserver )
+        {
+        iObserver->SettingChanged();  
+        }
+        
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SettingChangedL() completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// From MUSBOtgHostStateObserver
+// Handle Otg Id pin on/off notification
+// ----------------------------------------------------------------------------
+void CUSBClassChangeUIPluginModel::OtgHostIdPinStateChanged(TBool aIsIdPinOn)
+    {
+    iDeviceIDs.Reset();
+    if (iObserver)
+        {
+        iObserver->OtgHostIdPinStateChanged(aIsIdPinOn);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// From MUSBOtgHostStateObserver
+// Handle host event notification
+// ----------------------------------------------------------------------------
+void CUSBClassChangeUIPluginModel::HostEventNotify(TDeviceEventInformation aEventInfo)
+    {
+    if (iObserver)
+        {
+        FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::HostEventNotify"));        
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iDeviceId         = %d" ), aEventInfo.iDeviceId));
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iEventType        = %d" ), aEventInfo.iEventType));
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iError            = %d" ), aEventInfo.iError));
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iDriverLoadStatus = %d" ), aEventInfo.iDriverLoadStatus));
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iVid              = %d" ), aEventInfo.iVid));
+        FTRACE( FPrint(_L( "[CUSBClassChangeUIPlugin]\t iEventInfo.iPid              = %d" ), aEventInfo.iPid));
+
+        switch (aEventInfo.iEventType)
+            {
+            case EDeviceAttachment:
+                {
+                iObserver->HostEventNotify(aEventInfo);
+                break;
+                }
+            case EDeviceDetachment:
+                {
+                TInt index = iDeviceIDs.Find(aEventInfo.iDeviceId);
+                if (index >= 0)
+                    {
+                     iDeviceIDs.Remove(index);
+                    }
+                iObserver->HostEventNotify(aEventInfo);
+                break;
+                }
+            case EDriverLoad:
+                {
+                switch (aEventInfo.iDriverLoadStatus)
+                    {
+                    case EDriverLoadSuccess:
+                    case EDriverLoadPartialSuccess:
+                        {
+                        // Drivers are loaded more or less successfully
+                        TInt ret = iDeviceIDs.Append(aEventInfo.iDeviceId);
+                        if (ret != KErrNone) 
+                            {
+                            FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::HostEventNotify *** append error"));       
+                            }
+                        iObserver->HostEventNotify(aEventInfo);
+                        break;
+                        }
+                    }
+                break;
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Informs the observer that USB device state has changed.
+// ----------------------------------------------------------------------------
+void CUSBClassChangeUIPluginModel::DeviceStateChanged(
+    TUsbDeviceState aPreviousState, TUsbDeviceState aCurrentState)
+{
+    if (iObserver)
+        {
+            iObserver->DeviceStateChanged(aPreviousState, aCurrentState);
+        }
+}
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginModel::GetUsbIds()
+// Return an RArray of the personality indexes
+// 
+// ----------------------------------------------------------------------------
+//
+RArray<TInt>& CUSBClassChangeUIPluginModel::GetUsbIds()
+    {
+    return iUsbModeIndexes; 
+    }
+// ----------------------------------------------------------------------------
+// Returns if it's A-device and the driver to the attached pheripheral 
+// is loaded successfully(or partially). 
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginModel::HasPeripheralEnabled(TBool& aHasPeripheralEnabled)
+    {
+    aHasPeripheralEnabled = EFalse;
+#ifdef NO_USBWATCHER_USBMANAGER     ////UsbWatcher/UsbManager API N/A 
+    return KErrNone;
+#else
+    TBool idPinOn;
+    TInt ret = iOtgHostStateWatcher->IsIdPinOn(idPinOn);
+    if (ret != KErrNone || !idPinOn)
+        {
+        return ret;
+        }
+    
+    //aHasPeripheralEnabled = (iDeviceIDs.Count() > 0 ? ETrue : EFalse);
+    ret = iOtgHostStateWatcher->IsPeripheralConnected(aHasPeripheralEnabled); 
+    if (ret != KErrNone)
+        {
+        return ret;
+        }
+    
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::HasPeripheralEnabled - aHasPeripheralEnabled=%d"), aHasPeripheralEnabled));
+    
+    return KErrNone;
+#endif
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginView.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,566 @@
+/*
+* 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:  This the implementation of the view class
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <aknradiobuttonsettingpage.h>
+#include <akntitle.h>
+#include <bautils.h>         // BAFL utils (for language file)
+#include <StringLoader.h> 
+#include <usbui.mbg>
+#include <featmgr.h>
+#include <hlplch.h>         // Help launcher
+#include <usbpersonalityids.h>
+#include <gsparentplugin.h>
+#include <gsfwviewuids.h>
+#include <USBClassChangeUIPlugin.rsg> // Resources
+
+#include "USBClassChangeUIPluginView.h"
+#include "USBClassChangeUIPluginDebug.h"
+#include "USBClassChangeUIPlugin.h"
+#include "USBClassChangeUIPluginContainer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::NewPluginL
+// Entry point for CGSPluginInterface.
+// Used by General Settings Application
+// ---------------------------------------------------------
+//
+CUSBClassChangeUIPluginView* CUSBClassChangeUIPluginView::NewPluginL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewPluginL()"));
+    
+    CUSBClassChangeUIPluginView* self = new ( ELeave ) CUSBClassChangeUIPluginView();
+    
+    self->iLoadAsGSPlugin = ETrue;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+       
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewPluginL() completed"));
+    
+    return self;
+    }
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::NewL
+// Entry point for CGSPluginInterface.
+// Used by USBClassChangeUIPluginAppUI.
+// ---------------------------------------------------------
+//
+CUSBClassChangeUIPluginView* CUSBClassChangeUIPluginView::NewL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewL()"));
+    
+    CUSBClassChangeUIPluginView* self = new ( ELeave ) CUSBClassChangeUIPluginView();
+    
+    self->iLoadAsGSPlugin = EFalse;
+     
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::NewL() completed"));
+    
+    return self;
+    }    
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::ConstructL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::ConstructL()"));
+
+    iEikEnv = CEikonEnv::Static();
+
+    TFileName filename;
+    filename += KFileDrive;
+    filename += KDC_RESOURCE_FILES_DIR; 
+    filename += KResourceFileName;
+    BaflUtils::NearestLanguageFile(iEikEnv->FsSession(),filename);
+    iResourceFileFlag = iEikEnv->AddResourceFileL(filename);
+    
+    //"Back" or "Exit" right-softkey resource
+    BaseConstructL( iLoadAsGSPlugin ? 
+        R_USBUI_MAIN_VIEW_GS_PLUGIN : R_USBUI_MAIN_VIEW );
+    
+    iAppUIRef = AppUi();
+    
+    iModelRef = CUSBClassChangeUIPluginModel::NewL();
+    iModelRef->SetSettingsObserver(this);
+
+    FeatureManager::InitializeLibL();
+    iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp );
+    FeatureManager::UnInitializeLib(); 
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::ConstructL() completed"));
+    }
+     
+// ---------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------
+//
+CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView()"));
+
+    if ( iContainer )
+        {
+        if ( iAppUIRef )
+            {
+            iAppUIRef->RemoveFromViewStack( *this, iContainer );
+            }
+        delete iContainer;
+            }
+
+    if ( iEikEnv )
+        {
+        iEikEnv->DeleteResourceFile ( iResourceFileFlag );
+        }
+    
+    if ( iModelRef )
+        {
+        delete iModelRef;    
+        }
+   
+    if ( !iLoadAsGSPlugin )
+        {
+        SignalDestruction();
+        }
+    
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::~CUSBClassChangeUIPluginView() completed"));
+    }
+    
+// ---------------------------------------------------------
+// TUid CUSBClassChangeUIPluginView::Id
+// ---------------------------------------------------------
+//
+TUid CUSBClassChangeUIPluginView::Id() const
+    {
+    if ( iLoadAsGSPlugin )
+    	{
+	    return KGsUSBUIPluginUid; //same as ecom impl UID, required by GS interface.
+    	}
+    else
+    	{
+    	return KUSBUIMainViewId;  //view id
+    	}
+    }
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::HandleCommandL
+// Redirects commands to the appui class.
+// ---------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::HandleCommandL(TInt aCommand)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCommandL()"));
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeyExit:
+        case EEikCmdExit:
+            {
+            iAppUIRef->Exit();
+            break;
+            }
+        
+        case EAknSoftkeyBack:
+            /** 
+            * UPDATE THIS if this view has a sub-view. 
+            * In this case constant UID must be used instead of the
+            * previous view - otherwise the "back" might return to the 
+            * sub-view. See GSFWViewUIDs.h for constant UIDs.
+            */
+            iAppUIRef->ActivateLocalViewL( iPrevViewId.iViewUid );
+            break; 
+            
+        case EUSBUICmdHelp:
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL( 
+                iEikonEnv->WsSession(), iAppUIRef->AppHelpContextL() );
+            break;
+            }
+      
+        case EUSBUICmdSelect:
+        case EUSBUICmdMskSelect:
+            {
+             TInt CurrentIndex = iContainer->CurrentItemIndex() ;
+             HandleCmdChangeUSBModeL(CurrentIndex);
+             break;
+            }
+
+        default:
+            {
+            FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginAppUi::HandleCommandL default switch"));    
+            break;
+            }
+        }
+    }
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::DoActivateL
+// ---------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::DoActivateL( const TVwsViewId& aPrevViewId,
+                                 TUid /*aCustomMessageId*/,
+                                 const TDesC8& /*aCustomMessage*/)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoActivateL()"));
+
+    iPrevViewId = aPrevViewId;
+    if( !iContainer )
+        {
+        iContainer = CUSBClassChangeUIPluginContainer::NewL(this, iModelRef);
+        iContainer->SetMopParent( this ); // MObjectProvider
+    
+        // Setup the title
+        //
+        HBufC* usbTitleMain = iCoeEnv->AllocReadResourceLC( R_USB_TITLE );
+        CEikStatusPane* statusPane = StatusPane();
+        CAknTitlePane* titlePane;
+        titlePane = ( CAknTitlePane* ) statusPane->ControlL(TUid::Uid( EEikStatusPaneUidTitle ));
+        titlePane->SetTextL( *usbTitleMain );
+        CleanupStack::PopAndDestroy(usbTitleMain);
+        iAppUIRef->AddToStackL( *this, iContainer );
+        }
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoActivateL() completed"));
+    }
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::DoDeactivate
+// ---------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::DoDeactivate()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoDeactivate()"));
+
+    if ( iContainer )
+        {
+        iAppUIRef->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DoDeactivate() completed"));
+    }
+ 
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::GetCaptionL
+// Method for getting caption of this plugin.
+// ---------------------------------------------------------
+//   
+void CUSBClassChangeUIPluginView::GetCaptionL (TDes& aCaption) const
+    {   
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetCaptionL()")); 
+    // The resource file is already opened, see ConstructL()
+    //
+    HBufC* result = StringLoader::LoadL( R_GS_USBUI_VIEW_CAPTION );
+    aCaption.Copy( *result );
+    delete result;  
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetCaptionL() completed"));
+    }
+    
+// ---------------------------------------------------------
+// CUSBClassChangeUIPluginView::GetValue
+// Function for getting plugin's value for a certain key.
+// ---------------------------------------------------------
+//   
+void CUSBClassChangeUIPluginView::GetValue(const TGSPluginValueKeys aKey,
+                                           TDes& aValue)
+    {
+    switch( aKey )
+        {
+        case EGSPluginKeySettingsItemValueString:
+            {
+            // Get Id pin state of UsbOtg-capable device
+            TBool hasPeripheralEnabled = EFalse;
+            // Ignore error code
+            TInt ret = iModelRef->HasPeripheralEnabled(hasPeripheralEnabled);
+            FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::GetValue - HasPeripheralEnabled=%d"), ret));
+
+            TInt resId = 0;
+            if (hasPeripheralEnabled)
+                {
+                resId = R_CP_DETAIL_USB_OTG_CONN;
+                }
+            else if (IsUSBDeviceConnected())
+                {
+                TInt mode = USBMode();
+                switch (mode)
+                    {
+                    case KUsbPersonalityIdPCSuite:
+                    case KUsbPersonalityIdPCSuiteMTP:
+                        resId = R_CP_DETAIL_USB_CONN_PC_SUITE;
+                        break;
+                    case KUsbPersonalityIdMS:
+                        resId = R_CP_DETAIL_USB_CONN_MASS_STORAGE;
+                        break;
+                    case KUsbPersonalityIdPTP:
+                        resId = R_CP_DETAIL_USB_CONN_PICTURE_TRANSFER;
+                        break;
+                    case KUsbPersonalityIdMTP:
+                        resId = R_CP_DETAIL_USB_CONN_MEDIA_TRANSFER;
+                        break;
+                    case KUsbPersonalityIdModemInst:
+                        resId = R_CP_DETAIL_USB_CONN_MODEM_INST;
+                        break;
+					
+					case KUsbPersonalityIdRNDIS:
+                        resId = R_CP_DETAIL_USB_CONN_RNDIS;
+                        break;
+                    default:
+                        // Leave value empty
+                        break;
+                    }
+                }
+            else
+                {
+                resId = R_CP_DETAIL_USB_NOT_CONNECTED;
+                }
+
+            if (resId)
+                {
+                    TRAP_IGNORE(
+                        HBufC* text = StringLoader::LoadL(resId);
+                        aValue.Append(*text);
+                        delete text;
+                    );
+                }
+            }
+            break;
+
+        default:
+            CGSPluginInterface::GetValue(aKey, aValue);
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::SettingChanged()
+// A setting has been changed. 
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::SettingChanged()
+    {
+        if (iContainer)
+            {
+                iContainer->SettingChanged();
+            }
+
+        // Personality changes only affect USB UI when USB device is connected
+        if (IsUSBDeviceConnected())
+            {
+                UpdateParentView();
+            }
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::DeviceStateChanged()
+// USB device state has changed.
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::DeviceStateChanged(TUsbDeviceState /*aPrevState*/,
+                                                     TUsbDeviceState aState)
+    {
+		//Transitions to EUsbDeviceStateUndefined, EUsbDeviceStateConfigured 
+		//and EUsbDeviceStateAttached states update UI view.
+        if (aState == EUsbDeviceStateConfigured ||
+            aState == EUsbDeviceStateUndefined ||
+			aState == EUsbDeviceStateAttached)
+            {
+                UpdateParentView();
+                if (iContainer)
+                           {
+                               iContainer->SettingChanged();
+                           }
+            }
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::OtgHostIdPinStateChanged
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::OtgHostIdPinStateChanged(TBool aIsIdPinOn)
+    {
+    if (!aIsIdPinOn)
+        {
+        UpdateParentView();
+        }
+    // else, Ignore Id pin on event, host event to be checked further
+    }
+
+// ----------------------------------------------------------------------------
+// From MUSBOtgHostStateObserver
+// Handle host event notification
+// ----------------------------------------------------------------------------
+void CUSBClassChangeUIPluginView::HostEventNotify(TDeviceEventInformation /*aEventInfo*/)
+    {
+    UpdateParentView();
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::USBMode()
+// Gets the current USB mode from model
+// ----------------------------------------------------------------------------
+//
+TInt CUSBClassChangeUIPluginView::USBMode() const
+    {
+    return iModelRef->USBMode();
+    }
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::SetUSBModeL(TInt)
+// Sets the current USB mode through model
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::SetUSBModeL( TInt aMode )
+    {
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::SetUSBModeL()"));
+    
+    iModelRef->SetUSBModeL( aMode );
+    
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::SetUSBModeL complete"));
+    }   
+ 
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::CreateIconL()
+// Creates icon for General Settings application
+// ----------------------------------------------------------------------------
+//  
+CGulIcon* CUSBClassChangeUIPluginView::CreateIconL( const TUid aIconType )
+{
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL() - aIconType=0x%x"), aIconType.iUid));
+
+    CGulIcon* icon = NULL;
+        
+    if( aIconType == KGSIconTypeLbxItem )
+        {
+        TFileName usbUiIconFilename( KFileDrive );
+        usbUiIconFilename += KDC_APP_BITMAP_DIR;
+        usbUiIconFilename += KUSBUIconFileName;
+      
+
+        // Get peripheral connected state of UsbOtg-capable device
+        TBool hasPeripheralEnabled = EFalse;
+        TInt ret = iModelRef->HasPeripheralEnabled(hasPeripheralEnabled);
+        // In case of failure of getting the status, hasPeripheralEnabled is EFalse.
+        // So ignore the error code here.
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL - HasPeripheralEnabled=%d"), ret));
+
+        if (hasPeripheralEnabled || IsUSBDeviceConnected())
+            {
+            icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), 
+                KAknsIIDQgnPropSetAppsUsb, usbUiIconFilename, 
+                EMbmUsbuiQgn_prop_set_apps_usb, 
+                EMbmUsbuiQgn_prop_set_apps_usb_mask );
+            }
+        else
+            {
+            icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), 
+                KAknsIIDQgnPropSetAppsUsbOff, usbUiIconFilename, 
+                EMbmUsbuiQgn_prop_set_apps_usb_off, 
+                EMbmUsbuiQgn_prop_set_apps_usb_off_mask );
+            }
+        }
+    else 
+        {
+        icon = CGSPluginInterface::CreateIconL( aIconType );
+        }
+        
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::CreateIconL() completed"));
+    return icon;
+}
+
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL()
+// sets the selected usb mode 
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL(TInt aMode)
+    {
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL()"));
+    const RArray<TInt> usbIndexes = iModelRef->GetUsbIds(); 
+    SetUSBModeL( usbIndexes[aMode] );
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::HandleCmdChangeUSBModeL() completed"));
+    }
+
+
+// ----------------------------------------------------------------------------
+// Remove Help from options menu, if the feature is not supported. 
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::DynInitMenuPaneL( TInt /*aResId*/, CEikMenuPane* aMenu )
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DynInitMenuPaneL()"));
+	//dim help if it is not supported and it exists
+	if (!iHelpSupported)
+	    {
+    	TInt tmp;
+        if (  aMenu->MenuItemExists(EUSBUICmdHelp, tmp) )
+            {			
+            aMenu->SetItemDimmed(EUSBUICmdHelp, ETrue);
+            }
+        }
+    FLOG( _L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginView::DynInitMenuPaneL() completed"));
+    }
+    
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::IsUSBDeviceConnected()
+// Checks whether USB device is connected.
+// ----------------------------------------------------------------------------
+//
+TBool CUSBClassChangeUIPluginView::IsUSBDeviceConnected()
+    {
+        TUsbDeviceState state = EUsbDeviceStateUndefined;
+        return (iModelRef->GetDeviceState(state) == KErrNone && 
+                state != EUsbDeviceStateUndefined);
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIPluginView::UpdateParentView()
+// Updates parent view if we are loaded by GS plugin.
+// Copied from irappgspluginview.cpp
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIPluginView::UpdateParentView()
+    {
+        if (iLoadAsGSPlugin)
+            {
+                // Note: GetActiveViewId returns KErrNotFound if GS application
+                // is running in the background.
+		        TVwsViewId vid;
+		        AppUi()->GetTopViewId(vid);
+		        if (vid.iViewUid == KGSConPluginUid)
+			        {
+			            CGSParentPlugin* parent;
+			            parent = (CGSParentPlugin*)AppUi()->View(vid.iViewUid);
+			            parent->UpdateView();
+			        }
+            }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/USBDeviceStateWatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Device state watcher class.
+ *
+*/
+
+
+// INCLUDE FILES
+#include "USBDeviceStateWatcher.h"
+
+// CONSTANTS
+const TUint KUsbAllStates = 0xFFFFFFFF;
+
+// --------------------------------------------------------------------------
+// Two-phased constructor. Uses existing usb manager session.
+// --------------------------------------------------------------------------
+CUSBDeviceStateWatcher*
+CUSBDeviceStateWatcher::NewL(MUSBDeviceStateObserver& aObserver, RUsb& aUsbMan)
+    {
+    CUSBDeviceStateWatcher* self = new(ELeave)CUSBDeviceStateWatcher(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL(aUsbMan);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Two-phased constructor. Creates its own usb manager session.
+// --------------------------------------------------------------------------
+CUSBDeviceStateWatcher*
+CUSBDeviceStateWatcher::NewL(MUSBDeviceStateObserver& aObserver)
+    {
+    CUSBDeviceStateWatcher* self = new(ELeave)CUSBDeviceStateWatcher(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// C++ constructor
+// --------------------------------------------------------------------------
+CUSBDeviceStateWatcher::CUSBDeviceStateWatcher(MUSBDeviceStateObserver& aObserver) 
+    : CActive(EPriorityStandard), iObserver(aObserver)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// --------------------------------------------------------------------------
+// C++ destructor
+// --------------------------------------------------------------------------
+CUSBDeviceStateWatcher::~CUSBDeviceStateWatcher()
+    {
+    Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// Symbian 2nd phase constructor. Uses existing usb manager session. 
+// --------------------------------------------------------------------------
+void CUSBDeviceStateWatcher::ConstructL(RUsb& aUsbMan)
+    {
+    iUsbMan.SetHandleNC(aUsbMan.Handle()); // NC == NoClose
+    CommonConstructL();
+    }
+
+// --------------------------------------------------------------------------
+// Symbian 2nd phase constructor. Creates its own usb manager session. 
+// --------------------------------------------------------------------------
+void CUSBDeviceStateWatcher::ConstructL()
+    {
+    User::LeaveIfError(iUsbMan.Connect());
+    CommonConstructL();
+    }
+
+// --------------------------------------------------------------------------
+// Code shared by all ConstructL methods.
+// Usb manager session has already been set up.
+// --------------------------------------------------------------------------
+void CUSBDeviceStateWatcher::CommonConstructL()
+    {
+    User::LeaveIfError(iUsbMan.GetDeviceState(iCurrentState));
+    iPreviousState = iCurrentState;
+    iUsbMan.DeviceStateNotification(KUsbAllStates, iCurrentState, iStatus);
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// The device state has changed.
+// --------------------------------------------------------------------------
+void CUSBDeviceStateWatcher::RunL()
+    {
+    if (iStatus == KErrNone)
+        {
+            if (iCurrentState != iPreviousState)
+                {
+                    iObserver.DeviceStateChanged(iPreviousState, iCurrentState);
+                    iPreviousState = iCurrentState;
+                }
+            iUsbMan.DeviceStateNotification(KUsbAllStates, iCurrentState, iStatus);
+            SetActive();
+        }
+    }
+ 
+// ----------------------------------------------------------------------------
+// Standard active object error function.
+// ----------------------------------------------------------------------------
+TInt CUSBDeviceStateWatcher::RunError(TInt /*aError*/)
+    {
+    // Currently no leaving functions called in RunL, thus nothing should cause
+    // this to be called -> return.
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// Standard active object cancellation function.
+// ----------------------------------------------------------------------------
+void CUSBDeviceStateWatcher::DoCancel()
+    {
+    iUsbMan.DeviceStateNotificationCancel();    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/USBClassChangeUIPlugin/src/usbotghoststatewatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,334 @@
+/*
+* 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Device state watcher class.
+ *
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32property.h>
+#include <UsbWatcherInternalPSKeys.h>
+
+#include "usbotghoststatewatcher.h"
+#include "USBClassChangeUIPluginDebug.h"
+
+// --------------------------------------------------------------------------
+// Two-phased constructor. Uses existing usb manager session.
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher* 
+CUSBOtgHostStateWatcher::NewL(MUSBOtgHostStateObserver& aObserver, RUsb& aUsbMan)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgHostStateWatcher:NewL"));
+    
+    CUSBOtgHostStateWatcher* self = new(ELeave)CUSBOtgHostStateWatcher(aObserver, aUsbMan);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// C++ destructor
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::~CUSBOtgHostStateWatcher()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgHostStateWatcher:~CUSBOtgHostStateWatcher"));
+
+    delete iOtgIdPinWatcher;
+    delete iHostEventWatcher;
+    iPeripheral.Close();
+    }
+
+// --------------------------------------------------------------------------
+// Get Id pin state
+// --------------------------------------------------------------------------
+TInt CUSBOtgHostStateWatcher::IsIdPinOn(TBool& aIsIdPinOn)
+    {
+    return iOtgIdPinWatcher->IsIdPinOn(aIsIdPinOn);
+    }
+
+// --------------------------------------------------------------------------
+// Check wheather a pheripheral device is connected or not. 
+// --------------------------------------------------------------------------
+TInt CUSBOtgHostStateWatcher::IsPeripheralConnected(TBool &aIsConnected)
+    {
+    aIsConnected = EFalse;
+
+    TInt val(0);
+    TInt err = iPeripheral.Get(val);
+
+    if (KErrNone != err)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgHostStateWatcher::IsPeripheralConnected - err=%d"), err));
+        return err;
+        }
+    
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgHostStateWatcher::IsPeripheralConnected - val=%d"), val));
+    aIsConnected = (TBool)val;
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// C++ constructor
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBOtgHostStateWatcher(
+        MUSBOtgHostStateObserver& aObserver, RUsb& aUsbMan) 
+    : iUsbMan(aUsbMan), iObserver(aObserver)
+    {
+    }
+
+// --------------------------------------------------------------------------
+// Symbian 2nd phase constructor. 
+// --------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::ConstructL()
+    {
+    iOtgIdPinWatcher = CUSBOtgIdPinStateWatcher::NewL(*this);
+    iHostEventWatcher = CUSBHostEventNotifWatcher::NewL(*this);
+    TInt ret = iPeripheral.Attach(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected);
+    if (ret != KErrNone)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgHostStateWatcher::ConstructL - iPeripheral.Attach err=%d"), ret));
+        User::Leave(ret);
+        }    
+    }
+
+
+// --------------------------------------------------------------------------
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher* 
+CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::NewL(CUSBOtgHostStateWatcher& aOtgHostStateWatcher)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::NewL"));
+
+    CUSBOtgIdPinStateWatcher* self = new(ELeave)CUSBOtgIdPinStateWatcher(aOtgHostStateWatcher);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// C++ destructor
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::~CUSBOtgIdPinStateWatcher()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::~CUSBOtgIdPinStateWatcher"));
+
+    Cancel();    
+    iIdPin.Close();
+    }
+
+// --------------------------------------------------------------------------
+// Get Id pin state
+// --------------------------------------------------------------------------
+TInt CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::IsIdPinOn(TBool& aIsIdPinOn)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::IsIdPinOn" ));
+
+    TInt val(0);
+    TInt err = iIdPin.Get(val);
+
+    if (KErrNone != err)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::IsIdPinOn - err=%d"), err));
+        return err;
+        }
+
+    FTRACE(FPrint(_L( "[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::IsIdPinOn=%d" ), val ));
+
+    // not found in docs clear definition of this property. Verification is needed   
+    aIsIdPinOn = (0 == val ? EFalse : ETrue);
+    
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// The Id pin state has changed.
+// --------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::RunL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL"));
+
+    if (iStatus.Int() != KErrNone)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL - iStatus=%d"), iStatus.Int()));
+        User::Leave(iStatus.Int());
+        }    
+
+    // re-issue request first
+    iIdPin.Subscribe(iStatus);
+    SetActive();
+
+    TBool isIdPinOn;
+    TInt ret = IsIdPinOn(isIdPinOn);
+    if (ret != KErrNone)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL - IsIdPinOn=%d"), ret));
+        User::Leave(ret);
+        }    
+
+    if (isIdPinOn)
+        {
+        FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL IdPin ON"));
+
+        iOtgHostStateWatcher.iObserver.OtgHostIdPinStateChanged(ETrue);
+        }
+    else
+        {
+        FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL IdPin OFF"));
+
+        iOtgHostStateWatcher.iObserver.OtgHostIdPinStateChanged(EFalse);
+        }
+    }
+ 
+// ----------------------------------------------------------------------------
+// Standard active object error function.
+// ----------------------------------------------------------------------------
+TInt CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::RunError(TInt aError)
+    {
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::RunL"), aError));
+
+    // Currently no leaving functions called in RunL, thus nothing should cause
+    // this to be called -> return.
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// Standard active object cancellation function.
+// ----------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::DoCancel()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::DoCancel"));
+    
+    iIdPin.Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// ----------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::CUSBOtgIdPinStateWatcher(
+        CUSBOtgHostStateWatcher& aOtgHostStateWatcher)
+    : CActive(EPriorityStandard), iOtgHostStateWatcher(aOtgHostStateWatcher)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// --------------------------------------------------------------------------
+// Symbian 2nd phase constructor. 
+// --------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBOtgIdPinStateWatcher::ConstructL()
+    {
+    TInt ret = iIdPin.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty);
+    if (ret != KErrNone)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBOtgIdPinStateWatcher::ConstructL - iIdPin.Attach error:%d"), ret));
+        User::Leave(ret);
+        }
+    
+    // Issue request first
+    iIdPin.Subscribe(iStatus);
+    SetActive();
+    }
+
+// --------------------------------------------------------------------------
+// Two-phased constructor.
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher* 
+CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::NewL(CUSBOtgHostStateWatcher& aOtgHostStateWatcher)
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::NewL"));
+
+    CUSBHostEventNotifWatcher* self = new(ELeave)CUSBHostEventNotifWatcher(aOtgHostStateWatcher);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// C++ destructor
+// --------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::~CUSBHostEventNotifWatcher()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::~CUSBHostEventNotifWatcher"));
+
+    Cancel();    
+    }
+
+// --------------------------------------------------------------------------
+// The Id pin state has changed.
+// --------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::RunL()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::RunL"));
+
+    if (iStatus.Int() != KErrNone)
+        {
+        FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::RunL - iStatus=%d"), iStatus.Int()));
+        User::Leave(iStatus.Int());
+        }    
+
+    // Save current event
+    TDeviceEventInformation dei = iEventInfo;
+
+    // Re-issue request first
+    iOtgHostStateWatcher.iUsbMan.HostEventNotification(iStatus, iEventInfo);
+    SetActive();
+   
+    iOtgHostStateWatcher.iObserver.HostEventNotify(dei);    
+    }
+ 
+// ----------------------------------------------------------------------------
+// Standard active object error function.
+// ----------------------------------------------------------------------------
+TInt CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::RunError(TInt aError)
+    {
+    FTRACE(FPrint(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::RunL"), aError));
+
+    // Currently no leaving functions called in RunL, thus nothing should cause
+    // this to be called -> return.
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// Standard active object cancellation function.
+// ----------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::DoCancel()
+    {
+    FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBHostEventNotifWatcher::DoCancel"));
+    
+    iOtgHostStateWatcher.iUsbMan.HostEventNotificationCancel();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// ----------------------------------------------------------------------------
+CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::CUSBHostEventNotifWatcher(
+        CUSBOtgHostStateWatcher& aOtgHostStateWatcher)
+    : CActive(EPriorityStandard), iOtgHostStateWatcher(aOtgHostStateWatcher)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// --------------------------------------------------------------------------
+// Symbian 2nd phase constructor. 
+// --------------------------------------------------------------------------
+void CUSBOtgHostStateWatcher::CUSBHostEventNotifWatcher::ConstructL()
+    {
+    iOtgHostStateWatcher.iUsbMan.HostEventNotification(iStatus, iEventInfo);
+    SetActive();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/aif/USBClassChangeUI_caption.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2005, 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:  Caption resource for USB UI.
+*
+*/
+
+
+#include "usbclasschangeui.loc"
+#include <apcaptionfile.rh>
+
+RESOURCE CAPTION_DATA
+    {
+    caption      = qtn_apps_usb_list;
+    shortcaption = qtn_apps_usb_grid;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/aif/USBClassChangeUIaif.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2005, 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:  Application information resource file for USB UI.
+*
+*/
+
+
+#include <aiftool.rh>
+
+RESOURCE AIF_DATA
+    {
+    app_uid=0x102068E2;
+    num_icons=2;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/data/USBClassChangeUI.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005, 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:  USB UI application resources.
+*
+*/
+
+
+#include <data_caging_paths_strings.hrh>
+
+//  RESOURCE IDENTIFIER
+NAME    USBC // 4 letter ID
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <appinfo.rh>
+
+#include <usbclasschangeui.loc>
+
+//  RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+// default file name for a document
+RESOURCE TBUF { buf = "USBCLASSCHANGEUI"; }
+
+RESOURCE EIK_APP_INFO
+    {
+    }
+
+RESOURCE LOCALISABLE_APP_INFO r_usbclasschangeui_localisable_app_info
+    {
+    short_caption = qtn_apps_usb_grid;
+    caption_and_icon = 
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_apps_usb_list;
+        #ifdef __SCALABLE_ICONS
+        number_of_icons = 1;
+        icon_file = APP_BITMAP_DIR"\\usbclasschangeui_aif.mif";
+        #else
+        number_of_icons = 2; 
+        icon_file = APP_BITMAP_DIR"\\usbclasschangeui_aif.mbm"; 
+        #endif	
+        };
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/data/USBClassChangeUI_reg.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2005, 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:  USB UI application registration information.
+*
+*/
+
+
+#include <appinfo.rh>
+#include <USBClassChangeUI.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x0102068E2
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "usbclasschangeui";
+
+    localisable_resource_file = APP_RESOURCE_DIR"\\usbclasschangeui";
+    localisable_resource_id = R_USBCLASSCHANGEUI_LOCALISABLE_APP_INFO;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/group/USBClassChangeUI.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2005, 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 project specification file for the USBClassChangeUI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET              USBClassChangeUI.exe
+EPOCSTACKSIZE       0x5000
+TARGETTYPE  	    exe
+UID                 0x0 0x102068E2 
+
+
+VENDORID	VID_DEFAULT
+CAPABILITY	CAP_APPLICATION
+
+SOURCEPATH ../src
+SOURCE  USBClassChangeUIApp.cpp 
+SOURCE  USBClassChangeUIAppui.cpp
+SOURCE  USBClassChangeUIDocument.cpp
+
+
+START RESOURCE  ../data/USBClassChangeUI.rss
+TARGETPATH 	APP_RESOURCE_DIR
+HEADER
+LANGUAGE_IDS
+END
+
+START RESOURCE ../data/USBClassChangeUI_reg.rss
+DEPENDS usbclasschangeui.rsg
+// Do not change the UID below.
+TARGETPATH /private/10003a3f/apps
+END
+
+USERINCLUDE ../inc
+//for USBClassChangeUIPluginInterface.h
+USERINCLUDE ../USBClassChangeUIPlugin/inc
+
+SYSTEMINCLUDE         ../../inc ../../../inc     //for internal and private API headers
+MW_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib 
+LIBRARY avkon.lib
+LIBRARY bafl.lib                            // Basic Application Framework 
+LIBRARY AknSkins.lib                        // Skinned icons
+LIBRARY aknicon.lib
+LIBRARY commonengine.lib                    // Series 60 common components library
+
+LIBRARY GSEcomPlugin.lib
+
+
+LIBRARY ecom.lib
+       
+DEBUGLIBRARY flogger.lib                    // File logging services
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2005, 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 file provides project information required for 
+                  USB UI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/USBClassChangeUI.loc             MW_LAYER_LOC_EXPORT_PATH(usbclasschangeui.loc)
+../rom/USBClassChangeUI.iby             CORE_MW_LAYER_IBY_EXPORT_PATH(USBClassChangeUI.iby)
+../rom/USBClassChangeUIResources.iby    LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(USBClassChangeUIResources.iby)
+// Help exports
+#include "../help/group/bld.inf"
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE usbclasschangeui_aif.mif
+OPTION SOURCES -c8,8 qgn_menu_usb
+END
+
+PRJ_MMPFILES
+/*
+#ifdef __SCALABLE_ICONS
+    gnumakefile usbui_icons_aif_scalable_dc.mk
+#else 
+    gnumakefile usbui_icons_aif_bitmaps_dc.mk
+#endif
+*/
+../group/USBClassChangeUI.mmp
+
+// Define _USBUI_BLF_INF_INCLUDED_ to prevent duplicate export
+// of USBClassChangeUI.loc
+#define _USBUI_BLF_INF_INCLUDED_
+
+#include "../USBClassChangeUIPlugin/group/bld.inf"
+
+
+PRJ_TESTMMPFILES
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/group/usbui_Icons_aif_scalable_dc.mk	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2005,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:  
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\usbclasschangeui_aif.mif
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+		/c8,8 qgn_menu_usb.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/group/usbui_icons_aif_bitmaps_dc.mk	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,52 @@
+#
+# 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: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\usbclasschangeui_aif.mbm
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) \
+		/c8,8 qgn_menu_usb_lst.bmp \
+		/c8,8 qgn_menu_usb_cxt.bmp
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
+  
\ No newline at end of file
Binary file usbuis/usbui/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/help/group/bld.inf	Wed Sep 01 12:20:49 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:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/usb.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/usb.hlp.hrh)
+../rom/usbuihelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(usbuihelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/help/inc/usb.hlp.hrh	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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:
+*
+*/
+	
+//
+// usb.hlp.hrh generated by CSXHelp Utilities.
+//           
+
+#ifndef __USB_HLP_HRH__
+#define __USB_HLP_HRH__
+
+_LIT(KUSB_HLP_MAIN, "USB_HLP_MAIN"); // 
+_LIT(KUSB_HLP_PRINT_SETTINGS, "USB_HLP_PRINT_SETTINGS"); // 
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/help/rom/usbuihelps_variant.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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:
+ *
+ */
+
+#ifndef __USBUIHELPS_VARIANT_IBY__
+#define __USBUIHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE) && defined(__USB)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102068E2\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x102068E2\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102068E2\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102068E2\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102068E2\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102068E2\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102068E2\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102068E2\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/inc/USBClassChangeUI.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005, 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:  Common declarations for USBClassChange classes
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUI_H
+#define USBCLASSCHANGEUI_H
+
+#include <e32svr.h> 	// For RDebug and Panic
+
+// Application name
+//
+_LIT( KUSBUIAppName, "USBUI" );
+
+// UID of the application
+//
+const TUid KUidUSBClassChangeUI = { 0x102068E2 };
+
+// MACROS
+//
+#define PANIC( aPanic ) User::Panic( KUSBUIAppName, aPanic )
+
+// UID of the General Settings Plugin
+const TUid KGsUSBUiPluginUid = { 0x1020E473 };
+
+#endif //USBCLASSCHANGEUI_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/inc/USBClassChangeUIApp.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2005, 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:  Declares main application class.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIAPP_H
+#define USBCLASSCHANGEUIAPP_H
+
+// INCLUDES
+#include <aknapp.h>
+#include "USBClassChangeUI.h"
+
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* CUSBCLASSCHANGEUIAPP application class.
+* Provides factory to create concrete document object.
+*
+*/
+class CUSBClassChangeUIApp : public CAknApplication
+    {
+    private:
+
+        /**
+        * From CAknApplication, creates CUSBClassChangeUIDocument document
+        * object.
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+
+        /**
+        * From CAknApplication, returns application's UID (KUidUSBUI).
+        * @return The value of KUidUSBClassChangeUI.
+        */
+        TUid AppDllUid() const;
+    };
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/inc/USBClassChangeUIAppUi.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2005, 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:  Declares UI class for application.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIAPPUI_H
+#define USBCLASSCHANGEUIAPPUI_H
+
+// INCLUDES
+#include <aknappui.h>
+#include <aknViewAppUi.h>
+
+
+// FORWARD DECLARATIONS
+class CUSBClassChangeUIView;
+class CUSBClassChangeUIModel;
+
+// CLASS DECLARATION
+
+/**
+*  AppUI class.
+*
+*  @lib 
+*  @since Series 60 3.0
+*/
+class CUSBClassChangeUIAppUi : public CAknViewAppUi
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor
+        */
+        virtual ~CUSBClassChangeUIAppUi();
+        
+    public: // Functions from base classes
+
+        /**
+        * From CAknViewAppUi Handles user commands.
+        *
+        * @param aCommand A command id.        
+        * @return None.
+        */
+        void HandleCommandL(TInt aCommand);
+
+    public: // New functions
+		
+     
+        
+    private: // New functions
+    
+        /**
+        * Handles the "No USB mode active" state in startup.
+        * @since Series 60 3.0
+        * @param None.
+        * @return None.
+        */
+        void NoUSBModeActiveL();
+        
+    private: // Data
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/inc/USBClassChangeUIDebug.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2005, 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 file defines logging macros for USB Class
+*                Change UI
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIDEBUG_H
+#define USBCLASSCHANGEUIDEBUG_H
+ 
+#ifdef _DEBUG
+
+#include <e32svr.h>
+#include <e32std.h>
+
+// ===========================================================================
+#ifdef __WINS__     // File logging for WINS
+// ===========================================================================
+
+//The curly braces and the usual semicolon after the macro call cause
+//a harmless extra null statement. 
+#define FLOG(a)   { FPrint(a); }
+#define FTRACE(a) { a; }
+
+#include <f32file.h>
+#include <flogger.h>
+
+_LIT(KLogFile,"usbclasschangeuilog.txt");
+_LIT(KLogDir,"USBUI");
+
+//Declare the FPrint function with variable number of arguments.
+inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend,
+        aFmt, list);
+    }
+
+// ===========================================================================
+#else               // RDebug logging for target HW
+// ===========================================================================
+#define FLOG(a) { RDebug::Print(a);  }
+#define FTRACE(a) { a; }
+
+//Debug message printing function with variable number of arguments. 
+inline void FPrint(const TRefByValue<const TDesC16> 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);
+    }
+
+//Debug message printing function with variable number of arguments. 
+inline void FPrint(TRefByValue<const TDesC8> aFmt, ...)
+    {
+
+	VA_LIST list;
+	VA_START(list, aFmt);
+    TBuf8<256> buf8;
+	buf8.AppendFormatList(aFmt, list);
+
+    TBuf16<256> buf16(buf8.Length());
+    buf16.Copy(buf8);
+
+    TRefByValue<const TDesC> tmpFmt(_L("%S"));
+    RDebug::Print(tmpFmt, &buf16);
+    }
+
+#endif //__WINS__
+
+// ===========================================================================
+#else // // No loggings --> Reduced binary size
+// ===========================================================================
+#define FLOG(a)
+#define FTRACE(a)
+
+#endif // _DEBUG
+
+
+#endif // USBCLASSCHANGEUIDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/inc/USBClassChangeUIDocument.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2005, 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:  Declares document for application.
+*
+*/
+
+
+#ifndef USBCLASSCHANGEUIDOCUMENT_H
+#define USBCLASSCHANGEUIDOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+class CEikAppUi;
+class CUSBClassChangeUIModel;
+
+// CLASS DECLARATION
+
+/**
+*  This class is a base class mandatory for all Symbian OS UI applications.
+*
+*  @lib
+*  @since Series 60 3.0
+*/
+class CUSBClassChangeUIDocument : public CAknDocument
+    {
+    public: // Constructors and destructor
+
+		
+	    /**
+        * C++ default constructor.
+        */
+        CUSBClassChangeUIDocument( 
+            CEikApplication& aApp ): CAknDocument( aApp ){ }
+		
+		
+	    /**
+        * Destructor.
+        */
+        virtual ~CUSBClassChangeUIDocument();
+        
+    public:		// New functions
+	
+	private: // Functions from base classes
+
+	    /**
+        * From CEikDocument, to create CUSBClassChangeUiAppUi "App UI" object.
+        */
+        CEikAppUi* CreateAppUiL();
+	
+	private:
+	
+        
+	private:	// Data	
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/loc/USBClassChangeUI.loc	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2005-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 a localisation file for USB UI application.
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+
+// *** CAPTION STRINGS ***
+
+// d: USB Class Change UI application name on the application shell's app. list
+// l: list_single_large_graphic_pane_t1
+// r: 3.0
+//
+#define qtn_apps_usb_list "USB"
+
+// d: USB Class Change UI application name on the application shell's app. grid
+// l: cell_app_pane_t1
+// r: 3.0
+//
+#define qtn_apps_usb_grid "USB"
+
+// d: USB Setting folder caption 
+// l: list_single_large_graphic_pane_t1
+// r: 3.1
+#define qtn_set_folder_usb "USB"
+
+
+// *** TITLES ***
+
+// d: Status pane title for main view
+// l: title_pane_t2/opt9
+// r: 3.0
+//
+#define qtn_usb_title "USB"
+
+// *** SECONDARY STATUS INFORMATION ***
+
+// d: Secondary status information when not connected
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_not_connected "Not connected"
+
+// d: Shown when USB is connected and the phone is functioning as a USB OTG host.
+// l: list_double_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_otg_conn "Connected"
+
+// d: Secondary status information when connected in mass storage mode
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_conn_mass_storage "Mass storage mode"
+
+// d: Secondary status information when connected in Ovi suite mode
+// l: list_double_large_graphic_pane_t2
+// r: 5.2
+//
+#define qtn_cp_detail_usb_conn_ovi_suite "Ovi suite mode"
+
+// d: Secondary status information when connected in image print mode
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_conn_picture_transfer "Image print mode"
+
+// d: Secondary status information when connected in media transfer mode
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_conn_media_transfer "Media transfer mode"
+
+// d: Secondary status information when connect to internet mode
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_conn_modem_inst "Connect to internet mode"
+
+// d: Secondary status information when connected in RNDIS mode, not to be localized
+// l: list_double_large_graphic_pane_t2
+// r: 5.0
+//
+#define qtn_cp_detail_usb_conn_rndis "Connect PC with RNDIS mode"
+
+// d: Secondary status information in the USB UI setting list when the mode is a default mode
+// l: list_double_large_graphic_pane_t2_cp2
+// r: 5.2
+#define qtn_usb_settings_default "Default"
+
+// d: Secondary status information in the USB UI setting list when the mode is selected and cable is connected
+// l: list_double_large_graphic_pane_t2_cp2
+// r: 5.2
+#define qtn_usb_settings_active "Active"
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/rom/USBClassChangeUI.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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 __USBCLASSCHANGEUI_IBY__
+#define __USBCLASSCHANGEUI_IBY__
+
+#ifdef __USB_MULTIPERSONALITY 
+
+S60_APP_EXE(usbclasschangeui)
+
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,usbui)
+S60_APP_AIF_ICONS(usbclasschangeui)
+S60_APP_AIF_RSC(usbclasschangeui)
+
+//ECom Plugin
+ECOM_PLUGIN(USBClassChangeUIPlugin.dll, 1020E472.rsc)
+
+
+#endif // __USB_MULTIPERSONALITY
+#endif // __USBCLASSCHANGEUI_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/rom/USBClassChangeUIResources.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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 __USBCLASSCHANGEUIRESOURCES_IBY__
+#define __USBCLASSCHANGEUIRESOURCES_IBY__
+
+#ifdef __USB_MULTIPERSONALITY 
+
+//USBClassChangeUI
+data=DATAZ_\APP_RESOURCE_DIR\USBClassChangeUI.RSC    APP_RESOURCE_DIR\USBClassChangeUI.rsc
+
+//USBClassChangeUIPlugin
+data=DATAZ_\RESOURCE_FILES_DIR\USBClassChangeUIPlugin.rsc RESOURCE_FILES_DIR\USBClassChangeUIPlugin.rsc
+
+#endif // __USB_MULTIPERSONALITY
+#endif // __USBCLASSCHANGEUIRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/src/USBClassChangeUIApp.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005, 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 the implementation of application class.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "USBClassChangeUIApp.h"
+#include    "USBClassChangeUIDocument.h"
+#include    <eikstart.h>
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIApp::AppDllUid()
+// Returns application UID
+// ----------------------------------------------------------------------------
+//
+TUid CUSBClassChangeUIApp::AppDllUid() const
+    {
+    return KUidUSBClassChangeUI;
+    }
+   
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIApp::CreateDocumentL()
+// Creates CUSBClassChangeUIDocument object
+// ----------------------------------------------------------------------------
+//
+CApaDocument* CUSBClassChangeUIApp::CreateDocumentL()
+    {
+    CUSBClassChangeUIDocument* doc = 
+        new ( ELeave ) CUSBClassChangeUIDocument( *this );
+    return doc; 
+    
+    }
+    
+// ================= OTHER EXPORTED FUNCTIONS =================================   
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CUSBClassChangeUIApp;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/src/USBClassChangeUIAppui.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2005, 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:  Implementation of AppUI class
+*
+*/
+
+
+// INCLUDE FILES
+
+#include    "USBClassChangeUIAppUi.h"
+#include    "USBClassChangeUIDocument.h"
+#include    "USBClassChangeUIDebug.h"
+#include    "USBClassChangeUIPluginInterface.h"
+
+#include    <avkon.hrh>
+
+#include    <gsplugininterface.h>
+
+const TUid KUidImpl = { 0x1027478F };   // implementation UID of the plugin
+
+// ================= MEMBER FUNCTIONS =========================================
+//
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIAppUi::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIAppUi::ConstructL()
+    {
+    FLOG(_L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::ConstructL()"));
+    
+    BaseConstructL( EAknEnableSkin | EAknEnableMSK |EAknSingleClickCompatible);
+    
+    // Create the view using the GSPluginInterface
+    //   
+    CUSBClassChangeUIPluginInterface* mainView = 
+        CUSBClassChangeUIPluginInterface::NewL( KUidImpl, this );
+    
+    CleanupStack::PushL( mainView );
+    AddViewL( mainView ); // Transfer ownership to CAknViewAppUi
+    CleanupStack::Pop( mainView );
+    
+    ActivateLocalViewL( mainView->Id() );
+        
+    FLOG( _L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::ConstructL complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIAppUi::~CUSBUIAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------------------------------
+//
+CUSBClassChangeUIAppUi::~CUSBClassChangeUIAppUi()
+    {
+    FLOG( _L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::Destructor (empty) complete"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIAppUi::HandleCommandL(TInt aCommand)
+// Takes care of command handling
+// ----------------------------------------------------------------------------
+//
+void CUSBClassChangeUIAppUi::HandleCommandL(TInt aCommand)
+    {
+    FLOG( _L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::HandleCommandL()"));
+    switch ( aCommand )
+        {
+        case EAknSoftkeyExit:
+        case EEikCmdExit:
+            {
+            Exit();
+            break;
+            }    
+         
+        default:
+            {
+            FLOG( _L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::HandleCommandL default switch"));    
+            break;
+            }   
+        }
+        
+    FLOG( _L("[CUSBClassChangeUI]\t CUSBClassChangeUIAppUi::HandleCommandL complete"));
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/src/USBClassChangeUIDocument.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005, 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 the implementation of document class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "USBClassChangeUIDocument.h"
+#include "USBClassChangeUIAppUi.h"
+#include "USBClassChangeUIDebug.h"
+
+// ================= MEMBER FUNCTIONS =========================================
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CUSBClassChangeUIDocument::~CUSBClassChangeUIDocument()
+    {  
+    FLOG(_L("[CUSBClassChangeUI]\t CUSBClassChangeUIDocument::Destructor (empty) completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBClassChangeUIDocument::CreateAppUiL()
+// Constructs CUSBClassChangeUIAppUi
+// ----------------------------------------------------------------------------
+//
+CEikAppUi* CUSBClassChangeUIDocument::CreateAppUiL()
+    {
+    FLOG(_L("[CUSBClassChangeUI]\t CUSBClassChangeUIDocument::CreateAppUiL()"));
+    
+    return new ( ELeave ) CUSBClassChangeUIAppUi;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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	Wed Sep 01 12:20:49 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/usbavkonnotifu.def	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/BWINS/usbavkonnotifu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -1,3 +1,3 @@
 EXPORTS
-	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+	?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
 
--- a/usbuis/usbuinotif/data/102068DC.rss	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/data/102068DC.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -17,7 +17,7 @@
 */
 
 
-#include "ecom/registryinfo.rh"
+#include "registryinfo.rh"
 #include "uikon.hrh"
 
 RESOURCE REGISTRY_INFO theInfo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/data/usbuinotif.rss	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2005, 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 file contains all the resources for the module 
+*                   USBUINotif.
+*
+*/
+
+
+NAME USBN
+
+#include <eikon.rsg>
+#include <eikon.rh>
+
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+
+#include <usbuinotif.loc>
+
+
+RESOURCE RSS_SIGNATURE { }
+
+//default document name - not used
+RESOURCE TBUF { buf=""; }
+
+// === QUERIES ================================================================
+
+//-----------------------------------------------------------------------------
+// r_usb_query_with_cancel
+// Query resource (with Cancel) 
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_usb_query_with_cancel
+    {
+    flags   = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtQuery;
+            id      = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout    = EConfirmationQueryLayout;
+                animation = R_QGN_NOTE_QUERY_ANIM;
+                };
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_usb_query_without_cancel 
+// Query resource (without Cancel) 
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_usb_query_without_cancel
+    {
+    flags   = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtQuery;
+            id      = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout    = EConfirmationQueryLayout;
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+
+//-----------------------------------------------------------------------------
+// r_usb_on_connection_query
+// Defines a dialog for usb mode query
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_usb_on_connection_query
+    {
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSingleGraphicPopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    array_id = r_usb_empty_array;
+                    };
+                heading = qtn_usb_mode_query_header; 
+                };
+            }
+        };
+    }
+
+
+//-----------------------------------------------------------------------------
+//Prompts for message queries
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_usb_mode_msg_header {
+    buf=qtn_usb_mode_msg_header; }
+
+RESOURCE TBUF r_usb_mode_msg_mass_storage {
+    buf= "%U mode :\n"qtn_usb_mode_msg_mass_storage"\n<AknMessageQuery Link>"qtn_usb_mode_msg_link"</AknMessageQuery Link>"; }
+
+RESOURCE TBUF r_usb_mode_msg_pc_suite {
+    buf= "%U mode :\n"qtn_usb_mode_msg_pc_suite"\n<AknMessageQuery Link>" qtn_usb_mode_msg_link"</AknMessageQuery Link>"; }
+
+RESOURCE TBUF r_usb_mode_msg_mtp {
+    buf= "%U mode :\n"qtn_usb_mode_msg_mtp"\n<AknMessageQuery Link>" qtn_usb_mode_msg_link"</AknMessageQuery Link>"; }
+
+RESOURCE TBUF r_usb_mode_msg_ptp {
+    buf= "%U mode :\n"qtn_usb_mode_msg_ptp"\n<AknMessageQuery Link>" qtn_usb_mode_msg_link"</AknMessageQuery Link>"; }
+
+RESOURCE TBUF r_usb_mode_msg_link {
+    buf=qtn_usb_mode_msg_link; }
+
+//-----------------------------------------------------------------------------
+// r_usb_on_connection_message_query
+// Defines a dialog for ask on connection query
+//-----------------------------------------------------------------------------
+//   
+RESOURCE DIALOG r_usb_on_connection_message_query 
+    {
+    flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    items=
+        {
+        DLG_LINE 
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                label = header_not_defined;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                };
+            }
+        };
+    }
+
+
+//-----------------------------------------------------------------------------
+// r_usb_empty_array
+// Defines an empty array
+//-----------------------------------------------------------------------------
+RESOURCE ARRAY r_usb_empty_array
+    {
+    items=
+        {
+        LBUF { txt=""; }
+        };
+    }
+
+
+//-----------------------------------------------------------------------------
+// Prompts for information notes
+//-----------------------------------------------------------------------------
+//
+
+//-----------------------------------------------------------------------------
+// Prompts for confirmation queries
+//-----------------------------------------------------------------------------
+//
+#ifndef RD_MULTIPLE_DRIVE
+RESOURCE TBUF r_usb_memory_card_locked { 
+    buf = qtn_usb_mode_note_memory_card_locked; }
+
+RESOURCE TBUF r_usb_cable_unsafely_removed {
+    buf = qtn_usb_mode_note_cable_unsafely_removed; }
+
+RESOURCE TBUF r_usb_memorycard_unsafely_removed { 
+    buf = qtn_usb_mode_note_mmc_unsafely_removed; }
+#endif
+
+RESOURCE TBUF r_usb_change_from_mass_storage {
+    buf = qtn_usb_mode_query_change_from_mass_storage; }
+
+RESOURCE TBUF r_usb_storage_media_failure { 
+    buf = qtn_usb_mode_note_storage_media_failure; }
+
+// USB OTG Resources
+
+//-----------------------------------------------------------------------------
+// r_usb_query_otg_error
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_usb_query_otg_error
+    {
+    flags   = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtQuery;
+            id      = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout    = EConfirmationQueryLayout;
+                animation = R_QGN_NOTE_ERROR_ANIM;
+                };
+            }
+        };
+    }
+
+RESOURCE TBUF r_usb_otg_error_current_limit { 
+    buf = qtn_usb_otg_error_current_limit; }
+
+RESOURCE TBUF r_usb_otg_error_too_much_current_required { 
+    buf = qtn_usb_otg_error_too_much_current_required; }
+    
+RESOURCE TBUF r_usb_otg_error_unsupported { 
+    buf = qtn_usb_otg_error_unsupported; }
+
+RESOURCE TBUF r_usb_otg_error_hub_unsupported { 
+    buf = qtn_usb_otg_error_hub; }
+
+RESOURCE TBUF r_usb_otg_error_unrecoverable { 
+    buf = qtn_usb_otg_error_unrecoverable; }
+
+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; }
+
+RESOURCE TBUF r_usb_otg_error_attach_timedout { 
+    buf = qtn_usb_otg_error_cable; }
+
+RESOURCE TBUF r_usb_msmm_error_unknown_filesystem { 
+    buf = qtn_usb_otg_error_unsupported_filesystem; }
+
+RESOURCE TBUF r_usb_msmm_error_general_mass_storage_error { 
+    buf = qtn_usb_otg_general_mass_storage_error; }
+
+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; }
+
+RESOURCE TBUF r_usb_error_disk_full { 
+    buf = qtn_usb_error_disk_full; }
+	
+// End of File
--- a/usbuis/usbuinotif/eabi/usbavkonnotifu.def	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/eabi/usbavkonnotifu.def	Wed Sep 01 12:20:49 2010 +0100
@@ -1,3 +1,3 @@
 EXPORTS
-	_Z24ImplementationGroupProxyRi @ 1 NONAME
+	_Z13NotifierArrayv @ 1 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/group/bld.inf	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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:  This file provides building information for usbuinotif.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/usbuinotif.loc             MW_LAYER_LOC_EXPORT_PATH(usbuinotif.loc)
+../rom/usbuinotif.iby             CORE_MW_LAYER_IBY_EXPORT_PATH(usbuinotif.iby)
+../rom/usbuinotifresources.iby    LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbuinotifresources.iby)
+
+PRJ_MMPFILES
+usbuinotif.mmp
+usbavkonnotif.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/group/usbavkonnotif.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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"
+ * which accompanies 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
+SOURCE          usbavkonmain.cpp
+SOURCE	        usbnotifier.cpp
+
+USERINCLUDE     ../inc
+
+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 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/group/usbuinotif.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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"
+* which accompanies 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          usbuinotif.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D  0x102068DC
+
+CAPABILITY	    CAP_ECOM_PLUGIN
+VENDORID	    VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          usbuinmain.cpp
+SOURCE	        usbnotifier.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 
+END	
+
+// Notifier resource file
+START RESOURCE  ../data/usbuinotif.rss
+HEADER
+TARGETPATH    RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     ../inc
+
+SYSTEMINCLUDE   /epoc32/include/ecom
+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 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
+LIBRARY viewcli.lib 
+LIBRARY featmgr.lib
+
+DEBUGLIBRARY flogger.lib                    // File logging services
+
+// End of File
--- a/usbuis/usbuinotif/inc/usbnotifier.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbnotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -20,6 +20,9 @@
 #include <usbuinotif.h>
 #include <eikenv.h>
 #include <data_caging_path_literals.hrh> 
+#include <usbman.h>
+#include <usbwatcher.h>
+#include <AknCapServerClient.h>  
 #include "usbuinotifdebug.h"
 // CONSTANTS
 // Literal resource filename 
@@ -35,7 +38,7 @@
  *
  *  @lib
  */
-NONSHARABLE_CLASS(CUSBUINotifierBase) : public CBase, public MEikSrvNotifierBase2
+NONSHARABLE_CLASS(CUSBUINotifierBase) : public CActive, public MEikSrvNotifierBase2
     {
 public:
     // Constructors and destructor
@@ -69,25 +72,52 @@
      * @param aMessage Should be completed when the notifier is deactivated.
      * @return None.
      */
-    virtual void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    virtual void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
             const RMessagePtr2& aMessage)=0;
 
     /**
+     * A function for checking the status of Apps key.
+     * @param aEnable A Boolean according to Apps key status
+     * @return None.
+     */
+    void SuppressAppSwitching(TBool aEnable);
+
+    /**
      * Check if message needs to be completed and complete it
      * @param aReason   The completetion code
      */
     void CompleteMessage(TInt aReason);
 
-    /**
-     * Initialize HbTextResolrer, if not initialized before
-     * (checks it from TLS)
-     */    
-    void InitializeTextResolver();
-   
+    /*
+     * Check whether the keylock is on. If yes turn it off.
+     * @since S60 3.2
+     */
+    void DisableKeylock();
+
+    /*
+     * Restore the keyguard on if it has been disabled by DisableKeylock.
+     * @since S60 3.2
+     */
+    void RestoreKeylock();
+
 protected:
     // Functions from base classes        
 
     /**
+     * From CActive Gets called when a request completes.
+     * @param None.
+     * @return None.
+     */
+    virtual void RunL()=0;
+
+    /**
+     * From CActive Gets called when a leave occurres in RunL.
+     * @param aError Symbian OS errorcode.
+     * @return error code.
+     */
+    virtual TInt RunError(TInt aError);
+
+    /**
      * From MEikSrvNotifierBase2 Called when a notifier is first loaded 
      * to allow any initial construction that is required.
      * @param None.
@@ -101,7 +131,7 @@
      * @param None.
      * @return None.
      */
-   virtual void Cancel();
+    virtual void Cancel();
 
 private:
     // Functions from base classes        
@@ -146,8 +176,16 @@
      */
     virtual TPtrC8 UpdateL(const TDesC8& aBuffer);
 
- 
-  
+    /**
+     * From CActive Gets called when a request is cancelled.
+     * @param None.
+     * @return None.
+     */
+    virtual void DoCancel();
+
+private:
+    TBool iKeylockChanged; // Flag used to restore the keylock
+    RAknUiServer iAknServer;
 protected:
     // Data
 
@@ -158,7 +196,10 @@
     TInt iResourceFileFlag; // Flag for eikon env.
     TNotifierInfo iInfo; // Notifier parameters structure    
     CEikonEnv* iEikEnv; // Local eikonenv, not own
-    TBool iTranslator ;
+    TBool iAppsKeyBlocked; // Apps key status 
+
+    TBool iCoverDisplaySupported; // Cover Display UI feature support
+
     };
 
 #endif // USBUINOTIFIER_H
--- a/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h	Wed Sep 01 12:20:49 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,8 +20,8 @@
 
 // INCLUDES
 
-#include <hb/hbcore/hbdevicedialogsymbian.h>
-#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
+#include <aknlistquerydialog.h> 
+#include <AknQueryDialog.h>
 
 #include "usbnotifier.h" // Base class
 // CLASS DECLARATION
@@ -31,8 +31,8 @@
  *
  *  @lib
  */
-NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase, 
-    public MHbDeviceNotificationDialogObserver
+NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
+       public MEikCommandObserver
     {
 public:
     // Constructors and destructor
@@ -66,6 +66,13 @@
     void Cancel();
 
     /**
+     * From CUSBUINotifierBase Gets called when a request completes.
+     * @param None.
+     * @return None.
+     */
+    void RunL();
+
+    /**
      * From CUSBUINotifierBase Used in asynchronous notifier launch to 
      * store received parameters into members variables and 
      * make needed initializations.
@@ -74,21 +81,13 @@
      * @param aMessage Should be completed when the notifier is deactivated.
      * @return None.
      */
-    void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
             const RMessagePtr2& aMessage);
  
-       
-private:
-    // functions from MHbDeviceNotificationDialogObserver
     /**
-     * Callback function which is called when the dialog is tapped
+     * Handles the command on USB connected note
      */
-    void NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog);
-    /**
-     * Callback function which is called when the dialog is closed
-     */
-    void NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog,
-            TInt aCompletionCode);
+    void ProcessCommandL(TInt aCommandId);
 
 private:
     //New functions
@@ -97,21 +96,25 @@
      * @param aCurrentPersonality current personality id
      */
     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 GetPersonalityStringLC(HBufC*& aHeader,HBufC*& aDescription );
+    void GetPersonalityStringL(HBufC*& aHeader,HBufC*& aDescription );
 
-     /**
-     * launches the (USB) application
-     * @param aProcessName The process name (*.exe)
+    /**
+     * Runs the connected discreet note
+     */
+    void RunQueryL();
+  
+    /**
+     * creates the USB UI setting view
+     * @param aProcessName The process name (USBClassChangeUI.exe)
      * @param TUidType 
      */
-    void LaunchApplication(const TDesC & aProcessName,const TUidType & aUidType) const;
+    void CreateChosenViewL(const TDesC & aProcessName,const TUidType & aUidType) const;
 
 private:
     /**
@@ -119,7 +122,21 @@
      */
     CUSBUICableConnectedNotifier();
     
-    CHbDeviceNotificationDialogSymbian* iDialog; 
+    /**
+     * Waiter for canceling notifier. Canceling is not posible when note is visible
+     */
+    CActiveSchedulerWait    iNoteWaiter;    
+    
+    /**
+     * Note visible
+     */
+    TBool   iNoteVisible;
+
+    /**
+     * Note tapped
+     */
+    TBool   iNoteTapped;
 
     };
+
 #endif // USBUINCABLECONNECTEDNOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/inc/usbuinotifdialerwatcher.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* 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	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h	Wed Sep 01 12:20:49 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Declares MSMM error notifier.
+* Description:  Declares USB UI Queries notifier.
  *
 */
 
@@ -20,11 +20,12 @@
 #define USBUINOTIFMSMMERROR_H
 
 // INCLUDES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
-#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
+
 #include "usbnotifier.h"      // Base class
+#include <AknQueryDialog.h>   // AVKON component
+#include "usbuinotifdialerwatcher.h"
 
-
+#define KUsbUiNotifOtgGeneralQueryGranularity 3
 // CLASS DECLARATION
 
 /**
@@ -33,24 +34,19 @@
  *
  *  @lib
  */
-NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase,
-                                          public MHbDeviceMessageBoxObserver,
-                                          public MHbDeviceNotificationDialogObserver
+NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase, public MDialerNotifier
     {
 public:
 
-    /**
-     * Indexes for the strings used in KUsbUiNotifMSMMError which are mapped to 5 errors.
-     */
-    enum TUsbUiNotifMSMMError
-        {
-        EUsbMSMMGeneralError,	
-        EUsbMSMMUnknownFileSystem,
-        EUsbMSMMOutOfMemory,
-        EUsbMSMMSafeToRemove,
-        EUsbMSMMUnableToEject
-        };
-
+/**
+ * Possible parameter values for KUsbUiNotifMSMMError
+ */
+enum TUsbUiNotifMSMMError
+    {
+    EUsbMSMMGeneralError,	
+    EUsbMSMMUnknownFileSystem,
+    EUsbMSMMOutOfMemory
+    };
     // Constructors and destructor
 
     /**
@@ -63,14 +59,6 @@
      */
     virtual ~CUsbUiNotifMSMMError();
 
-    /**
-     * Call back function to observe device message box closing.
-     * @param aMessageBox Pointer to the closing message box instance.
-     * @param aButton Button that was pressed.
-     */
-    void MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
-        CHbDeviceMessageBoxSymbian::TButtonId aButton);
-
 protected:
 
     /**
@@ -95,6 +83,11 @@
     void Cancel();
 
     /**
+     * From CUSBUINotifierBase Gets called when a request completes.
+     */
+    void RunL();
+
+    /**
      * From CUSBUINotifierBase Used in asynchronous notifier launch to 
      * store received parameters into members variables and 
      * make needed initializations.
@@ -102,8 +95,25 @@
      * @param aReplySlot A reply slot.
      * @param aMessage Should be completed when the notifier is deactivated.
      */
-    void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    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:
 
@@ -113,21 +123,31 @@
     CUsbUiNotifMSMMError();
 
 private:
-    // functions from MHbDeviceNotificationDialogObserver
+    // New functions
+
     /**
-     * Callback function which is called when the dialog is tapped
+     * Show query dialog     
+     * @return KErrNone - accepted, KErrCancel - Cancel or End call key
      */
-    void NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog);
-    /**
-     * Callback function which is called when the dialog is closed
-     */
-    void NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog,
-            TInt aCompletionCode);
+    TInt QueryUserResponseL();
 
 private:
     // Data
-    CHbDeviceMessageBoxSymbian* iQuery;
-    CHbDeviceNotificationDialogSymbian* iDiscreet; 
-    CDesCArrayFlat* iStringIds;
-     };
+    /**
+     *  Query
+     *  Not own, destroys self when lauched.
+     */
+    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	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuinotifotgerror.h	Wed Sep 01 12:20:49 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Declares USB UI OTG Errors notifier.
+* Description:  Declares USB UI Queries notifier.
  *
 */
 
@@ -20,20 +20,21 @@
 #define USBUINOTIFOTGERROR_H
 
 // INCLUDES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
+
 #include "usbnotifier.h"      // Base class
+#include <AknQueryDialog.h>   // AVKON component
+#include "usbuinotifdialerwatcher.h"
 
-
+#define KUsbUiNotifOtgGeneralQueryGranularity 3
 // CLASS DECLARATION
 
 /**
- *  This class is used to show general USB OTG errors
+ *  This class is used to show general USB query.
  *  Asynchronous call is required.
  *
  *  @lib
  */
-NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase, 
-                                        public MHbDeviceMessageBoxObserver
+NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase, public MDialerNotifier
     {
 public:
     // Constructors and destructor
@@ -47,14 +48,7 @@
      * Destructor.
      */
     virtual ~CUsbUiNotifOtgError();
-   
-    /**
-     * Call back function to observe device message box closing.
-     * @param aMessageBox Pointer to the closing message box instance.
-     * @param aButton Button that was pressed.
-     */
-    void MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
-            CHbDeviceMessageBoxSymbian::TButtonId aButton);
+
 protected:
 
     /**
@@ -79,6 +73,11 @@
     void Cancel();
 
     /**
+     * From CUSBUINotifierBase Gets called when a request completes.
+     */
+    void RunL();
+
+    /**
      * From CUSBUINotifierBase Used in asynchronous notifier launch to 
      * store received parameters into members variables and 
      * make needed initializations.
@@ -86,8 +85,25 @@
      * @param aReplySlot A reply slot.
      * @param aMessage Should be completed when the notifier is deactivated.
      */
-    void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    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:
 
@@ -97,12 +113,31 @@
     CUsbUiNotifOtgError();
 
 private:
+    // New functions
+
+    /**
+     * Show query dialog     
+     * @return KErrNone - accepted, KErrCancel - Cancel or End call key
+     */
+    TInt QueryUserResponseL();
+
+private:
     // Data
     /**
      *  Query
-     *  Owned
+     *  Not own, destroys self when lauched.
      */
-    CHbDeviceMessageBoxSymbian* iQuery; 
-    CDesCArrayFlat* iStringIds;
+    CAknQueryDialog* iQuery; 
+    RArray<TInt> iStringIds;
+    TInt iErrorId;
+    /**
+     * Dialer watcher 
+     * Own.
+     */
+    CUsbuinotifDialerWatcher* iDialerWatcher;
+    /**
+     * Dialog is dismissed. 
+     */
+    TBool iDismissed;
     };
 #endif // USBUINOTIFOTGERROR_H
--- a/usbuis/usbuinotif/inc/usbuinotifotgwarning.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuinotifotgwarning.h	Wed Sep 01 12:20:49 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Declares USB OTG Warning notifier.
+* Description:  Declares USB UI connection notifier.
  *
 */
 
@@ -20,11 +20,11 @@
 #define USBUINOTIFOTGWARNING_H
 
 // INCLUDES
-
+#include <aknnotewrappers.h>
 #include <usbuinotif.h>
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
 
 #include "usbnotifier.h"   // Base class
+#define KUsbUiNotifOtgGeneralNoteGranularity 1
 // CLASS DECLARATION
 
 /**
@@ -32,8 +32,7 @@
  *  Synchronous call is enouph.
  * 
  */
-NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase,
-                                           public MHbDeviceMessageBoxObserver
+NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase
     {
 public:
     // Constructors and destructor
@@ -47,13 +46,6 @@
      * Destructor.
      */
     virtual ~CUsbUiNotifOtgWarning();
-    /**
-       * Call back function to observe device message box closing.
-       * @param aMessageBox Pointer to the closing message box instance.
-       * @param aButton Button that was pressed.
-       */
-    void MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
-          CHbDeviceMessageBoxSymbian::TButtonId aButton);
 
 protected:
 
@@ -80,6 +72,13 @@
     void Cancel();
 
     /**
+     * From CUSBUINotifierBase. Gets called when a request completes.
+     * @param None.
+     * @return None.
+     */
+    void RunL();
+
+    /**
      * From CUSBUINotifierBase. Used in asynchronous notifier launch to 
      * store received parameters into members variables and 
      * make needed initializations.
@@ -88,7 +87,7 @@
      * @param aMessage Should be completed when the notifier is deactivated.
      * @return None.
      */
-    void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
             const RMessagePtr2& aMessage);
 
 private:
@@ -98,12 +97,25 @@
      */
     CUsbUiNotifOtgWarning();
 
+    /**
+     * Publish the dialog to the cover UI
+     * The cover UI may use the personality ID or the localized
+     * personality name e.g. "Mass storage". 
+     * @param aNote           The dialog to be published.
+     * @param aPersonalityId  The personality ID.
+     * @param aLocalizedPersonalityDescriptor The personality as a string.
+     */
+    void
+            PublishToCoverUiL(CAknResourceNoteDialog* aNote,
+                    TInt aPersonalityId,
+                    const HBufC* aLocalizedPersonalityDescriptor);
+
 private:
     // data
-    CDesCArrayFlat* iStringIds;
+    RArray<TInt> iStringIds;
 
     //Own
-    CHbDeviceMessageBoxSymbian* iNote;
+    CAknResourceNoteDialog* iNote;
 
     TInt iNoteId;
     };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,129 @@
+/*
+ * 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"
+ * which accompanies 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 UI Queries notifier.
+ *
+ */
+
+#ifndef USBUINQUERIESNOTIFIER_H
+#define USBUINQUERIESNOTIFIER_H
+
+// INCLUDES
+
+#include "usbnotifier.h"      // Base class
+#include <AknQueryDialog.h>   // AVKON component
+
+// CLASS DECLARATION
+
+/**
+ *  This class is used to show USB query dialogs.
+ *
+ *  @lib
+ */
+NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase
+    {
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CUSBUIQueriesNotifier* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CUSBUIQueriesNotifier();
+
+
+private:
+    // Functions from base class
+
+    /**
+     * From CUSBUINotifierBase Called when a notifier is first loaded.        
+     * @param None.
+     * @return A structure containing priority and channel info.
+     */
+    TNotifierInfo RegisterL();
+
+    /**
+     * From CUSBUINotifierBase The notifier has been deactivated 
+     * so resources can be freed and outstanding messages completed.
+     * @param None.
+     * @return None.
+     */
+    void Cancel();
+
+    /**
+     * From CUSBUINotifierBase Gets called when a request completes.
+     * @param None.
+     * @return None.
+     */
+    void RunL();
+
+    /**
+     * From CUSBUINotifierBase Used in asynchronous notifier launch to 
+     * store received parameters into members variables and 
+     * make needed initializations.
+     * @param aBuffer A buffer containing received parameters
+     * @param aReplySlot A reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @return None.
+     */
+    void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+            const RMessagePtr2& aMessage);
+
+private:
+
+    /**
+     *  C++ default constructor.
+     */
+    CUSBUIQueriesNotifier();
+
+private:
+    // New functions
+
+
+    /**
+     * Show query dialog 
+     * @param aStringHolder   The string for the query. 
+     * @param aCoverDialogId  The dialog ID for the cover UI.
+     * @param aIsCancelKey    Does the dialog show Cancel key.
+     * @return KErrNone - accepted, KErrCancel - Cancel or End call key
+     */
+    TInt QueryUserResponseL(const TDesC& aStringHolder, TInt aCoverDialogId,
+            TBool aIsCancelKey);
+
+    /**
+     * Get attributes for the query dialog
+     * The query type is idenfied by the member variable iQueryType.
+     * The caller should pop and destroy the returned heap descriptor 
+     * when it is no longer needed.
+     * @param aCoverDialogId  Returned dialog ID for the cover UI.
+     * @param aIsCancelKey    Returned info about showing the Cancel key.
+     * @return                The string holder for the query. 
+     */
+    HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey);
+
+private:
+    // Data
+    /**
+     * Query
+     * Not own, destroys self when lauched.
+     */
+    CAknQueryDialog* iUSBQueryDlg;  
+    TUSBUIQueries iQueryType; // To store the type of the query
+    TInt iDriveLetter; // For MMC locked case
+
+    };
+#endif // USBUINQUERIESNOTIFIER_H
--- a/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h	Wed Sep 01 12:20:49 2010 +0100
@@ -19,10 +19,9 @@
 #define USBUINQUERIESNOTIFIER_H
 
 // INCLUDES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
+
 #include "usbnotifier.h"      // Base class
-
-
+#include <AknQueryDialog.h>   // AVKON component
 // CLASS DECLARATION
 
 /**
@@ -31,8 +30,7 @@
  *  @lib 
  *  @since S60 3.0
  */
-NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase,
-                                           public MHbDeviceMessageBoxObserver
+NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase
     {
 public:
     // Constructors and destructor
@@ -46,14 +44,6 @@
      * Destructor.
      */
     virtual ~CUSBUIQueriesNotifier();
-    /**
-     * Call back function to observe device message box closing.
-     * @param aMessageBox Pointer to the closing message box instance.
-     * @param aButton Button that was pressed.
-     */
-    void MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
-            CHbDeviceMessageBoxSymbian::TButtonId aButton);
-
 
 private:
     // Functions from base class
@@ -74,6 +64,13 @@
     void Cancel();
 
     /**
+     * From CUSBUINotifierBase Gets called when a request completes.
+     * @param None.
+     * @return None.
+     */
+    void RunL();
+
+    /**
      * From CUSBUINotifierBase Used in asynchronous notifier launch to 
      * store received parameters into members variables and 
      * make needed initializations.
@@ -82,24 +79,53 @@
      * @param aMessage Should be completed when the notifier is deactivated.
      * @return None.
      */
-    void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+    void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
             const RMessagePtr2& aMessage);
 
 private:
-    
+    /*
+     * From MEikSrvNotifierBase2 Synchronic notifier launch.        
+     * @param aBuffer Received parameter data.
+     * @return A pointer to return value.
+     */
+    virtual TPtrC8 StartL(const TDesC8& aBuffer);
+
     /**
      *  C++ default constructor.
      */
     CUSBUIQueriesNotifier();
 
+private:
+    // New functions
+
+    /**
+     * Show query dialog 
+     * @param aStringHolder   The string for the query. 
+     * @param aCoverDialogId  The dialog ID for the cover UI.
+     * @param aIsCancelKey    Does the dialog show Cancel key.
+     * @return KErrNone - accepted, KErrCancel - Cancel or End call key
+     */
+    TInt QueryUserResponseL(const TDesC& aStringHolder, TInt aCoverDialogId,
+            TBool aIsCancelKey, TBool aIsErrorQuery);
+
+    /**
+     * Get attributes for the query dialog
+     * The query type is idenfied by the member variable iQueryType.
+     * The caller should pop and destroy the returned heap descriptor 
+     * when it is no longer needed.
+     * @param aCoverDialogId  Returned dialog ID for the cover UI.
+     * @param aIsCancelKey    Returned info about showing the Cancel key.
+     * @return                The string holder for the query. 
+     */
+    HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey, TBool& aIsErrorQuery);
 
 private:
     // Data
     
     /**
-    * owned
+    * Not own, destroys self when lauched.
     */
-    CHbDeviceMessageBoxSymbian*  iUSBQueryDlg;
+    CAknQueryDialog* iUSBQueryDlg;
     TUSBUIQueries iQueryType; // To store the type of the query
 
     };
--- a/usbuis/usbuinotif/loc/usbuinotif.loc	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/loc/usbuinotif.loc	Wed Sep 01 12:20:49 2010 +0100
@@ -139,11 +139,16 @@
 //
 #define qtn_usb_otg_general_mass_storage_error "General Mass storage error"
 
+// End of USB_OTG
+
 //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
+//d: Disk full error
+//l: popup_note_window
+//r: 5.2
+#define qtn_usb_error_disk_full "Disk full. Remove some files and try to connect USB cable again."
 
 // End of File
--- a/usbuis/usbuinotif/rom/usbuinotif.iby	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/rom/usbuinotif.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -22,6 +22,7 @@
 #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/rom/usbuinotifresources.iby	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/rom/usbuinotifresources.iby	Wed Sep 01 12:20:49 2010 +0100
@@ -19,11 +19,9 @@
 
 REM USB UI notifiers resources
 
-#include <data_caging_paths_for_iby.hrh>
-
 #ifdef __USB_MULTIPERSONALITY 
 
-data=DATAZ_\QT_TRANSLATIONS_DIR\usbdialogs.qm   QT_TRANSLATIONS_DIR\usbdialogs.qm
+data=DATAZ_\RESOURCE_FILES_DIR\usbuinotif.rsc    RESOURCE_FILES_DIR\usbuinotif.rsc
 
 #endif // __USB_MULTIPERSONALITY
 #endif // __USBUINOTIFRESOURCES_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/src/usbavkonmain.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,96 @@
+/*
+ * 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/usbnotifier.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbnotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -16,14 +16,18 @@
  */
 
 // INCLUDE FILES
-
+#include <eikenv.h>          // Eikon environment
 #include <bautils.h>         // BAFL utils (for language file)
+#include <StringLoader.h>    // Localisation stringloader
+#include <centralrepository.h> 
+#include <coreapplicationuisdomainpskeys.h>
 #include <data_caging_path_literals.hrh> 
-#include <hb/hbcore/hbtextresolversymbian.h>
+#include <featmgr.h>
+#include <AknNotiferAppServerApplication.h>
 
 #include "usbnotifier.h"     // Own class 
 #include "usbuinotifdebug.h"
-
+#include "aknkeylock.h" //RAknKeyLock
 // CONSTANTS
 
 // ================= MEMBER FUNCTIONS =========================================
@@ -35,9 +39,11 @@
 // itself to the active scheduler stack.
 // ----------------------------------------------------------------------------
 //
-CUSBUINotifierBase::CUSBUINotifierBase() 
+CUSBUINotifierBase::CUSBUINotifierBase() :
+    CActive( EPriorityStandard )
     {
         FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Default constructor()"));
+    CActiveScheduler::Add( this );
     }
 
 // ----------------------------------------------------------------------------
@@ -49,16 +55,27 @@
 void CUSBUINotifierBase::ConstructL()
     {
     iEikEnv = CEikonEnv::Static();
-   
+    iAppsKeyBlocked = EFalse;
+    iKeylockChanged = EFalse;
+
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL()"));
-        
-    // use TLS as a boolean, set to EFalse
-    TBool initialized = EFalse;
-    TInt error;
-    error = Dll::SetTls((TAny* )initialized); 
-    error = error; // to suppress a compiler warning
-    FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:SetTls returned %d"), error ));       
-   
+    TFileName filename;
+
+    const TDriveNumber KStoreDrive = EDriveZ;
+    TDriveUnit driveUnit( KStoreDrive );
+    TDriveName drive = driveUnit.Name();
+    filename.Insert( 0, drive );
+
+    filename += KDC_RESOURCE_FILES_DIR; // From data_caging_path_literals.hrh
+    filename += KResourceFileName;
+    BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), filename );
+    iResourceFileFlag = iEikEnv->AddResourceFileL( filename );
+
+    FeatureManager::InitializeLibL();
+    iCoverDisplaySupported = FeatureManager::FeatureSupported(
+            KFeatureIdCoverDisplay );
+    FeatureManager::UnInitializeLib();
+
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL() completed"));
     }
 
@@ -73,11 +90,18 @@
     //this virtual function call is to the local CUSBUINotifierBase::Cancel, 
     //not to any possibly derived class implementation. 
     Cancel();
- 
+    iEikEnv->DeleteResourceFile( iResourceFileFlag );
+
     // Complete the RMessage2 if needed
     //
     CompleteMessage( KErrDied );
 
+    // Activate apps -key again (if not previously activated yet)
+    SuppressAppSwitching( EFalse );
+
+    //Don't call RestoreKeylock here. It's up to specific note notfier logic. 
+    //If failed to RestoreKeylock there, it doesn't matter to leave keylock open.
+
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Destructor completed"));
     }
 
@@ -125,7 +149,7 @@
         const RMessagePtr2& aMessage)
     {
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::StartL()"));
-    TRAPD( err, StartDialogL( aBuffer, aReplySlot, aMessage ));
+    TRAPD( err, GetParamsL( aBuffer, aReplySlot, aMessage ));
     if (err)
         {
         aMessage.Complete( err );
@@ -143,9 +167,8 @@
 void CUSBUINotifierBase::Cancel()
     {
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel()"));
-    //The message box closed callback gets not run in subclass cancel calls.
-    CompleteMessage(KErrCancel);
-    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel completed"));
+    CActive::Cancel();
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel completed()"));
     }
 
 // ----------------------------------------------------------------------------
@@ -160,6 +183,64 @@
     }
 
 // ----------------------------------------------------------------------------
+// CUSBUINotifierBase::DoCancel
+// This method will be called by framework (CActive)
+// if active object is still active.
+// Does nothing here.
+// ----------------------------------------------------------------------------
+//
+void CUSBUINotifierBase::DoCancel()
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::DoCancel()"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBUINotifierBase::RunError
+// This method is called if any leaving has been occured
+// during RunL. Optional method for CActive derived objects.
+// ----------------------------------------------------------------------------
+//
+TInt CUSBUINotifierBase::RunError(TInt aError)
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RunError()"));
+
+    // Activate apps -key again (if not previously activated yet)
+    //
+    SuppressAppSwitching( EFalse );
+
+    // Write error message to caller
+    //
+    CompleteMessage( aError );
+
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RunError() completed"));
+
+    return aError;
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBUINotifierBase::SuppressAppSwitching
+// 
+// ----------------------------------------------------------------------------
+//
+void CUSBUINotifierBase::SuppressAppSwitching(TBool aEnable)
+    {
+    FTRACE(FPrint(_L("[USBUINOTIF]\t CUSBUINotifierBase::SuppressAppSwitching() %d"), aEnable));
+
+    if (iAppsKeyBlocked != aEnable)
+        {
+        TInt err = iAknServer.ConnectAndSendAppsKeySuppress( aEnable ); // error is stored only for logging purposes
+        iAppsKeyBlocked = aEnable;
+        FTRACE(FPrint(_L("[USBUINOTIF]\t CUSBUINotifierBase::SuppressAppSwitching() ConnectAndSendAppsKeySuppress returned %d"), err ));
+        }
+
+    if (!iAppsKeyBlocked)
+        {
+        iAknServer.Close(); // close the connection once we have re-enabled swithcing
+        }
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::SuppressAppSwitching() completed"));
+    }
+
+// ----------------------------------------------------------------------------
 // CUSBUINotifierBase::CompleteMessage
 // Check if message needs to be completed and complete it. 
 // ----------------------------------------------------------------------------
@@ -176,33 +257,61 @@
     FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::CompleteMessage() completed"));
     }
 
-void CUSBUINotifierBase::InitializeTextResolver()
+// ----------------------------------------------------------------------------
+// CUSBUINotifierBase::DisableKeylock
+// ----------------------------------------------------------------------------
+// Turn off the keyguard if it was on.
+//
+void CUSBUINotifierBase::DisableKeylock()
     {
-    _LIT(KFileName, "usbdialogs_");
-    _LIT(KPath, "z:/resource/qt/translations/");         
-    TInt error = KErrNone;
-        
-    iTranslator = (TBool )Dll::Tls();
-    
-    FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:Tls returned %d"), iTranslator ));    
-    
-    if (!iTranslator)
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock()"));
+    RAknKeylock2 keylock;
+    iKeylockChanged = EFalse;
+    if (KErrNone == keylock.Connect())
         {
-        iTranslator = HbTextResolverSymbian::Init(KFileName, KPath);
-        FTRACE(FPrint(_L("[USBUINOTIF]\t HbTextResolverSymbian::Init returned %d"), iTranslator ));    
-        if (iTranslator)
+        if (keylock.IsKeyLockEnabled()) //Check and save the keylock status
             {
-            error = Dll::SetTls((TAny* )iTranslator);      
+            keylock.DisableWithoutNote();// Unlock
+            iKeylockChanged = ETrue;
             }
-        FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:SetTls returned %d"), error ));    
-        }    
-       
-     error = error;   // to suppress a compiler warning
-     FTRACE( FPrint(
-        _L( "[USBUINOTIF]\t CUSBUINotifierBase::InitializeTextResolver result = %d" ),
-        iTranslator ) );                     
-        
+        keylock.Close();
+        }
+    else
+        {
+        FLOG( _L( "[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock() fail caused by RAknKeylock2::Connect()") );
+        }
+
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock() completed"));
     }
 
+// ----------------------------------------------------------------------------
+// CUSBUINotifierBase::RestoreKeylock
+// ----------------------------------------------------------------------------
+// Restore the keyguard on.
+//
+void CUSBUINotifierBase::RestoreKeylock()
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock()"));
+    if (iKeylockChanged)
+        {
+        FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock(): iKeylockChanged true"));
+        RAknKeylock2 keylock;
+        FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock(): RAknKeyLock2 initialized"));
+        if (KErrNone == keylock.Connect())
+            {
+            FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock(): RAknKeyLock2::Connect() complete"));
+            keylock.EnableWithoutNote();// Lock back
+            FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock(): RAknKeyLock2::EnableWithoutNote() complete"));
+            keylock.Close();
+            FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock(): RAknKeyLock2::Close() complete"));
+            iKeylockChanged = EFalse;
+            }
+        else
+            {
+            FLOG( _L( "[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock() fail caused by RAknKeylock2::Connect()") );
+            }
+        }
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::RestoreKeylock() completed"));
+    }
 
 // End of File
--- a/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -15,25 +15,39 @@
  *
  */
 // INCLUDE FILES
+#include <eikenv.h>          // Eikon environment
+#include <bautils.h>         // BAFL utils (for language file)
+#include <aknlists.h>
+#include <aknPopup.h> 
+#include <StringLoader.h>    // Localisation stringloader
 #include <utf.h>             // Unicode character conversion utilities
-#include <usbman.h>
+#include <AknsUtils.h>
+#include <usb.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 <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
-#include <hb/hbcore/hbtextresolversymbian.h>
+#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, "USBSettingsApp");
-const TInt KUSBUIUid = 0x2002E70C;
-const TInt KTextIdLength = 40;
-
-_LIT(KUSBUIconFileName, "qtg_large_usb");
+_LIT(KUSBExe, "usbclasschangeui.exe");
+const TInt KUSBUIUid = 0x102068E2;
 
 // ================= MEMBER FUNCTIONS =========================================
 
@@ -60,7 +74,9 @@
 // might leave.
 // ----------------------------------------------------------------------------
 //
-CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier()
+CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier(): 
+    iNoteVisible(EFalse),
+    iNoteTapped(EFalse)
     {
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor"));
     }
@@ -76,7 +92,6 @@
     //this virtual function call is to the local CUSBUICableConnectedNotifier::
     //Cancel, not to any possibly derived class implementation. 
     Cancel();
-           
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor completed"));
     }
 
@@ -97,44 +112,46 @@
     }
 
 // ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::StartDialogL
+// CUSBUICableConnectedNotifier::GetParamsL
+//  Jump to RunL as soon as possible.
 // ----------------------------------------------------------------------------
 //
-void CUSBUICableConnectedNotifier::StartDialogL(const TDesC8& /*aBuffer*/,
+void CUSBUICableConnectedNotifier::GetParamsL(const TDesC8& /*aBuffer*/,
         TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL"));
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetParamsL"));
     if ( iReplySlot != 0 || iNeedToCompleteMessage)
         {
         User::Leave(KErrInUse);
         }
 
-    InitializeTextResolver();
-
     iMessage = aMessage;
     iNeedToCompleteMessage = ETrue;
     iReplySlot = aReplySlot;
-    if (iDialog)
-        {
-        FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL() deleting previous dialog"));
-        delete iDialog;
-        iDialog = NULL;
-        }
-    iDialog = CHbDeviceNotificationDialogSymbian::NewL(this);
-      
-    HBufC* header = NULL;
-    HBufC* description =NULL;   
-    GetPersonalityStringLC(header, description);
-   
-    iDialog->SetTitleL(*header);
-    iDialog->SetTextL(*description);
-    iDialog->SetIconNameL(KUSBUIconFileName );
-    iDialog->EnableTouchActivation(ETrue);
-    iDialog->ShowL();
-    
-    CleanupStack::PopAndDestroy(header);
-    CleanupStack::PopAndDestroy(description);
-    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL completed"));
+
+    // Call SetActive() so RunL() will be called by the active scheduler
+    //
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    SetActive();
+    User::RequestComplete(stat, KErrNone);
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetParamsL() completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::RunL
+// Ask user response and return it to caller.
+// ----------------------------------------------------------------------------
+//
+void CUSBUICableConnectedNotifier::RunL()
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL"));
+    iNoteVisible = ETrue;
+    DisableKeylock();
+    SuppressAppSwitching(ETrue);
+    RunQueryL();
+
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL() completed"));
     }
 
 // ----------------------------------------------------------------------------
@@ -145,72 +162,75 @@
 void CUSBUICableConnectedNotifier::Cancel()
     {
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() "));
-    if (iDialog)
+    // Not allowed to cancel this one before note is closed.
+    if ( iNoteVisible )
         {
-        iDialog->Close();
-        delete iDialog;
-        iDialog = NULL;
+        iNoteWaiter.Start();    
         }
+        
     CompleteMessage(KErrCancel);
     CUSBUINotifierBase::Cancel();
 
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed"));
     }
 
-// -----------------------------------------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
 // CUSBUICableConnectedNotifier::GetPersonalityStringL
-// Get the strings for the discreet popup dialog
-// -----------------------------------------------------------------------------------------------------------
+// Get the strings for ask on connection message query 
+// ----------------------------------------------------------------------------
 //
-void CUSBUICableConnectedNotifier::GetPersonalityStringLC(
+void CUSBUICableConnectedNotifier::GetPersonalityStringL(
        HBufC*& aHeader,HBufC*& aDescription )
     {
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL"));
-    _LIT(KFixedPart, "txt_usb_dpinfo_");
-    _LIT(KSpace, " ");
-    _LIT(KUnderline, "_");
-    _LIT(KUsbConnected, "txt_usb_dpophead_usb_connected");
     TInt CurrentPersonalityID = 0; // The ID of current USB mode
     GetCurrentIdL(CurrentPersonalityID);
     RUsb usbman;
     User::LeaveIfError(usbman.Connect());
-    FLOG(_L("[USBUINOTIF]\t usbman connect called"));     
     CleanupClosePushL(usbman);
-    HBufC* description = NULL;
     User::LeaveIfError(usbman.GetDescription(CurrentPersonalityID,
-            description));
-     FLOG(_L("[USBUINOTIF]\t get description called"));  
+            aDescription));
     CleanupStack::PopAndDestroy(&usbman);
-    
-    CleanupStack::PushL(description);
-    TPtr descriptionPtr = description->Des();
-    TInt position = descriptionPtr.Find(KSpace);
-    while (position != KErrNotFound)
-        {
-        descriptionPtr.Replace(position, 1, KUnderline);     
-        position = descriptionPtr.Find(KSpace); 
-        }
-    HBufC* textId = HBufC::NewL( KTextIdLength );
-    CleanupStack::PushL(textId);
-    TPtr textIdPtr = textId->Des();
-    textIdPtr.Append(KFixedPart);
-    textIdPtr.Append(descriptionPtr);  
+   
+    aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER);
 
-    aDescription = HbTextResolverSymbian::LoadL(textIdPtr);
-    CleanupStack::PopAndDestroy(textId);
-    CleanupStack::PopAndDestroy(description);
-    CleanupStack::PushL(aDescription);
-
-    FLOG(_L("[USBUINOTIF]\t get description called"));  
-    aHeader = HbTextResolverSymbian::LoadL(KUsbConnected);
-    FLOG(_L("[USBUINOTIF]\t get header called"));  
- 
-    CleanupStack::PushL(aHeader);
-    
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed"));
     }
 
 // ----------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::RunQueryL
+// Run the ask on connection message query
+// ----------------------------------------------------------------------------
+//
+void CUSBUICableConnectedNotifier::RunQueryL()
+    {
+    FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL()"));
+  
+    HBufC* header = NULL;
+    HBufC* description =NULL;
+    GetPersonalityStringL(header, description);
+  
+    CleanupStack::PushL(header);
+    CleanupStack::PushL(description);
+  
+    iNoteVisible = ETrue;
+    CAknDiscreetPopup::ShowGlobalPopupL(
+        *header,
+        *description,
+        KAknsIIDQgnPropUsb,
+        AknIconUtils::AvkonIconFileName(),
+        EMbmAvkonQgn_prop_usb,
+        EMbmAvkonQgn_prop_usb_mask,
+        KAknDiscreetPopupDurationLong,
+        EUSBUICmdDiscreetTapped,
+        (MEikCommandObserver*) this);
+   
+    CleanupStack::PopAndDestroy(description);
+    CleanupStack::PopAndDestroy(header);
+   
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
+    }
+// ----------------------------------------------------------------------------
 // CUSBUICableConnectedNotifier::GetCurrentIdL
 // get the current personality id
 // ----------------------------------------------------------------------------
@@ -222,53 +242,66 @@
     CRepository* repository = CRepository::NewL(KCRUidUsbWatcher);
     CleanupStack::PushL(repository);
     // Get the current USB mode
-    TInt ret = repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
-    FTRACE( FPrint(
-        _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::GetCurrentIdL() ret = %d" ),
-        ret ) );    
+    repository->Get(KUsbWatcherPersonality, aCurrentPersonality);
     CleanupStack::PopAndDestroy(repository);
     FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL completed"));
     }
 
-
+// ----------------------------------------------------------------------------
+// CUSBUICableConnectedNotifier::ProcessCommandL()
+// when discreet pop up is tapped the command will be handled here 
+// ----------------------------------------------------------------------------
+//
+void CUSBUICableConnectedNotifier::ProcessCommandL(TInt aCommandId)
+    {
+    FTRACE(FPrint(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL: %d"), 
+        aCommandId));
+    SuppressAppSwitching(EFalse);
+    
+    switch ( aCommandId )
+        {
+        case EUSBUICmdDiscreetTapped:
+            {
+            TUidType uidtype(KExecutableImageUid, TUid::Null(), TUid::Uid(KUSBUIUid));
+            CreateChosenViewL(KUSBExe(),uidtype);
+            iNoteTapped = ETrue;
+            }
+            //fall through
+        case EAknDiscreetPopupCmdClose:
+            if ( iNoteWaiter.IsStarted() )
+                {
+                iNoteWaiter.AsyncStop();
+                }
+            iNoteVisible = EFalse;
+            CompleteMessage( KErrCancel );
+            break;
+        default:
+            break;
+        }
 
-void CUSBUICableConnectedNotifier::NotificationDialogActivated(
-        const CHbDeviceNotificationDialogSymbian* /*aDialog*/)
-       {
-       
-           FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogActivated()"));
-           TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
-                                   TUid::Uid(KUSBUIUid));
-           iDialog->Close();
-           LaunchApplication(KUSBExe(), uidtype);
-         
-       }
-   
-void CUSBUICableConnectedNotifier::NotificationDialogClosed(
-        const CHbDeviceNotificationDialogSymbian* /*aDialog*/, TInt /*aCompletionCode*/)
-       {
-       FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogClosed()"));
-       CompleteMessage( KErrCancel ); 
-       FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogClosed() complete"));
+    if (!iNoteTapped)
+        {
+        FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL() restore keylock"));
+        RestoreKeylock();
+        }
 
-       }
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::ProcessCommandL() completed"));
+    }
+
 // ---------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::LaunchApplication()
-// launches the application 
+// CUSBUICableConnectedNotifier::CreateChosenViewL()
+// creates the USB UI setting view
 // ---------------------------------------------------------------------------
 //  
-void CUSBUICableConnectedNotifier::LaunchApplication(const TDesC & aProcessName, 
-        const TUidType & aUidType) const
+void CUSBUICableConnectedNotifier::CreateChosenViewL(
+    const TDesC & aProcessName, const TUidType & aUidType) const
     {                 
-    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 ) );    
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
+    RProcess usbUiProcess;
+    User::LeaveIfError(usbUiProcess.Create(aProcessName, KNullDesC, aUidType));
     usbUiProcess.Resume();
-    usbUiProcess.Close();                     
-    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() completed"));             
+    usbUiProcess.Close();
+    FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::CreateDesiredViewL() "));
     }
 
 // End of File
--- a/usbuis/usbuinotif/src/usbuinmain.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinmain.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -19,17 +19,22 @@
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
 #include <eiknotapi.h>
+#include <eikenv.h>
+#include <AknNotifierWrapper.h>
+#include <usbuinotif.h>
 
 #include "usbuincableconnectednotifier.h"
-#include "usbuinqueriesnotifiermdrv.h"
+#include "usbuinqueriesnotifier.h"
+
+
 #include "usbuinotifdebug.h"
 #include "usbuinotifotgwarning.h"    
 #include "usbuinotifotgerror.h"    
 #include "usbuinotifmsmmerror.h" 
 
 // CONSTANTS
-const TInt KUSBUINotifierArrayIncrement = 5;
-
+const TInt KUSBUINotifierArrayIncrement = 4;
+_LIT( KUSBUINotifdll, "usbavkonnotif.dll" ); 
 // ================= EXPORTED FUNCTIONS =======================================
 // ----------------------------------------------------------------------------
 //
@@ -41,12 +46,20 @@
     {
     FLOG(_L("[USBUINOTIF]\t CreateUSBUINotifiersL"));
 
-    CUSBUICableConnectedNotifier* cableConnectedNotifier =
-        CUSBUICableConnectedNotifier::NewL();
-    CleanupStack::PushL( cableConnectedNotifier );
-    aNotifiers->AppendL( cableConnectedNotifier );
-    CleanupStack::Pop( cableConnectedNotifier );
-
+    /* 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 );
     CUSBUIQueriesNotifier* queriesNotifier = CUSBUIQueriesNotifier::NewL();
     CleanupStack::PushL( queriesNotifier );
     aNotifiers->AppendL( queriesNotifier );
@@ -114,9 +127,9 @@
 // ----------------------------------------------------------------------------
 
 const TImplementationProxy ImplementationTable[] =
-{
+    {
     IMPLEMENTATION_PROXY_ENTRY( 0x10281F23, NotifierArray )
-};
+    };
 
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
         TInt& aTableCount)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* 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 <vwsdef.h>
+
+
+#include "usbuinotifdialerwatcher.h"
+#include "debug.h"
+#include "usbuinotifdebug.h"
+
+const TUid KDiallerUid  = { 0x100058B3 };
+const TUid KDiallerViewId = { 0x10282D81 };
+const TUid KDiallerViewCommand  = { 0x1 };
+
+
+
+// ======== 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(KDiallerUid, KDiallerViewId );
+        TUid msgId = KDiallerViewCommand;            
+        iwsSession->CreateActivateViewEvent( viewId, msgId, KNullDesC8  );            
+        CCoeAppUi* appui=CEikonEnv::Static()->AppUi();                        
+        iNotify->DialerActivated();
+        iwsSession->NotifyNextDeactivation(viewId);  
+        }
+        
+    return EKeyWasNotConsumed;
+    }
+
--- a/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 - 2010 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"
@@ -11,25 +11,29 @@
 *
 * Contributors:
 *
-* Description:  USB UI MSMM Error notifier class.
+* Description:  USB UI queries notifier class.
  *
 */
 
 
 // INCLUDE FILES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>      // dialog
-#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h> //discreet
-#include <hb/hbcore/hbtextresolversymbian.h>
-#include <usb/hostms/srverr.h>
+#include <eikenv.h>          // Eikon environment
+#include <bautils.h>         // BAFL utils (for language file)
+#include <utf.h>             // Unicode character conversion utilities
+#include <StringLoader.h>    // Localisation stringloader
+#include <AknQueryDialog.h> 
+#include <aknnotewrappers.h>
+#include <usb/hostms/srverr.h> 
+#include <featmgr.h>
+
 #include <usbuinotif.h>                     // pck
+#include <usbuinotif.rsg>                   // Own resources
+#include <secondarydisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
+
 #include "usbuinotifmsmmerror.h"            // Own class definition
 #include "usbuinotifdebug.h"                // Debugging macros
 
 
-// CONSTANTS
-/** granularity for allocating error strings */
-const TInt KUsbMsmmErrorGranularity = 5; 
-_LIT(KUSBUIconFileName, "qtg_large_usb");
 // ================= MEMBER FUNCTIONS =========================================
 
 // ----------------------------------------------------------------------------
@@ -53,7 +57,7 @@
 // ----------------------------------------------------------------------------
 //
 CUsbUiNotifMSMMError::CUsbUiNotifMSMMError() :
-    iStringIds(NULL)
+    iStringIds( KUsbUiNotifOtgGeneralQueryGranularity)
     {
     }
 
@@ -66,25 +70,17 @@
     //Make sure that the request is completed. Note that inside the destructor,
     //this virtual function call is to local CUsbUiNotifMSMMError::Cancel, 
     //not to any possibly derived class implementation. 
-    delete iStringIds;
     Cancel();
+    delete iDialerWatcher;    
+    delete iQuery;    
     }
 
 void CUsbUiNotifMSMMError::ConstructL()
     {
     CUSBUINotifierBase::ConstructL();
-    iStringIds = new (ELeave) CDesCArrayFlat(KUsbMsmmErrorGranularity);
-    _LIT(KGeneralError,"txt_usb_info_error_in_usb_connection_disconnect_d");
-    _LIT(KUnknownFileSys, "txt_usb_info_unknown_file_system_disconnect_devic");
-    _LIT(KOutOfMemory, "txt_usb_info_disk_full_remove_some_files_and_try");
-    _LIT(KSafeToRemove, "txt_usb_dpinfo_safe_to_remove");
-    _LIT(KUnableToEject,"txt_usb_info_unable_to_eject_the_usb_device_some" );
-    
-    iStringIds->AppendL(KGeneralError);
-    iStringIds->AppendL(KUnknownFileSys);
-    iStringIds->AppendL(KOutOfMemory);
-    iStringIds->AppendL(KSafeToRemove);
-    iStringIds->AppendL(KUnableToEject);
+    iStringIds.AppendL( R_USB_MSMM_ERROR_GENERAL_MASS_STORAGE_ERROR);
+    iStringIds.AppendL( R_USB_MSMM_ERROR_UNKNOWN_FILESYSTEM);
+    iStringIds.AppendL( R_USB_MSMM_ERROR_OUT_OF_MEMORY);  
     }
 
 // ----------------------------------------------------------------------------
@@ -105,89 +101,76 @@
 //  Jump to RunL as soon as possible.
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifMSMMError::StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+void CUsbUiNotifMSMMError::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
         const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL"));
-    if (iReplySlot != 0 || iNeedToCompleteMessage)
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL"));
+    if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage)
         {
         User::Leave( KErrInUse );
         }
 
-    InitializeTextResolver();
-
     iMessage = aMessage;
     iNeedToCompleteMessage = ETrue;
     iReplySlot = aReplySlot;
-    _LIT(KUsbDisconnected, "txt_usb_dpophead_usb_disconnected");
+
     // Get parameters 
     //    
     THostMsErrData error;
-    TPckgC<THostMsErrData> pckg( error );
+    TPckgC<THostMsErrData> pckg( error);
     pckg.Set( aBuffer );
-    int errorId = EUsbMSMMGeneralError;
     switch (pckg().iError)
         {
         case  EHostMsErrUnknownFileSystem:
-            errorId = EUsbMSMMUnknownFileSystem;
+            iErrorId = EUsbMSMMUnknownFileSystem;
             break;        
         case  EHostMsErrOutOfMemory:
-            errorId = EUsbMSMMOutOfMemory;
-            break;       
-        case EHostMsErrNone:
-            errorId = EUsbMSMMSafeToRemove;
-            break;
-        case EHostMsErrInUse:
-            errorId = EUsbMSMMUnableToEject;
-            break;
+            iErrorId = EUsbMSMMOutOfMemory;
+            break;        
         default:
-            errorId = EUsbMSMMGeneralError;
+            iErrorId = EUsbMSMMGeneralError;
         }
-    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(errorId)); 
-   
-   
-    if ( errorId == EUsbMSMMSafeToRemove)
-        {
-        // "safe to remove" discreet popup
-        HBufC* header = HbTextResolverSymbian::LoadLC(KUsbDisconnected);
-        if (iDiscreet)
+
+    SetActive();
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, KErrNone );
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL() completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUsbUiNotifMSMMError::RunL
+// Ask user response and return it to caller.
+// ----------------------------------------------------------------------------
+//
+void CUsbUiNotifMSMMError::RunL()
+    {
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL"));
+    TInt returnValue = KErrNone;
+    FeatureManager::InitializeLibL();
+    if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) )
+        { 
+        if (!iDialerWatcher)
             {
-             FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog"));
-             delete iDiscreet;
-             iDiscreet = NULL;
+            iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this);
             }
-        iDiscreet = CHbDeviceNotificationDialogSymbian::NewL(this);
-        iDiscreet->SetTitleL(*header);
-        iDiscreet->SetTextL(*stringHolder);
-        iDiscreet->SetIconNameL(KUSBUIconFileName );
-        iDiscreet->ShowL();
-        CleanupStack::PopAndDestroy( header );   
-        }
-    else
+        }        
+    iDismissed=EFalse;
+    DisableKeylock();
+    SuppressAppSwitching( ETrue );
+
+    //Excute dialog and check return value
+    returnValue = QueryUserResponseL();
+    if (!iDismissed)
         {
-         //Delete the query in case the client didn't cancel the notifier 
-   			 //or close the session after the previous query.
-   
-        if (iQuery)
-            {
-            FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog"));
-            delete iQuery;
-            iQuery = NULL;
-            }
-        
-        iQuery = CHbDeviceMessageBoxSymbian::NewL(
-                CHbDeviceMessageBoxSymbian::EWarning, this);
-        iQuery->SetTimeout(0);
-    
-  
-        iQuery->SetTextL(*stringHolder);
-        iQuery->ShowL();
+        SuppressAppSwitching( EFalse );
+        RestoreKeylock();
+        delete iDialerWatcher;
+        iDialerWatcher = NULL;
+        CompleteMessage( returnValue );
         }
-   
-    CleanupStack::PopAndDestroy( stringHolder );
-   
-        
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() completed"));
+
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL() completed"));
     }
 
 // ----------------------------------------------------------------------------
@@ -198,64 +181,92 @@
 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)
         {
-        FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel closing iQuery"));
-        iQuery->Close();
-        FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery closed"));
         delete iQuery;
-        FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel iQuery deleted"));
         iQuery = NULL;
         }
-    if (iDiscreet)
-        {
-        iDiscreet->Close();
-        delete iDiscreet;
-        iDiscreet = NULL;
-        }
-    CUSBUINotifierBase::Cancel();
+
+
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed"));
     }
 
 // ----------------------------------------------------------------------------
-// Call back function to observe device message box closing.
+// 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. 
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifMSMMError::MessageBoxClosed(
-        const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
-        CHbDeviceMessageBoxSymbian::TButtonId aButton)
+TInt CUsbUiNotifMSMMError::QueryUserResponseL()
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed"));
-    int returnValue = KErrNone;
+    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 );
+        }
     
-    //iQuery will be deleted in Cancel. If Cancel is not called, it will be
-    //deleted next time the query is shown. 
+    
+    iDismissed=EFalse;
+    if (iCoverDisplaySupported)
+        {
+        iQuery->PublishDialogL( iErrorId, KUsbUiNotifMsmmError );
+        }
+    HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] );
 
-    if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) 
-        {
-        returnValue = KErrNone;
-        } 
-    else 
-        {
-        returnValue = KErrCancel;
-        }
+    TInt keypress = iQuery->ExecuteLD( resourceId, *stringHolder );
+
+    CleanupStack::PopAndDestroy( stringHolder );
 
-    CompleteMessage( returnValue );
-    
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));    
+    iQuery = NULL; // Dialog destroyed
+
+    returnValue = keypress ? KErrNone : KErrCancel; //OK?
+
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::QueryUserResponseL completed"));
+    return returnValue;
     }
 
-void CUsbUiNotifMSMMError::NotificationDialogActivated(
-     const CHbDeviceNotificationDialogSymbian* /*aDialog*/)
-	{
-       
-	}
-   
-void CUsbUiNotifMSMMError::NotificationDialogClosed(
-        const CHbDeviceNotificationDialogSymbian* /*aDialog*/, TInt /*aCompletionCode*/)
-	{
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed()"));
-    CompleteMessage( KErrCancel ); 
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed() complete"));
-    }
 // End of File
--- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007, 2009 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"
@@ -17,16 +17,21 @@
 
 
 // INCLUDE FILES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>      // dialog
-#include <hb/hbcore/hbtextresolversymbian.h>
+#include <eikenv.h>          // Eikon environment
+#include <bautils.h>         // BAFL utils (for language file)
+#include <utf.h>             // Unicode character conversion utilities
+#include <StringLoader.h>    // Localisation stringloader
+#include <AknQueryDialog.h> 
+#include <aknnotewrappers.h>
+#include <featmgr.h>
+
 #include <usbuinotif.h>                     // pck
+#include <usbuinotif.rsg>                   // Own resources
+#include <secondarydisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
+
 #include "usbuinotifotgerror.h"             // Own class definition
 #include "usbuinotifdebug.h"                // Debugging macros
 
-// CONSTANTS
-/** granularity for allocating error strings */
-const TInt KUsbOtgErrorGranularity = 7; 
-
 
 // ================= MEMBER FUNCTIONS =========================================
 
@@ -51,7 +56,7 @@
 // ----------------------------------------------------------------------------
 //
 CUsbUiNotifOtgError::CUsbUiNotifOtgError() :
-    iStringIds(NULL)
+    iStringIds( KUsbUiNotifOtgGeneralQueryGranularity)
     {
     }
 
@@ -64,29 +69,21 @@
     //Make sure that the request is completed. Note that inside the destructor,
     //this virtual function call is to local CUsbUiNotifOtgError::Cancel, 
     //not to any possibly derived class implementation. 
-    delete iStringIds;
     Cancel();
+    delete iDialerWatcher;    
+    delete iQuery;    
     }
 
 void CUsbUiNotifOtgError::ConstructL()
     {
     CUSBUINotifierBase::ConstructL();
-    iStringIds = new (ELeave) CDesCArrayFlat(KUsbOtgErrorGranularity);
-    _LIT(KCurrentLimit, "txt_usb_info_error_in_usb_connection_disconnect_d");
-    _LIT(KTooMuchCurrent, "txt_usb_info_unsupported_usb_device_disconnect_de");
-    _LIT(KUnsupported, "txt_usb_info_unsupported_usb_device_disconnect_de");
-    _LIT(KHubUnsupported, "txt_usb_info_hubs_are_not_supported_disconnect_us");
-    _LIT(KUnRecoverable, "txt_usb_info_error_in_usb_connection_disconnect_d");
-    _LIT(KAttachTimeOut, "txt_usb_info_remove_usb_cable_or_connect_a_device");
-    _LIT(KNotEnoughMemory, "txt_usb_info_memory_full_close_some_applications");
-    iStringIds->AppendL( KCurrentLimit);
-    iStringIds->AppendL( KTooMuchCurrent);
-    iStringIds->AppendL( KUnsupported);
-    iStringIds->AppendL( KHubUnsupported);
-    iStringIds->AppendL( KUnRecoverable);
-    iStringIds->AppendL( KAttachTimeOut);
-    iStringIds->AppendL( KNotEnoughMemory);
-   
+    iStringIds.AppendL( R_USB_OTG_ERROR_CURRENT_LIMIT);
+    iStringIds.AppendL( R_USB_OTG_ERROR_TOO_MUCH_CURRENT_REQUIRED);
+    iStringIds.AppendL( R_USB_OTG_ERROR_UNSUPPORTED);
+    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);
     }
 
 // ----------------------------------------------------------------------------
@@ -107,47 +104,74 @@
 //  Jump to RunL as soon as possible.
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifOtgError::StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
+void CUsbUiNotifOtgError::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
         const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::StartDialogL"));
-    if (iReplySlot != 0 || iNeedToCompleteMessage)
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL"));
+    if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage)
         {
         User::Leave( KErrInUse );
         }
-  
-    InitializeTextResolver();
+        
+    // Get parameters 
+    //
     
-    TInt errorId = 0;
-    TPckgC<TInt> pckg( errorId );
+    TPckgC<TInt> pckg( iErrorId );
     pckg.Set( aBuffer );
-    errorId = pckg();
+    iErrorId = pckg();
     
-    FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), errorId ));  
-    if ( errorId < 0 || errorId >= iStringIds->MdcaCount())
+    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;
-   
-    if (iQuery)
-            {
-            delete iQuery;
-            iQuery = NULL;
-            }
+    iReplySlot = aReplySlot;  
+	  
+    SetActive();
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, KErrNone );    
         
-        iQuery = CHbDeviceMessageBoxSymbian::NewL(
-                CHbDeviceMessageBoxSymbian::EWarning, this);
-        iQuery->SetTimeout(0);
-        HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(errorId) );
-        iQuery->SetTextL(*stringHolder);
-        iQuery->ShowL();
-        CleanupStack::PopAndDestroy( stringHolder );
-            
-    
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::StartDialogL completed"));
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL() completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUsbUiNotifOtgError::RunL
+// Ask user response and return it to caller.
+// ----------------------------------------------------------------------------
+//
+void CUsbUiNotifOtgError::RunL()
+    {
+    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 );
+        }
+
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed"));
     }
 
 // ----------------------------------------------------------------------------
@@ -157,44 +181,93 @@
 //
 void CUsbUiNotifOtgError::Cancel()
     {
-    FLOG(_L("[USBUINOTIF]\t 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 );
+        }        
     if (iQuery)
         {
-        iQuery->Close();
         delete iQuery;
         iQuery = NULL;
         }
-    CUSBUINotifierBase::Cancel();
-
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
     }
+
 // ----------------------------------------------------------------------------
-// Call back function to observe device message box closing.
+// CUsbUiNotifOtgError::DialerActivated
+// Release all own resources (member variables)
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifOtgError::MessageBoxClosed(
-        const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
-        CHbDeviceMessageBoxSymbian::TButtonId aButton)
+void CUsbUiNotifOtgError::DialerActivated()
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed"));
-    int returnValue = KErrNone;
-    
-    //iQuery will be deleted in Cancel. If Cancel is not called, it will be
-    //deleted next time the query is shown. 
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()"));
+    if ( iQuery )
+        {
+        iDismissed=ETrue;    
+        Cancel();
+        }    
+    }
 
-    if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) 
-        {
-        returnValue = KErrNone;
-        } 
-    else 
+// ----------------------------------------------------------------------------
+// CUsbUiNotifOtgError::ReActivateDialog
+// Release all own resources (member variables)
+// ----------------------------------------------------------------------------
+//   
+void CUsbUiNotifOtgError::ReActivateDialog()
+    {    
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()"));
+    if ( !IsActive())
         {
-        returnValue = KErrCancel;
+        SetActive();
+        iStatus = KRequestPending;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
         }
-
-    CompleteMessage( returnValue );
-    
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));    
     }
 
+// ----------------------------------------------------------------------------
+// CUsbUiNotifOtgError::QueryUserResponseL
+// Show query dialog. 
+// ----------------------------------------------------------------------------
+//
+TInt CUsbUiNotifOtgError::QueryUserResponseL()
+    {
+    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;
+    if (iCoverDisplaySupported)
+        {
+        iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError );
+        }
+    HBufC *stringHolder = StringLoader::LoadLC( iStringIds[iErrorId] );
+
+    TInt keypress = iQuery->ExecuteLD( resourceId, *stringHolder );
+
+    CleanupStack::PopAndDestroy( stringHolder );
+
+    iQuery = NULL; // Dialog destroyed
+
+    returnValue = keypress ? KErrNone : KErrCancel; //OK?
+
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL completed"));
+    return returnValue;
+    }
 
 // End of File
--- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007, 2009 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"
@@ -17,15 +17,17 @@
 
 
 // INCLUDE FILES
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>  
-#include <hb/hbcore/hbtextresolversymbian.h>
-#include "usbuinotifotgwarning.h"        // Own class definition
-#include "usbuinotifdebug.h"                // Debugging macros
+#include <eikenv.h>             // Eikon environment
+#include <aknnotedialog.h>
+#include <bautils.h>            // BAFL utils (for language file)
+#include <StringLoader.h>       // Localisation stringloader
+#include <AknMediatorFacade.h>  // for cover display support
+#include <usbuinotif.rsg>       // Own resources
+#include <secondarydisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
 
+#include "usbuinotifotgwarning.h"        // Own class definition
+#include "usbuinotifdebug.h"             // Debugging macros
 
-// CONSTANTS
-/** granularity for allocating warning strings */
-const TInt KUsbOtgWarningGranularity = 1; 
 
 // ================= MEMBER FUNCTIONS =========================================
 
@@ -52,7 +54,7 @@
 // ----------------------------------------------------------------------------
 //
 CUsbUiNotifOtgWarning::CUsbUiNotifOtgWarning() :
-    iStringIds(NULL), iNote( NULL)
+    iStringIds( KUsbUiNotifOtgGeneralNoteGranularity), iNote( NULL)
     {
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::constructor()"));
     }
@@ -67,7 +69,6 @@
     //Make sure that the request is completed. Note that inside the destructor,
     //this virtual function call is to local CUsbUiNotifOtgWarning::Cancel, 
     //not to any possibly derived class implementation. 
-    delete iStringIds;
     Cancel();
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::destructor completed()"));
     }
@@ -75,9 +76,7 @@
 void CUsbUiNotifOtgWarning::ConstructL()
     {
     CUSBUINotifierBase::ConstructL();
-    iStringIds = new (ELeave) CDesCArrayFlat(KUsbOtgWarningGranularity);
-    _LIT(KPartiallySupported, "txt_usb_info_partially_supported_usb_device_connec");
-    iStringIds->AppendL( KPartiallySupported);
+    iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORT);
     }
 
 // ----------------------------------------------------------------------------
@@ -106,11 +105,10 @@
     if (iNote)
         {
         FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel - delete iNote"));
-        iNote->Close();
         delete iNote;
         iNote = NULL;
         }
-    CUSBUINotifierBase::Cancel();
+    CompleteMessage( KErrNone );
 
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel() completed"));
     }
@@ -121,73 +119,67 @@
 // This notifier is synchronous so this function is not used.
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifOtgWarning::StartDialogL(const TDesC8& aBuffer,
+void CUsbUiNotifOtgWarning::GetParamsL(const TDesC8& aBuffer,
         TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::StartDialogL"));
-    if (iReplySlot != 0 || iNeedToCompleteMessage)
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL"));
+    if (iNote || iReplySlot != 0 || iNeedToCompleteMessage)
         {
         User::Leave( KErrInUse );
         }
-        
-    InitializeTextResolver();
-
-    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->MdcaCount())
+    
+    FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL iNoteId: %d"), iNoteId ));  
+    if ( iNoteId < 0 || iNoteId >= iStringIds.Count() )
         {        
         User::Leave( KErrArgument);        
-        }   
-    if (iNote)
-            {
-            delete iNote;
-            iNote = NULL;
-            }
-        
-    iNote = CHbDeviceMessageBoxSymbian::NewL(
-                CHbDeviceMessageBoxSymbian::EWarning, this);
-    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(iNoteId) );
-    iNote->SetTextL(*stringHolder);
-    iNote->ShowL();
-    CleanupStack::PopAndDestroy( stringHolder );
-   
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::StartDialogL completed"));
+        }  
+    
+    iMessage = aMessage;
+    iNeedToCompleteMessage = ETrue;
+    iReplySlot = aReplySlot;
+    
+    SetActive();
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, KErrNone );
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------------------------
-// Call back function to observe device message box closing.
+// CUsbUiNotifOtgWarning::RunL
+// Mandatory for Active Objects. This notifier is synchronous 
+// so this function is not used.
 // ----------------------------------------------------------------------------
 //
-void CUsbUiNotifOtgWarning::MessageBoxClosed(
-        const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
-        CHbDeviceMessageBoxSymbian::TButtonId aButton)
+void CUsbUiNotifOtgWarning::RunL()
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed"));
-    int returnValue = KErrNone;
-    
-    //iQuery will be deleted in Cancel. If Cancel is not called, it will be
-    //deleted next time the query is shown. 
+    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RunL"));
 
-    if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) 
+    // Create confirmation note
+    //    
+    HBufC* str = StringLoader::LoadL( iStringIds[iNoteId] );
+    CleanupStack::PushL( str );
+    iNote = new (ELeave) CAknWarningNote( ETrue );
+
+    iNote->SetTimeout( CAknNoteDialog::ENoTimeout );
+
+    if (iCoverDisplaySupported)
         {
-        returnValue = KErrNone;
-        } 
-    else 
-        {
-        returnValue = KErrCancel;
+        iNote->PublishDialogL( iNoteId, KUsbUiNotifOtgWarning );
         }
 
-    CompleteMessage( returnValue );
-    
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));    
+    TInt t = iNote->ExecuteLD( *str );
+    iNote = NULL;
+    CleanupStack::PopAndDestroy( str );
+
+    CompleteMessage( KErrNone );
+  FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RunL() completed"));
     }
 
 // End of File
--- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -16,10 +16,17 @@
  */
 
 // INCLUDE FILES
+#include <eikenv.h>          // Eikon environment
+#include <bautils.h>         // BAFL utils (for language file)
+#include <utf.h>             // Unicode character conversion utilities
+#include <StringLoader.h>    // Localisation stringloader
+#include <AknQueryDialog.h> 
+#include <aknnotewrappers.h>
 
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
-#include <hb/hbcore/hbtextresolversymbian.h>
 #include <usbuinotif.h>                     // pck
+#include <usbuinotif.rsg>                   // Own resources
+#include <secondarydisplay/usbuinotifsecondarydisplay.h>     // Dialog index for cover UI
+
 #include "usbuinqueriesnotifiermdrv.h"      // Own class definition
 #include "usbuinotifdebug.h"                // Debugging macros
 
@@ -78,21 +85,49 @@
     return iInfo;
     }
 
+// ----------------------------------------------------------------------------
+// CUSBUIQueriesNotifier::StartL
+// Synchronic notifier launch. 
+// ----------------------------------------------------------------------------
+//
+TPtrC8 CUSBUIQueriesNotifier::StartL(const TDesC8& aBuffer)
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartL()"));
+
+    TUSBQueriesNotiferParams params; //stores parameters from aBuffef
+    TPckgC<TUSBQueriesNotiferParams> pckg( params );
+    pckg.Set( aBuffer );
+    // Save the type of the query for later use (dialog selection)
+    //
+
+    if (pckg().iQuery == EUSBNoMemoryCard)
+        {
+        TRAPD( err, GetParamsL( aBuffer, 0, iMessage ));
+        if (err)
+            {
+            iNeedToCompleteMessage = EFalse;
+            User::Leave( err );
+            }
+        }
+
+    TPtrC8 ret( KNullDesC8 );
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartL() completed"));
+    return (ret);
+    }
 
 // ----------------------------------------------------------------------------
 // CUSBUIQueriesNotifier::GetParamsL
+//  Jump to RunL as soon as possible.
 // ----------------------------------------------------------------------------
 //
-void CUSBUIQueriesNotifier::StartDialogL(const TDesC8& aBuffer,
+void CUSBUIQueriesNotifier::GetParamsL(const TDesC8& aBuffer,
         TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[USBUINOTIF]\t  CUSBUIQueriesNotifier::StartDialogL"));
-    if ( iReplySlot != 0 || iNeedToCompleteMessage)
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetParamsL"));
+    if (iUSBQueryDlg || iReplySlot != 0 || iNeedToCompleteMessage)
         {
         User::Leave( KErrInUse );
         }
-        
-    InitializeTextResolver();
 
     iMessage = aMessage;
     iNeedToCompleteMessage = ETrue;
@@ -106,54 +141,59 @@
     // Save the type of the query for later use (dialog selection)
     //
     iQueryType = pckg().iQuery;
-         
-    if (iUSBQueryDlg)
+    if (iQueryType == EUSBNoMemoryCard)
         {
-        delete iUSBQueryDlg;
-        iUSBQueryDlg = NULL;
+        iNeedToCompleteMessage = EFalse;
         }
-    iUSBQueryDlg = CHbDeviceMessageBoxSymbian::NewL(
-                       CHbDeviceMessageBoxSymbian::EWarning, this);
-    iUSBQueryDlg->SetTimeout(0);
-    HBufC* stringHolder = NULL;
-    switch (iQueryType)
-            {
-            case EUSBStorageMediaFailure:
-                {
-                _LIT(KMassStorageFail, "txt_usb_info_unable_to_show_a_memory_to_other_devi");
-                stringHolder = HbTextResolverSymbian::LoadLC( KMassStorageFail );
-                 break;
-                }
-            case EUSBDiskFull:
-                {
-                _LIT(KDiskFull, "txt_usb_info_disk_full_remove_some_files_and_try");
-                stringHolder = HbTextResolverSymbian::LoadLC( KDiskFull );
-		         break;
-                }
-            case EUSBNotEnoughRam:
-                {
-                _LIT(KNotEnoughMemory, "txt_usb_info_memory_full_close_some_applications");
-                 stringHolder = HbTextResolverSymbian::LoadLC( KNotEnoughMemory );
-                 break;
-                }
-            default:
-                {
-                FTRACE( FPrint( _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),iQueryType ) );
-                }
-            }
-   
-    if (stringHolder)
+    // Call SetActive() so RunL() will be called by the active scheduler
+    //
+    SetActive();
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete( stat, KErrNone );
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetParamsL() completed"));
+    }
+
+// ----------------------------------------------------------------------------
+// CUSBUIQueriesNotifier::RunL
+// Ask user response and return it to caller.
+// ----------------------------------------------------------------------------
+//
+void CUSBUIQueriesNotifier::RunL()
+    {
+    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, isErrorQuery );
+
+    //check if query text string loading was successful
+    if (NULL != stringHolder)
         {
-        iUSBQueryDlg->SetTextL(*stringHolder);
+        DisableKeylock();
+        SuppressAppSwitching( ETrue );
+        returnValue = QueryUserResponseL( *stringHolder, coverDialogId,
+                isCancelKey, isErrorQuery );
+        SuppressAppSwitching( EFalse );
+        RestoreKeylock();
+        CleanupStack::PopAndDestroy( stringHolder );
         }
-        
-    iUSBQueryDlg->ShowL();
-    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL() ShowL returned"));     
-    
-    CleanupStack::PopAndDestroy( stringHolder );
-    
-    
-    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL completed"));
+    else
+        {
+        returnValue = KErrUnknown;
+        }
+
+    CompleteMessage( returnValue );
+    // cancelling the notifier so that next one on the queue can be displayed.
+    // it may be that the client calls cancel too, but it is ok
+    iManager->CancelNotifier( iInfo.iUid );
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RunL() completed"));
     }
 
 // ----------------------------------------------------------------------------
@@ -166,40 +206,134 @@
     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::Cancel"));
     if (iUSBQueryDlg)
         {
-        iUSBQueryDlg->Close();
         delete iUSBQueryDlg;
         iUSBQueryDlg = NULL;
         }
- 
+    CompleteMessage( KErrCancel );
+
     CUSBUINotifierBase::Cancel();
     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::Cancel() completed"));
     }
 
-
-void CUSBUIQueriesNotifier::MessageBoxClosed(
-        const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
-        CHbDeviceMessageBoxSymbian::TButtonId aButton)
+// ----------------------------------------------------------------------------
+// CUSBUIQueriesNotifier::QueryUserResponseL
+// Show query dialog. 
+// ----------------------------------------------------------------------------
+//
+TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder,
+        TInt aCoverDialogId, TBool aIsCancelKey, TBool aIsErrorQuery)
     {
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed"));
-    int returnValue = KErrNone;
-    
-    //iQuery will be deleted in Cancel. If Cancel is not called, it will be
-    //deleted next time the query is shown. 
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL"));
+    TInt returnValue = KErrNone;
+
+    iUSBQueryDlg = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
 
-    if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) 
+    // Show dialog with or without the Cancel
+    //
+    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 );
+        }
+    else
+        {
+        iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITHOUT_CANCEL );
+        }
+
+    if (iCoverDisplaySupported)
+        {
+        iUSBQueryDlg->PublishDialogL( aCoverDialogId, KUSBUINotifCategory );
+        }
+
+    iUSBQueryDlg->SetPromptL( aStringHolder );
+    iUSBQueryDlg->SetFocus( ETrue );
+        FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL calling RunLD"));
+    TInt keypress = iUSBQueryDlg->RunLD();
+
+    iUSBQueryDlg = NULL;
+
+    if (keypress) // User has accepted the dialog
         {
         returnValue = KErrNone;
-        } 
-    else 
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL keypress"));
+        }
+    else
         {
         returnValue = KErrCancel;
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL NO keypress"));
         }
 
-    CompleteMessage( returnValue );
-    
-    FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));    
+        FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL completed"));
+    return returnValue;
     }
 
-
+// ----------------------------------------------------------------------------
+// CUSBUIQueriesNotifier::GetQueryAttributesLC
+// Get query text and the other attributes for the query dialog. 
+// ----------------------------------------------------------------------------
+//
+HBufC* CUSBUIQueriesNotifier::GetQueryAttributesLC(TInt& aCoverDialogId,
+        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:
+            {
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBStorageMediaFailure"));
+            stringHolder = StringLoader::LoadLC( R_USB_STORAGE_MEDIA_FAILURE );
+            aCoverDialogId = EUSBCoverStorageMediaFailure;
+            break;
+            }
+        case EUSBChangeFromMassStorage:
+            {
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBChangeFromMassStorage"));
+            stringHolder = StringLoader::LoadLC( R_USB_CHANGE_FROM_MASS_STORAGE );
+            aIsCancelKey = ETrue;
+            aCoverDialogId = EUSBCoverChangeFromMassStorage;
+            break;
+            }
+        case EUSBNoMemoryCard:
+            {
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNoMemoryCard"));
+            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;
+            }
+        case EUSBDiskFull:
+          	{
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBDiskFull"));
+            stringHolder = StringLoader::LoadLC( R_USB_ERROR_DISK_FULL );
+            aCoverDialogId = EUSBCoverNoMemoryCard;
+            //set flag to change the icon of querydialog (see QueryUserResponseL())
+            aIsErrorQuery = ETrue;
+            break;
+            }
+        default:
+            {
+            FTRACE( FPrint( _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),
+                            iQueryType ) );
+            }
+        }
+    FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC completed"));
+    return stringHolder;
+    }
 
 // End of File
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg	Wed Sep 01 12:20:49 2010 +0100
@@ -1,392 +1,230 @@
- // USB UI Notif tests -  total 33 tc
-
-[Define]
-//Message box OK button coordinates
-OK_X 180
-OK_Y 397
-
-//Message box pause before OK
-OK_PAUSE 1500
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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
+*
+*/
 
-//Message box pause before dismiss (enter key)
-DISMISS_PAUSE 1500
-
-//Device notification dialog touch coordinates
-DEVICENOTIF_X 141
-DEVICENOTIF_Y 47
+// UsbUiNotifApiTest Module - total 21 tc
 
-//Device notification dialog pause before touch
-DEVICENOTIF_PAUSE 1000
-[Enddefine]
+// UsbUiNotifApiTest Api Tests (... tc)
 
-
-// Cable connected notifier tests
+// Cable connected notifier tests (3)
 
 [Test]
-title USB Cable Connected (Cable Connected Notifier Test)
-create USBUiNotifApiTest tester
-tester CableConnectedNotifierTest PCSUITEMTP
-tester FinishCableConnectedQuery CANCEL
+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 Cable Connected cancel (Cable Connected Notifier Test)
-create USBUiNotifApiTest tester
-tester CableConnectedNotifierTest PCSUITEMTP
-pause 500
-tester CancelCableConnectedNotifier
-tester FinishCableConnectedQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title USB Cable Connected touch (Cable Connected Notifier Test)
-create USBUiNotifApiTest tester
-tester CableConnectedNotifierTest PCSUITEMTP
-pause DEVICENOTIF_PAUSE
-sendpointerevent global EButton1 DEVICENOTIF_X DEVICENOTIF_Y
-tester FinishCableConnectedQuery ACCEPT
-delete tester
-[Endtest]
-
-
-// Queries
-
-[Test]
-title USB Query Storage Media Failure OK (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBStorageMediaFailure
-pause OK_PAUSE
-sendpointerevent global EButton1 OK_X OK_Y
-tester FinishQuery ACCEPT
+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 Query Storage Media Failure dismiss (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBStorageMediaFailure
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-[Test] 
-title USB Query Not Enough RAM dismiss (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBNotEnoughRam
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-[Test] 
-title USB Query Disk Full dismiss (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBDiskFull
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 Query cancel (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBStorageMediaFailure
-tester CancelQueryNotifier
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-//Test launching query without cancelling the previous.
-[Test]
-title USB Query no cancel (USB Queries Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbQueriesNotifierTest EUSBStorageMediaFailure
-pause DISMISS_PAUSE
+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 WaitForRequest
-tester UsbQueriesNotifierTest EUSBStorageMediaFailure
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+tester ExecuteApiTestBlock FinishQuery ACCEPT
 delete tester
 [Endtest]
 
-
-// OTG Errors
-
 [Test]
-title OTG Error too much power (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgTooMuchPower
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 OTG Error too much power req (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgTooMuchPowerRequired
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 UsbOTGErrorNotifierTests EUsbOtgHubUnsupported
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 UsbOTGErrorNotifierTests EUsbOtgErrorInConnection
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 UsbOTGErrorNotifierTests EUsbOtgErrorAttachTimedOut
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgErrorAttachTimedOut
+pause 3000
+presskey global EKeyDevice0
+tester ExecuteApiTestBlock FinishQuery ACCEPT
 delete tester
 [Endtest] 
 
 [Test]
-title OTG Error no memory (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgErrorNoMemory
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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 OTG Error OK (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
-pause OK_PAUSE
-sendpointerevent global EButton1 OK_X OK_Y
-tester FinishQuery ACCEPT
+title Load and Unload notifiers
+create UsbUiNotifApiTest tester
+tester ExecuteApiTestBlock LoadNotifiers
+pause 500
+tester ExecuteApiTestBlock UnLoadNotifiers
 delete tester
 [Endtest] 
 
 [Test]
-title OTG Error cancel (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
-tester CancelOtgErrorNotifier
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-//Test launching OTG error without cancelling the previous.
-[Test]
-title OTG Error no cancel (Otg Error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester WaitForRequest
-tester UsbOTGErrorNotifierTests EUsbOtgErrorInConnection
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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] 
 
-
-// OTG Warnings
-
 [Test]
-title OTG Partially supported device (Otg Warning Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-//let the dialog time out
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title OTG Partially supported device OK (Otg Warning Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause OK_PAUSE
-sendpointerevent global EButton1 OK_X OK_Y
-tester FinishQuery ACCEPT
-delete tester
-[Endtest]
-
-[Test]
-title OTG Partially supported device dismiss(Otg Warning Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title OTG Partially supported device cancel(Otg Warning Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause DISMISS_PAUSE
-tester CancelOtgWarningNotifier
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title OTG Partially supported device no cancel(Otg Warning Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester WaitForRequest
-tester UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-
-// MSMM Errors
-
-[Test]
-title MSMM error OK (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMGeneralError
-pause OK_PAUSE
-sendpointerevent global EButton1 OK_X OK_Y
-tester FinishQuery ACCEPT
+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 dismiss (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMGeneralError
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-[Test]
-title MSMM error cancel (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMGeneralError
-tester CancelMsmmNotifier
-tester FinishQuery CANCEL
-delete tester
-[Endtest] 
-
-[Test]
-title MSMM error Unknown file system (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMUnknownFileSystem
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
+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] 
 
-[Test]
-title MSMM error Out of memory (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMOutOfMemory
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title MSMM safe to remove (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMSafeToRemove
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-
-[Test]
-title MSMM warning unable to eject (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMUnableToEject
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
-//Test launching MSMM error without cancelling the previous.
-[Test]
-title MSMM error no cancel (MSMM error Notifier Test)
-create USBUiNotifApiTest tester
-tester UsbMSMMNotifierTests EUsbMSMMUnknownFileSystem
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester WaitForRequest
-tester UsbMSMMNotifierTests EUsbMSMMOutOfMemory
-pause DISMISS_PAUSE
-presskey global EKeyEnter
-tester FinishQuery CANCEL
-delete tester
-[Endtest]
+// Add new api tests here
+// ...
 
 
-//MEikSrvNotifierBase2 API
+// UsbUiNotifApiTest Module Tests (... tc)
 
-[Test]
-title Load and Unload notifiers
-create USBUiNotifApiTest tester
-tester LoadNotifiers
-pause 500
-//the destructors of the notifier classes will be called
-tester UnLoadNotifiers
-delete tester
-[Endtest] 
+// Add new module tests here
+// ...
 
-[Test]
-title Synchronous Start
-create USBUiNotifApiTest tester
-tester SynchStart EUsbOtgPartiallySupportedDevice
-delete tester
-[Endtest] 
+
+// UsbUiNotifApiTest Branch Tests (... tc)
 
-[Test]
-title Update
-create USBUiNotifApiTest tester
-tester Update
-delete tester
-[Endtest] 
\ No newline at end of file
+// Add new branch tests here
+// ...
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis.bat	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-@rem
-@rem Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This material, including documentation and any related 
-@rem computer programs, is protected by copyright controlled by 
-@rem Nokia. All rights are reserved. Copying, including 
-@rem reproducing, storing, adapting or translating, any 
-@rem or all of this material requires the prior written consent of 
-@rem Nokia. This material also contains confidential 
-@rem information which may not be disclosed to others without the 
-@rem prior written consent of Nokia.
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem Description:  
-@rem
-
-call abld test build armv5
-call makesis usbuinotifapitest.pkg
-call signsis usbuinotifapitest.sis usbuinotifapitest.sisx rd.cer rd-key.pem
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat	Wed Sep 01 12:20:49 2010 +0100
@@ -1,23 +1,24 @@
 @rem
-@rem Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies).
+@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 @rem All rights reserved.
-@rem This material, including documentation and any related 
-@rem computer programs, is protected by copyright controlled by 
-@rem Nokia. All rights are reserved. Copying, including 
-@rem reproducing, storing, adapting or translating, any 
-@rem or all of this material requires the prior written consent of 
-@rem Nokia. This material also contains confidential 
-@rem information which may not be disclosed to others without the 
-@rem prior written consent of Nokia.
+@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 Description: Test script config file
+@rem
 @rem
 
-call sbs -k -c armv5.test 
+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 Nokia_RnDCert_02.der Nokia_RnDCert_02.key
+call signsis usbuinotifapitest_phone.sis usbuinotifapitest_phone.sisx x:\rd.cer x:\rd-key.pem
+call pause
\ No newline at end of file
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp	Wed Sep 01 12:20:49 2010 +0100
@@ -41,10 +41,10 @@
 LIBRARY         euser.lib
 LIBRARY         stiftestinterface.lib
 LIBRARY         stiftestengine.lib
-LIBRARY         centralrepository.lib
-LIBRARY         usbman.lib
-LIBRARY         usbwatcher.lib
-LIBRARY         ecom.lib
+LIBRARY 		centralrepository.lib
+LIBRARY 		usbman.lib
+LIBRARY 		usbwatcher.lib
+LIBRARY     	ecom.lib
 
 LANG            SC
 
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,9 @@
 *
 */
 
+
+
+
 #ifndef USBUINOTIFAPITEST_H
 #define USBUINOTIFAPITEST_H
 
@@ -32,57 +35,98 @@
 #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, "e:\\testing\\stiflogs\\" ); 
+//_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" );
+_LIT( KUsbUiNotifApiTestLogFile, "UsbUiNotifApiTest.txt" ); 
+_LIT( KUsbUiNotifApiTestLogFileWithTitle, "UsbUiNotifApiTest_[%S].txt" );
 
 // FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
 
 // FORWARD DECLARATIONS
-class CUSBUiNotifApiTest;
+//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.
+*  CUsbUiNotifApiTest test class for STIF Test Framework TestScripter.
 *  ?other_description_lines
 *
 *  @lib ?library
 *  @since ?Series60_version
 */
-NONSHARABLE_CLASS(CUSBUiNotifApiTest) : public CScriptBase
+NONSHARABLE_CLASS( CUsbUiNotifApiTest ) : public CScriptBase
     {
     public:  // Constructors and destructor
 
         /**
         * Two-phased constructor.
         */
-        static CUSBUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf );
+        static CUsbUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf );
 
         /**
         * Destructor.
         */
-        virtual ~CUSBUiNotifApiTest();
+        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
 
         /**
@@ -95,20 +139,38 @@
 
     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 );
+        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
@@ -118,23 +180,13 @@
         /**
         * Test methods are listed below. 
         */
-        virtual TInt CableConnectedNotifierTest( CStifItemParser& aItem );
-        virtual TInt FinishCableConnectedQuery( CStifItemParser& aItem );
-        virtual TInt UsbQueriesNotifierTest( CStifItemParser& aItem );
-        virtual TInt UsbOTGErrorNotifierTests( CStifItemParser& aItem );
-        virtual TInt UsbOTGWarningNotifierTests( CStifItemParser& aItem );
-        virtual TInt FinishQuery( CStifItemParser& aItem );
-        virtual TInt LoadNotifiersL( CStifItemParser& aItem );
-        virtual TInt UnLoadNotifiers ( CStifItemParser& aItem );
-        virtual TInt UsbMSMMNotifierTests ( CStifItemParser& aItem );
-        virtual TInt CancelMsmmNotifier( CStifItemParser& aItem );
-        virtual TInt CancelQueryNotifier( CStifItemParser& aItem );
-        virtual TInt CancelOtgErrorNotifier( CStifItemParser& aItem );
-        virtual TInt CancelOtgWarningNotifier( CStifItemParser& aItem );
-        virtual TInt CancelCableConnectedNotifier( CStifItemParser& aItem );
-        virtual TInt WaitForRequest( CStifItemParser& aItem );
-        virtual TInt SynchStart( CStifItemParser& aItem );
-        virtual TInt Update( CStifItemParser& aItem );
+
+        virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
+        virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
+        virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
+        
+        
+        
         /**
          * Method used to log version of test class
          */
@@ -142,22 +194,52 @@
 
         //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 );
-        TInt FindAndKillProcess(const TDesC& aProcessName);
 
+        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;
-        TBool iNotifierConnected;
         RUsbWatcher* iUsbWatcher;
  
         CRepository* iRepository;
@@ -172,14 +254,19 @@
         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
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl	Wed Sep 01 12:20:49 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(); 
+	};
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -15,57 +15,88 @@
 *
 */
 
+
+
+
 // INCLUDE FILES
 #include <Stiftestinterface.h>
-#include "usbuinotifapitest.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
+// CUsbUiNotifApiTest::CUsbUiNotifApiTest
 // C++ default constructor can NOT contain any code, that
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CUSBUiNotifApiTest::CUSBUiNotifApiTest( 
+CUsbUiNotifApiTest::CUsbUiNotifApiTest( 
     CTestModuleIf& aTestModuleIf ):
         CScriptBase( aTestModuleIf ),
         iRes(0)
-        
     {
     }
 
 // -----------------------------------------------------------------------------
-// CUSBUiNotifApiTest::ConstructL
+// CUsbUiNotifApiTest::ConstructL
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void CUSBUiNotifApiTest::ConstructL()
+void CUsbUiNotifApiTest::ConstructL()
     {
     //Read logger settings to check whether test case name is to be
     //appended to log file name.
-    
     RSettingServer settingServer;
-    CleanupClosePushL(settingServer); 
     TInt ret = settingServer.Connect();
     if(ret != KErrNone)
         {
@@ -80,7 +111,7 @@
         User::Leave(ret);
         } 
     // Close Setting server session
-    CleanupStack::PopAndDestroy(&settingServer);
+    settingServer.Close();
 
     TFileName logFileName;
     
@@ -88,48 +119,46 @@
         {
         TName title;
         TestModuleIf().GetTestCaseTitleL(title);
-        logFileName.Format(KUSBUiNotifApiTestLogFileWithTitle, &title);
+        logFileName.Format(KUsbUiNotifApiTestLogFileWithTitle, &title);
         }
     else
         {
-        logFileName.Copy(KUSBUiNotifApiTestLogFile);
+        logFileName.Copy(KUsbUiNotifApiTestLogFile);
         }
 
-    iLog = CStifLogger::NewL( KUSBUiNotifApiTestLogPath, 
+    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
+// CUsbUiNotifApiTest::NewL
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-CUSBUiNotifApiTest* CUSBUiNotifApiTest::NewL( 
+CUsbUiNotifApiTest* CUsbUiNotifApiTest::NewL( 
     CTestModuleIf& aTestModuleIf )
     {
-    CUSBUiNotifApiTest* self = new (ELeave) CUSBUiNotifApiTest( aTestModuleIf );
+    CUsbUiNotifApiTest* self = new (ELeave) CUsbUiNotifApiTest( aTestModuleIf );
 
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop( self );
+    CleanupStack::Pop();
 
     return self;
 
     }
 
 // Destructor
-CUSBUiNotifApiTest::~CUSBUiNotifApiTest()
+CUsbUiNotifApiTest::~CUsbUiNotifApiTest()
     { 
 
     // Delete resources allocated from test methods
@@ -141,11 +170,11 @@
     }
 
 //-----------------------------------------------------------------------------
-// CUSBUiNotifApiTest::SendTestClassVersion
+// CUsbUiNotifApiTest::SendTestClassVersion
 // Method used to send version of test class
 //-----------------------------------------------------------------------------
 //
-void CUSBUiNotifApiTest::SendTestClassVersion()
+void CUsbUiNotifApiTest::SendTestClassVersion()
 	{
 	TVersion moduleVersion;
 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
@@ -153,7 +182,7 @@
 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
 	
 	TFileName moduleName;
-	moduleName = _L("USBUiNotifApiTest.dll");
+	moduleName = _L("UsbUiNotifApiTest.dll");
 
 	TBool newVersionOfMethod = ETrue;
 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
@@ -170,7 +199,7 @@
     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
     {
 
-    return ( CScriptBase* ) CUSBUiNotifApiTest::NewL( aTestModuleIf );
+    return ( CScriptBase* ) CUsbUiNotifApiTest::NewL( aTestModuleIf );
 
     }
 
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp	Tue Aug 31 16:13:57 2010 +0300
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp	Wed Sep 01 12:20:49 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,85 +15,101 @@
 *
 */
 
+
+
+
 // [INCLUDE FILES] - do not remove
 #include <e32svr.h>
 #include <StifParser.h>
 #include <ecom/ecom.h>
 #include <Stiftestinterface.h>
-#include "usbuinotifapitest.h"
+#include "UsbUiNotifApiTest.h"
 
 // EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
 
 // EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
 
 // CONSTANTS
-#ifdef __WINS__
-_LIT( KUsbAppProcPattern, "usb[*" );
-#else
-_LIT( KUsbAppProcPattern, "#USBSettingsApp*" );
-#endif
+//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
+// CUsbUiNotifApiTest::Delete
 // Delete here all resources allocated and opened from test methods. 
 // Called from destructor. 
 // -----------------------------------------------------------------------------
 //
-void CUSBUiNotifApiTest::Delete() 
-    {
+void CUsbUiNotifApiTest::Delete() 
+	{
     iNotifier -> Close();
     delete iNotifier;
     iNotifier = NULL;
+    iUsbWatcher -> Close();
+    delete iUsbWatcher;
+    iUsbWatcher = NULL;
+    delete iRepository;
+    iRepository = NULL;
     }
 
 // -----------------------------------------------------------------------------
-// CUSBUiNotifApiTest::RunMethodL
+// CUsbUiNotifApiTest::RunMethodL
 // Run specified method. Contains also table of test mothods and their names.
 // -----------------------------------------------------------------------------
 //
-TInt CUSBUiNotifApiTest::RunMethodL( 
+TInt CUsbUiNotifApiTest::RunMethodL( 
     CStifItemParser& aItem ) 
     {
 
     static TStifFunctionInfo const KFunctions[] =
         {  
-        // Copy this line for every implemented function.
-        // First string is the function name used in TestScripter script file.
-        // Second is the actual implementation member function. 
-        ENTRY( "CableConnectedNotifierTest", CUSBUiNotifApiTest::CableConnectedNotifierTest ),
-        ENTRY( "FinishCableConnectedQuery", CUSBUiNotifApiTest::FinishCableConnectedQuery ),        
-        ENTRY( "UsbQueriesNotifierTest", CUSBUiNotifApiTest::UsbQueriesNotifierTest ),
-        ENTRY( "FinishQuery", CUSBUiNotifApiTest::FinishQuery ),
-        ENTRY( "UsbOTGErrorNotifierTests", CUSBUiNotifApiTest::UsbOTGErrorNotifierTests ), 
-        ENTRY( "UsbOTGWarningNotifierTests", CUSBUiNotifApiTest::UsbOTGWarningNotifierTests ),
-        ENTRY( "LoadNotifiers", CUSBUiNotifApiTest::LoadNotifiersL ),
-        ENTRY( "UnLoadNotifiers", CUSBUiNotifApiTest::UnLoadNotifiers ),
-        ENTRY( "UsbMSMMNotifierTests", CUSBUiNotifApiTest::UsbMSMMNotifierTests ),
-        ENTRY( "CancelMsmmNotifier", CUSBUiNotifApiTest::CancelMsmmNotifier ),
-        ENTRY( "CancelQueryNotifier", CUSBUiNotifApiTest::CancelQueryNotifier ),
-        ENTRY( "CancelOtgErrorNotifier", CUSBUiNotifApiTest::CancelOtgErrorNotifier ),
-        ENTRY( "CancelOtgWarningNotifier", CUSBUiNotifApiTest::CancelOtgWarningNotifier ),
-        ENTRY( "CancelCableConnectedNotifier", CUSBUiNotifApiTest::CancelCableConnectedNotifier ),
-        ENTRY( "WaitForRequest", CUSBUiNotifApiTest::WaitForRequest ),
-        ENTRY( "SynchStart", CUSBUiNotifApiTest::SynchStart ),	
-        ENTRY( "Update", CUSBUiNotifApiTest::Update )
         //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 ) / 
@@ -104,128 +120,374 @@
     }
 
 // -----------------------------------------------------------------------------
-// CUSBUiNotifApiTest::CableConnectedNotifierTests
+// 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::CableConnectedNotifierTest( CStifItemParser& /*aItem*/ )
+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;
-    TPtrC8 dummyPckg; //no parameters used
+    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 )
         {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
-        }   
-    iLog -> Log( _L("RNotifier connected") );
-
-    //kill the possibly running usb application
-    FindAndKillProcess(KUsbAppProcPattern);
-    
-    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KCableConnectedNotifierUid, 
-            dummyPckg, iConnectionNotifierResponseParamsPckg );    
-    
-    return KErrNone;
-    
-    }
-
-
-TInt CUSBUiNotifApiTest::FinishCableConnectedQuery( CStifItemParser& aItem )
-    {
-    //give time for application to start, in microseconds
-    const TInt KAppLaunchDelay = 5000000; 
-    TInt res;
-    TPtrC optionName( KNullDesC );
-    TTestOption option;
-    TPtrC expectedUsbPersonalityName( KNullDesC );
-    TInt expectedErrorCode;
-
-    iLog -> Log( _L("FinishCableConnectedQuery") );
-    
-    res = aItem.GetString( _L( "FinishCableConnectedQuery" ), optionName );
-        
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    iLog -> Log( _L("FinishCableConnectedQuery getting option") );
-    res = GetTestOption( optionName, option );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("GetTestOption failed with value: %d"), res );
+        TRACE_INFO(  (_L("Failed to connect RNotifier with value: %d"), res) );
         iUsbWatcher -> Close();
-        iNotifier -> Close();
-        return res;
-        }
- 
-    iLog -> Log( _L("FinishCableConnectedQuery wait for request") );
+        return;
+        }   
+    TRACE_INFO(  _L("RNotifier connected") );
+
+    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KCableConnectedNotifierUid, emptyNotifierInputPckg, iConnectionNotifierResponseParamsPckg );    
     User::WaitForRequest( iReqStatus );
-    expectedErrorCode = iReqStatus.Int();
-
-    iLog -> Log( _L("FinishCableConnectedQuery request complete") );
-    
-    iNotifier -> Close();  
-
-    iLog -> Log( _L("FinishCableConnectedQuery close") );
     
-    TInt ret = KErrNone;
-    switch( option )
-        {
-        case EQueryAccepted:
-            iLog -> Log( _L("EQueryAccepted"));
-            User::After(KAppLaunchDelay); //let the app start and let the tester person to see that
-            ret = FindAndKillProcess(KUsbAppProcPattern);
-            if (ret != KErrNone)
-                {
-                iLog -> Log( _L("Process start failed: %d"), ret );
-                return ret;
-                }
-            iLog -> Log( _L("Request status value: %d, expected: %d"), expectedErrorCode, KErrCancel );
-            //the notifier returns KErrCancel when clicked
-            STIF_ASSERT_EQUALS( KErrCancel, expectedErrorCode );
-            break;
-        case EQueryCanceled:
-            iLog -> Log( _L("FinishCableConnectedQuery canceled") );
-            iLog -> Log( _L("Request status value: %d, expected: %d"), expectedErrorCode, KErrCancel );
-            STIF_ASSERT_EQUALS( KErrCancel, expectedErrorCode );
-            break;
-        default:
-            iLog -> Log( _L("FinishCableConnectedQuery default - not found") );
-            return KErrNotFound;
-        }
-
-    iLog -> Log( _L("Test case passed!") );
-    return KErrNone;
+    TRACE_INFO((_L("StartNotifierAndGetResponse Status: %d, expected: %d"), iReqStatus.Int(), KErrCancel));
+    if(iReqStatus.Int() == KErrCancel)
+    	aTestResult = ETestCasePassed;
+    
+    TRACE_INFO(  _L("<<<CableConnectedNotifierTest") );
     }
 
 
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::UsbQueriesNotifierTests
+// CUsbUiNotifApiTest::UsbQueriesNotifierTest
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::UsbQueriesNotifierTest( CStifItemParser& aItem )
+void CUsbUiNotifApiTest::UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
     {
+    TRACE_INFO(  _L(">>>UsbQueriesNotifierTest") );
     TInt res;    
-    TPtrC usbQueryName( KNullDesC );
     TUSBUIQueries usbQueryType;
     
-    res = aItem.GetString( _L( "UsbQueriesNotifierTest" ), usbQueryName );   
+    
+    res = GetQueryType( aTestSubOption, usbQueryType );
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    res = GetQueryType( usbQueryName, usbQueryType );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("GetQueryType failed with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("GetQueryType failed with value: %d"), res) );
+        return;
         }
     
     TUSBQueriesNotiferParams notifierParams;
@@ -234,17 +496,13 @@
     TUSBQueriesNotifierParamsPckg notifierParamsPckg( notifierParams );
     TPckgBuf<TBool> output;
     
-    if (!iNotifierConnected)
-        {
-        res = iNotifier -> Connect();
-        iNotifierConnected = ETrue;
-        }
+    res = iNotifier -> Connect();
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("Failed to connect RNotifier with value: %d"), res) );
+        return;
         }   
-    iLog -> Log( _L("RNotifier connected") );
+    TRACE_INFO(  _L("RNotifier connected") );
     
     switch( usbQueryType )
         {
@@ -259,329 +517,200 @@
             break; 
         }
     
-    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KQueriesNotifier, 
-            notifierParamsPckg, output ); 
-    iLog -> Log( _L("StartNotifierAndGetResponse ready") );
+    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KQueriesNotifier, notifierParamsPckg, output ); 
+
+    aTestResult = ETestCasePassed;
     
-    return KErrNone;
+    TRACE_INFO(  _L("<<<UsbQueriesNotifierTest") );
     }
-    
+
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::UsbOTGErrorNotifierTests
+// CUsbUiNotifApiTest::UsbOTGErrorNotifierTests
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::UsbOTGErrorNotifierTests( CStifItemParser& aItem )
+void CUsbUiNotifApiTest::UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
     {
+    TRACE_INFO(  _L(">>>UsbOTGErrorNotifierTests") );
+    
     TInt res;    
-    TPtrC usbQueryName( KNullDesC );
     TUsbUiNotifOtgError usbOTGErrorType;
-    
-    res = aItem.GetString( _L( "UsbOTGErrorNotifierTests" ), usbQueryName );   
+        
+    res = GetOTGErrorType( aTestSubOption, usbOTGErrorType );
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    res = GetOTGErrorType( usbQueryName, usbOTGErrorType );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("usbOTGErrorType failed with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("usbOTGErrorType failed with value: %d"), res) );
+        return;
         }    
     
-    if (!iNotifierConnected)
-        {
-        res = iNotifier -> Connect();
-        iNotifierConnected = ETrue;
-        }
+    res = iNotifier -> Connect();
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("Failed to connect RNotifier with value: %d"), res) );
+        return;
         }   
-    iLog -> Log( _L("RNotifier connected") );
+    TRACE_INFO(  _L("RNotifier connected") );
     
     TPckgBuf<TInt> notifierParamsPckg;
     notifierParamsPckg() = usbOTGErrorType;
     iCompleteQuery = EFalse;
 
-    iNotifier -> StartNotifierAndGetResponse( iReqStatus, 
-            KUsbUiNotifOtgError, notifierParamsPckg, iRes ); 
+    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, notifierParamsPckg, iRes ); 
+
+    aTestResult = ETestCasePassed;
     
-    return KErrNone;
+    TRACE_INFO(  _L("<<<UsbOTGErrorNotifierTests") );
     }
 
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::UsbOTGErrorNotifierTests
+// CUsbUiNotifApiTest::UsbOTGWarningNotifierTests
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::UsbOTGWarningNotifierTests( CStifItemParser& aItem )
+void CUsbUiNotifApiTest::UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
     {        
+    TRACE_INFO(  _L(">>>UsbOTGWarningNotifierTests") );
+    
     TInt res;    
-    TPtrC usbQueryName( KNullDesC );
     TUsbUiNotifOtgWarning usbOTGWarningType;
     
-    res = aItem.GetString( _L( "UsbOTGWarningNotifierTests" ), usbQueryName );   
+    
+    res = GetOTGWarningType( aTestSubOption, usbOTGWarningType );
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    res = GetOTGWarningType( usbQueryName, usbOTGWarningType );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("usbOTGErrorType failed with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("usbOTGErrorType failed with value: %d"), res) );
+        return;
         }    
     
-    if (!iNotifierConnected)
-        {
-        res = iNotifier -> Connect();
-        iNotifierConnected = ETrue;
-        }
+    res = iNotifier -> Connect();
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("Failed to connect RNotifier with value: %d"), res) );
+        return;
         }   
-    iLog -> Log( _L("RNotifier connected") );
+    TRACE_INFO(  _L("RNotifier connected") );
     
     TPckgBuf<TInt> notifierParamsPckg;
     notifierParamsPckg() = usbOTGWarningType;
     iCompleteQuery = EFalse;
 
-    iNotifier -> StartNotifierAndGetResponse( iReqStatus, 
-            KUsbUiNotifOtgWarning, notifierParamsPckg, iRes ); 
+    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgWarning, notifierParamsPckg, iRes ); 
+
+    aTestResult = ETestCasePassed;
     
-    return KErrNone;    
+    TRACE_INFO(  _L("<<<UsbOTGWarningNotifierTests") ); 
     }
 
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::UsbMSMMNotifierTests
+// CUsbUiNotifApiTest::UsbMSMMNotifierTests
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::UsbMSMMNotifierTests( CStifItemParser& aItem )
+void CUsbUiNotifApiTest::UsbMSMMNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
     {        
+    TRACE_INFO(  _L(">>>UsbMSMMNotifierTests") );
+    
     TInt res;    
-    TPtrC usbQueryName( KNullDesC );
     THostMsErrCode usbMSMMNErrorType;
     
-    iLog -> Log( _L("------msmm------") );
-    
-    res = aItem.GetString( _L( "UsbMSMMNotifierTests" ), usbQueryName );   
+    res = GetMSMMrrorType( aTestSubOption, usbMSMMNErrorType );
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    res = GetMSMMrrorType( usbQueryName, usbMSMMNErrorType );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("MSMMrrorType failed with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("MSMMrrorType failed with value: %d"), res) );
+        return;
         }    
     iErrData.iError=usbMSMMNErrorType;
     iErrPckg = iErrData;
-    if (!iNotifierConnected)
-        {
-        res = iNotifier -> Connect();
-        iNotifierConnected = ETrue;
-        }
+    res = iNotifier -> Connect();
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
+        TRACE_INFO(  (_L("Failed to connect RNotifier with value: %d"), res) );
+        return;
         }   
-    iLog -> Log( _L("RNotifier connected") );
+    TRACE_INFO(  _L("RNotifier connected") );
     
     TPckgBuf<TInt> notifierParamsPckg;
     notifierParamsPckg() = usbMSMMNErrorType;
     iCompleteQuery = EFalse;
 
     iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifMsmmError, iErrPckg, iRes ); 
+
+    aTestResult = ETestCasePassed;
     
-    return KErrNone;    
-    }
-
-
-TInt CUSBUiNotifApiTest::CancelMsmmNotifier( CStifItemParser& /*aItem*/ ) 
-    {
-    return ( iNotifier->CancelNotifier(KUsbUiNotifMsmmError) );
-    }
-
-
-TInt CUSBUiNotifApiTest::CancelQueryNotifier( CStifItemParser& /*aItem*/ ) 
-    {
-    iLog -> Log( _L("CancelQueryNotifier") );
-    return ( iNotifier->CancelNotifier(KQueriesNotifier) );
+    TRACE_INFO(  _L("<<<UsbMSMMNotifierTests") ); 
     }
 
 
-TInt CUSBUiNotifApiTest::CancelOtgErrorNotifier( CStifItemParser& /*aItem*/ ) 
-    {
-    return ( iNotifier->CancelNotifier(KUsbUiNotifOtgError) );
-    }
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::FinishQuery
+// -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::CancelOtgWarningNotifier( CStifItemParser& /*aItem*/ ) 
-    {
-    return ( iNotifier->CancelNotifier(KUsbUiNotifOtgWarning) );
-    }
-
-TInt CUSBUiNotifApiTest::CancelCableConnectedNotifier( CStifItemParser& /*aItem*/ ) 
+TInt CUsbUiNotifApiTest::FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
     {
-    return ( iNotifier->CancelNotifier(KCableConnectedNotifierUid) );
-    }
-
-TInt CUSBUiNotifApiTest::WaitForRequest( CStifItemParser& /*aItem*/ ) 
-    {
-    User::WaitForRequest( iReqStatus );
-    return KErrNone;
-    }
-
-TInt CUSBUiNotifApiTest::SynchStart(CStifItemParser& aItem )
-{
-    TInt res;    
-    TPtrC usbQueryName( KNullDesC );
-    TUsbUiNotifOtgWarning usbOTGWarningType;
+    TRACE_INFO(  _L(">>>FinishQuery") ); 
+    
+    TInt res;
+    TTestOption option;
     
-    res = aItem.GetString( _L( "SynchStart" ), usbQueryName );   
+    if ( iCompleteQuery )
+        {
+        TRequestStatus* statPtr = &iReqStatus;
+        User::RequestComplete( statPtr, KErrNone );
+        }    
+    
+    res = GetTestOption( aTestSubOption, option );
     if ( res != KErrNone )
         {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
+        TRACE_INFO(  (_L("GetTestOption failed with value: %d"), res) );
         iNotifier -> Close();
         return res;
         }
     
-    res = GetOTGWarningType( usbQueryName, usbOTGWarningType );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("usbOTGErrorType failed with value: %d"), res );
-        return res;
-        }    
- 
- 
-    res = iNotifier -> Connect();
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
-        }   
-    iLog -> Log( _L("RNotifier connected") );
- 
-    TPckgBuf<TInt> notifierParamsPckg;
-    notifierParamsPckg() = usbOTGWarningType;
-    iCompleteQuery = EFalse;
-
-    TInt retVal = iNotifier -> StartNotifier( KUsbUiNotifOtgWarning, notifierParamsPckg );
-    iLog -> Log( _L("StartNotifier returned with value: %d"), retVal );
-    
-    iNotifier->Close();
-    return retVal;    
-}
-
-TInt CUSBUiNotifApiTest::Update(CStifItemParser& /*aItem*/ )
-{
-    //delay in microseconds before updating the notifier
-    const TInt KUpdateDelay = 2000000;
-    TInt res;    
-    TPtrC usbQueryName( KNullDesC );
-    
-    res = iNotifier -> Connect();
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
-        return res;
-        }   
-    iLog -> Log( _L("RNotifier connected") );
- 
-    TPckgBuf<TInt> notifierParamsPckg;
-    notifierParamsPckg() = EUsbOtgUnsupportedDevice;
-    iCompleteQuery = EFalse;
-    TPckgBuf<TInt> response ;
-    iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, 
-            notifierParamsPckg, iRes );
-		
-    User::After(KUpdateDelay); //simulate update after a delay
-    TPckgBuf<TInt> notifierParamsPckgUpdate;
-    notifierParamsPckgUpdate() = EUsbOtgErrorNoMemory;    
-  	TInt retVal = iNotifier -> UpdateNotifier( KUsbUiNotifOtgError, 
-  	        notifierParamsPckgUpdate, response);
-  	
-    iNotifier->Close();  	
-    return retVal;    
-}
-
-
-TInt CUSBUiNotifApiTest::FinishQuery( CStifItemParser& aItem )
-    {
-    iLog -> Log( _L("FinishQuery") );
-    TInt res;
-    TPtrC optionName( KNullDesC );
-    TTestOption option;
-    
-    if ( iCompleteQuery )
-        {
-        iLog -> Log( _L("FinishQuery completing request") );
-        TRequestStatus* statPtr = &iReqStatus;
-        User::RequestComplete( statPtr, KErrNone );
-        }
-    
-    iLog -> Log( _L("FinishQuery getting options") );
-    res = aItem.GetString( _L( "FinishQuery" ), optionName );   
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("GetString failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    res = GetTestOption( optionName, option );
-    if ( res != KErrNone )
-        {
-        iLog -> Log( _L("GetTestOption failed with value: %d"), res );
-        iNotifier -> Close();
-        return res;
-        }
-    
-    iLog -> Log( _L("FinishQuery waiting for request") );
-    User::WaitForRequest( iReqStatus );
-    iLog -> Log( _L("FinishQuery closing notifier") );
+    User::WaitForRequest( iReqStatus );   
     iNotifier -> Close();
-    iNotifierConnected = EFalse;
     
     switch( option )
         {
         case EQueryAccepted:
-            iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone );
+            TRACE_INFO(  (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone) );
             STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() );
             break;
         case EQueryCanceled:
-            iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel );
+            TRACE_INFO(  (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel) );
             STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() );
             break;
         default:
             return KErrNotFound;
         }
     
-    iLog -> Log( _L("Test case passed!") );
+    aTestResult = ETestCasePassed;
+    
+    TRACE_INFO(  _L("<<<FinishQuery") ); 
+    
     return KErrNone;
     }
 
-TInt CUSBUiNotifApiTest::LoadNotifiersL( CStifItemParser& /*aItem*/ )
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::LoadNotifiersL
+// -----------------------------------------------------------------------------
+
+void CUsbUiNotifApiTest::LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult )
     {
+    TRACE_INFO(  _L(">>>LoadNotifiersL") );
+    
     iNotifierArray = reinterpret_cast<CArrayPtr<MEikSrvNotifierBase2>*>(
 												REComSession::CreateImplementationL(TUid::Uid(0x10281F23), iInstanceUid));
-	return KErrNone;	
-    }
+
+    aTestResult = ETestCasePassed;
     
-TInt CUSBUiNotifApiTest::UnLoadNotifiers ( CStifItemParser& /*aItem*/ )
+    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++)
@@ -590,164 +719,216 @@
         }
     iNotifierArray->Reset();    
     delete iNotifierArray;
-    iNotifierArray = NULL;
     REComSession::DestroyedImplementation(iInstanceUid);    
-    return KErrNone;
+
+    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") );
     }
-                       
-TInt CUSBUiNotifApiTest::GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType )
+
+// -----------------------------------------------------------------------------
+// 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;
-        iLog -> Log( _L("Query type: EUSBNoMemoryCard") );
+        TRACE_INFO(  _L("Query type: EUSBNoMemoryCard") );
         }
     else if ( !aTypeString.Compare( _L( "EUSBStorageMediaFailure" ) ) )
         {
         aQueryType = EUSBStorageMediaFailure;
-        iLog -> Log( _L("Query type: EUSBStorageMediaFailure") );
+        TRACE_INFO(  _L("Query type: EUSBStorageMediaFailure") );
         }
-    else if ( !aTypeString.Compare( _L( "EUSBDiskFull" ) ) )
+    else if ( !aTypeString.Compare( _L( "EUSBChangeFromMassStorage" ) ) )
         {
-        aQueryType = EUSBDiskFull;
-        iLog -> Log( _L("Query type: EUSBDiskFull") );
-        }    
-    else if ( !aTypeString.Compare( _L( "EUSBNotEnoughRam" ) ) )
-        {
-        aQueryType = EUSBNotEnoughRam;
-        iLog -> Log( _L("Query type: EUSBNotEnoughRam") );
+        aQueryType = EUSBChangeFromMassStorage;
+        TRACE_INFO(  _L("Query type: EUSBChangeFromMassStorage") );
         }    
     else
         {
-        iLog -> Log( _L("Query type: not supported") );
+        TRACE_INFO(  _L("Query type: not supported") );
         return KErrNotFound;
         }
- 
+    TRACE_INFO(  _L("<<<GetQueryType") );
     return KErrNone;
     }
 
-TInt CUSBUiNotifApiTest::GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType )
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetOTGErrorType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType )
     {
+    TRACE_INFO(  _L(">>>GetOTGErrorType") );
+    
     if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPower" ) ) )
         {
         aQueryType = EUsbOtgTooMuchPower;
-        iLog -> Log( _L("Query type: EUsbOtgTooMuchPower") );
+        TRACE_INFO(  _L("Query type: EUsbOtgTooMuchPower") );
         }    
     else if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPowerRequired" ) ) )
         {
         aQueryType = EUsbOtgTooMuchPowerRequired;
-        iLog -> Log( _L("Query type: EUsbOtgTooMuchPowerRequired") );
+        TRACE_INFO(  _L("Query type: EUsbOtgTooMuchPowerRequired") );
         }    
     else if ( !aTypeString.Compare( _L( "EUsbOtgUnsupportedDevice" ) ) )
         {
         aQueryType = EUsbOtgUnsupportedDevice;
-        iLog -> Log( _L("Query type: EUsbOtgUnsupportedDevice") );
+        TRACE_INFO(  _L("Query type: EUsbOtgUnsupportedDevice") );
         }        
     else if ( !aTypeString.Compare( _L( "EUsbOtgHubUnsupported" ) ) )
         {
         aQueryType = EUsbOtgHubUnsupported;
-        iLog -> Log( _L("Query type: EUsbOtgHubUnsupported") );
+        TRACE_INFO(  _L("Query type: EUsbOtgHubUnsupported") );
         }            
     else if ( !aTypeString.Compare( _L( "EUsbOtgErrorInConnection" ) ) )
         {
         aQueryType = EUsbOtgErrorInConnection;
-        iLog -> Log( _L("Query type: EUsbOtgErrorInConnection") );
+        TRACE_INFO(  _L("Query type: EUsbOtgErrorInConnection") );
         }                
     else if ( !aTypeString.Compare( _L( "EUsbOtgErrorAttachTimedOut" ) ) )
         {
         aQueryType = EUsbOtgErrorAttachTimedOut;
-        iLog -> Log( _L("Query type: EUsbOtgErrorAttachTimedOut") );
-        }                    
-    else if ( !aTypeString.Compare( _L( "EUsbOtgErrorNoMemory" ) ) )
-        {
-        aQueryType = EUsbOtgErrorNoMemory;
-        iLog -> Log( _L("Query type: EUsbOtgErrorNoMemory") );
+        TRACE_INFO(  _L("Query type: EUsbOtgErrorAttachTimedOut") );
         }                    
     else
         {
-        iLog -> Log( _L("Query type: not supported") );
+        TRACE_INFO(  _L("Query type: not supported") );
         return KErrNotFound;
         } 
+    
+    TRACE_INFO(  _L("<<<GetOTGErrorType") );
     return KErrNone;    
     }
 
 
-TInt CUSBUiNotifApiTest::GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType )
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetOTGWarningType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType )
     {        
+    TRACE_INFO(  _L(">>>GetOTGWarningType") );
+    
     if ( !aTypeString.Compare( _L( "EUsbOtgPartiallySupportedDevice" ) ) )
         {            
         aQueryType = EUsbOtgPartiallySupportedDevice;
-        iLog -> Log( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+        TRACE_INFO(  _L("Query type: EUsbOtgPartiallySupportedDevice;") );
         }    
     else
         {
-        iLog -> Log( _L("Query type: not supported") );
+        TRACE_INFO(  _L("Query type: not supported") );
         return KErrNotFound;
         }
- 
+
+    TRACE_INFO(  _L("<<<GetOTGWarningType") );
+    
     return KErrNone;
     }
 
-TInt CUSBUiNotifApiTest::GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType )
+// -----------------------------------------------------------------------------
+// CUsbUiNotifApiTest::GetMSMMrrorType
+// -----------------------------------------------------------------------------
+
+TInt CUsbUiNotifApiTest::GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType )
     {        
+    TRACE_INFO(  _L(">>>GetMSMMrrorType") );
     if ( !aTypeString.Compare( _L( "EUsbMSMMGeneralError" ) ) )
         {            
         aQueryType = EHostMsErrGeneral;
-        iLog -> Log( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+        TRACE_INFO(  _L("Query type: EUsbOtgPartiallySupportedDevice;") );
         }    
     else if ( !aTypeString.Compare( _L( "EUsbMSMMUnknownFileSystem" ) ) )
         {
         aQueryType = EHostMsErrUnknownFileSystem;
-        iLog -> Log( _L("Query type: EUsbMSMMUnknownFileSystem") );
+        TRACE_INFO(  _L("Query type: EUsbMSMMUnknownFileSystem") );
         }         
     else if ( !aTypeString.Compare( _L( "EUsbMSMMOutOfMemory" ) ) )
         {
         aQueryType = EHostMsErrOutOfMemory;
-        iLog -> Log( _L("Query type: EUsbMSMMOutOfMemory") );
-        }     
-    else if ( !aTypeString.Compare( _L( "EUsbMSMMSafeToRemove" ) ) )
-        {
-        aQueryType = EHostMsErrNone;
-        iLog -> Log( _L("Query type: EUsbMSMMSafeToRemove") );
-        }     
-    else if ( !aTypeString.Compare( _L( "EUsbMSMMUnableToEject" ) ) )
-        {
-        aQueryType = EHostMsErrInUse;
-        iLog -> Log( _L("Query type: EUsbMSMMUnableToEject") );
+        TRACE_INFO(  _L("Query type: EUsbMSMMOutOfMemory") );
         }     
     else
         {
-        iLog -> Log( _L("Query type: not supported") );
+        TRACE_INFO(  _L("Query type: not supported") );
         return KErrNotFound;
         }
- 
+
+    TRACE_INFO(  _L("<<<GetMSMMrrorType") );
     return KErrNone;
     }
-    
+
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::GetTestOption
+// CUsbUiNotifApiTest::GetTestOption
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption )
+TInt CUsbUiNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption )
     {    
     if ( !aOptionString.Compare( _L( "DISCARD" ) ) )
         {
         aOption = EQueryDiscarded;
-        iLog -> Log( _L("Test type: EQueryDiscarded") );
+        TRACE_INFO(  _L("Test type: EQueryDiscarded") );
         }
     else if ( !aOptionString.Compare( _L( "ACCEPT" ) ) )
         {
         aOption = EQueryAccepted;
-        iLog -> Log( _L("Test type: EQueryAccepted") );
+        TRACE_INFO(  _L("Test type: EQueryAccepted") );
         }
     else if ( !aOptionString.Compare( _L( "CANCEL" ) ) )
         {
         aOption = EQueryCanceled;
-        iLog -> Log( _L("Test type: EQueryCanceled") );
+        TRACE_INFO(  _L("Test type: EQueryCanceled") );
         }
     else
         {
-        iLog -> Log( _L("Test type: not supported") );
+        TRACE_INFO(  _L("Test type: not supported") );
         return KErrNotFound;
         }
  
@@ -755,64 +936,40 @@
     }
 
 // -----------------------------------------------------------------------------
-// CBtNotifApiTest::GetPersonalityIdFromString
+// CUsbUiNotifApiTest::GetPersonalityIdFromString
 // -----------------------------------------------------------------------------
 
-TInt CUSBUiNotifApiTest::GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId )
+TInt CUsbUiNotifApiTest::GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId )
     {    
     if ( !aOptionString.Compare( _L( "MS" ) ) )
         {
         aPersonalityId = KUsbPersonalityIdMS;
-        iLog -> Log( _L("Usb personality type: KUsbPersonalityIdMS") );
+        TRACE_INFO(  _L("Usb personality type: KUsbPersonalityIdMS") );
         }
-    else if ( !aOptionString.Compare( _L( "PTP" ) ) )
+    else if ( !aOptionString.Compare( _L( "PCSUITE" ) ) )
         {
-        aPersonalityId = KUsbPersonalityIdPTP;
-        iLog -> Log( _L("Usb personality type: KUsbPersonalityIdPTP") );
+        aPersonalityId = KUsbPersonalityIdPCSuite;
+        TRACE_INFO(  _L("Usb personality type: KUsbPersonalityIdPCSuite") );
         }
     else if ( !aOptionString.Compare( _L( "MTP" ) ) )
         {
         aPersonalityId = KUsbPersonalityIdMTP;
-        iLog -> Log( _L("Usb personality type: KUsbPersonalityIdMTP") );
+        TRACE_INFO(  _L("Usb personality type: KUsbPersonalityIdMTP") );
         }
     else if ( !aOptionString.Compare( _L( "PCSUITEMTP" ) ) )
         {
         aPersonalityId = KUsbPersonalityIdPCSuiteMTP;
-        iLog -> Log( _L("Usb personality type: KUsbPersonalityIdPCSuiteMTP") );
+        TRACE_INFO(  _L("Usb personality type: KUsbPersonalityIdPCSuiteMTP") );
         }
     else
         {
-        iLog -> Log( _L("Usb personality type: not found") );
+        TRACE_INFO(  _L("Usb personality type: not found") );
         return KErrNotFound;  
         }
  
     return KErrNone;
     }
 
-
-TInt CUSBUiNotifApiTest::FindAndKillProcess(const TDesC& aProcessName)
-    {
-    iLog -> Log( _L("FindAndKillProcess") );
-    TInt ret = KErrNotFound;
-    RProcess process;            
-    TFindProcess findProc;
-    findProc.Find(aProcessName);
-    TFullName procName;
-    ret = findProc.Next(procName);
-    iLog -> Log( _L("FindAndKillProcess findProc returned: %d"), ret );
-    if (ret == KErrNone)
-        {
-        ret = process.Open(procName, EOwnerThread);
-        iLog -> Log( _L("FindAndKillProcess process open returned: %d"), ret );
-        if (ret == KErrNone)
-            {
-            process.Terminate(KErrNone);
-            process.Close();
-            }
-        }
-    return ret;
-    }
-
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 // None
 
--- a/usbuis/usbuinotif/usbuinotif.pro	Tue Aug 31 16:13:57 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-TEMPLATE = lib
-TARGET = usbuinotif
-CONFIG += HB
-HEADERS += inc/usbnotifier.h \
-    inc/usbuincableconnectednotifier.h \
-    inc/usbuinotifdebug.h \
-    inc/usbuinotifmsmmerror.h \
-    inc/usbuinotifotgerror.h \
-    inc/usbuinotifotgwarning.h \
-    inc/usbuinqueriesnotifiermdrv.h
-SOURCES += src/usbuincableconnectednotifier.cpp \
-    src/usbuinqueriesnotifiermdrv.cpp \
-    src/usbnotifier.cpp \
-    src/usbuinotifotgwarning.cpp \
-    src/usbuinotifotgerror.cpp \
-    src/usbuinotifmsmmerror.cpp \
-    src/usbuinmain.cpp
-TRANSLATIONS = usbdialogs.ts
-
-defBlock = \      
-    "$${LITERAL_HASH}if defined(EABI)" \
-    "DEFFILE  .\eabi/usbavkonnotif.def" \
-    "$${LITERAL_HASH}else" \
-    "DEFFILE  .\BWINS/usbavkonnotif.def" \
-    "$${LITERAL_HASH}endif"
-	
-MMP_RULES += defBlock
-
-
-symbian*: { 
-    TARGET.UID2 = 0x10009D8D 
-    TARGET.UID3 = 0x102068DC
-    TARGET.CAPABILITY = CAP_ECOM_PLUGIN 
-
-     ecomResourceBlock = \
-      "$${LITERAL_HASH}include <data_caging_paths.hrh>" \
-      "START RESOURCE   ../data/102068DC.rss" \
-      "TARGET           usbuinotif.rsc" \
-      "END"   
-
-   MMP_RULES += ecomResourceBlock
-   MMP_RULES += "TARGETTYPE plugin"  
-
-    BLD_INF_RULES.prj_exports += \
-      "loc/usbuinotif.loc MW_LAYER_LOC_EXPORT_PATH(usbuinotif.loc)" \
-      "rom/usbuinotif.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbuinotif.iby)" \
-      "rom/usbuinotifresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbuinotifresources.iby)" 
-
-   LIBS += -lecom \
-   -lbafl \
-   -lcommonengine \
-   -lcentralrepository \
-   -lusbman \
-   -lflogger \
-   -lcone \
-   -leiksrv
-}
-