# HG changeset patch # User William Roberts # Date 1279813443 -3600 # Node ID ef2686f7597e2d355efc0bedc79d1af057905a50 # Parent e84fb4c9218b63a694fe6612117bacb735ab945f# Parent 62e6d990246ccc447fb92119531326fa66780a80 Catchup to latest Symbian^4 diff -r e84fb4c9218b -r ef2686f7597e layers.sysdef.xml --- a/layers.sysdef.xml Mon Jun 21 22:40:15 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:44:03 2010 +0100 @@ -15,9 +15,11 @@ - - - + + + + + diff -r e84fb4c9218b -r ef2686f7597e package_definition.xml --- a/package_definition.xml Mon Jun 21 22:40:15 2010 +0100 +++ b/package_definition.xml Thu Jul 22 16:44:03 2010 +0100 @@ -11,9 +11,6 @@ - - - @@ -36,12 +33,6 @@ - - - - - - diff -r e84fb4c9218b -r ef2686f7597e tsrc/group/bld.inf --- a/tsrc/group/bld.inf Mon Jun 21 22:40:15 2010 +0100 +++ b/tsrc/group/bld.inf Thu Jul 22 16:44:03 2010 +0100 @@ -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" diff -r e84fb4c9218b -r ef2686f7597e usbclasses/group/bld.inf --- a/usbclasses/group/bld.inf Mon Jun 21 22:40:15 2010 +0100 +++ b/usbclasses/group/bld.inf Thu Jul 22 16:44:03 2010 +0100 @@ -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" diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/BWINS/pictbridgeU.DEF --- a/usbclasses/pictbridgeengine/BWINS/pictbridgeU.DEF Mon Jun 21 22:40:15 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 const &, class RArray 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 const &, class RArray 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 const &, class RArray 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 const &, class CDpsTransaction *) - ?FillRepArgs@TDpsGetCapability@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 13 NONAME ; int TDpsGetCapability::FillRepArgs(class RArray const &, class CDpsTransaction *) - ?FillRepArgs@TDpsGetJobStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 14 NONAME ; int TDpsGetJobStatus::FillRepArgs(class RArray const &, class CDpsTransaction *) - ?FillRepArgs@TDpsGetPrinterStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 15 NONAME ; int TDpsGetPrinterStatus::FillRepArgs(class RArray const &, class CDpsTransaction *) - ?FillReqArgs@TDpsAbortJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 16 NONAME ; int TDpsAbortJob::FillReqArgs(class RArray &, class RArray &, unsigned int &, class CDpsTransaction *) - ?FillReqArgs@TDpsConfigPrintService@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 17 NONAME ; int TDpsConfigPrintService::FillReqArgs(class RArray &, class RArray &, unsigned int &, class CDpsTransaction *) - ?FillReqArgs@TDpsGetCapability@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 18 NONAME ; int TDpsGetCapability::FillReqArgs(class RArray &, class RArray &, unsigned int &, class CDpsTransaction *) - ?FillReqArgs@TDpsStartJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 19 NONAME ; int TDpsStartJob::FillReqArgs(class RArray &, class RArray &, 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 &) - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/EABI/pictbridgeU.DEF --- a/usbclasses/pictbridgeengine/EABI/pictbridgeU.DEF Mon Jun 21 22:40:15 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 ; ## - _ZTI12TDpsStartJob @ 27 NONAME ; ## - _ZTI14TMDpsOperation @ 28 NONAME ; ## - _ZTI16TDpsGetJobStatus @ 29 NONAME ; ## - _ZTI17TDpsGetCapability @ 30 NONAME ; ## - _ZTI20TDpsGetPrinterStatus @ 31 NONAME ; ## - _ZTI22TDpsConfigPrintService @ 32 NONAME ; ## - _ZTV12TDpsAbortJob @ 33 NONAME ; ## - _ZTV12TDpsStartJob @ 34 NONAME ; ## - _ZTV14TMDpsOperation @ 35 NONAME ; ## - _ZTV16TDpsGetJobStatus @ 36 NONAME ; ## - _ZTV17TDpsGetCapability @ 37 NONAME ; ## - _ZTV20TDpsGetPrinterStatus @ 38 NONAME ; ## - _ZTV22TDpsConfigPrintService @ 39 NONAME ; ## - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/group/bld.inf --- a/usbclasses/pictbridgeengine/group/bld.inf Mon Jun 21 22:40:15 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 -PRJ_MMPFILES -pictbridge.mmp - -PRJ_EXPORTS -../rom/pictbridge.iby CORE_MW_LAYER_IBY_EXPORT_PATH(pictbridge.iby) diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/group/pictbridge.mmp --- a/usbclasses/pictbridgeengine/group/pictbridge.mmp Mon Jun 21 22:40:15 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 - -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 - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dps.rh --- a/usbclasses/pictbridgeengine/inc/dps.rh Mon Jun 21 22:40:15 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"; - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsconnectnotifier.h --- a/usbclasses/pictbridgeengine/inc/dpsconnectnotifier.h Mon Jun 21 22:40:15 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 -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsconst.h --- a/usbclasses/pictbridgeengine/inc/dpsconst.h Mon Jun 21 22:40:15 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 -#include - -_LIT(KDpsEnginePanicCat, "Dps Engine"); -const TInt KShiftLength = 16; -const TInt KFullWordWidth = 8; - -// -// -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, ""); -_LIT8(KDpsXmlNS, ""); -_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 - - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsdefs.h --- a/usbclasses/pictbridgeengine/inc/dpsdefs.h Mon Jun 21 22:40:15 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 - -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 TDpsEleArray; - -struct TDpsArg - { - TDpsArgument iElement; - TBuf8 iContent; - }; - -// used for get DPS respond -typedef RArray TDpsArgArray; - -struct TDpsResult - { - TDpsResultMajorCode iMajorCode; - TDpsResultMinorCode iMinorCode; - }; - -#endif - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsfile.h --- a/usbclasses/pictbridgeengine/inc/dpsfile.h Mon Jun 21 22:40:15 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 -#include - -/** -* 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsfile.inl --- a/usbclasses/pictbridgeengine/inc/dpsfile.inl Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsoperation.h --- a/usbclasses/pictbridgeengine/inc/dpsoperation.h Mon Jun 21 22:40:15 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 -#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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsoperation.inl --- a/usbclasses/pictbridgeengine/inc/dpsoperation.inl Mon Jun 21 22:40:15 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; - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsparam.h --- a/usbclasses/pictbridgeengine/inc/dpsparam.h Mon Jun 21 22:40:15 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 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 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 iDpsVersions; - TBuf8 iVendorName; - TDpsVersion iVendorVersion; - TBuf8 iProductName; - TBuf8 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 iContent; - RArray 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 iJobConfig; - //there might be multiple printInfo in case of several pictures are - //selected to be printed - RArray 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsparam.inl --- a/usbclasses/pictbridgeengine/inc/dpsparam.inl Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsptpnotifier.h --- a/usbclasses/pictbridgeengine/inc/dpsptpnotifier.h Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsscriptreceiver.h --- a/usbclasses/pictbridgeengine/inc/dpsscriptreceiver.h Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsscriptsender.h --- a/usbclasses/pictbridgeengine/inc/dpsscriptsender.h Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsstate.h --- a/usbclasses/pictbridgeengine/inc/dpsstate.h Mon Jun 21 22:40:15 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 -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsstatemachine.h --- a/usbclasses/pictbridgeengine/inc/dpsstatemachine.h Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsstatemachine.inl --- a/usbclasses/pictbridgeengine/inc/dpsstatemachine.inl Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpstransaction.h --- a/usbclasses/pictbridgeengine/inc/dpstransaction.h Mon Jun 21 22:40:15 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 -#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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpstransaction.inl --- a/usbclasses/pictbridgeengine/inc/dpstransaction.inl Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsusbnotifier.h --- a/usbclasses/pictbridgeengine/inc/dpsusbnotifier.h Mon Jun 21 22:40:15 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 -#include -#include "pictbridge.h" -#include -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsxmlgenerator.h --- a/usbclasses/pictbridgeengine/inc/dpsxmlgenerator.h Mon Jun 21 22:40:15 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 -#include -#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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsxmlparser.h --- a/usbclasses/pictbridgeengine/inc/dpsxmlparser.h Mon Jun 21 22:40:15 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 -#include -#include -#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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsxmlparser.inl --- a/usbclasses/pictbridgeengine/inc/dpsxmlparser.inl Mon Jun 21 22:40:15 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; - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/dpsxmlstring.h --- a/usbclasses/pictbridgeengine/inc/dpsxmlstring.h Mon Jun 21 22:40:15 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 - -typedef RArray 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/inc/pictbridge.h --- a/usbclasses/pictbridgeengine/inc/pictbridge.h Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/rom/pictbridge.iby --- a/usbclasses/pictbridgeengine/rom/pictbridge.iby Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/src/dps.rss --- a/usbclasses/pictbridgeengine/src/dps.rss Mon Jun 21 22:40:15 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 -#include "dps.rh" - - -RESOURCE BA_RSS_SIGNATURE - { - signature = 1; - } - -RESOURCE dps_configuration dps_config - { - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp --- a/usbclasses/pictbridgeengine/src/dpsconnectnotifier.cpp Mon Jun 21 22:40:15 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 -#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::~"))); - Cancel(); - IF_DEBUG(Print(_L("<<>>CDpsConnectNotifier::ConnectNotify"))); - if (!IsActive()) - { - iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates, - iNotifier->iConnectState, - iStatus); - SetActive(); - } - 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::DoCancel"))); - iNotifier->iUsbM.DeviceStateNotificationCancel(); - IF_DEBUG(Print(_L("<<ConstructL(); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- -// -void CDpsFile::ConstructL() - { - IF_DEBUG(Print(_L(">>>CDpsFile::ConstructL"))); - User::LeaveIfError(iFs.Connect()); - IF_DEBUG(Print(_L("<<>>CDpsFile::~"))); - iFs.Close(); - 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::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::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("<< -#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("<<>>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::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("<<>>TDpsAbortJob::FillReqArgs"))); - TDpsArg arg; - arg.iElement = EDpsArgAbortStyle; - arg.iContent.AppendNumUC(iReqParam.iAbortStyle, EHex); - arg.iContent.Append(KDpsLowZero); - aArgs.Append(arg); - 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::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("<<>>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("<<>>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("<<>>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("<<>>TDpsGetJobStatus::FillRepArgs"))); - TInt value, error, per; - TBuf 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("<<>>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("<< -#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::"))); - Cancel(); - 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::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::DoCancel"))); - iNotifier->iUsbW.CancelSetPersonality(); - IF_DEBUG(Print(_L("<< -#include -#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"))); - 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::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::DoCancel"))); - iOperator->DpsEngine()->Ptp().CancelObjectReceivedNotify(); - IF_DEBUG(Print(_L("<<>>CDpsScriptReceiver::RunError is %d"), aError)); - // if error happened cancel the outstanding request - Cancel(); - iOperator->Error(aError); - IF_DEBUG(Print(_L("<< -#include -#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"))); - 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::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::DoCancel"))); - iOperator->DpsEngine()->Ptp().CancelSendObject(); - IF_DEBUG(Print(_L("<<>>CDpsScriptSender::RunError is %d"), aError)); - Cancel(); - iOperator->Error(aError); - IF_DEBUG(Print(_L("<< -#include "dpsstate.h" -#include "dpsstatemachine.h" -#include "dpstransaction.h" -#include "dpsscriptreceiver.h" -#include - -#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; - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/src/dpsstatemachine.cpp --- a/usbclasses/pictbridgeengine/src/dpsstatemachine.cpp Mon Jun 21 22:40:15 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 -#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::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("<<>>CDpsStateMachine::StartTransaction"))); - iMOperation = aRequest; - iOperation = (TDpsOperation)iMOperation->iOperation; - iTrader->CreateRequestL(aRequest); - iCurState = iSendingReqState; - IF_DEBUG(Print(_L("<<>>CDpsStateMachine::Initialize"))); - iOperation = EDpsOpEmpty; - iEvent = EDpsEvtEmpty; - iCurError = KErrNone; - if (CurState() != IdleState()) - { - SetState(IdleState()); - } - IF_DEBUG(Print(_L("<< -#include -#include -#include -#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 -#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"))); - 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::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::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 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::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::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::CreateRequestReply"))); - TInt count = aArgs.Count(); - TInt basePathId; - TBuf8 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 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::SubstitutePath %S"), &aPath)); - TInt size = aPath.Size(); - for (TInt i = 0; i < size; i++) - { - if (aPath[i] == KSlash) - { - aPath[i] = KBackSlash; - } - } - TBuf driveEWide = PathInfo::MemoryCardRootPath(); - TBuf8 driveENarrow; - driveENarrow.Copy(driveEWide); - aPath.Replace(0, KPathLength - 1, driveENarrow); - IF_DEBUG(Print(_L("<< -#include -#include -#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"))); - 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("<<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::ConnectNotify"))); - iConnectP->ConnectNotify(); - 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::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::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::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::ConnectState"))); - TInt ret = iUsbM.GetDeviceState(iConnectState); - IF_DEBUG(Print(_L("<< -#include "dpsxmlgenerator.h" -#include "pictbridge.h" -#include "dpsconst.h" -#include "dpsxmlstring.h" -#include - -#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::StatrDocument"))); - aScript.WriteL(KDpsXmlHeader); - aScript.WriteL(KDpsXmlNS); - aScript.WriteL(KDpsXmlSpace); - IF_DEBUG(Print(_L("<<>>CDpsXmlGenerator::EndDocument"))); - aScript.WriteL(KDpsXmlBraceOpen); - aScript.WriteL(KDpsXmlSlash); - aScript.WriteL(KDpsXml); - aScript.WriteL(KDpsXmlBraceClose); - IF_DEBUG(Print(_L("<<>>CDpsXmlGenerator::StartInput"))); - aScript.WriteL(KDpsXmlBraceOpen); - aScript.WriteL(KDpsXmlInput); - aScript.WriteL(KDpsXmlBraceClose); - aScript.WriteL(KDpsXmlSpace); - 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::StartResult"))); - aScript.WriteL(KDpsXmlBraceOpen); - aScript.WriteL(KDpsXmlOutput); - aScript.WriteL(KDpsXmlBraceClose); - aScript.WriteL(KDpsXmlSpace); - aScript.WriteL(KDpsXmlBraceOpen); - aScript.WriteL(KDpsXmlResult); - aScript.WriteL(KDpsXmlBraceClose); - TBuf8 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::EndResult"))); - aScript.WriteL(KDpsXmlBraceOpen); - aScript.WriteL(KDpsXmlSlash); - aScript.WriteL(KDpsXmlOutput); - aScript.WriteL(KDpsXmlBraceClose); - aScript.WriteL(KDpsXmlSpace); - 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::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::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::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 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::StartElement"))); - aScript.WriteL(KDpsXmlBraceOpen); //< - aScript.WriteL(iEngine->DpsParameters()-> - iDpsElementStrings[aElement - 1]); - aScript.WriteL(KDpsXmlBraceClose); // > - aScript.WriteL(KDpsXmlSpace); - 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("<< -#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 _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::OnStartDocumentL"))); - if (aErrorCode != KErrNone) - { - IF_DEBUG(Print(_L("---, error code is %d"), aErrorCode)); - User::Leave(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::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 - if (!name.Compare(KDpsXml)) - { - iAction = EDpsXmlStart; - } - // this is the second layer - 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 - 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("<<> 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::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(value >> KShiftLength); - iDpsResult.iMinorCode = - static_cast(value & KDpsMinorMask); - } - // gets the argument - else if (iAction == EDpsXmlOperation || iAction == EDpsXmlEvent) - { - iDpsArgs[iDpsArgs.Count() - 1].iContent.Copy(aBytes); - } - 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::OnEndPrefixMappingL"))); - if (aErrorCode != KErrNone) - { - IF_DEBUG(Print(_L("--- error code %d"), aErrorCode)); - User::Leave(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::OnSkippedEntityL"))); - if (aErrorCode != KErrNone) - { - IF_DEBUG(Print(_L("--- error code %d"), aErrorCode)); - User::Leave(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::OnError()"))); - if (aErrorCode != KErrNone) - { - IF_DEBUG(Print(_L("---error code %d"), aErrorCode)); - } - IF_DEBUG(Print(_L("<<(this) : 0; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -void CDpsXmlParser::Reset() - { - iDpsArgs.Reset(); - iAction = EDpsXmlEmpty; - iDpsEvent = EDpsEvtEmpty; - iDpsOperation = EDpsOpEmpty; - iElement = EDpsEleEmpty; - iAttrib = 0; - } - diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/src/dpsxmlstring.cpp --- a/usbclasses/pictbridgeengine/src/dpsxmlstring.cpp Mon Jun 21 22:40:15 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 - -#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(); - } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/pictbridgeengine/src/pictbridge.cpp --- a/usbclasses/pictbridgeengine/src/pictbridge.cpp Mon Jun 21 22:40:15 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 -#include -#include -#include -#include -#include -#include -#include - -#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(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(Dll::Tls()); - if (me) - { - delete me; - Dll::SetTls(NULL); - } - 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("<<>>~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::CancelSearchPrinter"))); - iUsbNotifier->CancelPrinterNotify(); - 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::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::CancelDpsOperation"))); - if (iDpsOperationRequest) - { - iDpsOperator->ScriptSender()->Cancel(); - User::RequestComplete(iDpsOperationRequest, KErrCancel); - } - iDpsOperator->Initialize(); - 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("<<ScriptReceiver()->Cancel(); - } - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CDpsEngine::GetDpsConfigL(TDpsConfigPrintReq& aConfig) - { - IF_DEBUG(Print(_L(">>>DpsEngine::GetDpsConfigL"))); - - RFs fs = iDpsOperator->Trader()->FileHandle()->FileSession(); - RResourceFile resource; - - TBuf resourceFile(PathInfo::RomRootPath()); - TBuf 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(reader.ReadUint8()); - for (TInt i = 0; i < count; i++) - { - TDpsVersion version; - version.iMajor = static_cast(reader.ReadUint8()); - version.iMinor = static_cast(reader.ReadUint8()); - aConfig.iDpsVersions.Append(version); - } - TPtrC vendorString = reader.ReadTPtrC(); - aConfig.iVendorName.Copy(vendorString); - TDpsVersion vendorVersion; - vendorVersion.iMajor = static_cast(reader.ReadUint8()); - vendorVersion.iMinor = static_cast(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("<< + diff -r e84fb4c9218b -r ef2686f7597e usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h --- a/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Thu Jul 22 16:44:03 2010 +0100 @@ -22,9 +22,9 @@ #include #include #include -#include #include "obexsmwatcher.h" + const TInt KObexClassPriority = 2; const TInt KObexNumInterfaces = 2; diff -r e84fb4c9218b -r ef2686f7597e usbclasses/usbobexclasscontroller/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbobexclasscontroller/inc/debug.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug macros and declarations. +* +*/ + + +#ifndef DEBUG_H +#define DEBUG_H + +////////////////////////////////////////////////////////////////////////////// +// Here are parameters need to be modified. +// Component name +#define MODULE_NAME "UsbObexCc" +////////////////////////////////////////////////////////////////////////////// + + +// For handling unicode strings as L##MACRO is interpreted as LMACRO +#define WIDEN2( x ) L##x +#define WIDEN( x ) WIDEN2( x ) + +_LIT( KUsbPanicModule, ""WIDEN( MODULE_NAME ) ); + +#ifdef _DEBUG + +// Comment this line out if using real-time debugging +//#define LOG_TO_FILE +// =========================================================================== +#if defined ( LOG_TO_FILE ) +// =========================================================================== +// Add corresponding libabry in mmp file +// LIBRARY flogger.lib +// The log file is located at +// c:\logs\usb\MODULE_NAME.txt + +#include + +#define DESC( x ) TPtrC( ( const TText* ) ( x ) ) +#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) ) +_LIT( KUsbLogDir, "USB" ); +_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" ); + +// s: c string. +#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ) ) + +// s: c string contains "%x" +// v: varaible corresponding to %x +#define LOG1(s, v) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v) +// s: c string contains "%x%y" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +#define LOG2(s, v1, v2) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2) + +// s: c string contains "%x%y%z" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +// v3: varaible corresponding to %z +#define LOG3(s, v1, v2, v3) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2, v3 ) + +class TFuncLogger + { +public: + TFuncLogger(const TDesC8& aFuncName) + { + iFuncName.Set( aFuncName ); + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] >>%s" ), iFuncName.Ptr() ); + } + ~TFuncLogger() + { + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, + EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] <<%s" ), iFuncName.Ptr() ); + } +private: + TPtrC8 iFuncName; + }; +// =========================================================================== +#else //LOG_TO_FILE not defined +// =========================================================================== +#include + +// Paramters same as above. +#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } + +#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); } + +#define LOG2( s, v1,v2 ) { RDebug::Printf( "["MODULE_NAME"] "##s , v1, v2 ); } + +#define LOG3( s, v1, v2, v3 ) { RDebug::Printf( "["MODULE_NAME"] "##s , \ + v1, v2, v3); } + +inline void LogBuf(const TDesC8& aBuf8) + { + LOG1("Buffer length = %d Buffer content:", aBuf8.Length()); + + TInt len(aBuf8.Length()); + for (TInt i(0); i < len; ++i) + RDebug::Print(_L("Buffer[%d] = 0x%x"), i, aBuf8[i]); + } + +class TFuncLogger + { +public: + TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName ) + { + RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr()); + } + ~TFuncLogger() + { + RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr()); + } +private: + TPtrC8 iFuncName; + }; +#endif // LOG_TO_FILE + +#define LEAVE( exp ) {volatile TInt err_ = exp; \ + LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Leave( err_ );} + +#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \ + if(err__ < 0) LEAVE(err__);} + +#define PANIC( exp ) {volatile TInt err_ = exp; \ + LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Panic( KUsbPanicModule, err_ );} + +#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); + +#define ASSERT_DEBUG( exp, code ) {if(!(exp)) PANIC(code)} + +#else // _DEBUG not defined +// =========================================================================== + +#define LOG( s ) +#define LOG1( s, v ) +#define LOG2( s, v1, v2 ) +#define LOG3( s, v1, v2, v3 ) +#define LOG_FUNC_ENTRY +#define LOG_FUNC_EXIT +#define LEAVE( exp ) User::Leave( exp ); +#define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); +#define PANIC( err ) // in non-debug builds PANICs are silent +#define LOG_FUNC +#define ASSERT_DEBUG( exp, code ) +inline void LogBuf(const TDesC8& /*aBuf8*/) + {} +// =========================================================================== +#endif // _DEBUG +// =========================================================================== +#endif // DEBUG_H + +// End of File diff -r e84fb4c9218b -r ef2686f7597e usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp --- a/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -22,15 +22,8 @@ #include #include //for CleanupResetAndDestroyPushL #include +#include "debug.h" -// Panic category only used in debug builds -#ifdef _DEBUG -_LIT( KObexCcPanicCategory, "OBEXCC" ); -#endif - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, "UsbObexCc"); -#endif /** * Panic codes for the USB OBEX Class Controller. @@ -43,6 +36,8 @@ EBadApiCallStart = 1, /** Stop() called while in an illegal state */ EBadApiCallStop = 2, + /** Request completes in uknown state */ + EUnkownState = 3 }; // --------------------------------------------------------------------------- @@ -52,7 +47,7 @@ CUsbObexClassController* CUsbObexClassController::NewL( MUsbClassControllerNotify& aOwner) { - LOG_STATIC_FUNC_ENTRY + LOG_FUNC CUsbObexClassController* self = new (ELeave) CUsbObexClassController(aOwner); CleanupStack::PushL(self); @@ -107,13 +102,13 @@ LOG_FUNC //Start() should never be called if started, starting or stopping (or in state EUsbServiceFatalError) - __ASSERT_DEBUG(iState == EUsbServiceIdle, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStart)); + ASSERT_DEBUG(iState == EUsbServiceIdle, EBadApiCallStart ); // Start OBEX SM iRequestStatus = &aStatus; iState = EUsbServiceStarting; aStatus = KRequestPending; - LOGTEXT(_L8("CUsbObexClassController::Start() calling ManageUSBService(ETrue)")); + LOG("CUsbObexClassController::Start() calling ManageUSBService(ETrue)"); iObexSM->ManageUSBServices(ETrue, iStatus); SetActive(); } @@ -127,10 +122,10 @@ { LOG_FUNC - LOGTEXT2(_L8("CUsbObexClassController::Stop iState = %d"), iState); + LOG1("CUsbObexClassController::Stop iState = %d", iState); //Stop() should never be called if stopping or starting (or in state EUsbServiceFatalError) - __ASSERT_DEBUG(iState == EUsbServiceStarted || iState == EUsbServiceIdle, _USB_PANIC(KObexCcPanicCategory, EBadApiCallStop)); + ASSERT_DEBUG(iState == EUsbServiceStarted || iState == EUsbServiceIdle, EBadApiCallStop ); //state may be idle after Cancel if ( iState == EUsbServiceIdle ) @@ -144,7 +139,7 @@ iRequestStatus = &aStatus; iState = EUsbServiceStopping; aStatus = KRequestPending; - LOGTEXT(_L8("CUsbObexClassController::Stop() calling ManageUSBService(EFalse)")); + LOG("CUsbObexClassController::Stop() calling ManageUSBService(EFalse)"); iObexSM->ManageUSBServices(EFalse, iStatus); SetActive(); } @@ -160,11 +155,11 @@ LOG_FUNC if (iStatus != KErrNone) { - LOGTEXT2(_L8("CUsbObexClassController::RunL() Error = %d"), iStatus.Int()); + LOG1("CUsbObexClassController::RunL() iStatus = %d", iStatus.Int()); User::RequestComplete(iRequestStatus, iStatus.Int()); return; } - LOGTEXT2(_L8("CUsbObexClassController::RunL() State is %d"), iState); + LOG1("CUsbObexClassController::RunL() State is %d", iState); switch (iState) { @@ -182,7 +177,8 @@ case EUsbServiceIdle: default: - LOGTEXT(_L8("CUsbObexClassController::RunL() Error or Unknown State")); + LOG("CUsbObexClassController::RunL() Unknown State"); + PANIC(EUnkownState); break; } } @@ -198,7 +194,7 @@ TRAPD(ret, DoGetDescriptorInfoL(aDescriptorInfo)); if(ret!=KErrNone) { - LOGTEXT2(_L8("CUsbObexClassController::GetDescriptorInfo leave with code: %d"), ret); + LOG1("CUsbObexClassController::GetDescriptorInfo leave with code: %d", ret); } } @@ -217,7 +213,7 @@ resolverParams.SetWildcardMatch(EFalse); REComSession::ListImplementationsL(KCSrcsInterfaceUid, resolverParams, implInfoArray); - LOGTEXT2(_L8("CUsbObexClassController::DoGetDescriptorInfoL Number of Interfaces is %d"), + LOG1("CUsbObexClassController::DoGetDescriptorInfoL Number of Interfaces is %d", implInfoArray.Count()); aDescriptorInfo.iNumInterfaces = (implInfoArray.Count())*KObexNumInterfaces; aDescriptorInfo.iLength = 0; @@ -242,7 +238,7 @@ break; default: - __ASSERT_DEBUG( EFalse, _USB_PANIC(KObexCcPanicCategory, EBadAsynchronousCall) ); + ASSERT_DEBUG( EFalse, EBadAsynchronousCall ); break; } @@ -259,14 +255,14 @@ TInt CUsbObexClassController::RunError(TInt aError) { LOG_FUNC - LOGTEXT2(_L8("CUsbObexClassController::RunError aError=%d"), aError); + LOG1("CUsbObexClassController::RunError aError=%d", aError); return KErrNone; } void CUsbObexClassController::MosmError(TInt aError) { LOG_FUNC - LOGTEXT2(_L8("CUsbObexClassController::MosmError aError=%d"), aError); + LOG1("CUsbObexClassController::MosmError aError=%d", aError); Owner().UccnError(aError); } diff -r e84fb4c9218b -r ef2686f7597e usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp --- a/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -18,18 +18,15 @@ #include "obexsmwatcher.h" #include #include -#include +#include "debug.h" -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, "UsbObexCcSMW"); -#endif /** * @since S60 V5.2 */ CObexSMWatcher* CObexSMWatcher::NewL(MObexSMObserver& aObserver) { - LOG_STATIC_FUNC_ENTRY + LOG_FUNC CObexSMWatcher* self = new (ELeave) CObexSMWatcher(aObserver); CleanupStack::PushL( self); @@ -79,7 +76,7 @@ { LOG_FUNC - LOGTEXT2(_L8(">>CObexSMWatcher::RunL [iStatus=%d]"), iStatus.Int()); + LOG1("iStatus=%d", iStatus.Int()); iObexSMPostInit.Subscribe( iStatus ); SetActive(); @@ -89,9 +86,8 @@ if (err == KErrNone && value != KErrNone) { iObserver.MosmError(value); - } - - LOGTEXT(_L8("<ImplementationUid()); CUsbCMHandler* handler = (reinterpret_cast(REComSession::CreateImplementationL (uid, _FOFF(CUsbCMHandler, iPrivateEComUID)))); - iHandlers.Append(handler); + iHandlers.AppendL(handler); } implementations.Close(); // cleanup diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbdevcon/src/cusbdevcon.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/group/usblocodplugin.mmp --- a/usbengines/usblocodplugin/group/usblocodplugin.mmp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usblocodplugin/group/usblocodplugin.mmp Thu Jul 22 16:44:03 2010 +0100 @@ -48,4 +48,3 @@ LIBRARY ECom.lib // ECOM framework API LIBRARY usbman.lib // RUSB API (USB Manager) -#include diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usblocodplugin/inc/debug.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Debug macros and declarations. +* +*/ + + +#ifndef DEBUG_H +#define DEBUG_H + +////////////////////////////////////////////////////////////////////////////// +// Here are parameters need to be modified. +// Component name +#define MODULE_NAME "USBLcdPlugin" +////////////////////////////////////////////////////////////////////////////// + + +// For handling unicode strings as L##MACRO is interpreted as LMACRO +#define WIDEN2( x ) L##x +#define WIDEN( x ) WIDEN2( x ) + +_LIT( KUsbPanicModule, ""WIDEN( MODULE_NAME ) ); + +#ifdef _DEBUG + +// Comment this line out if using real-time debugging +//#define LOG_TO_FILE +// =========================================================================== +#if defined ( LOG_TO_FILE ) +// =========================================================================== +// Add corresponding libabry in mmp file +// LIBRARY flogger.lib +// The log file is located at +// c:\logs\usb\MODULE_NAME.txt + +#include + +#define DESC( x ) TPtrC( ( const TText* ) ( x ) ) +#define DESC8( x ) TPtrC8( ( const TUint8* ) ( x ) ) +_LIT( KUsbLogDir, "USB" ); +_LIT( KUsbLogFile, ""WIDEN(MODULE_NAME)L".txt" ); + +// s: c string. +#define LOG(s) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ) ) + +// s: c string contains "%x" +// v: varaible corresponding to %x +#define LOG1(s, v) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v) +// s: c string contains "%x%y" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +#define LOG2(s, v1, v2) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2) + +// s: c string contains "%x%y%z" +// v1: varaible corresponding to %x +// v2: varaible corresponding to %y +// v3: varaible corresponding to %z +#define LOG3(s, v1, v2, v3) RFileLogger::WriteFormat( KUsbLogDir, \ + KUsbLogFile, EFileLoggingModeAppend, \ + DESC8( "["MODULE_NAME"] "##s ), v1, v2, v3 ) + +class TFuncLogger + { +public: + TFuncLogger(const TDesC8& aFuncName) + { + iFuncName.Set( aFuncName ); + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] >>%s" ), iFuncName.Ptr() ); + } + ~TFuncLogger() + { + RFileLogger::WriteFormat( KUsbLogDir, KUsbLogFile, + EFileLoggingModeAppend, + DESC8( "["MODULE_NAME"] <<%s" ), iFuncName.Ptr() ); + } +private: + TPtrC8 iFuncName; + }; +// =========================================================================== +#else //LOG_TO_FILE not defined +// =========================================================================== +#include + +// Paramters same as above. +#define LOG( str ) { RDebug::Printf( "["MODULE_NAME"] %s", str ); } + +#define LOG1( s, v ) { RDebug::Printf( "["MODULE_NAME"] "##s , v ); } + +#define LOG2( s, v1,v2 ) { RDebug::Printf( "["MODULE_NAME"] "##s , v1, v2 ); } + +#define LOG3( s, v1, v2, v3 ) { RDebug::Printf( "["MODULE_NAME"] "##s , \ + v1, v2, v3); } + +inline void LogBuf(const TDesC8& aBuf8) + { + LOG1("Buffer length = %d Buffer content:", aBuf8.Length()); + + TInt len(aBuf8.Length()); + for (TInt i(0); i < len; ++i) + RDebug::Print(_L("Buffer[%d] = 0x%x"), i, aBuf8[i]); + } + +class TFuncLogger + { +public: + TFuncLogger(const TPtrC8& aFuncName) : iFuncName( aFuncName ) + { + RDebug::Printf( "["MODULE_NAME"] >>%s", iFuncName.Ptr()); + } + ~TFuncLogger() + { + RDebug::Printf( "["MODULE_NAME"] <<%s", iFuncName.Ptr()); + } +private: + TPtrC8 iFuncName; + }; +#endif // LOG_TO_FILE + +#define LEAVE( exp ) {volatile TInt err_ = exp; \ + LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Leave( err_ );} + +#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \ + if(err__ < 0) LEAVE(err__);} + +#define PANIC( exp ) {volatile TInt err_ = exp; \ + LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Panic( KUsbPanicModule, err_ );} + +#define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); + +#define ASSERT_DEBUG( exp, code ) {if(!(exp)) PANIC(code)} + +#else // _DEBUG not defined +// =========================================================================== + +#define LOG( s ) +#define LOG1( s, v ) +#define LOG2( s, v1, v2 ) +#define LOG3( s, v1, v2, v3 ) +#define LOG_FUNC_ENTRY +#define LOG_FUNC_EXIT +#define LEAVE( exp ) User::Leave( exp ); +#define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); +#define PANIC( err ) // in non-debug builds PANICs are silent +#define LOG_FUNC +#define ASSERT_DEBUG( exp, code ) +inline void LogBuf(const TDesC8& /*aBuf8*/) + {} +// =========================================================================== +#endif // _DEBUG +// =========================================================================== +#endif // DEBUG_H + +// End of File diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/inc/usblcdactive.h --- a/usbengines/usblocodplugin/inc/usblcdactive.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usblocodplugin/inc/usblcdactive.h Thu Jul 22 16:44:03 2010 +0100 @@ -21,7 +21,7 @@ #define USBLCDACTIVE_H #include -#include + /** * Base Active Object class diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/inc/usblcdplugin.h --- a/usbengines/usblocodplugin/inc/usblcdplugin.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usblocodplugin/inc/usblcdplugin.h Thu Jul 22 16:44:03 2010 +0100 @@ -22,7 +22,7 @@ #include #include #include "usblcdactive.h" -#include + /** * Class of EComm interface implementation diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/src/usblcdactive.cpp --- a/usbengines/usblocodplugin/src/usblcdactive.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usblocodplugin/src/usblcdactive.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -20,10 +20,8 @@ #include "usblcdactive.h" #include #include +#include "debug.h" -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, "USBLcdPlugin"); -#endif // ======== MEMBER FUNCTIONS ======== @@ -33,7 +31,7 @@ // CUsbLcdActive* CUsbLcdActive::NewL(MLocodBearerPluginObserver& aObserver) { - LOG_STATIC_FUNC_ENTRY + LOG_FUNC CUsbLcdActive* self = new (ELeave) CUsbLcdActive(aObserver); CleanupStack::PushL(self); self->ConstructL(); @@ -74,13 +72,13 @@ if( iStatus != KErrNone ) { - LOGTEXT2(_L8("CUsbLcdActive::RunL() error = %d"),iStatus.Int()); + LOG1("CUsbLcdActive::RunL() iStatus = %d",iStatus.Int()); } else { TInt ret = iProperty.Get( value ); - LOGTEXT3(_L8("Personality: %d, ret: %d"), value, ret); + LOG2("Personality: %d, ret: %d", value, ret); iProperty.Subscribe(iStatus); SetActive(); if (ret == KErrNone) @@ -152,7 +150,7 @@ void CUsbLcdActive::HandleUsbPersonalityChange( TInt aNewPersonalityId ) { LOG_FUNC - LOGTEXT2( _L8( "aNewPersonalityId: %d"), aNewPersonalityId ); + LOG1( "aNewPersonalityId: %d", aNewPersonalityId ); TBool isPcSuiteActive( EFalse ); if ( ( aNewPersonalityId == KUsbPersonalityIdPCSuite ) || ( aNewPersonalityId == KUsbPersonalityIdPCSuiteMTP ) ) diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/src/usblcdplugin.cpp --- a/usbengines/usblocodplugin/src/usblcdplugin.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usblocodplugin/src/usblcdplugin.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -18,14 +18,12 @@ #include "usblcdplugin.h" +#include "debug.h" -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, "USBLcdPlugin"); -#endif CUsbLcdPlugin* CUsbLcdPlugin::NewL(TLocodBearerPluginParams& aParams) { - LOG_STATIC_FUNC_ENTRY + LOG_FUNC CUsbLcdPlugin* self = new (ELeave) CUsbLcdPlugin(aParams); CleanupStack::PushL(self); self->ConstructL(); diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/tsrc/USBLocodPluginTest/conf/USBLocodPluginTest.cfg diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest.mmp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_ats.ini diff -r e84fb4c9218b -r ef2686f7597e usbengines/usblocodplugin/tsrc/USBLocodPluginTest/init/USBLocodPluginTest_phone.ini diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/group/bld.inf diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/group/usbotgwatcher.mmp --- a/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbotgwatcher/group/usbotgwatcher.mmp Thu Jul 22 16:44:03 2010 +0100 @@ -68,6 +68,6 @@ LIBRARY usbdescriptors.lib LIBRARY usbdi_utils.lib #endif -LIBRARY aknnotify.lib +LIBRARY hbcore.lib DEBUGLIBRARY flogger.lib diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbbusactivityobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbhosteventnotificationobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbidpinobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbindicatornotifier.h --- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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" @@ -19,14 +19,23 @@ #define C_USBINDICATORNOTIFIER_H #include -#include // SAknSmallIndicatorParams -#include // SAknNotifierPackage -#include // EAknIndicatorUSBConnection #include "cusbnotifier.h" #include "cusbvbusobserver.h" #include "cusbotgwatcher.h" +class CHbIndicatorSymbian; + +_LIT(KUsbConnectingIndicator, "com.nokia.hb.indicator.usb.device.inprogress/1.0"); + +// indicator states +enum + { + EIndicatorStateOff, + EIndicatorStateOn, + EIndicatorConnecting + }; + /** * Class implements functionality of showing/blinking usb indicator * Class does not provide method to get response from the user @@ -98,7 +107,7 @@ * Set USB indicator On or Off * @param aState Indicator states */ - void SetIndicatorStateL(const TInt aState); + void SetIndicatorState(const TInt aState); /** * Show/hide static icon of the indicator. @@ -106,17 +115,17 @@ * form of the indicator. * @param aVisible ETrue - Show the indicator, EFalse - Hide the indicator */ - void ShowStaticL(TBool aVisible); + void ShowStatic(TBool aVisible); /** * Blinks indicator */ - void BlinkL(); + void Blink(); /** * Sets indicator accordingly */ - void SetIndicatorL(); + void SetIndicator(); private: // data @@ -127,11 +136,17 @@ */ CUsbOtgWatcher& iOtgWatcher; - /** - * Current indicator state - */ - TInt iIndicatorState; + /** + * Pointer to a class for using Orbit indicator framework + * Owned + */ + CHbIndicatorSymbian* iUsbConnectingIndicator; + + /** + * Whether we have activated the connecting indicator + */ + TBool iConnectingIndicatorOn; }; #endif // C_USBINDICATORNOTIFIER_H diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbmessagenotificationobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbnotenotifier.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbnotifier.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbnotifmanager.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbotgstateobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbotgwatcher.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbservicecontrol.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstate.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostabase.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostahost.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehosthandle.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbstatehostundefined.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbtimer.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbvbusobserver.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbwaitnotifier.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/cusbwarningnotifier.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/debug.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/definitions.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/errors.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/inc/panic.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbidpinobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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" @@ -15,9 +15,8 @@ * */ -#include -#include #include +#include #include "cusbindicatornotifier.h" #include "cusbstate.h" @@ -62,6 +61,8 @@ // Unsubscribe from otg watcher states change notifications TRAP_IGNORE(iOtgWatcher.UnsubscribeL(*this)); + + delete iUsbConnectingIndicator; } // --------------------------------------------------------------------------- @@ -74,10 +75,7 @@ aOtgWatcher) { LOG_FUNC - - //To be changed to EAknIndicatorStateAnimate and remove iIconBlinkingTimer - //when AVKON implements animation form of usb indicator. - iIndicatorState = EAknIndicatorStateOn; + } // --------------------------------------------------------------------------- @@ -88,6 +86,8 @@ { LOG_FUNC + iUsbConnectingIndicator = CHbIndicatorSymbian::NewL(); + // Subscribe for VBus change notifications iOtgWatcher.VBusObserver()->SubscribeL(*this); @@ -95,7 +95,7 @@ iOtgWatcher.SubscribeL(*this); // check here for condition to set usb indicator - SetIndicatorL(); + SetIndicator(); } // --------------------------------------------------------------------------- @@ -104,26 +104,26 @@ // form of the indicator. // --------------------------------------------------------------------------- // -void CUsbIndicatorNotifier::ShowStaticL(TBool aVisible) +void CUsbIndicatorNotifier::ShowStatic(TBool aVisible) { LOG_FUNC LOG1("aVisible = %d" , aVisible); - SetIndicatorStateL(aVisible - ? EAknIndicatorStateOn - : EAknIndicatorStateOff); + SetIndicatorState(aVisible + ? EIndicatorStateOn + : EIndicatorStateOff); } // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // -void CUsbIndicatorNotifier::BlinkL() +void CUsbIndicatorNotifier::Blink() { LOG_FUNC - SetIndicatorStateL( EAknIndicatorStateAnimate ); + SetIndicatorState( EIndicatorConnecting ); } // --------------------------------------------------------------------------- @@ -134,7 +134,7 @@ { LOG_FUNC - ShowStaticL(ETrue); + ShowStatic(ETrue); } // --------------------------------------------------------------------------- @@ -145,31 +145,55 @@ { LOG_FUNC - TRAP_IGNORE( ShowStaticL(EFalse) ); + ShowStatic(EFalse); } // --------------------------------------------------------------------------- // Set USB indicator On or Off // --------------------------------------------------------------------------- // -void CUsbIndicatorNotifier::SetIndicatorStateL(const TInt aState) +void CUsbIndicatorNotifier::SetIndicatorState(const TInt aState) { - LOG1( "USB indicator State = %d" , aState); - - CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC(TUid::Uid( - EAknIndicatorUSBConnection)); - indicator->SetIndicatorStateL(aState); - CleanupStack::PopAndDestroy(indicator); //indicator + + TBool success = ETrue; + + if ((aState == EIndicatorConnecting) && !iConnectingIndicatorOn) + { + success = iUsbConnectingIndicator->Activate(KUsbConnectingIndicator); + LOG1( "calling CHbIndicatorSymbian::Activate(), returned %d", success); + if (success) + { + iConnectingIndicatorOn = ETrue; + } + + } + + if ((aState != EIndicatorConnecting) && iConnectingIndicatorOn) + { + success = iUsbConnectingIndicator->Deactivate(KUsbConnectingIndicator); + if (success) + { + iConnectingIndicatorOn = EFalse; + } + LOG1( "calling CHbIndicatorSymbian::Deactivate(), returned %d", success); + } + + // if success became false loading the indicator failed, log the error + if (!success) + { + TInt error = iUsbConnectingIndicator->Error(); + LOG1( "indicator error is %d", error); + } } - + // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CUsbIndicatorNotifier::OtgWatcherStateChangedL(TUsbStateIds aState) { - SetIndicatorL(); + SetIndicator(); } // --------------------------------------------------------------------------- @@ -178,7 +202,7 @@ // void CUsbIndicatorNotifier::VBusDownL() { - SetIndicatorL(); + SetIndicator(); } // --------------------------------------------------------------------------- @@ -187,7 +211,7 @@ // void CUsbIndicatorNotifier::VBusUpL() { - SetIndicatorL(); + SetIndicator(); } // --------------------------------------------------------------------------- @@ -203,7 +227,7 @@ // // --------------------------------------------------------------------------- // -void CUsbIndicatorNotifier::SetIndicatorL() +void CUsbIndicatorNotifier::SetIndicator() { if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral) { @@ -216,18 +240,18 @@ if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) && (iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAHost)) { - ShowStaticL(ETrue); + ShowStatic(ETrue); } // if VBus up and we are not host -> Blink indicator else if ((iOtgWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) && (iOtgWatcher.CurrentHostState()->Id() != EUsbStateHostAHost)) { - BlinkL(); + Blink(); } else // Otherwise do not show indicator { - ShowStaticL(EFalse); + ShowStatic(EFalse); } } diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbnotenotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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; } diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbnotifier.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbnotifmanager.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbotgwatcher.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbservicecontrol.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstate.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostabase.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostahost.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbtimer.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbvbusobserver.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/src/cremotepersonalityhandler.cpp --- a/usbengines/usbremotepersonality/src/cremotepersonalityhandler.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbremotepersonality/src/cremotepersonalityhandler.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -361,7 +361,7 @@ p.iIndex = KStringDescriptorsBase - i; // iPersonalities is a dynamic array, no error handling is needed on Append - iPersonalities.Append(p); + iPersonalities.AppendL(p); FTRACE(FPrint( _L("[USBREMOTEPERSONALITY]\tCRemotePersonalityHandler::ReadPersonalities Personality id = %d Index = %d" ), iPersonalities[i].iId, iPersonalities[i].iIndex)); diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/src/csetpersonality.cpp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/USBRemotePersonalityTest.mmp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/USBRemotePersonalityTest_exe.mmp diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_ats.ini diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/init/USBRemotePersonalityTest_phone.ini diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/conf/usbwatcher.confml Binary file usbengines/usbwatcher/conf/usbwatcher.confml has changed diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/group/bld.inf --- a/usbengines/usbwatcher/group/bld.inf Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/group/bld.inf Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -33,19 +33,11 @@ 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) - -//Usbmanrsc.iby is included by Symbian usbman.iby. -// For l10n reaon it is not used but just to overwrite possible existing one -../rom/usbmanrsc.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbmanrsc.iby) ../conf/usbwatcher.confml MW_LAYER_CONFML(usbwatcher.confml) ../conf/usbwatcher_101F8801.crml MW_LAYER_CRML(usbwatcher_101F8801.crml) ../rom/mtp_symbian_temp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_symbian_temp.iby) - // End of file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/group/usbwatcherserver.mmp --- a/usbengines/usbwatcher/group/usbwatcherserver.mmp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/group/usbwatcherserver.mmp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -37,7 +37,7 @@ SOURCE cusbdevicelock.cpp SOURCE cusbdevconstarter.cpp SOURCE cusbglobalsystemstateobserver.cpp -SOURCE tusbindicatorhandler.cpp +SOURCE cusbindicatorhandler.cpp USERINCLUDE ../inc @@ -45,36 +45,7 @@ MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE ../../usbotgwatcher/inc SYSTEMINCLUDE /epoc32/include/usb - - -START RESOURCE usbman_pcsmtp.rss -TARGET usbman_pcsmtp -TARGETPATH /private/101fe1db -HEADER -LANGUAGE_IDS -END - -START RESOURCE usbman_pcs.rss -TARGET usbman_pcs -TARGETPATH /private/101fe1db -HEADER -LANGUAGE_IDS -END - -START RESOURCE usbman_pcspam.rss -TARGET usbman_pcspam -TARGETPATH /private/101fe1db -HEADER -LANGUAGE_IDS -END - -START RESOURCE usbman_pcsmtppam.rss -TARGET usbman_pcsmtppam -TARGETPATH /private/101fe1db -HEADER -LANGUAGE_IDS -END - +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore LIBRARY euser.lib // Kernel API LIBRARY usbman.lib // RUsb API (i.e. USB Manager's client API) @@ -84,5 +55,6 @@ LIBRARY centralrepository.lib // Central Repository (USB Personality API) LIBRARY featmgr.lib LIBRARY usbotgwatcher.lib //OTG +LIBRARY hbcore.lib DEBUGLIBRARY flogger.lib // File logging diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/inc/cusbindicatorhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbwatcher/inc/cusbindicatorhandler.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include + +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 diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/inc/cusbwatcher.h --- a/usbengines/usbwatcher/inc/cusbwatcher.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/inc/cusbwatcher.h Thu Jul 22 16:44:03 2010 +0100 @@ -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? diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/inc/cusbwatcher.inl diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/inc/debug.h diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/loc/usbman.loc --- a/usbengines/usbwatcher/loc/usbman.loc Mon Jun 21 22:40:15 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" diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/rom/mtp_symbian_temp.iby --- a/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Thu Jul 22 16:44:03 2010 +0100 @@ -22,7 +22,7 @@ // mtp_framework.iby #ifndef MTP_FRAMEWORK_IBY #define MTP_FRAMEWORK_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Framework cenrep file (temporary until this can be described in ConfML) //data=ZPRIVATE\10202be9\10282fcc.cre private\10202be9\10282fcc.cre // MTP Data Types Library @@ -53,31 +53,31 @@ data=EPOCROOT##epoc32\data\Z\private\102827a2\backup_registration.xml private\102827a2\backup_registration.xml //MTP device icon property file data=EPOCROOT##epoc32\data\Z\private\102827a2\mtpdevice.ico private\102827a2\mtpdevice.ico -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_FRAMEWORK_IBY // mtp_filedp.iby #ifndef MTP_FILEDP_IBY #define MTP_FILEDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtpfiledp.dll, mtpfiledp.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\102827B0.rsc resource\mtp\102827B0.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_FILEDP_IBY // mtp_usbsic.iby #ifndef MTP_USBSIC_IBY #define MTP_USBSIC_IBY -#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB) +#if defined(__MTP_PROTOCOL_SUPPORT) && defined(__USB) //MTP USB Data Types Library file=ABI_DIR\BUILD_DIR\mtpusbdatatypes.dll system\libs\mtpusbdatatypes.dll //MTP USB Still Image Class Controller ECOM_PLUGIN(mtpusbsiccc.dll, mtpusbsiccc.rsc) //MTP USB SIC transport plugin ECOM_PLUGIN(mtpusbsicimp.dll, mtpusbsicimp.rsc) -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_USBSIC_IBY // mtppictbridgedp.iby @@ -106,95 +106,94 @@ // mtp_statusservice.iby #ifndef MTP_STATUSSERVICE_IBY #define MTP_STATUSSERVICE_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtpstatusservice.dll, mtpstatusservice.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\2001a97f.rsc resource\mtp\2001a97f.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_STATUSSERVICE_IBY // mtp_metadataservice.iby #ifndef MTP_METADATAERVICE_IBY #define MTP_METADATASERVICE_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtpmetadataservice.dll, mtpmetadataservice.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\2001A9A3.rsc resource\mtp\2001A9A3.rsc -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_PROTOCOL_SUPPORT #endif // MTP_METADATASERVICE_IBY // mtp_wmpextndp.iby #ifndef MTP_WMPEXTNDP_IBY #define MTP_WMPEXTNDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtpwmpextndp.dll, mtpwmpextndp.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\1028716c.rsc resource\mtp\1028716c.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_WMPEXTNDP_IBY // devicedp #ifndef MTP_DEVICEDP_IBY #define MTP_DEVICEDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Device Data Provider ECOM_PLUGIN(mtpdevicedp.dll, mtpdevicedp.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\102827AF.rsc resource\mtp\102827AF.rsc -#endif //SYMBIAN_EXCLUDE_MTP +#endif //__MTP_PROTOCOL_SUPPORT #endif //MTP_DEVICEDP_IBY // pimproxy #ifndef MTP_PIMPROXY_IBY #define MTP_PIMPROXY_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP PIM proxy file=ABI_DIR\BUILD_DIR\mtppimproxy.dll system\libs\mtppimproxy.dll -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_PIMPROXY_IBY // calendardp #ifndef MTP_CALENDARDP_IBY #define MTP_CALENDARDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtpcalendardp.dll, mtpcalendardp.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\102871B8.rsc resource\mtp\102871B8.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_CALENDARDP_IBY // taskdp #ifndef MTP_TASKDP_IBY #define MTP_TASKDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Provider API ECOM_PLUGIN(mtptaskdp.dll, mtptaskdp.rsc) // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\10287013.rsc resource\mtp\10287013.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_TASKDP_IBY // bluetooth #ifndef MTP_BT_IBY #define MTP_BT_IBY -#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB) +#if defined(__MTP_PROTOCOL_SUPPORT) && defined(__USB) //MTP over Bluetooth Data Types Library file=ABI_DIR\BUILD_DIR\mtpbtdatatypes.dll system\libs\mtpbtdatatypes.dll //MTP over Bluetooth transport plugin ECOM_PLUGIN(mtpbt.dll, mtpbt.rsc) -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif// MTP_BT_IBY #ifndef MTP_CONTROLLER_IBY #define MTP_CONTROLLER_IBY -#if !defined (SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) //MTP Controller LOCOD service plugin ECOM_PLUGIN(mtpcontroller.dll, mtpcontroller.rsc) -#endif// SYMBIAN_EXCLUDE_MTP +#endif// __MTP_PROTOCOL_SUPPORT #endif// MTP_CONTROLLER_IBY #endif // MTPSYMBIANTEMP_IBY__ diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/rom/usbmanrsc.iby --- a/usbengines/usbwatcher/rom/usbmanrsc.iby Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: USB Manager resource IBY dummy -* -*/ - - -#ifndef __USBMANRSC_IBY__ -#define __USBMANRSC_IBY__ - -//This file replaces the Symbian usbmanrsc.iby. - -#endif // __USBMANRSC_IBY__ diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/rom/usbwatcher.iby diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/rom/usbwatcher_resources.iby --- a/usbengines/usbwatcher/rom/usbwatcher_resources.iby Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: personality resources for UsbMan. -* -*/ -#ifndef __USBWATCHERRESOURCES_IBY__ -#define __USBWATCHERRESOURCES_IBY__ - -#ifdef __USB - -#ifdef __MEDIA_TRANSFER_PROTOCOL - -#ifdef FF_USB_MODEM -data=DATAZ_\private\101fe1db\usbman_pcsmtppam.rsc \private\101fe1db\usbman.rsc -#else // !FF_USB_MODEM -data=DATAZ_\private\101fe1db\usbman_pcsmtp.rsc \private\101fe1db\usbman.rsc -#endif // FF_USB_MODEM - -#else // !__MEDIA_TRANSFER_PROTOCOL - -#ifdef FF_USB_MODEM -data=DATAZ_\private\101fe1db\usbman_pcspam.rsc \private\101fe1db\usbman.rsc -#else // !FF_USB_MODEM -data=DATAZ_\private\101fe1db\usbman_pcs.rsc \private\101fe1db\usbman.rsc -#endif // FF_USB_MODEM - -#endif // __MEDIA_TRANSFER_PROTOCOL - -#endif // __USB - -#endif // __USBWATCHERRESOURCES_IBY__ \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp --- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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, diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/cusbactivestate.cpp --- a/usbengines/usbwatcher/src/cusbactivestate.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/src/cusbactivestate.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/cusbindicatorhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbwatcher/src/cusbindicatorhandler.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include +#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 diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/cusbpersonalitynotifier.cpp --- a/usbengines/usbwatcher/src/cusbpersonalitynotifier.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/src/cusbpersonalitynotifier.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -198,7 +198,11 @@ return KErrGeneral; } - iNotifierClient.Append(ptr); + if( (ret = iNotifierClient.Append(ptr)) != KErrNone) + { + LOG( "append error"); + } + } return ret; @@ -231,7 +235,10 @@ return KErrGeneral; } - iNotifierClient.Append( ptr ); + if( ( ret = iNotifierClient.Append( ptr ) ) != KErrNone) + { + LOG( "append error"); + } } return ret; @@ -338,7 +345,11 @@ //Remove all but the 1st TNotifierClient* ptr = iNotifierClient[0]; iNotifierClient.Reset(); - iNotifierClient.Append( ptr ); + TInt ret = iNotifierClient.Append( ptr ); + if (ret != KErrNone) + { + LOG("append error"); + } } } diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/cusbwatcher.cpp --- a/usbengines/usbwatcher/src/cusbwatcher.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/tusbindicatorhandler.cpp --- a/usbengines/usbwatcher/src/tusbindicatorhandler.cpp Mon Jun 21 22:40:15 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 -#include // SAknNotifierPackage -#include //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 > 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 diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/usbman_pcs.rss --- a/usbengines/usbwatcher/src/usbman_pcs.rss Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for usbman configuration. -* -*/ - - -NAME USBM - -#include -#include -#include -#include -#include "usbman.rh" -#include "usbvariation.rh" - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PCSuite; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPCSuite; - class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A"; - description = qtn_usb_mode_ovisuite; - detailedDescription = qtn_usb_mode_msg_ovi_suite; - property = 0x00000000; - - - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MassStorage; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMS; - class_uids = "10204bbc"; - description = qtn_usb_mode_mass_storage; - detailedDescription = qtn_usb_mode_msg_mass_storage; - property = 0x00000000; - - - } - , - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_RNDIS; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdRNDIS; - class_uids = "20013d2f"; - description = qtn_usb_mode_rndis; - detailedDescription = qtn_usb_mode_msg_rndis; - property = 0x00000001; - } - }; - } - -// End of file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/usbman_pcsmtp.rss --- a/usbengines/usbwatcher/src/usbman_pcsmtp.rss Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for usbman configuration. -* -*/ - - -NAME USBM - -#include -#include -#include -#include -#include "usbman.rh" -#include "usbvariation.rh" - - - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PCSuiteMTP; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPCSuiteMTP; - class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A"; - description = qtn_usb_mode_ovisuite_mtp; - detailedDescription = qtn_usb_mode_msg_ovi_suite; - property = 0x00000000; - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MassStorage; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMS; - class_uids = "10204bbc"; - description = qtn_usb_mode_mass_storage; - detailedDescription = qtn_usb_mode_msg_mass_storage; - property = 0x00000000; - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MediaTransfer; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMTP; - class_uids = "102827B3"; - description = qtn_usb_mode_mtp; - detailedDescription = qtn_usb_mode_msg_mtp; - property = 0x00000000; - } - , - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_RNDIS; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdRNDIS; - class_uids = "20013d2f"; - description = qtn_usb_mode_rndis; - detailedDescription = qtn_usb_mode_msg_rndis; - property = 0x00000001; - } - }; - } - -// End o file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/usbman_pcsmtppam.rss --- a/usbengines/usbwatcher/src/usbman_pcsmtppam.rss Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for usbman configuration. -* -*/ - - -NAME USBM - -#include -#include -#include -#include -#include "usbman.rh" -#include "usbvariation.rh" - - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PCSuiteMTP; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPCSuiteMTP; - class_uids = "102827B3, 101fbf22, 101fbf24, 10281F2A, 101FB43A"; - description = qtn_usb_mode_ovisuite_mtp; - detailedDescription = qtn_usb_mode_msg_ovi_suite; - property = 0x00000000; - - - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MassStorage; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMS; - class_uids = "10204bbc"; - description = qtn_usb_mode_mass_storage; - detailedDescription = qtn_usb_mode_msg_mass_storage; - property = 0x00000000; - - - } -#ifdef __USB_PTP - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PTP; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPTP; - class_uids = "1020df81"; - description = qtn_usb_mode_ptp; - detailedDescription = qtn_usb_mode_msg_ptp; - property = 0x00000000; - - - } -#endif // __USB_PTP - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MediaTransfer; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMTP; - class_uids = "102827B3"; - description = qtn_usb_mode_mtp; - detailedDescription = qtn_usb_mode_msg_mtp; - property = 0x00000000; - - - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_ModemInstall; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdModemInst; - class_uids = "2000FDA9"; - description = qtn_usb_mode_quickconnect; - detailedDescription = qtn_usb_mode_msg_pam; - property = 0x00000000; - } - , - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_RNDIS; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdRNDIS; - class_uids = "20013d2f"; - description = qtn_usb_mode_rndis; - detailedDescription = qtn_usb_mode_msg_rndis; - property = 0x00000001; - } - }; - } - -// End o file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/usbman_pcspam.rss --- a/usbengines/usbwatcher/src/usbman_pcspam.rss Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for usbman configuration. -* -*/ - - -NAME USBM - -#include -#include -#include -#include -#include "usbman.rh" -#include "usbvariation.rh" - -RESOURCE BA_RSS_SIGNATURE - { - signature = 3; - } - -RESOURCE usb_configuration usb_config - { - } - - -RESOURCE PERSONALITY_ARRAY device_personalities - { - personalities = - { - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PCSuite; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPCSuite; - class_uids = "101fbf22, 101fbf24, 10281F2A, 101FB43A"; - description = qtn_usb_mode_ovisuite; - detailedDescription = qtn_usb_mode_msg_ovi_suite; - property = 0x00000000; - - - } - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_MassStorage; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdMS; - class_uids = "10204bbc"; - description = qtn_usb_mode_mass_storage; - detailedDescription = qtn_usb_mode_msg_mass_storage; - property = 0x00000000; - - - } -#ifdef __USB_PTP - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_PTP; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdPTP; - class_uids = "1020df81"; - description = qtn_usb_mode_ptp; - detailedDescription = qtn_usb_mode_msg_ptp; - property = 0x00000000; - - - } -#endif // __USB_PTP - , - PERSONALITY - { - bDeviceClass = 0x00; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_ModemInstall; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdModemInst; - class_uids = "2000FDA9"; - description = qtn_usb_mode_quickconnect; - detailedDescription = qtn_usb_mode_msg_pam; - property = 0x00000000; - } - , - PERSONALITY - { - bDeviceClass = 0x02; - bDeviceSubClass = 0x00; - protocol = 0x00; - numConfigurations = 0x01; - vendorId = per_vendorId; - productId = per_productId_RNDIS; - bcdDevice = per_bcdDevice; - manufacturer = per_manufacturer; - product = per_product; - id = KUsbPersonalityIdRNDIS; - class_uids = "20013d2f"; - description = qtn_usb_mode_rndis; - detailedDescription = qtn_usb_mode_msg_rndis; - property = 0x00000001; - } - }; - } - -// End of file diff -r e84fb4c9218b -r ef2686f7597e usbengines/usbwatcher/src/usbwatcher.cpp diff -r e84fb4c9218b -r ef2686f7597e usbservices_plat/usb_notifier_api/inc/usbuinotif.h diff -r e84fb4c9218b -r ef2686f7597e usbservices_plat/usb_secondary_display_api/group/bld.inf diff -r e84fb4c9218b -r ef2686f7597e usbuis/group/bld.inf --- a/usbuis/group/bld.inf Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/group/bld.inf Thu Jul 22 16:44:03 2010 +0100 @@ -15,8 +15,9 @@ * */ +#include "../imageprintuiprovider/group/bld.inf" +#include "../imageprintui/group/bld.inf" -#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 +PRJ_EXPORTS +../inc/msmmclient.h MW_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmclient.h) +../inc/msmmindicatorclient.h MW_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmindicatorclient.h) diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/inc/capabilitymanager.h --- a/usbuis/imageprintui/inc/capabilitymanager.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/imageprintui/inc/capabilitymanager.h Thu Jul 22 16:44:03 2010 +0100 @@ -93,7 +93,7 @@ * Return certain type list of Capabilities * @param aCapability the Capabilities type requested */ - RArray& GetCapabilities(TInt aCapability); + RArray& GetCapabilitiesL(TInt aCapability); /** * Stores value choosed by user diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/inc/imageprintuiappui.h diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/inc/imageprintuidocument.h diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/loc/imageprintui.loc diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/capabilitymanager.cpp --- a/usbuis/imageprintui/src/capabilitymanager.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/imageprintui/src/capabilitymanager.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -277,7 +277,7 @@ // // --------------------------------------------------------------------------- // -RArray& CCapabilityManager::GetCapabilities(TInt aCapabilities) +RArray& CCapabilityManager::GetCapabilitiesL(TInt aCapabilities) { FLOG(_L("[IMAGEPRINTUI]<<NotifyError(); iCurrentQualities.Reset(); - iCurrentQualities.Append(EDpsPrintQualityDefault); + iCurrentQualities.AppendL(EDpsPrintQualityDefault); AskLayoutL(); } @@ -600,7 +608,7 @@ // if fails add default value; iAppUi->NotifyError(); iCurrentPaperSizes.Reset(); - iCurrentPaperSizes.Append(EDpsPaperSizeDefault); + iCurrentPaperSizes.AppendL(EDpsPaperSizeDefault); AskQualityL(); } @@ -624,7 +632,7 @@ //if fails add default value iAppUi->NotifyError(); iCurrentLayouts.Reset(); - iCurrentLayouts.Append(EDpsLayoutDefault); + iCurrentLayouts.AppendL(EDpsLayoutDefault); // complete even if not succesfull, UI must activate iAppUi->CapabilitiesReady(); } @@ -666,19 +674,19 @@ for (TInt i = 0; i < qualityCount; i++) { - iPhoneSuppQuality.Append(reader.ReadUint16()); + iPhoneSuppQuality.AppendL(reader.ReadUint16()); } FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, quality readed")); for (TInt i = 0; i < papersizeCount; i++) { - iPhoneSuppPaperSize.Append(reader.ReadUint16()); + iPhoneSuppPaperSize.AppendL(reader.ReadUint16()); } FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, papersize readed")); for (TInt i = 0; i < layoutCount; i++) { - iPhoneSuppLayout.Append(reader.ReadUint16()); + iPhoneSuppLayout.AppendL(reader.ReadUint16()); } FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, layout readed")); diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/emptycontainer.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/emptyview.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/imageprintuiappui.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/notes.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/requestmanager.cpp --- a/usbuis/imageprintui/src/requestmanager.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/imageprintui/src/requestmanager.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -225,15 +225,15 @@ req_quality.iElement = EDpsArgQuality; req_quality.iContent = quality; - iStart.iReqParam.iJobConfig.Append(req_quality); + iStart.iReqParam.iJobConfig.AppendL(req_quality); req_papersize.iElement = EDpsArgPaperSize; req_papersize.iContent = paperSize; - iStart.iReqParam.iJobConfig.Append(req_papersize); + iStart.iReqParam.iJobConfig.AppendL(req_papersize); req_layout.iElement = EDpsArgLayout; req_layout.iContent = layout; - iStart.iReqParam.iJobConfig.Append(req_layout); + iStart.iReqParam.iJobConfig.AppendL(req_layout); // retrieve images @@ -256,7 +256,7 @@ { FLOG(_L("[IMAGEPRINTUI]<<< CRequestManager, Start job, file exist")); helpTDpsPrintInfo[i].iFile.Copy(iImageArrayFlat->operator[](i)); - iStart.iReqParam.iPrintInfo.Append(helpTDpsPrintInfo[i]); + iStart.iReqParam.iPrintInfo.AppendL(helpTDpsPrintInfo[i]); } } diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/settingscontainer.cpp --- a/usbuis/imageprintui/src/settingscontainer.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/imageprintui/src/settingscontainer.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -36,7 +36,7 @@ #include "settingsitems.h" #include "settingstables.h" #ifdef __SERIES60_HELP -#include // Help id +//#include // 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")); +*/ } diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/settingsitems.cpp --- a/usbuis/imageprintui/src/settingsitems.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/imageprintui/src/settingsitems.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -245,7 +245,8 @@ { HBufC* item; FLOG(_L("[IMAGEPRINTUI]\t CSettingsItems::HandleEvent START")); - RArray capabilityArray = iCapabilityManager->GetCapabilities(aCapability); + RArray capabilityArray = iCapabilityManager->GetCapabilitiesL(aCapability); + TInt currentItemIndex(0); CDesCArrayFlat* items = new ( ELeave ) CDesCArrayFlat( KDefaultArrayValue ); CleanupStack::PushL(items); diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintui/src/settingsview.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintuiprovider/data/1020E471.rss diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintuiprovider/inc/caiwprintingprovider.h diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintuiprovider/src/caiwimageprintIf.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintuiprovider/src/caiwprintingprovider.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/imageprintuiprovider/src/dllmain.cpp diff -r e84fb4c9218b -r ef2686f7597e usbuis/inc/msmmclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/inc/msmmclient.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** + @file + @internalComponent +*/ + +#ifndef MSMMCLIENT_H +#define MSMMCLIENT_H + +#include +#include "msmm_pub_def.h" + +/** +RMsmmSession is the interface for MFDC to use the MSMM. +*/ +NONSHARABLE_CLASS(RMsmmSession) : public RSessionBase +{ +public: + // RMsmmSession Implementaion + IMPORT_C TInt Connect(); + IMPORT_C TInt Disconnect(); + IMPORT_C TVersion Version() const; + + /** Add USB Mass Storage Function to the MSMM synchronously. + @param aDevice Usb Mass Storage device description. + @param aInterfaceNumber The Usb Mass Storage interface number. + @param aInterfaceToken The Usb Mass Storage interface token. + @return Error code of IPC. + */ + IMPORT_C TInt AddFunction(const TUSBMSDeviceDescription& aDevice, + TUint8 aInterfaceNumber, + TUint32 aInterfaceToken); + + /** Remove USB Mass Storage device from the MSMM synchronously. + @param aDevice Usb Mass Storage device description. + @return Error code of IPC. + */ + IMPORT_C TInt RemoveDevice(TUint aDevice); + + // Support for server-side out-of-memory testing. In release, these just + // return KErrNone. + IMPORT_C TInt __DbgFailNext(TInt aCount); + IMPORT_C TInt __DbgAlloc(); + + +private: + // RMsmmSession data member + TPckgBuf iDevicePkg; + TUint8 iInterfaceNumber; + TUint32 iInterfaceToken; +}; + +#endif // MSMMCLIENT_H + +// End of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/inc/msmmindicatorclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/inc/msmmindicatorclient.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** + @file + @internalComponent +*/ + +#ifndef MSMMINDICATORCLIENT_H +#define MSMMINDICATORCLIENT_H + +#include + +/** +RHostMassStorage is the interface for Mass Storage Indicator UI to use the MSMM. +*/ +NONSHARABLE_CLASS(RHostMassStorage) : public RSessionBase +{ +public: + // RHostMassStorage Implementation API to add a session to the running MSMM server + IMPORT_C TInt Connect(); + IMPORT_C TInt Disconnect(); + IMPORT_C TVersion Version() const; + + /** Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status + The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase + @return Error code of IPC. + */ + IMPORT_C TInt EjectUsbDrives(); + +}; + +#endif // MSMMINDICATORCLIENT_H + +// End of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbaddressedindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbaddressedindicator.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 + +/** + * 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 */ + + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbdebug.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef USBDEBUG_H +#define USBDEBUG_H + +#include + +#if defined(_DEBUG) + inline QDebug myDebug() + { + return qDebug(); + } +#else + inline QNoDebug myDebug() + { + return QNoDebug(); + } +#endif + + +#endif // USBDEBUG_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbdisconnectingindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbdisconnectingindicator.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef USBDISCONNECTINGINDICATOR_H +#define USBDISCONNECTINGINDICATOR_H + +#include +#include "usbindicatorplugin.h" + +/** + * USB indicator class. + * Handles client request and showing the indications. + */ +class USBDisconnectingIndicator : public HbIndicatorInterface +{ + friend class TestUsbIndicatorPlugin; + +public: + /** + * Constructor + */ + USBDisconnectingIndicator(const QString &indicatorType); + + /** + * Destructor + */ + ~USBDisconnectingIndicator(); + + /** + * @see HbIndicatorInterface + */ + QVariant indicatorData(int role) const; + + +protected: + /** + * @see HbIndicatorInterface + */ + bool handleClientRequest(RequestType type, const QVariant ¶meter); + + +}; + +#endif /* USBDISCONNECTINGINDICATOR_H */ + + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbindicator.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 + +#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*/ + + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbindicatorplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbindicatorplugin.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: USB Indicator Plugin Class +* +*/ + +#ifndef USBINDICATORPLUGIN_H +#define USBINDICATORPLUGIN_H + + +#include +#include +#include + +const QString ConnectedIndicator = ("com.nokia.hb.indicator.usb.device.connected/1.0"); +const QString AddressedIndicator = ("com.nokia.hb.indicator.usb.device.inprogress/1.0" ); +const QString MassStorageIndicator = ("com.nokia.hb.indicator.usb.host.massstorage/1.0" ); +const QString UsbDisconnectingIndicator = ("com.nokia.hb.indicator.usb.host.disconnecting/1.0" ); + +_LIT(KUSBExe, "USBSettingsApp.exe"); +const TInt KUSBUIUid = 0x2002E70C; + +/*! + USB indicator plugin class. + Main class of USB indicator plugin. + */ +class UsbIndicatorPlugin : public QObject, public HbIndicatorPluginInterface +{ + Q_OBJECT + Q_INTERFACES(HbIndicatorPluginInterface) + +public: + /*! + Constructor + */ + UsbIndicatorPlugin(); + + /*! + Destructor + */ + ~UsbIndicatorPlugin(); + + /*! + @see HbIndicatorPluginInterface + */ + QStringList indicatorTypes() const; + + /*! + @see HbIndicatorPluginInterface + */ + inline bool accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const; + /*! + @see HbIndicatorPluginInterface + */ + HbIndicatorInterface* createIndicator(const QString &indicatorType); + + /*! + @see HbIndicatorPluginInterface + */ + inline int error() const; + +private: + Q_DISABLE_COPY(UsbIndicatorPlugin) + + /*! + Error value + */ + int mError; + + /*! + Indicator types + supported indicator types. + */ + QStringList mIndicatorTypes; + + bool mTranslatorLoaded; + + QTranslator mTranslator; +}; + +// ---------------------------------------------------------------------------- +// UsbIndicatorPlugin::accessAllowed +// ---------------------------------------------------------------------------- +bool UsbIndicatorPlugin::accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const +{ + Q_UNUSED(indicatorType) + Q_UNUSED(securityInfo) + + // This plugin doesn't perform operations that may compromise security. + // All clients are allowed to use. + return true; +} + +// ---------------------------------------------------------------------------- +// UsbIndicatorPlugin::error +// ---------------------------------------------------------------------------- +inline int UsbIndicatorPlugin::error() const +{ + return mError; +} + + +#endif /* USBIndicatorPlugin_H */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/inc/usbmassstorageindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/inc/usbmassstorageindicator.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: USB Mass Storage Indicator Class +* +*/ + +#ifndef USBMASSSTORAGEINDICATOR_H +#define USBMASSSTORAGEINDICATOR_H + +#include +#include "usbindicatorplugin.h" + +/** + * USB mass storage indicator class. + * Handles client request and showing the indications. + */ +class UsbMassStorageIndicator : public HbIndicatorInterface +{ + friend class TestUsbIndicatorPlugin; + +public: + /** + * Constructor + */ + UsbMassStorageIndicator(const QString &indicatorType); + + /** + * Destructor + */ + ~UsbMassStorageIndicator(); + + /** + * @see HbIndicatorInterface + */ + bool handleInteraction(InteractionType type); + + /** + * @see HbIndicatorInterface + */ + QVariant indicatorData(int role) const; + +protected: + /** + * @see HbIndicatorInterface + */ + bool handleClientRequest(RequestType type, const QVariant ¶meter); + +private: + + QString mSecDisplayName; + + bool mEjectStarted; +}; + +#endif /* USBMASSSTORAGEINDICATOR_H */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/rom/usbindicatorplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/rom/usbindicatorplugin.iby Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/rom/usbindicatorpluginresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/rom/usbindicatorpluginresources.iby Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef USBINDICATORPLUGINRESOURCES_IBY +#define USBINDICATORPLUGINRESOURCES_IBY +// Use standard macros +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\usbindimenu.qm QT_TRANSLATIONS_DIR\usbindimenu.qm + +#endif \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/src/usbaddressedindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/src/usbaddressedindicator.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include "usbindicatorplugin.h" +#include "usbindicator.h" +#include "usbdebug.h" + + +/*! + UsbAddressedIndicator::UsbAddressedIndicator +*/ +UsbAddressedIndicator::UsbAddressedIndicator(const QString &indicatorType) : +HbIndicatorInterface(indicatorType, + HbIndicatorInterface::ProgressCategory, + InteractionActivated) +{ +} + +/*! + UsbAddressedIndicator::~UsbAddressedIndicator +*/ +UsbAddressedIndicator::~UsbAddressedIndicator() +{ +} + + +/*! + UsbAddressedIndicator::handleInteraction +*/ +bool UsbAddressedIndicator::handleInteraction(InteractionType type) +{ + myDebug() << ">>> UsbAddressedIndicator::handleInteraction"; + bool handled = false; + TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00), + TUid::Uid(KUSBUIUid)); + if (type == InteractionActivated) { + RProcess usbUiProcess; + TInt result = usbUiProcess.Create(KUSBExe(), KNullDesC, uidtype); + if (result == KErrNone) { + usbUiProcess.Resume(); + } + usbUiProcess.Close(); + handled = true; + } + myDebug() << "<<< UsbAddressedIndicator::handleInteraction"; + return handled; +} + +/*! + UsbAddressedIndicator::indicatorData + returns the data and icon that needs to be displayed in the universal pop up and indicator menu +*/ +QVariant UsbAddressedIndicator::indicatorData(int role) const +{ + myDebug() << ">>> UsbAddressedIndicator::indicatorData"; + switch (role) { + case PrimaryTextRole: + { + QString text = QString(hbTrId("txt_usb_dblist_usb_connecting")); + return text; + } + case DecorationNameRole: + { + QString iconName(KUsbIconFile); + return iconName; + } + default: + return QVariant(); + } +} + +/*! + UsbAddressedIndicator::handleClientRequest + handles client's activate and deactivate request +*/ +bool UsbAddressedIndicator::handleClientRequest( RequestType type, + const QVariant ¶meter) +{ + myDebug() << ">>> UsbAddressedIndicator::handleClientRequest"; + switch (type) { + case RequestActivate: + emit dataChanged(); + break; + default: + emit deactivate(); + break; + } + myDebug() << "<<< UsbAddressedIndicator::handleClientRequest"; + //request always handled + return true; +} + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/src/usbdisconnectingindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/src/usbdisconnectingindicator.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 "usbdisconnectingindicator.h" +#include +#include "usbindicatorplugin.h" +#include "usbindicator.h" + + +/*! + UsbDisconnectingIndicator::UsbDisconnectingIndicator +*/ +USBDisconnectingIndicator::USBDisconnectingIndicator(const QString &indicatorType) : +HbIndicatorInterface(indicatorType, + HbIndicatorInterface::ProgressCategory, + NoInteraction) +{ +} + +/*! + USBDisconnectingIndicator::~USBDisconnectingIndicator +*/ +USBDisconnectingIndicator::~USBDisconnectingIndicator() +{ +} + + +/*! + USBDisconnectingIndicator::indicatorData + returns the data and icon that needs to be displayed in the universal pop up and indicator menu +*/ +QVariant USBDisconnectingIndicator::indicatorData(int role) const +{ + switch(role) { + case PrimaryTextRole: + { + QString text = QString(hbTrId("txt_usb_dblist_usb_disconnecting")); + return text; + } + case DecorationNameRole: + { + QString iconName(KUsbIconFile); + return iconName; + } + default: + return QVariant(); + } +} + +/*! + UsbDisconnectingIndicator::handleClientRequest + handles client's activate and deactivate request +*/ +bool USBDisconnectingIndicator::handleClientRequest( RequestType type, + const QVariant ¶meter) +{ + switch (type) { + case RequestActivate: + emit dataChanged(); + break; + default: + emit deactivate(); + break; + } + //request always handled + return true; +} + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/src/usbindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/src/usbindicator.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,117 @@ +/* +* 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 +#include +#include +#include "usbdebug.h" + +const QString TextIdPrefix = ("txt_usb_dblist_usb_connected_val_"); +/*! + USBIndicator::USBIndicator +*/ +USBIndicator::USBIndicator(const QString &indicatorType) : +HbIndicatorInterface(indicatorType, + HbIndicatorInterface::SettingCategory, + InteractionActivated) +{ +} + +/*! + USBIndicator::~USBIndicator +*/ +USBIndicator::~USBIndicator() +{ +} + + +/*! + USBIndicator::handleInteraction +*/ +bool USBIndicator::handleInteraction(InteractionType type) +{ + myDebug() << ">>> USBIndicator::handleInteraction"; + bool handled = false; + TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00), + TUid::Uid(KUSBUIUid)); + if (type == InteractionActivated) { + RProcess usbUiProcess; + TInt result = usbUiProcess.Create(KUSBExe(), KNullDesC, uidtype); + if (result == KErrNone) { + usbUiProcess.Resume(); + } + usbUiProcess.Close(); + handled = true; + } + myDebug() << "<<< USBIndicator::handleInteraction"; + return handled; +} + +/*! + USBIndicator::indicatorData + returns the data and icon that needs to be displayed in the universal pop up and indicator menu +*/ +QVariant USBIndicator::indicatorData(int role) const +{ + myDebug() << ">>> USBIndicator::indicatorData, role is " << role; + switch(role) { + case PrimaryTextRole: + { + QString text = QString(hbTrId("txt_usb_dblist_usb_connected")); + return text; + } + case SecondaryTextRole: + { + return mSecDisplayName; + } + case DecorationNameRole: + { + QString iconName(KUsbIconFile); + return iconName; + } + default: + return QVariant(); + } +} + +/*! + USBIndicator::handleClientRequest + handles client's activate and deactivate request +*/ +bool USBIndicator::handleClientRequest( RequestType type, + const QVariant ¶meter) +{ + myDebug() << ">>> USBIndicator::handleClientRequest"; + switch (type) { + case RequestActivate: + { + QString friendlyName = parameter.toString(); + friendlyName.replace( QChar(' '), QChar('_') ); + QString textId = TextIdPrefix + friendlyName; + mSecDisplayName = hbTrId(textId.toAscii()); + emit dataChanged(); + } + break; + default: + mSecDisplayName.clear(); + emit deactivate(); + break; + } + //request always handled + myDebug() << "<<< USBIndicator::handleClientRequest"; + return true; +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/src/usbindicatorplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/src/usbindicatorplugin.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "usbindicatorplugin.h" +#include +#include +#include +#include "usbindicator.h" +#include "usbaddressedindicator.h" +#include "usbmassstorageindicator.h" +#include "usbdisconnectingindicator.h" +#include "usbdebug.h" + +Q_EXPORT_PLUGIN(UsbIndicatorPlugin) + +/*! + UsbIndicatorPlugin::UsbIndicatorPlugin +*/ +UsbIndicatorPlugin::UsbIndicatorPlugin() : mError(0), mTranslatorLoaded(0) +{ +} + +/*! + UsbIndicatorPlugin::~UsbIndicatorPlugin +*/ +UsbIndicatorPlugin::~UsbIndicatorPlugin() +{ + if (mTranslatorLoaded) { + QApplication::removeTranslator(&mTranslator); + } +} + +/*! + UsbIndicatorPlugin::indicatorTypes + Return notification types this plugin implements +*/ +QStringList UsbIndicatorPlugin::indicatorTypes() const +{ + myDebug() << ">>> UsbIndicatorPlugin::indicatorTypes"; + QStringList types; + types << ConnectedIndicator; + types << AddressedIndicator; + types << MassStorageIndicator; + types << UsbDisconnectingIndicator; + return types; +} + + + +/*! + UsbIndicatorPlugin::createIndicator + Creates and returns the HbIndicatorInterface +*/ +HbIndicatorInterface* UsbIndicatorPlugin::createIndicator(const QString &indicatorType) +{ + myDebug() << ">>> UsbIndicatorPlugin::createIndicator"; + if (!mTranslatorLoaded) { + // add translator for application library + QString locale = QLocale::system().name(); + QString filename = QString("usbindimenu_") + locale; + bool success = mTranslator.load(filename, QString("z:/resource/qt/translations")); + QApplication::installTranslator(&mTranslator); + mTranslatorLoaded = true; + } + + HbIndicatorInterface *indicator = NULL; + if (indicatorType == ConnectedIndicator) { + indicator = new USBIndicator(indicatorType); + } + else if (indicatorType == AddressedIndicator) { + indicator = new UsbAddressedIndicator(indicatorType); + } + else if (indicatorType == MassStorageIndicator) { + indicator = new UsbMassStorageIndicator(indicatorType); + } + else if (indicatorType == UsbDisconnectingIndicator) { + indicator = new USBDisconnectingIndicator(indicatorType); + } + myDebug() << "<<< UsbIndicatorPlugin::createIndicator"; + return indicator; +} + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/src/usbmassstorageindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/src/usbmassstorageindicator.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: USB Mass Storage indicator implementation +* +*/ + +#include "usbmassstorageindicator.h" +#include +#include +#include +#include +#include "usbdebug.h" + +// icon name for mass storage +const QString KUsbIconFile("qtg_large_usb_memory"); + +/*! + Constructor + @param indicatorType The indicator type name +*/ +UsbMassStorageIndicator::UsbMassStorageIndicator(const QString &indicatorType) : +HbIndicatorInterface(indicatorType, + HbIndicatorInterface::SettingCategory, + InteractionActivated), + mEjectStarted(false) +{ +} + +/*! + Destructor +*/ +UsbMassStorageIndicator::~UsbMassStorageIndicator() +{ + myDebug() << ">>> UsbMassStorageIndicator::~UsbMassStorageIndicator"; +} + + +/*! + Handle user interaction + Request eject for all USB drives. +*/ +bool UsbMassStorageIndicator::handleInteraction(InteractionType type) +{ + myDebug() << ">>> UsbMassStorageIndicator::handleInteraction"; + bool handled = false; + if (type == InteractionActivated) { + if (!mEjectStarted) { + mEjectStarted = true; + // dismount all drives without waiting for result + RHostMassStorage hostMassStorage; + myDebug() << " UsbMassStorageIndicator::handleInteraction hostMassStorage connecting"; + TInt err = hostMassStorage.Connect(); + myDebug() << " UsbMassStorageIndicator::handleInteraction hostMassStorage connected"; + if (err == KErrNone) { + hostMassStorage.EjectUsbDrives(); + myDebug() << ">>> UsbMassStorageIndicator::handleInteraction EjectUsbDrives called"; + if (err != KErrNone) { + myDebug() << " UsbMassStorageIndicator::handleInteraction " + <<"RHostMassStorage EjectUsbDrives fail " << err; + } + } + else { + myDebug() << " UsbMassStorageIndicator::handleInteraction " + <<"RHostMassStorage Connect fail " << err; + } + hostMassStorage.Disconnect(); + myDebug() << ">>> UsbMassStorageIndicator::handleInteraction disconnected"; + hostMassStorage.Close(); + myDebug() << ">>> UsbMassStorageIndicator::handleInteraction closed"; + } + handled = true; + } + myDebug() << "<<< UsbMassStorageIndicator::handleInteraction"; + return handled; +} + +/*! + Return the data and icon that needs to be displayed in the universal indicator menu +*/ +QVariant UsbMassStorageIndicator::indicatorData(int role) const +{ + myDebug() << ">>> UsbMassStorageIndicator::indicatorData"; + switch (role) { + case PrimaryTextRole: + return QString(hbTrId("txt_usb_dblist_usb_connected")); + case SecondaryTextRole: + return QString(hbTrId("txt_usb_dpinfo_click_to_eject"));; + case DecorationNameRole: + return KUsbIconFile; + default: + return QVariant(); //empty variant + } +} + +/*! + USBIndicator::handleClientRequest + handles client's activate and deactivate request +*/ +bool UsbMassStorageIndicator::handleClientRequest( RequestType type, + const QVariant ¶meter) +{ + myDebug() << ">>> UsbMassStorageIndicator::handleClientRequest"; + Q_UNUSED(parameter); + if (type == RequestDeactivate) { + myDebug() << " UsbMassStorageIndicator::handleClientRequest deactivate"; + mEjectStarted = false; + emit deactivate(); + } + myDebug() << "<<< UsbMassStorageIndicator::handleClientRequest"; + return true; +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbindicatorplugin/usbindicatorplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbindicatorplugin/usbindicatorplugin.pro Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,34 @@ +TEMPLATE = lib +TARGET = usbindicatorplugin +CONFIG += plugin +CONFIG += hb +HEADERS += inc/usbindicatorplugin.h \ + inc/usbindicator.h \ + inc/usbaddressedindicator.h \ + inc/usbmassstorageindicator.h \ + inc/usbdisconnectingindicator.h + +SOURCES += src/usbindicatorplugin.cpp \ + src/usbindicator.cpp \ + src/usbaddressedindicator.cpp \ + src/usbmassstorageindicator.cpp \ + src/usbdisconnectingindicator.cpp + +LIBS += -lmsmmindicatorsession + +SYMBIAN_PLATFORMS = ARMV5 + +TRANSLATIONS = usbindimenu.ts + +symbian { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x2002E70D + pluginstub.sources = usbindicatorplugin.dll + pluginstub.path = /resource/plugins/indicators + DEPLOYMENT += pluginstub +} +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ + "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)" diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/USBSettingsApp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/USBSettingsApp.pro Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,28 @@ +TEMPLATE = app +TARGET = USBSettingsApp +QT += core \ + gui +CONFIG += no_icon +HEADERS += inc/usbsettingsapp.h \ + inc/usbuimodelactive.h \ + inc/usbuisettingmodel.h +SOURCES += src/usbuimodelactive.cpp \ + src/usbuisettingmodel.cpp \ + src/main.cpp \ + src/usbsettingsapp.cpp +LIBS += -lusbwatcher +LIBS += -lxqsettingsmanager +LIBS += -lusbman +FORMS += src/USBSettingsApp.ui +CONFIG += hb +TRANSLATIONS = usbview.ts +RESOURCES += src/usbsettinglayout.qrc \ + src/usbsettingsapp.qrc +symbian: { + TARGET.UID3 = 0x2002E70C + TARGET.CAPABILITY = LocalServices WriteDeviceData +} + +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ + "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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/inc/ui_USBSettingsApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/inc/ui_USBSettingsApp.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/inc/usbdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/inc/usbdebug.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef USBDEBUG_H +#define USBDEBUG_H + +#include + +#if defined(_DEBUG) + inline QDebug myDebug() + { + return qDebug(); + } +#else + inline QNoDebug myDebug() + { + return QNoDebug(); + } +#endif + + +#endif // MYDEBUG_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/inc/usbsettingsapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/inc/usbsettingsapp.h Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef USBSETTINGSAPP_H +#define USBSETTINGSAPP_H + +#include +#include + +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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/inc/usbuimodelactive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/inc/usbuimodelactive.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include + +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 */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/inc/usbuisettingmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/inc/usbuisettingmodel.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include +#include + +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 mPersonalityIds; + //owned by the class + // modelactive is used for the interaction with the usbwatcher + UsbUiModelActive *mModelActive; + + QItemSelectionModel *mSelectionModel; +}; + +#endif // USBUISETTINGMODEL_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/rom/usbsettingsapp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/rom/usbsettingsapp.iby Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef USBSETTINGSAPP_IBY +#define USBSETTINGSAPP_IBY +// Use standard macros +#include + +#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/rom/usbsettingsappresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/rom/usbsettingsappresources.iby Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef USBSETTINGSAPPRESOURCES_IBY +#define USBSETTINGSAPPRESOURCES_IBY +// Use standard macros +#include + +#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/USBSettingsApp.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/USBSettingsApp.ui Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,30 @@ + + USBSettingsApp + + + + 0 + 0 + 800 + 600 + + + + USBSettingsApp + + + + + + 0 + 0 + 800 + 21 + + + + + + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/hblistviewitem.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/hblistviewitem.css Thu Jul 22 16:44:03 2010 +0100 @@ -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; +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/hblistviewitem.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/hblistviewitem.widgetml Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/main.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include "usbsettingsapp.h" +#include + +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(); + +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbsettinglayout.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbsettinglayout.qrc Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,5 @@ + + + hblistviewitem.widgetml + hblistviewitem.css + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbsettingsapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbsettingsapp.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#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(widget); + this->addView(mView); + this->setCurrentView(mView); + } + QGraphicsWidget *listViewWidget = mDocumentLoader->findWidget(QString("listView")); + if (listViewWidget) { + myDebug() << " USBSettingsApp::load listView found"; + HbListView *listView = qobject_cast(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(listViewItemWidget); + mListViewItem->setGraphicsSize(HbListViewItem::LargeIcon); + setOrientation(orientation); + } + + QGraphicsWidget *groupBoxWidget = mDocumentLoader->findWidget(QString("groupBox")); + if (groupBoxWidget) { + myDebug() << " USBSettingsApp::load groupBox found"; + HbGroupBox *groupBox = qobject_cast(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"; +} + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbsettingsapp.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbsettingsapp.docml Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbsettingsapp.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbsettingsapp.qrc Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,5 @@ + + + usbsettingsapp.docml + + \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbsettingsapp.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbsettingsapp.ts Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,396 @@ + + + + + + The second line contains the progress indicator + USB disconnecting + USB disconnecting + qtl_indimenu_pri_medium_graphic + usb_05 + dblist_1 + us + False + + + + Unable to eject the USB device. Some of the applicatios may still be using it. + Unable to eject the USB device. Some of the applicatios may still be using it. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + + Mass storage + Mass storage + qtl_list_pri_large_graphic_add + usb_03 + dblist_2 + us + False + + + Note this is continuation from the heading. Tells which interface we show to the host device + to OVI suite + to OVI suite + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + + Memory full. Close some applications and try to connect USB cable again. + Memory full. Close some applications and try to connect USB cable again. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + When the selected UBS mode can't be loaded, because there is not enough memory + Not enough memory + Not enough memory + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_2_val + us + False + + + + to OVI suite + to OVI suite + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_1_val + us + False + + + + Use this phone to connect the other device to the Internet + Use this phone to connect the other device to the Internet + txt_usb_dblist_usb_connected_val_access_this_phone + usb_03 + dblist_4_val + us + False + + + + USB connected + USB connected + qtl_indimenu_pri_medium_graphic + usb_02 + dblist_1 + us + False + + + Note this is continuation from the heading. Tells which interface we show to the host device + as mass storage + as mass storage + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + 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) + Unsupported USB device. Disconnect device. + Unsupported USB device. Disconnect device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + There is only the USB cable, but no device in the other end. + Remove USB cable or connect a device. + Remove USB cable or connect a device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + + OVI suite + OVI suite + qtl_list_pri_large_graphic_add + usb_03 + dblist_1 + us + False + + + + Select connection type + Select connection type + qtl_groupbox_simple_sec + usb_03 + subhead + us + False + + + There is some parts of the USB device the phone doesn't recognize, but the device can still be used for some purposes + Partially supported USB device connected. All functionality might not work. + Partially supported USB device connected. All functionality might not work. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + 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. + Error in USB connection. Disconnect device. + Error in USB connection. Disconnect device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + + Safe to remove + Safe to remove + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + + USB problem + USB problem + qtl_indimenu_pri_medium_graphic + usb_02 + dblist_2 + us + False + + + + Use this phone like a memory stick on the other device + Use this phone like a memory stick on the other device + txt_usb_dblist_usb_connected_val_access_this_phone + usb_03 + dblist_2_val + us + False + + + + as media transfer + as media transfer + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_1_val + us + False + + + Tapping this item will start the safe removal process + Click to eject + Click to eject + qtl_notifdialog_sec_medium_graphics + usb_06 + dpinfo + us + False + + + The second line contains the progress indicator + USB connecting + USB connecting + qtl_indimenu_pri_medium_graphic + usb_05 + dblist_1 + us + False + + + 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. + Unable to use file system in device. Disconnect device. + Unable to use file system in device. Disconnect device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + + as mass storage + as mass storage + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_1_val + us + False + + + + USB connected + USB connected + qtl_notifdialog_pri_medium_graphics + usb_01 + dpophead + us + False + + + The name of the USB item in control panel connectivity section + USB + USB + qtl_titlebar + usb + title + us + False + + + 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 + Access this phone’s information from OVI Suite + Access this phone’s information from OVI Suite + txt_usb_dblist_usb_connected_val_access_this_phone + usb_03 + dblist_1_val + us + False + + + Note this is continuation from the heading. Tells which interface we show to the host device + as media transfer + as media transfer + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + + Web connection + Web connection + qtl_list_pri_large_graphic_add + usb_03 + dblist_4 + us + False + + + %1 is the type of the USB device, only in OTG + headset in use + headset in use + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + + Use this phone as a music or image source to the other device + Use this phone as a music or image source to the other device + txt_usb_dblist_usb_connected_val_access_this_phone + usb_03 + dblist_3_val + us + False + + + The USB hubs can't be used with the phone + Hubs are not supported. Disconnect device. + Hubs are not supported. Disconnect device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + + as web connection + as web connection + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_1_val + us + False + + + When use rhas selected to eject the other device and everythign has worked well, only in OTG + USB disconnected + USB disconnected + qtl_notifdialog_pri_medium_graphics + usb_01 + dpophead + us + False + + + + Media transfer + Media transfer + qtl_list_pri_large_graphic_add + usb_03 + dblist_3 + us + False + + + The USB device uses file system that we don't support + Unknown file system. Disconnect device. + Unknown file system. Disconnect device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + 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 + Unable to show a memory to other device. + Unable to show a memory to other device. + qtl_dialog_pri5_larger_graphic + usb_04 + info + us + False + + + When the host doesn't recognize the interface we are offering to it + Connection type not supported + Connection type not supported + qtl_indimenu_sec_medium_graphic + usb_02 + dblist_2_val + us + False + + + Note this is continuation from the heading. Tells which interface we show to the host device + as web connection + as web connection + qtl_notifdialog_sec_medium_graphics + usb_01 + dpinfo + us + False + + + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbuimodelactive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbuimodelactive.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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; +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbsettingsapp/src/usbuisettingmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbsettingsapp/src/usbuisettingmodel.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include +#include +#include +#include +#include +#include +#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 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 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; +} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/data/1020E472.rss --- a/usbuis/usbui/USBClassChangeUIPlugin/data/1020E472.rss Mon Jun 21 22:40:15 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"; - } - }; - } - - - }; -} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/data/USBClassChangeUIPlugin.rss --- a/usbuis/usbui/USBClassChangeUIPlugin/data/USBClassChangeUIPlugin.rss Mon Jun 21 22:40:15 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 - -// RESOURCE IDENTIFIER -NAME USBP // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include "USBClassChangeUIPlugin.hrh" -#include - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/group/USBClassChangeUIPlugin.mmp --- a/usbuis/usbui/USBClassChangeUIPlugin/group/USBClassChangeUIPlugin.mmp Mon Jun 21 22:40:15 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 -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/group/bld.inf --- a/usbuis/usbui/USBClassChangeUIPlugin/group/bld.inf Mon Jun 21 22:40:15 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 - -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 - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/group/usbuiplugin_icons_dc.mk --- a/usbuis/usbui/USBClassChangeUIPlugin/group/usbuiplugin_icons_dc.mk Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.h Mon Jun 21 22:40:15 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 // 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.hrh --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPlugin.hrh Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginCRWatcher.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginCRWatcher.h Mon Jun 21 22:40:15 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 - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginContainer.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginContainer.h Mon Jun 21 22:40:15 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 -#include -#include -#include -#include -#include -#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginDebug.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginDebug.h Mon Jun 21 22:40:15 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 -#include - -// =========================================================================== -#ifdef __WINS__ // File logging for WINS -// =========================================================================== -#define FLOG(a) { FPrint(a); } -#define FTRACE(a) { a; } - -#include -#include - -_LIT(KLogFile,"usbclasschangeuipluginlog.txt"); -_LIT(KLogDir,"USBUI"); - -// Declare the FPrint function -inline void FPrint(const TRefByValue 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 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 aFmt, ...) - { - - VA_LIST list; - VA_START(list, aFmt); - TBuf8<256> buf8; - buf8.AppendFormatList(aFmt, list); - - TBuf16<256> buf16(buf8.Length()); - buf16.Copy(buf8); - - TRefByValue 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.h Mon Jun 21 22:40:15 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 - - -/** - * 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.inl --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginInterface.inl Mon Jun 21 22:40:15 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 ); - } diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginModel.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginModel.h Mon Jun 21 22:40:15 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 -#include -#include -#include -#include -#include -#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& 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& 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& 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& 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 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 iDeviceIDs; - - //Number of personalities - TInt iPersonalityCount; - - }; - -#endif // USBCLASSCHANGEUIPLUGINMODEL_H - -// End of File diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h Mon Jun 21 22:40:15 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 // AVKON components -#include // AVKON component -#include // Menu pane definitions -#include // General Settings plugin -#include -#include - -#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/USBDeviceStateWatcher.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/USBDeviceStateWatcher.h Mon Jun 21 22:40:15 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 -#include - -/** - * 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/inc/usbotghoststatewatcher.h --- a/usbuis/usbui/USBClassChangeUIPlugin/inc/usbotghoststatewatcher.h Mon Jun 21 22:40:15 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 -#include -#include -#include - - -/** - * 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginCRWatcher.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginCRWatcher.cpp Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginContainer.cpp Mon Jun 21 22:40:15 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 // Resource reader - -#include -#include // Resources -#include // Help id -#include -#include -#include -#include - -#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* iconArray = new(ELeave) CArrayPtrFlat(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 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 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginImplementationTable.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginImplementationTable.cpp Mon Jun 21 22:40:15 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 -#include - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginModel.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginModel.cpp Mon Jun 21 22:40:15 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 -#include -#include -#include -#include // Resources -#include -#include -#include -#include -#include -#include -#include -#include - -#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(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& aIconArray) - { - FLOG(_L("[CUSBClassChangeUIPlugin]\t CUSBClassChangeUIPluginModel::SupportedUSBModeArraysL()")); - RArray 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& 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& 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& 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginView.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBClassChangeUIPluginView.cpp Mon Jun 21 22:40:15 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 -#include -#include // BAFL utils (for language file) -#include -#include -#include -#include // Help launcher -#include -#include -#include -#include // 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 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/USBDeviceStateWatcher.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/USBDeviceStateWatcher.cpp Mon Jun 21 22:40:15 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(); - } diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/USBClassChangeUIPlugin/src/usbotghoststatewatcher.cpp --- a/usbuis/usbui/USBClassChangeUIPlugin/src/usbotghoststatewatcher.cpp Mon Jun 21 22:40:15 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 -#include -#include - -#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(); - } diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/aif/USBClassChangeUI_caption.rss --- a/usbuis/usbui/aif/USBClassChangeUI_caption.rss Mon Jun 21 22:40:15 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 - -RESOURCE CAPTION_DATA - { - caption = qtn_apps_usb_list; - shortcaption = qtn_apps_usb_grid; - } - -// End of File - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/aif/USBClassChangeUIaif.rss --- a/usbuis/usbui/aif/USBClassChangeUIaif.rss Mon Jun 21 22:40:15 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 - -RESOURCE AIF_DATA - { - app_uid=0x102068E2; - num_icons=2; - } - -// End of File diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/data/USBClassChangeUI.rss --- a/usbuis/usbui/data/USBClassChangeUI.rss Mon Jun 21 22:40:15 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 - -// RESOURCE IDENTIFIER -NAME USBC // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/data/USBClassChangeUI_reg.rss --- a/usbuis/usbui/data/USBClassChangeUI_reg.rss Mon Jun 21 22:40:15 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 -#include -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/group/USBClassChangeUI.mmp --- a/usbuis/usbui/group/USBClassChangeUI.mmp Mon Jun 21 22:40:15 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 -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/group/bld.inf --- a/usbuis/usbui/group/bld.inf Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/group/usbui_Icons_aif_scalable_dc.mk --- a/usbuis/usbui/group/usbui_Icons_aif_scalable_dc.mk Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/group/usbui_icons_aif_bitmaps_dc.mk --- a/usbuis/usbui/group/usbui_icons_aif_bitmaps_dc.mk Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/help/data/xhtml.zip Binary file usbuis/usbui/help/data/xhtml.zip has changed diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/help/group/bld.inf --- a/usbuis/usbui/help/group/bld.inf Mon Jun 21 22:40:15 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 -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) diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/help/inc/usb.hlp.hrh --- a/usbuis/usbui/help/inc/usb.hlp.hrh Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/help/rom/usbuihelps_variant.iby --- a/usbuis/usbui/help/rom/usbuihelps_variant.iby Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/inc/USBClassChangeUI.h --- a/usbuis/usbui/inc/USBClassChangeUI.h Mon Jun 21 22:40:15 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 // 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/inc/USBClassChangeUIApp.h --- a/usbuis/usbui/inc/USBClassChangeUIApp.h Mon Jun 21 22:40:15 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 -#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/inc/USBClassChangeUIAppUi.h --- a/usbuis/usbui/inc/USBClassChangeUIAppUi.h Mon Jun 21 22:40:15 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 -#include - - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/inc/USBClassChangeUIDebug.h --- a/usbuis/usbui/inc/USBClassChangeUIDebug.h Mon Jun 21 22:40:15 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 -#include - -// =========================================================================== -#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 -#include - -_LIT(KLogFile,"usbclasschangeuilog.txt"); -_LIT(KLogDir,"USBUI"); - -//Declare the FPrint function with variable number of arguments. -inline void FPrint(const TRefByValue 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 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 aFmt, ...) - { - - VA_LIST list; - VA_START(list, aFmt); - TBuf8<256> buf8; - buf8.AppendFormatList(aFmt, list); - - TBuf16<256> buf16(buf8.Length()); - buf16.Copy(buf8); - - TRefByValue 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/inc/USBClassChangeUIDocument.h --- a/usbuis/usbui/inc/USBClassChangeUIDocument.h Mon Jun 21 22:40:15 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 - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/loc/USBClassChangeUI.loc --- a/usbuis/usbui/loc/USBClassChangeUI.loc Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/rom/USBClassChangeUI.iby --- a/usbuis/usbui/rom/USBClassChangeUI.iby Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/rom/USBClassChangeUIResources.iby --- a/usbuis/usbui/rom/USBClassChangeUIResources.iby Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/src/USBClassChangeUIApp.cpp --- a/usbuis/usbui/src/USBClassChangeUIApp.cpp Mon Jun 21 22:40:15 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 - - -// ================= 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/src/USBClassChangeUIAppui.cpp --- a/usbuis/usbui/src/USBClassChangeUIAppui.cpp Mon Jun 21 22:40:15 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 - -#include - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/src/USBClassChangeUIDocument.cpp --- a/usbuis/usbui/src/USBClassChangeUIDocument.cpp Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def --- a/usbuis/usbui/tsrc/usbuiapitest/bmarm/usbuiapitestu.def Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/bwins/usbuiapitestu.def --- a/usbuis/usbui/tsrc/usbuiapitest/bwins/usbuiapitestu.def Mon Jun 21 22:40:15 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 &) - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/conf/ui_usbuiapitest.cfg --- a/usbuis/usbui/tsrc/usbuiapitest/conf/ui_usbuiapitest.cfg Mon Jun 21 22:40:15 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 -// ... diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/eabi/usbuiapitestu.def --- a/usbuis/usbui/tsrc/usbuiapitest/eabi/usbuiapitestu.def Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf --- a/usbuis/usbui/tsrc/usbuiapitest/group/Bld.inf Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/build_sis_ats.bat --- a/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_ats.bat Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/build_sis_phone.bat --- a/usbuis/usbui/tsrc/usbuiapitest/group/build_sis_phone.bat Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.mmp --- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.mmp Mon Jun 21 22:40:15 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 -#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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.pkg --- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest.pkg Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest_phone.pkg --- a/usbuis/usbui/tsrc/usbuiapitest/group/usbuiapitest_phone.pkg Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h --- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitest.h Mon Jun 21 22:40:15 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 -#include -#include -#include - -#include "coreapplicationuisdomainpskeys.h" -#include -#include -#include -#include -#include -#include - -#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 aFmt, ...); - inline void Trace(TRefByValue 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl --- a/usbuis/usbui/tsrc/usbuiapitest/inc/usbuiapitestdebug.inl Mon Jun 21 22:40:15 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 - -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 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 tmpFmt(_L("%S")); - RDebug::Print(tmpFmt, &buf16); - iLog->Log(tmpFmt, &buf16); - buf8.Close(); - buf16.Close(); - }; - -void CUSBUiApiTest::Trace(TRefByValue 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(); - }; diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini --- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest.ini Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini --- a/usbuis/usbui/tsrc/usbuiapitest/init/usbuiapitest_phone.ini Mon Jun 21 22:40:15 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp --- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitest.cpp Mon Jun 21 22:40:15 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 -#include "USBUiApiTest.h" -#include - -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp --- a/usbuis/usbui/tsrc/usbuiapitest/src/usbuiapitestblocks.cpp Mon Jun 21 22:40:15 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 -#include -#include -#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("<<>>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("<<>>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("<<>>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("<<>>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("<<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("<< 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/BWINS/usbavkonnotifu.def --- a/usbuis/usbuinotif/BWINS/usbavkonnotifu.def Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/BWINS/usbavkonnotifu.def Thu Jul 22 16:44:03 2010 +0100 @@ -1,3 +1,3 @@ EXPORTS - ?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr * NotifierArray(void) + ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/data/102068DC.rss --- a/usbuis/usbuinotif/data/102068DC.rss Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/data/102068DC.rss Thu Jul 22 16:44:03 2010 +0100 @@ -17,7 +17,7 @@ */ -#include "registryinfo.rh" +#include "ecom/registryinfo.rh" #include "uikon.hrh" RESOURCE REGISTRY_INFO theInfo diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/data/usbuinotif.rss --- a/usbuis/usbuinotif/data/usbuinotif.rss Mon Jun 21 22:40:15 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 -#include - -#include -#include -#include -#include - -#include - - -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"qtn_usb_mode_msg_link""; } - -RESOURCE TBUF r_usb_mode_msg_pc_suite { - buf= "%U mode :\n"qtn_usb_mode_msg_pc_suite"\n" qtn_usb_mode_msg_link""; } - -RESOURCE TBUF r_usb_mode_msg_mtp { - buf= "%U mode :\n"qtn_usb_mode_msg_mtp"\n" qtn_usb_mode_msg_link""; } - -RESOURCE TBUF r_usb_mode_msg_ptp { - buf= "%U mode :\n"qtn_usb_mode_msg_ptp"\n" qtn_usb_mode_msg_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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/eabi/usbavkonnotifu.def --- a/usbuis/usbuinotif/eabi/usbavkonnotifu.def Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/eabi/usbavkonnotifu.def Thu Jul 22 16:44:03 2010 +0100 @@ -1,3 +1,3 @@ EXPORTS - _Z13NotifierArrayv @ 1 NONAME + _Z24ImplementationGroupProxyRi @ 1 NONAME diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/group/bld.inf --- a/usbuis/usbuinotif/group/bld.inf Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/group/usbuinotif.mmp --- a/usbuis/usbuinotif/group/usbuinotif.mmp Mon Jun 21 22:40:15 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 -#include //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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbnotifier.h --- a/usbuis/usbuinotif/inc/usbnotifier.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbnotifier.h Thu Jul 22 16:44:03 2010 +0100 @@ -20,9 +20,6 @@ #include #include #include -#include -#include -#include #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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuincableconnectednotifier.h --- a/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbuincableconnectednotifier.h Thu Jul 22 16:44:03 2010 +0100 @@ -20,8 +20,8 @@ // INCLUDES -#include -#include +#include +#include #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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuinotifmsmmerror.h --- a/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbuinotifmsmmerror.h Thu Jul 22 16:44:03 2010 +0100 @@ -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 +#include #include "usbnotifier.h" // Base class -#include // AVKON component -#define KUsbUiNotifOtgGeneralQueryGranularity 3 + + // CLASS DECLARATION /** @@ -32,19 +33,24 @@ * * @lib */ -NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase +NONSHARABLE_CLASS(CUsbUiNotifMSMMError) : public CUSBUINotifierBase, + public MHbDeviceMessageBoxObserver, + public MHbDeviceNotificationDialogObserver { 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, + EUsbMSMMSafeToRemove, + EUsbMSMMUnableToEject + }; + // Constructors and destructor /** @@ -57,6 +63,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 +95,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 +102,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: @@ -104,22 +113,21 @@ CUsbUiNotifMSMMError(); private: - // New functions - + // functions from MHbDeviceNotificationDialogObserver /** - * Show query dialog - * @return KErrNone - accepted, KErrCancel - Cancel or End call key + * Callback function which is called when the dialog is tapped */ - TInt QueryUserResponseL(); + void NotificationDialogActivated(const CHbDeviceNotificationDialogSymbian* aDialog); + /** + * Callback function which is called when the dialog is closed + */ + void NotificationDialogClosed(const CHbDeviceNotificationDialogSymbian* aDialog, + TInt aCompletionCode); private: // Data - /** - * Query - * Not own, destroys self when lauched. - */ - CAknQueryDialog* iQuery; - RArray iStringIds; - TInt iErrorId; - }; + CHbDeviceMessageBoxSymbian* iQuery; + CHbDeviceNotificationDialogSymbian* iDiscreet; + CDesCArrayFlat* iStringIds; + }; #endif // USBUINOTIFMSMMERROR_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuinotifotgerror.h --- a/usbuis/usbuinotif/inc/usbuinotifotgerror.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbuinotifotgerror.h Thu Jul 22 16:44:03 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Declares USB UI Queries notifier. +* Description: Declares USB UI OTG Errors notifier. * */ @@ -20,19 +20,20 @@ #define USBUINOTIFOTGERROR_H // INCLUDES - +#include #include "usbnotifier.h" // Base class -#include // 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 +47,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 +79,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 +86,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 +97,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 iStringIds; - TInt iErrorId; + CHbDeviceMessageBoxSymbian* iQuery; + CDesCArrayFlat* iStringIds; }; #endif // USBUINOTIFOTGERROR_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuinotifotgwarning.h --- a/usbuis/usbuinotif/inc/usbuinotifotgwarning.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbuinotifotgwarning.h Thu Jul 22 16:44:03 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Declares USB UI connection notifier. +* Description: Declares USB OTG Warning notifier. * */ @@ -20,11 +20,11 @@ #define USBUINOTIFOTGWARNING_H // INCLUDES -#include + #include +#include #include "usbnotifier.h" // Base class -#define KUsbUiNotifOtgGeneralNoteGranularity 1 // CLASS DECLARATION /** @@ -32,7 +32,8 @@ * Synchronous call is enouph. * */ -NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase +NONSHARABLE_CLASS(CUsbUiNotifOtgWarning) : public CUSBUINotifierBase, + public MHbDeviceMessageBoxObserver { public: // Constructors and destructor @@ -46,6 +47,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 +80,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 +88,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 +98,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 iStringIds; + CDesCArrayFlat* iStringIds; //Own - CAknResourceNoteDialog* iNote; + CHbDeviceMessageBoxSymbian* iNote; TInt iNoteId; }; diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuinqueriesnotifier.h --- a/usbuis/usbuinotif/inc/usbuinqueriesnotifier.h Mon Jun 21 22:40:15 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 // 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h --- a/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/inc/usbuinqueriesnotifiermdrv.h Thu Jul 22 16:44:03 2010 +0100 @@ -19,9 +19,10 @@ #define USBUINQUERIESNOTIFIER_H // INCLUDES - +#include #include "usbnotifier.h" // Base class -#include // 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 }; diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/loc/usbuinotif.loc diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/rom/usbuinotif.iby diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/rom/usbuinotifresources.iby --- a/usbuis/usbuinotif/rom/usbuinotifresources.iby Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/rom/usbuinotifresources.iby Thu Jul 22 16:44:03 2010 +0100 @@ -19,9 +19,11 @@ REM USB UI notifiers resources +#include + #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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbnotifier.cpp --- a/usbuis/usbuinotif/src/usbnotifier.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbnotifier.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -16,18 +16,15 @@ */ // INCLUDE FILES -#include // Eikon environment + #include // BAFL utils (for language file) -#include // Localisation stringloader -#include -#include #include -#include #include +#include #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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp --- a/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuincableconnectednotifier.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -15,17 +15,13 @@ * */ // INCLUDE FILES -#include // Eikon environment -#include // BAFL utils (for language file) -#include -#include -#include // Localisation stringloader #include // Unicode character conversion utilities #include -#include // Own resources #include #include #include // KExecutableImageUid +#include +#include #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,44 @@ } // ---------------------------------------------------------------------------- -// CUSBUICableConnectedNotifier::GetParamsL -// Jump to RunL as soon as possible. +// CUSBUICableConnectedNotifier::StartDialogL // ---------------------------------------------------------------------------- // -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")); + if (iDialog) + { + FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL() deleting previous dialog")); + delete iDialog; + iDialog = NULL; + } + iDialog = CHbDeviceNotificationDialogSymbian::NewL(this); + + HBufC* header = NULL; + HBufC* description =NULL; + GetPersonalityStringLC(header, description); + + iDialog->SetTitleL(*header); + iDialog->SetTextL(*description); + iDialog->SetIconNameL(KUSBUIconFileName ); + iDialog->EnableTouchActivation(ETrue); + iDialog->ShowL(); + + CleanupStack::PopAndDestroy(header); + CleanupStack::PopAndDestroy(description); + FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL completed")); } // ---------------------------------------------------------------------------- @@ -153,8 +145,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(); @@ -163,76 +159,57 @@ // ----------------------------------------------------------------------------------------------------------- // CUSBUICableConnectedNotifier::GetPersonalityStringL -// Get the strings for ask on connection message query +// Get the strings for the discreet popup dialog // ----------------------------------------------------------------------------------------------------------- // void CUSBUICableConnectedNotifier::GetPersonalityStringLC( 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 +230,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(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 +270,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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuinmain.cpp --- a/usbuis/usbuinotif/src/usbuinmain.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuinmain.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -19,10 +19,9 @@ #include #include #include -#include #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) diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp --- a/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007, 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007 - 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,25 +11,25 @@ * * Contributors: * -* Description: USB UI queries notifier class. +* Description: USB UI MSMM Error notifier class. * */ // INCLUDE FILES -#include // Eikon environment -#include // BAFL utils (for language file) -#include // Unicode character conversion utilities -#include // Localisation stringloader -#include -#include -#include +#include // dialog +#include //discreet +#include +#include +#include // pck +#include "usbuinotifmsmmerror.h" // Own class definition +#include "usbuinotifdebug.h" // Debugging macros -#include // pck -#include // 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 = 5; +_LIT(KUSBUIconFileName, "qtg_large_usb"); // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- @@ -53,7 +53,7 @@ // ---------------------------------------------------------------------------- // CUsbUiNotifMSMMError::CUsbUiNotifMSMMError() : - iStringIds( KUsbUiNotifOtgGeneralQueryGranularity) + iStringIds(NULL) { } @@ -66,15 +66,25 @@ //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"); + _LIT(KSafeToRemove, "txt_usb_dpinfo_safe_to_remove"); + _LIT(KUnableToEject,"txt_usb_info_unable_to_eject_the_usb_device_some" ); + + iStringIds->AppendL(KGeneralError); + iStringIds->AppendL(KUnknownFileSys); + iStringIds->AppendL(KOutOfMemory); + iStringIds->AppendL(KSafeToRemove); + iStringIds->AppendL(KUnableToEject); } // ---------------------------------------------------------------------------- @@ -95,64 +105,89 @@ // 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; - + _LIT(KUsbDisconnected, "txt_usb_dpophead_usb_disconnected"); // Get parameters // THostMsErrData error; - TPckgC pckg( error); + TPckgC pckg( error ); pckg.Set( aBuffer ); + int errorId = EUsbMSMMGeneralError; switch (pckg().iError) { case EHostMsErrUnknownFileSystem: - iErrorId = EUsbMSMMUnknownFileSystem; + errorId = EUsbMSMMUnknownFileSystem; break; case EHostMsErrOutOfMemory: - iErrorId = EUsbMSMMOutOfMemory; - break; + errorId = EUsbMSMMOutOfMemory; + break; + case EHostMsErrNone: + errorId = EUsbMSMMSafeToRemove; + break; + case EHostMsErrInUse: + errorId = EUsbMSMMUnableToEject; + break; default: - iErrorId = EUsbMSMMGeneralError; + errorId = EUsbMSMMGeneralError; } - - SetActive(); - iStatus = KRequestPending; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::GetParamsL() completed")); - } - -// ---------------------------------------------------------------------------- -// CUsbUiNotifMSMMError::RunL -// Ask user response and return it to caller. -// ---------------------------------------------------------------------------- -// -void CUsbUiNotifMSMMError::RunL() - { - FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL")); - TInt returnValue = KErrNone; - - DisableKeylock(); - SuppressAppSwitching( ETrue ); - - //Excute dialog and check return value - returnValue = QueryUserResponseL(); - - SuppressAppSwitching( EFalse ); - RestoreKeylock(); - CompleteMessage( returnValue ); - - FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL() completed")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(iStringIds->MdcaPoint(errorId)); + + + if ( errorId == EUsbMSMMSafeToRemove) + { + // "safe to remove" discreet popup + HBufC* header = HbTextResolverSymbian::LoadLC(KUsbDisconnected); + if (iDiscreet) + { + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog")); + delete iDiscreet; + iDiscreet = NULL; + } + iDiscreet = CHbDeviceNotificationDialogSymbian::NewL(this); + iDiscreet->SetTitleL(*header); + iDiscreet->SetTextL(*stringHolder); + iDiscreet->SetIconNameL(KUSBUIconFileName ); + iDiscreet->ShowL(); + CleanupStack::PopAndDestroy( header ); + } + else + { + //Delete the query in case the client didn't cancel the notifier + //or close the session after the previous query. + + if (iQuery) + { + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() deleting previous dialog")); + delete iQuery; + iQuery = NULL; + } + + iQuery = CHbDeviceMessageBoxSymbian::NewL( + CHbDeviceMessageBoxSymbian::EWarning, this); + iQuery->SetTimeout(0); + + + iQuery->SetTextL(*stringHolder); + iQuery->ShowL(); + } + + CleanupStack::PopAndDestroy( stringHolder ); + + + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::StartDialogL() completed")); } // ---------------------------------------------------------------------------- @@ -165,43 +200,62 @@ 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 ); - + if (iDiscreet) + { + iDiscreet->Close(); + delete iDiscreet; + iDiscreet = NULL; + } + 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")); } +void CUsbUiNotifMSMMError::NotificationDialogActivated( + const CHbDeviceNotificationDialogSymbian* /*aDialog*/) + { + + } + +void CUsbUiNotifMSMMError::NotificationDialogClosed( + const CHbDeviceNotificationDialogSymbian* /*aDialog*/, TInt /*aCompletionCode*/) + { + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed()")); + CompleteMessage( KErrCancel ); + FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::NotificationDialogClosed() complete")); + } // End of File diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuinotifotgerror.cpp --- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -17,18 +17,17 @@ // INCLUDE FILES -#include // Eikon environment -#include // BAFL utils (for language file) -#include // Unicode character conversion utilities -#include // Localisation stringloader -#include -#include - +#include // dialog +#include #include // pck -#include // 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 pckg( iErrorId ); + TInt errorId = 0; + TPckgC 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuinotifotgwarning.cpp --- a/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuinotifotgwarning.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -17,15 +17,16 @@ // INCLUDE FILES -#include // Eikon environment -#include -#include // BAFL utils (for language file) -#include // Localisation stringloader -#include // for cover display support -#include // Own resources +#include +#include #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 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp --- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -16,18 +16,12 @@ */ // INCLUDE FILES -#include // Eikon environment -#include // BAFL utils (for language file) -#include // Unicode character conversion utilities -#include // Localisation stringloader -#include -#include +#include +#include #include // pck -#include // Own resources #include "usbuinqueriesnotifiermdrv.h" // Own class definition #include "usbuinotifdebug.h" // Debugging macros -#include // 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 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/conf/ui_usbuinotifapitest.cfg Thu Jul 22 16:44:03 2010 +0100 @@ -1,230 +1,392 @@ -/* -* 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] +title MSMM safe to remove (MSMM error Notifier Test) +create USBUiNotifApiTest tester +tester UsbMSMMNotifierTests EUsbMSMMSafeToRemove +tester FinishQuery CANCEL +delete tester +[Endtest] + +[Test] +title MSMM warning unable to eject (MSMM error Notifier Test) +create USBUiNotifApiTest tester +tester UsbMSMMNotifierTests EUsbMSMMUnableToEject +pause DISMISS_PAUSE +presskey global EKeyEnter +tester FinishQuery CANCEL +delete tester +[Endtest] +//Test launching MSMM error without cancelling the previous. +[Test] +title MSMM error no cancel (MSMM error Notifier Test) +create USBUiNotifApiTest tester +tester UsbMSMMNotifierTests EUsbMSMMUnknownFileSystem +pause DISMISS_PAUSE +presskey global EKeyEnter +tester WaitForRequest +tester UsbMSMMNotifierTests EUsbMSMMOutOfMemory +pause DISMISS_PAUSE +presskey global EKeyEnter +tester FinishQuery CANCEL +delete tester +[Endtest] -// 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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis.bat Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,23 @@ +@rem +@rem Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This material, including documentation and any related +@rem computer programs, is protected by copyright controlled by +@rem Nokia. All rights are reserved. Copying, including +@rem reproducing, storing, adapting or translating, any +@rem or all of this material requires the prior written consent of +@rem Nokia. This material also contains confidential +@rem information which may not be disclosed to others without the +@rem prior written consent of Nokia. +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +call abld test build armv5 +call makesis usbuinotifapitest.pkg +call signsis usbuinotifapitest.sis usbuinotifapitest.sisx rd.cer rd-key.pem diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/build_sis_phone.bat Thu Jul 22 16:44:03 2010 +0100 @@ -1,24 +1,23 @@ @rem -@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +@rem Copyright (c) 2006 - 2010 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem This material, including documentation and any related +@rem computer programs, is protected by copyright controlled by +@rem Nokia. All rights are reserved. Copying, including +@rem reproducing, storing, adapting or translating, any +@rem or all of this material requires the prior written consent of +@rem Nokia. This material also contains confidential +@rem information which may not be disclosed to others without the +@rem prior written consent of Nokia. @rem @rem Initial Contributors: @rem Nokia Corporation - initial contribution. @rem @rem Contributors: @rem -@rem Description: Test script config file -@rem +@rem Description: @rem -rd /q /s x:\epoc32\BUILD - -call bldmake bldfiles -call abld test build armv5 +call sbs -k -c armv5.test call makesis usbuinotifapitest_phone.pkg -call signsis usbuinotifapitest_phone.sis usbuinotifapitest_phone.sisx x:\rd.cer x:\rd-key.pem -call pause \ No newline at end of file +call signsis usbuinotifapitest_phone.sis usbuinotifapitest_phone.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/group/usbuinotifapitest.mmp Thu Jul 22 16:44:03 2010 +0100 @@ -41,10 +41,10 @@ LIBRARY euser.lib LIBRARY stiftestinterface.lib LIBRARY stiftestengine.lib -LIBRARY centralrepository.lib -LIBRARY usbman.lib -LIBRARY usbwatcher.lib -LIBRARY ecom.lib +LIBRARY centralrepository.lib +LIBRARY usbman.lib +LIBRARY usbwatcher.lib +LIBRARY ecom.lib LANG SC diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitest.h Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-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" @@ -15,9 +15,6 @@ * */ - - - #ifndef USBUINOTIFAPITEST_H #define USBUINOTIFAPITEST_H @@ -35,98 +32,57 @@ #include #include // 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,38 +95,20 @@ protected: // New functions - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - protected: // Functions from base classes - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - private: /** * C++ default constructor. */ - CUsbUiNotifApiTest( CTestModuleIf& aTestModuleIf ); + CUSBUiNotifApiTest( CTestModuleIf& aTestModuleIf ); /** * By default Symbian 2nd phase constructor is private. */ void ConstructL(); - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - /** * Frees all resources allocated from test methods. * @since ?Series60_version @@ -180,13 +118,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 +142,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 aFmt, ...); - inline void Trace(TRefByValue 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 +172,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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/inc/usbuinotifapitestdebug.inl Mon Jun 21 22:40:15 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 - -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 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 tmpFmt(_L("%S")); - RDebug::Print(tmpFmt, &buf16); - iLog->Log(tmpFmt, &buf16); - buf8.Close(); - buf16.Close(); - }; - -void CUsbUiNotifApiTest::Trace(TRefByValue 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(); - }; diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest.ini Thu Jul 22 16:44:03 2010 +0100 @@ -110,7 +110,7 @@ [New_Module] ModuleName= testscripter -TestCaseFile= e:\testing\conf\ui_USBUiNotifApiTest.cfg +TestCaseFile= e:\testing\conf\ui_usbuinotifapitest.cfg [End_Module] diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/init/usbuinotifapitest_phone.ini Thu Jul 22 16:44:03 2010 +0100 @@ -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] diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitest.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -15,88 +15,57 @@ * */ - - - // INCLUDE FILES #include -#include "UsbUiNotifApiTest.h" +#include "usbuinotifapitest.h" #include // 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 ); } diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp --- a/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Mon Jun 21 22:40:15 2010 +0100 +++ b/usbuis/usbuinotif/tsrc/usbuinotifapitest/src/usbuinotifapitestblocks.cpp Thu Jul 22 16:44:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-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" @@ -15,101 +15,85 @@ * */ - - - // [INCLUDE FILES] - do not remove #include #include #include #include -#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("<<>>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("<<>>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("<<>>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("<<>>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("<<>>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("<<>>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("<< 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 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("<<>>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 notifierParamsPckg; notifierParamsPckg() = usbOTGErrorType; iCompleteQuery = EFalse; - iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, notifierParamsPckg, iRes ); - - aTestResult = ETestCasePassed; + iNotifier -> StartNotifierAndGetResponse( iReqStatus, + KUsbUiNotifOtgError, notifierParamsPckg, iRes ); - 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 notifierParamsPckg; notifierParamsPckg() = usbOTGWarningType; iCompleteQuery = EFalse; - iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgWarning, notifierParamsPckg, iRes ); - - aTestResult = ETestCasePassed; + iNotifier -> StartNotifierAndGetResponse( iReqStatus, + KUsbUiNotifOtgWarning, notifierParamsPckg, iRes ); - 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 notifierParamsPckg; notifierParamsPckg() = usbMSMMNErrorType; iCompleteQuery = EFalse; iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifMsmmError, iErrPckg, iRes ); + + return KErrNone; + } - aTestResult = ETestCasePassed; - - TRACE_INFO( _L("<<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 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 notifierParamsPckg; + notifierParamsPckg() = EUsbOtgUnsupportedDevice; + iCompleteQuery = EFalse; + TPckgBuf response ; + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KUsbUiNotifOtgError, + notifierParamsPckg, iRes ); + + User::After(KUpdateDelay); //simulate update after a delay + TPckgBuf 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("<< 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*>( REComSession::CreateImplementationL(TUid::Uid(0x10281F23), iInstanceUid)); - - aTestResult = ETestCasePassed; - - TRACE_INFO( _L("<<>>UnLoadNotifiers") ); - TInt count = iNotifierArray->Count(); TInt i=0; for (i=0; iReset(); delete iNotifierArray; + iNotifierArray = NULL; REComSession::DestroyedImplementation(iInstanceUid); - - aTestResult = ETestCasePassed; - - TRACE_INFO( _L("<<>>Update") ); - TInt count = iNotifierArray->Count(); - TInt i=0; - _LIT8(test, "test"); - TBuf8<32> buf(test); - for (i=0; iAt(i)->UpdateL(buf); - } - - aTestResult = ETestCasePassed; - - TRACE_INFO( _L("<<>>Notifierstart") ); - TInt count = iNotifierArray->Count(); - TInt i=0; - _LIT8(test, "test"); - TBuf8<32> buf(test); - for (i=0; iAt(i)->StartL(buf); - } - - aTestResult = ETestCasePassed; - - 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("<<>>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("<<>>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("<<>>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 if ( !aTypeString.Compare( _L( "EUsbMSMMSafeToRemove" ) ) ) + { + aQueryType = EHostMsErrNone; + iLog -> Log( _L("Query type: EUsbMSMMSafeToRemove") ); + } + else if ( !aTypeString.Compare( _L( "EUsbMSMMUnableToEject" ) ) ) + { + aQueryType = EHostMsErrInUse; + iLog -> Log( _L("Query type: EUsbMSMMUnableToEject") ); } else { - TRACE_INFO( _L("Query type: not supported") ); + iLog -> Log( _L("Query type: not supported") ); return KErrNotFound; } - - TRACE_INFO( _L("<< 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 +755,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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuinotif/usbuinotif.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbuis/usbuinotif/usbuinotif.pro Thu Jul 22 16:44:03 2010 +0100 @@ -0,0 +1,58 @@ +TEMPLATE = lib +TARGET = usbuinotif +CONFIG += HB +HEADERS += inc/usbnotifier.h \ + inc/usbuincableconnectednotifier.h \ + inc/usbuinotifdebug.h \ + inc/usbuinotifmsmmerror.h \ + inc/usbuinotifotgerror.h \ + inc/usbuinotifotgwarning.h \ + inc/usbuinqueriesnotifiermdrv.h +SOURCES += src/usbuincableconnectednotifier.cpp \ + src/usbuinqueriesnotifiermdrv.cpp \ + src/usbnotifier.cpp \ + src/usbuinotifotgwarning.cpp \ + src/usbuinotifotgerror.cpp \ + src/usbuinotifmsmmerror.cpp \ + src/usbuinmain.cpp +TRANSLATIONS = usbdialogs.ts + +defBlock = \ + "$${LITERAL_HASH}if defined(EABI)" \ + "DEFFILE .\eabi/usbavkonnotif.def" \ + "$${LITERAL_HASH}else" \ + "DEFFILE .\BWINS/usbavkonnotif.def" \ + "$${LITERAL_HASH}endif" + +MMP_RULES += defBlock + + +symbian*: { + TARGET.UID2 = 0x10009D8D + TARGET.UID3 = 0x102068DC + TARGET.CAPABILITY = CAP_ECOM_PLUGIN + + ecomResourceBlock = \ + "$${LITERAL_HASH}include " \ + "START RESOURCE ../data/102068DC.rss" \ + "TARGET usbuinotif.rsc" \ + "END" + + MMP_RULES += ecomResourceBlock + MMP_RULES += "TARGETTYPE plugin" + + BLD_INF_RULES.prj_exports += \ + "loc/usbuinotif.loc MW_LAYER_LOC_EXPORT_PATH(usbuinotif.loc)" \ + "rom/usbuinotif.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbuinotif.iby)" \ + "rom/usbuinotifresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbuinotifresources.iby)" + + LIBS += -lecom \ + -lbafl \ + -lcommonengine \ + -lcentralrepository \ + -lusbman \ + -lflogger \ + -lcone \ + -leiksrv +} + diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/icons/usb_icon_mode_2.svg --- a/usbuis/usbuiqt/icons/usb_icon_mode_2.svg Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/icons/usb_icon_mode_4.svg --- a/usbuis/usbuiqt/icons/usb_icon_mode_4.svg Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/icons/usb_icon_mode_5.svg --- a/usbuis/usbuiqt/icons/usb_icon_mode_5.svg Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/inc/mydebug.h --- a/usbuis/usbuiqt/inc/mydebug.h Mon Jun 21 22:40:15 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 - -#if defined(_DEBUG) - inline QDebug myDebug() - { - return qDebug(); - } -#else - inline QNoDebug myDebug() - { - return QNoDebug(); - } -#endif - - -#endif // MYDEBUG_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/inc/usbmainview.h --- a/usbuis/usbuiqt/inc/usbmainview.h Mon Jun 21 22:40:15 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 -#include - -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 */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/inc/usbuimodelactive.h --- a/usbuis/usbuiqt/inc/usbuimodelactive.h Mon Jun 21 22:40:15 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 -#include -#include - -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 */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/inc/usbuisettingmodel.h --- a/usbuis/usbuiqt/inc/usbuisettingmodel.h Mon Jun 21 22:40:15 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 -#include -#include -#include -#include - -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 mPersonalityIds; - UsbUiModelActive *mModelActive; -}; - -#endif // USBUISETTINGMODEL_H diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/inc/usbviewmanager.h --- a/usbuis/usbuiqt/inc/usbviewmanager.h Mon Jun 21 22:40:15 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 */ diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/rom/usbsettings.iby --- a/usbuis/usbuiqt/rom/usbsettings.iby Mon Jun 21 22:40:15 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 - -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 diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/rom/usbsettingsresources.iby --- a/usbuis/usbuiqt/rom/usbsettingsresources.iby Mon Jun 21 22:40:15 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=/epoc32/data/z/resource/apps/usbapplication.rsc APP_RESOURCE_DIR/usbapplication.rsc - -#endif diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/main.cpp --- a/usbuis/usbuiqt/src/main.cpp Mon Jun 21 22:40:15 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 -#include -#include -#include -#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(); -} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbapplication.qm Binary file usbuis/usbuiqt/src/usbapplication.qm has changed diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbapplication.qrc --- a/usbuis/usbuiqt/src/usbapplication.qrc Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - usbview.docml - - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbapplication.ts --- a/usbuis/usbuiqt/src/usbapplication.ts Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ - - - - - - Description for USB Ovi Suite personality. This gives user help about the selected personality. - Manage your phone with Ovi Suite and sync your media content. - Manage your phone with Ovi Suite and sync your media content. - - Text ID - description - Te - False - - - 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. - Ovi Suite - Ovi Suite - - Comment - modelistname - Co - False - - - 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. - Mass storage - Mass storage - - Layout ID - modelistname - La - False - - - USB mode name for Mass storage personality. This is used in USB application as the default (selected) mode. - Mass storage - Mass storage - - View ID (draft) - modename - Vi - False - - - 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. - Connect PC to Web - Connect PC to Web - - - modelistname - - False - - - Description for USB Mass storage personality. This gives user help about the selected personality. - Access your phoneÂ’s memory card from the device you are connected to. - Access your phoneÂ’s memory card from the device you are connected to. - - Position ID - description - Po - False - - - 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. - Media transfer - Media transfer - - - modelistname - - False - - - USB mode name for Ovi Suite personality. This is used in USB application as the default (selected) mode. - Ovi Suite - Ovi Suite - - File name - modename - Fi - False - - - Description for USB Phone as Modem personality. This gives user help about the selected personality. - Use your mobile phone as a modem - Use your mobile phone as a modem - - - description - - False - - - Description for USB MTP personality. This gives user help about the selected personality. - Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos. - Sync your media content with Windows Media Player or Nokia Ovi Player, or connect to compatible stereos. - - - description - - False - - - USB mode name for Phone as Modem personality. This is used in USB application as the default (selected) mode. - Connect PC to Web - Connect PC to Web - - - modename - - False - - - USB mode name for MTP personality. This is used in USB application as the default (selected) mode. - Media transfer - Media transfer - - - modename - - False - - - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbapplication.xls Binary file usbuis/usbuiqt/src/usbapplication.xls has changed diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbapplication_reg.rss --- a/usbuis/usbuiqt/src/usbapplication_reg.rss Mon Jun 21 22:40:15 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 -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0xECD2B4FE - -RESOURCE APP_REGISTRATION_INFO - { - app_file="usbapplication"; - localisable_resource_file="\\resource\\apps\\usbapplication"; - - } diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbicons.qrc --- a/usbuis/usbuiqt/src/usbicons.qrc Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - ../icons/usb_icon_mode_2.svg - ../icons/usb_icon_mode_4.svg - ../icons/usb_icon_mode_5.svg - - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbmainview.cpp --- a/usbuis/usbuiqt/src/usbmainview.cpp Mon Jun 21 22:40:15 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 -#include -#include -#include -#include -#include - -#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"; -} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbuimodelactive.cpp --- a/usbuis/usbuiqt/src/usbuimodelactive.cpp Mon Jun 21 22:40:15 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; -} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbuisettingmodel.cpp --- a/usbuis/usbuiqt/src/usbuisettingmodel.cpp Mon Jun 21 22:40:15 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 -#include -#include -#include - -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 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 ); -} diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbview.docml --- a/usbuis/usbuiqt/src/usbview.docml Mon Jun 21 22:40:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/src/usbviewmanager.cpp --- a/usbuis/usbuiqt/src/usbviewmanager.cpp Mon Jun 21 22:40:15 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 -#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); - - } - diff -r e84fb4c9218b -r ef2686f7597e usbuis/usbuiqt/usbapplication.pro --- a/usbuis/usbuiqt/usbapplication.pro Mon Jun 21 22:40:15 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 " \ - "rom/usbsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(usbsettings.iby)" \ - "rom/usbsettingsresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(usbsettingsresources.iby)"