--- a/layers.sysdef.xml Fri Jun 04 10:27:39 2010 +0100
+++ b/layers.sysdef.xml Fri Jun 11 14:38:00 2010 +0300
@@ -15,9 +15,11 @@
<unit unitID="lcdo.usbservices.usbclasses.usbhidclassdriver" mrp="" bldFile="&layer_real_source_path;/usbclasses/usbhidclassdriver/group" filter="!sf_build" name="usbservices_usbclasses_usbhidclassdriver" />
<unit unitID="lcdo.usbservices.usbuis.rndisui" mrp="" bldFile="&layer_real_source_path;/usbuis/rndisui/group" filter="!sf_build" name="usbservices_usbuis_rndisui" />
</module>
- <module name="usbuiqt">
- <unit unitID="lcdo.usbservices.usbclasses.usbuiqt" mrp="" bldFile="&layer_real_source_path;/usbuis/usbuiqt" name="usbservices_usbuis_usbapplication" proFile="usbapplication.pro" qmakeArgs="" />
- </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>
</layer>
<layer name="api_test_layer">
<module name="usbservices_test">
--- a/package_definition.xml Fri Jun 04 10:27:39 2010 +0100
+++ b/package_definition.xml Fri Jun 11 14:38:00 2010 +0300
@@ -11,9 +11,6 @@
<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>
@@ -36,12 +33,6 @@
</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>
--- a/tsrc/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ b/tsrc/group/bld.inf Fri Jun 11 14:38:00 2010 +0300
@@ -19,12 +19,8 @@
PRJ_PLATFORMS
DEFAULT
-//build files for shortlinkconn
-#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"
--- a/usbclasses/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ b/usbclasses/group/bld.inf Fri Jun 11 14:38:00 2010 +0300
@@ -19,8 +19,4 @@
#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"
--- a/usbclasses/pictbridgeengine/BWINS/pictbridgeU.DEF Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-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 &)
-
--- a/usbclasses/pictbridgeengine/EABI/pictbridgeU.DEF Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-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>#
-
--- a/usbclasses/pictbridgeengine/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* 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)
--- a/usbclasses/pictbridgeengine/group/pictbridge.mmp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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
-
--- a/usbclasses/pictbridgeengine/inc/dps.rh Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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";
- }
--- a/usbclasses/pictbridgeengine/inc/dpsconnectnotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsconst.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* 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
-
-
--- a/usbclasses/pictbridgeengine/inc/dpsdefs.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,483 +0,0 @@
-/*
-* 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
-
--- a/usbclasses/pictbridgeengine/inc/dpsfile.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsfile.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsoperation.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsoperation.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/inc/dpsparam.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsparam.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsptpnotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsscriptreceiver.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsscriptsender.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsstate.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsstatemachine.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsstatemachine.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpstransaction.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpstransaction.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsusbnotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsxmlgenerator.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsxmlparser.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/dpsxmlparser.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/inc/dpsxmlstring.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/inc/pictbridge.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/rom/pictbridge.iby Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* 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
--- a/usbclasses/pictbridgeengine/src/dps.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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
- {
- }
--- a/usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsfile.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
-* 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);
- }
--- a/usbclasses/pictbridgeengine/src/dpsoperation.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,957 +0,0 @@
-/*
-* 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();
-
- elemsP[0].iElement = EDpsJobConfig;
- elemsP[0].iNum = count;
- aElements.Append(elemsP[0]);
- 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);
- aArgs.Append(argsP[i]);
- 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);
- aArgs.Append(argsP[count]);
-
- 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);
- aArgs.Append(argsP[count]);
-
- 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);
- aArgs.Append(argsP[count]);
- 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);
- aArgs.Append(argsP[count]);
- 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);
- aArgs.Append(argsP[count]);
- 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);
- aArgs.Append(argsP[count]);
- 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;
- aElements.Append(elemsP[j + 1]);
- }
-
- 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);
- aArgs.Append(arg);
- IF_DEBUG(Print(_L("<<<TDpsAbortJob::FillReqArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// 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;
- aElements.Append(elems);
-
- // only one parameter
- TDpsArg argsP;
- argsP.iElement = iReqParam.iCap;
- aArgs.Append(argsP);
- 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;
- 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);
- }
- aArgs.Append(argsP[i]);
- break;
-
- case EDpsArgVendorName: // vender name
-
- argsP[i].iElement = EDpsArgVendorName;
- argsP[i].iContent.Append(iReqParam.iVendorName);
- 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);
- aArgs.Append(argsP[i]);
- }
-
- break;
-
- case EDpsArgProductName: // produce name
- argsP[i].iElement = EDpsArgProductName;
- argsP[i].iContent.Append(iReqParam.iProductName);
- aArgs.Append(argsP[i]);
- break;
-
- case EDpsArgSerialNo: // serialNo (optional)
- if (iReqParam.iSerialNo.Length())
- {
- argsP[i].iElement = EDpsArgSerialNo;
- argsP[i].iContent.Append(iReqParam.iSerialNo);
- aArgs.Append(argsP[i]);
- }
-
- break;
-
- default:
- IF_DEBUG(Print(_L("***Wrong parameter")));
- delete[] argsP;
- return KErrArgument;
- }
-
- }
- delete[] argsP;
- IF_DEBUG(Print(_L("<<<TDpsConfigPrintService::FillReqArgs")));
- 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 TDpsGetCapability::FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillRepArgs")));
- CDpsXmlParser* XmlPar = aTrader->Parser();
-
- if (aArgs.Count())
- {
- if (EDpsArgPaperTypes == aArgs[0].iElement ||
- EDpsArgLayouts == aArgs[0].iElement)
- {
- if (XmlPar->HasAttribute())
- {
- TDpsAttribute attrib;
- XmlPar->GetAttribute(attrib);
- iRepParam.iContent.Append(attrib);
- }
- else
- {
- iRepParam.iContent.Append(0);
- }
- }
- 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);
- iRepParam.iPaperType.Append(paperType);
- }
- else
- {
- // remove the extra zeros
- value = value >> KShiftLength;
- iRepParam.iContent.Append(value);
- IF_DEBUG(Print(_L("the value is %x"), value));
- }
-
- }
- 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;
- }
- iRepParam.iDpsVersions.Append(version);
- }
- 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsparam.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsptpnotifier.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsscriptreceiver.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsscriptsender.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsstate.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsstatemachine.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* 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")));
- }
--- a/usbclasses/pictbridgeengine/src/dpstransaction.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +0,0 @@
-/*
-* 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));
- }
--- a/usbclasses/pictbridgeengine/src/dpsusbnotifier.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +0,0 @@
-/*
-* 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;
- }
--- a/usbclasses/pictbridgeengine/src/dpsxmlgenerator.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*
-* 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")));
- }
--- a/usbclasses/pictbridgeengine/src/dpsxmlparser.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-/*
-* 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.Append(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;
- }
-
--- a/usbclasses/pictbridgeengine/src/dpsxmlstring.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/*
-* 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();
- }
--- a/usbclasses/pictbridgeengine/src/pictbridge.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +0,0 @@
-/*
-* 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.Append(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/usbengines/usbotgwatcher/inc/debug.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbotgwatcher/inc/debug.h Fri Jun 11 14:38:00 2010 +0300
@@ -1,21 +1,23 @@
/*
* 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".
+* 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: Debug macros and declarations.
+* Description: Debug macros and declarations.
*
*/
-
#ifndef DEBUG_H
#define DEBUG_H
--- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -130,14 +130,15 @@
LOG1( "iStatus = %d" , iStatus.Int());
- // if error occured, deal with it in RunError
- LEAVEIFERROR(iStatus.Int());
+ // if iStatus contains some other than KErrNone code
+ // do not perform any special actions,
+ // just forward the error code to caller
iNotifier.CancelNotifier(iUsbNoteNotifier.iCat);
// report to owner that show is over
iUsbNoteNotifier.iNotifManager.NotifierShowCompletedL(iUsbNoteNotifier,
- KErrNone, iRes());
+ iStatus.Int(), iRes());
}
// ---------------------------------------------------------------------------
@@ -159,8 +160,6 @@
LOG1("aError = %d" , aError);
- iNotifier.CancelNotifier(iUsbNoteNotifier.iCat);
-
// try to continue
return KErrNone;
}
--- a/usbengines/usbwatcher/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/group/bld.inf Fri Jun 11 14:38:00 2010 +0300
@@ -33,7 +33,6 @@
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
-../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)
@@ -46,6 +45,5 @@
../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)
-
// End of file
--- a/usbengines/usbwatcher/group/usbwatcherserver.mmp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/group/usbwatcherserver.mmp Fri Jun 11 14:38:00 2010 +0300
@@ -37,7 +37,7 @@
SOURCE cusbdevicelock.cpp
SOURCE cusbdevconstarter.cpp
SOURCE cusbglobalsystemstateobserver.cpp
-SOURCE tusbindicatorhandler.cpp
+SOURCE cusbindicatorhandler.cpp
USERINCLUDE ../inc
@@ -45,6 +45,7 @@
MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE ../../usbotgwatcher/inc
SYSTEMINCLUDE /epoc32/include/usb
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore
START RESOURCE usbman_pcsmtp.rss
@@ -84,5 +85,6 @@
LIBRARY centralrepository.lib // Central Repository (USB Personality API)
LIBRARY featmgr.lib
LIBRARY usbotgwatcher.lib //OTG
+LIBRARY hbcore.lib
DEBUGLIBRARY flogger.lib // File logging
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/inc/cusbindicatorhandler.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/inc/cusbwatcher.h Fri Jun 11 14:38:00 2010 +0300
@@ -30,7 +30,7 @@
#include "debug.h"
#include "musbwatchernotify.h"
#include "cusbwatchersession.h"
-#include "tusbindicatorhandler.h"
+#include "cusbindicatorhandler.h"
class CUsbActiveState;
@@ -180,7 +180,7 @@
* @param aStateOld old device state
* @param aStateNew new device state
*/
- void StateChangeNotify( TUsbDeviceState aStateOld,
+ void StateChangeNotifyL( TUsbDeviceState aStateOld,
TUsbDeviceState aStateNew );
@@ -442,7 +442,7 @@
/*
* USB indicator handler to handle device side indicator
*/
- TUsbIndicatorHandler iUsbIndicatorHandler;
+ CUsbIndicatorHandler* iUsbIndicatorHandler;
/*
* Starting mode is normal?
--- a/usbengines/usbwatcher/loc/usbman.loc Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* 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"
--- a/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Fri Jun 11 14:38:00 2010 +0300
@@ -122,7 +122,6 @@
ECOM_PLUGIN(mtpmetadataservice.dll, mtpmetadataservice.rsc)
// MTP plugin registration resource file
data=EPOCROOT##epoc32\data\Z\resource\mtp\2001A9A3.rsc resource\mtp\2001A9A3.rsc
-data=EPOCROOT##epoc32\data\Z\deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms
#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_METADATASERVICE_IBY
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -270,12 +270,9 @@
iDeviceState = aStateNew;
switch ( aStateNew )
{
- case EUsbDeviceStateAddress:
+ case EUsbDeviceStateConfigured:
{
- if( iAskOnConnectionSetting &&
- ( aStateOld != EUsbDeviceStateSuspended ) &&
- ( aStateOld != EUsbDeviceStateConfigured )
- )
+ if( aStateOld != EUsbDeviceStateSuspended )
{
iPersonalityParams->PersonalityNotifier().ShowQuery(
KCableConnectedNotifierUid, iDummy,
--- a/usbengines/usbwatcher/src/cusbactivestate.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/cusbactivestate.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -56,7 +56,7 @@
// start USB if cable is pluged-in at bootup
if( EUsbDeviceStateUndefined != iCurrentState )
{
- iOwner.StateChangeNotify( iPreviousState, iCurrentState );
+ iOwner.StateChangeNotifyL( iPreviousState, iCurrentState );
iPreviousState = iCurrentState;
}
iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState, iStatus );
@@ -106,7 +106,7 @@
{
LOG2( "USB device state changed: %d ==> %d", iPreviousState,
newState );
- iOwner.StateChangeNotify( iPreviousState, newState );
+ iOwner.StateChangeNotifyL( iPreviousState, newState );
iPreviousState = newState;
}
else
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbengines/usbwatcher/src/cusbindicatorhandler.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -106,6 +106,7 @@
iGlobalStateObserver = CUsbGlobalSystemStateObserver::NewL( *this );
iUsbDevConStarter = CUsbDevConStarter::NewL();
iActiveState = CUsbActiveState::NewL( iUsbMan, *this );
+ iUsbIndicatorHandler = CUsbIndicatorHandler::NewL();
}
// ----------------------------------------------------------------------------
@@ -147,6 +148,7 @@
delete iUsbDeviceLock;
delete iGlobalStateObserver;
iSupportedPersonalities.Close();
+ delete iUsbIndicatorHandler;
}
// ----------------------------------------------------------------------------
@@ -217,7 +219,7 @@
// This method notifies CUsbWatcher class about USB state changes.
// ----------------------------------------------------------------------------
//
-void CUsbWatcher::StateChangeNotify( TUsbDeviceState aStateOld,
+void CUsbWatcher::StateChangeNotifyL( TUsbDeviceState aStateOld,
TUsbDeviceState aStateNew )
{
LOG_FUNC
@@ -226,7 +228,7 @@
// Not show USB indicator in charging mode
if ( iNormalStart )
{
- iUsbIndicatorHandler.HandleDeviceStateChange( aStateOld, aStateNew );
+ iUsbIndicatorHandler->HandleDeviceStateChangeL( aStateOld, aStateNew, iPersonalityId );
}
if ( IsDeviceA() ) // Will be handled by UsbOtgWatcher
--- a/usbengines/usbwatcher/src/tusbindicatorhandler.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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: 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
--- a/usbengines/usbwatcher/src/usbman_pcs.rss Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/usbman_pcs.rss Fri Jun 11 14:38:00 2010 +0300
@@ -21,7 +21,6 @@
#include <badef.rh>
#include <bldvariant.hrh>
#include <usbpersonalityids.h>
-#include <usbman.loc>
#include "usbman.rh"
#include "usbvariation.rh"
@@ -52,7 +51,7 @@
product = per_product;
id = KUsbPersonalityIdPCSuite;
class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A";
- description = qtn_usb_mode_ovisuite;
+ description = "ovi suite";
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
@@ -72,7 +71,7 @@
product = per_product;
id = KUsbPersonalityIdMS;
class_uids = "10204bbc";
- description = qtn_usb_mode_mass_storage;
+ description = "mass storage";
detailedDescription = qtn_usb_mode_msg_mass_storage;
property = 0x00000000;
--- a/usbengines/usbwatcher/src/usbman_pcsmtp.rss Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/usbman_pcsmtp.rss Fri Jun 11 14:38:00 2010 +0300
@@ -21,7 +21,6 @@
#include <badef.rh>
#include <bldvariant.hrh>
#include <usbpersonalityids.h>
-#include <usbman.loc>
#include "usbman.rh"
#include "usbvariation.rh"
@@ -54,7 +53,7 @@
product = per_product;
id = KUsbPersonalityIdPCSuiteMTP;
class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A";
- description = qtn_usb_mode_ovisuite_mtp;
+ description = "ovi suite";
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
}
@@ -72,7 +71,7 @@
product = per_product;
id = KUsbPersonalityIdMS;
class_uids = "10204bbc";
- description = qtn_usb_mode_mass_storage;
+ description = "mass storage";
detailedDescription = qtn_usb_mode_msg_mass_storage;
property = 0x00000000;
}
@@ -90,7 +89,7 @@
product = per_product;
id = KUsbPersonalityIdMTP;
class_uids = "102827B3";
- description = qtn_usb_mode_mtp;
+ description = "media transfer";
detailedDescription = qtn_usb_mode_msg_mtp;
property = 0x00000000;
}
--- a/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Fri Jun 11 14:38:00 2010 +0300
@@ -21,7 +21,6 @@
#include <badef.rh>
#include <bldvariant.hrh>
#include <usbpersonalityids.h>
-#include <usbman.loc>
#include "usbman.rh"
#include "usbvariation.rh"
@@ -53,7 +52,7 @@
product = per_product;
id = KUsbPersonalityIdPCSuiteMTP;
class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A";
- description = qtn_usb_mode_ovisuite_mtp;
+ description = "ovi suite";
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
@@ -73,7 +72,7 @@
product = per_product;
id = KUsbPersonalityIdMS;
class_uids = "10204bbc";
- description = qtn_usb_mode_mass_storage;
+ description = "mass storage";
detailedDescription = qtn_usb_mode_msg_mass_storage;
property = 0x00000000;
@@ -115,7 +114,7 @@
product = per_product;
id = KUsbPersonalityIdMTP;
class_uids = "102827B3";
- description = qtn_usb_mode_mtp;
+ description = "media transfer";
detailedDescription = qtn_usb_mode_msg_mtp;
property = 0x00000000;
@@ -135,7 +134,7 @@
product = per_product;
id = KUsbPersonalityIdModemInst;
class_uids = "2000FDA9";
- description = qtn_usb_mode_quickconnect;
+ description = "phone as modem";
detailedDescription = qtn_usb_mode_msg_pam;
property = 0x00000000;
}
--- a/usbengines/usbwatcher/src/usbman_pcspam.rss Fri Jun 04 10:27:39 2010 +0100
+++ b/usbengines/usbwatcher/src/usbman_pcspam.rss Fri Jun 11 14:38:00 2010 +0300
@@ -21,7 +21,6 @@
#include <badef.rh>
#include <bldvariant.hrh>
#include <usbpersonalityids.h>
-#include <usbman.loc>
#include "usbman.rh"
#include "usbvariation.rh"
@@ -52,7 +51,7 @@
product = per_product;
id = KUsbPersonalityIdPCSuite;
class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A";
- description = qtn_usb_mode_ovisuite;
+ description = "ovi suite";
detailedDescription = qtn_usb_mode_msg_ovi_suite;
property = 0x00000000;
@@ -72,7 +71,7 @@
product = per_product;
id = KUsbPersonalityIdMS;
class_uids = "10204bbc";
- description = qtn_usb_mode_mass_storage;
+ description = "mass storage";
detailedDescription = qtn_usb_mode_msg_mass_storage;
property = 0x00000000;
@@ -114,7 +113,7 @@
product = per_product;
id = KUsbPersonalityIdModemInst;
class_uids = "2000FDA9";
- description = qtn_usb_mode_quickconnect;
+ description = "phone as modem";
detailedDescription = qtn_usb_mode_msg_pam;
property = 0x00000000;
}
--- a/usbuis/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/group/bld.inf Fri Jun 11 14:38:00 2010 +0300
@@ -15,8 +15,5 @@
*
*/
-
-#include "../usbui/group/bld.inf"
-#include "../usbuinotif/group/bld.inf"
#include "../imageprintuiprovider/group/bld.inf"
#include "../imageprintui/group/bld.inf"
\ No newline at end of file
--- a/usbuis/imageprintui/src/settingscontainer.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/imageprintui/src/settingscontainer.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -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,10 +254,12 @@
//
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"));
+*/
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/inc/usbaddressedindicator.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 ¶meter);
+
+private:
+
+ QString mSecDisplayName;
+
+};
+
+#endif /* USBADDRESSEDINDICATOR_H */
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/inc/usbindicator.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 ¶meter);
+
+private:
+
+ QString mSecDisplayName;
+};
+
+#endif /* USBINDICATOR_H*/
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/inc/usbindicatorplugin.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* 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" );
+
+_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 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/rom/usbindicatorplugin.iby Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/rom/usbindicatorpluginresources.iby Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/src/usbaddressedindicator.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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.h>
+#include <e32uid.h>
+#include <apadef.h>
+#include <usbpersonalityids.h>
+#include "usbindicatorplugin.h"
+#include "usbindicator.h"
+
+
+/*!
+ UsbAddressedIndicator::UsbAddressedIndicator
+*/
+UsbAddressedIndicator::UsbAddressedIndicator(const QString &indicatorType) :
+HbIndicatorInterface(indicatorType,
+ HbIndicatorInterface::ProgressCategory,
+ InteractionActivated)
+ {
+ }
+
+/*!
+ UsbAddressedIndicator::~UsbAddressedIndicator
+*/
+UsbAddressedIndicator::~UsbAddressedIndicator()
+ {
+ }
+
+
+/*!
+ UsbAddressedIndicator::handleInteraction
+*/
+bool UsbAddressedIndicator::handleInteraction(InteractionType type)
+ {
+ 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;
+ }
+ 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
+{
+ 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 ¶meter)
+{
+ switch (type) {
+ case RequestActivate:
+ {
+ emit dataChanged();
+ }
+
+ break;
+ default:
+ emit deactivate();
+ break;
+ }
+ //request always handled
+ return true;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/src/usbindicator.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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.h>
+#include <e32uid.h>
+#include <apadef.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)
+{
+ 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;
+ }
+ 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
+{
+ 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 ¶meter)
+{
+ 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
+ return true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/src/usbindicatorplugin.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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"
+
+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
+{
+ QStringList types;
+ types << ConnectedIndicator;
+ types << AddressedIndicator;
+ return types;
+}
+
+
+
+/*!
+ UsbIndicatorPlugin::createIndicator
+ Creates and returns the HbIndicatorInterface
+*/
+HbIndicatorInterface* UsbIndicatorPlugin::createIndicator(const QString &indicatorType)
+{
+ 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);
+ }
+ return indicator;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbindicatorplugin/usbindicatorplugin.pro Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,26 @@
+TEMPLATE = lib
+TARGET = usbindicatorplugin
+CONFIG += plugin
+CONFIG += hb
+HEADERS += inc/usbindicatorplugin.h \
+ inc/usbindicator.h \
+ inc/usbaddressedindicator.h
+
+SOURCES += src/usbindicatorplugin.cpp \
+ src/usbindicator.cpp \
+ src/usbaddressedindicator.cpp
+
+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)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/USBSettingsApp.pro Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,28 @@
+TEMPLATE = app
+TARGET = USBSettingsApp
+QT += core \
+ gui
+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
+ RSS_RULES = "hidden = KAppIsHidden;"
+}
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/inc/ui_USBSettingsApp.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,66 @@
+/********************************************************************************
+** 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/inc/usbdebug.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/inc/usbsettingsapp.h Fri Jun 11 14:38:00 2010 +0300
@@ -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:
+*
+*/
+
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/inc/usbuimodelactive.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/inc/usbuisettingmodel.h Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/rom/usbsettingsapp.iby Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/rom/usbsettingsappresources.iby Fri Jun 11 14:38:00 2010 +0300
@@ -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:
+*
+*/
+
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/USBSettingsApp.ui Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,30 @@
+<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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/hblistviewitem.css Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,125 @@
+
+/*
+ Layout selection
+*/
+
+HbListViewItem[layoutName="usb"]{
+ layout:usb-1;
+}
+
+HbListViewItem[layoutName="usb"][modelItemType="SeparatorItem"]{
+ layout:separator-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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/hblistviewitem.widgetml Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,55 @@
+<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" 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/main.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -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:
+*
+*/
+#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();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbsettinglayout.qrc Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>hblistviewitem.widgetml</file>
+ <file>hblistviewitem.css</file>
+</qresource></RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbsettingsapp.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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->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";
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbsettingsapp.docml Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,49 @@
+<?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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbsettingsapp.qrc Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/xml">
+ <file>usbsettingsapp.docml</file>
+ </qresource>
+</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbsettingsapp.ts Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,396 @@
+<?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'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'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'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'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'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'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'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'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'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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbuimodelactive.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* 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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbsettingsapp/src/usbuisettingmodel.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,322 @@
+/*
+* 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;
+}
--- a/usbuis/usbui/USBClassChangeUIPlugin/data/1020E472.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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";
- }
- };
- }
-
-
- };
-}
--- a/usbuis/usbui/USBClassChangeUIPlugin/data/USBClassChangeUIPlugin.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/group/USBClassChangeUIPlugin.mmp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* 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
-
--- a/usbuis/usbui/USBClassChangeUIPlugin/group/usbuiplugin_icons_dc.mk Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#
-# Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.hrh Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2005, 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginCRWatcher.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginContainer.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*
-* Copyright (c) 2005, 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginDebug.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* 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 );
- }
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginModel.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBDeviceStateWatcher.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/inc/usbotghoststatewatcher.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +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: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginCRWatcher.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,446 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginImplementationTable.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginModel.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,611 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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.Append(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
- iDeviceIDs.Append(aEventInfo.iDeviceId);
- 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginView.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,566 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBDeviceStateWatcher.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
-* 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();
- }
--- a/usbuis/usbui/USBClassChangeUIPlugin/src/usbotghoststatewatcher.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-/*
-* 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();
- }
--- a/usbuis/usbui/aif/USBClassChangeUI_caption.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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
-
--- a/usbuis/usbui/aif/USBClassChangeUIaif.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/data/USBClassChangeUI.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/data/USBClassChangeUI_reg.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/group/USBClassChangeUI.mmp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/group/usbui_Icons_aif_scalable_dc.mk Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#
-# 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
--- a/usbuis/usbui/group/usbui_icons_aif_bitmaps_dc.mk Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# 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
--- a/usbuis/usbui/help/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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:
-* 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)
--- a/usbuis/usbui/help/inc/usb.hlp.hrh Fri Jun 04 10:27:39 2010 +0100
+++ /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:
-*
-*/
-
-//
-// 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
--- a/usbuis/usbui/help/rom/usbuihelps_variant.iby Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#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
--- a/usbuis/usbui/inc/USBClassChangeUI.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/inc/USBClassChangeUIApp.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/inc/USBClassChangeUIAppUi.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/inc/USBClassChangeUIDebug.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/inc/USBClassChangeUIDocument.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/loc/USBClassChangeUI.loc Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/rom/USBClassChangeUI.iby Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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 __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
--- a/usbuis/usbui/rom/USBClassChangeUIResources.iby Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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 __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
--- a/usbuis/usbui/src/USBClassChangeUIApp.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/src/USBClassChangeUIAppui.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/src/USBClassChangeUIDocument.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
-
--- a/usbuis/usbui/tsrc/usbuiapitest/bwins/usbuiapitestu.def Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
-
--- a/usbuis/usbui/tsrc/usbuiapitest/conf/ui_usbuiapitest.cfg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,399 +0,0 @@
-/*
-* 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
-// ...
--- a/usbuis/usbui/tsrc/usbuiapitest/eabi/usbuiapitestu.def Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
-
--- a/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_ats.bat Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_phone.bat Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.mmp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.pkg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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: 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
--- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest_phone.pkg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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: 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
--- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#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();
- };
--- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-#
-# 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
--- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-#
-# 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
--- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
-* 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
--- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,701 +0,0 @@
-/*
-* 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/data/102068DC.rss Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/data/102068DC.rss Fri Jun 11 14:38:00 2010 +0300
@@ -17,7 +17,7 @@
*/
-#include "registryinfo.rh"
+#include "ecom/registryinfo.rh"
#include "uikon.hrh"
RESOURCE REGISTRY_INFO theInfo
--- a/usbuis/usbuinotif/data/usbuinotif.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-/*
-* 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; }
-
-// End of File
--- a/usbuis/usbuinotif/group/bld.inf Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2005, 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
-
-PRJ_TESTMMPFILES
-
-// End of File
--- a/usbuis/usbuinotif/group/usbuinotif.mmp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* 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 usbuincableconnectednotifier.cpp
-SOURCE usbuinqueriesnotifiermdrv.cpp
-SOURCE usbuinotifotgwarning.cpp
-SOURCE usbuinotifotgerror.cpp
-SOURCE usbuinotifmsmmerror.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 ../../inc ../../../inc MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/) //for internal and private API headers
-SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore
-MW_LAYER_SYSTEMINCLUDE
-
-
-
-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 hbcore.lib
-
-DEBUGLIBRARY flogger.lib // File logging services
-
-// End of File
--- a/usbuis/usbuinotif/inc/usbnotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbnotifier.h Fri Jun 11 14:38:00 2010 +0300
@@ -20,9 +20,6 @@
#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
@@ -38,7 +35,7 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUSBUINotifierBase) : public CActive, public MEikSrvNotifierBase2
+NONSHARABLE_CLASS(CUSBUINotifierBase) : public CBase, public MEikSrvNotifierBase2
{
public:
// Constructors and destructor
@@ -72,52 +69,25 @@
* @param aMessage Should be completed when the notifier is deactivated.
* @return None.
*/
- virtual void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ virtual void StartDialogL(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);
- /*
- * 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();
-
+ /**
+ * Initialize HbTextResolrer, if not initialized before
+ * (checks it from TLS)
+ */
+ void InitializeTextResolver();
+
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.
@@ -131,7 +101,7 @@
* @param None.
* @return None.
*/
- virtual void Cancel();
+ virtual void Cancel();
private:
// Functions from base classes
@@ -176,16 +146,8 @@
*/
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
@@ -196,10 +158,7 @@
TInt iResourceFileFlag; // Flag for eikon env.
TNotifierInfo iInfo; // Notifier parameters structure
CEikonEnv* iEikEnv; // Local eikonenv, not own
- TBool iAppsKeyBlocked; // Apps key status
-
- TBool iCoverDisplaySupported; // Cover Display UI feature support
-
+ TBool iTranslator ;
};
#endif // USBUINOTIFIER_H
--- a/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Fri Jun 11 14:38:00 2010 +0300
@@ -20,8 +20,8 @@
// INCLUDES
-#include <hbdevicedialogsymbian.h>
-#include <hbsymbianvariant.h>
+#include <hb/hbcore/hbdevicedialogsymbian.h>
+#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
#include "usbnotifier.h" // Base class
// CLASS DECLARATION
@@ -32,7 +32,7 @@
* @lib
*/
NONSHARABLE_CLASS(CUSBUICableConnectedNotifier) : public CUSBUINotifierBase,
- public MHbDeviceDialogObserver
+ public MHbDeviceNotificationDialogObserver
{
public:
// Constructors and destructor
@@ -66,13 +66,6 @@
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.
@@ -81,25 +74,21 @@
* @param aMessage Should be completed when the notifier is deactivated.
* @return None.
*/
- void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
private:
- // functions from MHbDeviceDialogObserver
-
+ // functions from MHbDeviceNotificationDialogObserver
/**
- * lunches the QT usb ui setting
- * @param aData is a CHbSymbianVariantMap daya which contains the keys
- */
- void DataReceived(CHbSymbianVariantMap& aData);
- /*
- * Virtual function from MHbDeviceDialogObserver
- * Not implemented
- */
- void DeviceDialogClosed(TInt aCompletionCode);
-
-
+ * Callback function which is called when the dialog is tapped
+ */
+ void NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog);
+ /**
+ * Callback function which is called when the dialog is closed
+ */
+ void NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog,
+ TInt aCompletionCode);
private:
//New functions
@@ -117,35 +106,20 @@
*/
void GetPersonalityStringLC(HBufC*& aHeader,HBufC*& aDescription );
- /**
- * Runs the connected discreet note
- */
- void RunQueryL();
-
-
- /**
+ /**
* launches the (USB) application
* @param aProcessName The process name (*.exe)
* @param TUidType
*/
void LaunchApplication(const TDesC & aProcessName,const TUidType & aUidType) const;
- /**
- * Adds a parameter to the dialog parameters.
- */
- void AddParameterL(
- CHbSymbianVariantMap* aParameters,
- const TDesC& aKey,
- const TAny* aData,
- CHbSymbianVariant::TType aDataType);
-
private:
/**
* C++ default constructor.
*/
CUSBUICableConnectedNotifier();
- CHbDeviceDialogSymbian* iDialog;
+ CHbDeviceNotificationDialogSymbian* iDialog;
};
#endif // USBUINCABLECONNECTEDNOTIFIER_H
--- a/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Fri Jun 11 14:38:00 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: Declares USB UI Queries notifier.
+* Description: Declares MSMM error notifier.
*
*/
@@ -20,10 +20,11 @@
#define USBUINOTIFMSMMERROR_H
// INCLUDES
-
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
#include "usbnotifier.h" // Base class
-#include <AknQueryDialog.h> // AVKON component
+
#define KUsbUiNotifOtgGeneralQueryGranularity 3
+
// CLASS DECLARATION
/**
@@ -32,19 +33,21 @@
*
* @lib
*/
-NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase
+NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase,
+ public MHbDeviceMessageBoxObserver
{
public:
-/**
- * Possible parameter values for KUsbUiNotifMSMMError
- */
-enum TUsbUiNotifMSMMError
- {
- EUsbMSMMGeneralError,
- EUsbMSMMUnknownFileSystem,
- EUsbMSMMOutOfMemory
- };
+ /**
+ * Indexes for the strings used in KUsbUiNotifMSMMError which are mapped to 5 errors.
+ */
+ enum TUsbUiNotifMSMMError
+ {
+ EUsbMSMMGeneralError,
+ EUsbMSMMUnknownFileSystem,
+ EUsbMSMMOutOfMemory
+ };
+
// Constructors and destructor
/**
@@ -57,6 +60,14 @@
*/
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:
/**
@@ -81,11 +92,6 @@
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.
@@ -93,7 +99,7 @@
* @param aReplySlot A reply slot.
* @param aMessage Should be completed when the notifier is deactivated.
*/
- void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
private:
@@ -106,20 +112,9 @@
private:
// New functions
- /**
- * Show query dialog
- * @return KErrNone - accepted, KErrCancel - Cancel or End call key
- */
- TInt QueryUserResponseL();
-
private:
// Data
- /**
- * Query
- * Not own, destroys self when lauched.
- */
- CAknQueryDialog* iQuery;
- RArray<TInt> iStringIds;
- TInt iErrorId;
- };
+ CHbDeviceMessageBoxSymbian* iQuery;
+ CDesCArrayFlat* iStringIds;
+ };
#endif // USBUINOTIFMSMMERROR_H
--- a/usbuis/usbuinotif/inc/usbuinotifotgerror.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbuinotifotgerror.h Fri Jun 11 14:38:00 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: Declares USB UI Queries notifier.
+* Description: Declares USB UI OTG Errors notifier.
*
*/
@@ -20,19 +20,21 @@
#define USBUINOTIFOTGERROR_H
// INCLUDES
-
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
#include "usbnotifier.h" // Base class
-#include <AknQueryDialog.h> // AVKON component
+
+
#define KUsbUiNotifOtgGeneralQueryGranularity 3
// CLASS DECLARATION
/**
- * This class is used to show general USB query.
+ * This class is used to show general USB OTG errors
* Asynchronous call is required.
*
* @lib
*/
-NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase
+NONSHARABLE_CLASS(CUsbUiNotifOtgError) : public CUSBUINotifierBase,
+ public MHbDeviceMessageBoxObserver
{
public:
// Constructors and destructor
@@ -46,7 +48,14 @@
* 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:
/**
@@ -71,11 +80,6 @@
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.
@@ -83,7 +87,7 @@
* @param aReplySlot A reply slot.
* @param aMessage Should be completed when the notifier is deactivated.
*/
- void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
private:
@@ -94,22 +98,12 @@
CUsbUiNotifOtgError();
private:
- // New functions
-
- /**
- * Show query dialog
- * @return KErrNone - accepted, KErrCancel - Cancel or End call key
- */
- TInt QueryUserResponseL();
-
-private:
// Data
/**
* Query
- * Not own, destroys self when lauched.
+ * Owned
*/
- CAknQueryDialog* iQuery;
- RArray<TInt> iStringIds;
- TInt iErrorId;
+ CHbDeviceMessageBoxSymbian* iQuery;
+ CDesCArrayFlat* iStringIds;
};
#endif // USBUINOTIFOTGERROR_H
--- a/usbuis/usbuinotif/inc/usbuinotifotgwarning.h Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbuinotifotgwarning.h Fri Jun 11 14:38:00 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: Declares USB UI connection notifier.
+* Description: Declares USB OTG Warning notifier.
*
*/
@@ -20,8 +20,9 @@
#define USBUINOTIFOTGWARNING_H
// INCLUDES
-#include <aknnotewrappers.h>
+
#include <usbuinotif.h>
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
#include "usbnotifier.h" // Base class
#define KUsbUiNotifOtgGeneralNoteGranularity 1
@@ -32,7 +33,8 @@
* Synchronous call is enouph.
*
*/
-NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase
+NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase,
+ public MHbDeviceMessageBoxObserver
{
public:
// Constructors and destructor
@@ -46,6 +48,13 @@
* 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:
@@ -72,13 +81,6 @@
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.
@@ -87,7 +89,7 @@
* @param aMessage Should be completed when the notifier is deactivated.
* @return None.
*/
- void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ void StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage);
private:
@@ -97,25 +99,12 @@
*/
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
- RArray<TInt> iStringIds;
+ CDesCArrayFlat* iStringIds;
//Own
- CAknResourceNoteDialog* iNote;
+ CHbDeviceMessageBoxSymbian* iNote;
TInt iNoteId;
};
--- a/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * 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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Fri Jun 11 14:38:00 2010 +0300
@@ -19,9 +19,10 @@
#define USBUINQUERIESNOTIFIER_H
// INCLUDES
-
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
#include "usbnotifier.h" // Base class
-#include <AknQueryDialog.h> // AVKON component
+
+
// CLASS DECLARATION
/**
@@ -30,7 +31,8 @@
* @lib
* @since S60 3.0
*/
-NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase
+NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase,
+ public MHbDeviceMessageBoxObserver
{
public:
// Constructors and destructor
@@ -44,6 +46,14 @@
* 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
@@ -64,13 +74,6 @@
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.
@@ -79,53 +82,24 @@
* @param aMessage Should be completed when the notifier is deactivated.
* @return None.
*/
- void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+ void StartDialogL(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
/**
- * Not own, destroys self when lauched.
+ * owned
*/
- CAknQueryDialog* iUSBQueryDlg;
+ CHbDeviceMessageBoxSymbian* iUSBQueryDlg;
TUSBUIQueries iQueryType; // To store the type of the query
};
--- a/usbuis/usbuinotif/rom/usbuinotifresources.iby Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/rom/usbuinotifresources.iby Fri Jun 11 14:38:00 2010 +0300
@@ -19,9 +19,11 @@
REM USB UI notifiers resources
+#include <data_caging_paths_for_iby.hrh>
+
#ifdef __USB_MULTIPERSONALITY
-data=DATAZ_\RESOURCE_FILES_DIR\usbuinotif.rsc RESOURCE_FILES_DIR\usbuinotif.rsc
+data=DATAZ_\QT_TRANSLATIONS_DIR\usbdialogs.qm QT_TRANSLATIONS_DIR\usbdialogs.qm
#endif // __USB_MULTIPERSONALITY
#endif // __USBUINOTIFRESOURCES_IBY__
\ No newline at end of file
--- a/usbuis/usbuinotif/src/usbnotifier.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbnotifier.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -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"
@@ -16,18 +16,15 @@
*/
// 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 <featmgr.h>
#include <AknNotiferAppServerApplication.h>
+#include <hb/hbcore/hbtextresolversymbian.h>
#include "usbnotifier.h" // Own class
#include "usbuinotifdebug.h"
-#include "aknkeylock.h" //RAknKeyLock
+
// CONSTANTS
// ================= MEMBER FUNCTIONS =========================================
@@ -39,11 +36,9 @@
// itself to the active scheduler stack.
// ----------------------------------------------------------------------------
//
-CUSBUINotifierBase::CUSBUINotifierBase() :
- CActive( EPriorityStandard )
+CUSBUINotifierBase::CUSBUINotifierBase()
{
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Default constructor()"));
- CActiveScheduler::Add( this );
}
// ----------------------------------------------------------------------------
@@ -55,27 +50,16 @@
void CUSBUINotifierBase::ConstructL()
{
iEikEnv = CEikonEnv::Static();
- iAppsKeyBlocked = EFalse;
- iKeylockChanged = EFalse;
-
+
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL()"));
- 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();
-
+
+ // 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 ));
+
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL() completed"));
}
@@ -90,19 +74,11 @@
//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 );
-
- // Restore the keylock if not restored before (caused by Leave).
- // If the Keylock is restored already, the function does nothing.
- RestoreKeylock();
-
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Destructor completed"));
}
@@ -150,7 +126,7 @@
const RMessagePtr2& aMessage)
{
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::StartL()"));
- TRAPD( err, GetParamsL( aBuffer, aReplySlot, aMessage ));
+ TRAPD( err, StartDialogL( aBuffer, aReplySlot, aMessage ));
if (err)
{
aMessage.Complete( err );
@@ -168,8 +144,9 @@
void CUSBUINotifierBase::Cancel()
{
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel()"));
- CActive::Cancel();
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel completed()"));
+ //The message box closed callback gets not run in subclass cancel calls.
+ CompleteMessage(KErrCancel);
+ FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel completed"));
}
// ----------------------------------------------------------------------------
@@ -184,64 +161,6 @@
}
// ----------------------------------------------------------------------------
-// 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.
// ----------------------------------------------------------------------------
@@ -258,61 +177,33 @@
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::CompleteMessage() completed"));
}
-// ----------------------------------------------------------------------------
-// CUSBUINotifierBase::DisableKeylock
-// ----------------------------------------------------------------------------
-// Turn off the keyguard if it was on.
-//
-void CUSBUINotifierBase::DisableKeylock()
+void CUSBUINotifierBase::InitializeTextResolver()
{
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock()"));
- RAknKeylock2 keylock;
- iKeylockChanged = EFalse;
- if (KErrNone == keylock.Connect())
+ _LIT(KFileName, "usbdialogs_");
+ _LIT(KPath, "z:/resource/qt/translations/");
+ TInt error;
+
+ iTranslator = (TBool )Dll::Tls();
+
+ FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:Tls returned %d"), iTranslator ));
+
+ if (!iTranslator)
{
- if (keylock.IsKeyLockEnabled()) //Check and save the keylock status
+ iTranslator = HbTextResolverSymbian::Init(KFileName, KPath);
+ FTRACE(FPrint(_L("[USBUINOTIF]\t HbTextResolverSymbian::Init returned %d"), iTranslator ));
+ if (iTranslator)
{
- keylock.DisableWithoutNote();// Unlock
- iKeylockChanged = ETrue;
+ error = Dll::SetTls((TAny* )iTranslator);
}
- keylock.Close();
- }
- else
- {
- FLOG( _L( "[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock() fail caused by RAknKeylock2::Connect()") );
- }
-
- FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::DisableKeylock() completed"));
+ 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 ) );
+
}
-// ----------------------------------------------------------------------------
-// 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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -15,17 +15,13 @@
*
*/
// 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 <usbuinotif.rsg> // Own resources
#include <centralrepository.h>
#include <e32property.h>
#include <e32uid.h> // KExecutableImageUid
+#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h>
+#include <hb/hbcore/hbtextresolversymbian.h>
#include "usbuincableconnectednotifier.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
#include "UsbWatcherInternalCRKeys.h"
@@ -33,10 +29,11 @@
// Literals
-_LIT(KUSBExe, "usbapplication.exe");
-const TInt KUSBUIUid = 0x2002BCA3;
-_LIT(KFileDrive,"z:");
-_LIT(KUSBUIconFileName, "usbui.mif");
+_LIT(KUSBExe, "USBSettingsApp");
+const TInt KUSBUIUid = 0x2002E70C;
+const TInt KTextIdLength = 40;
+
+_LIT(KUSBUIconFileName, "qtg_large_usb");
// ================= MEMBER FUNCTIONS =========================================
@@ -79,8 +76,7 @@
//this virtual function call is to the local CUSBUICableConnectedNotifier::
//Cancel, not to any possibly derived class implementation.
Cancel();
- delete iDialog;
-
+
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor completed"));
}
@@ -101,48 +97,39 @@
}
// ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::GetParamsL
+// CUSBUICableConnectedNotifier::StartDialogL
// Jump to RunL as soon as possible.
// ----------------------------------------------------------------------------
//
-void CUSBUICableConnectedNotifier::GetParamsL(const TDesC8& /*aBuffer*/,
+void CUSBUICableConnectedNotifier::StartDialogL(const TDesC8& /*aBuffer*/,
TInt aReplySlot, const RMessagePtr2& aMessage)
{
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetParamsL"));
+ FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL"));
if ( iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave(KErrInUse);
}
+ InitializeTextResolver();
+
iMessage = aMessage;
iNeedToCompleteMessage = ETrue;
iReplySlot = aReplySlot;
-
- // 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"));
-
- DisableKeylock();
- SuppressAppSwitching(ETrue);
- RunQueryL();
- SuppressAppSwitching(EFalse);
- RestoreKeylock();
-
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunL() completed"));
+ 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"));
}
// ----------------------------------------------------------------------------
@@ -153,8 +140,12 @@
void CUSBUICableConnectedNotifier::Cancel()
{
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() "));
-
- iDialog->Cancel(); // cancel the dialog, if it is active
+ if (iDialog)
+ {
+ iDialog->Close();
+ delete iDialog;
+ iDialog = NULL;
+ }
CompleteMessage(KErrCancel);
CUSBUINotifierBase::Cancel();
@@ -170,69 +161,50 @@
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,
- aDescription));
+ description));
+ FLOG(_L("[USBUINOTIF]\t get description called"));
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);
+
+ aDescription = HbTextResolverSymbian::LoadL(textIdPtr);
+ CleanupStack::PopAndDestroy(textId);
+ CleanupStack::PopAndDestroy(description);
CleanupStack::PushL(aDescription);
- aHeader = StringLoader::LoadL(R_USB_MODE_MSG_HEADER);
+
+ 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()"));
-
- _LIT(KNotificationType,"com.nokia.hb.devicenotificationdialog/1.0");
- _LIT(KTouchActivation, "touchActivation");
- _LIT(KIconName, "iconName");
- _LIT(KTitle, "title");
- _LIT(KText, "text");
-
- HBufC* header = NULL;
- HBufC* description =NULL;
- GetPersonalityStringLC(header, description);
-
- TFileName usbUiIconFilename( KFileDrive );
- usbUiIconFilename += KDC_APP_BITMAP_DIR;
- usbUiIconFilename += KUSBUIconFileName;
- if( iDialog )
- {
- delete iDialog;
- iDialog = NULL;
- }
- iDialog = CHbDeviceDialogSymbian::NewL();
- CHbSymbianVariantMap *parameters =CHbSymbianVariantMap::NewL();
- CleanupStack::PushL(parameters);
-
- AddParameterL(parameters, KTitle, header, CHbSymbianVariant::EDes);
- AddParameterL(parameters, KText, description, CHbSymbianVariant::EDes);
- AddParameterL(parameters, KIconName, &usbUiIconFilename, CHbSymbianVariant::EDes);
- TBool activation=ETrue;
- AddParameterL(parameters, KTouchActivation, &activation, CHbSymbianVariant::EBool);
-
- FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() show") );
- TBool error = iDialog->Show(KNotificationType ,*parameters, this);
- FTRACE( FPrint(
- _L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL() error = %d" ),
- error ) );
-
- CleanupStack::PopAndDestroy(parameters);
- CleanupStack::PopAndDestroy(header);
- CleanupStack::PopAndDestroy(description);
-
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RunQueryL completed"));
- }
// ----------------------------------------------------------------------------
// CUSBUICableConnectedNotifier::GetCurrentIdL
// get the current personality id
@@ -253,54 +225,28 @@
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL completed"));
}
-// ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::DataReceived
-// launches the QT usb ui setting
-// ----------------------------------------------------------------------------
-//
-void CUSBUICableConnectedNotifier::DataReceived(CHbSymbianVariantMap& aData)
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::DataReceived"));
- _LIT(KResult, "result");
- _LIT(KActivated, "activated");
- TInt result = 0;
- MDesCArray& keys = aData.Keys();
- HBufC* key = NULL;
- for(TInt i = 0; i < keys.MdcaCount(); i++)
- {
- result = keys.MdcaPoint(i).Compare(KResult);
- if (result == 0)
- {
- key = HBufC::New(KResult().Length());
- if (key)
- {
- *key = KResult;
- const CHbSymbianVariant* variant = aData.Get(*key);
- delete key;
- HBufC* value = static_cast<HBufC*>(variant->Data());
- result = value->Des().Compare(KActivated);
- if (result == 0)
- {
- TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
- TUid::Uid(KUSBUIUid));
- LaunchApplication(KUSBExe(), uidtype);
- }
- break;
- }
- }
- }
- }
+
-// ----------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::DeviceDialogClosed
-// ----------------------------------------------------------------------------
-//
- void CUSBUICableConnectedNotifier::DeviceDialogClosed(TInt aCompletionCode)
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::DeviceDialogClosed()"));
- CompleteMessage(aCompletionCode);
- }
-
+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"));
+
+ }
// ---------------------------------------------------------------------------
// CUSBUICableConnectedNotifier::LaunchApplication()
// launches the application
@@ -319,26 +265,5 @@
usbUiProcess.Close();
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() completed"));
}
-
-// ---------------------------------------------------------------------------
-// CUSBUICableConnectedNotifier::AddParameter()
-// Adds a string parameter to the dialog parameters.
-// ---------------------------------------------------------------------------
-//
-void CUSBUICableConnectedNotifier::AddParameterL(
- CHbSymbianVariantMap* aParameters,
- const TDesC& aKey,
- const TAny* aData,
- CHbSymbianVariant::TType aDataType)
- {
- FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter()") );
- FTRACE( FPrint(
- _L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::RunQueryL() aKey = %S" ),
- &aKey ) );
- CHbSymbianVariant* variant = CHbSymbianVariant::NewL(aData, aDataType);
- //aParameters takes variant ownership
- User::LeaveIfError(aParameters->Add(aKey, variant));
- FLOG( _L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::AddStringParameter() completed") );
- }
// End of File
--- a/usbuis/usbuinotif/src/usbuinmain.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuinmain.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -19,10 +19,9 @@
#include <ecom/ecom.h>
#include <ecom/implementationproxy.h>
#include <eiknotapi.h>
-#include <eikenv.h>
#include "usbuincableconnectednotifier.h"
-#include "usbuinqueriesnotifier.h"
+#include "usbuinqueriesnotifiermdrv.h"
#include "usbuinotifdebug.h"
#include "usbuinotifotgwarning.h"
#include "usbuinotifotgerror.h"
@@ -115,9 +114,9 @@
// ----------------------------------------------------------------------------
const TImplementationProxy ImplementationTable[] =
- {
+{
IMPLEMENTATION_PROXY_ENTRY( 0x10281F23, NotifierArray )
- };
+};
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
TInt& aTableCount)
--- a/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -11,25 +11,24 @@
*
* Contributors:
*
-* Description: USB UI queries notifier class.
+* Description: USB UI MSMM Error notifier class.
*
*/
// 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 <usb/hostms/srverr.h>
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h> // dialog
+#include <hb/hbcore/hbtextresolversymbian.h>
+#include <usb/hostms/srverr.h>
+#include <usbuinotif.h> // pck
+#include "usbuinotifmsmmerror.h" // Own class definition
+#include "usbuinotifdebug.h" // Debugging macros
-#include <usbuinotif.h> // pck
-#include <usbuinotif.rsg> // Own resources
-#include "usbuinotifmsmmerror.h" // Own class definition
-#include "usbuinotifdebug.h" // Debugging macros
-#include "usbuinotifsecondarydisplay.h" // Dialog index for cover UI
+
+// CONSTANTS
+/** granularity for allocating error strings */
+const TInt KUsbMsmmErrorGranularity = 3;
+
// ================= MEMBER FUNCTIONS =========================================
// ----------------------------------------------------------------------------
@@ -53,7 +52,7 @@
// ----------------------------------------------------------------------------
//
CUsbUiNotifMSMMError::CUsbUiNotifMSMMError() :
- iStringIds( KUsbUiNotifOtgGeneralQueryGranularity)
+ iStringIds(NULL)
{
}
@@ -66,15 +65,21 @@
//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();
}
void CUsbUiNotifMSMMError::ConstructL()
{
CUSBUINotifierBase::ConstructL();
- 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);
+ 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");
+
+ iStringIds->AppendL(KGeneralError);
+ iStringIds->AppendL(KUnknownFileSys);
+ iStringIds->AppendL(KOutOfMemory);
}
// ----------------------------------------------------------------------------
@@ -95,15 +100,17 @@
// Jump to RunL as soon as possible.
// ----------------------------------------------------------------------------
//
-void CUsbUiNotifMSMMError::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+void CUsbUiNotifMSMMError::StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage)
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL"));
- if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage)
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL"));
+ if (iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave( KErrInUse );
}
+ InitializeTextResolver();
+
iMessage = aMessage;
iNeedToCompleteMessage = ETrue;
iReplySlot = aReplySlot;
@@ -111,51 +118,43 @@
// Get parameters
//
THostMsErrData error;
- TPckgC<THostMsErrData> pckg( error);
+ TPckgC<THostMsErrData> pckg( error );
pckg.Set( aBuffer );
+ int errorId = EUsbMSMMGeneralError;
switch (pckg().iError)
{
case EHostMsErrUnknownFileSystem:
- iErrorId = EUsbMSMMUnknownFileSystem;
+ errorId = EUsbMSMMUnknownFileSystem;
break;
case EHostMsErrOutOfMemory:
- iErrorId = EUsbMSMMOutOfMemory;
+ errorId = EUsbMSMMOutOfMemory;
break;
default:
- iErrorId = EUsbMSMMGeneralError;
+ errorId = EUsbMSMMGeneralError;
+ }
+
+ //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::GetParamsL() deleting previous dialog"));
+ delete iQuery;
+ iQuery = NULL;
}
-
- 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 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;
-
- DisableKeylock();
- SuppressAppSwitching( ETrue );
-
- //Excute dialog and check return value
- returnValue = QueryUserResponseL();
-
- SuppressAppSwitching( EFalse );
- RestoreKeylock();
- CompleteMessage( returnValue );
-
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL() completed"));
- }
-
-// ----------------------------------------------------------------------------
// CUsbUiNotifMSMMError::Cancel
// Release all own resources (member variables)
// ----------------------------------------------------------------------------
@@ -165,43 +164,43 @@
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel"));
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;
}
- CompleteMessage( KErrCancel );
-
+ CUSBUINotifierBase::Cancel();
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed"));
}
// ----------------------------------------------------------------------------
-// CUsbUiNotifMSMMError::QueryUserResponseL
-// Show query dialog.
+// Call back function to observe device message box closing.
// ----------------------------------------------------------------------------
//
-TInt CUsbUiNotifMSMMError::QueryUserResponseL()
+void CUsbUiNotifMSMMError::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::QueryUserResponseL"));
- TInt returnValue = KErrNone;
- TInt resourceId = R_USB_QUERY_OTG_ERROR;
+ 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.
- iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
-
- if (iCoverDisplaySupported)
+ if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton)
{
- iQuery->PublishDialogL( iErrorId, KUsbUiNotifMsmmError );
+ returnValue = KErrNone;
+ }
+ else
+ {
+ returnValue = KErrCancel;
}
- 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 CUsbUiNotifMSMMError::QueryUserResponseL completed"));
- return returnValue;
+ CompleteMessage( returnValue );
+
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));
}
// End of File
--- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -17,18 +17,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> // dialog
+#include <hb/hbcore/hbtextresolversymbian.h>
#include <usbuinotif.h> // pck
-#include <usbuinotif.rsg> // Own resources
#include "usbuinotifotgerror.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
-#include "usbuinotifsecondarydisplay.h" // Dialog index for cover UI
+
+// CONSTANTS
+/** granularity for allocating error strings */
+const TInt KUsbOtgErrorGranularity = 7;
+
+
// ================= MEMBER FUNCTIONS =========================================
// ----------------------------------------------------------------------------
@@ -52,7 +51,7 @@
// ----------------------------------------------------------------------------
//
CUsbUiNotifOtgError::CUsbUiNotifOtgError() :
- iStringIds( KUsbUiNotifOtgGeneralQueryGranularity)
+ iStringIds(NULL)
{
}
@@ -65,19 +64,29 @@
//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();
}
void CUsbUiNotifOtgError::ConstructL()
{
CUSBUINotifierBase::ConstructL();
- 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);
+ 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);
+
}
// ----------------------------------------------------------------------------
@@ -98,60 +107,47 @@
// Jump to RunL as soon as possible.
// ----------------------------------------------------------------------------
//
-void CUsbUiNotifOtgError::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+void CUsbUiNotifOtgError::StartDialogL(const TDesC8& aBuffer, TInt aReplySlot,
const RMessagePtr2& aMessage)
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL"));
- if (iQuery || iReplySlot != 0 || iNeedToCompleteMessage)
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::StartDialogL"));
+ if (iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave( KErrInUse );
}
-
- // Get parameters
- //
+
+ InitializeTextResolver();
- TPckgC<TInt> pckg( iErrorId );
+ TInt errorId = 0;
+ TPckgC<TInt> pckg( errorId );
pckg.Set( aBuffer );
- iErrorId = pckg();
+ errorId = pckg();
- FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), iErrorId ));
- if ( iErrorId < 0 || iErrorId >= iStringIds.Count() )
+ FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::GetParamsL iErrorId: %d"), errorId ));
+ if ( errorId < 0 || errorId >= iStringIds->MdcaCount())
{
User::Leave( KErrArgument);
}
-
iMessage = aMessage;
iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
-
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* stat = &iStatus;
- User::RequestComplete( stat, KErrNone );
- 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;
-
- DisableKeylock();
- SuppressAppSwitching( ETrue );
-
- //Excute dialog and check return value
- returnValue = QueryUserResponseL();
-
- SuppressAppSwitching( EFalse );
- RestoreKeylock();
- CompleteMessage( returnValue );
-
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::RunL() completed"));
+ iReplySlot = aReplySlot;
+
+ if (iQuery)
+ {
+ delete iQuery;
+ iQuery = NULL;
+ }
+
+ 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"));
}
// ----------------------------------------------------------------------------
@@ -164,43 +160,41 @@
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel"));
if (iQuery)
{
+ iQuery->Close();
delete iQuery;
iQuery = NULL;
}
- CompleteMessage( KErrCancel );
+ CUSBUINotifierBase::Cancel();
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::Cancel() completed"));
}
-
// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgError::QueryUserResponseL
-// Show query dialog.
+// Call back function to observe device message box closing.
// ----------------------------------------------------------------------------
//
-TInt CUsbUiNotifOtgError::QueryUserResponseL()
+void CUsbUiNotifOtgError::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgError::QueryUserResponseL"));
- TInt returnValue = KErrNone;
- TInt resourceId = R_USB_QUERY_OTG_ERROR;
+ 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.
- iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
-
- if (iCoverDisplaySupported)
+ if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton)
{
- iQuery->PublishDialogL( iErrorId, KUsbUiNotifOtgError );
+ returnValue = KErrNone;
+ }
+ else
+ {
+ returnValue = KErrCancel;
}
- 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;
+ CompleteMessage( returnValue );
+
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));
}
+
// End of File
--- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -17,15 +17,16 @@
// INCLUDE FILES
-#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 <hb/hbwidgets/hbdevicemessageboxsymbian.h>
+#include <hb/hbcore/hbtextresolversymbian.h>
#include "usbuinotifotgwarning.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
-#include "usbuinotifsecondarydisplay.h" // Dialog index for cover UI
+
+
+// CONSTANTS
+/** granularity for allocating warning strings */
+const TInt KUsbOtgWarningGranularity = 1;
+
// ================= MEMBER FUNCTIONS =========================================
// ----------------------------------------------------------------------------
@@ -51,7 +52,7 @@
// ----------------------------------------------------------------------------
//
CUsbUiNotifOtgWarning::CUsbUiNotifOtgWarning() :
- iStringIds( KUsbUiNotifOtgGeneralNoteGranularity), iNote( NULL)
+ iStringIds(NULL), iNote( NULL)
{
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::constructor()"));
}
@@ -66,6 +67,7 @@
//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()"));
}
@@ -73,7 +75,9 @@
void CUsbUiNotifOtgWarning::ConstructL()
{
CUSBUINotifierBase::ConstructL();
- iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORT);
+ iStringIds = new (ELeave) CDesCArrayFlat(KUsbOtgWarningGranularity);
+ _LIT(KPartiallySupported, "txt_usb_info_partially_supported_usb_device_connec");
+ iStringIds->AppendL( KPartiallySupported);
}
// ----------------------------------------------------------------------------
@@ -102,10 +106,11 @@
if (iNote)
{
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel - delete iNote"));
+ iNote->Close();
delete iNote;
iNote = NULL;
}
- CompleteMessage( KErrNone );
+ CUSBUINotifierBase::Cancel();
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel() completed"));
}
@@ -116,67 +121,73 @@
// This notifier is synchronous so this function is not used.
// ----------------------------------------------------------------------------
//
-void CUsbUiNotifOtgWarning::GetParamsL(const TDesC8& aBuffer,
+void CUsbUiNotifOtgWarning::StartDialogL(const TDesC8& aBuffer,
TInt aReplySlot, const RMessagePtr2& aMessage)
{
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL"));
- if (iNote || iReplySlot != 0 || iNeedToCompleteMessage)
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::StartDialogL"));
+ if (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.Count() )
+ FTRACE(FPrint(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL iNoteId: %d"), iNoteId ));
+ if ( iNoteId < 0 || iNoteId >= iStringIds->MdcaCount())
{
User::Leave( KErrArgument);
}
-
- iMessage = aMessage;
- iNeedToCompleteMessage = ETrue;
- iReplySlot = aReplySlot;
-
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* stat = &iStatus;
- User::RequestComplete( stat, KErrNone );
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL() completed"));
+ 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"));
}
// ----------------------------------------------------------------------------
-// CUsbUiNotifOtgWarning::RunL
-// Mandatory for Active Objects. This notifier is synchronous
-// so this function is not used.
+// Call back function to observe device message box closing.
// ----------------------------------------------------------------------------
//
-void CUsbUiNotifOtgWarning::RunL()
+void CUsbUiNotifOtgWarning::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
{
- FLOG(_L("[USBUINOTIF]\t 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.
- // Create confirmation note
- //
- HBufC* str = StringLoader::LoadL( iStringIds[iNoteId] );
- CleanupStack::PushL( str );
- iNote = new (ELeave) CAknWarningNote( ETrue );
-
- iNote->SetTimeout( CAknNoteDialog::ENoTimeout );
-
- if (iCoverDisplaySupported)
+ if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton)
{
- iNote->PublishDialogL( iNoteId, KUsbUiNotifOtgWarning );
+ returnValue = KErrNone;
+ }
+ else
+ {
+ returnValue = KErrCancel;
}
- TInt t = iNote->ExecuteLD( *str );
- iNote = NULL;
- CleanupStack::PopAndDestroy( str );
-
- CompleteMessage( KErrNone );
- FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RunL() completed"));
+ CompleteMessage( returnValue );
+
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));
}
// End of File
--- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -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"
@@ -16,18 +16,12 @@
*/
// 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 "usbuinqueriesnotifiermdrv.h" // Own class definition
#include "usbuinotifdebug.h" // Debugging macros
-#include <SecondaryDisplay/usbuinotifsecondarydisplay.h> // Dialog index for cover UI
// ================= MEMBER FUNCTIONS =========================================
@@ -84,49 +78,21 @@
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::GetParamsL(const TDesC8& aBuffer,
+void CUSBUIQueriesNotifier::StartDialogL(const TDesC8& aBuffer,
TInt aReplySlot, const RMessagePtr2& aMessage)
{
- FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetParamsL"));
- if (iUSBQueryDlg || iReplySlot != 0 || iNeedToCompleteMessage)
+ FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL"));
+ if ( iReplySlot != 0 || iNeedToCompleteMessage)
{
User::Leave( KErrInUse );
}
+
+ InitializeTextResolver();
iMessage = aMessage;
iNeedToCompleteMessage = ETrue;
@@ -140,59 +106,54 @@
// Save the type of the query for later use (dialog selection)
//
iQueryType = pckg().iQuery;
- if (iQueryType == EUSBNoMemoryCard)
+
+ if (iUSBQueryDlg)
{
- iNeedToCompleteMessage = EFalse;
+ delete iUSBQueryDlg;
+ iUSBQueryDlg = NULL;
}
- // 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 = 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)
{
- DisableKeylock();
- SuppressAppSwitching( ETrue );
- returnValue = QueryUserResponseL( *stringHolder, coverDialogId,
- isCancelKey, isErrorQuery );
- SuppressAppSwitching( EFalse );
- RestoreKeylock();
- CleanupStack::PopAndDestroy( stringHolder );
+ iUSBQueryDlg->SetTextL(*stringHolder);
}
- 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"));
+
+ iUSBQueryDlg->ShowL();
+ FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL() ShowL returned"));
+
+ CleanupStack::PopAndDestroy( stringHolder );
+
+
+ FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL completed"));
}
// ----------------------------------------------------------------------------
@@ -205,127 +166,40 @@
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"));
}
-// ----------------------------------------------------------------------------
-// CUSBUIQueriesNotifier::QueryUserResponseL
-// Show query dialog.
-// ----------------------------------------------------------------------------
-//
-TInt CUSBUIQueriesNotifier::QueryUserResponseL(const TDesC& aStringHolder,
- TInt aCoverDialogId, TBool aIsCancelKey, TBool aIsErrorQuery)
- {
- FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL"));
- TInt returnValue = KErrNone;
-
- iUSBQueryDlg = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
- // Show dialog with or without the Cancel
- //
- if (aIsErrorQuery)
+void CUSBUIQueriesNotifier::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
+ {
+ 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.
+
+ if (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton)
{
- // 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)
+ returnValue = KErrNone;
+ }
+ else
{
- iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITH_CANCEL );
- }
- else
- {
- iUSBQueryDlg->PrepareLC( R_USB_QUERY_WITHOUT_CANCEL );
+ returnValue = KErrCancel;
}
- 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;
- FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL keypress"));
- }
- else
- {
- returnValue = KErrCancel;
- FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL NO keypress"));
- }
-
- FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::QueryUserResponseL completed"));
- return returnValue;
+ CompleteMessage( returnValue );
+
+ FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed"));
}
-// ----------------------------------------------------------------------------
-// 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;
- }
- 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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Fri Jun 11 14:38:00 2010 +0300
@@ -1,230 +1,375 @@
-/*
-* 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
-*
-*/
+ // 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
-// UsbUiNotifApiTest Module - total 21 tc
+//Message box pause before dismiss (enter key)
+DISMISS_PAUSE 1500
+
+//Device notification dialog touch coordinates
+DEVICENOTIF_X 141
+DEVICENOTIF_Y 47
-// UsbUiNotifApiTest Api Tests (... tc)
+//Device notification dialog pause before touch
+DEVICENOTIF_PAUSE 1000
+[Enddefine]
-// Cable connected notifier tests (3)
+
+// Cable connected notifier tests
[Test]
-title USB Ovi Suite Personality Info (Cable Connected Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock CableConnectedNotifierTest PCSUITEMTP
-pause 4000
-delete tester
-[Endtest]
-
-[Test]
-title USB MS Personality Info (Cable Connected Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock CableConnectedNotifierTest MS
-pause 4000
-delete tester
-[Endtest]
-
-[Test]
-title USB MTP Personality Info (Cable Connected Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock CableConnectedNotifierTest MTP
-pause 4000
+title USB Cable Connected (Cable Connected Notifier Test)
+create USBUiNotifApiTest tester
+tester CableConnectedNotifierTest PCSUITEMTP
+tester FinishCableConnectedQuery CANCEL
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
+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 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
+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
delete tester
[Endtest]
[Test]
-title USB Storage Media Failure Query Accepted/Device Key 0 Pressed (USB Queries Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBStorageMediaFailure
-pause 1000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
[Test]
-title USB Change From Mass Storage Query Accepted/Device Key Enter Pressed (USB Queries Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
-pause 3000
+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
presskey global EKeyEnter
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+tester WaitForRequest
+tester UsbQueriesNotifierTest EUSBStorageMediaFailure
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
+
+// OTG Errors
+
[Test]
-title USB Change From Mass Storage Query Accepted/Device Key 0 Pressed (USB Queries Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
[Test]
-title USB Change From Mass Storage Query Cancelled (USB Queries Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbQueriesNotifierTest EUSBChangeFromMassStorage
-pause 3000
-presskey global EKeyDevice1
-tester ExecuteApiTestBlock FinishQuery CANCEL
-delete tester
-[Endtest]
-
-
-[Test]
-title OTG Error too much power (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgTooMuchPower
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
-delete tester
-[Endtest]
-
-[Test]
-title OTG Error too much power (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgTooMuchPowerRequired
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
[Test]
title OTG Error unsupported device (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+create USBUiNotifApiTest tester
+tester UsbOTGErrorNotifierTests EUsbOtgUnsupportedDevice
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
[Test]
title OTG Error Hub not supported device (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgHubUnsupported
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+create USBUiNotifApiTest tester
+tester UsbOTGErrorNotifierTests EUsbOtgHubUnsupported
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
[Test]
title OTG Error error in connection (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgErrorInConnection
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+create USBUiNotifApiTest tester
+tester UsbOTGErrorNotifierTests EUsbOtgErrorInConnection
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
[Test]
title OTG Attach timed out (Otg Error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGErrorNotifierTests EUsbOtgErrorAttachTimedOut
-pause 3000
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+create USBUiNotifApiTest tester
+tester UsbOTGErrorNotifierTests EUsbOtgErrorAttachTimedOut
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
[Test]
-title OTG Partially supported device (Otg Warning Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbOTGWarningNotifierTests EUsbOtgPartiallySupportedDevice
-pause 500
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+title OTG Error no memory (Otg Error Notifier Test)
+create USBUiNotifApiTest tester
+tester UsbOTGErrorNotifierTests EUsbOtgErrorNoMemory
+pause DISMISS_PAUSE
+presskey global EKeyEnter
+tester FinishQuery CANCEL
delete tester
[Endtest]
[Test]
-title Load and Unload notifiers
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock LoadNotifiers
-pause 500
-tester ExecuteApiTestBlock UnLoadNotifiers
+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
delete tester
[Endtest]
[Test]
-title MSMM error test (MSMM error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMGeneralError
-pause 500
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
+
+// OTG Warnings
+
[Test]
-title MSMM error test (MSMM error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMUnknownFileSystem
-pause 500
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
[Test]
-title MSMM error test (MSMM error Notifier Test)
-create UsbUiNotifApiTest tester
-tester ExecuteApiTestBlock UsbMSMMNotifierTests EUsbMSMMOutOfMemory
-pause 500
-presskey global EKeyDevice0
-tester ExecuteApiTestBlock FinishQuery ACCEPT
+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
delete tester
[Endtest]
-// Add new api tests here
-// ...
+[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 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]
-// UsbUiNotifApiTest Module Tests (... tc)
+//MEikSrvNotifierBase2 API
-// Add new module tests here
-// ...
+[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]
-
-// UsbUiNotifApiTest Branch Tests (... tc)
+[Test]
+title Synchronous Start
+create USBUiNotifApiTest tester
+tester SynchStart EUsbOtgPartiallySupportedDevice
+delete tester
+[Endtest]
-// Add new branch tests here
-// ...
+[Test]
+title Update
+create USBUiNotifApiTest tester
+tester Update
+delete tester
+[Endtest]
\ No newline at end of file
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Fri Jun 11 14:38:00 2010 +0300
@@ -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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Fri Jun 11 14:38:00 2010 +0300
@@ -15,9 +15,6 @@
*
*/
-
-
-
#ifndef USBUINOTIFAPITEST_H
#define USBUINOTIFAPITEST_H
@@ -35,98 +32,57 @@
#include <usbwatcher.h>
#include <usb/hostms/srverr.h>
// CONSTANTS
-//const ?type ?constant_var = ?constant;
// MACROS
-//#define ?macro ?macro_def
#define TEST_CLASS_VERSION_MAJOR 0
#define TEST_CLASS_VERSION_MINOR 0
#define TEST_CLASS_VERSION_BUILD 0
// Logging path
-//_LIT( KUsbUiNotifApiTestLogPath, "\\logs\\testframework\\UsbUiNotifApiTest\\" );
-
-// Logging path for ATS - for phone builds comment this line
-_LIT( KUsbUiNotifApiTestLogPath, "e:\\testing\\stiflogs\\" );
+_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 ?FORWARD_CLASSNAME;
-class CUsbUiNotifApiTest;
+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
/**
@@ -139,14 +95,6 @@
protected: // New functions
- /**
- * ?member_description.
- * @since ?Series60_version
- * @param ?arg1 ?description
- * @return ?description
- */
- //?type ?member_function( ?type ?arg1 );
-
protected: // Functions from base classes
/**
@@ -159,18 +107,13 @@
/**
* 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
@@ -180,13 +123,23 @@
/**
* Test methods are listed below.
*/
-
- virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
- virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
- virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
-
-
-
+ 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 );
/**
* Method used to log version of test class
*/
@@ -194,52 +147,22 @@
//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;
@@ -254,20 +177,15 @@
THostMsErrData iErrData;
THostMsErrorDataPckg iErrPckg ;
- // Reserved pointer for future extension
- //TAny* iReserved;
-
public: // Friend classes
//?friend_class_declaration;
protected: // Friend classes
//?friend_class_declaration;
private: // Friend classes
//?friend_class_declaration;
-
+
};
-#include "UsbUiNotifApiTestDebug.inl"
-
#endif // USBUINOTIFAPITEST_H
// End of File
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#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/init/usbuinotifapitest.ini Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Fri Jun 11 14:38:00 2010 +0300
@@ -110,7 +110,7 @@
[New_Module]
ModuleName= testscripter
-TestCaseFile= e:\testing\conf\ui_USBUiNotifApiTest.cfg
+TestCaseFile= e:\testing\conf\ui_usbuinotifapitest.cfg
[End_Module]
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Fri Jun 11 14:38:00 2010 +0300
@@ -65,7 +65,7 @@
CreateTestReport= YES # Possible values: YES or NO
-TestReportFilePath= c:\logs\testframework\UsbUiNotifApiTest\
+TestReportFilePath= c:\logs\testframework\usbuinotifapitest\
TestReportFileName= testreport
TestReportFormat= TXT # Possible values: TXT, HTML or XML
@@ -110,7 +110,7 @@
[New_Module]
ModuleName= testscripter
-TestCaseFile= c:\testframework\ui_UsbUiNotifApiTest.cfg
+TestCaseFile= c:\testframework\ui_usbuinotifapitest.cfg
[End_Module]
--- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -15,88 +15,57 @@
*
*/
-
-
-
// 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)
{
@@ -111,7 +80,7 @@
User::Leave(ret);
}
// Close Setting server session
- settingServer.Close();
+ CleanupStack::PopAndDestroy(&settingServer);
TFileName logFileName;
@@ -119,46 +88,48 @@
{
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();
+ CleanupStack::Pop( self );
return self;
}
// Destructor
-CUsbUiNotifApiTest::~CUsbUiNotifApiTest()
+CUSBUiNotifApiTest::~CUSBUiNotifApiTest()
{
// Delete resources allocated from test methods
@@ -170,11 +141,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;
@@ -182,7 +153,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);
@@ -199,7 +170,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 Fri Jun 04 10:27:39 2010 +0100
+++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Fri Jun 11 14:38:00 2010 +0300
@@ -15,101 +15,85 @@
*
*/
-
-
-
// [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
-//const ?type ?constant_var = ?constant;
+#ifdef __WINS__
+_LIT( KUsbAppProcPattern, "usb[*" );
+#else
+_LIT( KUsbAppProcPattern, "#USBSettingsApp*" );
+#endif
// 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 ) /
@@ -120,374 +104,128 @@
}
// -----------------------------------------------------------------------------
-// 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
+// CUSBUiNotifApiTest::CableConnectedNotifierTests
// -----------------------------------------------------------------------------
-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 )
+TInt CUSBUiNotifApiTest::CableConnectedNotifierTest( CStifItemParser& /*aItem*/ )
{
- TRACE_INFO( _L(">>>DoExecuteModuleTestBlockL") );
-
- User::LeaveIfError( aItem.GetString( _L( "ExecuteModuleTestBlock" ), iTestBlockParams.iTestBlockName ) );
- TRACE_INFO( (_L("Module test type: %S"), &iTestBlockParams.iTestBlockName) );
-
- GetTestBlockParamsL( aItem );
-
- // Add new module test block branches with optional test parameters here
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
- iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
- }
- else
- {
- TRACE_INFO( _L("DoExecuteModuleTestBlockL() Test type: not found") );
- User::Leave( KErrNotFound );
- }
-
- TRACE_INFO( _L("<<<DoExecuteModuleTestBlockL") );
- }
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::ExecuteBranchTestBlock
-// -----------------------------------------------------------------------------
-
-TInt CUsbUiNotifApiTest::ExecuteBranchTestBlock( CStifItemParser& aItem )
- {
- TRACE_INFO( _L(">>>ExecuteBranchTestBlock") );
-
TInt res;
- TUsbUiNotifApiTestResult testResult;
-
- TRAP( res, DoExecuteBranchTestBlockL( aItem, testResult ) );
- if ( res != KErrNone )
- {
- TRACE_INFO( (_L("DoExecuteBranchTestBlockL error: %d"), res) );
- return res;
- }
-
- STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
- TRACE_INFO( _L("Test case passed") );
- TRACE_INFO( _L("<<<ExecuteBranchTestBlock") );
- return KErrNone;
- }
-
-
-void CUsbUiNotifApiTest::DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult )
- {
- TRACE_INFO( _L(">>>DoExecuteBranchTestBlockL") );
-
- User::LeaveIfError( aItem.GetString( _L( "ExecuteBranchTestBlock" ), iTestBlockParams.iTestBlockName ) );
- TRACE_INFO( (_L("Branch test type: %S"), &iTestBlockParams.iTestBlockName) );
-
- GetTestBlockParamsL( aItem );
-
- // Add new branch test block branches with optional test parameters here
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
- iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
- }
- else
- {
- TRACE_INFO( _L("DoExecuteBranchTestBlockL() Test type: not found") );
- User::Leave( KErrNotFound );
- }
-
- TRACE_INFO( _L("<<<DoExecuteBranchTestBlockL") );
- }
-
-// Add test block methods implementation here
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::ExampleTestL
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
- TInt aTestIntOption, TInt aTestCharOption, TUsbUiNotifApiTestResult& aTestResult )
- {
- TRACE_INFO( _L(">>>ExampleTestL") );
-
- if ( !aTestOption.Compare( _L( "API" ) ) )
- {
- TRACE_INFO( (_L("Api test option: %S"), &aTestOption) );
- TRACE_INFO( (_L("Api test sub-option: %S"), &aTestSubOption) );
- TRACE_INFO( (_L("Api test int option: %d"), aTestIntOption) );
- TRACE_INFO( (_L("Api test char option: %c"), aTestCharOption) );
- }
- else if ( !aTestOption.Compare( _L( "MODULE" ) ) )
- {
- TRACE_INFO( (_L("Module test option: %S"), &aTestOption) );
- TRACE_INFO( (_L("Module test sub-option: %S"), &aTestSubOption) );
- TRACE_INFO( (_L("Module test int option: %d"), aTestIntOption) );
- TRACE_INFO( (_L("Module test char option: %c"), aTestCharOption) );
- }
- else if ( !aTestOption.Compare( _L( "BRANCH" ) ) )
- {
- TRACE_INFO( (_L("Branch test option: %S"), &aTestOption) );
- TRACE_INFO( (_L("Branch test sub-option: %S"), &aTestSubOption) );
- TRACE_INFO( (_L("Branch test int option: %d"), aTestIntOption) );
- TRACE_INFO( (_L("Branch test char option: %c"), aTestCharOption) );
- }
- else
- {
- TRACE_INFO( _L("Invalid test parameter") );
- User::Leave( KErrNotFound );
- }
-
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<ExampleTestL") );
- }
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::CableConnectedNotifierTest
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::CableConnectedNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
- {
- TRACE_INFO( _L(">>>CableConnectedNotifierTest") );
-
- TInt res;
- TUSBConnectionNotifierParamsPckg emptyNotifierInputPckg;
- TPtrC displayedUsbPersonalityName( KNullDesC );
- TInt displayedUsbPersonalityId;
-
- res = GetPersonalityIdFromString( aTestSubOption, displayedUsbPersonalityId );
- if ( res != KErrNone )
- {
- TRACE_INFO( (_L("GetPersonalityIdFromString failed with value: %d"), res) );
- return;
- }
-
- res = iRepository -> Get( KUsbWatcherPersonality, iPersonalityIdBackup );
- if ( res != KErrNone )
- {
- TRACE_INFO( (_L("Personality backup failed with value (cenrep): %d"), res) );
- return;
- }
-
- res = iUsbWatcher -> Connect();
- if ( res != KErrNone )
- {
- TRACE_INFO( (_L("Failed to connect UsbWatcher with value: %d"), res) );
- return;
- }
- TRACE_INFO( _L("UsbWatcher connected") );
-
- iUsbWatcher -> SetPersonality( iReqStatus, displayedUsbPersonalityId, ETrue, ETrue );
- User::WaitForRequest( iReqStatus );
- if ( iReqStatus.Int() != KErrNone )
- {
- TRACE_INFO( (_L("Failed to set usb personality with value: %d"), iReqStatus.Int()) );
- iUsbWatcher -> Close();
- return;
- }
+ TPtrC8 dummyPckg; //no parameters used
res = iNotifier -> Connect();
if ( res != KErrNone )
{
- TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
- iUsbWatcher -> Close();
- return;
+ iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
+ return res;
}
- TRACE_INFO( _L("RNotifier connected") );
+ 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;
- iNotifier -> StartNotifierAndGetResponse( iReqStatus, KCableConnectedNotifierUid, emptyNotifierInputPckg, iConnectionNotifierResponseParamsPckg );
+ 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 );
+ iUsbWatcher -> Close();
+ iNotifier -> Close();
+ return res;
+ }
+
+ iLog -> Log( _L("FinishCableConnectedQuery wait for request") );
User::WaitForRequest( iReqStatus );
+ expectedErrorCode = iReqStatus.Int();
+
+ iLog -> Log( _L("FinishCableConnectedQuery request complete") );
- TRACE_INFO((_L("StartNotifierAndGetResponse Status: %d, expected: %d"), iReqStatus.Int(), KErrCancel));
- if(iReqStatus.Int() == KErrCancel)
- aTestResult = ETestCasePassed;
+ iNotifier -> Close();
+
+ iLog -> Log( _L("FinishCableConnectedQuery close") );
- TRACE_INFO( _L("<<<CableConnectedNotifierTest") );
+ 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;
}
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::UsbQueriesNotifierTest
+// CBtNotifApiTest::UsbQueriesNotifierTests
// -----------------------------------------------------------------------------
-void CUsbUiNotifApiTest::UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::UsbQueriesNotifierTest( CStifItemParser& aItem )
{
- TRACE_INFO( _L(">>>UsbQueriesNotifierTest") );
TInt res;
+ TPtrC usbQueryName( KNullDesC );
TUSBUIQueries usbQueryType;
-
- res = GetQueryType( aTestSubOption, usbQueryType );
+ res = aItem.GetString( _L( "UsbQueriesNotifierTest" ), usbQueryName );
if ( res != KErrNone )
{
- TRACE_INFO( (_L("GetQueryType failed with value: %d"), res) );
- return;
+ 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;
}
TUSBQueriesNotiferParams notifierParams;
@@ -496,13 +234,17 @@
TUSBQueriesNotifierParamsPckg notifierParamsPckg( notifierParams );
TPckgBuf<TBool> output;
- res = iNotifier -> Connect();
+ if (!iNotifierConnected)
+ {
+ res = iNotifier -> Connect();
+ iNotifierConnected = ETrue;
+ }
if ( res != KErrNone )
{
- TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
- return;
+ iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
+ return res;
}
- TRACE_INFO( _L("RNotifier connected") );
+ iLog -> Log( _L("RNotifier connected") );
switch( usbQueryType )
{
@@ -517,200 +259,329 @@
break;
}
- iNotifier -> StartNotifierAndGetResponse( iReqStatus, KQueriesNotifier, notifierParamsPckg, output );
-
- aTestResult = ETestCasePassed;
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus, KQueriesNotifier,
+ notifierParamsPckg, output );
+ iLog -> Log( _L("StartNotifierAndGetResponse ready") );
- TRACE_INFO( _L("<<<UsbQueriesNotifierTest") );
+ return KErrNone;
}
-
+
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::UsbOTGErrorNotifierTests
+// CBtNotifApiTest::UsbOTGErrorNotifierTests
// -----------------------------------------------------------------------------
-void CUsbUiNotifApiTest::UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::UsbOTGErrorNotifierTests( CStifItemParser& aItem )
{
- TRACE_INFO( _L(">>>UsbOTGErrorNotifierTests") );
+ TInt res;
+ TPtrC usbQueryName( KNullDesC );
+ TUsbUiNotifOtgError usbOTGErrorType;
- TInt res;
- TUsbUiNotifOtgError usbOTGErrorType;
-
- res = GetOTGErrorType( aTestSubOption, usbOTGErrorType );
+ res = aItem.GetString( _L( "UsbOTGErrorNotifierTests" ), usbQueryName );
if ( res != KErrNone )
{
- TRACE_INFO( (_L("usbOTGErrorType failed with value: %d"), res) );
- return;
+ 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;
}
- res = iNotifier -> Connect();
+ if (!iNotifierConnected)
+ {
+ res = iNotifier -> Connect();
+ iNotifierConnected = ETrue;
+ }
if ( res != KErrNone )
{
- TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
- return;
+ iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
+ return res;
}
- TRACE_INFO( _L("RNotifier connected") );
+ iLog -> Log( _L("RNotifier connected") );
TPckgBuf<TInt> notifierParamsPckg;
notifierParamsPckg() = usbOTGErrorType;
iCompleteQuery = EFalse;
- iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, notifierParamsPckg, iRes );
-
- aTestResult = ETestCasePassed;
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus,
+ KUsbUiNotifOtgError, notifierParamsPckg, iRes );
- TRACE_INFO( _L("<<<UsbOTGErrorNotifierTests") );
+ return KErrNone;
}
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::UsbOTGWarningNotifierTests
+// CBtNotifApiTest::UsbOTGErrorNotifierTests
// -----------------------------------------------------------------------------
-void CUsbUiNotifApiTest::UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::UsbOTGWarningNotifierTests( CStifItemParser& aItem )
{
- TRACE_INFO( _L(">>>UsbOTGWarningNotifierTests") );
-
TInt res;
+ TPtrC usbQueryName( KNullDesC );
TUsbUiNotifOtgWarning usbOTGWarningType;
-
- res = GetOTGWarningType( aTestSubOption, usbOTGWarningType );
+ res = aItem.GetString( _L( "UsbOTGWarningNotifierTests" ), usbQueryName );
if ( res != KErrNone )
{
- TRACE_INFO( (_L("usbOTGErrorType failed with value: %d"), res) );
- return;
+ 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;
}
- res = iNotifier -> Connect();
+ if (!iNotifierConnected)
+ {
+ res = iNotifier -> Connect();
+ iNotifierConnected = ETrue;
+ }
if ( res != KErrNone )
{
- TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
- return;
+ iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
+ return res;
}
- TRACE_INFO( _L("RNotifier connected") );
+ iLog -> Log( _L("RNotifier connected") );
TPckgBuf<TInt> notifierParamsPckg;
notifierParamsPckg() = usbOTGWarningType;
iCompleteQuery = EFalse;
- iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgWarning, notifierParamsPckg, iRes );
-
- aTestResult = ETestCasePassed;
+ iNotifier -> StartNotifierAndGetResponse( iReqStatus,
+ KUsbUiNotifOtgWarning, notifierParamsPckg, iRes );
- TRACE_INFO( _L("<<<UsbOTGWarningNotifierTests") );
+ return KErrNone;
}
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::UsbMSMMNotifierTests
+// CBtNotifApiTest::UsbMSMMNotifierTests
// -----------------------------------------------------------------------------
-void CUsbUiNotifApiTest::UsbMSMMNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::UsbMSMMNotifierTests( CStifItemParser& aItem )
{
- TRACE_INFO( _L(">>>UsbMSMMNotifierTests") );
-
TInt res;
+ TPtrC usbQueryName( KNullDesC );
THostMsErrCode usbMSMMNErrorType;
- res = GetMSMMrrorType( aTestSubOption, usbMSMMNErrorType );
+ iLog -> Log( _L("------msmm------") );
+
+ res = aItem.GetString( _L( "UsbMSMMNotifierTests" ), usbQueryName );
if ( res != KErrNone )
{
- TRACE_INFO( (_L("MSMMrrorType failed with value: %d"), res) );
- return;
+ 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;
}
iErrData.iError=usbMSMMNErrorType;
iErrPckg = iErrData;
- res = iNotifier -> Connect();
+ if (!iNotifierConnected)
+ {
+ res = iNotifier -> Connect();
+ iNotifierConnected = ETrue;
+ }
if ( res != KErrNone )
{
- TRACE_INFO( (_L("Failed to connect RNotifier with value: %d"), res) );
- return;
+ iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res );
+ return res;
}
- TRACE_INFO( _L("RNotifier connected") );
+ iLog -> Log( _L("RNotifier connected") );
TPckgBuf<TInt> notifierParamsPckg;
notifierParamsPckg() = usbMSMMNErrorType;
iCompleteQuery = EFalse;
iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifMsmmError, iErrPckg, iRes );
+
+ return KErrNone;
+ }
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<UsbMSMMNotifierTests") );
+
+TInt CUSBUiNotifApiTest::CancelMsmmNotifier( CStifItemParser& /*aItem*/ )
+ {
+ return ( iNotifier->CancelNotifier(KUsbUiNotifMsmmError) );
+ }
+
+
+TInt CUSBUiNotifApiTest::CancelQueryNotifier( CStifItemParser& /*aItem*/ )
+ {
+ iLog -> Log( _L("CancelQueryNotifier") );
+ return ( iNotifier->CancelNotifier(KQueriesNotifier) );
}
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::FinishQuery
-// -----------------------------------------------------------------------------
+TInt CUSBUiNotifApiTest::CancelOtgErrorNotifier( CStifItemParser& /*aItem*/ )
+ {
+ return ( iNotifier->CancelNotifier(KUsbUiNotifOtgError) );
+ }
+
+TInt CUSBUiNotifApiTest::CancelOtgWarningNotifier( CStifItemParser& /*aItem*/ )
+ {
+ return ( iNotifier->CancelNotifier(KUsbUiNotifOtgWarning) );
+ }
+
+TInt CUSBUiNotifApiTest::CancelCableConnectedNotifier( CStifItemParser& /*aItem*/ )
+ {
+ return ( iNotifier->CancelNotifier(KCableConnectedNotifierUid) );
+ }
+
+TInt CUSBUiNotifApiTest::WaitForRequest( CStifItemParser& /*aItem*/ )
+ {
+ User::WaitForRequest( iReqStatus );
+ return KErrNone;
+ }
-TInt CUsbUiNotifApiTest::FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::SynchStart(CStifItemParser& aItem )
+{
+ TInt res;
+ TPtrC usbQueryName( KNullDesC );
+ TUsbUiNotifOtgWarning usbOTGWarningType;
+
+ res = aItem.GetString( _L( "SynchStart" ), usbQueryName );
+ 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;
+ }
+
+
+ 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 )
{
- TRACE_INFO( _L(">>>FinishQuery") );
-
+ 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 );
- }
+ }
- res = GetTestOption( aTestSubOption, option );
+ iLog -> Log( _L("FinishQuery getting options") );
+ res = aItem.GetString( _L( "FinishQuery" ), optionName );
if ( res != KErrNone )
{
- TRACE_INFO( (_L("GetTestOption failed with value: %d"), res) );
+ iLog -> Log( _L("GetString failed with value: %d"), res );
iNotifier -> Close();
return res;
}
- User::WaitForRequest( iReqStatus );
+ 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") );
iNotifier -> Close();
+ iNotifierConnected = EFalse;
switch( option )
{
case EQueryAccepted:
- TRACE_INFO( (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone) );
+ iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone );
STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() );
break;
case EQueryCanceled:
- TRACE_INFO( (_L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel) );
+ iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel );
STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() );
break;
default:
return KErrNotFound;
}
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<FinishQuery") );
-
+ iLog -> Log( _L("Test case passed!") );
return KErrNone;
}
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::LoadNotifiersL
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult )
+TInt CUSBUiNotifApiTest::LoadNotifiersL( CStifItemParser& /*aItem*/ )
{
- TRACE_INFO( _L(">>>LoadNotifiersL") );
-
iNotifierArray = reinterpret_cast<CArrayPtr<MEikSrvNotifierBase2>*>(
REComSession::CreateImplementationL(TUid::Uid(0x10281F23), iInstanceUid));
-
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<LoadNotifiersL") );
+ return KErrNone;
}
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::UnLoadNotifiers
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::UnLoadNotifiers ( TUsbUiNotifApiTestResult& aTestResult )
+
+TInt CUSBUiNotifApiTest::UnLoadNotifiers ( CStifItemParser& /*aItem*/ )
{
- TRACE_INFO( _L(">>>UnLoadNotifiers") );
-
TInt count = iNotifierArray->Count();
TInt i=0;
for (i=0; i<count; i++)
@@ -719,216 +590,154 @@
}
iNotifierArray->Reset();
delete iNotifierArray;
+ iNotifierArray = NULL;
REComSession::DestroyedImplementation(iInstanceUid);
-
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<UnLoadNotifiers") );
- }
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::Update
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::Update( TUsbUiNotifApiTestResult& aTestResult )
- {
- TRACE_INFO( _L(">>>Update") );
- TInt count = iNotifierArray->Count();
- TInt i=0;
- _LIT8(test, "test");
- TBuf8<32> buf(test);
- for (i=0; i<count; i++)
- {
- iNotifierArray->At(i)->UpdateL(buf);
- }
-
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<Update") );
+ return KErrNone;
}
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::Notifierstart
-// -----------------------------------------------------------------------------
-
-void CUsbUiNotifApiTest::Notifierstart( TUsbUiNotifApiTestResult& aTestResult )
+
+TInt CUSBUiNotifApiTest::GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType )
{
- TRACE_INFO( _L(">>>Notifierstart") );
- TInt count = iNotifierArray->Count();
- TInt i=0;
- _LIT8(test, "test");
- TBuf8<32> buf(test);
- for (i=0; i<count; i++)
- {
- iNotifierArray->At(i)->StartL(buf);
- }
-
- aTestResult = ETestCasePassed;
-
- TRACE_INFO( _L("<<<Notifierstart") );
- }
-
-
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetQueryType
-// -----------------------------------------------------------------------------
-
-TInt CUsbUiNotifApiTest::GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType )
- {
- TRACE_INFO( _L(">>>GetQueryType") );
if ( !aTypeString.Compare( _L( "EUSBNoMemoryCard" ) ) )
{
aQueryType = EUSBNoMemoryCard;
- TRACE_INFO( _L("Query type: EUSBNoMemoryCard") );
+ iLog -> Log( _L("Query type: EUSBNoMemoryCard") );
}
else if ( !aTypeString.Compare( _L( "EUSBStorageMediaFailure" ) ) )
{
aQueryType = EUSBStorageMediaFailure;
- TRACE_INFO( _L("Query type: EUSBStorageMediaFailure") );
+ iLog -> Log( _L("Query type: EUSBStorageMediaFailure") );
}
- else if ( !aTypeString.Compare( _L( "EUSBChangeFromMassStorage" ) ) )
+ else if ( !aTypeString.Compare( _L( "EUSBDiskFull" ) ) )
{
- aQueryType = EUSBChangeFromMassStorage;
- TRACE_INFO( _L("Query type: EUSBChangeFromMassStorage") );
+ aQueryType = EUSBDiskFull;
+ iLog -> Log( _L("Query type: EUSBDiskFull") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUSBNotEnoughRam" ) ) )
+ {
+ aQueryType = EUSBNotEnoughRam;
+ iLog -> Log( _L("Query type: EUSBNotEnoughRam") );
}
else
{
- TRACE_INFO( _L("Query type: not supported") );
+ iLog -> Log( _L("Query type: not supported") );
return KErrNotFound;
}
- TRACE_INFO( _L("<<<GetQueryType") );
+
return KErrNone;
}
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetOTGErrorType
-// -----------------------------------------------------------------------------
-
-TInt CUsbUiNotifApiTest::GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType )
+TInt CUSBUiNotifApiTest::GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType )
{
- TRACE_INFO( _L(">>>GetOTGErrorType") );
-
if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPower" ) ) )
{
aQueryType = EUsbOtgTooMuchPower;
- TRACE_INFO( _L("Query type: EUsbOtgTooMuchPower") );
+ iLog -> Log( _L("Query type: EUsbOtgTooMuchPower") );
}
else if ( !aTypeString.Compare( _L( "EUsbOtgTooMuchPowerRequired" ) ) )
{
aQueryType = EUsbOtgTooMuchPowerRequired;
- TRACE_INFO( _L("Query type: EUsbOtgTooMuchPowerRequired") );
+ iLog -> Log( _L("Query type: EUsbOtgTooMuchPowerRequired") );
}
else if ( !aTypeString.Compare( _L( "EUsbOtgUnsupportedDevice" ) ) )
{
aQueryType = EUsbOtgUnsupportedDevice;
- TRACE_INFO( _L("Query type: EUsbOtgUnsupportedDevice") );
+ iLog -> Log( _L("Query type: EUsbOtgUnsupportedDevice") );
}
else if ( !aTypeString.Compare( _L( "EUsbOtgHubUnsupported" ) ) )
{
aQueryType = EUsbOtgHubUnsupported;
- TRACE_INFO( _L("Query type: EUsbOtgHubUnsupported") );
+ iLog -> Log( _L("Query type: EUsbOtgHubUnsupported") );
}
else if ( !aTypeString.Compare( _L( "EUsbOtgErrorInConnection" ) ) )
{
aQueryType = EUsbOtgErrorInConnection;
- TRACE_INFO( _L("Query type: EUsbOtgErrorInConnection") );
+ iLog -> Log( _L("Query type: EUsbOtgErrorInConnection") );
}
else if ( !aTypeString.Compare( _L( "EUsbOtgErrorAttachTimedOut" ) ) )
{
aQueryType = EUsbOtgErrorAttachTimedOut;
- TRACE_INFO( _L("Query type: EUsbOtgErrorAttachTimedOut") );
+ iLog -> Log( _L("Query type: EUsbOtgErrorAttachTimedOut") );
+ }
+ else if ( !aTypeString.Compare( _L( "EUsbOtgErrorNoMemory" ) ) )
+ {
+ aQueryType = EUsbOtgErrorNoMemory;
+ iLog -> Log( _L("Query type: EUsbOtgErrorNoMemory") );
}
else
{
- TRACE_INFO( _L("Query type: not supported") );
+ iLog -> Log( _L("Query type: not supported") );
return KErrNotFound;
}
-
- TRACE_INFO( _L("<<<GetOTGErrorType") );
return KErrNone;
}
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetOTGWarningType
-// -----------------------------------------------------------------------------
-
-TInt CUsbUiNotifApiTest::GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType )
+TInt CUSBUiNotifApiTest::GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType )
{
- TRACE_INFO( _L(">>>GetOTGWarningType") );
-
if ( !aTypeString.Compare( _L( "EUsbOtgPartiallySupportedDevice" ) ) )
{
aQueryType = EUsbOtgPartiallySupportedDevice;
- TRACE_INFO( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+ iLog -> Log( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
}
else
{
- TRACE_INFO( _L("Query type: not supported") );
+ iLog -> Log( _L("Query type: not supported") );
return KErrNotFound;
}
-
- TRACE_INFO( _L("<<<GetOTGWarningType") );
-
+
return KErrNone;
}
-// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetMSMMrrorType
-// -----------------------------------------------------------------------------
-
-TInt CUsbUiNotifApiTest::GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType )
+TInt CUSBUiNotifApiTest::GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType )
{
- TRACE_INFO( _L(">>>GetMSMMrrorType") );
if ( !aTypeString.Compare( _L( "EUsbMSMMGeneralError" ) ) )
{
aQueryType = EHostMsErrGeneral;
- TRACE_INFO( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
+ iLog -> Log( _L("Query type: EUsbOtgPartiallySupportedDevice;") );
}
else if ( !aTypeString.Compare( _L( "EUsbMSMMUnknownFileSystem" ) ) )
{
aQueryType = EHostMsErrUnknownFileSystem;
- TRACE_INFO( _L("Query type: EUsbMSMMUnknownFileSystem") );
+ iLog -> Log( _L("Query type: EUsbMSMMUnknownFileSystem") );
}
else if ( !aTypeString.Compare( _L( "EUsbMSMMOutOfMemory" ) ) )
{
aQueryType = EHostMsErrOutOfMemory;
- TRACE_INFO( _L("Query type: EUsbMSMMOutOfMemory") );
+ iLog -> Log( _L("Query type: EUsbMSMMOutOfMemory") );
}
else
{
- TRACE_INFO( _L("Query type: not supported") );
+ iLog -> Log( _L("Query type: not supported") );
return KErrNotFound;
}
-
- TRACE_INFO( _L("<<<GetMSMMrrorType") );
+
return KErrNone;
}
-
+
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetTestOption
+// CBtNotifApiTest::GetTestOption
// -----------------------------------------------------------------------------
-TInt CUsbUiNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption )
+TInt CUSBUiNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption )
{
if ( !aOptionString.Compare( _L( "DISCARD" ) ) )
{
aOption = EQueryDiscarded;
- TRACE_INFO( _L("Test type: EQueryDiscarded") );
+ iLog -> Log( _L("Test type: EQueryDiscarded") );
}
else if ( !aOptionString.Compare( _L( "ACCEPT" ) ) )
{
aOption = EQueryAccepted;
- TRACE_INFO( _L("Test type: EQueryAccepted") );
+ iLog -> Log( _L("Test type: EQueryAccepted") );
}
else if ( !aOptionString.Compare( _L( "CANCEL" ) ) )
{
aOption = EQueryCanceled;
- TRACE_INFO( _L("Test type: EQueryCanceled") );
+ iLog -> Log( _L("Test type: EQueryCanceled") );
}
else
{
- TRACE_INFO( _L("Test type: not supported") );
+ iLog -> Log( _L("Test type: not supported") );
return KErrNotFound;
}
@@ -936,40 +745,64 @@
}
// -----------------------------------------------------------------------------
-// CUsbUiNotifApiTest::GetPersonalityIdFromString
+// CBtNotifApiTest::GetPersonalityIdFromString
// -----------------------------------------------------------------------------
-TInt CUsbUiNotifApiTest::GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId )
+TInt CUSBUiNotifApiTest::GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId )
{
if ( !aOptionString.Compare( _L( "MS" ) ) )
{
aPersonalityId = KUsbPersonalityIdMS;
- TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdMS") );
+ iLog -> Log( _L("Usb personality type: KUsbPersonalityIdMS") );
}
- else if ( !aOptionString.Compare( _L( "PCSUITE" ) ) )
+ else if ( !aOptionString.Compare( _L( "PTP" ) ) )
{
- aPersonalityId = KUsbPersonalityIdPCSuite;
- TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdPCSuite") );
+ aPersonalityId = KUsbPersonalityIdPTP;
+ iLog -> Log( _L("Usb personality type: KUsbPersonalityIdPTP") );
}
else if ( !aOptionString.Compare( _L( "MTP" ) ) )
{
aPersonalityId = KUsbPersonalityIdMTP;
- TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdMTP") );
+ iLog -> Log( _L("Usb personality type: KUsbPersonalityIdMTP") );
}
else if ( !aOptionString.Compare( _L( "PCSUITEMTP" ) ) )
{
aPersonalityId = KUsbPersonalityIdPCSuiteMTP;
- TRACE_INFO( _L("Usb personality type: KUsbPersonalityIdPCSuiteMTP") );
+ iLog -> Log( _L("Usb personality type: KUsbPersonalityIdPCSuiteMTP") );
}
else
{
- TRACE_INFO( _L("Usb personality type: not found") );
+ iLog -> Log( _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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbuis/usbuinotif/usbuinotif.pro Fri Jun 11 14:38:00 2010 +0300
@@ -0,0 +1,46 @@
+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
+
+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
+}
+
--- a/usbuis/usbuiqt/icons/usb_icon_mode_2.svg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="-0.014 0.037 42 36">
-<rect fill="none" height="36" width="42" x="-0.014" y="0.037"/>
-<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="18.75" y1="11.54" x2="24.96" y2="27.67">
-<stop stop-color="#AABBD7" offset="0"/>
-<stop stop-color="#92A5CC" offset="0.26"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#637DB5" offset="0.76"/>
-<stop stop-color="#4C6EA4" offset="0.83"/>
-<stop stop-color="#265689" offset="0.91"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path d="M18.823,33.49c-0.028-0.01-0.053-0.021-0.077-0.037l0,0L8.569,28.85 c-0.093-0.043-0.157-0.125-0.171-0.225l0,0L7.83,25.033c-0.012-0.076,0.006-0.154,0.05-0.217l0,0l2.553-3.664l-0.393-3.671 c-0.01-0.082,0.016-0.164,0.068-0.226l0,0l9.84-11.568c1.962-1.956,4.492-2.737,6.807-2.735l0,0c0.896,0,1.76,0.117,2.553,0.329l0,0 c1.481,0.4,2.965,1.106,3.795,2.34l0,0c0.041,0.019,0.078,0.046,0.107,0.081l0,0c0.023,0.029,1.199,1.456,1.201,3.82l0,0 c0,0.34-0.022,0.699-0.078,1.077l0,0c-0.18,1.202-0.634,2.678-0.921,3.342l0,0l-7.986,14.282c-0.018,0.072-0.062,0.135-0.124,0.178 l0,0c-0.053,0.033-0.115,0.051-0.176,0.049l0,0c-0.025,0-0.05-0.004-0.074-0.01l0,0c-0.035-0.008-0.067-0.023-0.096-0.043l0,0 l-1.992-0.879l-3.774,5.799c-0.023,0.059-0.065,0.107-0.119,0.141l0,0c-0.034,0.02-0.07,0.033-0.107,0.039l0,0 c-0.001,0.002-0.003,0.002-0.004,0.002l0,0c-0.002,0-0.004,0-0.006,0l0,0c-0.015,0.002-0.03,0.004-0.045,0.004l0,0 C18.879,33.502,18.851,33.498,18.823,33.49L18.823,33.49z M32.753,6.081l0.179-0.148L32.753,6.081L32.753,6.081z" fill="url(#SVGID_1)"/>
-<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="27.94" y1="30.01" x2="8.42" y2="15.5">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#E0EAF3" offset="0.11"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#8CA9CF" offset="0.48"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#637DB5" offset="0.75"/>
-<stop stop-color="#4C6EA4" offset="0.82"/>
-<stop stop-color="#265689" offset="0.91"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#SVGID_2)" points="25.137,28.184 10.806,21.869 10.334,17.479 25.108,23.307 "/>
-<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="35.78" y1="4.5" x2="22.33" y2="31.13">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#E0EAF3" offset="0.11"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#8CA9CF" offset="0.48"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#637DB5" offset="0.75"/>
-<stop stop-color="#4C6EA4" offset="0.82"/>
-<stop stop-color="#265689" offset="0.91"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path d="M25.117,23.307l7.864-17.383c0,0,1.487,1.795,1.058,4.664c-0.174,1.164-0.627,2.644-0.887,3.241 l-8.027,14.355L25.117,23.307z" fill="url(#SVGID_3)"/>
-<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="15.76" y1="-3.13" x2="28.63" y2="29.22">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#F4F8FB" offset="0.19"/>
-<stop stop-color="#D6E4F0" offset="0.52"/>
-<stop stop-color="#A7C5DF" offset="0.96"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<path d="M29.23,3.599c-2.747-0.735-6.439-0.292-9.072,2.331l-9.825,11.549l14.774,5.828l7.753-13.183 C34.642,6.166,31.987,4.338,29.23,3.599z" fill="url(#SVGID_4)"/>
-<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="25.22" y1="23.12" x2="19.08" y2="11.35">
-<stop stop-color="#E6EEF4" offset="0"/>
-<stop stop-color="#C6DCC1" offset="0.08"/>
-<stop stop-color="#91C06F" offset="0.21"/>
-<stop stop-color="#6BAB33" offset="0.32"/>
-<stop stop-color="#539E0E" offset="0.4"/>
-<stop stop-color="#4A9900" offset="0.44"/>
-<stop stop-color="#398419" offset="0.55"/>
-<stop stop-color="#22663B" offset="0.71"/>
-<stop stop-color="#135550" offset="0.85"/>
-<stop stop-color="#0E4E58" offset="0.94"/>
-</linearGradient>
-<path d="M22.05,10.979l-0.616,0.813l3.756,1.229l-2.353,3.107l1.332,0.439l0.696-0.922l2.916,0.965 l-2.067,2.724l-2.899-0.958l0.688-0.923l-6.795-2.236l-0.678,0.935c-0.483-0.736-1.019-1.479-1.515-2.136 c1.078-0.14,2.283-0.313,3.448-0.509l-0.601,0.818l4.521,1.486l1.672-2.219l-2.791-0.916l-0.61,0.814 c-0.477-0.732-1.006-1.473-1.5-2.13C19.741,11.225,20.968,11.053,22.05,10.979z" fill="url(#SVGID_5)"/>
-<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="19.37" y1="27.94" x2="-19.75" y2="-11.18">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#000000" offset="1"/>
-</linearGradient>
-<polygon fill="url(#SVGID_6)" points="23.084,23.328 18.86,29.619 8.123,25.02 12.285,19.045 "/>
-<polygon fill="#4D4D4D" points="14.777,23.287 13.833,24.76 11.07,23.572 12.019,22.139 "/>
-<polygon fill="#4D4D4D" points="20.001,25.482 19.064,27.021 16.364,25.848 17.304,24.344 "/>
-<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="17.97" y1="37.85" x2="26.77" y2="9.05">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#000000" offset="1"/>
-</linearGradient>
-<polygon fill="url(#SVGID_7)" points="18.873,29.617 23.084,23.328 22.852,27.178 18.908,33.236 "/>
-<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="18.44" y1="33.76" x2="-1.24" y2="14.08">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#000000" offset="1"/>
-</linearGradient>
-<polygon fill="url(#SVGID_8)" points="18.915,33.236 8.691,28.611 8.123,25.02 18.879,29.602 "/>
-<polygon fill="#FFFFFF" points="18.23,32.199 9.25,28.139 9.049,27.063 18.177,31.076 "/>
-<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="19.28" y1="1.82" x2="32.69" y2="8.11">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path d="M24.564,5.472l6.489,1.948c0,0,0.749-1.301-2.161-2.179C25.981,4.364,24.564,5.472,24.564,5.472z" fill="url(#SVGID_9)"/>
-</svg>
\ No newline at end of file
--- a/usbuis/usbuiqt/icons/usb_icon_mode_4.svg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
-<rect fill="none" height="36" width="42"/>
-<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="4.34" y1="18" x2="37.66" y2="18">
-<stop stop-color="#A1C1DC" offset="0.1"/>
-<stop stop-color="#6C82B9" offset="0.71"/>
-<stop stop-color="#173F6C" offset="0.99"/>
-</linearGradient>
-<path d="M12.842,34.012l-0.057-0.078l-6.937-9.3l-0.042-0.059l-1.405-1.881L4.37,22.653v-0.052l-0.027-0.858 L4.34,21.59l0.149-0.015c1.725-0.188,3.256-0.634,4.676-1.372c0.68-1.623,2.405-2.95,4.057-3.121 c0.235-0.238,0.481-0.492,0.747-0.774L11.079,2.388L11.044,2.23l0.157-0.033l0.762-0.172l0.159-0.036l0.037,0.159 c0.482,2.094,1.557,2.859,2.694,3.67l0.098,0.07c0.172,0.12,0.348,0.243,0.523,0.364c1.704,1.185,3.464,2.408,3.86,5.01 c1.691-1.087,3.54-1.699,5.645-1.868l0.047-0.002l0.042,0.024l1.62,0.889l0.319,0.174l0.527,0.289l1.251,0.686l8.768,4.814 l0.106,0.057l-0.018,0.131l-0.219,1.099l-0.022,0.118l-0.125,0.013c-5.685,0.518-8.448,3.993-11.377,7.671 c-3.057,3.844-6.22,7.818-12.963,8.643L12.842,34.012L12.842,34.012z M13.666,8.596L15,15.196c0.997-1.081,2.029-2.183,3.198-3.116 C17.83,10.181,16.425,9.099,13.666,8.596L13.666,8.596z" fill="url(#SVGID_1)"/>
-<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="25.09" y1="3.25" x2="18.28" y2="29.64">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#486EA2" offset="0.71"/>
-<stop stop-color="#225487" offset="0.99"/>
-</linearGradient>
-<path d="M4.504,21.748c10.374-1.113,10.566-11.391,20.483-12.18l12.506,6.863 c-12.585,1.681-11.545,14.341-24.322,16.136L4.504,21.748z" fill="url(#SVGID_2)"/>
-<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="11.67" y1="27.2" x2="22.42" y2="12.96">
-<stop stop-color="#DEE8F1" offset="0"/>
-<stop stop-color="#225487" offset="1"/>
-</linearGradient>
-<path d="M6.254,23.966c1.579-0.102,5.475-0.806,8.816-4.604l6.127,5.619c-2.307,2.884-6.286,5.21-9.765,5.507 L6.254,23.966z" fill="url(#SVGID_3)"/>
-<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="22.63" y1="18.3" x2="16.39" y2="28">
-<stop stop-color="#DEE8F1" offset="0"/>
-<stop stop-color="#225487" offset="1"/>
-</linearGradient>
-<path d="M15.837,18.577c1.691-1.97,3.833-4.857,7.662-6.644l7.04,4.334c-2.24,1.156-4.458,2.596-8.474,7.792 L15.837,18.577z" fill="url(#SVGID_4)"/>
-<path d="M24.679,11.449c0,0,2.42-0.559,2.777-0.528l7.598,4.183c0,0-1.459-0.021-3.218,0.643L24.679,11.449z" fill="#D6E3F1"/>
-<polygon fill="#FFFFFF" points="5.01,22.433 6.175,22.295 6.975,23.324 5.913,23.549 "/>
-<polygon fill="#FFFFFF" points="7.375,21.997 8.266,23.043 9.482,22.64 8.574,21.615 "/>
-<polygon fill="#FFFFFF" points="9.574,21.165 10.499,22.191 11.537,21.608 10.586,20.609 "/>
-<polygon fill="#FFFFFF" points="11.421,20.037 12.384,21.011 13.269,20.314 12.271,19.342 "/>
-<polygon fill="#FFFFFF" points="13.02,18.701 14.011,19.635 14.791,18.83 13.778,17.914 "/>
-<polygon fill="#FFFFFF" points="14.442,17.202 15.475,18.118 16.197,17.266 15.179,16.398 "/>
-<polygon fill="#FFFFFF" points="15.844,15.668 16.866,16.522 17.604,15.706 16.559,14.862 "/>
-<polygon fill="#FFFFFF" points="17.244,14.166 18.299,14.983 19.106,14.222 18.006,13.415 "/>
-<polygon fill="#FFFFFF" points="18.777,12.774 19.879,13.55 20.761,12.867 19.676,12.108 "/>
-<polygon fill="#FFFFFF" points="20.562,11.561 21.648,12.29 22.73,11.758 21.609,11.037 "/>
-<polygon fill="#FFFFFF" points="22.604,10.648 23.753,11.323 25.063,10.971 23.888,10.287 "/>
-<polygon fill="#FFFFFF" points="25.024,10.068 26.227,10.754 26.93,10.631 25.677,9.949 "/>
-<polygon fill="#FFFFFF" points="11.811,30.928 13.116,30.698 13.985,31.78 12.649,32.004 "/>
-<polygon fill="#FFFFFF" points="14.498,30.351 15.391,31.409 16.816,30.875 15.881,29.832 "/>
-<polygon fill="#FFFFFF" points="17.029,29.287 18.192,28.574 19.174,29.579 17.976,30.306 "/>
-<polygon fill="#FFFFFF" points="19.158,27.871 20.135,28.861 21.14,27.983 20.148,27.013 "/>
-<polygon fill="#FFFFFF" points="20.978,26.184 21.984,27.14 22.859,26.174 21.842,25.253 "/>
-<polygon fill="#FFFFFF" points="22.612,24.36 23.645,25.271 24.468,24.251 23.416,23.373 "/>
-<polygon fill="#FFFFFF" points="24.171,22.477 25.218,23.341 26.04,22.319 24.979,21.479 "/>
-<polygon fill="#FFFFFF" points="25.762,20.613 26.828,21.433 27.736,20.487 26.656,19.675 "/>
-<polygon fill="#FFFFFF" points="27.506,18.885 28.624,19.658 29.642,18.824 28.518,18.066 "/>
-<polygon fill="#FFFFFF" points="29.538,17.391 30.671,18.123 31.874,17.434 30.726,16.714 "/>
-<polygon fill="#FFFFFF" points="31.916,16.199 33.104,16.899 34.571,16.434 33.386,15.741 "/>
-<polygon fill="#FFFFFF" points="34.844,15.44 36.06,16.109 36.745,16.033 35.5,15.349 "/>
-<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="14.3" y1="2.22" x2="26.79" y2="28.48">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#486EA2" offset="0.71"/>
-<stop stop-color="#225487" offset="0.99"/>
-</linearGradient>
-<path d="M13.232,32.458c12.06-1.605,12.525-15.277,24.25-16.038l-0.223,1.113 C25.511,18.605,26.003,32.25,12.916,33.847L13.232,32.458z" fill="url(#SVGID_5)"/>
-<polygon fill="url(#SVGID_2)" points="13.232,32.458 4.504,21.748 4.532,22.606 12.916,33.847 "/>
-<polygon fill="#7D96C5" points="12.839,31.979 12.556,33.363 11.799,32.325 11.973,30.891 "/>
-<polygon fill="#7D96C5" points="5.063,22.42 5.147,23.398 5.977,24.548 5.953,23.545 "/>
-<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="12.63" y1="30.81" x2="13.51" y2="19.84">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A1C1DC" offset="1"/>
-</linearGradient>
-<path d="M16.126,24.422c-0.565,1.555-2.365,2.897-4.022,3.002c-1.654,0.103-2.539-1.072-1.975-2.624 c0.563-1.555,2.364-2.897,4.021-3.004C15.805,21.694,16.689,22.867,16.126,24.422z" fill="url(#SVGID_7)"/>
-<path d="M14.487,18.025l-3.252-15.66l0.762-0.171c0.51,2.215,1.676,2.994,2.856,3.836 c2.69,1.907,5.913,3.547,3.617,10.54l-0.544-0.218c1.583-5.44-0.518-7.292-4.471-7.949l2.114,10.467L14.487,18.025z" fill="#6D5723"/>
-<radialGradient id="SVGID_8" gradientUnits="userSpaceOnUse" cx="13.33" cy="18.95" fx="12.7" fy="19.13" r="2.87">
-<stop stop-color="#E6EDF3" offset="0"/>
-<stop stop-color="#A2762B" offset="0.44"/>
-<stop stop-color="#474219" offset="0.94"/>
-</radialGradient>
-<path d="M15.434,20.15c-0.58,1.712-2.439,3.188-4.158,3.292c-1.717,0.11-2.644-1.193-2.063-2.906 c0.578-1.709,2.438-3.184,4.158-3.292C15.087,17.136,16.014,18.437,15.434,20.15z" fill="url(#SVGID_8)"/>
-</svg>
\ No newline at end of file
--- a/usbuis/usbuiqt/icons/usb_icon_mode_5.svg Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="42" height="36" viewBox="0 0 42 36">
-<rect fill="none" height="36" width="42"/>
-<linearGradient id="SVGID_1" gradientUnits="userSpaceOnUse" x1="-0.54" y1="15.57" x2="35.4" y2="15.57">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A1C1DC" offset="0.35"/>
-<stop stop-color="#6C82B9" offset="0.7"/>
-<stop stop-color="#173F6C" offset="1"/>
-</linearGradient>
-<path d="M24.067,29.803c-0.456,0-0.918-0.07-1.381-0.207l-12.552-3.74c-2.362-0.703-3.827-2.558-3.919-4.957 L5.74,8.165C5.673,6.397,6.431,4.892,7.82,4.036c1.797-1.579,3.234-2.693,5.342-2.693c0.377,0,0.778,0.038,1.19,0.114l11.474,1.836 c3.21,0.579,5.817,3.865,5.817,7.33l-0.161,12.044c0,3.272-2.31,4.707-4.984,6.37c-0.135,0.096-0.275,0.184-0.425,0.265 l-0.009,0.008l-0.15,0.092l-0.018,0.011l-0.014-0.013C25.321,29.666,24.71,29.803,24.067,29.803L24.067,29.803z" fill="url(#SVGID_1)"/>
-<linearGradient id="SVGID_2" gradientUnits="userSpaceOnUse" x1="19.15" y1="2.32" x2="19.15" y2="26.35">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A1C1DC" offset="0.35"/>
-<stop stop-color="#6C82B9" offset="0.7"/>
-<stop stop-color="#173F6C" offset="1"/>
-</linearGradient>
-<path d="M25.729,29.107c2.868-1.805,5.439-3.154,5.439-6.506l0.161-12.039c0-3.337-2.497-6.497-5.583-7.052 L14.27,1.672c-3.083-0.557-4.703,1.116-7.302,3.402l6.56,0.938l11.324,2.309l1.155,12.016L25.729,29.107z" fill="url(#SVGID_2)"/>
-<linearGradient id="SVGID_3" gradientUnits="userSpaceOnUse" x1="6.6" y1="5.55" x2="28.55" y2="27.5">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A1C1DC" offset="1"/>
-</linearGradient>
-<path d="M22.733,29.269c2.822,0.841,5.375-1.101,5.375-4.449V12.715c0-3.336-2.498-6.496-5.58-7.052 L11.366,3.65C8.277,3.094,5.871,5.092,5.986,8.095L6.461,20.83c0.084,2.214,1.425,4.015,3.72,4.696L22.733,29.269z" fill="url(#SVGID_3)"/>
-<linearGradient id="SVGID_4" gradientUnits="userSpaceOnUse" x1="12.92" y1="1.63" x2="32.49" y2="21.2">
-<stop stop-color="#E6EDF3" offset="0"/>
-<stop stop-color="#ADCEB3" offset="0.14"/>
-<stop stop-color="#78B277" offset="0.28"/>
-<stop stop-color="#57A052" offset="0.39"/>
-<stop stop-color="#4A9944" offset="0.44"/>
-<stop stop-color="#428E47" offset="0.5"/>
-<stop stop-color="#286C50" offset="0.68"/>
-<stop stop-color="#185756" offset="0.84"/>
-<stop stop-color="#124F58" offset="0.94"/>
-</linearGradient>
-<path d="M21.698,10.582c0.828,0.164,1.505,1.017,1.511,1.903l0.024,4.707l3.752,0.795v-4.86 c0-2.416-1.466-4.727-3.488-5.776c-0.465-0.24-0.96-0.414-1.471-0.506l-3.731-0.671v3.73L21.698,10.582z" fill="url(#SVGID_4)"/>
-<linearGradient id="SVGID_5" gradientUnits="userSpaceOnUse" x1="2.57" y1="1.96" x2="33.99" y2="39.18">
-<stop stop-color="#E6EDF3" offset="0"/>
-<stop stop-color="#B8CAE2" offset="0.11"/>
-<stop stop-color="#7C9DCD" offset="0.27"/>
-<stop stop-color="#5782BF" offset="0.38"/>
-<stop stop-color="#4977BA" offset="0.44"/>
-<stop stop-color="#3F6CAB" offset="0.51"/>
-<stop stop-color="#295489" offset="0.69"/>
-<stop stop-color="#1C4474" offset="0.84"/>
-<stop stop-color="#173F6C" offset="0.94"/>
-</linearGradient>
-<path d="M23.261,22.141c0.014,1.256-0.801,1.385-1.456,1.206l-9.833-2.939c-0.59-0.401-0.48-1.005-0.5-1.546 c-0.018-0.545-0.231-8.875-0.231-8.875c-0.023-0.829,0.626-1.365,1.458-1.197l5.035,1.004V6.072l-5.656-1.02 C9.324,4.556,7.178,6.336,7.281,9.014l0.423,11.352c0.075,1.974,1.269,3.58,3.314,4.187l11.191,3.335 c2.514,0.751,4.791-0.979,4.791-3.965v-5.36l-3.764-0.797L23.261,22.141z" fill="url(#SVGID_5)"/>
-<linearGradient id="SVGID_6" gradientUnits="userSpaceOnUse" x1="11.3" y1="22.66" x2="36.26" y2="22.66">
-<stop stop-color="#A1C1DC" offset="0.1"/>
-<stop stop-color="#6C82B9" offset="0.71"/>
-<stop stop-color="#173F6C" offset="0.99"/>
-</linearGradient>
-<path d="M17.672,34.657l-0.042-0.057l-5.196-6.966l-0.033-0.045l-1.052-1.408l-0.023-0.031v-0.039 l-0.021-0.645l-0.002-0.111l0.111-0.013c1.292-0.14,2.439-0.475,3.503-1.025c0.51-1.218,1.801-2.212,3.04-2.341 c0.176-0.176,0.36-0.367,0.559-0.578l-2.166-10.429l-0.025-0.118l0.118-0.026l0.57-0.128l0.119-0.026l0.027,0.119 c0.361,1.568,1.168,2.142,2.019,2.75l0.073,0.051c0.129,0.091,0.261,0.183,0.392,0.273c1.278,0.887,2.598,1.803,2.894,3.753 c1.265-0.815,2.649-1.272,4.229-1.399l0.034-0.001l0.032,0.017l1.212,0.667l0.24,0.129l0.395,0.216l0.938,0.515l6.568,3.605 l0.079,0.043l-0.013,0.099l-0.166,0.823l-0.016,0.09l-0.092,0.008c-4.26,0.389-6.33,2.992-8.523,5.748 c-2.289,2.879-4.659,5.857-9.711,6.474L17.672,34.657L17.672,34.657z M18.289,15.62l1,4.945c0.747-0.811,1.52-1.635,2.396-2.335 C21.408,16.807,20.356,15.997,18.289,15.62L18.289,15.62z" fill="url(#SVGID_6)"/>
-<linearGradient id="SVGID_7" gradientUnits="userSpaceOnUse" x1="26.85" y1="11.62" x2="21.75" y2="31.39">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#486EA2" offset="0.71"/>
-<stop stop-color="#225487" offset="0.99"/>
-</linearGradient>
-<path d="M11.427,25.473c7.77-0.837,7.915-8.534,15.346-9.126l9.365,5.143 c-9.428,1.259-8.646,10.743-18.22,12.087L11.427,25.473z" fill="url(#SVGID_7)"/>
-<linearGradient id="SVGID_8" gradientUnits="userSpaceOnUse" x1="16.79" y1="29.56" x2="24.85" y2="18.89">
-<stop stop-color="#DEE8F1" offset="0"/>
-<stop stop-color="#225487" offset="1"/>
-</linearGradient>
-<path d="M12.737,27.133c1.182-0.074,4.101-0.602,6.604-3.449l4.59,4.212 c-1.728,2.159-4.709,3.901-7.315,4.124L12.737,27.133z" fill="url(#SVGID_8)"/>
-<linearGradient id="SVGID_9" gradientUnits="userSpaceOnUse" x1="25" y1="22.89" x2="20.33" y2="30.15">
-<stop stop-color="#DEE8F1" offset="0"/>
-<stop stop-color="#225487" offset="1"/>
-</linearGradient>
-<path d="M19.915,23.097c1.268-1.476,2.872-3.64,5.741-4.977l5.272,3.245 c-1.678,0.867-3.339,1.945-6.347,5.839L19.915,23.097z" fill="url(#SVGID_9)"/>
-<path d="M26.538,17.757c0,0,1.814-0.419,2.082-0.396l5.691,3.135c0,0-1.094-0.018-2.411,0.48L26.538,17.757z" fill="#D6E3F1"/>
-<polygon fill="#FFFFFF" points="11.806,25.985 12.678,25.883 13.278,26.651 12.481,26.82 "/>
-<polygon fill="#FFFFFF" points="13.576,25.66 14.246,26.442 15.155,26.141 14.475,25.371 "/>
-<polygon fill="#FFFFFF" points="15.224,25.035 15.917,25.804 16.695,25.367 15.982,24.619 "/>
-<polygon fill="#FFFFFF" points="16.608,24.189 17.33,24.92 17.991,24.398 17.245,23.671 "/>
-<polygon fill="#FFFFFF" points="17.805,23.189 18.548,23.891 19.132,23.285 18.373,22.6 "/>
-<polygon fill="#FFFFFF" points="18.871,22.067 19.646,22.753 20.185,22.115 19.422,21.465 "/>
-<polygon fill="#FFFFFF" points="19.922,20.918 20.687,21.559 21.24,20.945 20.457,20.313 "/>
-<polygon fill="#FFFFFF" points="20.969,19.792 21.76,20.404 22.364,19.834 21.541,19.23 "/>
-<polygon fill="#FFFFFF" points="22.118,18.75 22.944,19.331 23.603,18.82 22.793,18.25 "/>
-<polygon fill="#FFFFFF" points="23.455,17.841 24.271,18.387 25.08,17.988 24.239,17.447 "/>
-<polygon fill="#FFFFFF" points="24.985,17.157 25.847,17.663 26.827,17.399 25.946,16.886 "/>
-<polygon fill="#FFFFFF" points="26.8,16.723 27.699,17.236 28.225,17.144 27.287,16.633 "/>
-<polygon fill="#FFFFFF" points="16.898,32.349 17.878,32.177 18.529,32.987 17.528,33.154 "/>
-<polygon fill="#FFFFFF" points="18.911,31.916 19.581,32.709 20.65,32.309 19.949,31.528 "/>
-<polygon fill="#FFFFFF" points="20.808,31.118 21.681,30.585 22.415,31.339 21.518,31.885 "/>
-<polygon fill="#FFFFFF" points="22.404,30.058 23.138,30.801 23.888,30.143 23.146,29.416 "/>
-<polygon fill="#FFFFFF" points="23.767,28.795 24.522,29.512 25.178,28.787 24.414,28.098 "/>
-<polygon fill="#FFFFFF" points="24.992,27.429 25.765,28.111 26.38,27.348 25.595,26.689 "/>
-<polygon fill="#FFFFFF" points="26.159,26.018 26.943,26.666 27.558,25.899 26.766,25.271 "/>
-<polygon fill="#FFFFFF" points="27.351,24.623 28.149,25.235 28.829,24.527 28.021,23.921 "/>
-<polygon fill="#FFFFFF" points="28.657,23.328 29.494,23.908 30.257,23.281 29.415,22.713 "/>
-<polygon fill="#FFFFFF" points="30.181,22.209 31.028,22.756 31.93,22.24 31.069,21.701 "/>
-<polygon fill="#FFFFFF" points="31.96,21.314 32.851,21.84 33.95,21.492 33.063,20.973 "/>
-<polygon fill="#FFFFFF" points="34.155,20.746 35.064,21.25 35.579,21.19 34.646,20.68 "/>
-<linearGradient id="SVGID_10" gradientUnits="userSpaceOnUse" x1="18.78" y1="10.86" x2="28.12" y2="30.5">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#486EA2" offset="0.71"/>
-<stop stop-color="#225487" offset="0.99"/>
-</linearGradient>
-<path d="M17.964,33.494c9.035-1.201,9.381-11.443,18.168-12.012l-0.169,0.832 c-8.802,0.803-8.433,11.025-18.236,12.22L17.964,33.494z" fill="url(#SVGID_10)"/>
-<polygon fill="url(#SVGID_7)" points="17.964,33.494 11.427,25.473 11.446,26.115 17.727,34.534 "/>
-<polygon fill="#7D96C5" points="17.669,33.137 17.458,34.173 16.892,33.395 17.022,32.322 "/>
-<polygon fill="#7D96C5" points="11.844,25.977 11.908,26.709 12.529,27.569 12.512,26.818 "/>
-<linearGradient id="SVGID_12" gradientUnits="userSpaceOnUse" x1="17.52" y1="32.26" x2="18.17" y2="24.05">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A1C1DC" offset="1"/>
-</linearGradient>
-<path d="M20.134,27.476c-0.425,1.165-1.773,2.171-3.014,2.247c-1.239,0.079-1.903-0.801-1.48-1.965 c0.421-1.164,1.771-2.172,3.012-2.25C19.891,25.431,20.554,26.31,20.134,27.476z" fill="url(#SVGID_12)"/>
-<path d="M18.905,22.685l-2.436-11.732l0.57-0.127c0.382,1.659,1.256,2.242,2.14,2.874 c2.016,1.427,4.429,2.657,2.709,7.895l-0.407-0.162c1.186-4.076-0.389-5.463-3.35-5.955l1.583,7.84L18.905,22.685z" fill="#6D5723"/>
-<radialGradient id="SVGID_13" gradientUnits="userSpaceOnUse" cx="18.04" cy="23.37" fx="17.57" fy="23.5" r="2.14">
-<stop stop-color="#E6EDF3" offset="0"/>
-<stop stop-color="#A2762B" offset="0.44"/>
-<stop stop-color="#474219" offset="0.94"/>
-</radialGradient>
-<path d="M19.613,24.275c-0.434,1.281-1.827,2.387-3.115,2.466c-1.285,0.083-1.98-0.895-1.544-2.177 c0.433-1.28,1.827-2.386,3.114-2.467C19.354,22.018,20.048,22.99,19.613,24.275z" fill="url(#SVGID_13)"/>
-</svg>
\ No newline at end of file
--- a/usbuis/usbuiqt/inc/mydebug.h Fri Jun 04 10:27:39 2010 +0100
+++ /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 MYDEBUG_H
-#define MYDEBUG_H
-
-#include <QtDebug>
-
-#if defined(_DEBUG)
- inline QDebug myDebug()
- {
- return qDebug();
- }
-#else
- inline QNoDebug myDebug()
- {
- return QNoDebug();
- }
-#endif
-
-
-#endif // MYDEBUG_H
--- a/usbuis/usbuiqt/inc/usbmainview.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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 USBMAINVIEW_H
-#define USBMAINVIEW_H
-
-#include <hbview.h>
-#include <QObject>
-
-class UsbUiSettingModel;
-class QGraphicsLinearLayout;
-class HbListWidgetItem;
-class HbListWidget;
-class HbTextEdit;
-class HbRadioButtonList;
-
-class UsbMainView : public HbView
-{
- Q_OBJECT
- friend class TestUsbUiModelActive;
-
-public:
- explicit UsbMainView( QObject *parent = 0 );
- virtual ~UsbMainView();
-
-public slots:
- /**
- * Update view item(s) between the selected rows.
- * @param topLeft The top row index
- * @param bottomRight The bottom row index
- */
- void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-
- /*
- * Set the personality user has selected in the radio button list
- * @param personalityIndex The selection index in the radio button list
- */
- void setPersonality( int personalityIndex );
-
-signals:
-
-private:
- /*
- * creates the main view window row by row
- */
- void createMainView();
- /*
- * creates the first row in the view containing an icon and a mode name
- * @param localPropertiesGroup main view layout
- */
- void createIconNameRow(QGraphicsLinearLayout *localPropertiesGroup);
- /*
- * creates the second row from the view containing the description of the selected mode
- * @param localPropertiesGroup main view layout
- */
- void createDescriptionArea(QGraphicsLinearLayout *localPropertiesGroup);
- /*
- * creates the third row from the view containing the radio button list of the existing usb modes
- * @param localPropertiesGroup main view layout
- */
- void createRadioButtonArea(QGraphicsLinearLayout *localPropertiesGroup);
-
-private:
- // main view layout owned by this class
- QGraphicsLinearLayout *mMainLayout;
- // setting model not owned by the view,
- // has to be deleted
- UsbUiSettingModel *mModel;
- //owned by the view
- HbListWidgetItem *mListItem;
- // owned by the view
- HbListWidget *mlist;
- // owned by the view
- HbTextEdit *mlabel;
- // owned by the view
- HbRadioButtonList *mradio;
- // not owned by the view
- // need to be deleted
- HbIcon *mIcon ;
-};
-
-#endif /* USBMAINVIEW_H */
--- a/usbuis/usbuiqt/inc/usbuimodelactive.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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 USBUIMODELACTIVE_H
-#define USBUIMODELACTIVE_H
-
-#include <QObject>
-#include <e32base.h>
-#include <usbwatcher.h>
-
-class UsbUiModelActivePrivate;
-
-/*!
- \class UsbUiModelActive
- \brief Helper class for using active objects in Qt classes.
-
- UsbUiModelActive is a helper class for using active objects
- from any Qt class. It wraps a CActive-derived class in an interface
- that uses Qt's signal-slot mechanism for communicating status changes
- of the active object.
-
- */
-class UsbUiModelActive : public QObject
-{
- Q_OBJECT
- friend class UsbUiModelActivePrivate;
-
-public:
- explicit UsbUiModelActive( int priority = CActive::EPriorityStandard,
- QObject *parent = NULL );
- ~UsbUiModelActive();
-
- inline TRequestStatus &RequestStatus();
- inline void SetActive();
- inline void Cancel();
- inline bool IsActive();
-
-public:
- int SetUsbPersonality(int personality);
- void CancelSetPersonality();
-
-signals:
- void requestCompleted( int status );
-
-private:
- /*!
- * emits a signal when the request is completed
- * @param status is the error
- */
- void emitRequestCompleted( int status );
-
-private:
- UsbUiModelActivePrivate *d;
-
- /** Handle to USBWatcher for setting the personality */
- RUsbWatcher iUsbWatcher;
-};
-
-
-/*!
- \class UsbUiModelActivePrivate
- \brief Private class of UsbUiModelActive, for using active objects in Qt classes.
-
- UsbUiModelActivePrivate is a helper class for using active objects
- from any Qt class. It derives from CActive and allows other classes to use
- it for passing to asynchronous function calls through its RequestStatus method.
-
- */
-class UsbUiModelActivePrivate : public CActive
-{
- friend class UsbUiModelActive;
-
-public:
- explicit UsbUiModelActivePrivate( UsbUiModelActive *parent, int priority );
- ~UsbUiModelActivePrivate();
-
-private:
- virtual void RunL();
- virtual void DoCancel();
- virtual TInt RunError( TInt aError );
-
-private:
- UsbUiModelActive *q;
-
-};
-
-inline bool UsbUiModelActive::IsActive()
-{
- return d->IsActive();
-}
-
-inline TRequestStatus &UsbUiModelActive::RequestStatus()
-{
- return d->iStatus;
-}
-
-inline void UsbUiModelActive::SetActive()
-{
- d->SetActive();
-}
-
-inline void UsbUiModelActive::Cancel()
-{
- d->Cancel();
-}
-
-#endif /* USBUIMODELACTIVE_H */
--- a/usbuis/usbuiqt/inc/usbuisettingmodel.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +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 USBUISETTINGMODEL_H
-#define USBUISETTINGMODEL_H
-
-
-#include <e32base.h>
-#include <e32property.h>
-#include <QStringList>
-#include <QAbstractItemModel>
-#include <XQSettingsManager>
-
-const int KDefaultColumn = 0;
-typedef QList< QMap< int, QVariant > > UsbUiModelDataSource;
-
-class RUsb;
-class UsbUiModelActive;
-
-class UsbUiSettingModel : public QAbstractItemModel
-{
- Q_OBJECT
- friend class TestUsbUiModelActive;
-
-public:
-enum usbSettingsIndex {
- DefaultMode,
- Description,
- UsbModeList,
- EndOfSettings
- };
-enum SettingsRoleValues {
- SettingType = Qt::UserRole,
- SettingsModeNameList,
- };
-public:
- UsbUiSettingModel( QObject *parent = 0 );
- virtual ~UsbUiSettingModel();
-
- /*
- * Returns the index of the item in the model specified by the given row, column and parent index.
- * @param row is the row number of the specified item
- * @param column is the column number of the specified item
- * @param parent QModelIndex parent
- */
- virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
- /*
- * Returns QModelIndex() because this model item has no parent
- * @param child is the index of item model, the parent of which is going to be returned
- * @param child is not used in here
- */
- virtual QModelIndex parent( const QModelIndex &child ) const;
- /*
- * Returns the number of rows under the given parent
- * @param parent QModelIndex parent
- */
- virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
- /*
- * Returns the number of columns for the children of the given parent.
- * @param parent QModelIndex parent
- */
- virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
- /*
- *Returns the data stored under the given role for the item referred to by the index.
- */
- virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
- /*
- * Sets the role data for the item at index to value. Returns true if successful; otherwise returns false.
- */
- virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
-
- const QModelIndex* sourceData() const;
-
-public slots:
- /*
- * Provides notification of changes in selected usb mode
- * @param key is not used
- * @param value is the value read from cenrep key
- */
- void usbModeChanged( const XQSettingsKey &key, const QVariant &value );
- /*
- * it checks the response from usbwatcher to see if the new mode change has been successful
- * it will go back to the previous personality if it has not been successfull
- * @param status is the error code returned from usbwatcher
- */
- void setPersonalityCompleted (int status );
-
-private:
- /*
- * creats the logical name of the modename string for the list
- * @param modeId is the usb personality id
- */
- QString modeListName( int modeId );
- /*
- * Get the current USB personality ID
- * Returns 0, if the key is missing or the value cannot be converted
- * to integer.
- * @return The current personality id
- */
- int currentMode();
- /*
- * sets the value to different roles of the model's first row
- */
- void setDefaultModeSetting();
- /*
- * sets the value to different roles of the model's description row
- */
- void setDescriptionSetting();
- /**
- * Set the USB mode list and the current selection in the list.
- * The personality IDs are stored to mPersonalityIds and the personality names
- * to mSettingsList.
- * @param modeId The current mode ID
- */
- bool setUsbModelistSetting( int modeId );
- /**
- * calls the model's set functions
- * @param modeId The current mode ID
- */
- void setUsbSettings( int modeId );
- /**
- * updates the model rows and emits signal datachanged
- * @param newPersonality is the new personality id
- */
- void setNewUsbMode(int newPersonality);
-
- /**
- * Check from the USB Manager if the USB personality is hidden.
- * @param usbman Already opened USB Manager session
- * @param personalityId The ID of the personality to be checked.
- * @return For hidden personality, true is returned.
- */
- bool isPersonalityHidden(RUsb &usbman, TInt personalityId);
-
- /**
- * Check if the USB personality is hidden.
- * The personality is hidden, if it does not exist in mPersonalityIds.
- * @param personalityId The ID of the personality to be checked.
- * @return For hidden personality, true is returned.
- */
- bool isPersonalityHidden(TInt personalityId);
- private:
-
- UsbUiModelDataSource mSettingsList;
- int mCurrentMode;
- // stored, so that we can show the correct personality when it fails to set the new one
- int mPreviousMode;
-
- XQSettingsManager mSettingsManager;
- QList<int> mPersonalityIds;
- UsbUiModelActive *mModelActive;
-};
-
-#endif // USBUISETTINGMODEL_H
--- a/usbuis/usbuiqt/inc/usbviewmanager.h Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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 USBVIEWMANAGER_H
-#define USBVIEWMANAGER_H
-
-#include "usbmainview.h"
-
-
-class HbMainWindow;
-
-class UsbViewManager : public QObject
- {
- Q_OBJECT
-
-public:
- explicit UsbViewManager(HbMainWindow* mainWindow, QObject *parent = 0 );
- ~UsbViewManager();
-
- void addView();
-
-private:
- HbMainWindow* mWindow;
- UsbMainView* mMainView; // owned
-
- };
-
-
-#endif /* USBVIEWMANAGER_H */
--- a/usbuis/usbuiqt/rom/usbsettings.iby Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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 USBSETTING_IBY
-#define USBSETTING_IBY
-// Use standard macros
-#include <data_caging_paths_for_iby.hrh>
-
-file=/epoc32/release/armv5/urel/usbapplication.exe PROGRAMS_DIR/usbapplication.exe
-data=/epoc32/data/z/private/10003a3f/import/apps/usbapplication_reg.rsc /private/10003a3f/import/apps/usbapplication_reg.rsc
-
-#endif
--- a/usbuis/usbuiqt/rom/usbsettingsresources.iby Fri Jun 04 10:27:39 2010 +0100
+++ /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 USBSETTINGRESOURCES_IBY
-#define USBSETTINGRESOURCES_IBY
-// Use standard macros
-#include <data_caging_paths_for_iby.hrh>
-
-data=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc
-
-#endif
--- a/usbuis/usbuiqt/src/main.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 <hbapplication.h>
-#include <hbmainwindow.h>
-#include <QTranslator>
-#include <eikenv.h>
-#include "usbviewmanager.h"
-
-int main(int argc, char *argv[])
-{
- HbApplication app(argc, argv);
-
- // add translator for application library
- QString locale = QLocale::system().name();
- QTranslator translator;
- QString filename = QString("usbapplication_") + locale;
-#ifdef Q_OS_SYMBIAN
- // TRAP is must here, otherwise it crashes
-TRAP_IGNORE(
- bool loaded(false);
- loaded = translator.load( filename, QString("z:/resource/qt/translations") );
- if (!loaded)
- translator.load(filename, QString("c:/resource/qt/translations") );
-);
-#else
- translator.load(filename, QString("resource") );
-#endif //Q_OS_SYMBIAN
- app.installTranslator(&translator);
-
- HbMainWindow mainWindow;
-
- // create the view manager, which handles 3 HbViews and add into mainWindow.
- UsbViewManager* mViewManager = new UsbViewManager( &mainWindow, &app );
- mViewManager->addView();
-
- mainWindow.show();
- return app.exec();
-}
Binary file usbuis/usbuiqt/src/usbapplication.qm has changed
--- a/usbuis/usbuiqt/src/usbapplication.qrc Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<RCC>
- <qresource prefix="/xml">
- <file>usbview.docml</file>
- </qresource>
-</RCC>
--- a/usbuis/usbuiqt/src/usbapplication.ts Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +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_description_5">
- <comment>Description for USB Ovi Suite personality. This gives user help about the selected personality.</comment>
- <source>Manage your phone with Ovi Suite and sync your media content.</source>
- <translation variants="no">Manage your phone with Ovi Suite and sync your media content.</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>Text ID</extra-loc-viewid>
- <extra-loc-positionid>description</extra-loc-positionid>
- <extra-loc-feature>Te</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_5">
- <comment>USB mode name for Ovi Suite personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_5.</comment>
- <source>Ovi Suite</source>
- <translation variants="no">Ovi Suite</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>Comment</extra-loc-viewid>
- <extra-loc-positionid>modelistname</extra-loc-positionid>
- <extra-loc-feature>Co</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_2">
- <comment>USB mode name for Mass storage personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_2.</comment>
- <source>Mass storage</source>
- <translation variants="no">Mass storage</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>Layout ID</extra-loc-viewid>
- <extra-loc-positionid>modelistname</extra-loc-positionid>
- <extra-loc-feature>La</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modename_2">
- <comment>USB mode name for Mass storage personality. This is used in USB application as the default (selected) mode.</comment>
- <source>Mass storage</source>
- <translation variants="no">Mass storage</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>View ID (draft)</extra-loc-viewid>
- <extra-loc-positionid>modename</extra-loc-positionid>
- <extra-loc-feature>Vi</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_6">
- <comment>USB mode name for Phone as modem personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_6.</comment>
- <source>Connect PC to Web</source>
- <translation variants="no">Connect PC to Web</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>modelistname</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_2">
- <comment>Description for USB Mass storage personality. This gives user help about the selected personality.</comment>
- <source>Access your phoneÂ’s memory card from the device you are connected to.</source>
- <translation variants="no">Access your phoneÂ’s memory card from the device you are connected to.</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>Position ID</extra-loc-viewid>
- <extra-loc-positionid>description</extra-loc-positionid>
- <extra-loc-feature>Po</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modelistname_4">
- <comment>USB mode name for MTP personality. This is used in USB application in a radio button list. Note that this string should use exactly the same words as txt_usb_modename_4.</comment>
- <source>Media transfer</source>
- <translation variants="no">Media transfer</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>modelistname</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modename_5">
- <comment>USB mode name for Ovi Suite personality. This is used in USB application as the default (selected) mode.</comment>
- <source>Ovi Suite</source>
- <translation variants="no">Ovi Suite</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid>File name</extra-loc-viewid>
- <extra-loc-positionid>modename</extra-loc-positionid>
- <extra-loc-feature>Fi</extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_6">
- <comment>Description for USB Phone as Modem personality. This gives user help about the selected personality.</comment>
- <source>Use your mobile phone as a modem</source>
- <translation variants="no">Use your mobile phone as a modem</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>description</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_description_4">
- <comment>Description for USB MTP personality. This gives user help about the selected personality.</comment>
- <source>Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</source>
- <translation variants="no">Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos.</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>description</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modename_6">
- <comment>USB mode name for Phone as Modem personality. This is used in USB application as the default (selected) mode.</comment>
- <source>Connect PC to Web</source>
- <translation variants="no">Connect PC to Web</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>modename</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-<message numerus="no" id="txt_usb_modename_4">
- <comment>USB mode name for MTP personality. This is used in USB application as the default (selected) mode.</comment>
- <source>Media transfer</source>
- <translation variants="no">Media transfer</translation>
- <extra-loc-layout_id></extra-loc-layout_id>
- <extra-loc-viewid></extra-loc-viewid>
- <extra-loc-positionid>modename</extra-loc-positionid>
- <extra-loc-feature></extra-loc-feature>
- <extra-loc-blank>False</extra-loc-blank>
-</message>
-</context>
-</TS>
Binary file usbuis/usbuiqt/src/usbapplication.xls has changed
--- a/usbuis/usbuiqt/src/usbapplication_reg.rss Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.0) on: 2009-12-16T13:39:42
-// * This file is generated by qmake and should not be modified by the
-// * user.
-// ============================================================================
-
-#include <usbapplication.rsg>
-#include <appinfo.rh>
-
-UID2 KUidAppRegistrationResourceFile
-UID3 0xECD2B4FE
-
-RESOURCE APP_REGISTRATION_INFO
- {
- app_file="usbapplication";
- localisable_resource_file="\\resource\\apps\\usbapplication";
-
- }
--- a/usbuis/usbuiqt/src/usbicons.qrc Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/" >
- <file>../icons/usb_icon_mode_2.svg</file>
- <file>../icons/usb_icon_mode_4.svg</file>
- <file>../icons/usb_icon_mode_5.svg</file>
- </qresource>
-</RCC>
--- a/usbuis/usbuiqt/src/usbmainview.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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 "usbmainview.h"
-#include <QModelIndex>
-#include <QtGui/QGraphicsLinearLayout>
-#include <hblistwidget.h>
-#include <hblistwidgetitem.h>
-#include <hbradiobuttonlist.h>
-#include <hbtextedit.h>
-
-#include "usbuisettingmodel.h"
-#include "mydebug.h"
-/*!
- * default constructor
- */
-UsbMainView::UsbMainView( QObject *parent )
-: HbView(), mModel(NULL)
-{
- myDebug() << ">>> UsbMainView::UsbMainView";
- setParent( parent );
- setTitle( qtTrId("USB") );
- mMainLayout = new QGraphicsLinearLayout( Qt::Vertical, this );
- mModel = new UsbUiSettingModel();
- createMainView();
- setLayout( mMainLayout );
- myDebug() << "<<< UsbMainView::UsbMainView";
-}
-
-/*!
- * creates the main view
- */
-void UsbMainView::createMainView()
-{
- myDebug() << ">>> UsbMainView::createMainView";
- QGraphicsLinearLayout *mainViewLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
- mListItem = NULL;
- mlist = NULL;
- mlabel = NULL;
- mradio = NULL;
- mIcon = NULL;
- createIconNameRow( mainViewLayout );
- createDescriptionArea( mainViewLayout );
- createRadioButtonArea( mainViewLayout );
- mMainLayout->addItem( mainViewLayout );
- bool connected = connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
- this, SLOT( updateSettingItems( QModelIndex, QModelIndex ) ) );
- myDebug() << "<<< UsbMainView::createMainView model connected=" << connected;
- connected = connect(mradio, SIGNAL( itemSelected( int ) ),
- this, SLOT( setPersonality( int ) ) );
- myDebug() << "<<< UsbMainView::createMainView mradio connected=" << connected;
- myDebug() << "<<< UsbMainView::createMainView";
-}
-/*!
- * creating the creates the first row in the view containing an icon and a mode name
- */
-void UsbMainView::createIconNameRow( QGraphicsLinearLayout *aLocalPropertiesGroup )
-{
- myDebug() << ">>> UsbMainView::createIconNameRow";
- QGraphicsLinearLayout *listLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
- mlist = new HbListWidget( this );
- mlist->setMaximumSize( 300, 50 ); //todo
- mListItem= new HbListWidgetItem();
- QModelIndex index = mModel->index( UsbUiSettingModel::DefaultMode, KDefaultColumn );
- // QVariant iconName = mModel->data( index, Qt::DecorationRole );
- mIcon = new HbIcon( mModel->data( index, Qt::DecorationRole ).toString() );
- mListItem->setIcon( *mIcon );
- mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
- mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
- mlist->insertItem( 1, mListItem );
- listLayout->addItem( mlist );
- aLocalPropertiesGroup->addItem( listLayout );
- myDebug() << "<<< UsbMainView::createIconNameRow";
-}
-/*!
- * creates the second row from the view containing the description of the selected mode
- */
-void UsbMainView::createDescriptionArea( QGraphicsLinearLayout *aLocalPropertiesGroup )
-{
- myDebug() << ">>> UsbMainView::createDescriptionArea";
- QGraphicsLinearLayout *desLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
- QModelIndex index = mModel->index( UsbUiSettingModel::Description, KDefaultColumn );
- mlabel = new HbTextEdit( mModel->data( index, Qt::DisplayRole ).toString() );
- mlabel->setReadOnly( true );
- mlabel->setCursorVisibility( Hb::TextCursorHidden );
- desLayout->addItem( mlabel );
- desLayout->setAlignment( mlabel, Qt::AlignTop );
- aLocalPropertiesGroup->addItem( desLayout );
- myDebug() << "<<< UsbMainView::createDescriptionArea";
-}
-
-/*!
- * creates the third row from the view containing the radio button list of the existing usb modes
- */
-void UsbMainView::createRadioButtonArea(QGraphicsLinearLayout *aLocalPropertiesGroup)
-{
- myDebug() << ">>> UsbMainView::createRadioButtonArea";
- QGraphicsLinearLayout *radioLayout = new QGraphicsLinearLayout( Qt::Vertical, mMainLayout );
- QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
- QStringList radioList = mModel->data( index, UsbUiSettingModel::SettingsModeNameList ).toStringList();
- int selectedIndex = mModel->data( index, Qt::EditRole ).toInt();
- mradio = new HbRadioButtonList( radioList, selectedIndex );
- radioLayout->addItem( mradio );
- radioLayout->setAlignment( mradio, Qt::AlignBottom );
- aLocalPropertiesGroup->addItem(radioLayout);
- myDebug() << "<<< UsbMainView::createRadioButtonArea";
-}
-
-/*!
- Slot for receiving notification of data changes from the model.
- Identify the setting changed and update the corresponding UI item.
- */
-void UsbMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
- myDebug() << ">>> UsbMainView::updateSettingItems";
- // update only the part of the view specified by the model row(s)
- for ( int row = topLeft.row(); row <= bottomRight.row(); row++ ) {
- myDebug() << " UsbMainView::updateSettingItems row=" << row;
- QModelIndex index = mModel->index( row, KDefaultColumn );
- // Distinguish which setting value is changed.
- switch ( row ) {
- case UsbUiSettingModel::DefaultMode :
- // set the selected personality icon and name
- mIcon->setIconName( mModel->data( index, Qt::DecorationRole ).toString() );
- mListItem->setIcon( *mIcon );
- mListItem->setText( mModel->data( index,Qt::DisplayRole ).toString() );
- break;
- case UsbUiSettingModel::Description :
- // set the description of the selected personality.
- mlabel->setPlainText( mModel->data( index, Qt::DisplayRole ).toString() );
- mlabel->setReadOnly( true );
- mlabel->setCursorVisibility( Hb::TextCursorHidden );
- break;
- case UsbUiSettingModel::UsbModeList :
- // only the selection can change, no changes in the list of personalities
- mradio->setSelected( mModel->data( index, Qt::EditRole ).toInt() );
- break;
- default :
- myDebug() << " UsbMainView::updateSettingItems unknown row " << row;
- break;
- }
- }
- myDebug() << "<<< UsbMainView::updateSettingItems";
-}
-
-/*
- * Slot for receiving notification from the change in radio button list
- */
-void UsbMainView::setPersonality( int personalityIndex )
-{
- myDebug() << ">>> UsbMainView::setPersonality";
- QModelIndex index = mModel->index( UsbUiSettingModel::UsbModeList, KDefaultColumn );
- mModel->setData( index, personalityIndex, Qt::EditRole );
- myDebug() << "<<< UsbMainView::setPersonality";
-}
-
-/*!
- * Destructor
- * destructs the items which are not owned by this class
- */
-UsbMainView::~UsbMainView()
-{
- myDebug() << ">>> UsbMainView::~UsbMainView";
- delete mModel;
- delete mIcon;
- myDebug() << "<<< UsbMainView::~UsbMainView";
-}
--- a/usbuis/usbuiqt/src/usbuimodelactive.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +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 "usbuimodelactive.h"
-#include "mydebug.h"
-
-//const ?type ?constant_var = ?constant;
-
-
-/*!
- Constructor.
- */
-UsbUiModelActive::UsbUiModelActive( int priority, QObject *parent )
-: QObject( parent )
-{
- myDebug() << ">>> UsbUiModelActive::UsbUiModelActive";
- d = new UsbUiModelActivePrivate( this, priority );
- int err= iUsbWatcher.Connect();
- myDebug() << "iUsbWatcher.Connect() returned ";
- myDebug() << err;
- myDebug() << "<<< UsbUiModelActive::UsbUiModelActive";
-}
-
-/*!
- Destructor.
- */
-UsbUiModelActive::~UsbUiModelActive()
-{
- myDebug() << ">>> UsbUiModelActive::~UsbUiModelActive";
- delete d;
- iUsbWatcher.Close();
- myDebug() << "<<< UsbUiModelActive::~UsbUiModelActive";
-}
-/*!
- * emits a signal when the request is completed
- */
-void UsbUiModelActive::emitRequestCompleted( int status )
-{
- myDebug() << ">>> UsbUiModelActive::emitRequestCompleted status: ";
- myDebug() << status;
- emit requestCompleted( status );
- myDebug() << "<<< UsbUiModelActive::emitRequestCompleted";
-}
-
-/*!
- * UsbUiModelActive::SetUSBModeL
- * Sets the Central Repository key to the parameter.
- */
-int UsbUiModelActive::SetUsbPersonality(int personality)
- {
- myDebug() << ">>> UsbUiModelActive::SetUsbPersonality";
- myDebug() << "requested personality is ";
- myDebug() << personality;
- // Change the personality asynchrously, result checked in RunL()
- if( IsActive() )
- {
- Cancel();
- }
- myDebug() << "setting new personality";
- iUsbWatcher.SetPersonality(RequestStatus(), personality);
- SetActive();
- myDebug() << "<<< UsbUiModelActive::SetUsbPersonality, returns 0";
- return 0;
- }
-/*!
- * cancles the personality set in usbwatcher
- */
-void UsbUiModelActive::CancelSetPersonality()
- {
- iUsbWatcher.CancelSetPersonality();
- }
-
-/*!
- Constructor.
- */
-UsbUiModelActivePrivate::UsbUiModelActivePrivate(
- UsbUiModelActive *parent, int priority )
-: CActive( (TInt) priority ), q( parent )
-{
- myDebug() << ">>> UsbUiModelActivePrivate::UsbUiModelActivePrivate";
- CActiveScheduler::Add( this );
- myDebug() << "<<< UsbUiModelActivePrivate::UsbUiModelActivePrivate";
-}
-
-
-/*!
- Destructor.
- */
-UsbUiModelActivePrivate::~UsbUiModelActivePrivate()
-{
- Cancel();
-}
-
-
-/*!
- * Called by the active scheduler when the request has been completed.
- */
-void UsbUiModelActivePrivate::RunL()
-{
- myDebug() << ">>> UsbUiModelActivePrivate::RunL";
- q->emitRequestCompleted( iStatus.Int() );
- myDebug() << "<<< UsbUiModelActivePrivate::RunL";
-}
-
-
-/*!
- Called by the active scheduler when the request has been cancelled.
- */
-void UsbUiModelActivePrivate::DoCancel()
-{
- q->CancelSetPersonality();
-}
-
-
-/*!
- Called by the active scheduler when an error in RunL has occurred.
- */
-TInt UsbUiModelActivePrivate::RunError( TInt aError )
-{
- q->emitRequestCompleted( aError );
- return KErrNone;
-}
--- a/usbuis/usbuiqt/src/usbuisettingmodel.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +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 "usbuisettingmodel.h"
-#include "usbuimodelactive.h"
-#include "mydebug.h"
-#include <QStringList>
-#include <UsbWatcherInternalCRKeys.h>
-#include <XQSettingsKey>
-#include <usbman.h>
-
-const QString TextIdPrefix = ("txt_usb_");
-const QString ModeIconNamePrefix = (":/icons/usb_icon_mode_");
-
-/*!
- Constructor.
- */
-UsbUiSettingModel::UsbUiSettingModel( QObject *parent )
- : QAbstractItemModel( parent )
-{
- mModelActive = new UsbUiModelActive();
-
- for ( int i = 0; i < UsbUiSettingModel::EndOfSettings; i++ ) {
- // Initialize the list with empty values.
- mSettingsList.append( QMap< int, QVariant >() );
- }
-
- mCurrentMode = currentMode();
- mPreviousMode = mCurrentMode;
- setUsbSettings(mCurrentMode);
- bool ret = mSettingsManager.startMonitoring(
- XQSettingsKey( XQSettingsKey::TargetCentralRepository,
- KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
- myDebug() << ">>> UsbUiSettingModel::startMonitoring value="
- << ret;
-
- // signal: personality changed in the central repository
- connect( &mSettingsManager,
- SIGNAL( valueChanged( const XQSettingsKey&, const QVariant& ) ),
- this,
- SLOT( usbModeChanged( const XQSettingsKey&, const QVariant& ) ) );
-
- // signal: response from usbwatcher to our attempt to set the personality
- connect( mModelActive,
- SIGNAL( requestCompleted( int status ) ),
- this,
- SLOT( setPersonalityCompleted (int status )));
-
-}
-/*!
- * calls the model's set functions to initialize the model's data
- */
-void UsbUiSettingModel::setUsbSettings( int aModeId )
- {
- setUsbModelistSetting( aModeId );
- setDefaultModeSetting();
- setDescriptionSetting();
- }
-
-/*!
- Destructor.
- */
-UsbUiSettingModel::~UsbUiSettingModel()
-{
- myDebug() << ">>> UsbUiSettingModel::~UsbUiSettingModel";
- mSettingsManager.stopMonitoring(
- XQSettingsKey( XQSettingsKey::TargetCentralRepository,
- KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
- delete mModelActive;
- myDebug() << "<<< UsbUiSettingModel::~UsbUiSettingModel";
-}
-
-/*!
- Provides notification of changes in selected usb mode
- */
-void UsbUiSettingModel::usbModeChanged( const XQSettingsKey &key,
- const QVariant &value )
-{
-Q_UNUSED(key);
- myDebug() << ">>> UsbUiSettingModel::usbModeChanged";
- // key is not checked, as we monitor only one key
-
- setNewUsbMode(value.toInt());
-
- myDebug() << "<<< UsbUiSettingModel::usbModeChanged";
-}
-/*!
- * updates the model rows and emits signal datachanged
- */
-void UsbUiSettingModel::setNewUsbMode(int newPersonality)
-
- {
- myDebug() << ">>> UsbUiSettingModel::setNewUsbMode value="
- << newPersonality;
-
- mCurrentMode = newPersonality;
- setUsbSettings(mCurrentMode);
-
- emit dataChanged( createIndex( DefaultMode, KDefaultColumn ),
- createIndex( UsbModeList, KDefaultColumn ) );
-
- myDebug() << "<<< UsbUiSettingModel::setNewUsbMode";
- }
-/*!
- * Returns the index of the item in the model specified by the given row, column and parent index.
- */
-QModelIndex UsbUiSettingModel::index( int row, int column, const QModelIndex &parent ) const
-{
- return hasIndex( row, column, parent ) ? createIndex( row, column ) : QModelIndex();
-}
-
-
-/*
- This model does not support hierarchy, so this returns an empty model index.
- */
-QModelIndex UsbUiSettingModel::parent( const QModelIndex &child ) const
-{
- Q_UNUSED( child );
- return QModelIndex();
-}
-/*!
- * Returns the number of rows under the given parent
- */
-int UsbUiSettingModel::rowCount( const QModelIndex &parent ) const
-{
- Q_UNUSED( parent );
- return mSettingsList.count();
-}
-
-
-/*!
- * Returns the number of columns for the children of the given parent.
- * This model is one-dimensional, so this returns 1.
- */
-int UsbUiSettingModel::columnCount( const QModelIndex &parent ) const
-{
- Q_UNUSED( parent );
- return 1;
-}
-/*!
- * Returns the data stored under the given role for the item referred to by the index.
- */
-QVariant UsbUiSettingModel::data( const QModelIndex &index, int role ) const
-{
- return mSettingsList.value( index.row() ).value( role );
-}
-
-
-/*!
- * This is called when usb mode is changed, it only sets the personality when the given role is EditRole
- */
-bool UsbUiSettingModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- myDebug() << ">>> UsbUiSettingModel::setData";
- bool success = false;
- if ( role == Qt::EditRole ) {
- // Only allow changes on the value with role EditRole. Others are managed here.
- switch ( index.row() ) {
- case UsbModeList: {
- mModelActive->SetUsbPersonality( mPersonalityIds.at( value.toInt() ) );
- success = true;
- // also update the rest of the model with the about to be selected mode right away
- setNewUsbMode(mPersonalityIds.at( value.toInt() ));
- break;
- }
- case DefaultMode:
- //no break
- case Description:
- //no break
- default:
- myDebug() << " UsbUiSettingModel::setData not supported row " << index.row();
- break;
- }
- }
- myDebug() << "<<< UsbUiSettingModel::setData return " << success;
- return success;
-}
-
-/*!
- * Getter for the source data.
- */
-const QModelIndex* UsbUiSettingModel::sourceData() const
-{
- return new QModelIndex( createIndex( 0, 0 ) );
-}
-
-/*!
- * creats the logical name of the modename string for the list
- */
-QString UsbUiSettingModel::modeListName( int modeId )
-{
- QString textId = TextIdPrefix + "modelistname_" + QString::number( modeId );
- QString modeName = qtTrId( textId.toAscii() );
- return modeName;
-}
-
-/*!
- * Get the current USB mode (personality) ID
- */
-int UsbUiSettingModel::currentMode()
-{
- myDebug() << ">>> UsbUiSettingModel::CurrentMode";
- int currentMode = mSettingsManager.readItemValue(
- XQSettingsKey( XQSettingsKey::TargetCentralRepository,
- KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
- myDebug() << "<<< UsbUiSettingModel::CurrentMode " << currentMode;
- return currentMode;
-}
-
-/*!
- * sets the value to different roles of the model's first row
- */
-void UsbUiSettingModel::setDefaultModeSetting()
-{
- QString iconName;
- QString modeName;
- //empty iconName and modeName are used for a hidden personality
- if ( !isPersonalityHidden(mCurrentMode) ) {
- iconName = ModeIconNamePrefix + QString::number( mCurrentMode ) + ".svg";
- QString textId = TextIdPrefix + "modename_" + QString::number( mCurrentMode );
- modeName = qtTrId( textId.toAscii() );
- }
-
- myDebug() << ">>> UsbUiSettingModel::setDefaultModeSetting iconName="
- << iconName << " modeName=" << modeName;
- QMap< int, QVariant > val = mSettingsList.at( DefaultMode );
- if ( val.isEmpty() ) {
- val[ SettingType ] = QVariant( DefaultMode );
- }
- val[ Qt::DecorationRole ] = QVariant(iconName) ;
- val[ Qt::DisplayRole ]= QVariant(modeName) ;
- mSettingsList.replace( DefaultMode, val );
- myDebug() << "<<< UsbUiSettingModel::setDefaultModeSetting";
-}
-
-/*!
- Updates all values related to the mode description.
- */
-void UsbUiSettingModel::setDescriptionSetting()
-{
- QString description;
- //the description will be empty for a hidden personality
- if ( !isPersonalityHidden(mCurrentMode) ) {
- QString textId = TextIdPrefix + "description_"
- + QString::number( mCurrentMode );
- description = qtTrId( textId.toAscii() );
- }
- myDebug() << ">>> UsbUiSettingModel::setDescriptionSetting description="
- << description;
- QMap< int, QVariant > val = mSettingsList.at( Description );
- if ( val.isEmpty() ) {
-
- val[ SettingType ] = QVariant( Description );
-
- }
- // The display role stores the string representation of the actual value.
- val[ Qt::DisplayRole ] = QVariant( description );
- mSettingsList.replace( Description, val );
- myDebug() << "<<< UsbUiSettingModel::setDescriptionSetting";
-}
-
-/*!
- Updates all values related to the visibility setting.
- Updates the selectable USB modes only in the 1st call.
- */
-bool UsbUiSettingModel::setUsbModelistSetting( int aModeId )
-{
- myDebug() << ">>> UsbUiSettingModel::setUsbModelistSetting aModeIndex="
- << aModeId;
- bool ret = true;
- QMap< int, QVariant > val = mSettingsList.at(UsbModeList);
- if ( val.isEmpty() ) {
- val[ SettingType ] = QVariant( UsbModeList );
-
- RUsb iUsbman;
- if ( iUsbman.Connect() == KErrNone ) {
-
- RArray<TInt> personalityIds;
- mPersonalityIds.clear();
- if ( iUsbman.GetPersonalityIds( personalityIds ) == KErrNone ) {
- QStringList modeList;
- for ( int i = 0; i < personalityIds.Count(); i++ ) {
- if ( !isPersonalityHidden(iUsbman, personalityIds[i]) ) {
- mPersonalityIds.append( personalityIds[i] );
- modeList.append( modeListName( mPersonalityIds[i] ) );
- }
- }
- val[ SettingsModeNameList ] = QVariant( modeList );
- }
- }
- else{
- ret = false;
- }
- iUsbman.Close();
- }
- //index will be -1 for hidden personality
- val[ Qt::EditRole ] = QVariant( mPersonalityIds.indexOf(aModeId) );
- mSettingsList.replace( UsbModeList, val );
- myDebug() << "<<< UsbUiSettingModel::setUsbModelistSetting";
- return ret;
-}
-
-/*!
- * it checks the response from usbwatcher to see if the new mode change has been successful
- * it will go back to the previous personality if it has not been successfull
- */
-void UsbUiSettingModel::setPersonalityCompleted (int status )
-{
- myDebug() << ">>> UsbUiSettingModel::setPersonalityCompleted status= "
- << status;
- // status contains Symbian error code from usbwatcher
- // if the status is KErrNone, we are ready to process the next request
- if (status != KErrNone)
- {
- // changing the personality failed, so we need to set back the previous personality
- // the value will be read from central repository and also updates mCurrentMode
- mPreviousMode = mSettingsManager.readItemValue(
- XQSettingsKey( XQSettingsKey::TargetCentralRepository,
- KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) ).toInt();
- setNewUsbMode(mPreviousMode);
- }
-
- // after handling the return code we know the the current personality works
- // and we will not go back to the previous one
- mPreviousMode = mCurrentMode;
- myDebug() << "<<< UsbUiSettingModel::setPersonalityCompleted";
-}
-
-bool UsbUiSettingModel::isPersonalityHidden(RUsb &usbman, TInt personalityId)
-{
- myDebug() << ">>> UsbUiSettingModel::isPersonalityHidden from USB Manager";
- bool hidden = false;
- TUint32 property = 0;
- TInt ret = usbman.GetPersonalityProperty(personalityId, property);
- if (ret == KErrNone) {
- myDebug() << "property " << property;
- if (property & KUsbPersonalityPropertyHidden) {
- hidden = true;
- }
- }
- myDebug() << "<<< UsbUiSettingModel::isPersonalityHidden " << hidden;
- return hidden;
-}
-
-bool UsbUiSettingModel::isPersonalityHidden(TInt personalityId)
-{
- return ( mPersonalityIds.indexOf(personalityId) == -1 );
-}
--- a/usbuis/usbuiqt/src/usbview.docml Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.1">
- <widget name="viewMain" type="HbView">
- <widget name="content" role="HbView:widget" type="HbWidget">
- <widget name="container" type="HbWidget">
- <sizehint height="18.0" type="MINIMUM" width="18.0"/>
- <sizehint height="160.0" type="PREFERRED" width="363.0"/>
- <zvalue value="0.0017000000000000006"/>
- <layout orientation="Vertical" type="linear"/>
- </widget>
- <widget name="container_1" type="HbWidget">
- <sizehint height="18.0" type="MINIMUM" width="18.0"/>
- <sizehint height="160.0" type="PREFERRED" width="363.0"/>
- <zvalue value="0.0016000000000000005"/>
- <layout orientation="Vertical" type="linear"/>
- </widget>
- <widget name="container_2" type="HbWidget">
- <sizehint height="18.0" type="MINIMUM" width="18.0"/>
- <sizehint height="160.0" type="PREFERRED" width="363.0"/>
- <zvalue value="0.0018000000000000006"/>
- <layout orientation="Vertical" type="linear"/>
- </widget>
- <layout type="anchor" widget="content">
- <anchoritem dst="container" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
- <anchoritem dst="container" dstEdge="TOP" spacing="0.0" src="" srcEdge="TOP"/>
- <anchoritem dst="container" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="container_1" dstEdge="LEFT" spacing="0.0" src="" srcEdge="LEFT"/>
- <anchoritem dst="container_1" dstEdge="TOP" spacing="0.0" src="container" srcEdge="BOTTOM"/>
- <anchoritem dst="container_1" dstEdge="RIGHT" spacing="0.0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="container_2" dstEdge="LEFT" spacing="-3.0" src="" srcEdge="LEFT"/>
- <anchoritem dst="container_2" dstEdge="TOP" spacing="0.0" src="container_1" srcEdge="BOTTOM"/>
- </layout>
- </widget>
- <string name="title" value="USB"/>
- </widget>
- <metadata>
- <resource location="usbapplication.qrc"/>
- </metadata>
-</hbdocument>
--- a/usbuis/usbuiqt/src/usbviewmanager.cpp Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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 <hbmainwindow.h>
-#include "usbviewmanager.h"
-#include "usbmainview.h"
-
-
-UsbViewManager::UsbViewManager( HbMainWindow* mainWindow, QObject *parent )
-: QObject( parent ),
- mWindow(mainWindow)
- {
- }
-
-UsbViewManager::~UsbViewManager()
- {
-
- }
-
-/*!
- Create views(main view, gadget gallery view and gadget details view).
- Add them to MainWindow.
- */
-void UsbViewManager::addView()
- {
- // Create main view and add
- mMainView = new UsbMainView( this );
- mWindow->addView(mMainView);
-
- }
-
--- a/usbuis/usbuiqt/usbapplication.pro Fri Jun 04 10:27:39 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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: Project definition file for project USB Settings Application
-#
-
-TEMPLATE = app
-TARGET = usbapplication
-QT += core \
- gui \
- xml
-HEADERS += inc/usbuisettingmodel.h \
- inc/usbuimodelactive.h \
- inc/usbviewmanager.h \
- inc/usbmainview.h
-SOURCES += src/usbuisettingmodel.cpp \
- src/usbuimodelactive.cpp \
- src/usbviewmanager.cpp \
- src/usbmainview.cpp \
- src/main.cpp \
- src/usbapplication_reg.rss
-INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
-LIBS += -lcentralrepository
-LIBS += -lusbwatcher
-LIBS += -lxqsettingsmanager
-LIBS += -lusbman
-
-FORMS +=
-RESOURCES += src/usbicons.qrc \
- src/usbapplication.qrc
-CONFIG += qt \
- hb
-
-symbian: {
- TARGET.UID3 = 0x2002BCA3
- TARGET.CAPABILITY = LocalServices \
- WriteDeviceData
-
- # for pkg
- usbuitranslation.sources = src/usbapplication.qm
- usbuitranslation.path = /resource
- DEPLOYMENT += usbuitranslation
-
- BLD_INF_RULES.prj_exports += "./src/usbapplication.qm z:/resource/qt/translations/usbapplication.qm
-}
-
-# placeholder for creating sis file
-createsis.commands += ( makesis -v usbapplication.pkg ); \
- && \
- ( signsis.exe usbapplication.sis usbapplication_signed.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key ); \
- && \
- ( del usbapplication.sis );
-QMAKE_EXTRA_TARGETS += createsis
-
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
- "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \
- "rom/usbsettingsresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsresources.iby)"