# HG changeset patch # User William Roberts # Date 1279812814 -3600 # Node ID 59ea2209bb674d9be24627e130bd42c2a20ca3b0 # Parent 08cc4cc059d4de2f08a612bb59608a9b2cd6c79a# Parent a92d00fca57452e69635b25973594b91d44e6355 Catchup to latest Symbian^4 diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/bwins/btprotocolu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/bwins/btprotocolu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - ??1CBtPrinterController@@UAE@XZ @ 2 NONAME ; CBtPrinterController::~CBtPrinterController(void) - ??1CBtJobChannel@@UAE@XZ @ 3 NONAME ; CBtJobChannel::~CBtJobChannel(void) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/01007779.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/01007779.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - -// Declares info for BtProtocol -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x01007779; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x10208A1E; - implementations = - { - // Info for BtProtocol - IMPLEMENTATION_INFO - { - implementation_uid = 0x10208A21; - version_no = 1; - display_name = "BtProtocol"; - default_data = "BtProtocol"; - opaque_data = ""; - } - }; - } - }; - } diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/btprotocol.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/btprotocol.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +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 "imageprint.rh" -#include "printcapabilitycodes.h" - -enum PrinterClass // should come from ImgPrintKonst.h -{ - EDefault = 0, - EBigAdaptive = 1, - ESmallAdaptive = 2, - EDesk = 3, - EOPP = 4, - ELinked = 99 -}; - -RESOURCE RS_CAPABILITIES bt_Capabilities -{ - capabilities = - { - RS_CAPABILITY - { - printerclass=EDefault; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSize4x6; - low=0; - high=0; - enumcodes={ - EPrintCapabPaperSizeLetter,1, - EPrintCapabPaperSizeA4,1, - EPrintCapabPaperSize5x7,4, - EPrintCapabPaperSizeA6,4, - EPrintCapabPaperSize4x6,4, - EPrintCapabPaperSizeSticker,5 - }; - linkid=0; - }, - RS_CAPABILITY - { - printerclass=EBigAdaptive; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSize4x6; - low=0; - high=0; - enumcodes={ - EPrintCapabPaperSizeLetter,1, - EPrintCapabPaperSizeA4,1, - EPrintCapabPaperSize5x7,2, - EPrintCapabPaperSizeA6,2, - EPrintCapabPaperSize4x6,2, - EPrintCapabPaperSizeSticker,5 - }; - linkid=0; - }, - RS_CAPABILITY - { - printerclass=ESmallAdaptive; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSize4x6; - low=0; - high=0; - enumcodes={ - EPrintCapabPaperSizeA6,2, - EPrintCapabPaperSize4x6,2, - EPrintCapabPaperSizeSticker,5 - }; - linkid=0; - }, - RS_CAPABILITY - { - printerclass=EDesk; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSize4x6; - low=0; - high=0; - enumcodes={ - EPrintCapabPaperSizeLetter,1, - EPrintCapabPaperSizeA4,1, - EPrintCapabPaperSize5x7,4, - EPrintCapabPaperSizeA6,3, - EPrintCapabPaperSize4x6,3, - EPrintCapabPaperSizeSticker,5 - }; - linkid=0; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpBorderless; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpBorderless,0, - EPrintCapabLayout1Up,0, - EPrintCapabLayout2Up,0, - EPrintCapabLayout4Up,0, - EPrintCapabLayout12Up,0 - }; - linkid=1; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpBorderless; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpBorderless,0, - EPrintCapabLayout1UpBorder,0, - EPrintCapabLayout2Up,0, - EPrintCapabLayout4Up,0, - EPrintCapabLayout12Up,0 - }; - linkid=2; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpBorderless; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpBorderless,0, - EPrintCapabLayout1UpBorder,0, - EPrintCapabLayout12Up,0 - }; - linkid=3; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpBorderless; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpBorderless,0, - EPrintCapabLayout1UpBorder,0, - EPrintCapabLayout2Up,0, - EPrintCapabLayout4Up,0, - EPrintCapabLayout12Up,0 - }; - linkid=4; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpStick; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpStick,0, - EPrintCapabLayout4UpStick,0, - EPrintCapabLayout16UpStick,0 - }; - linkid=5; - }, - RS_CAPABILITY - { - printerclass=ELinked; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpBorderless; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpBorderless,0 - }; - linkid=10; - }, - RS_CAPABILITY - { - printerclass=EOPP; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSizeAuto; - low=0; - high=0; - enumcodes={ - EPrintCapabPaperSizeAuto,10 - }; - linkid=0; - } - }; -} - -//End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/btxmltemplate.txt --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/data/btxmltemplate.txt Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -CONTENT-LENGTH: [BytesInBody] -CONTENT-TYPE: text/xml; charset="utf-8" -CONTENT-LANGUAGE: en-US -SOAPACTION: "urn:schemas-bluetooth-org:service:Printer:1#[Action]" - - - - - - [ActionData] - - - - - \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/eabi/btprotocolu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/eabi/btprotocolu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZTI10CBtOnQuery @ 2 NONAME ; ## - _ZTI16CBtPasswordQuery @ 3 NONAME ; ## - _ZTI17CBtPrintingDevice @ 4 NONAME ; ## - _ZTI19CBTAttribValVisitor @ 5 NONAME ; ## - _ZTI8CBtTimer @ 6 NONAME ; ## - _ZTV10CBtOnQuery @ 7 NONAME ; ## - _ZTV16CBtPasswordQuery @ 8 NONAME ; ## - _ZTV17CBtPrintingDevice @ 9 NONAME ; ## - _ZTV19CBTAttribValVisitor @ 10 NONAME ; ## - _ZTV8CBtTimer @ 11 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/group/bld.inf --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -btprotocol.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/group/btprotocol.mmp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/group/btprotocol.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "../../../inc/logdef.h" - -deffile btprotocol.def - -TARGET btprotocol.dll -TARGETTYPE PLUGIN -CAPABILITY CAP_ECOM_PLUGIN - -UID 0x10009D8D 0x01007779 - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc - -USERINCLUDE ../inc -USERINCLUDE ../../xhtmlfilecomposer/inc -USERINCLUDE ../../../ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintServer/inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../../clog/inc - -SOURCEPATH ../src - -SOURCE cbtprintingdevice.cpp -SOURCE crsbtdiscoverengine.cpp -SOURCE cbtdiscover.cpp -SOURCE crsbtdevice.cpp -SOURCE cbtdevicecontainer.cpp -SOURCE rsutils.cpp -SOURCE cprintjob.cpp -SOURCE main.cpp -SOURCE cbttimer.cpp -SOURCE cbtsoapcodec.cpp -SOURCE cxmlhandler.cpp -SOURCE cbtprintercontroller.cpp -SOURCE cbtobjectserver.cpp -SOURCE cbtsdpadvertiser.cpp -SOURCE cbtdprserviceadvertiser.cpp -SOURCE cbtjobchannel.cpp -SOURCE cbtstatuschannel.cpp -SOURCE cbtchannelbase.cpp -SOURCE cbtonquery.cpp -SOURCE cbtpasswordquery.cpp - -START RESOURCE ../data/01007779.rss -TARGET btprotocol.rsc -END - -START RESOURCE ../data/btprotocol.rss -HEADER -TARGET btprotocol.rsc -TARGETPATH resource/imageprintdata/protocols -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY bluetooth.lib -LIBRARY esock.lib -LIBRARY irobex.lib -LIBRARY estor.lib -LIBRARY sdpdatabase.lib -LIBRARY btdevice.lib -LIBRARY sdpagent.lib -LIBRARY btextnotifiers.lib -LIBRARY efsrv.lib -LIBRARY charconv.lib -LIBRARY bafl.lib -LIBRARY hal.lib -LIBRARY platformenv.lib -LIBRARY estlib.lib -LIBRARY ecom.lib -LIBRARY xhtmlfilecomposer.lib -LIBRARY centralrepository.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/btprotocolconsts.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/btprotocolconsts.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +0,0 @@ -/* -* Copyright (c) 2004-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 BTPROTOCOLCONSTS_H -#define BTPROTOCOLCONSTS_H - -#include - -//////////////////////////////////////////////////////////////////////////////////////// -// -// Obex header HI values from http://www.it.lut.fi/~doc/bluetooth/OBEX12.pdf -// -//////////////////////////////////////////////////////////////////////////////////////// -const TUint KBtObexHeaderHiCount = 0xC0; //Number of objects (used by Connect) -const TUint KBtObexHeaderHiName = 0x01; //name of the object (often a file name) -const TUint KBtObexHeaderHiType = 0x42; //type of object - e.g. text, html, binary, manufacturer specific -const TUint KBtObexHeaderHiLength = 0xC3; //the length of the object in bytes -const TUint KBtObexHeaderHiTimeIso = 0x44; //date/time stamp – ISO 8601 version - preferred -const TUint KBtObexHeaderHiTime4B = 0xC4; //date/time stamp – 4 byte version (for compatibility only) -const TUint KBtObexHeaderHiDescription = 0x05; //text description of the object -const TUint KBtObexHeaderHiTarget = 0x46; //name of service that operation is targeted to -const TUint KBtObexHeaderHiHTTP = 0x47; //an HTTP 1.x header -const TUint KBtObexHeaderHiBody = 0x48; //a chunk of the object body. -const TUint KBtObexHeaderHiEnd = 0x49; //of Body -const TUint KBtObexHeaderHiWho = 0x4A; //identifies the OBEX application, used to tell if talking to a peer -const TUint KBtObexHeaderHiConnectionId = 0xCB; //an identifier used for OBEX connection multiplexing -const TUint KBtObexHeaderHiAppParameters = 0x4C; //extended application request & response information -const TUint KBtObexHeaderHiAuthChallenge = 0x4D; //authentication digest-challenge -const TUint KBtObexHeaderHiAuthResponse = 0x4E; //authentication digest-response -const TUint KBtObexHeaderHiObjectClass = 0x4F; //OBEX Object class of object -// Reserved = 0x10 to 0x2F //this range includes all combinations of the upper 2 bits -// User Defined = 0x30 to 0x3F //this range includes all combinations of the upper 2 bits - -// Obex tag values -const TUint KBtObexTagOffset = 0x01; -const TUint KBtObexTagCount = 0x02; -const TUint KBtObexTagJobId = 0x03; -const TUint KBtObexTagSize = 0x04; - -// Obex tag lengths in bytes -const TUint KBtDataLength4 = 0x04; //Length of I4 = 4 bytes integer -const TUint KBtTripletLength = 6; //Length of tag + length + data = 1 + 1 + 4 - - -//////////////////////////////////////////////////////////////////////////////////////// -// -// Mime types -// -//////////////////////////////////////////////////////////////////////////////////////// -_LIT8(KBtMimeTypeSoap, "x-obex/bt-SOAP"); -_LIT8(KBtMimeTypeXhtml, "application/vnd.pwg-xhtml-print+xml\0"); //"application/xhtml+xml"); -_LIT8(KBtMimeTypeReferenced, "x-obex/referencedobject"); -_LIT8(KBtMimeTypeJpeg, "image/jpeg"); -_LIT8(KBtMimeAnyImg, "image/*" ); - -//////////////////////////////////////////////////////////////////////////////////////// -// -// Obex constants -// -// According to http://www.bluetooth.org/assigned-numbers/baseband.htm -// these should be the correct numbers, however the Series 60 -// implementation of Bluetooth uses the numbers as below -// -//////////////////////////////////////////////////////////////////////////////////////// -//#define KBTMjrDevClassImaging 0x6 -//#define KBTMinDevClassPrinter 0x80 -//#define KBTMjrSvcClassRendering 0x20 -//#define KBTMjrSvcClassObjectTransfer 0x80 - -/** If the Major Device Class includes Imaging, the discovered Bluetooth device MAY be a BPP printer. */ -#define KBTMjrDevClassImaging 0x600 -/** If the Minor Device Class includes Printing, the discovered Bluetooth device is LIKELY a BPP printer. */ -#define KBTMinDevClassPrinter 0x20 -/** If the Major Service Class does not include Rendering, the discovered Bluetooth device is NOT a BPP printer. */ -#define KBTMjrSvcClassRendering 0x200000 -/** If the Major Service Class includes ObjectTransfer, the discovered Bluetooth device is NOT a BPP printer. */ -#define KBTMjrSvcClassObjectTransfer 0x800000 - -/** Nokia 6600: If the Major Device Class includes Imaging, the discovered Bluetooth device MAY be a BPP printer. */ -#define KBTMjrDevClassImaging_V2 0x600 -/** Nokia 6600: If the Minor Device Class includes Printing, the discovered Bluetooth device is LIKELY a BPP printer. */ -#define KBTMinDevClassPrinter_V2 0x80 -/** Nokia 6600: If the Major Service Class does not include Rendering, the discovered Bluetooth device is NOT a BPP printer. */ -#define KBTMjrSvcClassRendering_V2 0x40000 -/** Nokia 6600: If the Major Service Class does not includes ObjectTransfer, the discovered Bluetooth device is NOT a BPP printer. */ -#define KBTMjrSvcClassObjectTransfer_V2 0x100000 - -/** If the Major Device Class includes Computer, the discovered Bluetooth device MAY support Object Transfer. */ -#define KBTMjrDevClassComputer 0x100 -/** The device is a Desktop Computer. */ -#define KBTMinDevClassDesktop 0x4 -/** The device is a Server Computer. */ -#define KBTMinDevClassServer 0x8 -/** The device is a Laptop Computer. */ -#define KBTMinDevClassLaptop 0xC - - -// According to https://www.bluetooth.org/foundry/assignnumb/document/service_discovery -/** UID for OBEX Object Push service in a Bluetooth device SDP query. Required for OPP. */ -#define KBTSDPOBEXObjectPush 0x1105 -/** UID for the BPP Direct Printing service in a Bluetooth device SDP query. Required for BPP. */ -#define KBTSDPDirectPrinting 0x1118 -/** UID for the BPP Reference Printing service in a Bluetooth device SDP query. Required for BPP. */ -#define KBTSDPReferencePrinting 0x1119 -/** UID for the BPP Direct Printing Reference Objects service in a Bluetooth device SDP advertise. Required for BPP. */ -#define KBTSDPDPROService 0x1120 -/** UID for the BPP Printing Status service in a Bluetooth device SDP advertise. Required for BPP. */ -#define KBTSDPPrintingStatus 0x1123 -/** UID for L2CAP in a Bluetooth device SDP query. Required for BPP. */ -#define KBTSDPL2CAP 0x0100 -/** UID for RFCOMM in a Bluetooth device SDP query. Required for BPP. */ -#define KBTSDPRFCOMM 0x0003 -/** UID for Object Exchange in a Bluetooth device SDP query. Required for BPP. */ -#define KBTSDPObex 0x0008 - -// Additions to universal attributes in btsdp.h -static const TSdpAttributeID KSdpAttrIdAdditionalProtocolDescriptorLists = 0x000D; -static const TSdpAttributeID KSdpAttrIdDocFormatsSupported = 0x0350; -static const TSdpAttributeID KSdpAttrIdModelID = 0x0358; -static const TSdpAttributeID KSdpAttrIdMaxWidth = 0x0362; -static const TSdpAttributeID KSdpAttrIdMaxLen = 0x0364; -static const TSdpAttributeID KSdpAttrIdAllDone = 0xFFFFFF; -// own constants for UID bitmask -static const TUint KBtMaskRFCOMM = 0; -static const TUint KBtMaskL2CAP = 1; -static const TUint KBtMaskObex = 2; -static const TUint KBtMaskObjectPush = 4; -static const TUint KBtMaskDirectPrinting = 8; -static const TUint KBtMaskPrintingStatus = 16; -static const TUint KBtMaskROService = 32; - -static const TUint KBtMaskObexLevel = KBtMaskRFCOMM | KBtMaskL2CAP | KBtMaskObex; - - -//////////////////////////////////////////////////////////////////////////////////////// -// -// Obex server constants -// -//////////////////////////////////////////////////////////////////////////////////////// -const TUint KRfcommChannel = 1; -const TUint KServiceClass = 0x01007779; // Own UID - -_LIT( KServiceName,"DirectPrintingReferenceObjectsService" ); -_LIT( KServiceDescription,"Direct Printing Reference Objects Service" ); - -// Used by ObexFileServerImpl.h -const TInt KSimultainousSocketsOpen = 8; - -//////////////////////////////////////////////////////////////////////////////////////// -// -// Misc -// -//////////////////////////////////////////////////////////////////////////////////////// -const TInt KPendingLimit = 6; // 6 x 5 sec = 30 sec total to wait answer to request from printer -const TInt KOppPendingLimit = 24; // 24 X 5 sec = 120 sec total to wait opp printing. -// to get local BT name from central repository -const TUid KCRUidBluetoothLocalNameSettings = {0x10204DAC}; -const TUint32 KBTLocalName = 0x00000001; - -/** XHTML file name*/ -_LIT(KXHTMLFileName, "c:\\system\\data\\xhtml\\Bt_Print_%d.xhtml"); -_LIT8(KXHTMLFileName8, "c:\\system\\data\\xhtml\\Bt_Print_%d.xhtml"); - -/* Time out value for OBEX commands = 20 second */ -const TInt KObexCmdTimeOut = 20000000; - -#endif // BTPROTOCOLCONSTS_H - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtchannelbase.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtchannelbase.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtChannelBase class. -* -*/ - - -#ifndef CBTCHANNELBASE_H -#define CBTCHANNELBASE_H - -#include -#include -#include -#include -#include -#include - -#include "crsbtdiscoverengine.h" -#include "tprintcapability.h" -#include "mbtpcobserver.h" -#include "cbtobjectserver.h" -#include "cprintjob.h" -#include "mconfirmationnotify.h" -#include "cbtpasswordquery.h" - -class CBtSoapCodec; -class CObexBufObject; -class CObexClient; -class CObexFileObject; - -/** -* @class CBtChannelBase -* @brief A base class to implement CObexClient use. -* -* This class implements the common methods used for connecting and -* communicating with device via CObexClient using either BPP job based -* printing or OPP simple push. -*/ -NONSHARABLE_CLASS(CBtChannelBase) : public CActive, public MObexAuthChallengeHandler, public MConfirmationNotify - { - public: - - /** ~CBtChannelBase - * @brief Destructor. - */ - virtual ~CBtChannelBase(); - - /** StartL - * @brief Synchronized method to start communication with device. - * Method clears former connections and connects to the device given. - * @param aDevice Device to connect - */ - virtual void StartL( CRsBtDevice& aDevice ); - - /** Stop - * @brief Clears connection. - * Device is disconnected and the channel (CObexClient) is deleted. - */ - virtual void Stop(); - - /** IsConnected - * @brief Checks wether the channel is connected or not. - * @return ETrue if connected, EFalse otherway. - */ - virtual TBool IsConnected(); - - /** Disconnect - * @brief Method to disconnect channel. - */ - virtual void Disconnect(); - - /** FinishPrinting - * @brief Finishes all printing operations started and stops the connection. - */ - virtual void FinishPrinting(); - - /** SetDevice - * @brief Sets the default device. - * @param aDevice Device to set as default - */ - void SetDevice( CRsBtDevice& aDevice ); - - /** Device - * @brief Gets the default device. - * @return Reference to default device. - */ - const CRsBtDevice& Device() const; - - /** JobId - * @brief Gets the default job id. - * @param aId Job id to set as default. - */ - void SetJobId( TInt aId ); - - /** JobId - * @brief Gets the default job id. - * @return Default job id. - */ - TInt JobId() const; - - public: - /** GetUserPasswordL - * @brief Gets the Obex password. - * @return Contain the Realm specified by the unit forcing the Authentication. - */ - virtual void GetUserPasswordL( const TDesC &aRealm ); - - void PasswordQueryCompleteL ( TObexPasskeyBuf aResultPckg ); - - protected: - - /** CBtChannelBase - * @brief C++ constructor - * @param Observer to call back about received feed back or occured errors. - */ - CBtChannelBase(MBtPCObserver& aObs); - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - // =============================== - // From CActive. - // =============================== - virtual void DoCancel(); - virtual TInt RunError(TInt aError) = 0; - - /** ConnectL - * @brief Pure virtual method for CObexClient connection. - */ - virtual void ConnectL() = 0; - - /** TControlState - * @brief Operation states in derived classes. - */ - enum TControlState - { - EStateNone = 0, - - EStateConnecting, - EStateDisconnecting, - EStateGettingCapabilities, - EStateGettingPrinterState, - EStateCreatingJob, - - EStateCancellingJob, - EStateSendingDocument, - EStateSendingXhtml, - EStateSendingOPP, - EStateGettingJobAttributes, - - EStateGetEvent, - EStateGettingEvent, - EStateFinish - }; - - - /** GetSoapResponseL - * @brief Gets Soap response and parses the action name - * @return Soap action ID (TBtSoapActions) - */ - virtual TInt GetSoapResponseL(); - - /** SendSoapRequestL - * @brief Operates Soap Action - */ - virtual void SendSoapRequestL(const TInt aRequest, const TInt aJobId = KErrNotFound); - /// @brief Overwrites SendSoapRequestL - virtual void SendSoapRequestL(const TInt aRequest, TRequestStatus& aStatus, - const TInt aJobId = KErrNotFound); - - /** CompleteRequest - * @brief Completes pending request - */ - void CompleteRequest(TControlState aStateCompleted, TInt aError = KErrNone); - - /** Activate - * @brief Activates object if not already active - */ - virtual void Activate(); - - /** ClearConnection - * @brief Disconnects and deletes the connection. - * In case of pending request, calls Abort for CObexClient. - */ - virtual void ClearConnection(); - - /** WaitL - * @brief Sets the object to wait request to complete if not already waiting. - */ - void WaitL(); - - /** StopWaiting - * @brief Stops the object waiting request to complete if waiting. - */ - void StopWaiting(); - - /** DeleteChannel - * @brief Deletes the channel and initializes it. - */ - void DeleteChannel(); - - protected: - - /** @var MBtPCObserver& iObs - * Observer to call back about received feed back or occured errors. */ - MBtPCObserver& iObs; - - /** @var TControlState iState - * Internal container for current operation state. */ - TControlState iState; - - /** @var TInt iJobId - * Current job id. */ - TInt iJobId; - - /** @var CObexClient* iChannel - * Channel to communicate with device over bluetooth. */ - CObexClient* iChannel; - - /** @var CBtSoapCodec* iSoapCodec - * Helper class to codec and manage SOAP messages. */ - CBtSoapCodec* iSoapCodec; - - /** @var CObexBufObject* iObexBufObject - * OBEX data object, type of 'buffer'. */ - CObexBufObject* iObexBufObject; - - /** @var CObexNullObject* iObexNullObject - * Empty OBEX object for connecting. */ - CObexNullObject* iObexNullObject; - - /** @var CBufBase* iObexBody - * Body of the OBEX data object. */ - CBufBase* iObexBody; - - /** @var CRsBtDevice* iDevice - * The device to communicate with. */ - CRsBtDevice* iDevice; - - /** @var CActiveSchedulerWait* iWait - * Active scheduler wait object for nested scheduler loops. */ - CActiveSchedulerWait* iWait; - - /** @var TInt iResponseError - * Member to maintain errors occured during phases of synchronized calls. */ - TInt iResponseError; - - /** @var TBool iStop - * Flag to indicate the processing shall or is about to stop. */ - TBool iStop; - - CBtPasswordQuery* iPasswordQuery; - - TBTObexPasskey iPckg; // Input parameters - }; - -#endif // CBTCHANNELBASE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdevicecontainer.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdevicecontainer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTDEVICECONTAINER_H -#define CBTDEVICECONTAINER_H - -#include -#include -#include - -class CRsBtDevice; - -/** - * \brief Brief Description - * - * Detailed Description - */ -NONSHARABLE_CLASS(CBtDeviceContainer) : public CBase - { - public: - void StoreL(); - void RestoreL(); - void AppendL( CRsBtDevice* aDevice ); - TInt Delete( const TInt aDeviceId ); // returns the position in array or KErrNotFound - TInt Delete( const CRsBtDevice &aDevice ); // returns the position in array or KErrNotFound - TInt Find( const CRsBtDevice &aDevice, TInt aInitIndex = -1 ) const; - TInt Find( const TInt aDeviceId, TInt aInitIndex = -1 ) const; - TInt Count() const; - CRsBtDevice* At(TInt aPosition) const; - static CBtDeviceContainer* NewL(); - ~CBtDeviceContainer(); - void Reset(); - - private: - - enum - { - ETimeLastUsed = 1, - ETimeDiscovered = 2, - EUsed = 4, - ENotUsed = 8 - }; - - TInt FindOldest(TUint aFlags) const; - void ExternalizeL(RWriteStream& aStream) const; - void InternalizeL(RReadStream& aStream); - void ConstructL(); - CBtDeviceContainer(); - TInt GetAvailableId( const CRsBtDevice& aDevice ); - TBool IsIdAvailable( TInt aId ) const; - - private: - - TInt iVersion; - RPointerArray iDeviceArray; - TFileName iDataFolder; - TInt iCurrentId; - RFs iFs; - }; - -#endif // CBTDEVICECONTAINER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdiscover.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdiscover.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CBtDiscover class definition. Bluetooth device discovery and SDP. -* -*/ - - -#ifndef CBTDISCOVER_H -#define CBTDISCOVER_H - -#include -#include -#include -#include - -#include "e32base.h" -#include "tprinter.h" -#include "btprotocolconsts.h" - -/** - * \brief Implements Bluetooth device discovery and SDP. - * - * Implements Bluetooth device discovery and Service Discovery Protocol (SDP). - * Uses the low-level Symbian interfaces for doing a Bluetooth device discovery, - * allowing for more flexibility with the user interface. Results of the device discovery and - * SDP request are stored in private variables until extracted by CRsBTDiscoverEngine - * which owns the only instance of this class, and directs the asynchronous functionality. - * \sa CRsBtDiscoverEngine - */ -NONSHARABLE_CLASS(CBtDiscover) : public CBase, public MSdpAgentNotifier - { - public: - - static CBtDiscover* NewL(); - - virtual ~CBtDiscover(); - - void Start(TRequestStatus& aStatus); - void Stop(); - void Reset(); - - TBool IsDoingSDP() const; - TBool IsFindingDevices() const; - TBool IsBPPSupported() const; - TBool IsOPPSupported() const; - - void StopSDP(); - - void GetNextDevice(TRequestStatus &aStatus); - void GetSupportedServicesL(TRequestStatus &aStatus, TUint32 aServiceMask = -1); - - TBool SupportsContentType(const TDesC &aContType) const; - void SetContentTypesL(const TPtrC8 &aString); - - void SetPrinterModelL(const TPtrC8 &aString); - const TDesC& GetPrinterModel() const; - - void SetNameRecord(TNameRecord aNameRecord); - TNameRecord GetNameRecord() const; - - const TDesC& GetDeviceName() const; - TBTDeviceClass GetDeviceClass() const; - - TInt GetBPPPort() const; - void SetBPPPort(TInt aPort); - TInt GetSTSPort() const; - void SetSTSPort(TInt aPort); - TInt GetOPPPort() const; - void SetOPPPort(TInt aPort); - - void SetVendor( TPrinter::TPrinterVendor aVendor ); - TPrinter::TPrinterVendor GetVendor() const; - - public: // From MSdpAgentNotifier - - void AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError); - void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount); - void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue); - - private: - CBtDiscover(); - void ConstructL(); - - void StartSDPL(); - void AttributeRequestResultL( TSdpAttributeID aAttrID, CSdpAttrValue* aValue ); - void GetNextAttributeL(TSdpServRecordHandle aHandle); - - public: - TSdpAttributeID iCurrentSDPAttrID; - TUint iCurrentServiceUUID; - TBool iFoundSTS; - TBool iWantedService; - - private: - // internal flags - // operation flags - TBool iDoingSDP; - TBool iFindingDevices; - - CSdpAgent* iAgent; - - TRequestStatus *iRequestStatus; - - CSdpSearchPattern* iSdpSearchPattern; - CSdpAttrIdMatchList* iMatchList; - - HBufC* iContentTypes; - - RSocketServ iSocketServ; - RHostResolver iHostResolver; - - // device data - TNameEntry iNameEntry; - TInquirySockAddr iSockAddr; - HBufC* iPrinterModel; - TPrinter::TPrinterVendor iVendor; - TInt iBPPPort; - TInt iSTSPort; - TInt iOPPPort; - }; - - -/** - * \brief Enumerate the values in a SDP response attribute list. - * - * Used to parse attributes from the structured data returned by a Bluetooth - * Service Discovery Protocol request. - */ -class CBTAttribValVisitor : public CBase, public MSdpAttributeValueVisitor - { - public: - static CBTAttribValVisitor* NewLC( CBtDiscover& aDiscover ); - ~CBTAttribValVisitor(); - - public: // from MSdpAttributeValueVisitor - void VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType); - void StartListL(CSdpAttrValueList& aList); - void EndListL(); - - private: - CBTAttribValVisitor( CBtDiscover& aDiscover ); - void CheckUuid( const TUUID& aUuid ); - void CheckUint( const TUint& aValue ); - void CheckVendor( const TDesC8& aVendor ); - - private: - CBtDiscover& iDiscover; - }; - -#endif // CBTDISCOVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdprserviceadvertiser.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtdprserviceadvertiser.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTDPRSERVICEADVERTISER_H -#define CBTDPRSERVICEADVERTISER_H - -// INCLUDES -#include -#include -#include - -#include "cbtsdpadvertiser.h" - -// CLASS DECLARATIONS -/** -* CBtDprServiceAdvertiser -* Advertises the Direct Printing Referenced Object OBEX service using the SDP database. -*/ -NONSHARABLE_CLASS(CBtDprServiceAdvertiser) : public CBtSdpAdvertiser - { - public: //Constructors and destructor - - /** - * NewL() - * Create a CObjectExchangeServiceAdvertiser object - * @return a pointer to the created instance of - * CObjectExchangeServiceAdvertiser - */ - static CBtDprServiceAdvertiser* NewL(); - - /** - * NewLC() - * Create a CObjectExchangeServiceAdvertiser object - * @return a pointer to the created instance of - * CObjectExchangeServiceAdvertiser - */ - static CBtDprServiceAdvertiser* NewLC(); - - /** - * ~CObjectExchangeServiceAdvertiser() - * Destroy the object and release all memory objects - */ - virtual ~CBtDprServiceAdvertiser(); - - protected: // from CBTServiceAdvertiser - - /** - * BuildProtocolDescriptionL() - * Builds the protocol description - * @param aProtocolDescriptor the protocol descriptor - * @param aPort the service port - */ - void BuildProtocolDescriptionL( CSdpAttrValueDES* - aProtocolDescriptor, TInt aPort ); - - /** - * ServiceClass() - * @return the service class - */ - TUint ServiceClass(); - - /** - * ServiceName() - * @return the service name - */ - const TDesC& ServiceName(); - - /** - * ServiceDescription() - * @return the service description - */ - const TDesC& ServiceDescription(); - - private: // Constructors - - /** - * CObjectExchangeServiceAdvertiser() - * Constructs this object - */ - CBtDprServiceAdvertiser(); - - /** - * ConstructL() - * Perform the second phase construction of a - * CObjectExchangeServiceAdvertiser object - */ - void ConstructL(); - - private: // Data - - /** - * iserviceDescription, - * Owned by CObjectExchangeServiceAdvertiser. - */ - HBufC* iServiceDescription; - - }; - -#endif // CBTDPRSERVICEADVERTISER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtjobchannel.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtjobchannel.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTJOBCHANNEL_H -#define CBTJOBCHANNEL_H - -#include -#include -#include - -#include "tprintcapability.h" -#include "cbtchannelbase.h" -#include "cprintjob.h" - -class CBtStatusChannel; -class CObexFileObject; - -const TInt KProgressUpdateInterval = 1000000; - -/** -* @class CBtJobChannel -* @brief -* -*/ -NONSHARABLE_CLASS(CBtJobChannel) : public CBtChannelBase, public MBtTimerObserver - { - public: - - /** NewL - * @brief Creates a new instance of XHTML file composer. - * @return Pointer to the instance. - */ - static CBtJobChannel* NewL(MBtPCObserver& aObs); - - /** NewLC - * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. - * @return Pointer to the instance. - */ - static CBtJobChannel* NewLC(MBtPCObserver& aObs); - - /** ~CBtJobChannel - * @brief Destructor. - */ - IMPORT_C ~CBtJobChannel(); - - /** GetCapabilitiesL - * @brief Method to get printer capabilities. - * - * Actually this method gets printer attributes, but this is synchronous - * method to get only capabilities, not all capabilities. - */ - void GetCapabilitiesL(CRsBtDevice& aDevice); - - /** CreateJob - * @brief - */ - void CreateJobL(CPrintJob& aJob); - - TInt GetPercentSent(); - - /** GetJobAttributes - * @brief - */ - void GetPrinterStateL(); - - /** GetJobAttributes - * @brief - */ - void GetJobAttributesL(TInt aJobId); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aJobId Print job ID of cancelled job. - */ - void CancelJobL(TInt aJobId ); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aJobId Print job ID of cancelled job. - */ - void GetEventL(TInt aJobId); - - /** FinishPrinting - * @brief Finish all printing operations started - */ - - public: // from MBtTimerObserver - void HandleTimeoutL(); - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - virtual void RunL(); - virtual void DoCancel(); - virtual TInt RunError(TInt aError); - - private: - - /** CBtJobChannel - * @brief C++ constructor - */ - CBtJobChannel(MBtPCObserver& aObs); - - void ConnectL(); - void ClearConnection(); - void CleanXhtmlDirL(); - - TInt CreateJobResponseL(); - TInt GetPrinterStateResponseL(); - TInt GetPrinterCapabilitiesResponseL(); - TInt GetJobAttributesResponseL(); - TInt CancelJobResponseL(); - TInt GetEventResponseL(); - - void SendOPPL(); - void SendXhtmlDocumentL(); - - void DoLeaveL(TInt aError); - - /* - * Removes timeout from OBEX commands. - * */ - void RemoveObexCmdTimeOut(); - - /* - * Callback function of CPeriodic. - * */ - static TInt CheckProgress( TAny *aObj ); - - /* - * Calculates and returns size of current print job. - * */ - TInt CBtJobChannel::CalculateJobSizeL(); - - /* - * Updates progress bar. - * */ - void UpdateProgress(); - - - private: - - TFileName8 iJobFile; - TInt iJobFileNum; - RArray iImageList; - TInt iImageCount; - TInt iFileObjectSize; - - CObexFileObject* iObexFileObject; - - TInt iPercents; - - CBtTimer* iTimer; - CBtStatusChannel* iStatusChannel; - - // Periodic timer to update image sending progress. - CPeriodic *iUpdateProgress; - - TInt iJobSize; // Size of printing job. - TInt iProgressOfFullImages; // Size of full images this far. - }; - -#endif // CBTJOBCHANNEL_H - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtobjectserver.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtobjectserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTOBJECTSERVER_H -#define CBTOBJECTSERVER_H - -#include -#include -#include -#include - -#include "cxhtmlfilecomposer.h" -#include "btprotocolconsts.h" -#include "cbtdprserviceadvertiser.h" - - -/** -* MBtObjectServerObserver -* -* @brief Interface to observe bluetooth object server's state -*/ -class MBtObjectServerObserver -{ - public: - enum TStatusMessages - { - KObjectServerPackageSent = 10, ///@brief a requested chunk of data sent - KObjectServerFileSent, ///@brief a requested file sent - KObjectServerAllFilesSent, ///@brief not used... cannot know when done! - KObjectServerStopped, ///@brief server stopped - KObjectServerStarted, ///@brief server started - KObjectServerBTDeviceMismatch, ///@brief remote device isn't correct - KObjectServerConnected, ///@brief remote device connected - KObjectServerDisconnected, ///@brief remote device disconnected - KObjectServerTransportUp, ///@brief transportation up with remote device - KObjectServerTransportDown, ///@brief transportation down with remote device - KObjectServerError ///@brief Error indication for any occured error - }; - - public: - - /** - * OperationStatus - * - * A callback function to observe bluetooth object server's state - * @param aStatus TStatusMessages status or error code occured - * @param aInfo Explaining information of the status - */ - virtual void HandleObjectServerEvent(TInt aStatus, TInt aInfo = 0) = 0; -}; -/*! - @class CBtObjectServer - - @discussion An instance of the Obex File Server object for the obexfileserver - example application - */ -NONSHARABLE_CLASS(CBtObjectServer) : public CBase, public MObexServerNotify -{ - public: - - /** - * NewL() - * Construct a CBtObjectServer - * @param aDevice Device (printer) which should be contacted over Bluetooth - * @param aImgArray Images that will be sent over OBEX (if printer asks them) - * @return a pointer to the created instance of CBtObjectServer - */ - static CBtObjectServer* NewL(const TBTDevAddr& aDeviceAddress, RArray &aImgArray, MBtObjectServerObserver& aObs); - - /** - * NewLC() - * Construct a CBtObjectServer - * @param aDevice Device which should be contacted over Bluetooth - * @param aImgArray Images that will be sent over OBEX (if printer asks them) - * @return a pointer to the created instance of CBtObjectServer - */ - static CBtObjectServer* NewLC(const TBTDevAddr& aDeviceAddress, RArray &aImgArray, MBtObjectServerObserver& aObs); - - /** - * ~CBtObjectServer() - * Destructor for the class - */ - ~CBtObjectServer(); - - /** - * CreateObexObject() - * For creating an OBEX object that will be send through bluetooth - */ - CObexBufObject* CreateObexObjectL(const TDesC& aUri); - - /** - * StartL() - * Starts the server - */ - void StartL(); - - /** - * Stop() - * Stops the server - */ - void Stop(); - - /** - * Cancel() - * For stopping server action nicely - will continue to send the current file to - * the BT device - */ - void Cancel(); - - - /** - * IsConnected() - * @return ETrue if the server is connected. - */ - TBool IsConnected(); - - /** - * IsTransporting() - * @return ETrue if the transport connection is up. - */ - TBool IsTransporting(); - - /** - * IsSendingData() - * @return ETrue if the server is sending data to a Bluetooth device - */ - TBool IsSendingData(); - - /** - * IsFinished() - * @return ETrue if the server is finished and can be deleted - */ - TBool IsFinished(); - - protected: - - /** - * ConstructL() - * Method that constucts the classes possibly leaving parts - */ - void ConstructL( RArray &aImgArray ); - - - private: - - /** - * CBtObjectServer() - * @param aDevice Device (printer) which should be contacted over Bluetooth - * @param aImgArray Images that will be sent over OBEX (if printer asks them) - * Private constructor - */ - CBtObjectServer( const TBTDevAddr& aDeviceAddress, MBtObjectServerObserver& aObs ); - - /** - * InitialiseServerL - * Initialises the server - */ - void InitialiseServerL(); - - /** - * InitTransferData - * Initialises the data used to transfer and process a file - */ - void InitTransferData(); - - /** - * InitHeaderVariables - * Initialises the requested header data members - */ - void InitHeaderVariables(); - - TBool AllowConnection(); - - /** - * HandleGetRequestL - * Method to go through to trap leaves for GetRequestIndication - */ - CObexBufObject* HandleGetRequestL( CObexBaseObject* aRequestedObject ); - - void GetAppHeaderL(CObexBaseObject* aRequestedObject); - void GetDataSequenceL(const TFileName& aFileName, TInt& aFileSize); - void SetCompleted(); - - /** - * SetSecurityWithChannelL - * Sets the security on the channel port - * And returns the channel available. - * @param aAuthentication is authentication used - * @param aEncryption is encryption used - * @param aAuthorisation is authorisation used - * @param aDenied is denied used - * @return an available channel - */ - TInt SetSecurityWithChannelL ( TBool aAuthentication, - TBool aEncryption, - TBool aAuthorisation, - TBool aDenied ); - private: - - /** - * Following private methods implement the MObexServerNotify class - * - these methods (together with CObexServer) implement the observer - * for the OBEX data handling - * - Methods are called every time server receives something over the bluetooth - */ - - /** - * ErrorIndication - * Receive error indication - * @param aError the error code - */ - void ErrorIndication( TInt aError ); - - /** - * TransportUpIndication - * Called when the underlying socket transport connection is made from - * a remote client to the server - */ - void TransportUpIndication(); - - /** - * TransportDownIndication - * Transport connection is dropped - */ - void TransportDownIndication(); - - /** - * ObexConnectIndication - * Invoked when an OBEX connection is made from a remote client - * @param aRemoteInfo connection information supplied by - * the remote machine - * @param aInfo holds further information about the - * requested connection - * @return system wide error code - */ - TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, - const TDesC8& aInfo ); - - /** - * ObexDisconnectIndication - * OBEX server has been disconnected - * @param aInfo contains information about the disconnection - */ - void ObexDisconnectIndication( const TDesC8& aInfo ); - - /** - * PutRequestIndication - * @return the CObexBufObject in which to store - * the transferred object - */ - CObexBufObject* PutRequestIndication(); - - /** - * PutPacketIndication - * @return system wide error code - */ - TInt PutPacketIndication(); - - /** - * PutCompleteIndication - * @return system wide error code - */ - TInt PutCompleteIndication(); - - /** - * GetRequestIndication - * Called when a full get request has been received from the client - * @param aRequestedObject holds details about the requested object - * @return the CObexBufObject in which return to the client - */ - CObexBufObject* GetRequestIndication( CObexBaseObject* - aRequestedObject ); - - /** - * GetPacketIndication - * @return system wide error code - */ - TInt GetPacketIndication(); - - /** - * GetCompleteIndication - * @return system wide error code - */ - TInt GetCompleteIndication(); - - /** - * SetPathIndication - * @param aPathInfo the information received in a SETPATH command - * @return system wide error code - */ - TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo, - const TDesC8& aInfo ); - - /** - * AbortIndication - * Server has been aborted - */ - void AbortIndication(); - - /** - * End of the Obex Observer methods - * - */ - - private: - - /** - * State of the server - * Owned by CBtObjectServer - */ - enum TServerState - { - EStateDisconnected = 0, - EStateConnected, - EStateStop - }; - - /** - * Current operation of the server - * Owned by CBtObjectServer - */ - enum TServerOperation - { - ETerminating = 0, - ESending, - EIdle - }; - - /** - * The bluetooth device where the images will be sent - * Owned by CBtObjectServer - */ - const TBTDevAddr& iAllowedAddress; - - /** - * The bluetooth device requested the data - * Owned by CBtObjectServer - */ - TBTDevAddr iRemoteAddress; - - /** - * The images that will be printed if printer asks for them - * Owned by CBtObjectServer - */ - RArray iImgArray; - - MBtObjectServerObserver& iObs; - - /** - * iObexServer manages the OBEX client connection - * Owned by CBtObjectServer - */ - CObexServer* iObexServer; - - /** - * iObexBufData the raw data that has been transferred - * Owned by CBtObjectServer - */ - CBufFlat* iObexBody; - - /** - * iCurrObject the OBEX object that has been transferred - * Owned by CBtObjectServer - */ - CObexBufObject* iObexBufObject; - - /** - * iAdvertiser used to advertise this service - * Owned by CBtObjectServer - */ - CBtDprServiceAdvertiser* iAdvertiser; - - /** - * Current operation - */ - TServerOperation iOperation; - - RFs iFs; - - TBool iStarted; - TBool iConnected; - TBool iTransportUp; - - TUint iOffset; - TInt iCount; - TInt iSize; - TInt iProgress; // proggress in percents of currently printed file - -}; - -#endif // CBTOBJECTSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtonquery.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtonquery.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CBtOnQuery class definition. This Implementation is used to avoid -* User::WaitForRequest() function and ViewServer 11 panic when BT naming query is activated. -* -*/ - - -#ifndef BTONQUERY_H -#define BTONQUERY_H - -#include - -class MBTOnNotify; - -class CBtOnQuery : public CActive - { - public: // construction / destruction - - /** - * NewL() - * Create a CBtOnQuery object - * @param aNotify notifier to the calling object - * @return a pointer to the created instance of CBtOnQuery - */ - static CBtOnQuery* NewL( MBTOnNotify& aNotify ); - - /** - * NewLC() - * Create a CBtOnQuery object - * @param aNotify notifier to the calling object - * @return a pointer to the created instance of CBtOnQuery - */ - static CBtOnQuery* NewLC( MBTOnNotify& aNotify ); - - /** - * ~CBtOnQuery() - * Destroy the object and release all memory objects - */ - ~CBtOnQuery(); - - public: // new functions - - /** - * IsBluetoothOn() - * Starts this Active object - */ - void IsBluetoothOn(); - - protected: // from CActive - - /** - * RunL() - * Respond to an event - */ - void RunL(); - - /** - * RunError() - * Handles errors which is throwed by RunL() function - */ - void RunError(); - - /** - * DoCancel - * Cancel any outstanding requests - */ - void DoCancel(); - - protected: // construction - - /** - * CBtOnQuery() - * @param aNotify notifier to the calling object - */ - CBtOnQuery( MBTOnNotify& aNotify ); - - /** - * ConstructL() - * Standard second phase construction - */ - void ConstructL(); - - private: // data - MBTOnNotify &iNotify; - RNotifier iNotif; - TPckgBuf iResultPckg; - }; - -#endif // BTONQUERY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtpasswordquery.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtpasswordquery.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTPASSWORDQUERY_H -#define CBTPASSWORDQUERY_H - -#include -#include -#include - -#include "mconfirmationnotify.h" - -class CBtPasswordQuery : public CActive -{ -public: - - ~CBtPasswordQuery(); - - static CBtPasswordQuery* NewL( MConfirmationNotify& aNotify ); - - static CBtPasswordQuery* NewLC( MConfirmationNotify& aNotify ); - - void StartActiveObjectL (); - -protected: // from CActive - - void RunL(); - - void RunError(); - - void DoCancel(); - -protected: // construction - - CBtPasswordQuery(MConfirmationNotify& aNotify); - - void ConstructL(); - -private: - - MConfirmationNotify& iNotify; - - TBTObexPasskey iPckg; // Input parameters - - TObexPasskeyBuf iResultPckg; // Response - - RNotifier iNotifier; - -}; - -#endif // CBTPASSWORDQUERY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtprintercontroller.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtprintercontroller.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtPrinterController class. -* -*/ - - -#ifndef CBTPRINTERCONTROLLER_H -#define CBTPRINTERCONTROLLER_H - -#include -#include -#include - -#include "crsbtdiscoverengine.h" -#include "tprintcapability.h" -#include "mbtpcobserver.h" -#include "cbtobjectserver.h" -#include "cprintjob.h" -#include "cbtonquery.h" -#include "mbtonnotify.h" - -class CBtStatusChannel; -class CBtJobChannel; -class CBtSoapCodec; -class CObexBufObject; -class CObexClient; -class CObexFileObject; - -NONSHARABLE_CLASS( CBtPrinterController ) : public CBase, - public MBtDiscoveryObserver, - public MBtObjectServerObserver, - public MBTOnNotify - { - public: - - /** NewL - * @brief Creates a new instance of XHTML file composer. - * @return Pointer to the instance. - */ - static CBtPrinterController* NewL(MBtPCObserver& aObs); - - /** NewLC - * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. - * @return Pointer to the instance. - */ - static CBtPrinterController* NewLC(MBtPCObserver& aObs); - - void DeviceDiscovered(); - void DeviceDisappeared(); - - /** ~CBtPrinterController - * @brief Destructor. - */ - IMPORT_C ~CBtPrinterController(); - - TInt GetPercentSent(); - void CancelDiscovery(); - void Stop(); - TBool IsConnected(); - - /** GetCapabilitiesL - * @brief Method to get printer capabilities. - * - * Actually this method gets printer attributes, but this is synchronous - * method to get only capabilities, not all capabilities. - */ - void GetCapabilitiesL(CRsBtDevice& aDevice); - - /** GetPrinterStateL - * @brief - */ - void GetPrinterStateL(CRsBtDevice& aDevice); - - /** CreateJob - * @brief - */ - void CreateJobL(CRsBtDevice& aDevice, CPrintJob& aJob); - - /** GetJobAttributes - * @brief - */ - void GetJobAttributesL(CRsBtDevice& aDevice, TInt aJobId); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aJobId Print job ID of cancelled job. - */ - void CancelJobL( CRsBtDevice& aDevice, TInt aJobId ); - - /** GetEventL - * @brief - */ - void GetEventL(TInt aJobId); - - /** StartDiscoveryL - * @brief Starts discovering devices - */ - void StartDiscoveryL(TUint aProtocol); - - /** FinishPrinting - * @brief Finish all printing operations started - */ - void FinishPrinting(); - - public: // From MRsBtDiscoverEngineObserver - - /** - * @brief Get asynchronous notifications of Bluetooth device discovery or Service Discovery Protocol events. - * - * Possible values for aEvent are of type MRsBtDiscoverEngineObserver::TEvent: - * enum TEvent - * { - * EFoundBtPrinter, - * ERemoveBtPrinter, - * EDoneFindingPrinters, - * EErrorDuringDiscover, - * EErrorFindingDevice, - * EErrorVerifyingBt - * }; - * - * @param aEvent Event that occurred, of type MRsBtDiscoverEngineObserver::TEvent. - * @param aErrorCode If the event is an error, error code is sent here. - */ - void HandleDiscoveryEvent(TInt aEvent, TInt aErrorCode); - - public: // MBtObexServerObserver - - void HandleObjectServerEvent(TInt aStatus, TInt aInfo = 0); - - public: // MBTOnNotify - - void BTOnCompleteL( TBool aResult ); - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - private: - - /** CBtPrinterController - * @brief C++ constructor - */ - CBtPrinterController(MBtPCObserver& aObs); - - void InitJobVariables(); - - /** ConnectedL - * @brief Creates obex connection to the aBtDevice in the iClient - */ - void ClearConnections(); - void EstablishObjectChannelL( CRsBtDevice& aDevice ); - - private: - - // @var iFinish - TBool iFinish; - - RArray iImageList; - TInt iJobId; - - MBtPCObserver& iObs; - - CBtJobChannel* iJobChannel; - CBtObjectServer* iObjectChannel; - - CRsBtDiscoverEngine* iBtDiscoverEngine; - - CRsBtDevice* iDevice; - - TInt iPercents; - TInt iImageCount; - TInt iSentImages; - TInt iServerError; - - CBtOnQuery* iQuery; - TUint iProtocol; - - - }; - -#endif // CBTPRINTERCONTROLLER_H - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtprintingdevice.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtprintingdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,248 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTPRINTINGDEVICE_H -#define CBTPRINTINGDEVICE_H - -#include "mprotprintingdevice.h" -#include "mbtpcobserver.h" -#include "imageprint.h" -#include "btprotocolconsts.h" -#include "crsbtdiscoverengine.h" -#include "crsbtdevice.h" -#include "cbtprintercontroller.h" -#include "cprintjob.h" - -static const TUid KBtProtocolUid = { 0x01007779 }; - -/** - * @brief CBtPrintingDevice implements MProtPrintingDevice. This makes the class the "published" class of the DLL it is in. - */ -class CBtPrintingDevice : public CActive, public MProtPrintingDevice, public MBtPCObserver - { - public: - - static MProtPrintingDevice* NewL(); - - // Default constructor and destructor. - CBtPrintingDevice(); - ~CBtPrintingDevice(); - - public: // From MProtPrintingDevice - - // General. - void ConstructL(const TDesC& aDLLPath); - TVersion Version(); - TUint SupportedProtocols(); - // Discovery. - void StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocols = 0); - TInt RemoveCachedDeviceL(TInt aDeviceID); - void CancelDiscovery(TBool aDoCallBack = ETrue); - // Print. - TInt CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver); - - /** - * @brief Submit a job previously created with CreatePrintJobL() - */ - void SubmitPrintJobL(); - - /** - * @brief Cancels and ongoing print job. - * - * @return KErrNone if successful, KErrInvalidSequence if no printing job was previously submitted. - */ - TInt CancelPrintJob(); - TInt ContinuePrintJobL(); - TInt GetNumPrintPages(); - TInt GetPrintJobStatus(); - TInt GetPrinterStatus(TInt aDeviceID); - // Capabilities. - TInt GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs); - TInt GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability); - TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); - - /** - * @brief Sets the value of a single capability. - * - * Sets the value of a single capability. The value is passed as a TInt. - * For Float capabilities it is the numerator. - * - * Changes in certain capability values can affect other capabilities, - * such as a change in paper size changes the available templates. - * When this occurs, the affected capabilities are returned in the - * aAffectedCapability field. If there are any, the client should get - * these capabilities again. - * - * @param[in] aCapabilityID Id of the capability to be setted. - * @param[in] aValue Value to set the capability to. - * @param[out] aAffectedCapability 0=None, else CapabilityID - * - * @return KErrNone if successful, KErrInvalidSequence if job is not active, - * KErrInvalidData if setting request is invalid (either capability ID or value). - * Otherwise another of the system-wide error codes. - */ - TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); - - // Preview. - TInt GetNumPreviewPages(); - - /** - * @brief Creates a CFbsBitmap object and fills it with the preview bitmap. - * - * @param[in] aTemplateID Layout Capability ID of the icon desired. - * @param[out] aFsBitmapHandle - * - * @return KErrNone, or another of the system-wide error codes. - */ - TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFsBitmapHandle); - - /** - * Creates a preview image in a CFbsBitmap object. PreviewImageEvent() is called on the PrintEventObserver. - * - * @param aPageNumber Currently unused - * - * @return KErrNone if successful, KErrInvalidData if the Preview Image could not be loaded, or another of the system-wide error codes. - */ - TInt CreatePreviewImage(TInt aPageNumber); - - void RegisterIdleObserver(MProtIdleObserver * /*aObserver*/) {}; - - void SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ); - - void CreateJobResponse( TInt aJobId, TInt aErrorCode ); - - void CancelJobResponse(TInt aErrorCode ); - - void GetPrinterStateResponse(TInt aState, - TInt aStateReasons, - TInt aOperationStatus, TInt aDeviceId); - - void GetEventResponse(TInt aJobId, - TInt aJobState, - TInt aPrinterState, - TInt aStateReasons, - TInt aOperationStatus); - - void GetJobAttributesResponse( TInt aJobState, - const TDesC8& aJobName, - const TDesC8& aOriginator, - TInt aSheetsCompleted, - TInt aPendingJobs, - TInt aErrorCode ); - - void DeviceDiscovered( CRsBtDevice& aDevice ); - void DeviceDisappeared( CRsBtDevice& aDevice ); - void DiscoveryError(TInt aError); - - /* - * Updates OPP printing progress bar. - * */ - void OPPSendProgress( TInt aProgress ); - - public: //own - static TBool HandleTimeout(TAny *aWho); - - private: - - virtual void RunL(); - virtual void DoCancel(); - virtual TInt RunError(TInt aError); - - void GetUsedDevicesL(); - - void InitJobL(CRsBtDevice *aPrinter, RPointerArray& aImages); - - TBool InformObserver(TInt aUsedProtocol); - - void GetCapabilities(CRsBtDevice& aPrinter, TBool aForcedGet = EFalse); - void GetDefaultCapabilities(RArray& aCapabilities); - - void FoundDeviceL(CRsBtDevice& aDevice); - void UpdateCacheList(); - - TBool DoHandleTimeout(); - - void ResetTimer(); - void StartTimer(TTimeIntervalMicroSeconds32 aDelay, - TTimeIntervalMicroSeconds32 anInterval, - TCallBack aCallBack); - - CRsBtDevice* FindDevice(TInt aPrinterID); - - TInt AddBtDeviceL(CRsBtDevice& aDevice); - - void FinishPrinting(TInt aErrorCode); - - void ManagePrintingState(TInt aJobId, TInt aJobState, TInt aPrinterState, - TInt aStateReasons, TInt aOperationStatus); - - void GetJobAttributesL(); - void GetPrinterStateL(); - void CancelJobL(); - void Deactivate(); - // updates the printing proggress if increased and resets the pending counter if so. - TInt UpdateProggress(); - void GetLocalBTNameL(TDes8& aName); - void OPPJobRollBack(); - - private: - - enum TDeviceState - { - ENone, - EReady, - EGetPrinterState, - EGetJobAttributes, - EFinish, - EDiscovering, - EJobProgress, - ECancelJob - }; - - /// State operating. - TDeviceState iState; - - /// Print job object. - CPrintJob* iPrintingJob; - - CBtPrinterController* iPrinterController; - CBtDeviceContainer* iDeviceContainer; - - /// Requested Protocols for Discovery - TUint iRequestedProtocols; - - /// Print error. - TInt iPrintError; - /// Print error message code. - TInt iPrintErrorMsgCode; - - TUint iPendingCount; - - CPeriodic* iPrinterTimer; - - TInt iProggress; - - // used BlueTooth profile - TUint iUsedBtProfile; - - - }; - -#endif // CBTPRINTINGDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtsdpadvertiser.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtsdpadvertiser.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTSDPADVERTISER_H -#define CBTSDPADVERTISER_H - -#include -#include -#include - -/** -* CBtSdpAdvertiser -* Base class for advertising service in the SDP database. -*/ -NONSHARABLE_CLASS( CBtSdpAdvertiser ) : public CBase - { - public: // Constructors and destructor - - /** - * ~CBtSdpAdvertiser() - * Destroy the object, close all open handles - * and remove the advertised service. - */ - virtual ~CBtSdpAdvertiser(); - - /** - * StartAdvertisingL() - * Start the advertising of this service - * @param aPort the port being used by the service - */ - void StartAdvertisingL( TInt aPort ); - - /** - * StopAdvertisingL() - * Stop advertising this service. Remove the record - * from the sdp database - */ - void StopAdvertisingL(); - - /** - * IsAdvertising() - * Does the SDP database contain a record for this service - * @return ETrue whether the service is being advertised - */ - TBool IsAdvertising(); - - /** - * UpdateAvailabilityL() - * Update the service availability field of the service record - * @param aIsAvailable ETrue is the service is not busy. - */ - void UpdateAvailabilityL( TBool aIsAvailable ); - - protected: // Constructor - - /** - * CBtSdpAdvertiser() - * Construct this object - */ - CBtSdpAdvertiser(); - - /** - * BuildProtocolDescriptionL() - * Builds the protocol description - * @param aProtocolDescriptor the protocol descriptor - * @param aPort the service port - */ - virtual void BuildProtocolDescriptionL( - CSdpAttrValueDES* aProtocolDescriptor, TInt aPort ) = 0; - - /** - * ServiceClass() - * @return the service class - */ - virtual TUint ServiceClass() = 0; - - /** - * ServiceName() - * @return the service name - */ - virtual const TDesC& ServiceName() = 0; - - /** - * ServiceDescription() - * @return the service description - */ - virtual const TDesC& ServiceDescription() = 0; - - private: - - /** - * ConnectL - * Connect to the SDP database - */ - void ConnectL(); - - private: //data - - /** iSdpSession a handle to the SDP session */ - RSdp iSdpSession; - - /** iSdpDatabase a connection to the SDP database */ - RSdpDatabase iSdpDatabase; - - /**iRecord the record handle of the service - record for this server - */ - TSdpServRecordHandle iRecord; - - /**iRecordState the current record state - change number */ - TInt iRecordState; - - /** iIsConnected has a connection been made to the SDP Database */ - TBool iIsConnected; - }; - -#endif // CBTSDPADVERTISER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtsoapcodec.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtsoapcodec.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtSoapCodec class to create and read SOAP-encoded messages. -* -*/ - - -#ifndef CBTSOAPCODEC_H -#define CBTSOAPCODEC_H - -#include -#include -#include - -#include "cxmlhandler.h" -#include "tprintcapability.h" -#include "btprotocolconsts.h" - -/** @name Constants */ -/** Template file to use to create the XML soap-encoded messages */ - _LIT( KBtXmlTemplate, "z:\\resource\\imageprintdata\\protocols\\btxmltemplate.txt" ); - - -/** general tags */ -_LIT8(KBtEnvelopeStartTag, ""); -_LIT8(KBtBodyStartTag, ""); -_LIT8(KBtBodyEndTag, ""); - -_LIT8(KBtAction, "[Action]"); -_LIT8(KBtActionData, "[ActionData]"); -_LIT8(KBtBytesInBody, "[BytesInBody]"); - -/** Create job tags */ -_LIT8(KBtCreateJobStart, "[CreateJobStart]"); -_LIT8(KBtCreateJobEnd, "[CreateJobEnd]"); - -/** Get printer attributes tags */ -_LIT8(KBtGetPrinterAttributesAllStart, "[GetPrinterAttributesAllStart]"); -_LIT8(KBtGetPrinterAttributesAllEnd, "[GetPrinterAttributesAllEnd]"); -_LIT8(KBtGetPrinterAttributesStart, "[GetPrinterAttributesStart]"); -_LIT8(KBtGetPrinterAttributesEnd, "[GetPrinterAttributesEnd]"); -_LIT8(KBtGetPrinterCapabilitiesStart, "[GetPrinterCapabilitiesStart]"); -_LIT8(KBtGetPrinterCapabilitiesEnd, "[GetPrinterCapabilitiesEnd]"); -_LIT8(KBtGetPrinterStateStart, "[GetPrinterStateStart]"); -_LIT8(KBtGetPrinterStateEnd, "[GetPrinterStateEnd]"); - - -/** Get printer attributes tags */ -_LIT8(KBtGetJobAttributesStart, "[GetJobAttributesStart]"); -_LIT8(KBtGetJobAttributesEnd, "[GetJobAttributesEnd]"); - -/** Get margins tags */ -_LIT8(KBtGetMarginsStart, "[GetMarginsStart]"); -_LIT8(KBtGetMarginsEnd, "[GetMarginsEnd]"); -_LIT8(KBtMediaSizeData, "[MediaSizeData]"); -_LIT8(KBtMediaTypeData, "[MediaTypeData]"); - -/** Job related */ -_LIT8(KBtJobIdStart, "[JobIdStart]"); -_LIT8(KBtJobIdEnd, "[JobIdEnd]"); - -/** Actions */ -enum TBtSoapActions -{ - EBtUnknownAction = -1, - EBtCreateJob, - EBtCreateJobResponse, - EBtGetPrinterAttributes, - EBtGetPrinterAttributesResponse, - EBtGetJobAttributes, - EBtGetJobAttributesResponse, - EBtCancelJob, - EBtCancelJobResponse, - EBtGetEvent, - EBtGetEventResponse, - EBtGetMargins, - EBtGetMarginsResponse, - // Not actual actions but identifiers as sub for EBtGetPrinterAttributes - EBtGetPrinterCapabilities, - EBtGetPrinterState -}; - -_LIT8(KBtCreateJob, "CreateJob"); -_LIT8(KBtCreateJobResponse, "CreateJobResponse"); -_LIT8(KBtGetPrinterAttributes, "GetPrinterAttributes"); -_LIT8(KBtGetPrinterAttributesResponse, "GetPrinterAttributesResponse"); -_LIT8(KBtGetJobAttributes, "GetJobAttributes"); -_LIT8(KBtGetJobAttributesResponse, "GetJobAttributesResponse"); -_LIT8(KBtCancelJob, "CancelJob"); -_LIT8(KBtCancelJobResponse, "CancelJobResponse"); -_LIT8(KBtGetEvent, "GetEvent"); -_LIT8(KBtGetEventResponse, "GetEventResponse"); -_LIT8(KBtGetMargins, "GetMargins"); -_LIT8(KBtGetMarginsResponse, "GetMarginsResponse"); - -_LIT8(KBtNumberUpSupported, "NumberUpSupported"); -_LIT8(KBtMediaTypesSupported, "MediaTypesSupported"); -_LIT8(KBtMediaSizesSupported, "MediaSizesSupported"); -_LIT8(KBtPrintQualitySupported, "PrintQualitySupported"); -_LIT8(KBtMediaLoaded, "MediaLoaded"); -_LIT8(KBtLoadedMediumDetails, "LoadedMediumDetails"); - -/** Attributes */ -_LIT8(KBtOperationStatus, "OperationStatus"); -_LIT8(KBtJobId, "JobId"); -_LIT8(KBtJobName, "JobName"); -_LIT8(KBtJobState, "JobState"); -_LIT8(KBtJobOriginatingUserName, "JobOriginatingUserName"); -_LIT8(KBtJobMediaSheetsCompleted, "JobMediaSheetsCompleted"); -_LIT8(KBtJobPending, "NumberOfInterveningJobs"); - -_LIT8(KBtPrinterName, "PrinterName"); -_LIT8(KBtPrinterState, "PrinterState"); -_LIT8(KBtPrinterStateReasons, "PrinterStateReasons"); - -_LIT8(KBtDocumentFormat, "DocumentFormat"); -_LIT8(KBtCopies, "Copies"); -_LIT8(KBtSides, "Sides"); -_LIT8(KBtNumberUp, "NumberUp"); -_LIT8(KBtOrientationRequest, "OrientationRequest"); -_LIT8(KBtMediaSize, "MediaSize"); -_LIT8(KBtMediaType, "MediaType"); -_LIT8(KBtPrintQuality, "PrintQuality"); -_LIT8(KBtLoadedMediumSize, "LoadedMediumSize"); -_LIT8(KBtLoadedMediumType, "LoadedMediumType"); - -_LIT8(KBtStartTag, "<%S>"); -_LIT8(KBtEndTag, ""); -_LIT8(KBtValueTemplate, "[%S]"); - -static const TInt KAttrStrLen = 0x100; -typedef TBuf8 TBtAttrString8; -typedef TBuf8 TBtIntString8; - -/** -* @class CBtSoapCodec -* @brief Class to create and read SOAP-encoded messages. -* -* Class defines methods to encode and decode BPP actions to SOAP-encoded messages. -* @n -* @b Usage: -* @n -* @b Creating a message: -*
    -* 1. Create an instance of the class -* 2. Create an encoded message by CreateSoapL -*
-* @n -* After a message is created, it must be added in OBEX message body. -* @n -* @b Reading a message: -* After a OBEX message is received, a body from it can be given to -* CBtSoapCodec to decode the SOAP-encoded message. -*
    -* 1. Decode and the message by ReadSoapL -* 2. Get the attributes(s) of the message by GetAttributeL -*
-* -*/ -NONSHARABLE_CLASS( CBtSoapCodec ) : public CBase - { - public: - - /** NewL - * @brief Creates a new instance of SOAP codec class. - * @return Pointer to the instance. - */ - static CBtSoapCodec* NewL(); - - /** NewLC - * @brief Creates a new instance of SOAP codec class and leaves it in the cleanup stack. - * @return Pointer to the instance. - */ - static CBtSoapCodec* NewLC(); - - /** ~CBtSoapCodec - * @brief Destructor. - */ - ~CBtSoapCodec(); - - - /** Reset - * @brief Resets the member variables. - */ - void Reset(); - - /** CreateSoapL - * @brief Creates the SOAP-encoded message. - * According to the action parameter given, the method reads - * the xml template for a named action from file @ref KBtXmlTemplate - * and decodes it with the data concerning. - * @param aAction Name of the action for the message to create. - * @param aJobId Jod identifier for the actions required. - * NOTE: for CreateJob operation the job id is the cumulative number - * of the created jobs during the session. - * @return Pointer to the SOAP-encoded message for the action - */ - TPtrC8 CreateSoapL(const TInt aAction, const TInt aJobId = KErrNotFound); - - /** SoapAction - * @brief Returns for the action of the SOAP-encoded message - * @return TBtSoapActions type action identifier - */ - TInt SoapAction(); - - /** ReadSoapL - * @brief Reads the SOAP-encoded message. - * The message is read and the class is initialized with the data of the message. - * @param aAction Returns the name of the action of the SOAP-encoded data - * @param aSoapBuffer The buffer to read - */ - void ReadSoapL(TInt& aAction, const TDesC8& aSoapBuffer); - - /** @overload void ReadSoapL(TInt& aAction, const TDesC8& aSoapBuffer) */ - void ReadSoapL(TInt& aAction, const CBufBase& aSoapBuffer); - - /** @overload void ReadSoapL(TInt& aAction, const TDesC8& aSoapBuffer) */ - void ReadSoapL(const TDesC8& aSoapBuffer); - - /** @overload void ReadSoapL(TInt& aAction, const TDesC8& aSoapBuffer) */ - void ReadSoapL(const CBufBase& aSoapBuffer); - - public: - void CreateJobResponseL(TInt& aJobId, TInt& aErrorCode); - - void GetPrinterAttributesResponseL(TInt& aState, TInt& aStateReasons, - RArray& aCapabilities, - TInt& aOperationStatus); - - void GetPrinterStateResponseL(TInt& aState, TInt& aStateReasons, TInt& aOperationStatus); - - void GetPrinterCapabilitiesResponseL(RArray& aCapabilities, - TInt& aOperationStatus); - - void GetJobAttributesResponseL(const TInt aJobId, - TInt& aJobState, - TBtAttrString8& aJobName, - TBtAttrString8& aOriginator, - TInt& aSheetsCompleted, - TInt& aPendingJobs, - TInt& aOperationStatus ); - - void CancelJobResponseL(const TInt aJobId, TInt& aOperationStatus); - - void GetEventResponseL(const TInt aJobId, - TInt& aJobState, - TInt& aPrinterState, - TInt& aStateReasons, - TInt& aOperationStatus); - TInt OperationStatusL(); - - public: - /** GetAttributeL - * @brief Reads the requested attributes's value. - * @param aName Name of the attribute - * @param aValue Returns the value of the attribute - * @param aError Returns the code for the occurred error or KErrNone - */ - void GetAttributeL(const TDesC8& aName, TDes8& aValue, TInt& aError); - - void GetAttributeListL(const TDesC8& aName, CDesC8ArrayFlat& aList, TInt& aError); - - public: - /** TestMeL - Static test method - * @brief Static method to test this class' public interface. - */ - static void TestMeL(); - static TPtrC8 CreateJobResponseTestSoap(); - static TPtrC8 CancelJobResponseTestSoap(); - static TPtrC8 GetPrinterAttributesResponseTestSoap(); - static TPtrC8 GetJobAttributesResponseTestSoap(); - static TPtrC8 GetEventsResponseTestSoap(); - static TPtrC8 GetMarginsResponseTestSoap(); - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - private: - - /** CBtSoapCodec - * @brief C++ constructor - */ - CBtSoapCodec(); - - /** CreateSoapTemplateL - * @brief Constructs a correct type message template. - * According to the given parameters method composes a template - * for the message with general headers and action specific data block. - * @param aStartTag Start tag for the action - * @param aEndTag End tag for the action - */ - void CreateSoapTemplateL(const TDesC8& aStartTag, const TDesC8& aEndTag); - - /** CreateJobSoapL - * @brief Composes the CreateJob action specific data in template. - */ - void CreateJobSoapL(const TInt aJobId); - - /** GetPrinterAttributesSoapL - * @brief Composes the GetPrinterAttributes action specific data in template. - */ - void GetPrinterAttributesSoapL(); - void GetCapabilitiesSoapL(); - void GetPrinterStateSoapL(); - - void GetJobAttributesSoapL(const TDesC8& aJobId); - void CancelJobSoapL(const TDesC8& aJobId); - void GetEventSoapL(const TDesC8& aJobId); - void GetMarginsSoapL(); - - TPrintCapability ParseLayoutL(); - TPrintCapability ParseQualityL(); - TPrintCapability ParsePaperSizeL(); - void ParseDefaultSizeL(TPrintCapability& aSize, TInt& aPos); - TInt ValuePosition(TPrintCapability aCapab, TInt aValue); - - private: - - /** @var HBufC8* iActionBuffer - * Buffer to store the action data */ - HBufC8* iActionBuffer; - - /** @var CXmlHandler* iXmlHandler - * XML handler */ - CXmlHandler* iXmlHandler; - - }; - -#endif // CBTSOAPCODEC_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtstatuschannel.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbtstatuschannel.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtStatusChannel class. -* -*/ - - -#ifndef CBTSTATUSCHANNEL_H -#define CBTSTATUSCHANNEL_H - -#include -#include -#include -#include - -#include "crsbtdiscoverengine.h" -#include "tprintcapability.h" -#include "cbtchannelbase.h" -#include "mbtpcobserver.h" -#include "cbtobjectserver.h" -#include "cprintjob.h" - -/** -* @class CBtStatusChannel -* @brief -* -*/ -NONSHARABLE_CLASS( CBtStatusChannel ) : public CBtChannelBase - { - public: - - /** NewL - * @brief Creates a new instance of XHTML file composer. - * @return Pointer to the instance. - */ - static CBtStatusChannel* NewL(MBtPCObserver& aObs); - - /** NewLC - * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. - * @return Pointer to the instance. - */ - static CBtStatusChannel* NewLC(MBtPCObserver& aObs); - - /** ~CBtStatusChannel - * @brief Destructor. - */ - ~CBtStatusChannel(); - - /** GetPrinterAttributesL - * @brief - */ - TInt GetPrinterStateL(); - - /** GetJobAttributes - * @brief - */ - TInt GetJobAttributesL(TInt aJobId); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aJobId Print job ID of cancelled job. - */ - void GetEventL(TInt aJobId); - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - void RunL(); - virtual void DoCancel(); - TInt RunError(TInt aError); - - private: - - /** CBtStatusChannel - * @brief C++ constructor - */ - CBtStatusChannel(MBtPCObserver& aObs); - - void GetPrinterStateResponseL(); - void GetJobAttributesResponseL(); - void CancelJobResponseL(); - void GetEventResponseL(); - - /** ConnectL - * @brief Creates obex connection to the aBtDevice in the iClient - */ - void ConnectL(); - - void DoLeaveL(TInt aError); - - private: - - }; - -#endif // CBTSTATUSCHANNEL_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbttimer.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cbttimer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2004-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 CBTTIMER_H -#define CBTTIMER_H - -#include - -namespace - { - // 0,1 second for AOs to finish their RunL methods - const TUint KPrintingErrorDelay = 100000; - - // 60 seconds for discovery - const TUint KDiscoveryDelay = 60000000; - - // 5 seconds for data sending percents - const TUint KSentPercentsDelay = 3000000; - - // 5 seconds for data sending percents - const TUint KPrinterResponseTimeout = 5000000; - - } - -class MBtTimerObserver - { - public: - virtual void HandleTimeoutL() = 0; - }; - -class CBtTimer : public CTimer - { - public: - static CBtTimer* NewL( MBtTimerObserver& aObserver ); - ~CBtTimer(); - void Start(TUint aDelay); - - private: - CBtTimer( MBtTimerObserver& aObserver ); - void ConstructL(); - void RunL(); - - private: - MBtTimerObserver& iObserver; - }; - - -#endif // CBTTIMER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cprintjob.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cprintjob.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrintJob class definition and the PJS enum. -* -*/ - - -#ifndef CPRINTJOB_H -#define CPRINTJOB_H - -#include - -#include "cxhtmlfilecomposer.h" -#include "crsbtdevice.h" - -#define KMaxIdLength 10 - - -class TPrintSetting -{ - public: - TInt iCapability; - TInt iValue; -}; - -NONSHARABLE_CLASS( CPrintJob ): public CBase -{ - public: - /// Possible states of a print job. - enum TJobState - { - EStateNone, - EStateCreated, - EStateSubmitted, - EStateSending, - EStatePrinting, - EStateCancel - }; - - public: - /* - * @function NewL - * @description Constructs the CPrintJob object. - * NOTE: The ownership of aFileFactory does not change here! - * @param aPrinter Selected printer for the job - * @param aImages Array of images to be printed - * @param aFileFactory Pointer to XHTML-print file factory - * @param aUserName User name got from central repository - */ - static CPrintJob* NewL(CRsBtDevice* aDevice, RArray& aImages, const TDesC8& aUserName); - - /* - * @function Destructor - * @description Destroys the object and frees the memory allocated by this object - */ - ~CPrintJob(); - - /* - * @function SetJobId - * @description Initializes the job id - * @param TDesC& aId - */ - void SetJobId(const TInt aId); - - /* - * @function JobId - * @description Returns the job id as TInt - * @return Job id - */ - TInt JobId(); - - /* - * @function GetJobName - * @description Returns the file path - * @param TDes8& - */ - void GetJobName(TDes8& aJobName); - - /* - * @function ImageCount - * @description Returns the number of images in job. - * @return TInt - */ - TInt ImageCount(); - - /* - * @function Images - * @description Returns job's images as CImageInfo - * @param RArray Output parameter - */ - void Images(RArray& aImages); - - /* - * @function PrinterId - * @description Returns the printer id - * @param TInt - */ - TInt PrinterId(); - - /* - * @function Device - * @description Returns the printer id - * @param TInt - */ - CRsBtDevice* Device(); - - /* - * @function GetUserName - * @description Returns the user name - * @param TPtrC8& - */ - void GetUserName(TPtrC8& aDocFormat); - - /* - * @function SetNumsOfCopies - * @description Sets the number of copies for certain image. - * @param TInt aCapabilityId - * @param TInt aValue - * @return TInt System wide error code - */ - TInt SetNumsOfCopies( const RArray& aNumsOfCopies); - - /* - * @function XhtmlPrintFile - * @description Returns the file path of generated XHTML-Print file - * @param TDes8& - */ - void GetPrintFileL(TDes8& aPrintFile); - - /* - * @function Sheets - * @description Returns the total number of sheets the job requires - * @return TInt - */ - TInt Sheets(); - - /* - * @function JobState - * @description Returns the job state - * @return TJobState - */ - TJobState JobState(); - - /* - * @function UpdateJobState - * @description Updates the job state - */ - void UpdateJobState(const TJobState aState); - - /* - * @function GetPrintSetting - * @description Gets print settings - */ - TInt GetPrintSetting(TInt aCapabilityID, TInt& aValue); - TInt SetPrintSetting(TInt aCapabilityID, TInt aValue); - - - protected: - /* - * @function ConstructL - * @description Construction's second phase - * @param aPriner Selected printer for the job - * @param aImages Array of images to be printed - */ - void ConstructL(RArray& aImages, const TDesC8& aUserName); - - private: - - /* - * @function CPrintJob - * @description C++ constructor - * @param aPrinterId Id of the printer to be used for this job. - * - */ - CPrintJob(CRsBtDevice* aDevice); - - private: - - //@var iJobId Id for printing job received from printer control point - TInt iJobId; - - //@var iDeviceId Defines the printer to be used. - TInt iDeviceId; - - CRsBtDevice* iDevice; - - //@var iUserName Name of the user - TFileName8 iUserName; - - //@var iImages Job's images - RArray iImages; - - //@var iSheets Number of sheets to print - TInt iSheets; - - TJobState iJobState; - -}; - -#endif // CPRINTJOB_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/crsbtdevice.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/crsbtdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsBtDevice class definition. -* -*/ - - -#ifndef CRSBTDEVICE_H -#define CRSBTDEVICE_H - -#include -#include -#include - -#include "tprinter.h" -#include "btprotocolconsts.h" -#include "tprintcapability.h" - -/** - * @brief Stores information on Bluetooth device. - * - * Contains information related to a Bluetooth device, such as a printer. This includes Bluetooth - * information like device ID and device class, BPP and OPP information like port (channel), number of prints made, - * and time stamps of discovery and last use. - */ -NONSHARABLE_CLASS( CRsBtDevice ): public CBase - { - public: - TBool UpdateDeviceL(CRsBtDevice &aDevice); - TBool UpdateDeviceAndBPPL(CRsBtDevice& aDevice); - TBool UpdateAllL(CRsBtDevice &aDevice); - TBool UpdateUsedL(CRsBtDevice &aDevice); - - void SetDisappeared(TBool aDisappeared); - TBool IsDisappeared() const; - - void SetSupportedProtocols(TUint aSupportedProtocols); - TUint SupportedProtocols() const; - - void SetBPPPort(TUint aPort); - TUint BPPPort() const; - - void SetSTSPort(TUint aPort); - TUint STSPort() const; - - void SetOPPPort(TUint aPort); - TUint OPPPort() const; - - void SetTimeLastUsed(TTime aTime); - TTime TimeLastUsed() const; - - void SetTimeDiscovered(TTime aTime); - TTime TimeDiscovered() const; - - const TBTDevAddr& BDAddr() const; - TBTDeviceClass DeviceClass() const; - - TBool Equals( const CRsBtDevice &aDevice ) const; - CRsBtDevice* CopyL(); - CRsBtDevice* CopyL(CRsBtDevice& aSource); - - static CRsBtDevice* NewLC(const CRsBtDevice &a); - static CRsBtDevice* NewLC(const TNameRecord &aName); - static CRsBtDevice* NewLC(); - static CRsBtDevice* NewL(const CRsBtDevice &a); - static CRsBtDevice* NewL(const TNameRecord &aName); - static CRsBtDevice* NewL(); - - virtual ~CRsBtDevice(); - - void ExternalizeL(RWriteStream& aStream) const; - void InternalizeL(RReadStream& aStream); - - const TDesC& FriendlyName() const; - - void SetPrinterModelL(const TDesC& aModelName); - const TDesC& GetPrinterModel() const; - - void SetJustFound(TBool aJustFound); - TBool IsJustFound() const; - - TInt DeviceId() const; - void SetDeviceId(TInt aNewId); - - void SetVendor( TPrinter::TPrinterVendor aVendor ); - TPrinter::TPrinterVendor Vendor() const; - - void AddCapability(TPrintCapability& aCapability); - void GetCapabilityIDs(RArray& aCapabilityIDs ); - TInt GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability); - TInt SetDefaultCapability(TInt aCapabilityID, TInt aValue); - TInt CapabilityCount() const; - - TPrinter ToTPrinter(); - TBool IsUsed() const; - void SetUsed(TBool aUsed); - - TInt UsedProtocol() const; - TInt ComposeUsedProtocol(TInt aRequestedProtocols); - void SetUsedProtocol(TInt aProtocol); - - private: - CRsBtDevice(); - // copy constructor - CRsBtDevice(const CRsBtDevice &a); - - void ConstructL(const TNameRecord &aName); - void ConstructL(const CRsBtDevice &a); - void ConstructL(); - void Init(); - void ExternalizeCapabilitiesL(RWriteStream& aStream) const; - void InternalizeCapabilitiesL(RReadStream& aStream); - - private: - TTime iTimeLastUsed; - TTime iTimeDiscovered; - TUint iBPPPort; - TUint iSTSPort; - TUint iOPPPort; - TUint iSupportedProtocols; - TPrinter::TPrinterVendor iVendor; - CBTDevice* iDevice; - HBufC *iPrinterModel; - TBool iJustFound; - TInt iInternalDeviceId; - - TBool iUsed; - TBool iDisappeared; - - TInt iUsedProtocol; - RArray iCapabilities; - - - }; - -#endif // CRSBTDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/crsbtdiscoverengine.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/crsbtdiscoverengine.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsBtDiscoverEngine class definition and its observer -* definition (MBtDiscoveryObserver). -* -*/ - - -#ifndef CRSBTDISCOVERENGINE_H -#define CRSBTDISCOVERENGINE_H - -#include -#include -#include - -#include "imageprint.h" -#include "cbttimer.h" - -class CBtDiscover; -class CRsBtDevice; -class CBtDeviceContainer; - -#define KMaxDaysForCachedDevice 30 - - -/** - * \brief Observer interface for device discovery or SDP events. - * - * The class which owns the CRsBtDiscoverEngine object implements this interface to get - * asynchronous notifications of Bluetooth device discovery or Service Discovery Protocol - * events. - */ -class MBtDiscoveryObserver - { - public: - // the values in this enum are subject to change as need crops up - // the granularity of feedback should be enough to meet UI needs - - enum TEvent - { - EFoundBtPrinter, - ERemoveBtPrinter, - EDoneFindingPrinters, - EErrorDuringDiscover, - EErrorFindingDevice, - EErrorVerifyingBt - }; - public: - virtual void HandleDiscoveryEvent(TInt aEvent,TInt aErrorCode)=0; - }; - -/** - * \brief Brief Description - * - * Detailed Description - */ -NONSHARABLE_CLASS( CRsBtDiscoverEngine ): public CActive, public MBtTimerObserver - { - public: - CRsBtDevice& GetDevice(); - ~CRsBtDiscoverEngine(); - - static CRsBtDiscoverEngine* NewL(MBtDiscoveryObserver& aObs); - void Start(TUint aRequestedProtocols); - void Stop(); - - protected: // from CActive - void DoCancel(); - void RunL(); - TInt RunError(TInt aError); - - protected: // from MBtTimerObserver - void HandleTimeoutL(); - - private: - - CRsBtDiscoverEngine(MBtDiscoveryObserver& aObs); - void ConstructL(); - - void StartDiscovery(); - void ContinueDiscovery(); - - TBool ComposeDeviceL(); - void ResetDevice(); - - TBool CheckBtDevice(); - - void ServiceDiscoveryL(); - void StopServiceDiscovery(); - - private: - - enum TState - { - EFindingDevices, - EGettingServices, - EDelayFindDevices - }; - - private: - - /// State we are currently on ESendingCached, EFindingDevices, ERemovingStale, EVerifyServices, EDelayFindDevices. - TState iState; - /// This Object implements the Bluetooth Discovery system calls. - CBtDiscover *iDiscover; - /// Discovery Events observer. - MBtDiscoveryObserver& iObserver; - /// Indicates the position of the current device. - CRsBtDevice* iDevice; - - RArray iFoundBeforeArray; - RTimer iDelayFindDevices; - /// Bitmask of the protocols requested for printing. - TUint iRequestedProtocols; - CBtTimer* iTimeout; - }; - -#endif // CRSBTDISCOVERENGINE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cxmlhandler.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/cxmlhandler.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* -* Copyright (c) 2004-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: Handler for XML file modify. Defines the class to store and modify XML data. -* -*/ - - -#ifndef CXMLHANDLER_H -#define CXMLHANDLER_H - -#include -#include -#include - -/** general tags */ -_LIT8(KBtLessThan, "<"); -_LIT8(KBtGreaterThan, ">"); -_LIT8(KBtLessThanSlash," -* @li Create an instance of class -* @li Initialize class with a data buffer by InitFromBufferL or with a file name by InitFromFileL -* @li Get/replace/remove parts of initialized data -* -*/ -NONSHARABLE_CLASS( CXmlHandler ): public CBase - { - public: - - /** NewL - * @brief Creates a new instance of XML handler. - * @return Pointer to the instance. - */ - static CXmlHandler* NewL(); - - /** NewLC - * @brief Creates a new instance of XML handler and leaves it in the cleanup stack. - * @return Pointer to the instance. - */ - static CXmlHandler* NewLC(); - - static TPtrC8 ParseValue(const TDesC8 &aData, const TDesC8 &aStart, const TDesC8 &aEnd, TInt& aOffset); - static void ParseValueListL(const TDesC8 &aData, const TDesC8 &aStart, const TDesC8 &aEnd, CDesC8ArrayFlat& aList); - - /** ~CXmlHandler - * @brief Destructor. - */ - ~CXmlHandler(); - - - /** Reset - * @brief Resets the member variables. - */ - void Reset(); - - /** InitFromFileL - * @brief Reads the named template file for handling it. - * @param aFile Name of the file to read for handle - * @param aId Identifier for the data stored in class - */ - void InitFromFileL(const TDesC& aFile, const TInt aId = KErrNotFound); - - /** InitFromBufferL - * @brief Initialises the data to handle with given buffer. - * @param aBuffer The buffer to handle - * @param aId Identifier for the data stored in class - */ - void InitFromBufferL(const TDesC8& aBuffer, const TInt aId = KErrNotFound); - - - /** ComposeDataL - * @brief Replaces the template with string value in stored data - * @param aStr String to convert for - * @param aTag Template to replace - */ - void ComposeDataL(const TDesC8& aData, const TDesC8& aTag); - - /** @overload void ComposeDataL(const TDesC8& aData, const TDesC8& aTag) */ - void ComposeDataL(const TInt aValue, const TDesC8& aTag); - - /** InsertDataL - * @brief Inserts data in the buffer - * @param aStr String to convert for - * @param aTag Template to replace - */ - void InsertDataL(const TDesC8& aData, const TInt aOffset); - - /** GetDataL - * @brief Returns the data between given start and end descriptors. - * NOTE: The start and end descriptors are @e not returned. - * @param aStart Start tag for data to find. - * @param aEnd End tag for data to find. - * @param aOffset Returns offset for the data start. KErrNotFound indicates the data not found. - */ - TPtrC8 GetDataL(const TDesC8& aStart, const TDesC8& aEnd, TInt& aOffset); - - /** FinalizeBufferL - * @brief Trims the member buffer tail. Replacing the template strings from - * the buffer makes the data length in the buffer vary and generates - * rubbish in the end of buffer. - * @param aTag End tag to delete all after it. - * @return Pointer to the stored data. - */ - TPtrC8 FinalizeBufferL(const TDesC8& aTag); - - /** DeleteBufferData - * @brief Deletes the data from the buffer. - * @param aOffset Data offset to start delete - * @param aLength Length of the data to delete - */ - void DeleteBufferData(TInt aOffset, TInt aLength); - - /** BufferId - * @brief Returns the identifier of the stored data. - * @return Identifier of the stored data - */ - TInt BufferId(); - - /** Buffer - * @brief Returns the pointer to the stored data. - * @return Pointer to the stored data - */ - TPtrC8 Buffer(); - - void GetDataListL(const TDesC8 &aStart, const TDesC8 &aEnd, CDesC8ArrayFlat& aList); - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - */ - void ConstructL(); - - private: - - /** CXmlHandler - * @brief C++ constructor - */ - CXmlHandler(); - - /** ReadFileL - * @brief Reads the file in iDataBuf - */ - void ReadFileL(const TDesC& aFile); - - private: - - /** @var HBufC8* iDataBuf - * Buffer to store the data initialized */ - HBufC8* iDataBuf; - - /** @var TInt iBufferId - * Identifier for the stored data. Initialized as KErrNotFound. */ - TInt iBufferId; - - /** @var RFs iFs - * File server session */ - RFs iFs; - - }; - -#endif // CXMLHANDLER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mbtonnotify.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mbtonnotify.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004-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 BTONNOTIFY_H -#define BTONNOTIFY_H - -#include - -class MBTOnNotify - { - public: - virtual void BTOnCompleteL( TBool aResult ) = 0; - }; - -#endif // BTONNOTIFY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mbtpcobserver.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mbtpcobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2004-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: Declares the MBtPCObserver interface class -* -*/ - - -#ifndef MBTPCOBSERVER_H -#define MBTPCOBSERVER_H - -#include -#include - -class CRsBtDevice; -class TPrintCapability; - - -// CLASS DECLARATION - -/** -* @brief A virtual MBtPCObserver class. -* -* @since Series60 3.1 -*/ -class MBtPCObserver - { - public: // New interface functions - - /** - * CreateJobResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void CreateJobResponse( TInt aJobId, TInt aErrorCode ) = 0; - - /** - * CancelJobResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void CancelJobResponse( TInt aErrorCode ) = 0; - - /** - * GetPrinterAttributesResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - * - virtual void GetPrinterAttributesResponse( TInt aState, TInt aStateReasons, - RArray& aCapabilities, - TInt aOperationStatus, TInt aDeviceId) = 0; - - ** - * GetPrinterAttributesResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetPrinterStateResponse( TInt aState, TInt aStateReasons, - TInt aOperationStatus, TInt aDeviceId) = 0; - - /** - * GetJobAttributesResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetJobAttributesResponse( TInt aJobState, - const TDesC8& aJobName, - const TDesC8& aOriginator, - TInt aSheetsCompleted, - TInt aPendingJobs, - TInt aOperationStatus ) = 0; - - /** - * GetEventResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetEventResponse(TInt aJobId, - TInt aJobState, - TInt aPrinterState, - TInt aStateReasons, - TInt aOperationStatus) = 0; - /** - * DeviceDiscoveredL callback function - * @since Series60 3.1 - * @param aDevice the device discovered - */ - virtual void DeviceDiscovered( CRsBtDevice& aDevice ) = 0; - - /** - * DeviceDisappeared callback function - * @since Series60 3.1 - * @param aDevice the device disappeared - */ - virtual void DeviceDisappeared( CRsBtDevice& aDevice ) = 0; - - /** - * DiscoveryError callback function - * @since Series60 3.1 - * @param aError error occured during discovery on cancel discovery operation - */ - virtual void DiscoveryError(TInt aError) = 0; - - /* - * Updates progress bar. - * */ - virtual void OPPSendProgress( TInt aProgress ) = 0; - }; - -#endif // MBTPCOBSERVER_H - -// End Of File \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mconfirmationnotify.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/mconfirmationnotify.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2004-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 MCONFIRMATIONNOTIFY_H -#define MCONFIRMATIONNOTIFY_H - -#include -#include - -class MConfirmationNotify - { - public: - virtual void PasswordQueryCompleteL (TObexPasskeyBuf aResultPckg) = 0; - }; - -#endif // MCONFIRMATIONNOTIFY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/rsutils.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/rsutils.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2004-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 RSUTILS_H -#define RSUTILS_H - -#include -#include - -#include "mbtonnotify.h" - -class CObexBaseObject; - -/** -* \brief Useful utilities -* -* The RsUtils class contains static utility functions useful to the whole application -* such as descriptor manipulations. -*/ -class RsUtils - { - public: - - static TBool IsBluetoothOn(); // Check comments .cpp file - static HBufC16* MakeXHTMLSafeL(const TDesC16& aString); - static HBufC8* ConvertToUtf8SafeLC(const TDesC16& aUnicode); - static void CleanFileName(const TDesC &aOldFname, TDes& aNewFname); - static void FindWidthHeightForPrinting(TInt &aWidth, TInt &aHeight, const TInt aMaxWidth, const TInt aMaxHeight); - static HBufC8* ConvertFromUnicodeToUtf8LC(const TDesC16& aUnicode); - static TBool PathIsInRom(const TFileName &aFileName); - static TFileName PathNotRom(const TFileName &aFileName); - static TFileName FileName( const TFileName& aFullName ); - static TBool FileExists(const TDesC& aFileName, RFs& aFs); - static TInt FileSize(const TDesC& aFileName, TInt& aSize, RFs& aFs); - static TLanguage GetPhoneLanguage(); - static TInt CreateDataFolder( RFs& aSession, TDes& aPath, TDriveNumber aDrive = EDriveC ); - static TInt ValidateCacheFile( RFs& aSession, const TDesC& aFileName, - TTimeIntervalMinutes aValidPeriod, TBool& aDeleted ); - static HBufC* ConcatenateStringsLC(const TDesC& aDes1, const TDesC& aDes2); - static HBufC* ConcatenateStringsLC(const TDesC& aDes1, const TDesC& aDes2, const TDesC& aDes3); - static void LogL( const CBufBase& aBuffer ); - static void LogL( CObexBaseObject& aBuffer ); - static void LogL( const TDesC8& aBuffer ); - static void LogL( const TDesC16& aBuffer ); - static void LogFileL( const TFileName& aName ); - static void GetLocalBTNameL(TDes8& aName); - - }; - -#endif // RSUTILS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/tbtmapper.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/inc/tbtmapper.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,318 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the TBtMapper class definition. -* -*/ - - -#ifndef TBTMAPPER_H -#define TBTMAPPER_H - -#include -#include - -#include "printmessagecodes.h" -#include "printcapabilitycodes.h" - -enum TBtPrintState -{ - EBtStateUnknown = 0, //@brief job state not known - EBtStateIdle, //@brief printer state idle - EBtStateProcessing, //@brief printer processing - EBtStateStopped, //@brief printer or job state stopped - EBtStatePrinting, //@brief printing job - EBtStateWaiting, //@brief job is waiting - EBtStateCompleted, //@brief job ready - EBtStateAborted, //@brief job aborted for some error - EBtStateCancelled, //@brief job cancelled - EBtStateSending //@brief sending job. Internal state to indicate the data is about transmissed. -}; - -_LIT8(KBtStateUnknown, "unknown"); -_LIT8(KBtStateIdle, "idle"); -_LIT8(KBtStateProcessing, "processing"); -_LIT8(KBtStateStopped, "stopped"); -_LIT8(KBtStatePrinting, "printing"); -_LIT8(KBtStateWaiting, "waiting"); -_LIT8(KBtStateCompleted, "completed"); -_LIT8(KBtStateAborted, "aborted"); -_LIT8(KBtStateCancelled, "cancelled"); - -_LIT8(KPrintReasonNone, "none"); -_LIT8(KPrintReasonAttentionRequired, "attention-required"); -_LIT8(KPrintReasonMediaJam, "media-jam"); -_LIT8(KPrintReasonPaused, "paused"); -_LIT8(KPrintReasonDoorOpen, "door-open"); -_LIT8(KPrintReasonMediaLow, "media-low"); -_LIT8(KPrintReasonMediaEmpty, "media-empty"); -_LIT8(KPrintReasonOutputAreaAlmostFull, "output-area-almost-full"); -_LIT8(KPrintReasonOutputAreaFull, "output-area-full"); -_LIT8(KPrintReasonMarkerSupplyLow, "marker-supply-low"); -_LIT8(KPrintReasonMarkerSupplyEmpty, "marker-supply-empty"); -_LIT8(KPrintReasonMarkerFailure, "marker-failure"); -_LIT8(KPrintReasonMediaChangeRequest, "media-change-request"); -_LIT8(KPrintReasonVendorDefined, "vendor-defined"); -_LIT8(KPrintReasonHwError, "hardware-error"); -_LIT8(KPrintReasonUriNotFound, "external-access-uri-not-found"); -_LIT8(KPrintReasonObjectFailure, "external-access-object-failure"); -_LIT8(KPrintReasonFormatError, "external-access-doc-format-error"); -_LIT8(KPrintReasonHttpError, "external-access-http-error"); -_LIT8(KPrintReasonCopies, "copies"); -_LIT8(KPrintReasonSides, "sides"); -_LIT8(KPrintReasonNumberUp, "number-up"); -_LIT8(KPrintReasonOrientationRequested, "orientation-requested"); -_LIT8(KPrintReasonMediaSize, "media-size"); -_LIT8(KPrintReasonMediaType, "media-type"); -_LIT8(KPrintReasonPrintQuality, "print-quality"); -_LIT8(KPrintReasonTextLayout, "text-layout"); -_LIT8(KPrintReasonImageLayout, "image-layout"); -_LIT8(KPrintReasonImageOrientation, "image-orientation"); -_LIT8(KPrintReasonPdlFidelity, "pdl-fidelity"); -_LIT8(KPrintReasonFontFamily, "font-family"); -_LIT8(KPrintReasonFontSize, "font-size"); - - -// Paper size -// According to the "ftp://ftp.pwg.org/pub/pwg/standards/pwg5101.1.pdf", -// only the size of paper is defined -_LIT8(KPaperSizeMax, "custom_max_"); //custom_max_[nn]x[nn][mm|in] -_LIT8(KPaperSizeMin, "custom_min_"); //custom_min_[nn]x[nn][mm|in] -_LIT8(KPaperSizeA6, "_105x148mm"); //iso_a6_105x148mm -_LIT8(KPaperSizeA4, "_210x297mm"); //iso_a4_210x297mm -_LIT8(KPaperSize5x7, "_5x7in"); //na_5x7_5x7in -_LIT8(KPaperSize4x6, "_4x6in"); //na_index-4x6_4x6in -_LIT8(KPaperSizeLetter, "_8.5x11in"); //na_letter_8.5x11in - -// Quality -_LIT8(KQualityDraft, "draft"); -_LIT8(KQualityNormal, "normal"); -_LIT8(KQualityHigh, "high"); - -_LIT8(KHexPrefix, "0x"); - -/** - * @brief A printer abstraction. - * - * Class representing the basic properties of a printing device. - * Published as part of the ImagePrint Server API. - */ -class TBtMapper - { - public: - - inline static TInt32 HexToInt(const TDesC8& aString) - { - TInt len(0); - if( KErrNotFound < aString.Find(KHexPrefix())) - len = KHexPrefix().Length(); - - TPtrC8 str = aString.Right(aString.Length()-len); - - TLex8 lex(str); - TUint32 val = KErrNotFound; - lex.Val(val, EHex); - LOG82("[TBtMapper::OperationStatus]\t %S: %d", &aString, val); - return val; - } - - inline static TInt32 HexToInt(const TDesC& aString) - { - TBuf8<0x100> str; - str.Copy(aString); - return HexToInt(str); - } - - inline static TInt32 Int(const TDesC8& aString) - { - TLex8 lex(aString); - TInt32 value = KErrNotFound; - lex.Val(value); - return value; - } - - inline static TInt32 Int(const TDesC& aString) - { - TLex lex(aString); - TInt32 value = KErrNotFound; - lex.Val(value); - return value; - } - - inline static TUint32 Uint(const TDesC8& aString) - { - TUint32 value = Int(aString); - return value; - } - - inline static TUint32 Uint(const TDesC& aString) - { - TUint32 value = Int(aString); - return value; - } - - inline static TInt State(const TDesC8& aStrState) - { - if(0 == aStrState.Compare(KBtStateUnknown)) //job - return EBtStateUnknown; - if(0 == aStrState.Compare(KBtStateIdle)) // printer - return EBtStateIdle; - if(0 == aStrState.Compare(KBtStateProcessing)) // printer - return EBtStateProcessing; - if(0 == aStrState.Compare(KBtStateStopped)) //job, printer - return EBtStateStopped; - if(0 == aStrState.Compare(KBtStatePrinting)) //job - return EBtStatePrinting; - if(0 == aStrState.Compare(KBtStateWaiting)) //job - return EBtStateWaiting; - if(0 == aStrState.Compare(KBtStateCompleted)) //job - return EBtStateCompleted; - if(0 == aStrState.Compare(KBtStateAborted)) //job - return EBtStateAborted; - if(0 == aStrState.Compare(KBtStateCancelled)) //job - return EBtStateCancelled; - - return EBtStateUnknown; - } - - inline static TInt PrintError(const TDesC8& aCode) - { - if(0 == aCode.Compare(KPrintReasonNone)) - return ENoMessage; - if(0 == aCode.Compare(KPrintReasonAttentionRequired)) - return EPrintReasonAttentionRequired; - if(0 == aCode.Compare(KPrintReasonMediaJam)) - return EPbStatusErrorReasonPaperJam; - if(0 == aCode.Compare(KPrintReasonPaused)) - return EPrintReasonPaused; - if(0 == aCode.Compare(KPrintReasonDoorOpen)) - return EPbStatusErrorReasonHardwareCoverOpen; - if(0 == aCode.Compare(KPrintReasonMediaLow)) - return EPbStatusErrorReasonPaperNearlyEmpty; - if(0 == aCode.Compare(KPrintReasonMediaEmpty)) - return EPbStatusErrorReasonPaperEmpty; - if(0 == aCode.Compare(KPrintReasonOutputAreaAlmostFull)) - return EPrintReasonOutputAreaAlmostFull; - if(0 == aCode.Compare(KPrintReasonOutputAreaFull)) - return EPrintReasonOutputAreaFull; - if(0 == aCode.Compare(KPrintReasonMarkerSupplyLow)) - return EPrintReasonMarkerSupplyLow; - if(0 == aCode.Compare(KPrintReasonMarkerSupplyEmpty)) - return EPrintReasonMarkerSupplyEmpty; - if(0 == aCode.Compare(KPrintReasonMarkerFailure)) - return EPrintReasonMarkerFailure; - if(0 == aCode.Compare(KPrintReasonMediaChangeRequest)) - return EPbStatusErrorReasonPaperMedia; - if(0 == aCode.Compare(KPrintReasonVendorDefined)) - return EPbCheckPrinter; - - return EPbCheckPrinter; - }; - - inline static TInt HttpError(TInt /*aCode*/) - { - return EPbCheckPrinter; - }; - - inline static TInt OperationStatus(const TDesC8& aCode) - { - return HexToInt(aCode); - } - - inline static void Layout(const TDesC8& aCode, RArray& aArray) - { - TInt layout; - switch(Int(aCode)) - { - case 16: - layout = EPrintCapabLayout16Up; - aArray.Append(layout); - case 12: - layout = EPrintCapabLayout12Up; - aArray.Append(layout); - case 9: - layout = EPrintCapabLayout9Up; - aArray.Append(layout); - case 6: - layout = EPrintCapabLayout6Up; - aArray.Append(layout); - case 4: - layout = EPrintCapabLayout4Up; - aArray.Append(layout); - case 2: - layout = EPrintCapabLayout2Up; - aArray.Append(layout); - case 1: - layout = EPrintCapabLayout1UpBorder; - aArray.Append(layout); - default: - layout = EPrintCapabLayout1UpBorderless; - aArray.Append(layout); - break; - - } - }; - - inline static TInt Size(const TDesC8& aCode) - { - if(0 <= aCode.Find(KPaperSize4x6)) - return EPrintCapabPaperSize4x6;//default - if(0 <= aCode.Find(KPaperSizeA4)) - return EPrintCapabPaperSizeA4; - if(0 <= aCode.Find(KPaperSizeA6)) - return EPrintCapabPaperSizeA6; - if(0 <= aCode.Find(KPaperSize5x7)) - return EPrintCapabPaperSize5x7; - if(0 <= aCode.Find(KPaperSizeLetter)) - return EPrintCapabPaperSizeLetter; - return KErrNotSupported; - }; - - inline static TInt Quality(const TDesC8& aCode) - { - if(0 <= aCode.Find(KQualityDraft)) - return EPrintCapabQualityDraft; - if(0 <= aCode.Find(KQualityNormal)) - return EPrintCapabQualityNormal; - if(0 <= aCode.Find(KQualityHigh)) - return EPrintCapabQualityFine; - return EPrintCapabQualityDefault; - }; - - inline static TInt TripletValue(const TDesC8& aParams, TInt& aPos, TUint& aTag) - { - // get tag - aTag = aParams[aPos]; - ++aPos; - - //get len - TInt len = aParams[aPos]; - ++aPos; - - TInt value = 0; - TInt shift = (len-1)*8; - while(0 <= shift) - { - value |= (aParams[aPos] << shift); - ++aPos; - shift -= 8; - } - - return value; - }; - - }; - -#endif // TBTMAPPER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtchannelbase.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtchannelbase.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,543 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtChannelBase class. -* -*/ - - -#include - -#include "crsbtdevice.h" -#include "cbtchannelbase.h" -#include "cbtsoapcodec.h" -#include "clog.h" -#include "tbtmapper.h" -#include "cbtdiscover.h" -#include "printmessagecodes.h" -#include "rsutils.h" - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::CBtChannelBase -// -//-------------------------------------------------------------------------------------------- -CBtChannelBase::CBtChannelBase(MBtPCObserver& aObs): - CActive(CActive::EPriorityStandard), - iObs( aObs ), - iState( EStateNone ), - iJobId( KErrNotFound ), - iChannel( NULL ), - iSoapCodec( NULL ), - iObexBufObject( NULL ), - iObexNullObject( NULL ), - iObexBody( NULL ), - iDevice( NULL ), - iWait( NULL ), - iResponseError(KErrNone), - iStop(EFalse) -{ - LOG("[CBtChannelBase::CBtChannelBase]\t"); - CActiveScheduler::Add(this); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::~CBtChannelBase -// -//-------------------------------------------------------------------------------------------- -CBtChannelBase::~CBtChannelBase() -{ - LOG("[CBtChannelBase::~CBtChannelBase]\t"); - - if(iWait) - { - StopWaiting(); - delete iWait; - } - - ClearConnection(); - - if(iSoapCodec) - delete iSoapCodec; - - if(iObexNullObject) - delete iObexNullObject; - - if(iObexBufObject) - delete iObexBufObject; - - if(iObexBody) - delete iObexBody; - - if(iChannel) - { - delete iChannel; - iChannel = NULL; - } - if (iPasswordQuery) - { - delete iPasswordQuery; - iPasswordQuery = NULL; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::ConstructL() -{ - LOG("[CBtChannelBase::ConstructL]\t begin"); - - iWait = new (ELeave) CActiveSchedulerWait; - - LOG("[CBtChannelBase::ConstructL]\t iSoapCodec"); - iSoapCodec = CBtSoapCodec::NewL(); - - // Create obex objects here: do not NEVER delete them but in destructor - iObexBody = CBufFlat::NewL(8); - iObexBufObject = CObexBufObject::NewL(iObexBody); - iObexNullObject = CObexNullObject::NewL(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::SetDevice -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::SetJobId( TInt aId ) -{ - iJobId = aId; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::Device -// -//-------------------------------------------------------------------------------------------- -TInt CBtChannelBase::JobId() const -{ - return iJobId; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::SetDevice -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::SetDevice( CRsBtDevice& aDevice ) -{ - iDevice = &aDevice; - LOG1("[CBtChannelBase::SetDevice]\t iDevice %d", iDevice); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::Device -// -//-------------------------------------------------------------------------------------------- -const CRsBtDevice& CBtChannelBase::Device() const -{ - return *iDevice; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::StartL -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::StartL( CRsBtDevice& aDevice ) -{ - LOG1("[CBtChannelBase::StartL]\t state %d", iState); - - User::LeaveIfNull(&aDevice); - - Stop(); - - iStop = EFalse; - - TBool btOn = RsUtils::IsBluetoothOn(); - LOG1("[CBtChannelBase::StartL]\t btOn: %d", btOn); - if( !btOn ) - User::Leave( EObexConnectError ); - - SetDevice( aDevice ); - iState = EStateNone; - ConnectL(); - WaitL(); - - LOG("[CBtChannelBase::StartL]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::Stop -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::Stop() -{ - LOG("[CBtChannelBase::Stop]\t"); - - iStop = ETrue; - - if( IsActive() ) - { - Cancel(); - } - else - StopWaiting(); - - ClearConnection(); - LOG("[CBtChannelBase::Stop]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::DoCancel -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::DoCancel() -{ - LOG("[CBtChannelBase::DoCancel]\t"); - - StopWaiting(); - - LOG1("[CBtChannelBase::DoCancel]\t iChannel %d", iChannel); - if(iChannel) - { - LOG1("[CBtChannelBase::DoCancel]\t iStatus.Int(): 0x%X", iStatus.Int()); - if(KRequestPending == iStatus.Int()) - { - DeleteChannel(); - } - } - - LOG1("[CBtChannelBase::DoCancel]\t out iStatus 0x%X", iStatus.Int()); -} - -//------------------------------ -// InCalls -//------------------------------ - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::IsConnected -// -//-------------------------------------------------------------------------------------------- -TBool CBtChannelBase::IsConnected() -{ - TBool connected = EFalse; - - if(iChannel && iChannel->IsConnected()) - { - connected = ETrue; - } - - LOG2("[CBtChannelBase::IsConnected]\t iChannel: %d, connected: %d", iChannel, connected); - - return connected; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::Disconnect -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::Disconnect() -{ - TBool conn = IsConnected(); - LOG1("[CBtChannelBase::Disconnect]\t IsConnected(): %d", conn); - - if( conn ) - { - if(IsActive()) - { - LOG("[CBtChannelBase::Disconnect]\t iChannel abort"); - iChannel->Abort(); - } - else - { - LOG("[CBtChannelBase::Disconnect]\t iChannel disconnect"); - iState = EStateDisconnecting; - iChannel->Disconnect(iStatus); - Activate(); - } - iStop = ETrue; - } - else - { - DeleteChannel(); - iState = EStateNone; - } - - LOG1("[CBtChannelBase::Disconnect]\t out. iState: %d", iState); - return; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::FinishPrinting -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::FinishPrinting() -{ - LOG("[CBtChannelBase::FinishPrintingL]\t begin"); - - // Already finishing - if(EStateFinish == iState) - { - LOG("[CBtChannelBase::FinishPrintingL]\t already finishing"); - return; - } - - iState = EStateDisconnecting; - - LOG1("[CBtChannelBase::FinishPrintingL]\t IsActive() %d", IsActive()); - if(IsActive()) - { - //return: the iState causes disconnection printing when RunL called. - return; - } - - IsConnected(); - Disconnect(); - - LOG("[CBtChannelBase::FinishPrintingL]\t end"); - return; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::SendSoapRequestL -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::SendSoapRequestL(const TInt aRequest, const TInt aJobId) -{ - SendSoapRequestL(aRequest, iStatus, aJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::SendSoapRequestL -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::SendSoapRequestL(const TInt aRequest, - TRequestStatus& aStatus, - const TInt aJobId) -{ - LOG1("[CBtChannelBase::SendSoapRequestL]\t begin for %d", aRequest); - User::LeaveIfNull(iChannel); - User::LeaveIfNull(iObexBufObject); // panics if iObexBody == NULL - - /* Create soap from file */ - if(!iSoapCodec) - { - iSoapCodec = CBtSoapCodec::NewL(); - } - TPtrC8 soap = iSoapCodec->CreateSoapL(aRequest, aJobId); - - LOG2("[CBtChannelBase::SendSoapRequestL]\t Soap created for %d. len: %d",aRequest, soap.Length()); - - iObexBufObject->Reset(); - - iObexBody->InsertL(0, soap); - LOG1("[CBtChannelBase::SendSoapRequestL]\t data size %d", iObexBody->Size()); - - iObexBufObject->SetTypeL(KBtMimeTypeSoap()); - - LOG("[CBtChannelBase::SendSoapRequestL]\t Issuing get."); - iChannel->Get(*iObexBufObject, aStatus); - - Activate(); - LOG("[CBtChannelBase::SendSoapRequestL]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::GetSoapResponseL -// -//-------------------------------------------------------------------------------------------- -TInt CBtChannelBase::GetSoapResponseL() -{ - LOG("[CBtChannelBase::GetSoapResponseL]\t"); - - if( 0 >= iObexBody->Size() ) - User::Leave(KErrInvalidData); - - LOG("[CBtChannelBase::GetSoapResponseL]\t Data in obex body."); - LOG1("[CBtChannelBase::GetSoapResponseL]\t iDevice: %d", iDevice); - TInt action = EBtUnknownAction; - - //give obexbody to parser - if(!iSoapCodec) - { - iSoapCodec = CBtSoapCodec::NewL(); - } - - //read - iSoapCodec->ReadSoapL(action, *iObexBody); - LOG1("[CBtChannelBase::GetSoapResponseL]\t soap read. Action %d", action); - - // Reset object: data is stored in iSoapCodec. - // NOTE: reset resets also iObexBody - iObexBufObject->Reset(); - - LOG("[CBtChannelBase::GetSoapResponseL]\t done"); - return action; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::Activate -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::Activate() -{ - // If already active do not activate again - LOG2("[CBtChannelBase::Activate]\t for %d, IsActive %d",iState, IsActive()); - if( IsActive() ) - return; - - SetActive(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::CompleteRequest -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::CompleteRequest(TControlState aStateCompleted, TInt aError) -{ - LOG2("[CBtChannelBase::CompleteRequest]\t aStateCompleted %d, aError %d",aStateCompleted, aError); - iState = aStateCompleted; - - LOG2("[CBtChannelBase::CompleteRequest]\t IsActive() %d, iStatus %d", IsActive(), iStatus.Int()); - if(IsActive() && KRequestPending == iStatus.Int()) - { - TRequestStatus* statusPtr = &iStatus; - User::RequestComplete(statusPtr, aError); - } - if(EStateNone != aStateCompleted) - { - Activate(); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::StartWaiting -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::WaitL() -{ - if( !(iWait->IsStarted()) && KRequestPending == iStatus.Int()) - { - LOG("[CBtChannelBase::WaitL]\t"); - iWait->Start(); - - LOG2("[CBtChannelBase::WaitL]\t Continue, iStatus: %d at iState: %d", iStatus.Int(), iState); - LOG1("[CBtChannelBase::WaitL]\t iStop: %d",iStop); - if(KErrNone != iStatus.Int() && KRequestPending != iStatus.Int() && !iStop) - User::Leave(iStatus.Int()); - LOG("[CBtChannelBase::WaitL]\t out"); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::StopWaiting -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::StopWaiting() -{ - if( (iWait->IsStarted()) ) - { - LOG("[CBtChannelBase::StopWaiting]\t"); - iWait->AsyncStop(); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::ClearConnection -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::ClearConnection() -{ - LOG1("[CBtChannelBase::ClearConnection]\t iState %d", iState); - - Cancel(); - - iObexBufObject->Reset(); - iObexNullObject->Reset(); - iDevice = NULL; - - if(iChannel) - { - LOG("[CBtChannelBase::ClearConnection]\t iChannel clear"); - //Sends the abort operation to receiver and completes request with KErrAbort - Disconnect(); - } - LOG("[CBtChannelBase::ClearConnection]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::DeleteChannel -// -//-------------------------------------------------------------------------------------------- -void CBtChannelBase::DeleteChannel() -{ - LOG1("[CBtChannelBase::DeleteChannel]\t iChannel %d delete", iChannel); - if(iChannel) - { - delete iChannel; - iChannel = NULL; - } - iStop = EFalse; - - LOG1("[CBtChannelBase::DeleteChannel]\t iChannel %d out", iChannel); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtChannelBase::GetUserPasswordL -// -//-------------------------------------------------------------------------------------------- - -void CBtChannelBase::GetUserPasswordL( const TDesC &aRealm ) -{ - LOG("[CBtChannelBase::GetUserPasswordL begin]\t"); - - iPasswordQuery = CBtPasswordQuery::NewL( *this ); - - iPasswordQuery->StartActiveObjectL(); - - LOG("[CBtChannelBase::GetUserPasswordL end]\t"); -} - -void CBtChannelBase::PasswordQueryCompleteL ( TObexPasskeyBuf aResultPckg ) - { - iPckg = aResultPckg(); - - TBuf<256> data; - data.Copy(iPckg); - - // Send user password - iChannel->UserPasswordL(data); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdevicecontainer.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdevicecontainer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,404 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -// EXTERNAL INCLUDES -#include - -#include "cbtdevicecontainer.h" -#include "crsbtdevice.h" -#include "rsutils.h" -#include "mprotprintingdevice.h" -#include "clog.h" - -// CONSTANTS -namespace - { - /// File name where the BT devices will be stored, for future sessions. - _LIT(KUsedDevicesFile,"btdevices.dat"); - /// Maximum number of Bluetooth devices to be stored. - const TInt KUsedDevicesMax = 150; - /// Version of the file where the BT devices will be stored. - const TInt KUsedDevicesVersion = 5; - } - - - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -CBtDeviceContainer* CBtDeviceContainer::NewL() - { - CBtDeviceContainer* self = new (ELeave) CBtDeviceContainer(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -void CBtDeviceContainer::ConstructL() - { - User::LeaveIfError( iFs.Connect()); - TInt err = RsUtils::CreateDataFolder( iFs, iDataFolder ); - LOG1("[CBtDeviceContainer::ConstructL]\t err: %d", err ); - iDataFolder = RsUtils::PathNotRom( iDataFolder ); - iFs.SetSessionPath( iDataFolder ); - LOG1("CBtDeviceContainer::ConstructL iDataFolder: %S", &iDataFolder ); - } - -CBtDeviceContainer::CBtDeviceContainer() : iVersion(KUsedDevicesVersion) - { - } - -CBtDeviceContainer::~CBtDeviceContainer() - { - LOG("CBtDeviceContainer::~CBtDeviceContainer begin"); - iDeviceArray.ResetAndDestroy(); - iDeviceArray.Close(); - iFs.Close(); - LOG("CBtDeviceContainer::~CBtDeviceContainer end"); - } - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::StoreL -// -//-------------------------------------------------------------------------------------------- -void CBtDeviceContainer::StoreL() -{ - LOG("[CBtDeviceContainer::StoreL]\t begin"); - - TFileName fileName( iDataFolder ); - fileName.Append( KUsedDevicesFile ); - LOG1("CBtDeviceContainer::StoreL fileName 1: %S", &fileName); - - RFileWriteStream outstream; - TFileName tempFileName; - - User::LeaveIfError( outstream.Temp( iFs, iDataFolder, tempFileName, EFileWrite ) ); - LOG1("[CBtDeviceContainer::StoreL]\t tempFileName: %S", &tempFileName); - - CleanupClosePushL( outstream ); - ExternalizeL( outstream ); - // makes sure all data is written from the buffer to file, before calling close. - outstream.CommitL(); - CleanupStack::PopAndDestroy(); // outstream - - if( RsUtils::FileExists( fileName, iFs ) ) - User::LeaveIfError( iFs.Delete( fileName ) ); - User::LeaveIfError( iFs.Rename( tempFileName, fileName ) ); - - LOG("[CBtDeviceContainer::StoreL]\t end"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::RestoreL -// -//-------------------------------------------------------------------------------------------- -void CBtDeviceContainer::RestoreL() -{ - TFileName fileName( iDataFolder ); - fileName.Append( KUsedDevicesFile ); - - RFileReadStream instream; - CleanupClosePushL( instream ); - - User::LeaveIfError( instream.Open( iFs, fileName, EFileRead ) ); - InternalizeL(instream); - - CleanupStack::PopAndDestroy(); // instream -} - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::ExternalizeL -// -//-------------------------------------------------------------------------------------------- -void CBtDeviceContainer::ExternalizeL(RWriteStream& aStream) const - { - TInt count = 0; - for( TInt i = 0; i < iDeviceArray.Count(); i++ ) - { - if(iDeviceArray[i]->IsUsed()) - { - ++count; - } - } - LOG1("[CBtDeviceContainer::ExternalizeL]\t count: %d", count); - if(0 == count) - { - return; - } - - aStream.WriteInt32L(iVersion); - aStream.WriteInt32L(iCurrentId); - aStream.WriteInt32L(count); - for( TInt i = 0; i < iDeviceArray.Count(); i++ ) - { - if(iDeviceArray[i]->IsUsed()) - { - aStream << *(iDeviceArray[i]); - } - } - LOG("CBtDeviceContainer::ExternalizeL end"); - } - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::InternalizeL -// -//-------------------------------------------------------------------------------------------- -void CBtDeviceContainer::InternalizeL(RReadStream& aStream) -{ - TInt version = aStream.ReadInt32L(); - if (version != KUsedDevicesVersion) - { - return; - } - iVersion = version; - - iCurrentId = aStream.ReadInt32L(); - TInt count = aStream.ReadInt32L(); - for (TInt i = 0; i < count; i++) - { - CRsBtDevice* tmpDevice = CRsBtDevice::NewLC(); - - tmpDevice->InternalizeL(aStream); - - tmpDevice->SetUsed(ETrue); - tmpDevice->SetJustFound(EFalse); - User::LeaveIfError( iDeviceArray.Append( tmpDevice ) ); - CleanupStack::Pop(); // tmpDevice - } -} - -CRsBtDevice* CBtDeviceContainer::At(TInt aPosition) const - { - if( aPosition >= 0 && aPosition < iDeviceArray.Count() ) - { - return iDeviceArray[aPosition]; - } - else - { - return NULL; - } - } - -TInt CBtDeviceContainer::Count() const - { - return iDeviceArray.Count(); - } - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::Find -// -//-------------------------------------------------------------------------------------------- -TInt CBtDeviceContainer::Find( const CRsBtDevice &aDevice, TInt aInitIndex) const -{ - TInt nCnt; - CRsBtDevice *cmpDev; - - for (nCnt = aInitIndex+1; nCnt < iDeviceArray.Count(); nCnt++) - { - cmpDev = iDeviceArray[nCnt]; - if (cmpDev->Equals(aDevice)) - { - return nCnt; - } - } - - return KErrNotFound; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::Find -// -//-------------------------------------------------------------------------------------------- -TInt CBtDeviceContainer::Find( const TInt aDeviceId, TInt aInitIndex) const -{ - for (TInt i = aInitIndex+1; i < iDeviceArray.Count(); i++) - { - if (iDeviceArray[i]->DeviceId() == aDeviceId) - { - return i; - } - } - return KErrNotFound; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::Delete -// -//-------------------------------------------------------------------------------------------- -TInt CBtDeviceContainer::Delete( const TInt aDeviceId ) -{ - TInt pos = Find(aDeviceId); - if(KErrNotFound != pos) - { - iDeviceArray[pos]->SetUsed(EFalse); - } - return pos; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::Delete -// -//-------------------------------------------------------------------------------------------- -TInt CBtDeviceContainer::Delete( const CRsBtDevice &aDevice ) -{ - TInt pos = Find(aDevice); - if(KErrNotFound != pos) - { - iDeviceArray[pos]->SetUsed(EFalse); - } - return pos; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtDeviceContainer::AppendL -// -//-------------------------------------------------------------------------------------------- -void CBtDeviceContainer::AppendL( CRsBtDevice* aDevice ) -{ - LOG1("[CBtDeviceContainer::AppendL]\t %S", &(aDevice->FriendlyName())); - - if( iDeviceArray.Count() == KUsedDevicesMax ) - { - TInt nOldest = FindOldest(ENotUsed | ETimeLastUsed); - CRsBtDevice* device = iDeviceArray[nOldest]; - iDeviceArray.Remove(nOldest); - delete device; - } - - if( aDevice->DeviceId() <= 0 ) - { - aDevice->SetDeviceId( GetAvailableId( *aDevice ) ); - } - iDeviceArray.AppendL( aDevice ); -} - -TInt CBtDeviceContainer::FindOldest(TUint aFlags) const - { - TInt oldest=-1; - TTime timeOldest, timeCmp; - CRsBtDevice *cmpDev; - TBool bSavedCheck; - - timeOldest.UniversalTime(); - for (TInt i=0; i < iDeviceArray.Count(); ++i) - { - cmpDev = iDeviceArray[i]; - if ((aFlags & EUsed) && (aFlags & ENotUsed)) - { - bSavedCheck = ETrue; - } - else if (aFlags & ESaved) - { - bSavedCheck = cmpDev->IsUsed(); - } - else if (aFlags & ENotUsed) - { - bSavedCheck = !(cmpDev->IsUsed()); - } - else - { - bSavedCheck = ETrue; - } - - if (bSavedCheck) - { - if (aFlags & ETimeLastUsed) - { - timeCmp = cmpDev->TimeLastUsed(); - } - else if (aFlags & ETimeDiscovered) - { - timeCmp = cmpDev->TimeDiscovered(); - } - else - { - // Error, but shouldn't get here if program does the right thing - return -1; - } - - if (timeCmp < timeOldest) - { - oldest = i; - timeOldest = timeCmp; - } - } - } - - return oldest; - } - -TInt CBtDeviceContainer::GetAvailableId( const CRsBtDevice& aDevice ) -{ - LOG("CBtDeviceContainer::GetAvailableId begin"); - const TBTDevAddr& btAddr = aDevice.BDAddr(); - TInt id( 0 ); - TInt intSize = sizeof(TInt); - LOG1("CBtDeviceContainer::GetAvailableId intSize: %d", intSize); - for( TInt i = ( KBTDevAddrSize - 1 ), s = 0; i >= 0 && s < intSize; i--, s++ ) - { - const TUint8& element = btAddr[i]; - TInt temp( element ); - temp <<= ( s * 8 ); - id |= temp; - } - - id &= DEVICE_ID_FIELD_MASK; - LOG1("[CBtDeviceContainer::GetAvailableId]\t id after masking: %d", id); - - while( !IsIdAvailable( id ) ) - { - id++; - } - - iCurrentId = id; - LOG1("[CBtDeviceContainer::GetAvailableId]\t return: %d", iCurrentId); - return iCurrentId; -} - - -TBool CBtDeviceContainer::IsIdAvailable( TInt aId ) const -{ - TBool result( ETrue ); - for( TInt x = 0; x < iDeviceArray.Count() && result; ++x ) - { - if ( aId == iDeviceArray[x]->DeviceId() ) - { - result = EFalse; - } - } - return result; -} - -void CBtDeviceContainer::Reset() - { - iDeviceArray.ResetAndDestroy(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdiscover.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdiscover.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,895 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CBtDiscover class definition. Bluetooth device discovery and SDP. -* -*/ - - -#include "cbtdiscover.h" -#include "clog.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -/** - * @brief Instantiate new CBtDiscover object. - */ -CBtDiscover* CBtDiscover::NewL() - { - CBtDiscover* self = new (ELeave) CBtDiscover(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - - -/** - * @brief Two phase construction. - */ -void CBtDiscover::ConstructL() - { - iSdpSearchPattern = CSdpSearchPattern::NewL(); - iMatchList = CSdpAttrIdMatchList::NewL(); - } - -/** - * @brief Constructor. - */ -CBtDiscover::CBtDiscover() : - iCurrentSDPAttrID(0), - iCurrentServiceUUID(0), - iFoundSTS(EFalse), - iWantedService(ETrue), - iDoingSDP(EFalse), - iFindingDevices(EFalse), - iAgent(NULL), - iRequestStatus(NULL), - iSdpSearchPattern(NULL), - iMatchList(NULL), - iContentTypes(NULL), - iPrinterModel(NULL), - iBPPPort(0), - iSTSPort(0), - iOPPPort(0) - { - } - -/** - * @brief Destructor. - */ -CBtDiscover::~CBtDiscover() - { - LOG("CBtDiscover::~CBtDiscover begin"); - Stop(); - if(iSdpSearchPattern) - delete iSdpSearchPattern; - if(iMatchList) - delete iMatchList; - if(iContentTypes) - delete iContentTypes; - if(iPrinterModel) - delete iPrinterModel; - if(iAgent) - delete iAgent; - LOG("CBtDiscover::~CBtDiscover end"); - } - -/** - * @brief Destructor. - */ -void CBtDiscover::Reset() - { - LOG("CBtDiscover::Reset begin"); - - StopSDP(); // resets also public member variables and iDoingSDP flag - - iBPPPort = 0; - iSTSPort = 0; - iOPPPort = 0; - - if(iPrinterModel) - delete iPrinterModel; - iPrinterModel = NULL; - - if(iSdpSearchPattern) - iSdpSearchPattern->Reset(); - - // No can do if remove fails -> ignore leave - if(iMatchList) - TRAP_IGNORE( iMatchList->RemoveL(TAttrRange(0x0000, 0xFFFF)) ); - - if(iContentTypes) - delete iContentTypes; - iContentTypes = NULL; - - - if( iRequestStatus ) - { - if(KRequestPending == iRequestStatus->Int()) - User::RequestComplete(iRequestStatus, KErrNone); - } - iRequestStatus = NULL; - - LOG("CBtDiscover::Reset end"); - } - -/** - * @brief Starts the asynchronous search for Bluetooth devices. - * - * Starts the asynchronous search for Bluetooth devices. The Active Object containing - * this object, CRsBtDiscoverEngine, is notified after the first device is found. - * @param aStatus Status variable from CRsBtDiscoverEngine, receives notification when asynchronous call completes. - */ -void CBtDiscover::Start(TRequestStatus &aStatus) - { - LOG("[CBtDiscover::Start]\t begin"); - aStatus = KErrNotSupported; - - TInt err = iSocketServ.Connect(); - LOG1("[CBtDiscover::Start]\t iSocketServ.Connect() err: %d", err); - if( KErrNone == err ) - { - err = iHostResolver.Open( iSocketServ, KBTAddrFamily, KBTLinkManager ); - LOG1("[CBtDiscover::Start]\t iHostResolver.Open() err: %d", err); - } - - if( KErrNone == err ) - { - iFindingDevices = ETrue; - iSockAddr.SetIAC( KGIAC ); - iSockAddr.SetAction( KHostResInquiry | KHostResName | KHostResIgnoreCache ); - iHostResolver.GetByAddress( iSockAddr, iNameEntry, aStatus ); - } - else - { - iFindingDevices = EFalse; - iSocketServ.Close(); - iHostResolver.Close(); - } - - LOG("[CBtDiscover::Start]\t end"); - } - -/** - * @brief Continues the asynchronous search for Bluetooth devices. - * - * Continues the asynchronous search for Bluetooth devices. The Active Object containing - * this object, CRsBtDiscoverEngine, is notified after the next device is found. - * @param aStatus Status variable from CRsBtDiscoverEngine, receives notification when asynchronous call completes. - */ -void CBtDiscover::GetNextDevice(TRequestStatus &aStatus) - { - LOG("[CBtDiscover::GetNextDevice]\t"); - iHostResolver.Next(iNameEntry, aStatus); - } - -/** - * @brief Stop the asynchronous search for Bluetooth devices. - */ -void CBtDiscover::Stop() - { - LOG1("[CBtDiscover::Stop]\t begin with iFindingDevices: %d", iFindingDevices); - - if(iFindingDevices) - iHostResolver.Cancel(); - iFindingDevices = EFalse; - - Reset(); - - iHostResolver.Close(); - iSocketServ.Close(); - - LOG("[CBtDiscover::Stop]\t end"); - } - -/** - * @brief Is an asynchronous search for Bluetooth devices in progress? - * @return True, a search is in progress, or False, no search is in progress - */ -TBool CBtDiscover::IsFindingDevices() const - { - return iFindingDevices; - } - -/** - * @brief Get the last Bluetooth device found by the search. - * @return The last Bluetooth device found by the search. - */ -TNameRecord CBtDiscover::GetNameRecord() const - { - return iNameEntry(); - } - -/** - * @brief Store Bluetooth device information, in preparation for doing an SDP query. - */ -void CBtDiscover::SetNameRecord(TNameRecord aNameRecord) - { - TNameEntry nameEntry(aNameRecord); - iNameEntry = nameEntry; - } - -/** - * @brief Starts the asynchronous request for the SDP record. - * - * Starts the asynchronous request for the SDP record from a Bluetooth device. - * Specifically the device is tested for the BPP and OPP services. - * @param aStatus Status variable from CRsBtDiscoverEngine, receives notification when asynchronous call completes. - * @param aServiceMask Bitmask to require (only) certain services. All marked by default. - */ -void CBtDiscover::GetSupportedServicesL(TRequestStatus &aStatus, TUint32 aServiceMask) - { - LOG("[CBtDiscover::GetSupportedServicesL]\t begin"); - - Reset(); - iRequestStatus = &aStatus; - *iRequestStatus = KRequestPending; - - iMatchList->RemoveL(TAttrRange(0x0000, 0xFFFF)); - iMatchList->AddL(TAttrRange(KSdpAttrIdServiceClassIDList)); - iMatchList->AddL(TAttrRange(KSdpAttrIdProtocolDescriptorList)); - iMatchList->AddL(TAttrRange(KSdpAttrIdAdditionalProtocolDescriptorLists)); - iMatchList->AddL(TAttrRange(KSdpAttrIdDocFormatsSupported)); - iMatchList->AddL(TAttrRange(KSdpAttrIdModelID)); - iMatchList->AddL(TAttrRange(KSdpAttrIdMaxWidth)); - iMatchList->AddL(TAttrRange(KSdpAttrIdMaxLen)); - - iSdpSearchPattern->Reset(); - - if(KBtMaskObjectPush & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPOBEXObjectPush); // 0x1105 - if(KBtMaskDirectPrinting & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPDirectPrinting); // 0x1118 - if(KBtMaskPrintingStatus & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPPrintingStatus); // 0x1123 - if(KBtMaskL2CAP & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPL2CAP); - if(KBtMaskRFCOMM & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPRFCOMM); - if(KBtMaskObex & aServiceMask) - iSdpSearchPattern->AddL(KBTSDPObex); - - StartSDPL(); - - LOG("[CBtDiscover::GetSupportedServicesL]\t end"); - } - -/** - * @brief Initiate the SDP request started in VerifyServiceSupportL. - */ -void CBtDiscover::StartSDPL() - { - StopSDP(); - TBTDevAddr btAddr = ((TInquirySockAddr)iNameEntry().iAddr).BTAddr(); - iAgent = CSdpAgent::NewL(*this, btAddr); - iAgent->SetRecordFilterL(*iSdpSearchPattern); - iAgent->SetAttributePredictorListL(*iMatchList); - iAgent->NextRecordRequestL(); - iDoingSDP = ETrue; - } - -/** - * @brief Stop the asynchronous request for the SDP record from a Bluetooth device. - */ -void CBtDiscover::StopSDP() - { - LOG1("[CBtDiscover::StopSDP] begin with iAgent address: %d", TInt(iAgent)); - iDoingSDP = EFalse; - - iCurrentSDPAttrID = 0; - iCurrentServiceUUID = 0; - iFoundSTS = EFalse; - iWantedService = ETrue; - - if( iAgent ) - { - iAgent->Cancel(); - delete iAgent; - iAgent = NULL; - } - LOG("[CBtDiscover::StopSDP] end"); - } - -/** - * @brief Is an asynchronous request for the SDP record in progress?. - * - * Is an asynchronous request for the SDP record from a Bluetooth device in progress? - * @return True, a request is in progress, or False, no request is in progress - */ -TBool CBtDiscover::IsDoingSDP() const - { - return iDoingSDP; - } - -/** - * The CSdpAgent object calls this to notify that the attributes from an SDP record are ready for parsing. - * @param aAttrValue Structured attribute(s) of SDP record, parsed with TBTAttribValVisitor - */ -void CBtDiscover::AttributeRequestResult(TSdpServRecordHandle /*aHandle*/, TSdpAttributeID aAttrID, CSdpAttrValue *aAttrValue) - { - TRAPD( err, AttributeRequestResultL( aAttrID, aAttrValue ) ); - if(KErrNone != err) - LOG1("[CBtDiscover::AttributeRequestResult]\t AttributeRequestResultL leaves with: %d", err); - } - -void CBtDiscover::AttributeRequestResultL( TSdpAttributeID aAttrID, CSdpAttrValue* aValue ) - { - LOG1("[CBtDiscover::AttributeRequestResultL]\t *** Device: %S: ", &GetDeviceName() ); - LOG2("CBtDiscover::AttributeRequestResultL aAttrID: %d, aValue->Type(): %d", aAttrID, aValue->Type()); - - iCurrentSDPAttrID = aAttrID; - CBTAttribValVisitor* valVisitor = NULL; - - switch( aAttrID ) - { - case KSdpAttrIdServiceClassIDList: - iCurrentServiceUUID = 0; // reset - case KSdpAttrIdProtocolDescriptorList: - case KSdpAttrIdAdditionalProtocolDescriptorLists: - case KSdpAttrIdDocFormatsSupported: - case KSdpAttrIdModelID: - case KSdpAttrIdMaxWidth: - case KSdpAttrIdMaxLen: - valVisitor = CBTAttribValVisitor::NewLC( *this ); - aValue->AcceptVisitorL( *valVisitor ); // goes in CBTAttribValVisitor::VisitAttributeValueL - CleanupStack::PopAndDestroy( valVisitor ); - break; - default: - break; - } - - delete aValue; - - LOG("CBtDiscover::AttributeRequestResultL end"); - } - - -/** - * The CSdpAgent object calls this to notify that the SDP record request has been completed. - */ -void CBtDiscover::NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount) - { - LOG1("CBtDiscover::NextRecordRequestComplete aError: %d", aError); - LOG1("CBtDiscover::NextRecordRequestComplete aHandle: %d", aHandle); - LOG1("CBtDiscover::NextRecordRequestComplete aTotalRecordsCount: %d", aTotalRecordsCount); - TInt err( aError ); - - if( KErrNone == aError && aTotalRecordsCount > 0) - { - TRAP( err, iAgent->AttributeRequestL( aHandle, KSdpAttrIdServiceClassIDList ) ); - LOG1("CBtDiscover::NextRecordRequestComplete err: %d", err); - } - - if( KErrNone != err || !aTotalRecordsCount ) - { - if( KErrEof == err || !aTotalRecordsCount ) - { - err = KErrNone; - } - StopSDP(); - LOG("CBtDiscover::NextRecordRequestComplete User::RequestComplete"); - User::RequestComplete( iRequestStatus, err ); - } - - // reset - iCurrentServiceUUID = 0; - iWantedService = ETrue; - iCurrentSDPAttrID = 0; - LOG("CBtDiscover::NextRecordRequestComplete end"); - } - -/** - * The CSdpAgent object calls this to notify that the current SDP record has no more attributes. - * @param aError Standard Symbian error code, KErrNone indicates success. - */ -void CBtDiscover::AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError) -{ - LOG("[CBtDiscover::AttributeRequestComplete]\t Begin."); - if( KErrNone != aError || !iWantedService || 0 == iCurrentSDPAttrID) - { - LOG1("[CBtDiscover::AttributeRequestComplete]\t err: %d", aError); - iCurrentSDPAttrID = 0; - LOG("[CBtDiscover::AttributeRequestComplete]\t Not wanted service. Get next record."); - TRAPD( err, iAgent->NextRecordRequestL() ); - if(KErrNone != err) - { - NextRecordRequestComplete(err, aHandle, 0); - } - } - else - { - LOG("[CBtDiscover::AttributeRequestComplete]\t Wanted service. Get next attribute."); - TRAPD( err, GetNextAttributeL(aHandle) ); - if( KErrNone != err ) - LOG1("[CBtDiscover::AttributeRequestComplete]\t err: %d", err); - } - iCurrentSDPAttrID = 0; - LOG("[CBtDiscover::AttributeRequestComplete]\t End."); -} - -/** - * @brief Get BPP port. - * @return Port (i.e. Bluetooth channel) of the BPP service on the printer. Returns -1 if port is unknown. - */ -TInt CBtDiscover::GetBPPPort() const - { - return iBPPPort; - } - -/** - * @brief Get Status port. - * @return Port (i.e. Bluetooth channel) of the status service on the printer. Returns -1 if port is unknown. - */ -TInt CBtDiscover::GetSTSPort() const - { - return iSTSPort; - } - -/** - * @brief Get OPP port. - * @return Port (i.e. Bluetooth channel) of the OPP service on the printer. Returns -1 if port is unknown. - */ -TInt CBtDiscover::GetOPPPort() const - { - return iOPPPort; - } - -/** - * @brief Set the BPP Port. - * - * Called from TBTAttribValVisitor to set the Port (i.e. Bluetooth channel). - * Also used to indicate that the BPP service was successfully detected in the SDP response. - */ -void CBtDiscover::SetBPPPort(TInt aPort) - { - LOG1("CBtDiscover::SetBPPPort aPort: %d", aPort); - iBPPPort = aPort; - } - -/** - * @brief Set the Status Port. - * - * Called from TBTAttribValVisitor to set the Port (i.e. Bluetooth channel). - * Also used to indicate that the Status service was successfully detected in the SDP response. - */ -void CBtDiscover::SetSTSPort(TInt aPort) - { - LOG1("CBtDiscover::SetSTSPort aPort: %d", aPort); - iSTSPort = aPort; - } -/** - * @brief Set the OPP Port. - * - * Called from TBTAttribValVisitor to set the Port (i.e. Bluetooth channel). - * Also used to indicate that the OPP service was successfully detected in the SDP response. - */ -void CBtDiscover::SetOPPPort(TInt aPort) - { - LOG1("CBtDiscover::SetOPPPort aPort: %d", aPort); - iOPPPort = aPort; - } - -/** - * @brief Bluetooth device supports BPP?. - * - * Does the SDP response for the current Bluetooth device indicate that BPP is supported? - * Checks to make sure that a Port (i.e. Bluetooth channel) for the BPP service was determined, - * AND that the device supports the Mime/Multiplex document type. - * @return True, BPP is supported, or False, BPP is not supported - */ -TBool CBtDiscover::IsBPPSupported() const - { - _LIT(KMimeXhtmlType, "application/vnd.pwg-xhtml-print+xml"); - _LIT(KMimeMultiplexType, "application/vnd.pwg-multiplexed"); - LOG1("CBtDiscover::IsBPPSupported iBPPPort: %d", iBPPPort); - return ( iBPPPort && (SupportsContentType( KMimeMultiplexType ) || SupportsContentType( KMimeXhtmlType )) ); - } - -/** - * @brief Bluetooth device supports OPP?. - * - * Does the SDP response for the current Bluetooth device indicate that OPP is supported? - * @return True if OPP is supported. False if OPP is not supported. - */ -TBool CBtDiscover::IsOPPSupported() const - { - LOG1("CBtDiscover::IsOPPSupported iOPPPort: %d", iOPPPort); - if(iOPPPort) - return ETrue; - else - return iOPPPort; - } - -/** - * @brief Obtain Bluetooth device class. - * - * @return Bluetooth device class. Used by CRsBtDiscoverEngine to do the first check - * whether the current Bluetooth device is likely to support BPP or OPP. - * @sa KBTMinDevClassPrinter - */ -TBTDeviceClass CBtDiscover::GetDeviceClass() const - { - TInquirySockAddr sockAddr = (TInquirySockAddr)iNameEntry().iAddr; - TBTDeviceClass devClass(sockAddr.MajorServiceClass(), - sockAddr.MajorClassOfDevice(), - sockAddr.MinorClassOfDevice()); - - return devClass; - } - -/** - * @brief Obtain Bluetooth device name. - * - * @return Friendly name of current Bluetooth device. - */ -const TDesC& CBtDiscover::GetDeviceName() const - { - return iNameEntry().iName; - } - -/** - * @brief Sets supported content types. - * - * Called from TBTAttribValVisitor to set the supported content types. - * @param aString String of comma separated mime-types. - */ -void CBtDiscover::SetContentTypesL(const TPtrC8 &aString) - { -#ifdef _DEBUG - - LOG1("CBtDiscover::SetContentTypesL %d", aString.Length()); - - TInt start = 0; - TInt end = aString.Locate(','); - TPtrC8 ptr; - while(end > 0 && start <= aString.Length()) - { - ptr.Set(aString.Mid(start, end)); - LOG81("[CBtDiscover::SetContentTypesL]\t ptr: \"%S\"", &ptr); - ++end; - start += end; - if(start > aString.Length()) - break; - - TPtrC8 left = aString.Mid(start); - end = left.Locate(','); - if(KErrNotFound == end) - end = aString.Length() - start; - } - -#endif - delete iContentTypes; - iContentTypes = NULL; - iContentTypes = HBufC::NewL(aString.Length()); - TPtr bufPtr(iContentTypes->Des()); - bufPtr.Copy(aString); - } - -/** - * @brief Ask if device supports a content type. - * - * Searches the string of supported content types found in the SDP record of the current Bluetooth device. - * - * @param aContType Mime-type to search for. - * - * @return True, if the passed in content type was found, False, if it was not found - */ -TBool CBtDiscover::SupportsContentType(const TDesC &aContType) const - { - LOG1("CBtDiscover::SupportsContentType aContType: %S", &aContType); - TPtr bufPtr(iContentTypes->Des()); - - if( bufPtr.Length() == 0 ) - { - LOG("CBtDiscover::SupportsContentType length == 0"); - return EFalse; - } - - if( bufPtr.Find(aContType) == KErrNotFound ) - { - LOG("CBtDiscover::SupportsContentType Find == KErrNotFound"); - return EFalse; - } - else - { - LOG("CBtDiscover::SupportsContentType Found"); - return ETrue; - } - } - -/** - * @brief Called from TBTAttribValVisitor to set the printer model. - * @param aString String of semi-colon separated printer details. - */ -void CBtDiscover::SetPrinterModelL(const TPtrC8 &aString) - { - LOG81("CBtDiscover::SetPrinterModelL aString: %S", &aString); - - if(iPrinterModel) - delete iPrinterModel; - iPrinterModel = NULL; - - _LIT8(KModelString, ";MDL:"); - TInt pos = aString.Find( KModelString ); - LOG1("[CBtDiscover::SetPrinterModelL]\t pos: %d", pos); - if( pos != KErrNotFound ) - { - TPtrC8 tmpStr = aString.Right(aString.Length() - pos - 5); - pos = tmpStr.Locate(';'); - if( pos != KErrNotFound ) - { - iPrinterModel = HBufC::NewL(pos); - iPrinterModel->Des().Copy(tmpStr.Left(pos)); - } - } - - LOG("CBtDiscover::SetPrinterModelL end"); - } - -/** - * @brief Obtain Printer Model. - * - * Gets a TDesC& to the printer model previously set with SetPrinterModelL(), - * or KNullDesC if no printer model has been set. - * - * @return String with the printer model. - */ -const TDesC& CBtDiscover::GetPrinterModel() const - { - if (iPrinterModel) - return *iPrinterModel; - else - return KNullDesC; - } - -void CBtDiscover::SetVendor( TPrinter::TPrinterVendor aVendor ) - { - LOG1("CBtDiscover::SetVendor aVendor: %d", aVendor); - iVendor = aVendor; - } - -TPrinter::TPrinterVendor CBtDiscover::GetVendor() const - { - LOG1("CBtDiscover::GetVendor return: %d", iVendor); - return iVendor; - } - -void CBtDiscover::GetNextAttributeL(TSdpServRecordHandle aHandle) - { - LOG1("[CBtDiscover::GetNextAttributeL]\t iCurrentSDPAttrID: 0x%X", iCurrentSDPAttrID); - - TSdpAttributeID nextId; - - switch( iCurrentSDPAttrID ) - { - case KSdpAttrIdServiceClassIDList: - nextId = KSdpAttrIdProtocolDescriptorList; - break; - case KSdpAttrIdProtocolDescriptorList: - nextId = KSdpAttrIdAdditionalProtocolDescriptorLists; - break; - case KSdpAttrIdAdditionalProtocolDescriptorLists: - nextId = KSdpAttrIdDocFormatsSupported; - break; - case KSdpAttrIdDocFormatsSupported: - nextId = KSdpAttrIdModelID; - break; - case KSdpAttrIdModelID: - nextId = KSdpAttrIdMaxWidth; - break; - case KSdpAttrIdMaxWidth: - nextId = KSdpAttrIdMaxLen; - break; - default: - // all interested attributes received, at tleast asked - //Request 0xFFFFFF to indicate all done - nextId = KSdpAttrIdAllDone; - break; - } - - iAgent->AttributeRequestL( aHandle, nextId ); - - LOG1("[CBtDiscover::GetNextAttributeL]\t end. nextId: 0x%X", nextId); - } - - - -/************************************************************************/ -/* visitor */ -/************************************************************************/ - -CBTAttribValVisitor* CBTAttribValVisitor::NewLC( CBtDiscover& aDiscover ) - { - CBTAttribValVisitor* obj = new (ELeave) CBTAttribValVisitor( aDiscover ); - CleanupStack::PushL( obj ); - return obj; - } - -/** - * @param aDiscover Stores a pointer to the CBtDiscover object, in order to call - * CBtDiscover::SetPort and CBtDiscover::SetContentTypes once those attributes have been - * found. - */ -CBTAttribValVisitor::CBTAttribValVisitor(CBtDiscover& aDiscover) : iDiscover(aDiscover) - { - } - -/** - * @brief Called for each of the individual attributes in the SDP record being parsed. - * @param aValue Value of the attribute. - * @param aType Type of the attribute. - */ -void CBTAttribValVisitor::VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType) - { - LOG1("[CBTAttribValVisitor::VisitAttributeValueL]\t Begin. aType: %d", aType); - - switch ( aType ) - { - case ETypeUUID: - CheckUuid(aValue.UUID()); - break; - case ETypeUint: - CheckUint(aValue.Uint()); - break; - case ETypeString: - switch (iDiscover.iCurrentSDPAttrID) - { - case KSdpAttrIdDocFormatsSupported: - iDiscover.SetContentTypesL(aValue.Des()); - break; - case KSdpAttrIdModelID: - CheckVendor( aValue.Des() ); - iDiscover.SetPrinterModelL(aValue.Des()); - break; - default: - break; - } - break; - default: - break; - } - } - -/** - * @brief Indicates the beginning of an attribute list in the SDP record. - */ -void CBTAttribValVisitor::StartListL(CSdpAttrValueList& /*aList*/) - { - LOG("CBTAttribValVisitor::StartListL"); - } - -/** - * @brief Indicates the end of an attribute list in the SDP record. - */ -void CBTAttribValVisitor::EndListL() - { - LOG("CBTAttribValVisitor::EndListL"); - } - -CBTAttribValVisitor::~CBTAttribValVisitor() - { - } - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CheckUuid -// -//-------------------------------------------------------------------------------------------- -void CBTAttribValVisitor::CheckUuid( const TUUID& aUuid ) -{ - LOG("[CBTAttribValVisitor::CheckUuid]\t begin"); - - // We're interested only about UUIDs received at KSdpAttrIdServiceClassIDList - if (KSdpAttrIdServiceClassIDList != iDiscover.iCurrentSDPAttrID) - { - LOG1("[CBTAttribValVisitor::CheckUuid]\t Wrong attribute ID: 0x%X",iDiscover.iCurrentSDPAttrID); - return; - } - -#ifdef _DEBUG - TBuf<20> uidstr; - _LIT(KUidForm, "0x%02X%02X%02X%02X"); - uidstr.Format(KUidForm, aUuid[0], aUuid[1], aUuid[2], aUuid[3]); - LOG1("[CBTAttribValVisitor::CheckUuid]\t ETypeUUID: %S", &uidstr); -#endif - - TUUID uidOpp(KBTSDPOBEXObjectPush); - TUUID uidBpp(KBTSDPDirectPrinting); - TUUID uidSts(KBTSDPPrintingStatus); - - if(aUuid == uidOpp) - iDiscover.iCurrentServiceUUID = KBTSDPOBEXObjectPush; - if(aUuid == uidBpp) - iDiscover.iCurrentServiceUUID = KBTSDPDirectPrinting; - if(aUuid == uidSts) - iDiscover.iFoundSTS = ETrue; - - LOG("[CBTAttribValVisitor::CheckUuid]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CheckUint -// -//-------------------------------------------------------------------------------------------- -void CBTAttribValVisitor::CheckUint( const TUint& aValue ) -{ - LOG("[CBTAttribValVisitor::CheckUint]\t begin"); - - switch(iDiscover.iCurrentSDPAttrID) - { - case KSdpAttrIdProtocolDescriptorList: - if (KBTSDPDirectPrinting == iDiscover.iCurrentServiceUUID) - { - LOG1("[CBTAttribValVisitor::CheckUint]\t iDiscover->SetBPPPort(%d)", aValue); - iDiscover.SetBPPPort(aValue); - } - if (KBTSDPOBEXObjectPush == iDiscover.iCurrentServiceUUID) - { - LOG1("[CBTAttribValVisitor::CheckUint]\t iDiscover->SetOPPPort(%d)", aValue); - iDiscover.SetOPPPort(aValue); - } - break; - case KSdpAttrIdAdditionalProtocolDescriptorLists: - if(iDiscover.iFoundSTS ) - { - LOG1("[CBTAttribValVisitor::CheckUint]\t iDiscover->SetSTSPort(%d)", aValue); - iDiscover.SetSTSPort(aValue); - iDiscover.iFoundSTS = EFalse; - } - break; - case KSdpAttrIdMaxWidth: - LOG1("[CBTAttribValVisitor::CheckUint]\t KSdpAttrIdMaxWidth: %d", aValue); - break; - case KSdpAttrIdMaxLen: - LOG1("[CBTAttribValVisitor::CheckUint]\t KSdpAttrIdMaxLen: %d", aValue); - break; - default: - break; - } - - LOG("[CBTAttribValVisitor::CheckUint]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CheckVendor -// -//-------------------------------------------------------------------------------------------- -void CBTAttribValVisitor::CheckVendor( const TDesC8& aVendor ) - { - LOG("[CBTAttribValVisitor::CheckVendor]\t Begin"); - iDiscover.SetVendor( TPrinter::EVendorNone ); - // At the moment this functionality is not used, but no Vendor is set. - HBufC8* vendorName = aVendor.Alloc(); - if( vendorName ) - { - LOG81("[CBTAttribValVisitor::CheckVendor]\t vendorName: %S", vendorName); - TPtr8 ptr = vendorName->Des(); - ptr.LowerCase(); - _LIT8( KHp, "mfg:hp;" ); - - TInt res = vendorName->Find( KHp ); - LOG1("[CBTAttribValVisitor::CheckVendor]\t res: %d", res); - - if( res != KErrNotFound ) - iDiscover.SetVendor( TPrinter::EVendorHp ); - } - delete vendorName; - LOG("[CBTAttribValVisitor::CheckVendor]\t End"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdprserviceadvertiser.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtdprserviceadvertiser.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "cbtdprserviceadvertiser.h" -#include "btprotocolconsts.h" -#include "cbtdiscover.h" - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::NewL() -// Two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtDprServiceAdvertiser* CBtDprServiceAdvertiser::NewL() - { - CBtDprServiceAdvertiser* self = - CBtDprServiceAdvertiser::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::NewLC() -// Two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtDprServiceAdvertiser* CBtDprServiceAdvertiser::NewLC() - { - CBtDprServiceAdvertiser* self = new ( - ELeave ) CBtDprServiceAdvertiser(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::ConstructL() -// Symbian 2nd phase constructor can leave. -// ---------------------------------------------------------------------------- -// -void CBtDprServiceAdvertiser::ConstructL() - { - iServiceDescription = KServiceDescription().AllocL(); - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::CBtDprServiceAdvertiser() -// Constructor. -// ---------------------------------------------------------------------------- -// -CBtDprServiceAdvertiser::CBtDprServiceAdvertiser() - { - // no implementation required - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::~CBtDprServiceAdvertiser() -// Destructor. -// ---------------------------------------------------------------------------- -// -CBtDprServiceAdvertiser::~CBtDprServiceAdvertiser() - { - - // Delete private member - delete iServiceDescription; - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::BuildProtocolDescriptionL() -// Builds the protocol description. -// ---------------------------------------------------------------------------- -// -void CBtDprServiceAdvertiser -::BuildProtocolDescriptionL( CSdpAttrValueDES* aProtocolDescriptor, - TInt aPort ) - { - TBuf8<1> channel; - channel.Append( ( TChar )aPort ); - - aProtocolDescriptor - ->StartListL() // List of protocols required for this method - ->BuildDESL() - ->StartListL() // Details of lowest level protocol - ->BuildUUIDL( KL2CAP ) - ->EndListL() - - ->BuildDESL() - ->StartListL() - ->BuildUUIDL( KRFCOMM ) - ->BuildUintL( channel ) - ->EndListL() - - ->BuildDESL() - ->StartListL() - ->BuildUUIDL( KBTSDPObex ) - ->EndListL() - - ->BuildDESL() - ->StartListL() - ->BuildUUIDL( KBTSDPDPROService ) - ->EndListL() - ->EndListL(); - - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::ServiceName() -// ---------------------------------------------------------------------------- -// -const TDesC& CBtDprServiceAdvertiser::ServiceName() - { - return KServiceName; - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::ServiceDescription() -// ---------------------------------------------------------------------------- -// -const TDesC& CBtDprServiceAdvertiser::ServiceDescription() - { - return *iServiceDescription; - } - -// ---------------------------------------------------------------------------- -// CBtDprServiceAdvertiser::ServiceClass() -// ---------------------------------------------------------------------------- -// -TUint CBtDprServiceAdvertiser::ServiceClass() - { - return KServiceClass; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtjobchannel.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtjobchannel.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1040 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -/** - * @file CBtJobChannel.h - * @brief Defines the CBtJobChannel class. - */ - -#include - -#include "crsbtdevice.h" -#include "cbtjobchannel.h" -#include "cbtsoapcodec.h" -#include "clog.h" -#include "tbtmapper.h" -#include "cbtdiscover.h" -#include "printmessagecodes.h" -#include "cbtstatuschannel.h" -#include "rsutils.h" -#include "cbttimer.h" -#include "btprotocolconsts.h" - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::NewL -// -//-------------------------------------------------------------------------------------------- -CBtJobChannel* CBtJobChannel::NewL(MBtPCObserver& aObs) -{ - CBtJobChannel *self = NewLC(aObs); - CleanupStack::Pop(); // self - - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::NewLC -// -//-------------------------------------------------------------------------------------------- -CBtJobChannel* CBtJobChannel::NewLC(MBtPCObserver& aObs) -{ - CBtJobChannel *self = new (ELeave) CBtJobChannel(aObs); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CBtJobChannel -// -//-------------------------------------------------------------------------------------------- -CBtJobChannel::CBtJobChannel(MBtPCObserver& aObs): - CBtChannelBase(aObs), - iJobFile(KNullDesC8()), - iJobFileNum(0), - iImageCount(0), - iFileObjectSize(0), - iObexFileObject(NULL), - iPercents(0), - iTimer(NULL), - iStatusChannel(NULL) -{ - LOG("[CBtJobChannel::CBtJobChannel]\t"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::~CBtJobChannel -// -//-------------------------------------------------------------------------------------------- -CBtJobChannel::~CBtJobChannel() -{ - LOG("[CBtJobChannel::~CBtJobChannel]\t"); - Stop(); - - // ignore leave: if cleaning fails, no can do. - TRAP_IGNORE(CleanXhtmlDirL()) - - if(iObexFileObject) - delete iObexFileObject; - - if(iTimer) - delete iTimer; - - if(iStatusChannel) - { - delete iStatusChannel; - iStatusChannel = NULL; - } - - // deleting iChannel here because review-x report error. - if(iChannel) - { - delete iChannel; - iChannel = NULL; - } - - iImageList.Reset(); - iImageList.Close(); - - if (iUpdateProgress) - { - delete iUpdateProgress; - iUpdateProgress = NULL; - } - - LOG("[CBtJobChannel::~CBtJobChannel]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::ConstructL() -{ - LOG("[CBtJobChannel::ConstructL]\t begin"); - - CBtChannelBase::ConstructL(); - - iObexFileObject = CObexFileObject::NewL(); - iStatusChannel = CBtStatusChannel::NewL(iObs); - - iState = EStateNone; - iPercents = 0; - iImageCount = 0; - - // Create periodic timer to update progress of printing. - iUpdateProgress = CPeriodic::NewL( CActive::EPriorityStandard ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::RunL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::RunL() -{ - LOG2("[CBtJobChannel::RunL]\t BEGIN iStatus %d at state %d", iStatus.Int(), iState); - - //Finish if required - if( EStateFinish == iState ) - { - ClearConnection(); - return; - } - - // leave if "not allowed" error - DoLeaveL( iStatus.Int() ); - - switch( iState ) - { - case EStateConnecting: - RemoveObexCmdTimeOut(); - iObexNullObject->Reset(); - LOG("[CBtJobChannel::RunL]\t EStateConnecting"); - StopWaiting(); - break; - case EStateDisconnecting: - StopWaiting(); - // Go to disconnection again in case it is not finished yet... - Disconnect(); - break; - case EStateGettingCapabilities: - GetSoapResponseL(); - GetPrinterCapabilitiesResponseL(); - - StopWaiting(); - - iState = EStateNone; - break; - case EStateGettingPrinterState: - GetSoapResponseL(); - GetPrinterStateResponseL(); - - iState = EStateNone; - break; - case EStateCreatingJob: - { - GetSoapResponseL(); - TInt res = CreateJobResponseL(); - StopWaiting(); - // No reason to send doc in error case - if(KErrNone == res) - { - LOG("[CBtJobChannel::RunL]\t CreateJobResponseL() returns %d"); - SendXhtmlDocumentL(); - } - } - break; - case EStateCancellingJob: - GetSoapResponseL(); - CancelJobResponseL(); - - iDevice = NULL; - iState = EStateNone; - break; - case EStateGettingJobAttributes: - GetSoapResponseL(); - GetJobAttributesResponseL(); - - iState = EStateNone; - break; - case EStateSendingXhtml: - iState = EStateNone; - iObexBufObject->Reset(); - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, ENoMessage, iStatus.Int()); - break; - case EStateSendingOPP: - SendOPPL(); - break; - default: - break; - } - LOG("[CBtJobChannel::RunL]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::RunError -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::RunError(TInt aError) - { - LOG1("[CBtJobChannel::RunError]\t state %d", iState); - LOG2("[CBtJobChannel::RunError]\t error %d, iStatus %d", aError, iStatus.Int() ); - - TInt id = KErrNotFound; - - StopWaiting(); - - switch ( iState ) - { - case EStateGettingPrinterState: - if(iDevice) - id = iDevice->DeviceId(); - - iState = EStateFinish; - iObs.GetPrinterStateResponse(EBtStateIdle, ENoMessage, aError, id); - break; - case EStateCreatingJob: - iState = EStateFinish; - iObs.CreateJobResponse(KErrNotFound, aError); - break; - case EStateCancellingJob: - iState = EStateFinish; - iObs.CancelJobResponse(aError); - break; - case EStateGettingJobAttributes: - iState = EStateFinish; - iObs.GetJobAttributesResponse(iJobId, KNullDesC8(), KNullDesC8(), KErrNotFound, KErrNotFound, aError); - break; - case EStateSendingXhtml: - case EStateSendingOPP: - default: - iState = EStateFinish; - iObs.GetEventResponse(KErrNotFound, KErrNotFound, KErrNotFound, KErrNotFound, aError); - LOG("[CBtJobChannel::RunError]\t GetEventResponse sent" ); - break; - } - - iResponseError = aError; - return KErrNone; // othervise error returns to CActive: that's what we don't want. - } - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::DoCancel -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::DoCancel() -{ - LOG2("[CBtJobChannel::DoCancel]\t at state %d, iStatus 0x%X", iState, iStatus.Int()); - - StopWaiting(); - - iState = EStateNone; - - CBtChannelBase::DoCancel(); - iStatusChannel->Cancel(); - LOG1("[CBtJobChannel::DoCancel]\t out iStatus 0x%X", iStatus.Int()); -} - -//------------------------------ -// InCalls -//------------------------------ - - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::HandleTimeoutL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::HandleTimeoutL() -{ - LOG1("[CBtJobChannel::HandleTimeoutL]\t at state %d", iState); - - if(EStateSendingOPP != iState) - return; - - TInt state(EBtStateSending); - if( 100 == iPercents ) - { - state = EBtStateCompleted; - } - else if(iTimer) - iTimer->Start(KSentPercentsDelay); - - iObs.GetEventResponse(iJobId, state, EBtStatePrinting, KErrNone, KErrNone); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetPercentSent -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::GetPercentSent() -{ - LOG1("[CBtJobChannel::GetPercentSent]\t at state %d", iState); - - iPercents = 100; - - if(EStateSendingOPP == iState) - { - // Store current bytes sent. - TReal32 bytesSent = iObexFileObject->BytesSent(); - - TInt temp = iProgressOfFullImages - iFileObjectSize; - iPercents = ( 100 * ( ( temp + bytesSent ) / iJobSize) ); - - LOG2("[CBtJobChannel::GetPercentSent]\t iJobId %d, iImageCount: %d", iJobId, iImageCount); - LOG2("[CBtJobChannel::GetPercentSent]\t BytesSent %d, iFileObjectSize %d", iObexFileObject->BytesSent(), iFileObjectSize); - } - - LOG1("[CBtJobChannel::GetPercentSent]\t at state %d", iPercents); - return iPercents; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CreateJobL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::CreateJobL(CPrintJob& aJob) - { - LOG("[CBtJobChannel::CreateJob]\t begin"); - - if(!IsConnected()) - User::Leave( KErrDisconnected ); - - Cancel(); - - iProgressOfFullImages = 0; - - ++iJobFileNum; - iJobFile.Format(KXHTMLFileName8(), iJobFileNum); - aJob.GetPrintFileL(iJobFile); - - iImageList.Reset(); - aJob.Images(iImageList); - - iJobSize = CalculateJobSizeL(); - - iImageCount = iImageList.Count(); - LOG1("[CBtJobChannel::CreateJob]\t iImageList.Count(): %d", iImageList.Count()); - - iJobId = KErrNotFound; - iResponseError = KErrNone; - - LOG1("[CBtJobChannel::CreateJob]\t aDevice.UsedProtocol() %d", iDevice->UsedProtocol()); - if(KImagePrint_PrinterProtocol_BPP == iDevice->UsedProtocol()) - { - iState = EStateCreatingJob; - SendSoapRequestL(EBtCreateJob, iJobFileNum); - // do asynchronously to indicate to start the object server - WaitL(); - } - else - { - iState = EStateSendingOPP; - iJobId = 1; - SendOPPL(); - Activate(); - } - - LOG1("[CBtJobChannel::CreateJob]\t Request sent. iResponseError: %d", iResponseError); - if( KErrNone != iResponseError ) - { - User::Leave( iResponseError ); - } - LOG("[CBtJobChannel::CreateJob]\t out"); - } - - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetCapabilitiesL -// -// Fully independent and synchronous method. Does not require any existing -// connections and all connections will be deleted after execution. -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::GetCapabilitiesL(CRsBtDevice& aDevice) -{ - LOG("[CBtJobChannel::GetCapabilitiesL]\t"); - Cancel(); - - if( KImagePrint_PrinterProtocol_BPP != aDevice.UsedProtocol() ) - User::Leave(KErrNotSupported); - - if( !RsUtils::IsBluetoothOn() ) - User::Leave(KErrCancel); - - CRsBtDevice* tmpDevice = iDevice; - iDevice = &aDevice; - TBool connected = IsConnected(); - iResponseError = KErrNone; - - ConnectL(); - WaitL(); - - LOG1("[CBtJobChannel::GetCapabilitiesL]\t ConnectL done: %d", IsConnected()); - - iState = EStateGettingCapabilities; - SendSoapRequestL(EBtGetPrinterAttributes); - LOG1("[CBtJobChannel::GetCapabilitiesL]\t SendSoapRequestL done: %d", IsConnected()); - - WaitL(); - - if(!connected) - { - ClearConnection(); - } - iDevice = tmpDevice; - tmpDevice = NULL; - - LOG("[CBtJobChannel::GetCapabilitiesL]\t OUT"); - User::LeaveIfError(iResponseError); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetPrinterStateL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::GetPrinterStateL() -{ - LOG1("[CBtJobChannel::GetPrinterStateL]\t begin for protocol %d", iDevice->UsedProtocol()); - if(KImagePrint_PrinterProtocol_BPP != iDevice->UsedProtocol()) - { - iObs.GetPrinterStateResponse(EBtStatePrinting, ENoMessage, KErrNone, iDevice->DeviceId()); - return; - } - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - iStatusChannel->StartL(*iDevice); - iStatusChannel->GetPrinterStateL(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetJobAttributesL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::GetJobAttributesL(TInt aJobId) -{ - LOG("[CBtJobChannel::GetJobAttributesL]\t begin"); - - if(!iDevice) - { - User::Leave(KErrDisconnected); - } - - LOG1("[CBtJobChannel::GetJobAttributesL]\t begin for protocol %d", iDevice->UsedProtocol()); - if(KImagePrint_PrinterProtocol_BPP != iDevice->UsedProtocol()) - { - TInt state(EBtStateSending), completed(0); - if(100 == iPercents) - { - state = EBtStateCompleted; - completed = iImageCount; - } - - iObs.GetJobAttributesResponse(state, KNullDesC8(), KNullDesC8(), completed, 0, KErrNone); - return; - } - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - LOG("[CBtJobChannel::GetJobAttributesL]\t start status channel if required"); - if(!iStatusChannel->IsConnected()) - iStatusChannel->StartL(*iDevice); - - LOG1("[CBtJobChannel::GetJobAttributesL]\t iStatusChannel->GetJobAttributesL(%d)", iJobId); - iStatusChannel->GetJobAttributesL(aJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetEventL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::GetEventL(TInt aJobId) -{ - LOG("[CBtJobChannel::GetJobAttributesL]\t begin"); - if(KImagePrint_PrinterProtocol_BPP != iDevice->UsedProtocol()) - { - TInt state(EBtStateSending); - if(100 == iPercents) - { - state = EBtStateCompleted; - } - - iObs.GetEventResponse(iJobId, state, EBtStatePrinting, KErrNone, KErrNone); - return; - } - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - iStatusChannel->StartL(*iDevice); - iStatusChannel->GetEventL(aJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CancelJobL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::CancelJobL(TInt aJobId) -{ - LOG("[CBtJobChannel::CancelJob(TInt)]\t begin"); - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - Cancel(); - - iJobId = aJobId; - - iState = EStateCancellingJob; - SendSoapRequestL(EBtCancelJob, iJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::SendOPPL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::SendOPPL() - { - LOG("[CBtJobChannel::SendOPPL]\t begin"); - TInt tmpNumberOfCopies(0); - // Delete file object - iObexFileObject->Reset(); - - if(iTimer) - iTimer->Cancel(); - - // all sent - if(0 >= iImageList.Count()) - { - LOG1("[CBtJobChannel::SendOPPL]\t Finishing... iImageList.Count(): %d", iImageList.Count()); - - iJobFile.Zero(); - iImageList.Reset(); - - iState = EStateNone; - - ClearConnection(); - - iObs.GetEventResponse(iJobId, EBtStateCompleted, EBtStateIdle, KErrNone, KErrNone); - iJobId = KErrNotFound; - - if(iTimer) - delete iTimer; - iTimer = NULL; - - return; - } - - LOG2("[CBtJobChannel::SendOPPL]\t iChannel: %d, iChannel->IsConnected(): %d", iChannel, iChannel->IsConnected()); - if(!IsConnected()) - User::Leave(KErrDisconnected); - - iState = EStateSendingOPP; - - TFileName fn; - iImageList[0].GetFilePathL(fn); - tmpNumberOfCopies = iImageList[0].Copies(); - - LOG1("[CBtJobChannel::SendOPPL]\t init file object with \"%S\"", &fn); - iObexFileObject->InitFromFileL(fn); - // check that does user wants print more than one copy of the currently printing picture. - if(tmpNumberOfCopies > 1) - { - tmpNumberOfCopies--; - iImageList[0].SetCopies(tmpNumberOfCopies); - } - else - { - iImageList.Remove(0); - } - - LOG81("[CBtJobChannel::SendOPPL]\t set type \"%S\"...", &KBtMimeTypeJpeg()); - iObexFileObject->SetTypeL(KBtMimeTypeJpeg()); - - LOG1("[CBtJobChannel::SendOPPL]\t ...and name \"%S\"", &fn); - iObexFileObject->SetNameL(fn); - - iFileObjectSize = iObexFileObject->Length(); - - if(!iTimer) - iTimer = CBtTimer::NewL(*this); - - iTimer->Start(KSentPercentsDelay); - - LOG("[CBtJobChannel::SendOPPL]\t put"); - iChannel->Put(*iObexFileObject, iStatus); - - iProgressOfFullImages = iProgressOfFullImages + iFileObjectSize; - - if (iUpdateProgress) - { - iUpdateProgress->Cancel(); - } - - // Start periodic timer to track data transfer process. - // Event interval is setup to 1 second. - iUpdateProgress->Start(5000, KProgressUpdateInterval, TCallBack( CheckProgress, this )); - - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, KErrNone, KErrNone); - - Activate(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CheckProgress -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::CheckProgress( TAny *aObj ) - { - CBtJobChannel* obj = (CBtJobChannel*)aObj; - obj->UpdateProgress(); - return 1; - } -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::UpdateProgress -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::UpdateProgress() - { - TInt percentBuffer = GetPercentSent(); - - // If all data has been sent, it's OK to stop timer - if ( percentBuffer == 100 ) - { - iUpdateProgress->Cancel(); - } - - // Update progress bar using MBtPCObserver. - iObs.OPPSendProgress(percentBuffer); - } - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::SendXhtmlDocumentL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::SendXhtmlDocumentL() - { - LOG("[CBtJobChannel::SendXhtmlDocumentL]\t begin"); - - if( !iDevice || !iChannel || !iChannel->IsConnected() ) - User::Leave( EObexConnectError ); - - iState = EStateSendingXhtml; - - TFileName fn; - fn.Copy( iJobFile ); - - iObexFileObject->Reset(); - - LOG("[CBtJobChannel::SendXhtmlDocumentL]\t fill in iObexBufObject"); - iObexFileObject->InitFromFileL( fn ); - - TBuf8<50> mime; - mime.Copy( KBtMimeTypeXhtml() ); - mime.ZeroTerminate(); - iObexFileObject->SetTypeL( mime ); - - // name initialized automatically... - - // Job ID (application parameters) - TUint32 jobId = iJobId; - TBuf8<20> triplet; - - triplet.Zero(); - triplet.Append((TChar)KBtObexTagJobId); - triplet.Append((TChar)KBtDataLength4); - //append value - triplet.Append((TChar) ((jobId & 0xFF000000) >> 24) ); - triplet.Append((TChar) ((jobId & 0xFF0000) >> 16) ); - triplet.Append((TChar) ((jobId & 0xFF00) >> 8) ); - triplet.Append((TChar) (jobId & 0xFF) ); - triplet.ZeroTerminate(); - -#ifdef _DEBUG - const TUint8* aPtr = triplet.Ptr(); - _LIT(KBTHexFormatString,"%02x"); - TBuf<50> line; - for (TInt j=0; jSetAppParamL(triplet); - - LOG("[CBtJobChannel::SendXhtmlDocumentL]\t putting..."); - - iChannel->Put(*iObexFileObject, iStatus); - - Activate(); - LOG("[CBtJobChannel::SendXhtmlDocumentL]\t end"); -} - -//------------------------------ -// Responses -//------------------------------ -TInt CBtJobChannel::CreateJobResponseL() -{ - LOG("[CBtJobChannel::CreateJobResponseL]\t "); - User::LeaveIfNull(iSoapCodec); - - iJobId = KErrNotFound; - TInt err = KErrGeneral; - - iSoapCodec->CreateJobResponseL(iJobId, err); - iResponseError = err; - - iObs.CreateJobResponse(iJobId, err); - LOG("[CBtJobChannel::CreateJobResponseL]\t out"); - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetPrinterStateResponseL -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::GetPrinterStateResponseL() -{ - LOG("[CBtJobChannel::GetPrinterStateResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - - TInt state = EBtStateUnknown; - TInt reasons = EPbCheckPrinter; - TInt opStatus = KErrGeneral; - - iSoapCodec->GetPrinterStateResponseL(state, reasons, opStatus); - iObs.GetPrinterStateResponse(state, reasons, opStatus, iDevice->DeviceId()); - - LOG("[CBtJobChannel::GetPrinterAttributesResponseL]\t out"); - return opStatus; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetPrinterCapabilitiesResponseL -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::GetPrinterCapabilitiesResponseL() -{ - LOG("[CBtJobChannel::GetPrinterCapabilitiesResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - - RArray capab; - CleanupClosePushL(capab); - TInt opStatus = KErrGeneral; - - iSoapCodec->GetPrinterCapabilitiesResponseL(capab, opStatus); - - if(iDevice) - { - for(TInt i = 0; i < capab.Count(); ++i) - { - iDevice->AddCapability(capab[i]); - } - LOG("[CBtJobChannel::GetPrinterCapabilitiesResponseL]\t returning to iObs..."); - } - else - { - opStatus = KErrNotFound; - } - - CleanupStack::PopAndDestroy(&capab); - LOG("[CBtJobChannel::GetPrinterCapabilitiesResponseL]\t out"); - return opStatus; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::GetJobAttributesResponseL -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::GetJobAttributesResponseL() -{ - LOG("[CBtJobChannel::GetJobAttributesResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - - TInt state, sheets, pendingJobs, opStatus; - TBtAttrString8 jobName; - TBtAttrString8 originator; - - iSoapCodec->GetJobAttributesResponseL( iJobId, state, jobName, originator,sheets, pendingJobs, opStatus); - iObs.GetJobAttributesResponse(state, jobName, originator,sheets, pendingJobs, opStatus); - - return opStatus; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CancelJobResponseL -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::CancelJobResponseL() -{ - LOG("[CBtJobChannel::CancelJobResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - - TInt err = KErrNotFound; - iSoapCodec->CancelJobResponseL(iJobId, err); - - LOG1("[CBtJobChannel::CancelJobResponseL]\t err %d", err); - iObs.CancelJobResponse(err); - - return err; -} - -/////////////////////////////// -// Private -/////////////////////////////// -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::ConnectL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::ConnectL() - { - LOG("[CBtJobChannel::ConnectL]\t"); - - User::LeaveIfNull( iDevice ); - - if( IsConnected() ) - { - LOG1("[CBtJobChannel::ConnectL]\t return isConnected: %d", IsConnected()); - return; - } - - // delete old if exists - if ( iChannel ) - { - delete iChannel; - iChannel = NULL; - } - - iState = EStateConnecting; - - // set common parts of protocol info - TObexBluetoothProtocolInfo protocolInfo; - protocolInfo.iTransport.Copy( KRFCOMMDesC ); - protocolInfo.iAddr.SetBTAddr( iDevice->BDAddr() );//Address of server bt device - - // connect profile specifically - LOG1("[CBtJobChannel::ConnectL]\t aDevice.UsedProtocol(): %d", iDevice->UsedProtocol()); - if( KImagePrint_PrinterProtocol_BPP == iDevice->UsedProtocol() ) - { - LOG("[CBtJobChannel::ConnectL]\t connect BPP"); - protocolInfo.iAddr.SetPort( iDevice->BPPPort() );//Service channel of server rfcomm - - TUUID uuid( KBTSDPDirectPrinting ); - iObexNullObject->Reset(); - iObexNullObject->SetTargetL( uuid.Des() ); - - // create channel - iChannel = CObexClient::NewL( protocolInfo ); - iChannel->SetCallBack( *this ); - iChannel->Connect( *iObexNullObject, iStatus ); - } - else - { - LOG("[CBtJobChannel::ConnectL]\t connect OPP"); - protocolInfo.iAddr.SetPort(iDevice->OPPPort()); - - // create channel - iChannel = CObexClient::NewL( protocolInfo ); - iChannel->SetCallBack(*this); - iChannel->SetCommandTimeOut(KObexCmdTimeOut); - iChannel->Connect(iStatus); - } - - Activate(); - - LOG("[CBtJobChannel::ConnectL]\t out."); - return; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::IsError -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::DoLeaveL(TInt aError) -{ - LOG2("[CBtJobChannel::DoLeaveL]\t aError %d at state %d", aError, iState); - - if(KErrNone == aError) - return; - - if(EStateDisconnecting == iState) - return; - - // obex connection objects returns 'KErrCompletion' at destructor. Ignore. - if(KErrCompletion == aError) - return; - - LOG("[CBtJobChannel::DoLeaveL]\t Leave"); - User::Leave(aError); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::ClearConnection -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::ClearConnection() -{ - LOG1("[CBtJobChannel::ClearConnection]\t iState %d", iState); - - if(iStatusChannel) - { - LOG("[CBtJobChannel::ClearConnections]\t **** iStatusChannel stop"); - iStatusChannel->Stop(); - } - - CBtChannelBase::ClearConnection(); - - iObexFileObject->Reset(); - - iState = EStateNone; - - iUpdateProgress->Cancel(); - - iImageCount = 0; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CleanXhtmlDirL -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::CleanXhtmlDirL() -{ - LOG1("[CBtJobChannel::CleanXhtmlDirL]\t iJobFileNum %d", iJobFileNum); - - RFs fs; - CleanupClosePushL(fs); - User::LeaveIfError(fs.Connect()); - - CFileMan* fm = CFileMan::NewL(fs); - CleanupStack::PushL(fm); - - while(0 < iJobFileNum) - { - TFileName fn; - fn.Format(KXHTMLFileName, iJobFileNum); - TInt err = fm->Delete(fn); - LOG2("[CBtJobChannel::CleanXhtmlDirL]\t delete file %S, err %d", &fn, err); - --iJobFileNum; - } - - CleanupStack::PopAndDestroy( 2 ); // fm, fs -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::RemoveObexCmdTimeOut -// -//-------------------------------------------------------------------------------------------- -void CBtJobChannel::RemoveObexCmdTimeOut() -{ - iChannel->SetCommandTimeOut(0); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtJobChannel::CalculateJobSizeL -// -//-------------------------------------------------------------------------------------------- -TInt CBtJobChannel::CalculateJobSizeL() - { - - TInt imgCount= iImageList.Count(); - TInt size = 0; - - for (TInt i = 0; iInitFromFileL(fn); - TInt tempSize = iObexFileObject->Length(); - iObexFileObject->Reset(); - size = size + tempSize; - } - return size; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtobjectserver.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtobjectserver.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,952 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cbtprintingdevice.h" -#include "cbtobjectserver.h" -#include "btprotocolconsts.h" -#include "clog.h" -#include "printmessagecodes.h" -#include "tbtmapper.h" -#include "xhtmlfilecomposerconst.h" -#include "rsutils.h" - - -// ---------------------------------------------------------------------------- -// CBtObjectServer::NewL() -// Creates a new instance of the class -// ---------------------------------------------------------------------------- - -CBtObjectServer* CBtObjectServer::NewL(const TBTDevAddr& aDeviceAddress, - RArray &aImgArray, - MBtObjectServerObserver &aObs) -{ - - CBtObjectServer* self = CBtObjectServer::NewLC( aDeviceAddress, aImgArray, aObs ); - CleanupStack::Pop( self ); - return self; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::NewLC() -// Creates a new instance of the class -// ---------------------------------------------------------------------------- - -CBtObjectServer* CBtObjectServer::NewLC(const TBTDevAddr& aDeviceAddress, - RArray &aImgArray, - MBtObjectServerObserver &aObs) -{ - - CBtObjectServer* self = new ( ELeave ) CBtObjectServer( aDeviceAddress, aObs ); - CleanupStack::PushL( self ); - self->ConstructL(aImgArray); - return self; - -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::CBtObjectServer -// The actual constructor of the class -// ---------------------------------------------------------------------------- - -CBtObjectServer::CBtObjectServer(const TBTDevAddr& aDeviceAddress, MBtObjectServerObserver& aObs ) -: iAllowedAddress ( aDeviceAddress ), - iObs ( aObs ), - iStarted(EFalse), - iConnected(EFalse), - iTransportUp(EFalse) -{ - LOG("CBtObjectServer::CBtObjectServer]\t default constructor"); - - iImgArray.Reset(); - iImgArray.Close(); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::~CBtObjectServer() -// Destructor. -// ---------------------------------------------------------------------------- -// -CBtObjectServer::~CBtObjectServer() -{ - LOG("CBtObjectServer::~CBtObjectServer]\t"); - - iStarted = EFalse; - iOperation = EIdle; - - if ( iObexServer && iObexServer->IsStarted() ) - { - iObexServer->Stop(); - } - - iFs.Close(); - - if (iObexServer) - delete iObexServer; - iObexServer = NULL; - - if(iObexBufObject) - delete iObexBufObject; - iObexBufObject = NULL; - - // This must be deleted after the iObexBufObject who uses it. - if (iObexBody) - delete iObexBody; - iObexBody = NULL; - - if(iAdvertiser) - delete iAdvertiser; - iAdvertiser = NULL; - - iImgArray.Close(); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::Cancel() -// Sends current file to the server and then stops the server -// ---------------------------------------------------------------------------- -void CBtObjectServer::Cancel() -{ - LOG("[CBtObjectServer::Cancel]\t"); - - if (!IsSendingData()) - { - LOG("[CBtObjectServer::Cancel]\t - not sending data - stopping server now! \n"); - Stop(); - } - else - { - iOperation = EIdle; - } -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::ConstructL() -// Constucts everything that can leave in the class -// ---------------------------------------------------------------------------- -void CBtObjectServer::ConstructL(RArray &aImgArray) -{ - LOG("[CBtObjectServer::ConstructL]\t"); - - LOG1("[CBtObjectServer::ConstructL]\t aImgArray.Count(): %d", aImgArray.Count()); - for(TInt i = 0; i < aImgArray.Count(); ++i) - { - iImgArray.Append(aImgArray[i]); - -/* For debug -#ifdef ENABLE_LOGGING - TFileName8 uri; - aImgArray[i].GetUri(uri); - TFileName8 log; - CImageInfo::UriLog(uri, log); - LOG1("[CBtObjectServer::ConstructL]\t uri: %d", log); -#endif // ENABLE_LOGGING -*/ - } - - iAdvertiser = CBtDprServiceAdvertiser::NewL(); - - // create OBEX object to receive obex transfer. 8 for reserving data in 8 bytes segments - iObexBody = CBufFlat::NewL( 8 ); - - User::LeaveIfError(iFs.Connect()); - - InitTransferData(); - iRemoteAddress.Reset(); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::Stop() -// Disconnects the server. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::Stop() -{ - LOG("[CBtObjectServer::Stop]\t"); - - // already stopping - if(!iStarted) - return; - - iOperation = ETerminating; - - LOG("[CBtObjectServer::Stop]\t cont..."); - iRemoteAddress.Reset(); - - //cannot delete here. Stop called from iObexServer Callback function. - if ( iObexServer && iObexServer->IsStarted()) - { - LOG("[CBtObjectServer::Stop]\t stopping iObexServer..."); - iObexServer->Stop(); - } - - // Trap this: if it fails, we cannot do anything. - TInt leave; // for remove compiling warnings - TRAP(leave, iAdvertiser->StopAdvertisingL()); - LOG1("[CBtObjectServer::Stop]\t iAdvertiser->StopAdvertising() leaves with %d", leave); - - LOG1("[CBtObjectServer::Stop]\t iObexServer: %d", iObexServer); - - iOperation = EIdle; - iStarted = EFalse; - iConnected = EFalse; - iTransportUp = EFalse; - - /* Sending 'stopped' status */ - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerStopped); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::StartL() -// Starts the server. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::StartL() -{ - LOG("[CBtObjectServer::StartL]\t"); - - TBool btOn = RsUtils::IsBluetoothOn(); - LOG1("[CBtObjectServer::StartL]\t btOn: %d", btOn); - if( !btOn ) - User::Leave(KErrCancel); - - TRAPD( err, InitialiseServerL() ); - LOG1("CBtObjectServer::StartL]\t InitialiseServerL leaves with %d", err); - - if ( err != KErrNone ) - { - Stop(); - User::Leave(err); - } - - iStarted = ETrue; - - /* Send 'server started' status */ - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerStarted); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::InitialiseServerL() -// Initialises the server. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::InitialiseServerL() -{ - LOG("CBtObjectServer::InitialiseServerL]\t"); - - if ( iObexServer ) - { - ASSERT( IsConnected() ); // server already running - return; - } - - LOG("[CBtObjectServer::InitialiseServerL]\t - getting channel"); - - // Set the Socket's security with parameters, - // Authentication, Encryption, Authorisation and Denied - // Method also return the channel available to listen to. - TInt channel = SetSecurityWithChannelL( EFalse, EFalse, EFalse, EFalse ); - - // start the OBEX server - TObexBluetoothProtocolInfo obexProtocolInfo; - - LOG1("[CBtObjectServer::InitialiseServerL]\t setting %S ", &KRFCOMMDesC); - obexProtocolInfo.iTransport.Copy( KRFCOMMDesC() ); - - LOG1("[CBtObjectServer::InitialiseServerL]\t setting port %d", channel); - obexProtocolInfo.iAddr.SetPort( channel ); - - LOG("[CBtObjectServer::InitialiseServerL]\t CObexServer::NewL()"); - if(iObexServer) - { - delete iObexServer; - iObexServer = NULL; - } - iObexServer = CObexServer::NewL( obexProtocolInfo ); - - LOG("[CBtObjectServer::InitialiseServerL]\t iObexServer->Start()"); - User::LeaveIfError(iObexServer->Start( this ) ); - - TUUID who(KBTSDPDPROService); - User::LeaveIfError(iObexServer->SetLocalWho(who.LongForm())); - - // advertise this service - LOG("[CBtObjectServer::InitialiseServerL]\t iAdvertiser->StartAdvertisingL()"); - iAdvertiser->StartAdvertisingL( channel ); - LOG("[CBtObjectServer::InitialiseServerL]\t iAdvertiser->UpdateAvailabilityL()"); - iAdvertiser->UpdateAvailabilityL( ETrue ); - -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::InitTransferData() -// Initialises the variables needed for progressing and processing the printing -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::InitTransferData() -{ - LOG("CBtObjectServer::InitTransferData]\t"); - - InitHeaderVariables(); - iProgress = 0; - - // delete this to be ready to send NULL object. - if(iObexBufObject) - delete iObexBufObject; - iObexBufObject = NULL; - - // no need to delete. Reset is enough. - iObexBody->Reset(); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::InitHeaderVariables() -// Initialises the variables needed for progressing and processing the printing -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::InitHeaderVariables() -{ - LOG("CBtObjectServer::InitHeaderVariables]\t"); - - iOffset = 0; - iCount = 0; // KErrNotFound indicates "the rest" - iSize = KErrNotFound; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::SetSecurityWithChannelL() -// Sets the security on the channel port and returns the available port. -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::SetSecurityWithChannelL( TBool aAuthentication, - TBool aEncryption, - TBool aAuthorisation, - TBool aDenied ) - -{ - - LOG("CBtObjectServer::SetSecurityWithChannelL]\t"); - - // Local variable to channel to listen to. - TInt channel; - - RSocketServ socketServer; - - // Connect to SocetServer - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - connecting to socketServer"); - User::LeaveIfError( socketServer.Connect() ); - CleanupClosePushL( socketServer ); - - RSocket socket; - - // Open the Socket connection - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - opening a socket"); - User::LeaveIfError( socket.Open( socketServer, KRFCOMMDesC() ) ); - CleanupClosePushL( socket ); - - // Retreive to one channel that is available. - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - get one channel"); - User::LeaveIfError( socket.GetOpt( KRFCOMMGetAvailableServerChannel,KSolBtRFCOMM, channel ) ); - - // Set the Socket's Port. - TBTSockAddr sockaddr; - sockaddr.SetPort( channel ); - - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - setting security settings"); - - // Set the security according to. - TBTServiceSecurity serviceSecurity; - - serviceSecurity.SetUid ( KBtProtocolUid ); // UID for _this_ security service; internal inside the phone - serviceSecurity.SetAuthentication ( aAuthentication ); - serviceSecurity.SetEncryption ( aEncryption ); - serviceSecurity.SetAuthorisation ( aAuthorisation ); - serviceSecurity.SetDenied( aDenied ); - - // Attach the security settings. - sockaddr.SetSecurity(serviceSecurity); - - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - binding socket to a address"); - - // Bind and start listeing the port with security set, - User::LeaveIfError(socket.Bind(sockaddr)); - User::LeaveIfError(socket.Listen(KSimultainousSocketsOpen ) ); - - // now close the socket and the socket server - CleanupStack::PopAndDestroy(2); // socket, socketServer - - LOG("[CBtObjectServer::SetSecurityWithChannelL]\t - returning"); - - return channel; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::IsConnected() -// Results true if the server is connected. -// ---------------------------------------------------------------------------- -// -TBool CBtObjectServer::IsConnected() -{ - LOG1("CBtObjectServer::IsConnected]\t %d", iConnected); - return iConnected; -} - - -// ---------------------------------------------------------------------------- -// CBtObjectServer::IsTransporting() -// Results true if the transport connection is up. -// ---------------------------------------------------------------------------- -// -TBool CBtObjectServer::IsTransporting() -{ - LOG1("CBtObjectServer::IsTransporting]\t %d", iTransportUp); - return iTransportUp; -} -// ---------------------------------------------------------------------------- -// IsSendingData() -// @return ETrue if the server is sending data to a Bluetooth device -// ---------------------------------------------------------------------------- -TBool CBtObjectServer::IsSendingData() -{ - LOG("CBtObjectServer::IsSendingData]\t"); - - if(ESending == iOperation) - return ETrue; - - return EFalse; -} - -// ---------------------------------------------------------------------------- -// IsSendingData() -// @return ETrue if the server is finished and can be deleted -// ---------------------------------------------------------------------------- -TBool CBtObjectServer::IsFinished() -{ - LOG("CBtObjectServer::IsFinished]\t"); - - if(ESending != iOperation) - return ETrue; - - return EFalse; -} - -/*****************************************************************************/ -/* Following methods implement the Obex Observer callbacks in this class */ -/*****************************************************************************/ - -// ---------------------------------------------------------------------------- -// CBtObjectServer::ErrorIndication() -// Receive error indication. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::ErrorIndication( TInt aError ) -{ - LOG2("CBtObjectServer::ErrorIndication]\t iOperation: %d, aError: %d", iOperation, aError); - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerError, aError); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::TransportUpIndication() -// Called when the underlying socket transport connection is made from -// a remote client to the server -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::TransportUpIndication() -{ - LOG1("CBtObjectServer::TransportUpIndication]\t iOperation: %d", iOperation); - - iTransportUp = ETrue; - - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerTransportUp); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::TransportDownIndication() -// Transport connection is dropped. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::TransportDownIndication() -{ - LOG1("[CBtObjectServer::TransportDownIndication]\t iOperation: %d", iOperation); - - iTransportUp = EFalse; - - if(ETerminating != iOperation) - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerTransportDown); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::ObexConnectIndication() -// Invoked when an OBEX connection is made from a remote client. -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::ObexConnectIndication( - const TObexConnectInfo& /*aRemoteInfo*/, const TDesC8& /*aInfo*/ ) -{ - LOG("CBtObjectServer::ObexConnectIndication]\t"); - - TInt message = KErrAccessDenied; - - /* Check the address of the remote device */ - if(AllowConnection()) - { - message = KErrNone; - iConnected = ETrue; - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerConnected); - } - - LOG1("CBtObjectServer::ObexConnectIndication]\t returns %d", message); - return message; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::ObexDisconnectIndication() -// OBEX server has been disconnected. -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::ObexDisconnectIndication( const TDesC8& /*aInfo*/ ) -{ - LOG("CBtObjectServer::ObexDisconnectIndication]\t"); - - if(ETerminating != iOperation) - { - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerDisconnected); - } - iConnected = EFalse; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::PutRequestIndication() -// ---------------------------------------------------------------------------- -// -CObexBufObject* CBtObjectServer::PutRequestIndication() -{ - LOG("CBtObjectServer::PutRequestIndication]\t"); - - /* This is the object where server receives the client request over OBEX */ - return iObexBufObject; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::PutPacketIndication() -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::PutPacketIndication() -{ - LOG("CBtObjectServer::PutPacketIndication]\t"); - - return KErrNone; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::PutCompleteIndication() -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::PutCompleteIndication() -{ - LOG("CBtObjectServer::PutCompleteIndication]\t"); - - return KErrNone; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::GetRequestIndication() -// Called when a full get request has been received from the client. -// ---------------------------------------------------------------------------- -// -CObexBufObject* CBtObjectServer::GetRequestIndication( CObexBaseObject* aRequestedObject ) -{ - LOG("[CBtObjectServer::GetRequestIndication]\t"); - - CObexBufObject* object = NULL; - - /* Check if connection allowed for the remote device */ - if(AllowConnection()) - { - iOperation = ESending; - TRAPD(leave, object = HandleGetRequestL(aRequestedObject)); - if(KErrNone != leave) - LOG1("[CBtObjectServer::GetRequestIndication]\t HandleGetRequestL leaves with %d", leave ); - - // Stop advertising if still advertisig... - TRAP(leave, iAdvertiser->StopAdvertisingL()); - if(KErrNone != leave) - LOG1("[CBtObjectServer::GetRequestIndication]\t StopAdvertisingL leaves with %d", leave); - } - - LOG1("[CBtObjectServer::GetRequestIndication]\t return object pointer %d", object ); - return object; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::GetPacketIndication() -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::GetPacketIndication() -{ - LOG("[CBtObjectServer::GetPacketIndication]\t"); - - /* Setting that we are now sending data */ - iOperation = ESending; - - return KErrNone; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::GetCompleteIndication() -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::GetCompleteIndication() -{ - LOG("[CBtObjectServer::GetCompleteIndication]\t"); - - if(iProgress >= 100) - // Sending status that the whole file sent to BT-device - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerFileSent, iProgress); - else - // Sending status that one package sent to BT-device - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerPackageSent, iProgress); - - // We are finished for one package - init - SetCompleted(); - - return KErrNone; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::SetPathIndication() -// ---------------------------------------------------------------------------- -// -TInt CBtObjectServer::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, - const TDesC8& /*aInfo*/ ) -{ - LOG("CBtObjectServer::SetPathIndication]\t"); - return KErrNone; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::AbortIndication() -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::AbortIndication() -{ - LOG("CBtObjectServer::AbortIndication]\t"); - - SetCompleted(); - - /* Sending status that one file sent to BT-device */ - iObs.HandleObjectServerEvent(KErrAbort); - -} - -/*****************************************************************************/ -/* Own privates */ -/*****************************************************************************/ - -// ---------------------------------------------------------------------------- -// CBtObjectServer::AllowConnection() -// Checks if the connection should allow. -// ---------------------------------------------------------------------------- -// -TBool CBtObjectServer::AllowConnection() -{ - LOG("CBtObjectServer::AllowConnection]\t"); - - // Return immediatedly if addresses macth - if( iRemoteAddress != 0 && iRemoteAddress == iAllowedAddress) - return ETrue; - - TBool allow = EFalse; - - if( iRemoteAddress == 0 ) - { - /* Getting address of the remote device */ - TBTSockAddr remoteAddress; - iObexServer->RemoteAddr(remoteAddress); - - /* Getting the actual bluetooth address */ - iRemoteAddress = remoteAddress.BTAddr(); - - /* Comparing the two bluetooth device addresses */ - allow = (iRemoteAddress == iAllowedAddress); - -#ifdef _DEBUG - - TBuf<100> origName; - iAllowedAddress.GetReadable(origName); - TBuf<100> remoteName; - iRemoteAddress.GetReadable(remoteName); - - LOG1("[CBtObjectServer::AllowConnection]\t btAddressOrig: %S", &origName); - LOG1("[CBtObjectServer::AllowConnection]\t btAddressRemote: %S", &remoteName); -#endif - } - - - if (!allow) - { - LOG("[CBtObjectServer::AllowConnection]\t BT addresses DON'T match!"); - iObs.HandleObjectServerEvent(MBtObjectServerObserver::KObjectServerBTDeviceMismatch); - } - else - { - LOG("[CBtObjectServer::AllowConnection]\t BT addresses match!"); - } - - return allow; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::HandleGetRequestL() -// Called when a full get request has been received from the client. -// ---------------------------------------------------------------------------- -// -CObexBufObject* CBtObjectServer::HandleGetRequestL( CObexBaseObject* aRequestedObject ) -{ - User::LeaveIfNull(aRequestedObject); - - TFileName name(aRequestedObject->Name()); - - TFileName log; - CImageInfo::UriLog(name, log); - LOG1("[CBtObjectServer::HandleGetRequestL]\t file requested: \"%S\"", &log); - - /* get application parameters header */ - GetAppHeaderL(aRequestedObject); - - //Append obex header start in uri - _LIT(KObex, "obex:"); - _LIT(KSlash, "/"); - TFileName scheme(KObex()); - // Note here: the correct format would be uuid.LongForm(), - // but in currently supported services it is not required. - scheme.AppendNum(KBTSDPDPROService, EHex); - scheme.Append(KSlash()); - - TInt pos = name.Find(scheme); - if(KErrNotFound == pos) - name.Insert(0, scheme); - - return CreateObexObjectL(name); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::GetAppHeaderL() -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::GetAppHeaderL(CObexBaseObject* aRequestedObject) -{ - LOG("CBtObjectServer::GetAppHeaderL]\t"); - - /* get header parameters */ - InitHeaderVariables(); - - TInt indx = 0; // grows cumulatively during GetTriplet - TInt tmp = 0; - - // offset - TUint tag = 0; - TInt len = KBtTripletLength; - HBufC8* params = (aRequestedObject->AppParam()).AllocLC(); - - if(len <= params->Des().Length()) - { - tmp = TBtMapper::TripletValue(params->Des(), indx, tag); - } - if(KBtObexTagOffset == tag) - iOffset = tmp; - - LOG1("CBtObjectServer::GetAppHeaderL]\t offset: %d", iOffset); - - // count - tag = 0; - len += KBtTripletLength; - if(len <= params->Des().Length()) - { - tmp = TBtMapper::TripletValue(params->Des(), indx, tag); - } - if(KBtObexTagCount == tag) - iCount = tmp; - - LOG1("CBtObjectServer::GetAppHeaderL]\t count: %d", iCount); - - // size - tag = 0; - len += KBtTripletLength; - if(len <= params->Des().Length()) - { - tmp = TBtMapper::TripletValue(params->Des(), indx, tag); - } - if(KBtObexTagSize == tag) - iSize = tmp; - - LOG1("CBtObjectServer::GetAppHeaderL]\t size: %d", iSize); - - CleanupStack::PopAndDestroy(params); -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer -// -// ---------------------------------------------------------------------------- -CObexBufObject* CBtObjectServer::CreateObexObjectL(const TDesC& aUri) -{ - TFileName log; - CImageInfo::UriLog(aUri, log); - LOG1("[CBtObjectServer::CreateObexObjectL]\t file requested: \"%S\"", &log); - - if(iObexBufObject) - delete iObexBufObject; - iObexBufObject = NULL; - - TInt size = KErrNotFound; - - for(TInt i = 0; i < iImgArray.Count(); ++i) - { - if(iImgArray[i].CompareUri(aUri)) - { - TFileName file; - iImgArray[i].GetFilePathL(file); - LOG1("[CBtObjectServer::CreateObexObject]\t file = \"%S\"", &file ); - - GetDataSequenceL(file, size); - if(iObexBody) - { - LOG2("[CBtObjectServer::CreateObexObject]\t data len: %d, file size: %d", iObexBody->Size(), size); - iObexBufObject = CObexBufObject::NewL(iObexBody); - } - - break; - } - } - if(!iObexBufObject) - { - LOG1("[CBtObjectServer::CreateObexObject]\t return NULL: %d", iObexBufObject); - return iObexBufObject; - } - - // Fill headers - // File size (application parameters) - - TBuf8<20> triplet; - - triplet.Zero(); - triplet.Append((TChar)KBtObexTagSize); - triplet.Append((TChar)KBtDataLength4); - //append value - triplet.Append((TChar) ((size & 0xFF000000) >> 24) ); - triplet.Append((TChar) ((size & 0xFF0000) >> 16) ); - triplet.Append((TChar) ((size & 0xFF00) >> 8) ); - triplet.Append((TChar) (size & 0xFF) ); - triplet.ZeroTerminate(); - - iObexBufObject->SetAppParamL(triplet); - - return iObexBufObject; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::GetDataSequenceL() -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::GetDataSequenceL(const TFileName& aFileName, TInt& aFileSize) -{ - //LOG1("[CBtObjectServer::GetDataSequenceL]\t for file \"%S\"", aFileName); - - RFile file; - CleanupClosePushL(file); - TInt err = file.Open(iFs, aFileName, EFileRead|EFileShareReadersOnly); - if(KErrNone != err) - User::LeaveIfError(file.Open(iFs, aFileName, EFileRead|EFileShareAny)); - - // Get file size - aFileSize = KErrNotFound; - file.Size(aFileSize); - - if(!iObexBody) - { - iObexBody = static_cast(User::LeaveIfNull(CBufFlat::NewL(8))); - } - iObexBody->Reset(); - - // if iCount is zero, return empty body... - if(0 == iCount) - return; - - // count to send - TInt len = iCount; - - // ...if iCount is -1, return the rest of the file - // (http://www.bluetooth.com/NR/rdonlyres/276DE16A-BDB9-48BF-8123-AF01E3730E5F/925/BPP_SPEC_V10.pdf) - if(KErrNotFound == len) - { - len = aFileSize - iOffset; - } - //LOG2("[CBtObjectServer::GetDataSequenceL]\t iOffset: %d, len: %d", iOffset, len); - - HBufC8* data = static_cast(User::LeaveIfNull(HBufC8::NewLC(len))); - TPtr8 dataPtr( data->Des() ); - - dataPtr.Zero(); - User::LeaveIfError( file.Read(iOffset, dataPtr, len) ); - //LOG1("[CBtObjectServer::GetDataSequenceL]\t read data->Des().Length(): %d", data->Des().Length()); - - iObexBody->InsertL(0, data->Des()); - - CleanupStack::PopAndDestroy(2); // data, file - - //count proggress of this file - if(!iOffset) - iProgress = iOffset; - else - iProgress = (((iOffset << 8) / aFileSize) * 100) >> 8; - - LOG1("[CBtObjectServer::GetDataSequenceL]\t Progress: %d", iProgress); - return; -} - -// ---------------------------------------------------------------------------- -// CBtObjectServer::SetCompleted() -// ---------------------------------------------------------------------------- -// -void CBtObjectServer::SetCompleted() -{ - // method to indicate a package is sent - LOG("[CBtObjectServer::SetCompleted]\t"); - - // init requested parameters - InitTransferData(); - - /* If the user of the server called Cancel() */ - if(ETerminating == iOperation) - { - LOG("[CBtObjectServer::SetCompleted]\t to stop..."); - Stop(); - } - else - { - LOG("[CBtObjectServer::SetCompleted]\t package sent..."); - iOperation = EIdle; - } - - return; -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtonquery.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtonquery.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CBtOnQuery class definition. This Implementation is used to avoid -* User::WaitForRequest() function and ViewServer 11 panic when BT naming query is activated. -* -*/ - - -#include -#include - -#include "cbtonquery.h" -#include "mbtonnotify.h" -#include "clog.h" - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CObjectExchangeClient::NewL() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtOnQuery* CBtOnQuery::NewL( MBTOnNotify& aNotify ) - { - CBtOnQuery* self = CBtOnQuery::NewLC( aNotify ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::NewLC() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtOnQuery* CBtOnQuery::NewLC( MBTOnNotify& aNotify ) - { - CBtOnQuery* self; - self = new ( ELeave ) CBtOnQuery( aNotify ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::CBtOnQuery() -// Constructor. -// ---------------------------------------------------------------------------- -// -CBtOnQuery::CBtOnQuery( MBTOnNotify& aNotify ) : CActive( CActive::EPriorityLow ), - iNotify( aNotify ) - { - CActiveScheduler::Add( this ); - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::~CBtOnQuery() -// Destructor. -// ---------------------------------------------------------------------------- -// -CBtOnQuery::~CBtOnQuery() - { - Cancel(); - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::ConstructL() -// Perform second phase construction of this object. -// ---------------------------------------------------------------------------- -// -void CBtOnQuery::ConstructL() - { - iResultPckg = EFalse; - } - - -// ---------------------------------------------------------------------------- -// CBtOnQuery::IsBluetoothOn() -// Starts Notifier to ask user to BT activation. -// ---------------------------------------------------------------------------- -// -void CBtOnQuery::IsBluetoothOn() - { - LOG("CBtOnQuery::IsBluetoothOn, start"); - TPckgBuf pckg( ETrue ); // Input parameter - - if( iNotif.Connect() == KErrNone ) - { - LOG("CBtOnQuery::IsBluetoothOn() iNotif.Connect() == KErrNone"); - iNotif.StartNotifierAndGetResponse( iStatus, KPowerModeSettingNotifierUid, pckg, iResultPckg ); - LOG1("CBtOnQuery::IsBluetoothOn %d", iResultPckg()); - } - - SetActive(); - LOG("CBtOnQuery::IsBluetoothOn, end"); - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::IsBluetoothOn() -// Respond to an event. -// ---------------------------------------------------------------------------- -// -void CBtOnQuery::RunL() - { - LOG1("CBtOnQuery::RunL() %d", iStatus.Int()); - if( iStatus.Int() == KErrNone || iStatus.Int() == KErrCancel || iStatus.Int() == KErrGeneral ) - { - iNotif.CancelNotifier( KPowerModeSettingNotifierUid ); - iNotif.Close(); - LOG1("CBtOnQuery::RunL() %d", iResultPckg()); - iNotify.BTOnCompleteL( iResultPckg() ); // iResultPckg contains user answer - } - LOG("CBtOnQuery::RunL() End"); // Activate BT -> iResultPckg = ETrue - } // No BT Activation -> iResultPckg EFalse) - -// ---------------------------------------------------------------------------- -// CBtOnQuery::RunError() -// Handles errors which is throwed by RunL() function. -// ---------------------------------------------------------------------------- -// -void CBtOnQuery::RunError() - { - // No implementation required - } - -// ---------------------------------------------------------------------------- -// CBtOnQuery::RunError() -// Cancel any outstanding requests. -// ---------------------------------------------------------------------------- -// -void CBtOnQuery::DoCancel() - { - // No implementation required - } - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtpasswordquery.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtpasswordquery.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "cbtpasswordquery.h" - -CBtPasswordQuery::CBtPasswordQuery( MConfirmationNotify& aNotify ) : CActive( CActive::EPriorityStandard), - iNotify (aNotify) - { - CActiveScheduler::Add( this ); - } - -CBtPasswordQuery::~CBtPasswordQuery() - { - Cancel(); - iNotifier.Close(); - } - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CBtPasswordQuery::NewL() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtPasswordQuery* CBtPasswordQuery::NewL( MConfirmationNotify& aNotify ) - { - CBtPasswordQuery* self = CBtPasswordQuery::NewLC( aNotify ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtPasswordQuery::NewLC() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CBtPasswordQuery* CBtPasswordQuery::NewLC( MConfirmationNotify& aNotify ) - { - CBtPasswordQuery* self; - self = new ( ELeave ) CBtPasswordQuery( aNotify ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CBtPasswordQuery::ConstructL() -// Perform second phase construction of this object. -// ---------------------------------------------------------------------------- -// -void CBtPasswordQuery::ConstructL() - { - - } - -void CBtPasswordQuery::StartActiveObjectL() - { - - //RNotifier notifier; - User::LeaveIfError(iNotifier.Connect()); - - // start asynchronic notifier -> prompt user passsword - iNotifier.StartNotifierAndGetResponse(iStatus, KBTObexPasskeyQueryNotifierUid, iPckg, iResultPckg); - - // Start active object and set iStatus = KRequestPending - SetActive(); - } - -void CBtPasswordQuery::RunL() - { - if( iStatus.Int() == KErrNone || iStatus.Int() == KErrCancel) - { - iNotifier.CancelNotifier( KPowerModeSettingNotifierUid ); - // close connection to the notify server - iNotifier.Close(); - iNotify.PasswordQueryCompleteL( iResultPckg ); - } - } - -void CBtPasswordQuery::RunError() - { - - } - -void CBtPasswordQuery::DoCancel() - { - iNotifier.CancelNotifier( KPowerModeSettingNotifierUid ); - - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtprintercontroller.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtprintercontroller.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,574 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtPrinterController class. -* -*/ - - -#include - -#include "crsbtdevice.h" -#include "cbtprintercontroller.h" -#include "cbtsoapcodec.h" -#include "clog.h" -#include "tbtmapper.h" -#include "cbtdiscover.h" -#include "printmessagecodes.h" -#include "cbtstatuschannel.h" -#include "cbtjobchannel.h" -#include "rsutils.h" -#include "btnotifierapi.h" - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::NewL -// -//-------------------------------------------------------------------------------------------- -CBtPrinterController* CBtPrinterController::NewL(MBtPCObserver& aObs) -{ - CBtPrinterController *self = NewLC(aObs); - CleanupStack::Pop(); // self - - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::NewLC -// -//-------------------------------------------------------------------------------------------- -CBtPrinterController* CBtPrinterController::NewLC(MBtPCObserver& aObs) -{ - CBtPrinterController *self = new (ELeave) CBtPrinterController(aObs); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CBtPrinterController -// -//-------------------------------------------------------------------------------------------- -CBtPrinterController::CBtPrinterController(MBtPCObserver& aObs): - iObs( aObs ), - iJobChannel(NULL), - iObjectChannel(NULL) -{ - LOG("[CBtPrinterController::CBtPrinterController]\t"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::~CBtPrinterController -// -//-------------------------------------------------------------------------------------------- -CBtPrinterController::~CBtPrinterController() -{ - LOG("[CBtPrinterController::~CBtPrinterController]\t"); - - ClearConnections(); - - if(iBtDiscoverEngine) - { - delete iBtDiscoverEngine; - iBtDiscoverEngine = NULL; - } - - if(iObjectChannel) - { - delete iObjectChannel; - iObjectChannel = NULL; - } - - if(iJobChannel) - { - delete iJobChannel; - iJobChannel = NULL; - } - - delete iQuery; - - iImageList.Reset(); - iImageList.Close(); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::ConstructL() -{ - LOG("[CBtPrinterController::ConstructL]\t begin"); - iJobId = KErrNotFound; - - iBtDiscoverEngine = CRsBtDiscoverEngine::NewL(*this); - - LOG("[CBtPrinterController::ConstructL]\t channels"); - iObjectChannel = NULL; - iJobChannel = CBtJobChannel::NewL(iObs); - - iQuery = NULL; - iProtocol = 0; - - InitJobVariables(); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::ConstructL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrinterController::GetPercentSent() -{ - LOG("[CBtPrinterController::GetPercentSent]\t"); - - return iPercents; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::Stop -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::Stop() -{ - LOG("[CBtPrinterController::Stop]\t"); - - iJobChannel->Cancel(); - - ClearConnections(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::IsConnected -// -//-------------------------------------------------------------------------------------------- -TBool CBtPrinterController::IsConnected() -{ - LOG("[CBtPrinterController::IsConnected]\t"); - TBool connected = EFalse; - - if(iJobChannel && iJobChannel->IsConnected()) - { - connected = ETrue; - LOG1("[CBtPrinterController::IsConnected]\t iJobChannel->IsConnected() %d", connected); - } - - if(iObjectChannel && iObjectChannel->IsConnected()) - { - connected = ETrue; - LOG1("[CBtPrinterController::IsConnected]\t iObjectChannel->IsConnected() %d", connected); - } - - LOG1("[CBtPrinterController::IsConnected]\t return %d",connected); - return connected; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::FinishPrinting -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::FinishPrinting() -{ - LOG("[CBtPrinterController::FinishPrintingL]\t begin"); - - // Already finishing - if(iFinish) - { - LOG("[CBtPrinterController::FinishPrintingL]\t already finishing"); - return; - } - - iFinish = ETrue; - - Stop(); - - LOG("[CBtPrinterController::FinishPrintingL]\t end"); - return; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::StartDiscoveryL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::StartDiscoveryL( TUint aProtocol) -{ - LOG1("[CBtPrinterController::StartDiscoveryL]\t aProtocol: %d", aProtocol); - - iProtocol = aProtocol; - iQuery = CBtOnQuery::NewL( *this ); - iQuery->IsBluetoothOn(); - - LOG("CBtPrinterController::StartDiscoveryL end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CancelDiscoveryL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::CancelDiscovery() -{ - LOG("[CBtPrinterController::CancelDiscovery]\t begin"); - iBtDiscoverEngine->Stop(); - - LOG1( "[CBtPrinterController::CancelDiscovery]\t iBtDiscoverEngine->IsActive() = %d", iBtDiscoverEngine->IsActive() ); - - Stop(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::GetCapabilitiesL -// -// Fully independent and synchronous method. Does not require any existing -// connections and all connections will be deleted after execution. -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::GetCapabilitiesL(CRsBtDevice& aDevice) -{ - LOG("[CBtPrinterController::GetCapabilitiesL]\t"); - iJobChannel->Cancel(); - iJobChannel->GetCapabilitiesL(aDevice); - LOG("[CBtPrinterController::GetCapabilitiesL]\t out"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CreateJobL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::CreateJobL(CRsBtDevice& aDevice, CPrintJob& aJob) -{ - LOG("[CBtPrinterController::CreateJobL]\t begin"); - - iJobChannel->Cancel(); - - iImageList.Reset(); - aJob.Images(iImageList); - iImageCount = iImageList.Count(); - LOG1("[CBtPrinterController::CreateJobL]\t iImageList.Count(): %d", iImageList.Count()); - if(0 == iImageCount) - User::Leave(KErrInvalidData); - - iJobId = KErrNotFound; - - iJobChannel->StartL(aDevice); - - iJobChannel->CreateJobL(aJob); - LOG("[CBtPrinterController::CreateJobL]\t CreateJobL done"); - - LOG1("[CBtPrinterController::CreateJobL]\t aDevice.UsedProtocol() %d", aDevice.UsedProtocol()); - if(KImagePrint_PrinterProtocol_BPP == aDevice.UsedProtocol()) - { - LOG("[CBtPrinterController::CreateJobL]\t before establishing"); - EstablishObjectChannelL( aDevice ); - } - else - { - iJobId = 1; - } - - LOG("[CBtPrinterController::CreateJobL]\t out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::GetPrinterStateL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::GetPrinterStateL(CRsBtDevice& aDevice) -{ - LOG("[CBtPrinterController::GetPrinterStateL]\t begin"); - iJobChannel->Cancel(); - - if(!iJobChannel->IsConnected()) - { - iJobChannel->StartL(aDevice); - } - - iJobChannel->GetPrinterStateL(); - - LOG("[CBtPrinterController::GetPrinterStateL]\t OUT"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::GetJobAttributesL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::GetJobAttributesL(CRsBtDevice& aDevice, TInt aJobId) -{ - LOG("[CBtPrinterController::GetJobAttributesL]\t begin"); - - if(!iJobChannel || !iJobChannel->IsConnected()) - { - LOG("[CBtPrinterController::GetJobAttributesL]\t User::Leave(KErrInvalidSequence);"); - User::Leave(KErrInvalidSequence); - } - - LOG("[CBtPrinterController::GetJobAttributesL]\t iJobId = aJobId;"); - iJobId = aJobId; - - LOG("[CBtPrinterController::GetJobAttributesL]\t iJobChannel->GetJobAttributesL(aJobId);"); - iJobChannel->GetJobAttributesL(aJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::CancelJobL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::CancelJobL(CRsBtDevice& aDevice, TInt aJobId) -{ - LOG("[CBtPrinterController::CancelJob(TInt)]\t begin"); - - if(!iJobChannel || !iJobChannel->IsConnected()) - User::Leave(KErrInvalidSequence); - - iJobChannel->Cancel(); - - iJobId = aJobId; - - iJobChannel->CancelJobL(iJobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::GetEventL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::GetEventL(TInt aJobId) -{ - LOG("[CBtPrinterController::GetEvent]\t begin"); - iJobId = aJobId; - - if(!iJobChannel || !iJobChannel->IsConnected()) - User::Leave(KErrInvalidSequence); - - iJobChannel->GetEventL(aJobId); -} - -//---------------------------------- - -/////////////////////////////// -// Private -/////////////////////////////// -// From MRsBtDiscoverEngineObserver. -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::HandleDiscoveryEvent -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::HandleDiscoveryEvent(TInt aEvent, TInt aErrorCode) -{ - LOG2("[CBtPrinterController::HandleDiscoveryEvent]\t aEvent: %d, aErrorCode: %d", aEvent, aErrorCode); - - switch ( aEvent ) - { - case MBtDiscoveryObserver::EFoundBtPrinter: - LOG("[CBtPrinterController::HandleBtDiscoverEngineEventL]\t EFoundBtPrinter"); - iObs.DeviceDiscovered(iBtDiscoverEngine->GetDevice()); - break; - case MBtDiscoveryObserver::ERemoveBtPrinter: - LOG("[CBtPrinterController::HandleBtDiscoverEngineEventL]\t ERemoveBtPrinter"); - iObs.DeviceDisappeared(iBtDiscoverEngine->GetDevice()); - break; - case MBtDiscoveryObserver::EDoneFindingPrinters: - LOG("[CBtPrinterController::HandleBtDiscoverEngineEventL]\t EDoneFindingPrinters"); - iObs.DiscoveryError(KErrNone); - break; - case MBtDiscoveryObserver::EErrorDuringDiscover: - LOG("[CBtPrinterController::HandleBtDiscoverEngineEventL]\t EErrorDuringDiscover"); - iObs.DiscoveryError(aErrorCode); - break; - default: - break; - } -} - -// From MBtObjectServerObserver -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::HandleObjectServerEvent -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::HandleObjectServerEvent(TInt aStatus, TInt aInfo) -{ - LOG2("[CBtPrinterController::OperationStatus]\t aStatus: %d, aInfo: %d", aStatus, aInfo); - - switch( aStatus ) - { - case KObjectServerStopped: - LOG("[CBtPrinterController::OperationStatus]\t iObjectChannel stopped"); - iServerError = KErrNone; - break; - case KObjectServerStarted: - LOG("[CBtPrinterController::OperationStatus]\t KObjectServerStarted"); - iServerError = KErrNone; - iPercents = 0; - iSentImages = 0; - break; - case KObjectServerAllFilesSent: // not used! - iServerError = KErrNone; - break; - case KObjectServerPackageSent: - iServerError = KErrNone; - iPercents = 100 * ((iSentImages * 100) + aInfo) / (iImageCount * 100); - LOG2("[CBtPrinterController::OperationStatus]\t iPercents %d, aInfo %d", iPercents, aInfo); - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, ENoMessage, KErrNone); - break; - case KObjectServerFileSent: - LOG("[CBtPrinterController::OperationStatus]\t KObjectServerOneFileSent"); - iServerError = KErrNone; - - iPercents = 100 * ((iSentImages * 100) + aInfo) / (iImageCount * 100); - - ++iSentImages; - LOG2("[CBtPrinterController::OperationStatus]\t sent images: %d/%d", iSentImages, iImageCount); - if(iSentImages == iImageCount) - { - iObs.GetEventResponse(iJobId, EBtStatePrinting, EBtStatePrinting, ENoMessage, KErrNone); - } - else - { - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, ENoMessage, KErrNone); - } - break; - case KErrNone: - break; - case KObjectServerBTDeviceMismatch: - LOG("[CBtPrinterController::OperationStatus]\t KObjectServerBTDeviceMismatch"); - break; - case KObjectServerTransportUp: - LOG("[CBtPrinterController::OperationStatus]\t KObjectServerTransportUp"); - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, ENoMessage, KErrNone); - case KObjectServerConnected: - iServerError = KErrNone; - break; - case KObjectServerError: - LOG1("[CBtPrinterController::OperationStatus]\t KObjectServerError: %d", aInfo); - iServerError = aInfo; - //break here: other messages takes care of correct actions - break; - case KObjectServerDisconnected: - LOG1("[CBtPrinterController::OperationStatus]\t disconnected, iServerError %d", iServerError); - case KObjectServerTransportDown: - LOG1("[CBtPrinterController::OperationStatus]\t transport down. iServerError %d", iServerError); - if(KErrNone != iServerError) - iObs.GetEventResponse(iJobId, EBtStateSending, EBtStatePrinting, iServerError, KErrDisconnected); - iServerError = KErrNone; - break; - default: - LOG("[CBtPrinterController::OperationStatus]\t default..."); - break; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::InitSyncVariables -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::InitJobVariables() -{ - iPercents = 0; - iImageCount = 0; - iServerError = KErrNone; - iFinish = EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::ClearConnections -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::ClearConnections() -{ - LOG("[CBtPrinterController::ClearConnections]\t "); - - if(iBtDiscoverEngine) - iBtDiscoverEngine->Cancel(); - - if(iObjectChannel) - { - iObjectChannel->Stop(); - LOG("[CBtPrinterController::ClearConnections]\t **** iObjectChannel stop"); - } - - if(iJobChannel) - { - LOG("[CBtPrinterController::ClearConnections]\t **** iJobChannel stop"); - iJobChannel->Disconnect(); - } - - InitJobVariables(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::EstablishObjectChannelL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::EstablishObjectChannelL( CRsBtDevice& aDevice ) -{ - if( 0 == iImageList.Count()) - User::Leave(KErrInvalidSequence); - - LOG("[CBtPrinterController::EstablishObjectChannelL]\t create iObjectChannel"); - if(iObjectChannel) - { - delete iObjectChannel; - iObjectChannel = NULL; - } - iObjectChannel = CBtObjectServer::NewL( aDevice.BDAddr(), iImageList, *this ); - iObjectChannel->StartL(); - - iImageList.Reset(); - -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrinterController::BTOnCompleteL -// -//-------------------------------------------------------------------------------------------- -void CBtPrinterController::BTOnCompleteL( TBool aResult ) - { - LOG("[CBtPrinterController::BTOnComplete] begin \t "); - - if( !aResult ) - { - LOG("[CBtPrinterController::BTOnComplete]\t cancelling discovery, bt is not activated \t "); - CancelDiscovery(); - iObs.DiscoveryError( ENoConnection ); - } - - - iBtDiscoverEngine->Start( iProtocol ); - - LOG("[CBtPrinterController::BTOnComplete] end \t "); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtprintingdevice.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtprintingdevice.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1666 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -#include "cbtprintingdevice.h" -#include "printcapabilitycodes.h" -#include "printmessagecodes.h" -#include "rsutils.h" -#include "crsbtdevice.h" -#include "cbtdevicecontainer.h" -#include "clog.h" -#include "tbtmapper.h" -#include "crsbtdiscoverengine.h" - - -// CONSTANTS -namespace - { - /// Bluetooth BPP/OPP Version Major. - const static TInt KBtVersionMajor = 3; - /// Bluetooth BPP/OPP Version Minor. - const static TInt KBtVersionMinor = 0; - /// Bluetooth BPP/OPP Version Build. - const static TInt KBtVersionBuild = 1; - } - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::NewL -// -//-------------------------------------------------------------------------------------------- -MProtPrintingDevice* CBtPrintingDevice::NewL() -{ - return new (ELeave) CBtPrintingDevice(); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CBtPrintingDevice -// -//-------------------------------------------------------------------------------------------- -CBtPrintingDevice::CBtPrintingDevice() : - CActive(CActive::EPriorityStandard), - iState( ENone ), - iPrintingJob( NULL ), - iPrinterController( NULL ), - iDeviceContainer( NULL ), - iRequestedProtocols( 0 ), - iPrintError( KErrNone ), - iPrintErrorMsgCode( 0 ), - iPendingCount(KPendingLimit), - iPrinterTimer( NULL ), - iProggress( 0 ) -{ - iDiscoveryObserver = NULL; - iPrintEventObserver = NULL; - CActiveScheduler::Add(this); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::ConstructL(const TDesC& /*aDLLPath*/) -{ - LOG("CBtPrintingDevice ****************************************************"); - LOG("[CBtPrintingDevice::ConstructL]\t begin"); - - iPrinterController = CBtPrinterController::NewL(*this); - iDeviceContainer = CBtDeviceContainer::NewL(); - iPrinterTimer = CPeriodic::NewL(CActive::EPriorityStandard); - LOG("CBtPrintingDevice::ConstructL end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::~CBtPrintingDevice -// -//-------------------------------------------------------------------------------------------- -CBtPrintingDevice::~CBtPrintingDevice() -{ - LOG("CBtPrintingDevice::~CBtPrintingDevice begin"); - - Deactivate(); - - if(iPrinterTimer) - { - if(iPrinterTimer->IsActive()) - iPrinterTimer->Cancel(); - delete iPrinterTimer; - } - - if(iPrinterController) - { - iPrinterController->Stop(); - delete iPrinterController; - } - - if(iPrintingJob) - delete iPrintingJob; - - if(iDeviceContainer) - delete iDeviceContainer; - - REComSession::DestroyedImplementation( iDtor_ID_Key ); - - LOG("CBtPrintingDevice::~CBtPrintingDevice end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::RunL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::RunL() -{ - LOG1("[CBtPrintingDevice::RunL]\t iStatus: %d", iStatus.Int()); - - if(KErrNone != iStatus.Int()) - { - User::Leave(iStatus.Int()); - } - - switch( iState ) - { - case EFinish: - FinishPrinting(iStatus.Int()); - break; - case EGetJobAttributes: - GetJobAttributesL(); - break; - case EGetPrinterState: - GetPrinterStateL(); - break; - default: - break; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::RunError -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::RunError(TInt aError) -{ - LOG2("[CBtPrintingDevice::RunError]\t iStatus: %d, aError: %d", iStatus.Int(), aError); - - FinishPrinting(aError); - - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::DoCancel -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::DoCancel() -{ - LOG1("[CBtPrintingDevice::DoCancel]\t iStatus: %d", iStatus.Int()); - ResetTimer(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::Deactivate -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::Deactivate() -{ - LOG2("[CBtPrintingDevice::Deactivate]\t iStatus: %d iState %d", iStatus.Int(), iState); - ResetTimer(); - Cancel(); - iStatus = KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::Version -// -//-------------------------------------------------------------------------------------------- -TVersion CBtPrintingDevice::Version() -{ - return TVersion(KBtVersionMajor, KBtVersionMinor, KBtVersionBuild); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::SupportedProtocols -// -//-------------------------------------------------------------------------------------------- -TUint CBtPrintingDevice::SupportedProtocols() -{ - return KImagePrint_PrinterProtocol_BPP | - KImagePrint_PrinterProtocol_OPP_Printer | - KImagePrint_PrinterProtocol_OPP_PC; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::DiscoveryError -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::DiscoveryError(TInt aError) -{ - LOG1("[CBtPrintingDevice::DiscoveryError]\t aError: %d", aError); - if(0 < iDeviceContainer->Count()) - { - iState = EReady; - } - else - { - iState = ENone; - } - - iPrinterController->CancelDiscovery(); - Deactivate(); - - if( iDiscoveryObserver ) - { - if(KErrNone == aError)// discovery finished, update not-found cached devices - UpdateCacheList(); - - //We're not interested if the call back leaves - TRAP_IGNORE(iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, aError)); - } - - LOG("[CBtPrintingDevice::DiscoveryError]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::StartDiscoveryL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocol) -{ - LOG1("[CBtPrintingDevice::StartDiscoveryL]\t aProtocol: %d", aProtocol); - iDiscoveryObserver = &aObserver; - - // already discovering - if(EDiscovering == iState) - return; - - if((aProtocol & SupportedProtocols())) - { - iRequestedProtocols = aProtocol; - iDeviceContainer->Reset(); - iPrinterController->Stop(); - - // If GetUsedDevicesL fails, no can do. Just continue. - LOG("[CBtPrintingDevice::StartDiscoveryL]\t Get used devices"); - TInt leave; - TRAP(leave, GetUsedDevicesL() ); - LOG1("[CBtPrintingDevice::StartDiscoveryL]\t Get used devices leaves with %d", leave); - - LOG("[CBtPrintingDevice::StartDiscoveryL]\t Calling iPrinterController"); - iPrinterController->StartDiscoveryL(aProtocol); - - iState = EDiscovering; - } - else - { - LOG("CBtPrintingDevice::StartDiscoveryL NO protocol match, ending discovery..."); - if( iDiscoveryObserver ) - { - //We're not interested if the call back leaves - TRAP_IGNORE(iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNone)); - } - } - LOG("[CBtPrintingDevice::StartDiscoveryL]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::RemoveCachedDeviceL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::RemoveCachedDeviceL(TInt aDeviceID) -{ - LOG1("CBtPrintingDevice::RemoveCachedDeviceL aDeviceID: %d", aDeviceID); - - TInt err = KErrNone; - CRsBtDevice* device = FindDevice(aDeviceID); - if( device ) - { - device->SetUsed(EFalse); - iDeviceContainer->StoreL(); - } - else - { - err = KErrInvalidData; - } - - LOG1("CBtPrintingDevice::RemoveCachedDeviceL end with: %d", err); - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::UpdateCacheListL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::UpdateCacheList() -{ - LOG("[CBtPrintingDevice::UpdateCacheList]\t"); - - for(TInt i = 0; i < iDeviceContainer->Count(); ++i) - { - CRsBtDevice* device = iDeviceContainer->At(i); - if(device && !device->IsJustFound()) - DeviceDisappeared(*device); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CancelDiscovery -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::CancelDiscovery(TBool aDoCallBack) -{ - LOG1("[CBtPrintingDevice::CancelDiscovery]\t aDoCallBack: %d", aDoCallBack); - if(0 < iDeviceContainer->Count()) - { - iState = EReady; - } - else - { - iState = ENone; - } - iPrinterController->CancelDiscovery(); - Deactivate(); - - if( aDoCallBack && iDiscoveryObserver ) - { - //We're not interested if the call back leaves - TRAP_IGNORE(iDiscoveryObserver->DiscoveryStatusL(EDiscoveryCancelling, KErrNone)); - } - LOG("[CBtPrintingDevice::CancelDiscovery]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CreatePrintJobL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver) -{ - LOG("[CBtPrintingDevice::CreatePrintJobL]\t begin"); - LOG2("[CBtPrintingDevice::CreatePrintJobL]\t aDeviceID: %d, aImages.Count(): %d", aDeviceID, aImages.Count()); - - iPrintEventObserver = &aObserver; - - CRsBtDevice *printer = FindDevice( aDeviceID ); - - if( printer == NULL ) - { - LOG("CBtPrintingDevice::CreatePrintJobL no device found, returning error"); - return KErrInvalidData; - } - if(iPrintingJob && - (CPrintJob::EStateSubmitted == iPrintingJob->JobState() || - CPrintJob::EStateSending == iPrintingJob->JobState() || - CPrintJob::EStatePrinting == iPrintingJob->JobState()) ) - { - LOG("[CBtPrintingDevice::CreatePrintJobL]\t Printing job already"); - return KErrInvalidSequence; - } - - iPendingCount = 0; - - GetCapabilities(*printer); - - InitJobL(printer, aImages); - - LOG("[CBtPrintingDevice::CreatePrintJobL]\t job created"); - - iPrintingJob->UpdateJobState(CPrintJob::EStateCreated); - - LOG1("[CBtPrintingDevice::CreatePrintJobL]\t end - status: %d", iState); - - return KErrNone; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::SubmitPrintJobL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::SubmitPrintJobL() -{ - LOG("[CBtPrintingDevice::SubmitPrintJobL] begin"); - - TInt err = KErrInvalidSequence; - if( iPrintingJob && iPrintingJob->JobState() == CPrintJob::EStateCreated ) - { - // We try to find the Device specified in our list. - CRsBtDevice* device = static_cast(User::LeaveIfNull( - FindDevice(iPrintingJob->PrinterId()))); - - LOG1("[CBtPrintingDevice::SubmitPrintJobL] iPrintingJob.iPrinterID: %d", iPrintingJob->PrinterId() ); - // save used bluetooth profile - iUsedBtProfile = device->UsedProtocol(); - if( !(device->UsedProtocol() & SupportedProtocols()) ) - { - LOG("[CBtPrintingDevice::SubmitPrintJobL]\t can't select a protocol"); - err = KErrInvalidData; - } - else - { - LOG1("[CBtPrintingDevice::SubmitPrintJobL]\t Submitting to printer \"%S\"", &(device->FriendlyName())); - iState = EJobProgress; - - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); - iPendingCount = 0; - iProggress = 0; - - TRAP(err, iPrinterController->CreateJobL(*device, *iPrintingJob) ); - LOG1("[CBtPrintingDevice::SubmitPrintJobL]\t CreateJobL leaves with %d", err); - if(KErrNone == err) - { - device->SetUsed(ETrue); - iDeviceContainer->StoreL(); - - if( iPrintingJob->JobState() != CPrintJob::EStateSending && - iPrintingJob->JobState() != CPrintJob::EStatePrinting ) - { - iPrintingJob->UpdateJobState(CPrintJob::EStateSubmitted); - } - - } - else - { - CreateJobResponse(KErrNotFound, err); - } - } - } - else - LOG("[CBtPrintingDevice::SubmitPrintJobL]\t ***Invalid Sequence***. Job state wrong or job not created"); - - if(KErrNone != err) - { - LOG1("[CBtPrintingDevice::SubmitPrintJobL]\t return error %d", err); - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(err); - else - User::Leave(err); - } - LOG("[CBtPrintingDevice::SubmitPrintJobL] end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CancelPrintJob -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::CancelPrintJob() -{ - LOG("[CBtPrintingDevice::CancelPrintJob]\t begin"); - TInt retVal( KErrInvalidSequence ); - - LOG1("[CBtPrintingDevice::CancelPrintJob]\t iPrintingJob: %d", iPrintingJob); - - if(iPrintingJob) - { - retVal = KErrNone; - - LOG1("[CBtPrintingDevice::CancelPrintJob]\t iPrintingJob->JobState(): %d", iPrintingJob->JobState()); - if(iPrintingJob->JobState() == CPrintJob::EStateCancel) - { - LOG("[CBtPrintingDevice::CancelPrintJob]\t Already cancelling. Return."); - retVal = KErrCancel; - } - else if( iPrintingJob->JobState() == CPrintJob::EStateSubmitted || - iPrintingJob->JobState() == CPrintJob::EStateSending || - iPrintingJob->JobState() == CPrintJob::EStatePrinting ) - { - // cancel job - TInt leave; // for remove compiling errors - TRAP(leave, CancelJobL()); - if( leave == KErrDisconnected ) - { - LOG("[CBtPrintingDevice::CancelPrintJob]\t calling OPPJobRollBack..."); - OPPJobRollBack(); - } - LOG1("[CBtPrintingDevice::CancelPrintJob]\t CancelJobL() leaves with %d.", leave); - } - else - { - LOG1("[CBtPrintingDevice::CancelPrintJob]\t No print job, just cancel all (forced stop) if connections exist: %d", iPrinterController->IsConnected()); - FinishPrinting( KErrInvalidSequence ); - - } - } - - if( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobProgressEvent( EDone, iPrinterController->GetPercentSent(), ECancelling ); - } - - LOG1("CBtPrintingDevice::CancelPrintJob end with: %d", retVal); - return retVal; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::OPPJobRollBack -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::OPPJobRollBack() -{ - LOG("[CBtPrintingDevice::OPPJobRollBack ]\t begin"); - - Cancel(); - TInt err = KErrNone; - iState = EFinish; - TRequestStatus* tmpStatus = &iStatus; - User::RequestComplete( tmpStatus, err ); - SetActive(); - - LOG("[CBtPrintingDevice::OPPJobRollBack ]\t end"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::ContinuePrintJobL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::ContinuePrintJobL() -{ - LOG1("CBtPrintingDevice::ContinuePrintJobL returns with: %d", KErrNotSupported); - return KErrNotSupported; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetNumPrintPages -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetNumPrintPages() -{ - LOG("[CBtPrintingDevice::GetNumPrintPages]\t"); - - if( iPrintingJob ) - return iPrintingJob->Sheets(); - else - return KErrInvalidSequence; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetPrintJobStatus -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetPrintJobStatus() -{ - LOG1("CBtPrintingDevice::GetPrintJobStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetPrinterStatus -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetPrinterStatus(TInt /*aDeviceID*/) -{ - LOG1("CBtPrintingDevice::GetPrinterStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetDeviceCapabilityIDsL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs) -{ - LOG1("[CBtPrintingDevice::GetDeviceCapabilityIDsL]\t begins with aDeviceID: %d", aDeviceID); - - TInt err = KErrNone; - aCapabilityIDs.Reset(); - - CRsBtDevice *printer = FindDevice( aDeviceID ); - if( printer == NULL ) - { - LOG("[CBtPrintingDevice::GetDeviceCapabilityIDsL]\t no device found, returning error"); - return KErrInvalidData; - } - - GetCapabilities(*printer); - - printer->GetCapabilityIDs(aCapabilityIDs); - - LOG1("[CBtPrintingDevice::GetDeviceCapabilityIDsL]\t ends with err: %d", err); - return err; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetDeviceCapabilityL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability) -{ - LOG1("CBtPrintingDevice::GetDeviceCapabilityL begins with aDeviceID: %d", aDeviceID); - LOG1("CBtPrintingDevice::GetDeviceCapabilityL begins with aCapabilityID: %d", aCapabilityID); - - TInt err = KErrNone; - - CRsBtDevice* printer = FindDevice(aDeviceID); - if( printer ) - { - printer->GetCapability(aCapabilityID, aCapability); - } - else - { - err = KErrInvalidData; - } - LOG1("CBtPrintingDevice::GetDeviceCapabilityL ends with err: %d", err); - return err; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetJobSetting -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetJobSetting(TInt aCapabilityID, TInt& aValue) -{ - LOG1("CBtPrintingDevice::GetJobSetting begins with aCapabilityID: %d", aCapabilityID); - - TInt res = KErrInvalidSequence; - aValue = KErrNotFound; - - if(iPrintingJob) - res = iPrintingJob->GetPrintSetting(aCapabilityID, aValue); - - return res; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::SetJobSettingL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - LOG1("[CBtPrintingDevice::SetJobSettingL]\t begins with aCapabilityID: %d", aCapabilityID); - LOG1("[CBtPrintingDevice::SetJobSettingL]\t begins with aValue: %d", aValue); - LOG1("[CBtPrintingDevice::SetJobSettingL]\t begins with aAffectedCapability: %d", aAffectedCapability); - - if( !iPrintingJob || iPrintingJob->JobState() == CPrintJob::EStateNone ) - { - LOG1("[CBtPrintingDevice::SetJobSettingL]\t iPrintingJob: %d || job state == EJobStateNone; return KErrInvalidSequence", iPrintingJob); - return KErrInvalidSequence; - } - - aAffectedCapability = 0; - - // Get the Target printer and capability - CRsBtDevice* printer = FindDevice( iPrintingJob->PrinterId() ); - if( printer == NULL ) - { - LOG1("[CBtPrintingDevice::SetJobSettingL]\t printer == NULL; return %d", KErrInvalidData); - return KErrInvalidData; - } - - TInt res = printer->SetDefaultCapability(aCapabilityID, aValue); - if(KErrNone == res) - { - iPrintingJob->SetPrintSetting(aCapabilityID, aValue); - aAffectedCapability = aCapabilityID; - TRAPD(err, iDeviceContainer->StoreL()); - if(KErrNone != err) - { - LOG1("[CBtPrintingDevice::SetJobSettingL]\t Storing fails: %d", err); - } - } - LOG1("[CBtPrintingDevice::SetJobSettingL]\t ends. aAffectedCapability: %d", aAffectedCapability); - return res; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetNumPreviewPages -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetNumPreviewPages() -{ - LOG1("CBtPrintingDevice::GetNumPreviewPages ends with: %d", 1); - return 1; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetJobTemplateIconL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::GetJobTemplateIconL(TInt /*aTemplateID*/, TInt& /*aFsBitmapHandle*/) -{ - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CreatePreviewImage -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::CreatePreviewImage(TInt /*aPageNumber*/) -{ - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CreateJobResponse -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::CreateJobResponse( TInt aJobId, TInt aErrorCode ) -{ - LOG2("[CBtPrintingDevice::CreateJobResponse]\t iState: %d, Error: %d", iState, aErrorCode); - - ResetTimer(); - - if (ECancelJob == iState) - { - LOG2("[CBtPrintingDevice::CreateJobResponse]\t wrong sequence: iState: %d, iPrintingJob->JobState(): %d", iState, iPrintingJob->JobState()); - return; - } - - if(KErrNone != aErrorCode) - { - LOG1("[CBtPrintingDevice::CreateJobResponse]\t error occured: %d. Finish.", aErrorCode); - ManagePrintingState(KErrNotFound, EBtStateAborted, EBtStateIdle, KErrNone, aErrorCode); - return; - } - - iPrintingJob->SetJobId(aJobId); - - iState = EJobProgress; - - LOG( "[CBtPrintingDevice]\t ******"); - LOG1("[CBtPrintingDevice]\t -Printing started with job id: * %2d", aJobId); - LOG( "[CBtPrintingDevice]\t ******"); - - // Printing started - restart timer - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CancelJobResponse -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::CancelJobResponse(TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::CancelJobResponse]\t Error: %d", aErrorCode); - ManagePrintingState(iPrintingJob->JobId(), EBtStateCancelled, EBtStateIdle, KErrNone, aErrorCode); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetPrinterStateResponse -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetPrinterStateResponse(TInt aState, TInt aStateReasons, - TInt aOperationStatus, TInt aDeviceId) -{ - LOG2("[CBtPrintingDevice::GetPrinterStateResponse]\t iState: %d, Error: %d", iState, aOperationStatus); - - if(EGetPrinterState != iState) - return; - - Deactivate(); - - CRsBtDevice* printer = FindDevice( aDeviceId ); - if(!printer) - { - LOG("[CBtPrintingDevice::GetPrinterStateResponse]\t panic PANIC panic: printer not found"); - return; - } - - LOG2("[CBtPrintingDevice::GetPrinterStateResponse] Printer state: %d - %d", aState, aOperationStatus); - if(KErrNone != aOperationStatus) - { - // handle operation status in ManagePrintingState as a printer state - aState = EBtStateStopped; - aStateReasons = aOperationStatus; - } - - if(EBtStateStopped == aState) - { - ManagePrintingState(KErrNotFound, EBtStateUnknown, aState, aStateReasons, aOperationStatus); - return; - } - else if (EBtStateIdle == aState) - { - // maybe we cannot touch to iState: it maybe set to somethin on purpose... - //iState = EReady; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetEventResponse -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetEventResponse(TInt aJobId, TInt aJobState, TInt aPrinterState, - TInt aStateReasons, TInt aOperationStatus) -{ - LOG("[CBtPrintingDevice::GetEventResponse]\t"); - - ManagePrintingState(aJobId, aJobState, aPrinterState, aStateReasons, aOperationStatus); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetJobAttributesResponse -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetJobAttributesResponse( TInt aJobState, - const TDesC8& aJobName, - const TDesC8& /*aOriginator*/, - TInt aSheetsCompleted, - TInt aPendingJobs, - TInt aOperationStatus ) -{ - - LOG1("[CBtPrintingDevice::GetJobAttributesResponse]\t iState: %d", iState); - LOG2("[CBtPrintingDevice::GetJobAttributesResponse]\t aOperationStatus: %d / 0x%X", aOperationStatus, aOperationStatus); - LOG2("[CBtPrintingDevice::GetJobAttributesResponse]\t aJobState: %d aSheetsCompleted: %d", aJobState, aSheetsCompleted); - LOG82("[CBtPrintingDevice::GetJobAttributesResponse]\t aPendingJobs: %d aJobName: %S", aPendingJobs, &aJobName); - - if(EFinish == iState) - { - LOG("[CBtPrintingDevice::GetJobAttributesResponse]\t Finishing... return."); - return; - } - - if(KErrNone == aOperationStatus) - { - LOG("[CBtPrintingDevice::GetJobAttributesResponse]\t aOperationStatus OK"); - - if(0 < aPendingJobs) - { - LOG1("[CBtPrintingDevice::GetJobAttributesResponse]\t pending: %d", aPendingJobs); - aJobState = EBtStateWaiting; - } - else if(iPrintingJob->Sheets() == aSheetsCompleted) - { - LOG("[CBtPrintingDevice::GetJobAttributesResponse]\t Job Completed."); - aJobState = EBtStateCompleted; - - if(CPrintJob::EStateCancel == iPrintingJob->JobState()) - iPrintingJob->UpdateJobState(CPrintJob::EStatePrinting); - } - else if(KPendingLimit == iPendingCount) - { - LOG1("[CBtPrintingDevice::GetJobAttributesResponse]\t timeout. pending too long: %d", iPendingCount); - aOperationStatus = EPbCheckPrinter; - } - else if (aJobState == EBtStateStopped || aJobState == EBtStateAborted || aJobState == EBtStateUnknown || aJobState == EBtStateWaiting || aJobState == EBtStateCompleted) - { - Deactivate(); - - LOG1("[CBtPrintingDevice::GetJobAttributesResponse]\t aJobState NOK: %d. Get printer attributes", aJobState); - TRequestStatus* tmpStatus = &iStatus; - iState = EGetPrinterState; - User::RequestComplete(tmpStatus, KErrNone); - - SetActive(); - return; - } - else - { - iState = EGetJobAttributes; - aJobState = EBtStatePrinting; - } - } - - ManagePrintingState(iPrintingJob->JobId(), aJobState, EBtStatePrinting, ENoMessage, aOperationStatus); - - return; -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::FindDevice -// -//-------------------------------------------------------------------------------------------- -CRsBtDevice* CBtPrintingDevice::FindDevice(TInt aDeviceID) -{ - LOG1("[CBtPrintingDevice::FindDevice] begins with aDeviceID: %d", aDeviceID); - TInt pos = iDeviceContainer->Find(aDeviceID); - if(KErrNotFound != pos) - { - return iDeviceContainer->At(pos); - } - LOG("[CBtPrintingDevice::FindDevice] device NOT found"); - return NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::SetNumsOfCopiesL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ) - { - if( !iPrintingJob || iPrintingJob->JobState() != CPrintJob::EStateCreated ) - { - aErr = KErrInvalidSequence; - return; - } - - LOG1("[CBtPrintingDevice::SetNumsOfCopiesL]\t iPrintingJob->JobState(): %d", iPrintingJob->JobState()); - - LOG2("[CBtPrintingDevice::SetNumsOfCopiesL]\t ImageCount(): %d, copies count: %d ", - iPrintingJob->ImageCount(), aNumsOfCopies.Count()); - if( iPrintingJob->ImageCount() != aNumsOfCopies.Count() ) - { - aErr = KErrInvalidData; - return; - } - - aErr = iPrintingJob->SetNumsOfCopies(aNumsOfCopies); - LOG1("CBtPrintingDevice::SetNumsOfCopiesL aErr: %d", aErr); - } - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::InitJobL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::InitJobL(CRsBtDevice *aPrinter, RPointerArray& aImages) -{ - LOG("[CBtPrintingDevice::InitJobL]"); - - if (iPrintingJob) - { - delete iPrintingJob; - iPrintingJob = NULL; - } - - // Change format of file list - RArray imageList; - CleanupClosePushL(imageList); - for (TInt i=0; i < aImages.Count(); i++) - { - LOG1("[InitJobL]\t %S", aImages[i]); - imageList.Append( *(aImages[i]) ); - } - - // Get local BT name - TBuf8<0x100> name; - GetLocalBTNameL(name); - - // Create job object - iPrintingJob = CPrintJob::NewL(aPrinter, imageList, name); - CleanupStack::PopAndDestroy(&imageList); - - RArray capabIDs; - CleanupClosePushL(capabIDs); - aPrinter ->GetCapabilityIDs(capabIDs); - - for(TInt i = 0; i < capabIDs.Count(); ++i) - { - TPrintCapability capab; - aPrinter->GetCapability(capabIDs[i], capab); - iPrintingJob->SetPrintSetting(capabIDs[i], capab.iDefaultValue); - } - CleanupStack::PopAndDestroy(&capabIDs); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetCapabilities -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetCapabilities(CRsBtDevice& aPrinter, TBool aForcedGet) - { - // gets printer capabilities. If cannot get, sets defaults. - LOG1("[CBtPrintingDevice::GetCapabilities] already found %d", aPrinter.CapabilityCount()); - - // Capabilities already got - if (0 < aPrinter.CapabilityCount() && !aForcedGet ) - return; - - TDeviceState tmpState = iState; - iPendingCount = 0; - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); - - /*Get printer's capabilities*/ - TRAPD(leave, iPrinterController->GetCapabilitiesL(aPrinter) ); - LOG1("[CBtPrintingDevice::GetCapabilities] GetCapabilitiesL leaves with %d", leave); - - if ( ( leave == KErrNotFound && aPrinter.UsedProtocol() == KImagePrint_PrinterProtocol_BPP ) || - ( leave == KErrArgument && aPrinter.UsedProtocol() == KImagePrint_PrinterProtocol_BPP ) ) - { - LOG( "Capabilities not received from BPP Printer - Thus Force OPP ON to avoid problems "); - LOG( "This case indicates that there is possible problem in the BPP printer. "); - aPrinter.SetUsedProtocol( KImagePrint_PrinterProtocol_OPP_Printer ); - aPrinter.SetSupportedProtocols( KImagePrint_PrinterProtocol_OPP_Printer ); - iUsedBtProfile = KImagePrint_PrinterProtocol_OPP_Printer; - leave = KErrNone; - } - ResetTimer(); - iPendingCount = 0; - iState = tmpState; - - if(KErrNone != leave) - { - // cleanup connections - Cancel(); - iPrinterController->Stop(); - - RArray c; - GetDefaultCapabilities(c); - for (TInt i = 0; i < c.Count(); ++i) - { - aPrinter.AddCapability(c[i]); - } - c.Close(); - } - else - { - // store connected printer - aPrinter.SetUsed(ETrue); - // If this fails, no can do. Continue. - TRAP_IGNORE( iDeviceContainer->StoreL() ); - } - } - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetDefaultCapabilities -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetDefaultCapabilities(RArray& aCapabilities) -{ - // Layout - TPrintCapability layout; - layout.iCapabilityID = EPrintCapabLayout; - layout.iType = TPrintCapability::Enum; - layout.iDefaultValue = EPrintCapabLayout1Up; - layout.iLow = 0; - layout.iHigh = 0; - layout.iEnumCodes[0] = layout.iDefaultValue; - layout.iEnumCount = 1; - - // Quality - TPrintCapability quality; - quality.iCapabilityID = EPrintCapabQuality; - quality.iType = TPrintCapability::Enum; - quality.iDefaultValue = EPrintCapabQualityDefault; - quality.iLow = 0; - quality.iHigh = 0; - quality.iEnumCodes[0] = quality.iDefaultValue; - quality.iEnumCount = 1; - - // Paper size - TPrintCapability paper; - paper.iCapabilityID = EPrintCapabPaperSize; - paper.iType = TPrintCapability::Enum; - paper.iDefaultValue = EPrintCapabPaperSizeAuto; - paper.iLow = 0; - paper.iHigh = 0; - paper.iEnumCodes[0] = paper.iDefaultValue; - paper.iEnumCount = 1; - - aCapabilities.Append(layout); - aCapabilities.Append(quality); - aCapabilities.Append(paper); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::FoundDevice -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::FoundDeviceL(CRsBtDevice& aDevice) -{ - LOG2("[CBtPrintingDevice::FoundDeviceL]\t protocol: %d, DeviceId: %d", aDevice.UsedProtocol(), aDevice.DeviceId()); - - TBool inform = EFalse; - - if( aDevice.UsedProtocol() == KImagePrint_PrinterProtocol_BPP ) - { - inform = ETrue; - } - else if( aDevice.UsedProtocol() == KImagePrint_PrinterProtocol_OPP_Printer ) - { - inform = ETrue; - } - else if( aDevice.UsedProtocol() == KImagePrint_PrinterProtocol_OPP_PC ) - { - inform = ETrue; - } - else - { - // avoid lint error - inform = EFalse; - } - - - if( iDiscoveryObserver && inform) - { - TPrinter printer = aDevice.ToTPrinter(); - iDiscoveryObserver->FoundDeviceL( printer ); - LOG("[CBtPrintingDevice::FoundDeviceL] observer informed"); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::AddBtDeviceL -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::AddBtDeviceL(CRsBtDevice& aDevice) -{ - - LOG("[CBtPrintingDevice::AddBtDeviceL]\t"); - - CRsBtDevice* device = NULL; - - TInt pos = iDeviceContainer->Find(aDevice); - LOG1("[CBtPrintingDevice::AddBtDeviceL]\t pos: %d", pos); - if(KErrNotFound != pos) - { - LOG("[CBtPrintingDevice::AddBtDeviceL]\t device exists"); - device = iDeviceContainer->At(pos); - // create TPrinter of old device for informing of update - TPrinter oldPrinter = device->ToTPrinter(); - - // update existing - TBool modified = device->UpdateUsedL(aDevice); - device->SetJustFound(ETrue); - - // Be sure the if updated device is updated in observer - if( iDiscoveryObserver && modified) - { - iDiscoveryObserver->RemoveDeviceL( oldPrinter ); - LOG1("[CBtPrintingDevice::FoundDeviceL] observer informed: remove \"%S\"", &oldPrinter.iDisplayName); - TPrinter printer = device->ToTPrinter(); - iDiscoveryObserver->FoundDeviceL( printer ); - LOG1("[CBtPrintingDevice::FoundDeviceL] observer informed: found \"%S\"", &printer.iDisplayName); - } - - return KErrNone; - } - - device = CRsBtDevice::NewL(aDevice); - LOG1("[CBtPrintingDevice::AddBtDeviceL]\t newDevice address: %d", (TInt)device); - - device->SetUsed(EFalse); - device->SetDisappeared(EFalse); - device->ComposeUsedProtocol(iRequestedProtocols); - - LOG1("[CBtPrintingDevice::AddBtDeviceL]\t usedProtocol: %d", device->UsedProtocol()); - - iDeviceContainer->AppendL(device); - - LOG("[CBtPrintingDevice::AddBtDeviceL]\t preparing info for observer"); - - FoundDeviceL( *device ); - return KErrNone; -} -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetUsedDevicesL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetUsedDevicesL() -{ - LOG("[CBtPrintingDevice::GetUsedDevicesL]\t"); - iDeviceContainer->RestoreL(); - - LOG1("[CBtPrintingDevice::GetUsedDevicesL]\t found %d devices.", iDeviceContainer->Count()); - for(TInt i = 0; i < iDeviceContainer->Count(); ++i) - { - iDeviceContainer->At(i)->ComposeUsedProtocol(iRequestedProtocols); - FoundDeviceL( *(iDeviceContainer->At(i)) ); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::FinishPrinting -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::FinishPrinting(TInt aErrorCode) -{ - LOG("[CBtPrintingDevice::FinishPrinting]\t "); - - iState = EFinish; - - LOG("[CBtPrintingDevice::FinishPrinting]\t -Reset timer"); - Deactivate(); - - LOG("[CBtPrintingDevice::FinishPrinting]\t -Init ids"); - iPendingCount = KPendingLimit; - - // if error occures when geting capabilities, the job not created yet. - if(iPrintingJob) - { - //Cancel job. if leaves, there is no chance to cancel the job -> continue - //else return, the timeout or cancel job response will complete finish - TRAPD(leave, CancelJobL()); - if(KErrNone != leave) - LOG1("[CBtPrintingDevice::FinishPrinting]\t -CancelJobL() leaves with %d", leave); - else - return; - - iPrintingJob->UpdateJobState(CPrintJob::EStateCreated); - } - - LOG1("[CBtPrintingDevice::FinishPrinting]\t FinishPrinting: state=%d", iState); - - // Inform controller - iPrinterController->FinishPrinting(); - - if(KErrNone != aErrorCode) - { - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(aErrorCode); - } - - iState = EReady; - LOG("[CBtPrintingDevice::FinishPrinting]\t -out"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::DeviceDiscovered -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::DeviceDiscovered( CRsBtDevice& aDevice ) -{ - LOG("[CBtPrintingDevice::DeviceDiscovered]\t"); - TInt err; // for remove compiling errors - TRAP(err, AddBtDeviceL(aDevice)); - LOG1("[CBtPrintingDevice::DeviceDiscovered]\t Device added with leave: %d", err); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::DeviceDisappeared -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::DeviceDisappeared( CRsBtDevice& aDevice ) -{ - LOG("[CBtPrintingDevice::DeviceDisappeared]\t"); - - CRsBtDevice* device = FindDevice(aDevice.DeviceId()); - if(!device) - { - LOG("[CBtPrintingDevice::DeviceDisappeared]\t Device not found. Return."); - return; - } - - TPrinter printer = device->ToTPrinter(); - LOG1("[CBtPrintingDevice::DeviceDisappeared]\t printer.iDisplayName: %S", &(printer.iDisplayName)); - device->SetDisappeared(ETrue); - - // Ignore leave; the call back - TRAP_IGNORE(iDiscoveryObserver->RemoveDeviceL(printer)); - - LOG("[CBtPrintingDevice::DeviceDisappeared]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::ResetTimer -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::ResetTimer() -{ - LOG("[CBtPrintingDevice::ResetTimer]\t"); - - if(iPrinterTimer) - { - if(iPrinterTimer->IsActive()) - iPrinterTimer->Cancel(); - } - iPendingCount = 0; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::StartTimer -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::StartTimer(TTimeIntervalMicroSeconds32 aDelay, - TTimeIntervalMicroSeconds32 anInterval, - TCallBack aCallBack) -{ - LOG("[CBtPrintingDevice::StartTimer]\t"); - - ResetTimer(); - - iPrinterTimer->Start(aDelay, anInterval, aCallBack); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::ConnectionTimeout -// -//-------------------------------------------------------------------------------------------- -TBool CBtPrintingDevice::HandleTimeout(TAny *aWho) -{ - CBtPrintingDevice *cbTarget = static_cast(aWho); - return cbTarget->DoHandleTimeout(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::DoConnectionTimeout -// -//-------------------------------------------------------------------------------------------- -TBool CBtPrintingDevice::DoHandleTimeout() -{ - LOG1("[CBtPrintingDevice::DoHandleTimeout]\t iState: %d", iState); - - TInt err = KErrTimedOut; - if(iUsedBtProfile != KImagePrint_PrinterProtocol_OPP_Printer) - { - if(KPendingLimit > iPendingCount) - { - ++iPendingCount; - LOG1("[CBtPrintingDevice::DoHandleTimeout]\t pending: %d", iPendingCount); - - //Continue waiting... - return ETrue; - } - - // when timeout occures during printing, try anyway get printer state - if(KPendingLimit == iPendingCount && EJobProgress == iState) - { - err = KErrNone; - iState = EGetJobAttributes; - --iPendingCount; - } - } - else - { - - if(KOppPendingLimit > iPendingCount) - { - ++iPendingCount; - LOG1("[CBtPrintingDevice::DoHandleTimeout]\t opp print pending: %d", iPendingCount); - - //Continue waiting... - return ETrue; - } - - // when timeout occures during printing, try anyway get printer state - if(KOppPendingLimit == iPendingCount && EJobProgress == iState) - { - err = KErrNone; - iState = EFinish; - --iPendingCount; - } - } - - Cancel(); - - TRequestStatus* tmpStatus = &iStatus; - User::RequestComplete(tmpStatus, err); - SetActive(); - - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::ManagePrintingState -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::ManagePrintingState(TInt aJobId, TInt aJobState, TInt aPrinterState, - TInt aStateReasons, TInt aOperationStatus) -{ - LOG1("[CBtPrintingDevice::ManagePrintingState]\t begin: iState: %d", iState); - LOG2("[CBtPrintingDevice::ManagePrintingState]\t aOperationStatus: %d / 0x%X", aOperationStatus, aOperationStatus); - LOG2("[CBtPrintingDevice::ManagePrintingState]\t jobId: %d state: %d", aJobId, aJobState); - LOG2("[CBtPrintingDevice::ManagePrintingState]\t aPrinterState: %d aStateReasons: %d", aPrinterState, aStateReasons); - - // already stopping, cancelling or idle... No reason to continue - if( EFinish == iState || EReady == iState ) - return; - - Deactivate(); - TInt percents = 0; - - // Always inform anyway. No matter the state. - // First the error cases: - TInt err = KErrNone; - - // Set tmpState - TDeviceState tmpState = EFinish; - - if(KErrNone != aOperationStatus) - { - // if cancelling, ignore errors - if(ECancelJob == iState && KErrDisconnected == aOperationStatus) - return; - - err = aOperationStatus; - } - else if(EBtStateStopped == aPrinterState) - { - LOG("[CBtPrintingDevice::ManagePrintingState] Printer state stopped."); - if(iPrintEventObserver) - iPrintEventObserver->PrinterStatusEvent(aStateReasons, KErrNone); - - // Mustn't give error here: - // inform via PrinterStatusEvent not at FinishPrinting via PrintJobErrorEvent - err = KErrNone; - } - else - { - switch (aJobState) - { - case EBtStateUnknown: - case EBtStateStopped: - case EBtStateAborted: - err = aStateReasons; - break; - case EBtStateWaiting: - LOG("[CBtPrintingDevice::ManagePrintingState]\t Waiting. Cancel."); - // Don't care if cancel fails: no can do anyway. - CancelPrintJob(); - err = EPbStatusErrorReasonHardwarePrinterBusy; - break; - case EBtStateCompleted: - LOG("[CBtPrintingDevice::ManagePrintingState]\t Completed."); - LOG1("[CBtPrintingDevice::ManagePrintingState]\t iPrinting->JobState: %d", iPrintingJob->JobState()); - - if(CPrintJob::EStatePrinting == iPrintingJob->JobState() || - CPrintJob::EStateSending == iPrintingJob->JobState()) - { - if(iPrintEventObserver) - iPrintEventObserver->PrintJobProgressEvent(EDone, 100, ENoMessage); - } - - else - { - err = EObexSendError; - } - - iPrintingJob->UpdateJobState(CPrintJob::EStateCreated); - break; - case EBtStateCancelled: - LOG("[CBtPrintingDevice::ManagePrintingState]\t Cancelled"); - - // If Bt print is cancelled by Image Print, show error "Check status of Printer" - err = EPbStatusErrorReasonNoReason; - break; - // continue cases - case EBtStatePrinting: - iPrintingJob->UpdateJobState(CPrintJob::EStatePrinting); - percents = UpdateProggress(); - LOG1("[CBtPrintingDevice::ManagePrintingState]\t Printing proggress %d", percents); - - if(iPrintEventObserver) - iPrintEventObserver->PrintJobProgressEvent(EActive, percents, EPrinting); - - tmpState = EGetJobAttributes; - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); - break; - case EBtStateSending: - iPrintingJob->UpdateJobState(CPrintJob::EStateSending); - percents = UpdateProggress(); - LOG1("[CBtPrintingDevice::ManagePrintingState]\t Sending proggress %d", percents); - - if(iPrintEventObserver) - iPrintEventObserver->PrintJobProgressEvent(EActive, percents, ECopying); - - tmpState = EJobProgress; - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); - return; - default: - tmpState = iState; - break; - } - } - - iPrintError = err; - - TRequestStatus* tmpStatus = &iStatus; - iState = tmpState; - User::RequestComplete(tmpStatus, err); - - SetActive(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetJobAttributesL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetJobAttributesL() -{ - LOG1("[CBtPrintingDevice::GetJobAttributesL]\t begin: iState: %d", iState); - - CRsBtDevice* printer = static_cast(User::LeaveIfNull( - FindDevice(iPrintingJob->PrinterId()))); - - iPrinterController->GetJobAttributesL(*printer, iPrintingJob->JobId()); - iState = EGetJobAttributes; - - LOG("[CBtPrintingDevice::GetJobAttributesL]\t out"); - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetPrinterAttributesL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetPrinterStateL() -{ - LOG1("[CBtPrintingDevice::GetPrinterAttributesL]\t begin: iState: %d", iState); - - CRsBtDevice* printer = static_cast(User::LeaveIfNull( - FindDevice(iPrintingJob->PrinterId()))); - - iPrinterController->GetPrinterStateL(*printer); - iState = EGetPrinterState; - - LOG("[CBtPrintingDevice::GetPrinterAttributesL]\t out"); - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CancelJobL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::CancelJobL() -{ - LOG("[CBtPrintingDevice::CancelJobL]\t begin"); - - // If not submitted, return - if( !iPrintingJob || - (CPrintJob::EStateSubmitted != iPrintingJob->JobState() && - CPrintJob::EStateSending != iPrintingJob->JobState() && - CPrintJob::EStatePrinting != iPrintingJob->JobState()) ) - User::Leave(KErrInvalidSequence); - - LOG1("[CBtPrintingDevice::CancelJobL]\t begin at iPrintingJob->JobState(): %d", iPrintingJob->JobState()); - - CRsBtDevice* printer = static_cast(User::LeaveIfNull( - FindDevice(iPrintingJob->PrinterId()))); - - iPrintingJob->UpdateJobState(CPrintJob::EStateCancel); - - iPrinterController->CancelJobL(*printer, iPrintingJob->JobId()); - iState = ECancelJob; - - TRequestStatus* tmpStatus = &iStatus; - User::RequestComplete(tmpStatus, KErrNone); - SetActive(); - - LOG("[CBtPrintingDevice::CancelJobL]\t out"); - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(HandleTimeout, this) ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::CheckProggress -// -//-------------------------------------------------------------------------------------------- -TInt CBtPrintingDevice::UpdateProggress() -{ - TInt percents = iPrinterController->GetPercentSent(); - - if(iProggress != percents && 0 != percents) - { - iProggress = percents; - iPendingCount = 0; - } - - // don't return 100% until the job is reported to be completed. - // that way also the physical printing is included in percents. - if(95 < iProggress) - return 95; - else - return iProggress; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::GetLocalBTNameL -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::GetLocalBTNameL(TDes8& aName) -{ - RsUtils::GetLocalBTNameL(aName); - LOG81("[CBtPrintingDevice::GetLocalBTNameL]\t GetLocalBTNameL(%S)", &aName); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtPrintingDevice::OPPSendProgress -// -//-------------------------------------------------------------------------------------------- -void CBtPrintingDevice::OPPSendProgress( TInt aProgress ) - { - if(iPrintEventObserver) - { - // If sendind is finished ( Bytes sent == Job size) it's OK to remove progress bar. - if (aProgress == 100) - { - iPrintEventObserver->PrintJobProgressEvent(EDone, 100, ENoMessage); - } - else - { - // If sending is in progress update progress bar. - iPrintEventObserver->PrintJobProgressEvent(EActive, aProgress, EPrinting); - } - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtsdpadvertiser.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtsdpadvertiser.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cbtsdpadvertiser.h" -#include "clog.h" - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::CBtSdpAdvertiser() -// Constructor. -// ---------------------------------------------------------------------------- -// -CBtSdpAdvertiser::CBtSdpAdvertiser() -: iRecord( 0 ), - iIsConnected( EFalse ) - { - // no implementation required - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::~CBtSdpAdvertiser() -// Destructor. -// ---------------------------------------------------------------------------- -// -CBtSdpAdvertiser::~CBtSdpAdvertiser() - { - // If this fails there is nothing to do. - TRAPD( err,StopAdvertisingL() ); - if ( err != KErrNone ) - { - LOG1("[CBtSdpAdvertiser::~CBtSdpAdvertiser]\t StopAdvertisingL leaves with: %d", err); - } - iSdpDatabase.Close(); - iSdpSession.Close(); - - LOG("[CBtSdpAdvertiser::~CBtSdpAdvertiser]\t done"); - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::ConnectL() -// Connect to the SDP database. -// ---------------------------------------------------------------------------- -// -void CBtSdpAdvertiser::ConnectL() - { - if ( !iIsConnected ) - { - User::LeaveIfError( iSdpSession.Connect() ); - User::LeaveIfError( iSdpDatabase.Open( iSdpSession ) ); - iIsConnected = ETrue; - } - LOG1("[CBtSdpAdvertiser::ConnectL]\t iIsConnected: %d", iIsConnected); - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::StartAdvertisingL() -// Start the advertising of this service. -// ---------------------------------------------------------------------------- -// -void CBtSdpAdvertiser::StartAdvertisingL( TInt aPort ) - { - // could be advertising on a different port - StopAdvertisingL(); - - if ( !iIsConnected ) - { - ConnectL(); - } - iSdpDatabase.CreateServiceRecordL( ServiceClass(), iRecord ); - - LOG1("[CBtSdpAdvertiser::StartAdvertisingL]\t iRecord: %d", iRecord); - - // add a Protocol to the record - CSdpAttrValueDES* vProtocolDescriptor = CSdpAttrValueDES::NewDESL( NULL ); - CleanupStack::PushL( vProtocolDescriptor ); - - BuildProtocolDescriptionL( vProtocolDescriptor,aPort ); - - iSdpDatabase.UpdateAttributeL( iRecord, KSdpAttrIdProtocolDescriptorList, - *vProtocolDescriptor ); - - CleanupStack::PopAndDestroy( vProtocolDescriptor ); - - // Add a name to the record - iSdpDatabase.UpdateAttributeL( iRecord, - KSdpAttrIdBasePrimaryLanguage + - KSdpAttrIdOffsetServiceName, - ServiceName() ); - - // Add a description to the record - iSdpDatabase.UpdateAttributeL( iRecord, - KSdpAttrIdBasePrimaryLanguage + - KSdpAttrIdOffsetServiceDescription, - ServiceDescription() ); - - LOG("[CBtSdpAdvertiser::StartAdvertisingL]\t end"); - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::UpdateAvailabilityL() -// Update the service availability field of the service record. -// ---------------------------------------------------------------------------- -// -void CBtSdpAdvertiser::UpdateAvailabilityL( TBool aIsAvailable ) - { - LOG("[CBtSdpAdvertiser::UpdateAvailabilityL]\t "); - TUint state; - if ( aIsAvailable ) - { - state = 0xFF; // Fully unused - } - else - { - state = 0x00; // Fully used -> can't connect - } - - // Update the availibility attribute field - iSdpDatabase.UpdateAttributeL( iRecord, - KSdpAttrIdServiceAvailability, state ); - - - // Mark the record as changed - by increasing its state number (version) - iSdpDatabase.UpdateAttributeL( iRecord, - KSdpAttrIdServiceRecordState, ++iRecordState ); - - LOG("[CBtSdpAdvertiser::UpdateAvailabilityL]\t end"); - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::StopAdvertisingL() -// Stop advertising this service. Remove the record from the sdp database. -// ---------------------------------------------------------------------------- -// -void CBtSdpAdvertiser::StopAdvertisingL() - { - if ( IsAdvertising() ) - { - iSdpDatabase.DeleteRecordL( iRecord ); - iRecord = 0; - } - } - -// ---------------------------------------------------------------------------- -// CBtSdpAdvertiser::IsAdvertising() -// Does the SDP database contain a record for this service. -// ---------------------------------------------------------------------------- -// -TBool CBtSdpAdvertiser::IsAdvertising() - { - LOG1("[CBtSdpAdvertiser::IsAdvertising]\t %d", iRecord != 0); - return iRecord != 0; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtsoapcodec.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtsoapcodec.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1377 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtSoapCodec class to create and read SOAP-encoded messages. -* -*/ - - -#include "cxmlhandler.h" -#include "cbtsoapcodec.h" -#include "imageprint.h" -#include "clog.h" -#include "tbtmapper.h" -#include "rsutils.h" - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::NewL -// -//-------------------------------------------------------------------------------------------- -CBtSoapCodec* CBtSoapCodec::NewL() - { - CBtSoapCodec *self = NewLC(); - CleanupStack::Pop(); // self - - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::NewLC -// -//-------------------------------------------------------------------------------------------- -CBtSoapCodec* CBtSoapCodec::NewLC() - { - CBtSoapCodec *self = new (ELeave) CBtSoapCodec(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::~CBtSoapCodec -// -//-------------------------------------------------------------------------------------------- -CBtSoapCodec::~CBtSoapCodec() -{ - if(iXmlHandler) - delete iXmlHandler; - iXmlHandler = NULL; - - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ConstructL() -{ - LOG("[CBtSoapCodec::ConstructL]\t"); - iXmlHandler = CXmlHandler::NewL(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::Reset -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::Reset() -{ - LOG("[CBtSoapCodec::Reset]\t"); - - if(iXmlHandler) - delete iXmlHandler; - iXmlHandler = NULL; - - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CreateSoapL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CBtSoapCodec::CreateSoapL(const TInt aAction, const TInt aJobId) -{ - LOG1("[CBtSoapCodec::CreateSoapL]\t action: %d", aAction); - // Open the template file and read it into buffer - - TPtrC8 soap(KNullDesC8); - TBtIntString8 jobId; - jobId.AppendNum(aJobId); - - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; - - switch(aAction) - { - case EBtCreateJob: - CreateJobSoapL(aJobId); - break; - case EBtGetPrinterAttributes: - GetPrinterAttributesSoapL(); - break; - case EBtGetPrinterState: - GetPrinterStateSoapL(); - break; - case EBtGetPrinterCapabilities: - GetCapabilitiesSoapL(); - break; - case EBtCancelJob: - CancelJobSoapL(jobId); - break; - case EBtGetJobAttributes: - GetJobAttributesSoapL(jobId); - break; - case EBtGetEvent: - GetEventSoapL(jobId); - break; - default: - break; - } - - TInt offset; - TPtrC8 ptr = iXmlHandler->GetDataL(KBtBodyStartTag, KBtBodyEndTag, offset); - iXmlHandler->ComposeDataL(ptr.Length(), KBtBytesInBody()); - - return iXmlHandler->FinalizeBufferL(KBtEnvelopeEndTag()); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ReadSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ReadSoapL(const TDesC8& aSoapBuffer) -{ - LOG("[CBtSoapCodec::ReadSoapL(TDesC8&)]\t "); - // Open the template file and read it into buffer - - TInt action = 0; - ReadSoapL(action, aSoapBuffer); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ReadSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ReadSoapL(const CBufBase& aSoapBuffer) -{ - LOG("[CBtSoapCodec::ReadSoapL(CBufBase&)]\t "); - // Open the template file and read it into buffer - - TInt action = 0; - ReadSoapL(action, aSoapBuffer); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ReadSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ReadSoapL(TInt& aAction, const CBufBase& aSoapBuffer) -{ - LOG("[CBtSoapCodec::ReadSoapL(TInt&, CBufBase&)]\t "); - // Open the template file and read it into buffer - - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; - - iActionBuffer = static_cast(User::LeaveIfNull(HBufC8::NewL(aSoapBuffer.Size()))); - TPtr8 ptr = iActionBuffer->Des(); - aSoapBuffer.Read(0, ptr, aSoapBuffer.Size()); - - ReadSoapL(aAction, iActionBuffer->Des()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ReadSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ReadSoapL(TInt& aAction, const TDesC8& aSoapBuffer) -{ - LOG("[CBtSoapCodec::ReadSoapL(TInt&, TDesC8&)]\t "); - // Open the template file and read it into buffer - -#ifdef _DEBUG - TInt len = aSoapBuffer.Length() < 50 ? aSoapBuffer.Length() : 50; - TPtrC8 p = aSoapBuffer.Mid(0, len); - -#endif - - if(!iXmlHandler) - iXmlHandler = CXmlHandler::NewL(); - iXmlHandler->InitFromBufferL(aSoapBuffer); - - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; - - TInt offset = 0; - - TPtrC8 ptr = iXmlHandler->GetDataL(KBtBodyStartTag, KBtBodyEndTag, offset); - - iActionBuffer = static_cast(User::LeaveIfNull(ptr.AllocL())); - - aAction = SoapAction(); - - iXmlHandler->Reset(); - iXmlHandler->InitFromBufferL(iActionBuffer->Des(), aAction); -} - -//------------------------------ -// Responses -//------------------------------ -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CreateJobResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::CreateJobResponseL(TInt& aJobId, TInt& aErrorCode) -{ - LOG("[CBtSoapCodec::CreateJobResponseL]\t "); - - if(EBtCreateJobResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - TBtIntString8 jobId; - jobId.Zero(); - TInt status = OperationStatusL(); - - aErrorCode = KErrNotFound; - GetAttributeL(KBtJobId(), jobId, aErrorCode); - LOG82("[CBtSoapCodec::CreateJobResponseL]\t %S: %S",&KBtJobId(), &jobId); - LOG2("[CBtSoapCodec::CreateJobResponseL]\t opStatus: %d, err %d",status, aErrorCode); - if(aErrorCode == KErrNone) - aErrorCode = status; - - aJobId = TBtMapper::Int(jobId); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetPrinterAttributesResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetPrinterAttributesResponseL(TInt& aState, TInt& aStateReasons, - RArray& aCapabilities, - TInt& aOperationStatus) -{ - LOG("[CBtSoapCodec::GetPrinterAttributesResponseL]\t"); - - // same operationStatus got twce but no matter. - GetPrinterStateResponseL(aState, aStateReasons, aOperationStatus); - GetPrinterCapabilitiesResponseL(aCapabilities, aOperationStatus); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetPrinterStateResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetPrinterStateResponseL(TInt& aState, TInt& aStateReasons, TInt& aOperationStatus) -{ - LOG("[CBtSoapCodec::GetPrinterStateResponseL]\t"); - - if(EBtGetPrinterAttributesResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - aState = EBtStateUnknown; - aStateReasons = EPbCheckPrinter; - aOperationStatus = OperationStatusL(); - - /*get attribute*/ - TBtAttrString8 value(KNullDesC8()); - - /* Get printer status and reason */ - TInt err = KErrNotFound; - GetAttributeL(KBtPrinterState(), value, err); - LOG82("[CBtSoapCodec::GetPrinterStateResponseL]\t ** %S: %S",&KBtPrinterState(), &value); - if(KErrNone == err) - { - aState = TBtMapper::State(value); - GetAttributeL(KBtPrinterStateReasons(), value, err); - LOG82("[CBtSoapCodec::GetPrinterStateResponseL]\t ** %S: %S",&KBtPrinterStateReasons(), &value); - if(KErrNone == err) - { - aStateReasons = TBtMapper::PrintError(value); - } - } -} - - - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetCapabilitiesResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetPrinterCapabilitiesResponseL(RArray& aCapabilities, - TInt& aOperationStatus) -{ - LOG("[CBtSoapCodec::GetPrinterCapabilitiesResponseL]\t"); - - if(EBtGetPrinterAttributesResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - aOperationStatus = OperationStatusL(); - aCapabilities.Reset(); - - aCapabilities.Append(ParseLayoutL()); - aCapabilities.Append(ParseQualityL()); - aCapabilities.Append(ParsePaperSizeL()); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetJobAttributesResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetJobAttributesResponseL(const TInt aJobId, TInt& aJobState, TBtAttrString8& aJobName, - TBtAttrString8& aOriginator, TInt& aSheetsCompleted, - TInt& aPendingJobs, TInt& aErrorCode ) - -{ - LOG("[CBtSoapCodec::GetJobAttributesResponseL]\t"); - if(EBtGetJobAttributesResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - aJobState = EBtStateUnknown; - aJobName = KNullDesC8(); - aOriginator = KNullDesC8(); - aSheetsCompleted = KErrNotFound; - aPendingJobs = KErrNotFound; - aErrorCode = KErrNotFound; - - TBtAttrString8 value(KNullDesC8()); - TInt status = OperationStatusL(); - - GetAttributeL(KBtJobId(), value, aErrorCode); - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobId(), &value); - LOG2("[CBtSoapCodec::GetJobAttributesResponseL]\t opStatus: %d, err %d",status, aErrorCode); - if(aErrorCode == KErrNone) - { - if( TBtMapper::Int(value) != aJobId) - aErrorCode = KErrArgument; - else - aErrorCode = status; - } - - // then just get the rest of the arguments. Success or fails, just continue. - GetAttributeL(KBtJobState(), value, status); - if(KErrNone == status) - aJobState = TBtMapper::State(value); - else - { - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobState(), &value); - LOG1("[CBtSoapCodec::GetJobAttributesResponseL]\t err %d",status); - } - - GetAttributeL(KBtJobMediaSheetsCompleted(), value, status); - if(KErrNone == status) - aSheetsCompleted = TBtMapper::Int(value); - else - { - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobMediaSheetsCompleted(), &value); - LOG1("[CBtSoapCodec::GetJobAttributesResponseL]\t err %d",status); - } - - GetAttributeL(KBtJobPending(), value, status); - if(KErrNone == status) - aPendingJobs = TBtMapper::Int(value); - else - { - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobPending(), &value); - LOG1("[CBtSoapCodec::GetJobAttributesResponseL]\t err %d",status); - } - - GetAttributeL(KBtJobName(), aJobName, status); - if(KErrNone != status) - { - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobName(), &aJobName); - LOG1("[CBtSoapCodec::GetJobAttributesResponseL]\t err %d",status); - } - - GetAttributeL(KBtJobOriginatingUserName(), aOriginator, status); - if(KErrNone != status) - { - LOG82("[CBtSoapCodec::GetJobAttributesResponseL]\t %S: %S",&KBtJobOriginatingUserName(), &aOriginator); - LOG1("[CBtSoapCodec::GetJobAttributesResponseL]\t err %d",status); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CancelJobResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::CancelJobResponseL(const TInt aJobId, TInt& aErrorCode) -{ - LOG("[CBtSoapCodec::CancelJobResponseL]\t"); - TBtIntString8 jobId; - jobId.Append(aJobId); - - if(EBtCancelJobResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - TBuf8 respJobId; - TInt status = OperationStatusL(); - - aErrorCode = KErrNotFound; - GetAttributeL(KBtJobId(), respJobId, aErrorCode); - LOG82("[CBtSoapCodec::CancelJobResponseL]\t %S: %S",&KBtJobId(), &respJobId); - LOG2("[CBtSoapCodec::CancelJobResponseL]\t opStatus: %d, err %d",status, aErrorCode); - if(aErrorCode == KErrNone) - { - if(TBtMapper::Int(respJobId) != aJobId) - aErrorCode = KErrArgument; - else - aErrorCode = status; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetEventResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetEventResponseL(const TInt aJobId, - TInt& aJobState, - TInt& aPrinterState, - TInt& aStateReasons, - TInt& aErrorCode) -{ - LOG("[CBtSoapCodec::GetEventResponseL]\t"); - if(EBtGetEventResponse != SoapAction()) - { - User::Leave(KErrInvalidSequence); - } - - aJobState = EBtStateUnknown; - aPrinterState = KErrNotFound; - aStateReasons = KErrNotFound; - aErrorCode = KErrNotSupported; - - TBtAttrString8 value(KNullDesC8()); - TInt status = OperationStatusL(); - - GetAttributeL(KBtJobId(), value, aErrorCode); - LOG82("[CBtSoapCodec::GetEventResponseL]\t %S: %S",&KBtJobId(), &value); - LOG2("[CBtSoapCodec::GetEventResponseL]\t opStatus: %d, err %d",status, aErrorCode); - if(aErrorCode == KErrNone) - { - if(TBtMapper::Int(value) != aJobId) - aErrorCode = KErrArgument; - else - aErrorCode = status; - } - - // then just get the rest of the arguments. Success or fails, just continue. - GetAttributeL(KBtJobState(), value, status); - LOG82("[CBtSoapCodec::GetEventResponseL]\t %S: %S",&KBtJobState(), &value); - LOG1("[CBtSoapCodec::GetEventResponseL]\t err %d",status); - if(KErrNone == status) - aJobState = TBtMapper::Int(value); - - GetAttributeL(KBtPrinterState(), value, status); - LOG82("[CBtSoapCodec::GetEventResponseL]\t %S: %S",&KBtPrinterState(), &value); - LOG1("[CBtSoapCodec::GetEventResponseL]\t err %d",status); - if(KErrNone == status) - aPrinterState = TBtMapper::Int(value); - - GetAttributeL(KBtPrinterStateReasons(), value, status); - LOG82("[CBtSoapCodec::GetEventResponseL]\t %S: %S",&KBtPrinterStateReasons(), &value); - LOG1("[CBtSoapCodec::GetEventResponseL]\t err %d",status); - if(KErrNone == status) - aStateReasons = TBtMapper::Int(value); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::OperationStatusL -// -//-------------------------------------------------------------------------------------------- -TInt CBtSoapCodec::OperationStatusL() -{ - LOG("[CBtSoapCodec::GetOperationStatus]\t"); - - /* Get operation status. If NOK or not found, no reason to continue */ - TBtAttrString8 value(KNullDesC8()); - TInt status = KErrNotFound; - - GetAttributeL(KBtOperationStatus(), value, status); - LOG82("[CBtSoapCodec::GetOperationStatus]\t %S: %S",&KBtOperationStatus(), &value); - - status = TBtMapper::OperationStatus(value); - - LOG1("[CBtSoapCodec::GetOperationStatus]\t return status %d",status); - return status; -} - -//------------------------------ - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetAttributeL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetAttributeL(const TDesC8& aName, TDes8& aValue, TInt& aError) -{ - LOG("[CBtSoapCodec::GetAttributeL()]\t "); - - if(KErrNotFound == iXmlHandler->BufferId()) - User::Leave(KErrInvalidSequence); - - aError = KErrNotFound; - - TBtAttrString8 startTag; - TBtAttrString8 endTag; - - startTag.Format(KBtStartTag(), &aName); - endTag.Format(KBtEndTag(), &aName); - - TInt offset = KErrNotFound; - TPtrC8 ptr = iXmlHandler->GetDataL(startTag, endTag, offset); - - if(0 < ptr.Length()) - { - aError = KErrNone; - aValue.Copy(ptr); - } - LOG("[CBtSoapCodec::GetAttributeL]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetAttributeListL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetAttributeListL(const TDesC8& aName, CDesC8ArrayFlat& aList, TInt& aError) -{ - LOG("[CBtSoapCodec::GetAttributeL()]\t "); - - if(KErrNotFound == iXmlHandler->BufferId()) - User::Leave(KErrInvalidSequence); - - aError = KErrNotFound; - aList.Reset(); - - // Read the list of tag aName - TInt offset = KErrNotFound; - HBufC8* listData = HBufC8::NewLC(iXmlHandler->Buffer().Length()); - TPtr8 dataPtr = listData->Des(); - GetAttributeL(aName, dataPtr, offset); - if(0 >= dataPtr.Length()) - { - aError = KErrNotFound; - CleanupStack::PopAndDestroy(listData); - return; - } - - CXmlHandler* tmpHandler = CXmlHandler::NewLC(); - tmpHandler->InitFromBufferL(dataPtr); - - // Now find the first tag data to identify the tag of the entry in the list - TPtrC8 newNamePtr = tmpHandler->GetDataL(KBtLessThan(), KBtGreaterThan(), offset); - - TBtAttrString8 startTag; - TBtAttrString8 endTag; - - startTag.Format(KBtStartTag(), &newNamePtr); - endTag.Format(KBtEndTag(), &newNamePtr); - - tmpHandler->GetDataListL(startTag, endTag, aList); - CleanupStack::PopAndDestroy(2); //listData, tmpHandler - - if(0 < aList.Count()) - { - aError = KErrNone; - } -} - - -// PRIVATE -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CreateSoapTemplateL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::CreateSoapTemplateL(const TDesC8& aStartTag, const TDesC8& aEndTag) -{ - LOG("[CBtSoapCodec::CreateSoapTemplateL]\t"); - - // Open the template file and read it into buffer - iXmlHandler->Reset(); - iXmlHandler->InitFromFileL(KBtXmlTemplate()); - - // Separate the template element from the template buffer - if(iActionBuffer) - delete iActionBuffer; - iActionBuffer = NULL; - - TInt offset = 0; - - TPtrC8 ptr = iXmlHandler->GetDataL(aStartTag, aEndTag, offset); - - iActionBuffer = static_cast(User::LeaveIfNull(ptr.AllocL())); - - iXmlHandler->DeleteBufferData(offset, iActionBuffer->Length()+aStartTag.Length()+aEndTag.Length()); - iXmlHandler->ComposeDataL(iActionBuffer->Des(), KBtActionData()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CreateJobSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::CreateJobSoapL(const TInt aJobId) -{ - LOG("[CBtSoapCodec::CreateJobSoapL]\t"); - CreateSoapTemplateL(KBtCreateJobStart(), KBtCreateJobEnd()); - - TBuf8 filename; - filename.Format(KXHTMLFileName8(), aJobId); - - TBtAttrString8 nameTempl, userNameTempl; - nameTempl.Format(KBtValueTemplate(), &KBtJobName()); - userNameTempl.Format(KBtValueTemplate(), &KBtJobOriginatingUserName()); - nameTempl.Format(KBtValueTemplate(), &KBtJobName()); - - iXmlHandler->ComposeDataL(KBtCreateJob(), KBtAction()); - iXmlHandler->ComposeDataL(filename, nameTempl); - - TBuf8<0x100> name; - RsUtils::GetLocalBTNameL(name); - iXmlHandler->ComposeDataL(name, userNameTempl); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetCapabilitiesSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetCapabilitiesSoapL() -{ - LOG("[CBtSoapCodec::GetCapabilitiesSoapL]\t"); - CreateSoapTemplateL(KBtGetPrinterCapabilitiesStart(), KBtGetPrinterCapabilitiesEnd()); - - iXmlHandler->ComposeDataL(KBtGetPrinterAttributes(), KBtAction()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetPrinterStateSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetPrinterStateSoapL() -{ - LOG("[CBtSoapCodec::GetPrinterStateSoapL]\t"); - CreateSoapTemplateL(KBtGetPrinterStateStart(), KBtGetPrinterStateEnd()); - - iXmlHandler->ComposeDataL(KBtGetPrinterAttributes(), KBtAction()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetPrinterAttributesSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetPrinterAttributesSoapL() -{ - LOG("[CBtSoapCodec::GetPrinterAttributesSoapL]\t"); - CreateSoapTemplateL(KBtGetPrinterAttributesAllStart(), KBtGetPrinterAttributesAllEnd()); - - iXmlHandler->ComposeDataL(KBtGetPrinterAttributes(), KBtAction()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetJobAttributesSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetJobAttributesSoapL(const TDesC8& aJobId) -{ - LOG("[CBtSoapCodec::GetJobAttributesSoapL]\t"); - CreateSoapTemplateL(KBtJobIdStart(), KBtJobIdEnd()); - - iXmlHandler->ComposeDataL(KBtGetJobAttributes(), KBtAction()); - - TBtAttrString8 templ; - templ.Format(KBtValueTemplate(), &KBtJobId()); - - iXmlHandler->ComposeDataL(aJobId, templ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CancelJobSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::CancelJobSoapL(const TDesC8& aJobId) -{ - LOG("[CBtSoapCodec::CancelJobSoapL]\t"); - CreateSoapTemplateL(KBtJobIdStart(), KBtJobIdEnd()); - - iXmlHandler->ComposeDataL(KBtCancelJob(), KBtAction()); - - TBtAttrString8 templ; - templ.Format(KBtValueTemplate(), &KBtJobId()); - - iXmlHandler->ComposeDataL(aJobId, templ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetEventSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetEventSoapL(const TDesC8& aJobId) -{ - LOG("[CBtSoapCodec::GetEventSoapL]\t"); - CreateSoapTemplateL(KBtJobIdStart(), KBtJobIdEnd()); - - iXmlHandler->ComposeDataL(KBtGetEvent(), KBtAction()); - - TBtAttrString8 templ; - templ.Format(KBtValueTemplate(), &KBtJobId()); - - iXmlHandler->ComposeDataL(aJobId, templ); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::GetMarginsSoapL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::GetMarginsSoapL() -{ - LOG("[CBtSoapCodec::GetMarginsSoapL]\t NOT SUPPORTED -> leave"); - User::Leave(KErrNotSupported); - - CreateSoapTemplateL(KBtGetMarginsStart(), KBtGetMarginsEnd()); - - iXmlHandler->ComposeDataL(KBtGetMargins(), KBtAction()); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::SoapAction -// -//-------------------------------------------------------------------------------------------- -TInt CBtSoapCodec::SoapAction() -{ - LOG1("[CBtSoapCodec::SoapAction()]\t iActionBuffer: %d", iActionBuffer); - if(!iActionBuffer || 0 >= iActionBuffer->Length()) - return EBtUnknownAction; - - TInt len = iActionBuffer->Length() < 50 ? iActionBuffer->Length() : 50; - TPtrC8 ptr = iActionBuffer->Mid(0, len); - LOG81("[CBtSoapCodec::SoapAction()]\t ptr: \"%S\"", &ptr); - - /* read action name - the order in list below matters: - be aware the substrings (as CreateJob is for CreateJobResponse) aren't found!*/ - if(KErrNotFound < ptr.Find(KBtCreateJobResponse())) - { - return EBtCreateJobResponse; - } - else if(KErrNotFound < ptr.Find(KBtCreateJob())) - { - return EBtCreateJob; - } - else if(KErrNotFound < ptr.Find(KBtGetPrinterAttributesResponse())) - { - return EBtGetPrinterAttributesResponse; - } - else if(KErrNotFound < ptr.Find(KBtGetPrinterAttributes())) - { - return EBtGetPrinterAttributes; - } - else if(KErrNotFound < ptr.Find(KBtGetJobAttributesResponse())) - { - return EBtGetJobAttributesResponse; - } - else if(KErrNotFound < ptr.Find(KBtGetJobAttributes())) - { - return EBtGetJobAttributes; - } - else if(KErrNotFound < ptr.Find(KBtCancelJobResponse())) - { - return EBtCancelJobResponse; - } - else if(KErrNotFound < ptr.Find(KBtCancelJob())) - { - return EBtCancelJob; - } - else if(KErrNotFound < ptr.Find(KBtGetEventResponse())) - { - return EBtGetEventResponse; - } - else if(KErrNotFound < ptr.Find(KBtGetEvent())) - { - return EBtGetEvent; - } - else if(KErrNotFound < ptr.Find(KBtGetMarginsResponse())) - { - return EBtGetMarginsResponse; - } - else if(KErrNotFound < ptr.Find(KBtGetMargins())) - { - return EBtGetMargins; - } - - return EBtUnknownAction; - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::CBtSoapCodec -// -//-------------------------------------------------------------------------------------------- -CBtSoapCodec::CBtSoapCodec() -{ -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ParseLayout -// -//-------------------------------------------------------------------------------------------- -TPrintCapability CBtSoapCodec::ParseLayoutL() -{ - LOG("[CBtSoapCodec::ParseLayout]\t"); - - TPrintCapability layout; - layout.iCapabilityID = EPrintCapabLayout; - layout.iType = TPrintCapability::Enum; - layout.iLow = 0; - layout.iHigh = 0; - layout.iEnumCount = 0; - - /* Get layout(s) */ - TBtAttrString8 value(KNullDesC8()); - TInt err = KErrNotFound; - GetAttributeL(KBtNumberUpSupported(), value, err); - LOG82("[CBtSoapCodec::ParseLayout]\t %S: %S",&KBtNumberUpSupported(), &value); - LOG1("[CBtSoapCodec::ParseLayout]\t error: %d",err); - if(KErrNone != err) - { - layout.iEnumCodes[0] = EPrintCapabLayout1UpBorderless; - layout.iEnumCount = 1; - } - else - { - LOG("[CBtSoapCodec::ParseLayout]\t get layout values..."); - RArray arr; - TBtMapper::Layout(value, arr); - LOG1("[CBtSoapCodec::ParseLayout]\t layout count: %d", arr.Count()); - for(TInt i = 0; i < arr.Count(); ++i) - { - LOG2("[CBtSoapCodec::ParseLayout]\t arr[%d]: %d", i, arr[i]); - layout.iEnumCodes[i] = arr[i]; - } - layout.iEnumCount = arr.Count(); - arr.Close(); - } - - RArray tmpArr; - tmpArr.Append(EPrintCapabLayout1UpBorderless); - tmpArr.Append(EPrintCapabLayout1UpBorder); - tmpArr.Append(EPrintCapabLayout2Up); - tmpArr.Append(EPrintCapabLayout4Up); - tmpArr.Append(EPrintCapabLayout6Up); - tmpArr.Append(EPrintCapabLayout9Up); - tmpArr.Append(EPrintCapabLayout12Up); - tmpArr.Append(EPrintCapabLayout16Up); - - for(TInt i = 0; i < tmpArr.Count(); ++i) - { - TInt ix = ValuePosition(layout, tmpArr[i]); - if(KErrNotFound == ix) - { - layout.iEnumCodes[layout.iEnumCount] = tmpArr[i]; - ++layout.iEnumCount; - } - } - tmpArr.Close(); - - layout.iDefaultValue = layout.iEnumCodes[0]; - - TInt ix = ValuePosition(layout, EPrintCapabLayout1UpBorderless); - if(KErrNotFound < ix) - layout.iDefaultValue = layout.iEnumCodes[ix]; - - LOG1("[CBtSoapCodec::ParseLayout]\t return default: %d", layout.iDefaultValue); - return layout; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ParseQuality -// -//-------------------------------------------------------------------------------------------- -TPrintCapability CBtSoapCodec::ParseQualityL() -{ - LOG("[CBtSoapCodec::ParseQuality]\t"); - - TPrintCapability quality; - quality.iCapabilityID = EPrintCapabQuality; - quality.iType = TPrintCapability::Enum; - quality.iLow = 0; - quality.iHigh = 0; - quality.iDefaultValue = EPrintCapabQualityDefault; - quality.iEnumCodes[0] = EPrintCapabQualityDefault; - quality.iEnumCount = 1; - - /* Get quality(s) */ - CDesC8ArrayFlat *qualities = new (ELeave) CDesC8ArrayFlat(10); - CleanupStack::PushL(qualities); - - TInt err = KErrNotFound; - GetAttributeListL(KBtPrintQualitySupported(), *qualities, err); - LOG82("[CBtSoapCodec::ParseQuality]\t %S: count: %d",&KBtPrintQualitySupported(), qualities->MdcaCount()); - if(KErrNone != err) - { - LOG1("[CBtSoapCodec::ParseQuality]\t return with error %d",err); - return quality; - } - - for(TInt i = 0; i < qualities->MdcaCount(); ++i) - { - TInt tmp = TBtMapper::Quality( qualities->MdcaPoint(i) ); - LOG2("[CBtSoapCodec::ParseQuality]\t qualities[%2d]: %d",i, tmp); - if(KErrNotSupported != tmp) - { - quality.iEnumCodes[quality.iEnumCount] = tmp; - ++quality.iEnumCount; - } - if(KMaxEnumAmount < quality.iEnumCount) - { - LOG1("[CBtSoapCodec::ParseQuality]\t max enum count reached: %d",quality.iEnumCount); - --quality.iEnumCount; - break; - } - } - CleanupStack::PopAndDestroy(qualities); - - LOG1("[CBtSoapCodec::ParseQuality]\t return default: %d", quality.iDefaultValue); - return quality; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ParsePaperSize -// -//-------------------------------------------------------------------------------------------- -TPrintCapability CBtSoapCodec::ParsePaperSizeL() -{ - LOG("[CBtSoapCodec::ParsePaperSize]\t"); - - TPrintCapability size; - size.iCapabilityID = EPrintCapabPaperSize; - size.iType = TPrintCapability::Enum; - size.iLow = 0; - size.iHigh = 0; - size.iDefaultValue = EPrintCapabPaperSize4x6; - - /* Get size(s) */ - CDesC8ArrayFlat *sizes = new (ELeave) CDesC8ArrayFlat(10); - CleanupStack::PushL(sizes); - - TInt err = KErrNotFound; - GetAttributeListL(KBtMediaSizesSupported(), *sizes, err); - LOG82("[CBtSoapCodec::ParsePaperSize]\t %S: count %d",&KBtMediaSizesSupported(), sizes->MdcaCount()); - if(KErrNone != err) - { - size.iEnumCodes[0] = size.iDefaultValue; - size.iEnumCount = 1; - return size; - } - - TInt enumPos = 0; - for(TInt i = 0; i < sizes->MdcaCount(); ++i) - { -// LOG82("[CBtSoapCodec::ParsePaperSize]\t sizes[%2d]: %S",i, &sizes[i]); - TInt tmp = TBtMapper::Size(sizes->MdcaPoint(i)); - if(KErrNotSupported != tmp) - { - LOG2("[CBtSoapCodec::ParsePaperSize]\t sizes[%2d]: %d",i, tmp); - size.iEnumCodes[enumPos] = tmp; - size.iEnumCount = ++enumPos; - } - if(KMaxEnumAmount < enumPos) - { - LOG1("[CBtSoapCodec::ParsePaperSize]\t max enum count reached: %d",enumPos); - break; - } - } - CleanupStack::PopAndDestroy(sizes); - - // Get default value from loaded media - ParseDefaultSizeL(size, enumPos); - - // Sort the paper sizes in order 'smallest to biggest' - RArray tmpArr; - tmpArr.Append(EPrintCapabPaperSizeAuto); - tmpArr.Append(EPrintCapabPaperSize4x6); - tmpArr.Append(EPrintCapabPaperSize5x7); - tmpArr.Append(EPrintCapabPaperSizeA6); - tmpArr.Append(EPrintCapabPaperSizeA4); - tmpArr.Append(EPrintCapabPaperSizeLetter); - - for(TInt s = 0; s < tmpArr.Count(); ++s) - { - TInt ix = ValuePosition(size,tmpArr[s]); - if(KErrNotFound == ix) - tmpArr.Remove(s); - } - - // Move back to enum array - for(TInt s2 = 0; s2 < tmpArr.Count(); ++s2) - { - size.iEnumCodes[s2] = tmpArr[s2]; - } - tmpArr.Close(); - -#ifdef ENABLE_LOGGING - _LIT(KTab, "|"); - TFileName tmp(KTab); - - for(TInt l = 0; l < size.iEnumCount; ++l) - { - tmp.AppendNum(size.iEnumCodes[l]); - tmp.Append(KTab); - } - LOG1("[CBtSoapCodec::ParsePaperSizeL]\t order: %S", &tmp); -#endif - - return size; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ParseDefaultSizeL -// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::ParseDefaultSizeL(TPrintCapability& aSize, TInt& aPos) -{ - LOG("[CBtSoapCodec::ParseDefaultSizeL]\t"); - - //reserve more space for this: there are several long text lines - TBuf8 value(KNullDesC8()); - TInt err = KErrNotFound; - - GetAttributeL(KBtMediaLoaded(), value, err); - -#ifdef ENABLE_LOGGING - TInt len = value.Length() < 50 ? value.Length() : 50; - TPtrC8 p = value.Mid(0, len); - LOG82("[CBtSoapCodec::ParseDefaultValues]\t %S: ptr: \"%S\"",&KBtMediaLoaded(), &p); -#endif - - if(KErrNone != err) - { - LOG82("[CBtSoapCodec::ParseDefaultSizeL]\t %S not found. Error: %d. Return.",&KBtMediaLoaded(), err); - return; - } - - CXmlHandler* tmpHandler = CXmlHandler::NewLC(); - tmpHandler->InitFromBufferL(value); - TBtAttrString8 start; - TBtAttrString8 end; - start.Format(KBtStartTag(), &KBtLoadedMediumSize()); - end.Format(KBtEndTag(), &KBtLoadedMediumSize()); - - TPtrC8 defValue = tmpHandler->GetDataL(start, end, err); - TInt tmpDefault = TBtMapper::Size(defValue); - - CleanupStack::PopAndDestroy(tmpHandler); - - if(KErrNotSupported != tmpDefault) - { - aSize.iDefaultValue = tmpDefault; - } - - // Check the default value exists... - for(TInt i = 0; i < aSize.iEnumCount; ++i) - { - if(aSize.iDefaultValue == aSize.iEnumCodes[i]) - { - return; - } - } - - // ...if not, append it. - if(KMaxEnumAmount < aPos) - { - --aPos; - } - aSize.iEnumCodes[aPos] = aSize.iDefaultValue; - aSize.iEnumCount = ++aPos; - - LOG1("[CBtSoapCodec::ParseDefaultSizeL]\t return default: %d", aSize.iDefaultValue); -} - - -//-------------------------------------------------------------------------------------------- -// -// CBtSoapCodec::ValuePosition -// -//-------------------------------------------------------------------------------------------- -TInt CBtSoapCodec::ValuePosition(TPrintCapability aCapab, TInt aValue) -{ - TInt pos = KErrNotFound; - for(TInt i = 0; i < aCapab.iEnumCount; ++i) - if(aValue == aCapab.iEnumCodes[i]) - pos = i; - - return pos; -} - -////// TEST METHODS /////////// -//-------------------------------------------------------------------------------------------- -void CBtSoapCodec::TestMeL() -{ - - _LIT8(KSepar, "\n-------------------------\n"); - _LIT8(KKErrNotFound, "KErrNotFound"); - _LIT8(KLF, "\n%d\n"); - - RFs fs; - CleanupClosePushL(fs); - User::LeaveIfError(fs.Connect()); - - /*create*/ - CBtSoapCodec* codec = CBtSoapCodec::NewL(); - TPtrC8 ptr = codec->CreateSoapL(EBtGetPrinterAttributes); - - _LIT(KTstFile, "c:\\data\\tst.txt"); - RFile f; - CleanupClosePushL(f); - f.Replace(fs,KTstFile, EFileWrite); - f.Write(ptr); - f.Write(KSepar()); - - /*read*/ - TInt act; - CBufFlat* data = CBufFlat::NewL(8); - data->InsertL(0, GetPrinterAttributesResponseTestSoap()); - - codec->ReadSoapL(act, *data); - - /*get attribute*/ - TBtAttrString8 val, errStr; - _LIT8(KPrinterState, "PrinterState"); - _LIT8(KPrinterStateReasons, "PrinterStateReasons"); - TInt err = KErrNoMemory; - - codec->GetAttributeL(KPrinterState(), val, err); - TInt s; - errStr.Format(KLF(), err); - f.Size(s); - f.Write(s+1, KPrinterState); - f.Write(errStr); - f.Write(val); - f.Write(KSepar()); - - codec->GetAttributeL(KPrinterStateReasons(), val, err); - errStr.Format(KLF(), err); - f.Size(s); - f.Write(s+1, KPrinterStateReasons); - f.Write(errStr); - f.Write(val); - f.Write(KSepar()); - - codec->GetAttributeL(KKErrNotFound(), val, err); - errStr.Format(KLF(), err); - f.Size(s); - f.Write(s+1, KKErrNotFound); - f.Write(errStr); - f.Write(val); - f.Write(KSepar()); - - CleanupStack::PopAndDestroy(2); // f, fs - -} - - -TPtrC8 CBtSoapCodec::CreateJobResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - "12345" - "0x0001" - "" - "" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} -TPtrC8 CBtSoapCodec::CancelJobResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - "12345" - "0x0406" - "" - "" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} -TPtrC8 CBtSoapCodec::GetPrinterAttributesResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - "MyPrinter" - "MyLocation" - "idle" - "none" - "" - "" - " application/vnd.pwg-xhtml-print+xml:0.95 " - " application/vnd.hp-PCL:5E" - " text/plain" - " application/PostScript:3" - "" - "" - "image/jpeg" - "image/gif" - "" - "true" - "1" - "" - " one-sided" - " two-sided-long-edge" - " two-sided-short-edge" - "" - "4" - "" - "portrait" - "landscape" - "" - "" - "iso_a4_210x297mm" - "iso_a3_297x420mm" - "" - "" - "stationery" - "photographic" - "cardstock" - "" - "" - "" - " iso_a4_210x297mm" - "stationery" - "" - "" - " iso_a4_210x297mm" - "photographic" - "" - "" - "" - "draft" - "normal" - "fine" - "" - "1" - "0x0000" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} -TPtrC8 CBtSoapCodec::GetJobAttributesResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - "12345" - "printing" - "MyExpenseReport" - "mailto:MyEmail" - "2" - "0" - "0x0000" - "" - "" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} -TPtrC8 CBtSoapCodec::GetEventsResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - "12345" - "stopped" - "stopped" - "media-empty" - "0x0000" - "" - "" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} -TPtrC8 CBtSoapCodec::GetMarginsResponseTestSoap() -{ - _LIT8(KTestSoap, "CONTENT-LENGTH:200\nCONTENT-TYPE:text/xml; charset=\"utf-8\"" - "" - "" - "" - " .25in,.25in,0in,.25in" - " 0x0000" - "" - "" - ""); - - TPtrC8 response = KTestSoap(); - return response; -} - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtstatuschannel.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtstatuschannel.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,465 +0,0 @@ -/* -* Copyright (c) 2004-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: Defines the CBtStatusChannel class. -* -*/ - - -#include - -#include "crsbtdevice.h" -#include "cbtstatuschannel.h" -#include "cbtsoapcodec.h" -#include "clog.h" -#include "tbtmapper.h" -#include "cbtdiscover.h" -#include "printmessagecodes.h" - - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::NewL -// -//-------------------------------------------------------------------------------------------- -CBtStatusChannel* CBtStatusChannel::NewL(MBtPCObserver& aObs) -{ - CBtStatusChannel *self = NewLC(aObs); - CleanupStack::Pop(); // self - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::NewLC -// -//-------------------------------------------------------------------------------------------- -CBtStatusChannel* CBtStatusChannel::NewLC(MBtPCObserver& aObs) -{ - CBtStatusChannel *self = new (ELeave) CBtStatusChannel(aObs); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::CBtStatusChannel -// -//-------------------------------------------------------------------------------------------- -CBtStatusChannel::CBtStatusChannel(MBtPCObserver& aObs): - CBtChannelBase( aObs ) -{ - LOG("[CBtStatusChannel::CBtStatusChannel]\t"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::~CBtStatusChannel -// -//-------------------------------------------------------------------------------------------- -CBtStatusChannel::~CBtStatusChannel() -{ - LOG("[CBtStatusChannel::~CBtStatusChannel]\t"); - Cancel(); - ClearConnection(); - - // iChannel have to delete here or otherwise Review-x report critical error. - if(iChannel) - { - delete iChannel; - iChannel = NULL; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::ConstructL() -{ - LOG("[CBtStatusChannel::ConstructL]\t begin"); - CBtChannelBase::ConstructL(); - LOG("[CBtStatusChannel::ConstructL]\t end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::RunL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::RunL() -{ - LOG2("[CBtStatusChannel::RunL]\t BEGIN iStatus %d at state %d", iStatus.Int(), iState); - - //Finish if required - if( EStateFinish == iState ) - { - Disconnect(); - return; - } - - DoLeaveL( iStatus.Int() ); - - switch( iState ) - { - case EStateConnecting: - iObexNullObject->Reset(); - StopWaiting(); - break; - case EStateDisconnecting: - Disconnect(); - StopWaiting(); - break; - case EStateGettingPrinterState: - GetSoapResponseL(); - GetPrinterStateResponseL(); - iState = EStateNone; - break; - case EStateCancellingJob: - GetSoapResponseL(); - CancelJobResponseL(); - iDevice = NULL; - iState = EStateNone; - break; - case EStateGettingJobAttributes: - GetSoapResponseL(); - GetJobAttributesResponseL(); - break; - case EStateNone: - User::Leave( KErrCancel ); - break; - case EStateGetEvent: - iState = EStateGettingEvent; - SendSoapRequestL(EBtGetEvent, iJobId); - WaitL(); - break; - case EStateGettingEvent: - GetSoapResponseL(); - GetEventResponseL(); - StopWaiting(); - break; - default: - break; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::RunError -// -//-------------------------------------------------------------------------------------------- -TInt CBtStatusChannel::RunError(TInt aError) -{ - LOG1("[CBtStatusChannel::RunError]\t state %d", iState); - LOG2("[CBtStatusChannel::RunError]\t error %d, iStatus %d", aError, iStatus.Int() ); - - TInt id = KErrNotFound; - - StopWaiting(); - - switch( iState ) - { - case EStateGettingPrinterState: - if(iDevice) - id = iDevice->DeviceId(); - - iState = EStateFinish; - iObs.GetPrinterStateResponse(EBtStateIdle, ENoMessage, aError, id); - break; - case EStateCancellingJob: - iState = EStateFinish; - iObs.CancelJobResponse(aError); - break; - case EStateGettingJobAttributes: - iState = EStateFinish; - iObs.GetJobAttributesResponse(EBtStateUnknown, KNullDesC8(), KNullDesC8(), KErrNotFound, KErrNotFound, aError); - break; - case EStateGetEvent: - case EStateGettingEvent: - iObs.GetEventResponse(iJobId, EBtStateUnknown, EBtStateIdle, KErrNone, aError); - break; - default: - iState = EStateFinish; - iObs.GetEventResponse(KErrNotFound, KErrNotFound, KErrNotFound, KErrNotFound, aError); - LOG("[CBtPrinterController::RunError]\t GetEventResponse sent" ); - break; - } - iResponseError = aError; - return KErrNone; // othervise error returns to CActive: that's what we don't want. -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::DoCancel -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::DoCancel() -{ - LOG2("[CBtStatusChannel::DoCancel]\t at state %d, iStatus 0x%X", iState, iStatus.Int()); - - StopWaiting(); - - iState = EStateNone; - - CBtChannelBase::DoCancel(); - LOG1("[CBtStatusChannel::DoCancel]\t out iStatus 0x%X", iStatus.Int()); -} - -//------------------------------ -// InCalls -//------------------------------ - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetPrinterAttributesL -// -//-------------------------------------------------------------------------------------------- -TInt CBtStatusChannel::GetPrinterStateL() -{ - LOG("[CBtStatusChannel::GetPrinterStateL]\t begin"); - if(iStop) - return KErrNone; - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - Cancel(); - - iState = EStateGettingPrinterState; - SendSoapRequestL(EBtGetPrinterState); - - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetJobAttributesL -// -//-------------------------------------------------------------------------------------------- -TInt CBtStatusChannel::GetJobAttributesL(TInt aJobId) -{ - LOG1("[CBtStatusChannel::GetJobAttributesL]\t begin with id %d", aJobId); - if(iStop) - return KErrNone; - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - if( KErrNotFound == aJobId) - User::Leave(KErrInvalidData); - - LOG1("[CBtStatusChannel::GetJobAttributesL]\t wait connection? %d", iStatus.Int()); - WaitL(); - - iJobId = aJobId; - LOG1("[CBtStatusChannel::GetJobAttributesL]\t iJobId %d", iJobId); - - iState = EStateGettingJobAttributes; - SendSoapRequestL(EBtGetJobAttributes, iJobId); - - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetEventL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::GetEventL(TInt aJobId) -{ - LOG("[CBtStatusChannel::GetEvent]\t begin"); - if(iStop) - return; - - if(!IsConnected()) - User::Leave(KErrDisconnected); - - if( 0 > aJobId) - User::Leave(KErrInvalidData); - - if(EStateGetEvent == iState || EStateGettingEvent == iState) - return; - - Cancel(); - - iJobId = aJobId; - - iState = EStateGetEvent; - Activate(); -} - -//---------------------------------- - -//------------------------------ -// Responses -//------------------------------ -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetPrinterStateResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::GetPrinterStateResponseL() -{ - LOG("[CBtStatusChannel::GetPrinterStateResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - iState = EStateNone; - - TInt state = EBtStateUnknown; - TInt reasons = EPbCheckPrinter; - TInt opStatus = KErrGeneral; - - iSoapCodec->GetPrinterStateResponseL(state, reasons, opStatus); - - TInt id = KErrNotFound; - if(iDevice) - id = iDevice->DeviceId(); - - iObs.GetPrinterStateResponse(state, reasons, opStatus, id); - -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetJobAttributesResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::GetJobAttributesResponseL() -{ - LOG("[CBtStatusChannel::GetJobAttributesResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - iState = EStateNone; - - TInt jobState = EBtStateUnknown; - TBtAttrString8 jobName(KNullDesC8()); - TBtAttrString8 originator(KNullDesC8()); - TInt sheetsCompleted = KErrNotFound; - TInt pendingJobs = KErrNotFound; - TInt opStatus = KErrNotSupported; - - iSoapCodec->GetJobAttributesResponseL(iJobId, jobState, jobName, originator, - sheetsCompleted, pendingJobs, opStatus); - - iObs.GetJobAttributesResponse(jobState, jobName, originator, - sheetsCompleted, pendingJobs, opStatus); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::CancelJobResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::CancelJobResponseL() -{ - LOG("[CBtStatusChannel::CancelJobResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - iState = EStateNone; - - TInt err = KErrNotFound; - iSoapCodec->CancelJobResponseL(iJobId, err); - - LOG1("[CBtStatusChannel::CancelJobResponseL]\t err %d", err); - iObs.CancelJobResponse(err); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::GetEventResponseL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::GetEventResponseL() -{ - LOG("[CBtStatusChannel::GetEventResponseL]\t"); - User::LeaveIfNull(iSoapCodec); - iState = EStateNone; - - TInt jobState, printerState, stateReasons, operationStatus; - - iSoapCodec->GetEventResponseL(iJobId, jobState, printerState, stateReasons, operationStatus); - iObs.GetEventResponse(iJobId, jobState, printerState, stateReasons, operationStatus); -} -/////////////////////////////// -// Private -/////////////////////////////// -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::ConnectL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::ConnectL() -{ - LOG2("[CBtStatusChannel::ConnectL]\t isConnected: %d, iDevice %d", IsConnected(), iDevice); - - User::LeaveIfNull(iDevice); - - LOG1("[CBtStatusChannel::ConnectedL]\t aDevice.UsedProtocols(): %d", iDevice->UsedProtocol()); - if( !(KImagePrint_PrinterProtocol_BPP & iDevice->UsedProtocol()) ) - User::Leave(KErrNotSupported); - - if(IsConnected()) - { - LOG1("[CBtStatusChannel::ConnectL]\t isConnected: %d", IsConnected()); - return; - } - - if(iChannel) - { - delete iChannel; - iChannel = NULL; - } - - TObexBluetoothProtocolInfo protocolInfo; - protocolInfo.iTransport.Copy( KRFCOMMDesC ); - protocolInfo.iAddr.SetBTAddr(iDevice->BDAddr() );//Address of server bt device - protocolInfo.iAddr.SetPort(iDevice->STSPort() );//Service channel of server rfcomm - - TUUID uuid(KBTSDPPrintingStatus); - iObexNullObject->Reset(); - iObexNullObject->SetTargetL(uuid.Des()); - - // create channel - iChannel = CObexClient::NewL( protocolInfo ); - iChannel->SetCallBack(*this); - iChannel->Connect(*iObexNullObject, iStatus); - - iState = EStateConnecting; - Activate(); -} - -//-------------------------------------------------------------------------------------------- -// -// CBtStatusChannel::DoLeaveL -// -//-------------------------------------------------------------------------------------------- -void CBtStatusChannel::DoLeaveL(TInt aError) -{ - LOG2("[CBtStatusChannel::DoLeaveL]\t aError %d at state %d", aError, iState); - - if(KErrNone == aError) - return; - - if(EStateDisconnecting == iState) - return; - - if(KErrCancel == aError) - return; - - if(KErrCompletion == aError) - return; - - LOG("[CBtStatusChannel::DoLeaveL]\t Leave"); - User::Leave(aError); -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbttimer.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbttimer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2004-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 "cbttimer.h" -#include "clog.h" - -// CONSTANTS - -CBtTimer* CBtTimer::NewL( MBtTimerObserver& aObserver ) - { - CBtTimer* obj = new (ELeave) CBtTimer( aObserver ); - CleanupStack::PushL( obj ) ; - obj->ConstructL(); - CleanupStack::Pop(); // obj - return obj; - } - -CBtTimer::~CBtTimer() - { - } - -CBtTimer::CBtTimer( MBtTimerObserver& aObserver ) : - CTimer( -1 ), - iObserver( aObserver ) - { - CActiveScheduler::Add( this ); - } - -void CBtTimer::ConstructL() - { - CTimer::ConstructL(); - } - -void CBtTimer::Start(TUint aDelay) - { - LOG1("[CBtTimer::Start] timeout %d", aDelay); - After( KDiscoveryDelay ); - } - -void CBtTimer::RunL() - { - LOG2("[CBtTimer::RunL] iStatus.Int(): %d/0x%X", iStatus.Int(),iStatus.Int()); - if( iStatus.Int() == KErrNone ) - { - iObserver.HandleTimeoutL(); - } - LOG("CBtTimer::RunL end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cprintjob.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cprintjob.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrintJob class definition and the PJS enum. -* -*/ - - -#include -#include -#include - -#include "cprintjob.h" -#include "printcapabilitycodes.h" -#include "imageprint.h" -#include "clog.h" -#include "tbtmapper.h" -#include "btprotocolconsts.h" - - - - -// Public functions -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::NewL -// -//-------------------------------------------------------------------------------------------- -CPrintJob* CPrintJob::NewL(CRsBtDevice* aDevice, RArray& aImages, - const TDesC8& aUserName) -{ - CPrintJob* self = new (ELeave) CPrintJob(aDevice); - CleanupStack::PushL(self); - self->ConstructL(aImages, aUserName); - CleanupStack::Pop(); // self - return self; -} - - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::~CPrintJob -// -//-------------------------------------------------------------------------------------------- -CPrintJob::~CPrintJob() -{ - iImages.Reset(); - iImages.Close(); - iDevice = NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::SetJobId -// -//-------------------------------------------------------------------------------------------- -void CPrintJob::SetJobId(const TInt aId) -{ - iJobId = aId; -} - - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::GetJobId -// -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::JobId() -{ - return iJobId; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::GetJobName -// -//-------------------------------------------------------------------------------------------- -void CPrintJob::GetJobName(TDes8& aJobName) -{ - // Return the name of first image - if (iImages.Count() > 0) - { - iImages[0].GetFilePath(aJobName); - } - else - { - aJobName.Append(KNullDesC8()); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::ImageCount -// -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::ImageCount() -{ - return iImages.Count(); -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::Images -// -//-------------------------------------------------------------------------------------------- -void CPrintJob::Images(RArray& aImages) -{ - for (TInt i=0; i < iImages.Count(); i++) - { - aImages.Append(iImages[i]); - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::PrinterId -// -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::PrinterId() -{ - if(Device()) - return Device()->DeviceId(); - - return KErrNotFound; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::GetUserName -// -//-------------------------------------------------------------------------------------------- -void CPrintJob::GetUserName(TPtrC8& aUserName) -{ - aUserName.Set(iUserName); -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::GetUserName -// -//-------------------------------------------------------------------------------------------- -CRsBtDevice* CPrintJob::Device() -{ - if(iDevice) - return iDevice; - else - return NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::SetNumsOfCopies -// -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::SetNumsOfCopies( const RArray& aNumsOfCopies) -{ - TInt err = KErrNone; - - for(TInt arrayIx = 0, imgIx = 0; arrayIx < aNumsOfCopies.Count(); ++arrayIx) - { - if(iImages[imgIx].Index() < aNumsOfCopies.Count()) - { - TInt copies = aNumsOfCopies[iImages[imgIx].Index()]; - if(0 < copies) - iImages[imgIx].SetCopies(copies); - ++imgIx; - } - else - err = KErrCorrupt; - } - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::GetPrintFileL -// -//-------------------------------------------------------------------------------------------- -void CPrintJob::GetPrintFileL(TDes8& aPrintFile) -{ - LOG("[CPrintJob::GetPrintFileL]\t begin"); - - TInt layout; - TInt paper; - TInt quality; - - GetPrintSetting(EPrintCapabLayout, layout); - GetPrintSetting(EPrintCapabPaperSize, paper); - GetPrintSetting(EPrintCapabQuality, quality); - - TFileName tmpFile; - tmpFile.Copy(aPrintFile); - - CXhtmlFileComposer* fileComposer = CXhtmlFileComposer::NewLC(KNullDesC()); - - LOG("[CPrintJob::GetPrintFileL]\t create file"); - fileComposer->CreateXhtmlFileL( iImages, layout, paper, quality, tmpFile, iSheets ); - - CleanupStack::PopAndDestroy(fileComposer); - aPrintFile.Copy(tmpFile); - - LOG("[CPrintJob::GetPrintFileL]\t file created"); -} - - -//-------------------------------------------------------------------------------------------- -// -// CPrintJob::Sheets -// -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::Sheets() -{ - if(0 == iSheets) - { - TInt layout; - TInt layoutNbr = 1; - TInt imageNbr = 0; - - // We don't care about return value here: if GetPrintSetting - // fails, we can anyway tell there will be at least an image/page - GetPrintSetting(EPrintCapabLayout, layout); - - switch( layout ) - { - case EPrintCapabLayout1Up: - case EPrintCapabLayout1UpBorderless: - case EPrintCapabLayout1UpBorder: - layoutNbr = 1; - break; - case EPrintCapabLayout2Up: - layoutNbr = 2; - break; - case EPrintCapabLayout4Up: - layoutNbr = 4; - break; - case EPrintCapabLayout6Up: - layoutNbr = 6; - break; - case EPrintCapabLayout9Up: - layoutNbr = 9; - break; - case EPrintCapabLayout12Up: - layoutNbr = 12; - break; - case EPrintCapabLayout16Up: - layoutNbr = 16; - break; - default: - break; - } - - for (TInt i = 0; i& aImages, const TDesC8& aUserName) -{ - if (aImages.Count() < 1) - { - User::Leave(KErrArgument); - } - - _LIT(KObex, "obex:"); - _LIT(KMmc, "\\mmc"); - _LIT(KLocal, "\\media"); - _LIT(KSlash, "/"); - _LIT(KBackSlash, "\\"); - - // Initialize iImages array - for (TInt i=0 ; iCapabilityCount(); ++i) - { - TPrintCapability c; - if(KErrNone == Device()->GetCapability(aCapabilityID, c) ) - { - aValue = c.iDefaultValue; - LOG2("[CPrintJob::GetPrintSetting]\t %d = %d", aCapabilityID, aValue); - return KErrNone; - } - } - } - - aValue = KErrNotFound; - - LOG("[CPrintJob::GetPrintSetting]\t out: KErrInvalidData"); - return KErrInvalidData; -} - -//-------------------------------------------------------------------------------------------- -// CPrintJob::SetPrintSetting -//-------------------------------------------------------------------------------------------- -TInt CPrintJob::SetPrintSetting(TInt aCapabilityID, TInt aValue) -{ - LOG2("[CPrintJob::SetPrintSetting]\t %d = %d", aCapabilityID, aValue); - - if(Device()) - return Device()->SetDefaultCapability(aCapabilityID, aValue); - - LOG("[CPrintJob::GetPrintSetting]\t out: KErrInvalidData"); - return KErrInvalidSequence; -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/crsbtdevice.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/crsbtdevice.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,879 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsBtDevice class definition. - * -*/ - - -#include "crsbtdevice.h" -#include "clog.h" -#include "imageprint.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CRsBtDevice::CRsBtDevice() - { - } - -CRsBtDevice::~CRsBtDevice() - { - LOG("CRsBtDevice::~CRsBtDevice begin"); - delete iPrinterModel; - delete iDevice; - - iCapabilities.Close(); - LOG("CRsBtDevice::~CRsBtDevice end"); - } - -CRsBtDevice* CRsBtDevice::NewL(const TNameRecord &aName) - { - CRsBtDevice* self = CRsBtDevice::NewLC(aName); - CleanupStack::Pop(self); - return self; - } - -CRsBtDevice* CRsBtDevice::NewL() - { - CRsBtDevice* self = CRsBtDevice::NewLC(); - CleanupStack::Pop(self); - return self; - } - -CRsBtDevice* CRsBtDevice::NewLC(const TNameRecord &aName) - { - CRsBtDevice* self = new (ELeave) CRsBtDevice(); - CleanupStack::PushL(self); - self->ConstructL(aName); - return self; - } - -CRsBtDevice* CRsBtDevice::NewLC() - { - CRsBtDevice* self = new (ELeave) CRsBtDevice(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CRsBtDevice* CRsBtDevice::NewLC(const CRsBtDevice &a) - { - CRsBtDevice* self = new (ELeave) CRsBtDevice(); - CleanupStack::PushL(self); - self->ConstructL(a); - return self; - } - -CRsBtDevice* CRsBtDevice::NewL(const CRsBtDevice &a) - { - CRsBtDevice* self = CRsBtDevice::NewLC(a); - CleanupStack::Pop(self); - return self; - } - -void CRsBtDevice::ConstructL(const TNameRecord &aName) - { - LOG1("CRsBtDevice::ConstructL aName.iName: %S", &(aName.iName)); - TInquirySockAddr sockAddr = (TInquirySockAddr)aName.iAddr; - - TBTDeviceClass devClass(sockAddr.MajorServiceClass(), - sockAddr.MajorClassOfDevice(), - sockAddr.MinorClassOfDevice()); - - iDevice = CBTDevice::NewL(sockAddr.BTAddr()); - - iDevice->SetDeviceClass(devClass); - iDevice->SetFriendlyNameL(aName.iName); - - Init(); - - LOG("CRsBtDevice::ConstructL end"); - } - -void CRsBtDevice::ConstructL() - { - iDevice = CBTDevice::NewL(); - Init(); - } - -void CRsBtDevice::ConstructL(const CRsBtDevice &a) - { - iDevice = CBTDevice::NewL(); - if(a.iDevice) - iDevice->UpdateL(*(a.iDevice)); - - iBPPPort = a.iBPPPort; - iSTSPort = a.iSTSPort; - iOPPPort = a.iOPPPort; - iSupportedProtocols = a.iSupportedProtocols; - iVendor = a.iVendor; - iJustFound = a.iJustFound; - iTimeDiscovered = a.iTimeDiscovered; - iTimeLastUsed = a.iTimeLastUsed; - - iUsed = a.iUsed; - - iPrinterModel = NULL; - if(a.iPrinterModel) - iPrinterModel = a.iPrinterModel->AllocL(); - - iInternalDeviceId = a.iInternalDeviceId; - iDisappeared = a.iDisappeared; - iUsedProtocol = a.iUsedProtocol; - - iCapabilities.Reset(); - for(TInt i = 0; i < a.iCapabilities.Count(); ++i) - { - - TPrintCapability capab; - capab.iCapabilityID = a.iCapabilities[i].iCapabilityID; - capab.iType = a.iCapabilities[i].iType; - capab.iLow = a.iCapabilities[i].iLow; - capab.iHigh = a.iCapabilities[i].iHigh; - capab.iDefaultValue = a.iCapabilities[i].iDefaultValue; - capab.iEnumCount = a.iCapabilities[i].iEnumCount; - - for(TInt j = 0; j < a.iCapabilities[i].iEnumCount; ++j) - { - capab.iEnumCodes[j] = a.iCapabilities[i].iEnumCodes[j]; - } - - AddCapability(capab); - } - } - -void CRsBtDevice::Init() - { - iBPPPort = 0; - iSTSPort = 0; - iOPPPort = 0; - iSupportedProtocols = 0; - iVendor = TPrinter::EVendorNone; - iJustFound = EFalse; - iTimeDiscovered.UniversalTime(); - iTimeLastUsed.UniversalTime(); - iPrinterModel = NULL; - - iInternalDeviceId = KErrNotFound; - iDisappeared = ETrue; - iUsedProtocol = 0; - - iCapabilities.Reset(); - iUsed = EFalse; - } - -/** - * Standard method to allow object to be streamed out to a file. - * @param aStream Stream that object will be written to, should have already been opened. - */ -void CRsBtDevice::ExternalizeL(RWriteStream& aStream) const - { - LOG("[CRsBtDevice::ExternalizeL]\t Begin"); - - aStream.WriteInt32L(iInternalDeviceId); - aStream.WriteUint32L(iBPPPort); - aStream.WriteUint32L(iSTSPort); - aStream.WriteUint32L(iOPPPort); - aStream.WriteInt32L(iSupportedProtocols); - aStream.WriteUint32L(Vendor()); - - TUint32 temp = iTimeLastUsed.Int64(); - aStream.WriteUint32L( temp ); - temp = iTimeLastUsed.Int64() >> 32; - aStream.WriteUint32L( temp ); - temp = iTimeDiscovered.Int64(); - aStream.WriteUint32L( temp ); - temp = iTimeDiscovered.Int64() >> 32; - aStream.WriteUint32L( temp ); - - - aStream.WriteInt32L(iPrinterModel->Des().MaxLength()); - aStream << *iPrinterModel; - - ExternalizeCapabilitiesL(aStream); - - aStream << *iDevice; - - LOG("[CRsBtDevice::ExternalizeL]\t end"); - } - -void CRsBtDevice::ExternalizeCapabilitiesL(RWriteStream& aStream) const - { - LOG("CRsBtDevice::ExternalizeCapabilitiesL begin"); - - aStream.WriteInt32L(iCapabilities.Count()); - for(TInt i = 0; i < iCapabilities.Count(); ++i) - { - aStream.WriteInt32L(iCapabilities[i].iCapabilityID); - aStream.WriteInt32L(iCapabilities[i].iType); - aStream.WriteInt32L(iCapabilities[i].iDefaultValue); - aStream.WriteInt32L(iCapabilities[i].iLow); - aStream.WriteInt32L(iCapabilities[i].iHigh); - aStream.WriteInt32L(iCapabilities[i].iEnumCount); - for(TInt j = 0; j < KMaxEnumAmount; ++j) - { - aStream.WriteInt32L(iCapabilities[i].iEnumCodes[j]); - } - } - } - - -/** - * Standard method to allow object to be streamed in from a file. - * @param aStream Stream that object will be read from, should have already been opened. - */ -void CRsBtDevice::InternalizeL(RReadStream& aStream) - { - LOG("[CRsBtDevice::InternalizeL]\t Begin"); - - TUint timeLastHigh, timeLastLow, timeDiscHigh, timeDiscLow; - TInt maxlen; - - iInternalDeviceId = aStream.ReadInt32L(); - iBPPPort = aStream.ReadUint32L(); - iSTSPort = aStream.ReadUint32L(); - iOPPPort = aStream.ReadUint32L(); - - iSupportedProtocols = aStream.ReadInt32L(); - SetVendor(static_cast( aStream.ReadUint32L() )); - - timeLastLow = aStream.ReadUint32L(); - timeLastHigh = aStream.ReadUint32L(); - timeDiscLow = aStream.ReadUint32L(); - timeDiscHigh = aStream.ReadUint32L(); - - TInt64 temp; - temp = timeLastHigh; - temp = temp << 32; - iTimeLastUsed = temp | timeLastLow; - temp = timeDiscHigh; - temp = temp << 32; - iTimeDiscovered = temp | timeDiscLow; - - delete iPrinterModel; - iPrinterModel = NULL; - maxlen = aStream.ReadInt32L(); - iPrinterModel = HBufC::NewL(aStream,maxlen); - - InternalizeCapabilitiesL(aStream); - - iDevice->InternalizeL(aStream); - iUsed = ETrue; - - LOG1("[CRsBtDevice::InternalizeL]\t End for: %S", &FriendlyName()); - } - -void CRsBtDevice::InternalizeCapabilitiesL(RReadStream& aStream) - { - LOG("[CRsBtDevice::InternalizeCapabilitiesL]\t begin"); - - iCapabilities.Reset(); - - TInt count = aStream.ReadInt32L(); - for(TInt i = 0; i < count; ++i) - { - TPrintCapability capability; - capability.iCapabilityID = aStream.ReadInt32L(); - capability.iType = (TPrintCapability::ECapType)aStream.ReadInt32L(); - capability.iDefaultValue = aStream.ReadInt32L(); - capability.iLow = aStream.ReadInt32L(); - capability.iHigh = aStream.ReadInt32L(); - capability.iEnumCount = aStream.ReadInt32L(); - for(TInt j = 0; j < KMaxEnumAmount; ++j) - { - capability.iEnumCodes[j] = aStream.ReadInt32L(); - } - iCapabilities.Append(capability); - } - } - - -/** - * Create a copy of the current object. - * \returns A pointer to the new object, the caller takes ownership of the object. - */ -CRsBtDevice* CRsBtDevice::CopyL() - { - CRsBtDevice* newDevice = NewLC(); - newDevice->UpdateAllL(*this); - CleanupStack::Pop(); // newDevice - return newDevice; - } - -/** - * Create a copy of the current object. - * \returns A pointer to the new object, the caller takes ownership of the object. - */ -CRsBtDevice* CRsBtDevice::CopyL(CRsBtDevice& aSource) - { - CRsBtDevice* newDevice = NewLC(); - newDevice->UpdateAllL(aSource); - CleanupStack::Pop(); // newDevice - return newDevice; - } - -/** - * \returns Address of descriptor containing the Bluetooth friendly name of the device. - */ -const TDesC& CRsBtDevice::FriendlyName() const - { - return iDevice->FriendlyName(); - } - -/** - * Stores the BPP port (channel). - * @param aPort BPP port (channel) as unsigned integer. If CRsBtDevice::SetBPPPort is not called, initialized as 0. - */ -void CRsBtDevice::SetBPPPort(TUint aPort) - { - iBPPPort = aPort; - } - -/** - * Stores the status port (channel). - * @param aPort Status port (channel) as unsigned integer. If CRsBtDevice::SetSTSPort is not called, initialized as 0. - */ -void CRsBtDevice::SetSTSPort(TUint aPort) - { - iSTSPort = aPort; - } - -/** - * Stores the OPP port (channel). - * @param aPort OPP port (channel) as unsigned integer. If CRsBtDevice::SetOPPPort is not called, initialized as 0. - */ -void CRsBtDevice::SetOPPPort(TUint aPort) - { - iOPPPort = aPort; - } - - -/** - * Stores the protocols that this device support. - * @param aSupportedProtocols The Supported Protocols by this device - */ -void CRsBtDevice::SetSupportedProtocols(TUint aSupportedProtocols) - { - iSupportedProtocols = aSupportedProtocols; - } - -/** - * Obtain the supported protocols by this device - * \returns The supported protocols by this device TUint @sa KImagePrint_PrinterProtocol_BPP @sa KImagePrint_PrinterProtocol_OPP_Printer @sa KImagePrint_PrinterProtocol_OPP_PC - */ -TUint CRsBtDevice::SupportedProtocols() const - { - return iSupportedProtocols; - } - -/** - * Compares the Bluetooth device address of this Bluetooth device to the address of the passed in device. - * @param aDevice Bluetooth device to compare this object to. - * \returns True, Bluetooth device addresses are identical, False, Bluetooth device addresses as not identical. - */ -TBool CRsBtDevice::Equals( const CRsBtDevice &aDevice ) const - { - return (aDevice.iDevice->BDAddr() == iDevice->BDAddr()); - } - -/** - * \returns Bluetooth device address. - */ -const TBTDevAddr& CRsBtDevice::BDAddr() const - { - return iDevice->BDAddr(); - } - -/** - * \returns BPP port (channel) as an unsigned integer. If CRsBtDevice::SetBPPPort is not called, initialized as 0. - */ -TUint CRsBtDevice::BPPPort() const - { - return iBPPPort; - } - -/** - * \returns status port (channel) as an unsigned integer. If CRsBtDevice::SetSTSPort is not called, initialized as 0. - */ -TUint CRsBtDevice::STSPort() const - { - return iSTSPort; - } - -/** - * \returns OPP port (channel) as an unsigned integer. If CRsBtDevice::SetOPPPort is not called, initialized as 0. - */ -TUint CRsBtDevice::OPPPort() const - { - return iOPPPort; - } - -void CRsBtDevice::SetDisappeared(TBool aDisappeared) - { - iDisappeared = aDisappeared; - } - -TBool CRsBtDevice::IsDisappeared() const - { - return iDisappeared; - } - -/** - * First calls CRsBtDevice::UpdateDeviceAndBPP, then updates any remaining data from the current device, - * includes whether device is saved in the device cache, the number of prints, and time stamps of - * discovery and when last used. - * @param aDevice Device whose data will be used to update current device. - * \returns True, data of the current device was updated, False, nothing changed. - */ -TBool CRsBtDevice::UpdateAllL(CRsBtDevice &aDevice) - { - TBool modified = EFalse; - - modified = UpdateDeviceAndBPPL(aDevice); - - if (iTimeDiscovered != aDevice.iTimeDiscovered) - { - iTimeDiscovered = aDevice.iTimeDiscovered; - modified = ETrue; - } - - if (iTimeLastUsed != aDevice.iTimeLastUsed) - { - iTimeLastUsed = aDevice.iTimeLastUsed; - modified = ETrue; - } - - return modified; - } - -/** - * First calls CRsBtDevice::UpdateDevice, then updates the current devices BPP/OPP data, - * includes BPP/OPP supported information and BPP/OPP port. - * @param aDevice Device whose data will be used to update current device. - * \returns True, data of the current device was updated, False, nothing changed. - */ -TBool CRsBtDevice::UpdateDeviceAndBPPL(CRsBtDevice &aDevice) - { - TBool modified = EFalse; - - modified = UpdateDeviceL(aDevice); - - if ((iSupportedProtocols & aDevice.SupportedProtocols()) != iSupportedProtocols) - { - iSupportedProtocols = aDevice.SupportedProtocols(); - modified = ETrue; - } - - if (iBPPPort != aDevice.BPPPort()) - { - iBPPPort = aDevice.BPPPort(); - modified = ETrue; - } - - if (iSTSPort != aDevice.STSPort()) - { - iSTSPort = aDevice.STSPort(); - modified = ETrue; - } - - if (iOPPPort != aDevice.OPPPort()) - { - iOPPPort = aDevice.OPPPort(); - modified = ETrue; - } - - return modified; - } - -/** - * Update the current devices Bluetooth device data, includes device address, friendly name and device class. - * @param aDevice Device whose data will be used to update current device. - * \returns True, data of the current device was updated, False, nothing changed. - */ -TBool CRsBtDevice::UpdateDeviceL(CRsBtDevice &aDevice) - { - TBool modified = EFalse; - - if( iDevice->BDAddr() != aDevice.iDevice->BDAddr() || - iDevice->FriendlyName() != aDevice.iDevice->FriendlyName() || - ! (DeviceClass() == aDevice.DeviceClass()) ) - { - iDevice->UpdateL(*(aDevice.iDevice)); - modified = ETrue; - } - - if( iPrinterModel ) - { - delete iPrinterModel; - iPrinterModel = NULL; - modified = ETrue; - } - if( aDevice.iPrinterModel ) - { - iPrinterModel = aDevice.iPrinterModel->AllocL(); - modified = ETrue; - } - if( Vendor() != aDevice.Vendor() ) - { - SetVendor(aDevice.Vendor()); - modified = ETrue; - } - - return modified; - } - -/** - * First calls CRsBtDevice::UpdateDeviceAndBPP, then updates any remaining data from the current device, - * includes whether device is saved in the device cache, the number of prints, and time stamps of - * discovery and when last used. - * @param aDevice Device whose data will be used to update current device. - * \returns True, data of the current device was updated, False, nothing changed. - */ -TBool CRsBtDevice::UpdateUsedL(CRsBtDevice &aDevice) - { - TBool modified = EFalse; - - modified = UpdateDeviceAndBPPL(aDevice); - - if (iTimeDiscovered != aDevice.TimeDiscovered()) - { - iTimeDiscovered = aDevice.TimeDiscovered(); - modified = ETrue; - } - - if (iTimeLastUsed != aDevice.TimeLastUsed()) - { - iTimeLastUsed = aDevice.TimeLastUsed(); - modified = ETrue; - } - - if ( !iDisappeared ) - { - iDisappeared = ETrue; - modified = ETrue; - } - - if (iUsedProtocol != (iUsedProtocol & aDevice.SupportedProtocols()) ) - { - iUsedProtocol = aDevice.UsedProtocol(); - modified = ETrue; - } - - return modified; - } - - -/** - * \returns The time stamp of when the device was last used. - */ -TTime CRsBtDevice::TimeLastUsed() const - { - return iTimeLastUsed; - } - -void CRsBtDevice::SetTimeLastUsed(TTime aTime) - { - iTimeLastUsed = aTime; - } - -/** - * \returns The time stamp of when the device was first discovered. - */ -TTime CRsBtDevice::TimeDiscovered() const - { - return iTimeDiscovered; - } - -void CRsBtDevice::SetTimeDiscovered(TTime aTime) - { - iTimeDiscovered = aTime; - } - -/** - * \returns The Bluetooth device class. - */ -TBTDeviceClass CRsBtDevice::DeviceClass() const -{ -return iDevice->DeviceClass(); -} - -void CRsBtDevice::SetPrinterModelL(const TDesC& aModelName) - { - LOG1("CRsBtDevice::SetPrinterModelL aModelName: %S", &aModelName); - HBufC* temp = aModelName.AllocL(); - TPtr ptr = temp->Des(); - ptr.UpperCase(); - delete iPrinterModel; - iPrinterModel = temp; - LOG("CRsBtDevice::SetPrinterModelL end"); - } - -const TDesC& CRsBtDevice::GetPrinterModel() const - { - return *iPrinterModel; - } - -// This is not stored in the cache! -void CRsBtDevice::SetJustFound(TBool aJustFound) - { - iJustFound = aJustFound; - } - -// This is not stored in the cache! -TBool CRsBtDevice::IsJustFound() const - { - return iJustFound; - } - -TInt CRsBtDevice::DeviceId() const - { - return iInternalDeviceId; - } - -void CRsBtDevice::SetDeviceId(TInt aNewId) - { - iInternalDeviceId = aNewId; - } - -void CRsBtDevice::SetVendor( TPrinter::TPrinterVendor aVendor ) - { - LOG1("CRsBtDevice::SetVendor aVendor: %d", aVendor); - iVendor = aVendor; - - LOG("CRsBtDevice::SetVendor end"); - } - -TPrinter::TPrinterVendor CRsBtDevice::Vendor() const - { - return iVendor; - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::Used -// ----------------------------------------------------------------------------- -TBool CRsBtDevice::IsUsed() const - { - return iUsed; - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::SetUsed -// ----------------------------------------------------------------------------- -void CRsBtDevice::SetUsed(TBool aUsed) - { - iUsed = aUsed; - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::GetUsedProtocol -// ----------------------------------------------------------------------------- -// -TInt CRsBtDevice::UsedProtocol() const - { - return iUsedProtocol; - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::SetUsedProtocol -// ----------------------------------------------------------------------------- -// -TInt CRsBtDevice::ComposeUsedProtocol(TInt aRequestedProtocols) - { - LOG2("CRsBtDevice::ComposeUsedProtocol]\t iRequestedProtocols: %d, supported: %d", - aRequestedProtocols, SupportedProtocols()); - - if ((aRequestedProtocols & KImagePrint_PrinterProtocol_BPP) && (SupportedProtocols() & KImagePrint_PrinterProtocol_BPP)) - { - SetUsedProtocol(KImagePrint_PrinterProtocol_BPP); - } - else if ((aRequestedProtocols & KImagePrint_PrinterProtocol_OPP_Printer) && (SupportedProtocols() & KImagePrint_PrinterProtocol_OPP_Printer)) - { - SetUsedProtocol(KImagePrint_PrinterProtocol_OPP_Printer); - } - else if ((aRequestedProtocols & KImagePrint_PrinterProtocol_OPP_PC) && (SupportedProtocols() & KImagePrint_PrinterProtocol_OPP_PC)) - { - SetUsedProtocol(KImagePrint_PrinterProtocol_OPP_PC); - } - else - { - // This shouldn't happen at all, we have an error in the code - LOG("[CRsBtDevice::ComposeUsedProtocol]\t ERROR! Protocol Mismatch."); - SetUsedProtocol(0); - } - return UsedProtocol(); - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::SetUsedProtocol -// ----------------------------------------------------------------------------- -// -void CRsBtDevice::SetUsedProtocol(TInt aUsedProtocol) - { - iUsedProtocol = aUsedProtocol; - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::GetCapabilityIDs -// ----------------------------------------------------------------------------- -// -void CRsBtDevice::GetCapabilityIDs(RArray& aCapabilityIDs ) - { - LOG1("[CBtPrintingDevice::GetCapabilityIDs]\t iCapabilities.Count(): %d", iCapabilities.Count()); - for (TInt i=0; i < iCapabilities.Count(); i++) - { - aCapabilityIDs.Append(iCapabilities[i].iCapabilityID); - LOG2("[CBtPrintingDevice::GetCapabilityIDs]\t iCapabilities[%d]: %d", i, iCapabilities[i].iCapabilityID); - } - } - -// ----------------------------------------------------------------------------- -// CRsBtDevice::GetCapability -// ----------------------------------------------------------------------------- -// -TInt CRsBtDevice::GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability) - { - for (TInt i=0; i < iCapabilities.Count(); i++) - { - if (aCapabilityID == iCapabilities[i].iCapabilityID) - { - // copy capability to ouput param - aCapability.iCapabilityID = aCapabilityID; - aCapability.iDefaultValue = iCapabilities[i].iDefaultValue; - aCapability.iType = iCapabilities[i].iType; - aCapability.iEnumCount = 0; - - - for (TInt j=0; j < iCapabilities[i].iEnumCount; j++) - { - aCapability.iEnumCodes[j] = iCapabilities[i].iEnumCodes[j]; - aCapability.iEnumCount++; - } - - return KErrNone; - } - } - - return KErrNotSupported; - } - -//-------------------------------------------------------------------------------------------- -// CRsBtDevice::SetDefaultCapability -//-------------------------------------------------------------------------------------------- -TInt CRsBtDevice::SetDefaultCapability(TInt aCapabilityID, TInt aValue) - { - LOG2("[CBtPrintingDevice::SetDefaultCapability]\t capab: %d, value: %d", aCapabilityID, aValue); - - // Check Validity against the target capability ranges - for (TInt c=0; c iCapabilities[c].iHigh) && (iCapabilities[c].iHigh != -1))) - { - LOG1("[CBtPrintingDevice::SetJobSettingL]\t capability ranges error; return %d", KErrInvalidData); - return KErrInvalidData; - } - else - { - iCapabilities[c].iDefaultValue = aValue; - LOG1("[CBtPrintingDevice::SetDefaultCapability]\t %d matches", iCapabilities[c].iType); - return KErrNone; - } - - } - else // enum - { - for (TInt e = 0; e < iCapabilities[c].iEnumCount; ++e) - { - if (aValue == iCapabilities[c].iEnumCodes[e]) - { - iCapabilities[c].iDefaultValue = aValue; - LOG("[CBtPrintingDevice::SetDefaultCapability]\t enum matches"); - return KErrNone; - } - } - } - } - } - LOG("[CBtPrintingDevice::SetDefaultCapability]\t capab/value doesn't match"); - return KErrInvalidData; - } - -//-------------------------------------------------------------------------------------------- -// CRsBtDevice::AddCapability -//-------------------------------------------------------------------------------------------- -void CRsBtDevice::AddCapability(TPrintCapability& aCapability) - { - LOG1("[CBtPrintingDevice::AddCapability]\t %d", aCapability.iCapabilityID); - - for (TInt i=0; i < iCapabilities.Count(); i++) - { - if (aCapability.iCapabilityID == iCapabilities[i].iCapabilityID) - { - iCapabilities[i] = aCapability; - return; - } - } - - iCapabilities.Append(aCapability); - } - -//-------------------------------------------------------------------------------------------- -// CRsBtDevice::CapabilityIDCount -//-------------------------------------------------------------------------------------------- -TInt CRsBtDevice::CapabilityCount() const - { - return iCapabilities.Count(); - } - -//-------------------------------------------------------------------------------------------- -// CRsBtDevice::GetPrinter -//-------------------------------------------------------------------------------------------- -TPrinter CRsBtDevice::ToTPrinter() - { - LOG("[CRsBtDevice::GetTPrinter]\t"); - - TPrinter printer; - printer.iDisplayName = FriendlyName(); - if(0 == printer.iDisplayName.Length()) - { - TBuf<20> tmpName; - tmpName.AppendNum(DeviceId()); - printer.iDisplayName = tmpName; - } - printer.iPrinterID = DeviceId(); - printer.iProtocol = UsedProtocol(); - printer.iVendor = Vendor(); - - - // Set properties - printer.iProperties = 0; - if(IsUsed()) - { - printer.iProperties |= TPrinter::Cached; - } - if(KImagePrint_PrinterProtocol_BPP == printer.iProtocol) - { - printer.iProperties |= TPrinter::SupportsPreview; - } - - return printer; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/crsbtdiscoverengine.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/crsbtdiscoverengine.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,550 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsBtDiscoverEngine class definition and its observer -* definition (MBtDiscoveryObserver). -* -*/ - - -#include "crsbtdiscoverengine.h" -#include "cbtdiscover.h" -#include "crsbtdevice.h" -#include "rsutils.h" -#include "cbtdevicecontainer.h" -#include "btprotocolconsts.h" -#include "clog.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -CRsBtDiscoverEngine* CRsBtDiscoverEngine::NewL(MBtDiscoveryObserver& aObs) -{ - CRsBtDiscoverEngine* self = new (ELeave) CRsBtDiscoverEngine(aObs); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; -} - - -CRsBtDiscoverEngine::CRsBtDiscoverEngine(MBtDiscoveryObserver& aObs) - : CActive(CActive::EPriorityStandard), - iState(EFindingDevices), - iObserver(aObs), - iDevice(NULL), - iRequestedProtocols(0) -{ - CActiveScheduler::Add(this); -} - -/** - * @brief Second phase constructor. - * - * @param aFolderToUser Folder where the device cache will be read/stored. - */ -void CRsBtDiscoverEngine::ConstructL() - { - iDiscover = CBtDiscover::NewL(); - iDelayFindDevices.CreateLocal(); - iTimeout = CBtTimer::NewL( *this ); - } - -/** - * @brief Destructor. - */ -CRsBtDiscoverEngine::~CRsBtDiscoverEngine() - { - LOG("CRsBtDiscoverEngine::~CRsBtDiscoverEngine begin"); - Cancel(); - delete iDiscover; - ResetDevice(); - iFoundBeforeArray.Close(); - iDelayFindDevices.Close(); - delete iTimeout; - LOG("CRsBtDiscoverEngine::~CRsBtDiscoverEngine end"); - } - -/** - * @brief Cancels asynchronous tasks of this active object. Terminates the Device and Service Discovery. - */ -void CRsBtDiscoverEngine::DoCancel() - { - LOG("CRsBtDiscoverEngine::DoCancel begin"); - ResetDevice(); - iTimeout->Cancel(); - iDiscover->Stop(); - iDiscover->StopSDP(); - iDelayFindDevices.Cancel(); - iFoundBeforeArray.Reset(); - LOG("CRsBtDiscoverEngine::DoCancel end"); - } - -/** - * @brief Called by the Active Scheduler when an asynchronous call finish. - */ -void CRsBtDiscoverEngine::RunL() - { - LOG1("CRsBtDiscoverEngine::RunL iStatus.Int(): %d", iStatus.Int()); - LOG1("CRsBtDiscoverEngine::RunL iState: %d", iState); - - iTimeout->Cancel(); - - if( iStatus != KErrNone ) - { - switch( iState ) - { - case EDelayFindDevices: - LOG1("[CRsBtDiscoverEngine::RunL]\t Try to find again... (error %d)", iStatus.Int()); - break; - case EFindingDevices: - if( iStatus == (KHCIErrorBase - ECommandDisallowed) ) - { - LOG("[CRsBtDiscoverEngine::RunL]\t Retry discovery"); - iState = EDelayFindDevices; - iDelayFindDevices.Cancel(); - iDelayFindDevices.After(iStatus,500000); - SetActive(); - break; - } - else if (iStatus == KErrHostResNoMoreResults) - { - LOG("[CRsBtDiscoverEngine::RunL]\t No more devices, all found."); - ResetDevice(); - //Make call to callback function informing that all is done - iObserver.HandleDiscoveryEvent(MBtDiscoveryObserver::EDoneFindingPrinters, KErrNone); - break; - } - default: - LOG1("[CRsBtDiscoverEngine::RunL]\t Leave error %d", iStatus.Int()); - User::Leave(iStatus.Int()); - break; - } - } - else - { - switch( iState ) - { - case EFindingDevices: - if( CheckBtDevice() ) - { - TNameRecord name = iDiscover->GetNameRecord(); - TBTDevAddr addr = ((TBTSockAddr)name.iAddr).BTAddr(); - TInt nPos = iFoundBeforeArray.Find( addr ); - - if( nPos == KErrNotFound ) - { - // found new printer, add to list and check service capabilities - User::LeaveIfError( iFoundBeforeArray.Append( addr ) ); - ServiceDiscoveryL(); - break; - } - } - ContinueDiscovery(); - break; - case EGettingServices: - if( ComposeDeviceL() ) - { - LOG1("CRsBtDiscoverEngine::RunL wanted device: %S", &(iDiscover->GetDeviceName())); - //Make call to callback function informing that new device has been found. - iObserver.HandleDiscoveryEvent(MBtDiscoveryObserver::EFoundBtPrinter, iStatus.Int()); - } - //And search for more devices - ContinueDiscovery(); - break; - - case EDelayFindDevices: - StartDiscovery(); - break; - default: - break; - } - } - - LOG("CRsBtDiscoverEngine::RunL end"); - } - -TInt CRsBtDiscoverEngine::RunError(TInt aError) - { - LOG1("CRsBtDiscoverEngine::RunError aError: %d", aError); - Stop(); - - //Make call to callback function informing that there was an error. - iObserver.HandleDiscoveryEvent(MBtDiscoveryObserver::EErrorDuringDiscover,iStatus.Int()); - LOG("CRsBtDiscoverEngine::RunError end"); - return KErrNone; - } - -/** - * @brief Starts the asynchronous discovery of devices. - * - * Starts the asynchronous discovery of devices, it will first report - * the devices that are stored on the cache from a previous run. - * If no devices were returned from the cache, it will start the - * Bluetooth discovery process inmediatly. - * - * @param aRequestedProtocols The requested protocols. - */ -void CRsBtDiscoverEngine::Start(TUint aRequestedProtocols) - { - LOG1("[CRsBtDiscoverEngine::StartL]\t aRequestedProtocols: %d", aRequestedProtocols); - iRequestedProtocols = aRequestedProtocols; - iFoundBeforeArray.Reset(); - - if(!iDiscover->IsFindingDevices() && !iDiscover->IsDoingSDP()) - { - LOG("[CRsBtDiscoverEngine::StartL]\t inside IF clause"); - Cancel(); - ResetDevice(); - - StartDiscovery(); - } - - LOG("[CRsBtDiscoverEngine::StartL]\t exit"); - } - -/** - * @brief Stops the asynchronous discovery of devices. - * - * Starts the asynchronous discovery of devices, it will first report - * the devices that are stored on the cache from a previous run. - * If no devices were returned from the cache, it will start the - * Bluetooth discovery process inmediatly. - * - * @param aRequestedProtocols The requested protocols. - */ -void CRsBtDiscoverEngine::Stop() - { - LOG("[CRsBtDiscoverEngine::Stop]\t"); - - if(IsActive()) - Cancel(); - else - DoCancel(); - - LOG("[CRsBtDiscoverEngine::Stop]\t exit"); - } - -/** - * @brief Start the asynchronous Bluetooth discovery process. - * - * This function calls the method CBtDiscover::FindDevicesL() which - * will cause RunL() with status EFindingDevices to be called when a - * device is discovered. All bluetooth devices will be find, and RunL() - * will determine if it might be a device that we can use. - * - * @sa FindMoreDevices() - */ -void CRsBtDiscoverEngine::StartDiscovery() - { - LOG("[CRsBtDiscoverEngine::StartDiscovery]\t begin"); - iState = EFindingDevices; - iDiscover->Start( iStatus ); - - LOG1( "[CRsBtDiscoverEngine::StartDiscovery]\t iStatus.Int(): 0x%X", iStatus.Int() ); - if( iStatus == KErrNotSupported ) - { - // cleanup if error - iDiscover->Stop(); - TRequestStatus *tmpStat = &iStatus; - User::RequestComplete(tmpStat, KErrHostResNoMoreResults); - } - else - { - iTimeout->Cancel(); - iTimeout->Start(KDiscoveryDelay); - } - SetActive(); - LOG("[CRsBtDiscoverEngine::StartDiscovery]\t end"); - } - -/** - * @brief Find the next device. - * - * It the current state is ESendingCached this will call - * ReportCachedDeviceL() again to fetch the next cached device. - * - * If the state is ERemovingStale it will call - * RemoveStalePrintersL() again to remove the next stale device. - * - * Otherwise, it will call CBtDiscover::FindMoreDevices() to - * discover another device. - */ -void CRsBtDiscoverEngine::ContinueDiscovery() - { - LOG1("[CRsBtDiscoverEngine::ContinueDiscoveryL]\t begin iState: %d", iState); - - Cancel(); - - iState = EFindingDevices; - iDiscover->GetNextDevice(iStatus); - iTimeout->Cancel(); - iTimeout->Start(KDiscoveryDelay); - SetActive(); - - } - -void CRsBtDiscoverEngine::HandleTimeoutL() - { - LOG("[CRsBtDiscoverEngine::HandleTimeoutL]\t begin"); - - Stop(); - if (iState == EGettingServices && IsActive()) - { - LOG("[CRsBtDiscoverEngine::StopServiceDiscovery]\t complete iStatus IS IT OK???"); - TRequestStatus *tmpStat = &iStatus; - User::RequestComplete(tmpStat, KErrNone); - } - iObserver.HandleDiscoveryEvent(MBtDiscoveryObserver::EDoneFindingPrinters, KErrNone); - - LOG("[CRsBtDiscoverEngine::HandleTimeoutL]\t end"); - } - -/** - * @brief Determine if the BT Device could be a device we need. - * - * When any BT Device is discovered RunL() will be called, and it - * will use this function to do a first check on the device to see - * if it is a device that we could use, or if it is a device that - * is totally unrelated to printing and we can ignore rigth away. - * - * Currently we are checking if the device is either a Rendering - * device or a Computer device. If it is a computer it should support - * Object Transfers to be useful. - * - * With this first check we can't be 100% sure if this is a device - * that we can use. If it is a potentially useful device we will need - * to do a Service Discovery (SDP) check later. - * - * @return ETrue if this is an appropiate BT Device, EFalse if this device must be ignored. - * - * @sa ServiceDiscoveryL() - */ -TBool CRsBtDiscoverEngine::CheckBtDevice() - { - // Algorithm to understand Device / Service Class bits - - //1. Are "Rendering"0x40000 and "Object Transfer"0x100000 bits set in the Major Service - // Class field? If not, check if it is a Computer and Supports Object Transfer. - //2. If it is a Rendering device and the Major Device Class is "Imaging"0x600, is the "Printer"0x80 bit set in - // the Minor Device Class field? If not, ignore this Bluetooth device. - //3. If the device was a Computer and it supports Object Transfer, check that - // the MinorDeviceClass Field is any of Desktop | Laptop | Server. - - // http://www.bluetooth.org/assigned-numbers/baseband.htm - // http://www.bluetooth.org/assigned-numbers/sdp.htm - - TUint32 devClass = iDiscover->GetDeviceClass().DeviceClass(); - LOG1("[CRsBtDiscoverEngine::CheckBtDevice]\t devClass: %d", devClass); - - TBool potentialDevice = EFalse; - - if( !(devClass & KBTMjrSvcClassObjectTransfer_V2) ) - { - LOG("[CRsBtDiscoverEngine::CheckBtDevice]\t !KBTMjrSvcClassObjectTransfer_V2 -> return"); - return potentialDevice; - } - - if (devClass & KBTMjrSvcClassRendering_V2) - { - if( (devClass & KBTMjrDevClassImaging_V2) && !(devClass & KBTMinDevClassPrinter_V2) ) - { - // Other imaging device - LOG("[CRsBtDiscoverEngine::CheckBtDevice]\t other imaging device"); - potentialDevice = EFalse; - } - else - { - // Possibly a BPP printer, - LOG("[CRsBtDiscoverEngine::CheckBtDevice]\t KBTMjrSvcClassRendering_V2 and KBTMjrSvcClassObjectTransfer_V2"); - potentialDevice = ETrue; - } - } - else if(devClass & KBTMjrDevClassComputer) - { - // Note: If it is a Rendering Device, it could support BPP or OPP or both. So we will need to do a SDP to know. - // On the other hand, if the Device is of Class Computer, we can check here if we want the device or not - // by checking if iRequestedProtocols contains KImagePrint_PrinterProtocol_OPP_PC. If not, then we don't want - // any Computer Devices. - - - if ( (iRequestedProtocols & KImagePrint_PrinterProtocol_OPP_PC) && - ( (devClass & KBTMinDevClassDesktop) || - (devClass & KBTMinDevClassServer) || - (devClass & KBTMinDevClassLaptop) ) ) - { - LOG("[CRsBtDiscoverEngine::CheckBtDevice] OPP Computers were requested and this is a computer"); - potentialDevice = ETrue; - } - } - - LOG1("[CRsBtDiscoverEngine::CheckBtDevice]\t potentialDevice: %d", potentialDevice); - return potentialDevice; - } - -/** - * @brief Start SDP (Service Discovery Protocol) on a device. - * - * Start SDP (Service Discovery Protocol) on a device to make sure that - * it supports the services needed by this system. The Services that - * we are looking for are DirectPrinting (BPP) and OBEX Object Push (OPP). - * - * This method will only call CBtDiscover::VerifyServiceSupportL() which - * is an asynchronous call. RunL() will be called back when the results are - * ready. - */ -void CRsBtDiscoverEngine::ServiceDiscoveryL() - { - iDiscover->GetSupportedServicesL(iStatus, KBtMaskObexLevel); - iState = EGettingServices; - SetActive(); - } - -void CRsBtDiscoverEngine::StopServiceDiscovery() -{ - LOG1("[CRsBtDiscoverEngine::StopServiceDiscovery]\t iState %d",iState); - if (iState == EGettingServices && IsActive()) - { - LOG("[CRsBtDiscoverEngine::StopServiceDiscovery]\t complete iStatus IS IT OK???"); - TRequestStatus *tmpStat = &iStatus; - User::RequestComplete(tmpStat, KErrNone); - } - iDiscover->StopSDP(); -} - -/** - * @brief Compose the device. - * - * When a Service Discovery has finished, we need to see - * if the services that we want were found on the device. - * This function will also tell if this device supports a - * protocol that was requested. - * - * If a device was determined to support BPP and/or OPP it - * supports a protocol this library can manage. - * - * For example: - * If the libray is requesting devices that support - * the protocol KImagePrint_PrinterProtocol_OPP_Printer and the - * current device supports only KImagePrint_PrinterProtocol_BPP - * then this device will be handled because this library - * can manage BPP Printers. But this device will not be used because - * the library is currently requesting only the OPP_Printer protocol. - * In this case ComposeDeviceL() will return EFalse, indicating that - * we won't use this device. - * - * @return ETrue if this is a device that we can use, EFalse if this device cannot be used. - */ -TBool CRsBtDiscoverEngine::ComposeDeviceL() - { - LOG("[CRsBtDiscoverEngine::ComposeDeviceL]\t begin"); - - TBool wantedDevice( EFalse ); - TNameRecord name = iDiscover->GetNameRecord(); - ResetDevice(); - CRsBtDevice *device = CRsBtDevice::NewLC( name ); - - TUint supportedProtocols( 0 ); - if( iDiscover->IsBPPSupported() ) - { - LOG("[CRsBtDiscoverEngine::ComposeDeviceL]\t BPP supported"); - // We indicate that this device does support this protocol - supportedProtocols = KImagePrint_PrinterProtocol_BPP; - // But we still need to see if that protocol was requested. - if( iRequestedProtocols & KImagePrint_PrinterProtocol_BPP ) - { - device->SetBPPPort( iDiscover->GetBPPPort() ); - device->SetSTSPort( iDiscover->GetSTSPort() ); - wantedDevice = ETrue; - } - } - - if( iDiscover->IsOPPSupported() ) - { - // It must be either a Computer or a Printer, but NOT both! - TBTDeviceClass deviceClass = device->DeviceClass(); - - if( deviceClass.DeviceClass() & KBTMjrDevClassComputer ) - { - LOG("[CRsBtDiscoverEngine::ComposeDeviceL]\t OPP computer"); - supportedProtocols |= KImagePrint_PrinterProtocol_OPP_PC; - if( iRequestedProtocols & KImagePrint_PrinterProtocol_OPP_PC ) - { - device->SetOPPPort(iDiscover->GetOPPPort()); - wantedDevice = ETrue; - } - } - else - { - LOG("[CRsBtDiscoverEngine::ComposeDeviceL]\t OPP printer(?)"); - supportedProtocols |= KImagePrint_PrinterProtocol_OPP_Printer; - if( iRequestedProtocols & KImagePrint_PrinterProtocol_OPP_Printer ) - { - device->SetOPPPort(iDiscover->GetOPPPort()); - wantedDevice = ETrue; - } - } - } - - // Store if wanted device - if( wantedDevice ) - { - LOG1("[CRsBtDiscoverEngine::ComposeDeviceL]\t iRequestedProtocols: %d", iRequestedProtocols); - LOG1("[CRsBtDiscoverEngine::ComposeDeviceL]\t supportedProtocols: %d", supportedProtocols); - device->SetSupportedProtocols(supportedProtocols); - device->SetPrinterModelL(iDiscover->GetPrinterModel()); - device->SetVendor(iDiscover->GetVendor()); - device->SetJustFound(ETrue); - - iDevice = device; - CleanupStack::Pop(device); - device = NULL; - LOG1("[CRsBtDiscoverEngine::ComposeDeviceL]\t iDevice: %d", iDevice); - } - else - { - LOG("[CRsBtDiscoverEngine::ComposeDeviceL]\t NOT wanted device, don't store"); - CleanupStack::PopAndDestroy(device); - } - - // We have now added this device to the cache, along with the protocols - // that it supports. However we wont report it if it does not support - // the specific protocol that was requested. - - LOG1("[CRsBtDiscoverEngine::ComposeDeviceL]\t end with: %d", wantedDevice); - return wantedDevice; - } - -/** - * @brief Obtain the current device. - * - * @param[out] aSequence Will obtain the position the current device. - * - * @return A reference to the current CRsBtDevice. - */ -CRsBtDevice& CRsBtDiscoverEngine::GetDevice() - { - return *iDevice; - } - -void CRsBtDiscoverEngine::ResetDevice() -{ - if(iDevice) - { - delete iDevice; - iDevice = NULL; - } -} - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cxmlhandler.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cxmlhandler.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,361 +0,0 @@ -/* -* Copyright (c) 2004-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: Handler for XML file modify. Defines the class to store and modify XML data. -* -*/ - - -#ifdef _DEBUG -#include -#include -#endif - -#include "cxmlhandler.h" -#include "clog.h" - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::NewL -// -//-------------------------------------------------------------------------------------------- -CXmlHandler* CXmlHandler::NewL() - { - CXmlHandler *self = NewLC(); - CleanupStack::Pop(); // self - - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::NewLC -// -//-------------------------------------------------------------------------------------------- -CXmlHandler* CXmlHandler::NewLC() - { - CXmlHandler *self = new (ELeave) CXmlHandler(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::~CXmlHandler -// -//-------------------------------------------------------------------------------------------- -CXmlHandler::~CXmlHandler() -{ - if(iDataBuf) - delete iDataBuf; - iDataBuf = NULL; - - Reset(); - - iFs.Close(); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::ConstructL() -{ - LOG("[CXmlHandler::ConstructL]\t"); - User::LeaveIfError( iFs.Connect() ); - Reset(); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::InitFromFileL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::InitFromFileL(const TDesC& aFile, const TInt aId) -{ - LOG("[CXmlHandler::InitFromFileL]\t"); - Reset(); - - ReadFileL(aFile); - iBufferId = aId; - - LOG("[CXmlHandler::InitFromFileL]\t Done."); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::InitFromBufferL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::InitFromBufferL(const TDesC8& aBuffer, const TInt aId) -{ - LOG("[CXmlHandler::InitFromBufferL]\t"); - - Reset(); - - if(0 >= aBuffer.Length()) - { - User::Leave(KErrArgument); - } - - iDataBuf = static_cast(User::LeaveIfNull(aBuffer.AllocL())); - iBufferId = aId; - - LOG("[CXmlHandler::InitFromBufferL]\t Done."); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::Reset -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::Reset() -{ - LOG("[CXmlHandler::Reset]\t"); - - if(iDataBuf) - delete iDataBuf; - iDataBuf = NULL; - - iBufferId = KErrNotFound; -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::Reset -// -//-------------------------------------------------------------------------------------------- -TInt CXmlHandler::BufferId() -{ - return iBufferId; -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::Reset -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXmlHandler::Buffer() -{ - if(iDataBuf) - return iDataBuf->Des(); - - return KNullDesC8(); -} - -// PRIVATE - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::CXmlHandler -// -//-------------------------------------------------------------------------------------------- -CXmlHandler::CXmlHandler() -{ -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::FinalizeBufferL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXmlHandler::FinalizeBufferL(const TDesC8& aTag) -{ - LOG("[CXmlHandler]\t FinalizeBufferL"); - - User::LeaveIfNull(iDataBuf); - - // Cut the template to the end tag - TInt pos = iDataBuf->Find(aTag); - if(KErrNotFound == pos) - User::Leave(KErrCorrupt); - - TInt dataLen = pos + aTag.Length(); - TPtrC8 tail = iDataBuf->Left(dataLen); - - return tail; -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::DeleteBufferData -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::DeleteBufferData(TInt aOffset, TInt aLength) -{ - iDataBuf->Des().Delete(aOffset, aLength); - -} -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ReadL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::ReadFileL(const TDesC& aFileName) -{ - LOG("[CXmlHandler]\t ReadFileL"); - // Open the template file and read it into buffer - RFile templateFile; - CleanupClosePushL(templateFile); - - User::LeaveIfError( templateFile.Open( iFs, aFileName, EFileRead) ); - - TInt fileSize = 0; - TInt err = templateFile.Size(fileSize); - if(KErrNone != err) - fileSize = KBtMaxFileSize; - - iDataBuf = HBufC8::NewL(fileSize); - TPtr8 bufferPtr( iDataBuf->Des() ); - - bufferPtr.Zero(); - templateFile.Read(bufferPtr); - - CleanupStack::PopAndDestroy(&templateFile); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::GetDataL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXmlHandler::GetDataL(const TDesC8 &aStart, const TDesC8 &aEnd, TInt& aOffset) -{ - User::LeaveIfNull(iDataBuf); - return ParseValue(iDataBuf->Des(), aStart, aEnd, aOffset); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::GetDataListL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::GetDataListL(const TDesC8 &aStart, const TDesC8 &aEnd, CDesC8ArrayFlat& aList) -{ - User::LeaveIfNull(iDataBuf); - ParseValueListL(iDataBuf->Des(), aStart, aEnd, aList); -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ParseValue -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXmlHandler::ParseValue(const TDesC8 &aData, const TDesC8 &aStart, const TDesC8 &aEnd, TInt& aOffset) -{ -// LOG82("[CXmlHandler::ParseValue]\t s: %S, e: %S", &aStart, &aEnd); - aOffset = aData.Find(aStart); - if(0 > aOffset) - { - return KNullDesC8(); - } - - TInt end = aData.Find(aEnd); - TInt len = end-aOffset-aStart.Length(); - if(0 >= len) - { - aOffset = end; - return KNullDesC8(); - } - - return aData.Mid(aOffset+aStart.Length(), len); -} - - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ParseValueList -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::ParseValueListL(const TDesC8 &aData, const TDesC8 &aStart, const TDesC8 &aEnd, CDesC8ArrayFlat& aList) -{ - LOG("[CXmlHandler::ParseValueListL]\t "); - TPtrC8 tmpPtr = aData; - - TInt offset = tmpPtr.Find(aStart); - while(offset != KErrNotFound) - { - TInt end = tmpPtr.Find(aEnd); - if(0 > end) - { - return; - } - TPtrC8 valuePtr = tmpPtr.Mid(offset+aStart.Length(), end-offset-aStart.Length()); - - HBufC8* listEntry = valuePtr.AllocLC(); - aList.AppendL(listEntry->Des()); - CleanupStack::PopAndDestroy(); // listEntry - - tmpPtr.Set( tmpPtr.Right(tmpPtr.Length()-(end+aEnd.Length()) ) ); - offset = tmpPtr.Find(aStart); - - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ComposeDataL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::ComposeDataL(const TInt aValue, const TDesC8 &aTag) -{ - TBuf8 valueStr; - valueStr.Zero(); - valueStr.AppendNum(aValue); - - ComposeDataL(valueStr, aTag); -} -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::ComposeDataL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::ComposeDataL(const TDesC8 &aData, const TDesC8 &aTag) -{ - User::LeaveIfNull(iDataBuf); - - TInt pos = iDataBuf->Find(aTag); - if(KErrNotFound == pos) - User::Leave(KErrCorrupt); - - while(KErrNotFound != pos) - { - TInt requiredSize = iDataBuf->Des().Length() + aData.Length(); - if(iDataBuf->Des().MaxLength() < requiredSize) - { - iDataBuf = iDataBuf->ReAllocL(requiredSize); - } - iDataBuf->Des().Replace(pos, aTag.Length(), aData); - pos = iDataBuf->Find(aTag); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXmlHandler::InsertDataL -// -//-------------------------------------------------------------------------------------------- -void CXmlHandler::InsertDataL(const TDesC8 &aData, const TInt aOffset) -{ - TInt requiredSize = iDataBuf->Des().Length() + aData.Length(); - if(iDataBuf->Des().MaxLength() < requiredSize) - { - iDataBuf = iDataBuf->ReAllocL(requiredSize); - } - iDataBuf->Des().Insert(aOffset, aData); -} - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/main.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/main.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cbtprintingdevice.h" - -// Entry point to the application DLL - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10208A21, CBtPrintingDevice::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/rsutils.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/rsutils.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,645 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rsutils.h" -#include "btprotocolconsts.h" -#include "cbtonquery.h" -#include "clog.h" - -namespace - { - const TInt KSegBufChunkSize=2048; -#ifdef ENABLE_LOGGING // for removing compile warnings - const TInt KLogBufferSize = 50; -#endif - } - - - -LOCAL_C TInt SearchAndReplace(TDes &aString, const TDesC &aSearch, const TDesC &aReplace) -{ - TInt nPos, nLengthLeft; - - nLengthLeft = aString.MaxLength() - aString.Length(); - - nPos = aString.Find(aSearch); - while (nPos != KErrNotFound) - { - if ((nLengthLeft - (aReplace.Length() - aSearch.Length())) < 0) - { - return KErrGeneral; - } - aString.Replace (nPos, aSearch.Length(), aReplace); - nLengthLeft = aString.MaxLength() - aString.Length(); - nPos = aString.Find(aSearch); - } - return KErrNone; -} - -LOCAL_C void SearchAndReplaceL(CBufBase& aString, TDesC8& aSearch, TDesC8& aReplace) -{ - TInt nExtraLength = 0; - TInt nLength = aString.Size(); - TInt nTempPos = 0; - - HBufC8* buf = HBufC8::NewLC(nLength); - TPtr8 ptr(buf->Des()); - aString.Read(0, ptr, nLength); - - TInt nPos = 0; - while (nPos < nLength) - { - nTempPos = ptr.Mid(nPos).Find(aSearch); - if (nTempPos == KErrNotFound) - break; - nPos += nTempPos; - aString.Delete(nPos+nExtraLength, aSearch.Length()); - aString.InsertL(nPos+nExtraLength, aReplace); - nExtraLength += aReplace.Length()-aSearch.Length(); - nPos++; - } - - CleanupStack::PopAndDestroy(buf); -} - -LOCAL_C void SearchAndReplace(TDes &aString, TChar aChar, TChar aReplace) -{ - TBuf<1> aSrc1, aRep2; - aSrc1.Append(aChar); - aRep2.Append(aReplace); - - SearchAndReplace(aString, aSrc1, aRep2); -} - -void RsUtils::CleanFileName(const TDesC &aOldFname, TDes& aNewFname) -{ -LOG1("RsUtils::CleanFileName aOldFname: %S", &aOldFname); - TInt nLen; - - const TUint colon=TChar(':'); - - if (aOldFname.Length() == 0 || aNewFname.Length() == 0) - return; - - nLen = aOldFname.Length(); - if(nLen > 3 && aOldFname[1] == colon) - { - // strip off c:\ at the front - aNewFname = aOldFname.Right(nLen-3); - } - else - aNewFname=aOldFname; - - // Change \ into / - SearchAndReplace (aNewFname, '\\', '/'); - LOG1("RsUtils::CleanFileName aNewFname: %S", &aNewFname); -} - - -LOCAL_C void ConvertFrom8To16Bit(const TDesC8& aSrc, TDes8& aDest) -{ - const TInt srcLen = aSrc.Length(); - const TInt destMaxLen = aDest.MaxSize(); - - if (srcLen*2 > destMaxLen) - return; - - aDest.SetLength(srcLen*2); - aDest.FillZ(); - for (TInt i = 0; i < srcLen; i++) - { - aDest[2*i] = aSrc[i]; - aDest[2*i+1] = 0x00; - } -} - -HBufC16* RsUtils::MakeXHTMLSafeL(const TDesC16& aString) -{ - // Change XHTML special characters to their printable equivalents - CBufSeg* seg=CBufSeg::NewL(KSegBufChunkSize); - CleanupStack::PushL(seg); - - seg->InsertL(0, &aString[0], aString.Length()*2); - - TBuf8<16> src; - TBuf8<18> rep; - - _LIT8(KAmpersand, "&"); - ConvertFrom8To16Bit(KAmpersand, rep); - ConvertFrom8To16Bit(_L8("&"), src); - SearchAndReplaceL(*seg, src, rep); - - _LIT8(KLessthan, "<"); - ConvertFrom8To16Bit(KLessthan, rep); - ConvertFrom8To16Bit(_L8("<"), src); - SearchAndReplaceL(*seg, src, rep); - - _LIT8(KGreaterthan, ">"); - ConvertFrom8To16Bit(KGreaterthan, rep); - ConvertFrom8To16Bit(_L8(">"), src); - SearchAndReplaceL(*seg, src, rep); - - _LIT8(KApostrophe, "'"); - ConvertFrom8To16Bit(KApostrophe, rep); - ConvertFrom8To16Bit(_L8("\'"), src); - SearchAndReplaceL(*seg, src, rep); - - _LIT8(KDoubleQuote, """); - ConvertFrom8To16Bit(KDoubleQuote, rep); - ConvertFrom8To16Bit(_L8("\""), src); - SearchAndReplaceL(*seg, src, rep); - - // Replace the many types of newlines with the XHTML break sequence - _LIT8(KTokenNewLine8,"
"); - ConvertFrom8To16Bit(KTokenNewLine8, rep); - - ConvertFrom8To16Bit(_L8("\r\n"), src); - SearchAndReplaceL(*seg, src, rep); - - ConvertFrom8To16Bit(_L8("\n"), src); - SearchAndReplaceL(*seg, src, rep); - - TUint16 newLine=0x2029; - src.Copy(((TUint8*)&newLine),2); - SearchAndReplaceL(*seg, src, rep); - - newLine=0x2028; - src.Copy(((TUint8*)&newLine),2); - SearchAndReplaceL(*seg, src, rep); - - - TInt len = seg->Size()/2; - HBufC16* retBuf = HBufC16::NewL(len); - TPtr16 ptr16(retBuf->Des()); - ptr16.SetLength(len); - seg->Read(0, &ptr16[0], len*2); - - CleanupStack::PopAndDestroy(seg); - - return retBuf; - -} - - -HBufC8* RsUtils::ConvertFromUnicodeToUtf8LC(const TDesC16& aUnicode) -{ - CBufSeg* seg=CBufSeg::NewL(KSegBufChunkSize); - CleanupStack::PushL(seg); - - const TInt KNumCharConvert = 30; - - HBufC8* buf = HBufC8::NewLC(KNumCharConvert*10); - TPtr8 ptr(buf->Des()); - - TInt nInsertPos = 0; - TInt nSrcPos = 0; - TInt nLength = KNumCharConvert; - TInt nSrcLength = aUnicode.Length(); - TInt nUnconvCharsLeft = 0; - - //start loop - while (nSrcPos < nSrcLength) - { - ptr.SetLength(0); - nLength = Min(KNumCharConvert, nSrcLength-nSrcPos); - - //convert to utf8 - nUnconvCharsLeft = CnvUtfConverter::ConvertFromUnicodeToUtf8(ptr, aUnicode.Mid(nSrcPos, nLength)); - - //append converted text to a buffer - seg->InsertL(nInsertPos, ptr); - - nInsertPos += ptr.Length(); - nSrcPos += (nLength-nUnconvCharsLeft); - } - CleanupStack::PopAndDestroy(buf); - - //copy converted data to a buffer to return - nLength = seg->Size(); - HBufC8* retBuf = HBufC8::NewL(nLength); - TPtr8 ptrRet(retBuf->Des()); - seg->Read(0, ptrRet, nLength); - *retBuf=ptrRet; - - CleanupStack::PopAndDestroy(seg); - - CleanupStack::PushL(retBuf); - return retBuf; -} - -// correct order one... -HBufC8* RsUtils::ConvertToUtf8SafeLC(const TDesC16& aUnicode) -{ - if (!aUnicode.Length()) - { - HBufC8* buf = HBufC8::NewLC(1); - return buf; - } - - HBufC16* buf1 = MakeXHTMLSafeL(aUnicode); - CleanupStack::PushL(buf1); - HBufC8* retBuf = ConvertFromUnicodeToUtf8LC(*buf1); - - CleanupStack::Pop(retBuf); - CleanupStack::PopAndDestroy(buf1); - CleanupStack::PushL(retBuf); - return retBuf; -} - - -void RsUtils::FindWidthHeightForPrinting(TInt &aWidth, TInt &aHeight, const TInt aMaxWidth, const TInt aMaxHeight) -{ - if (aWidth*aMaxHeight == aHeight*aMaxWidth) - { - aWidth = aMaxWidth; - aHeight = aMaxHeight; - } - else if (aWidth*aMaxHeight > aHeight*aMaxWidth) - { - aHeight = (aMaxWidth*aHeight)/aWidth; - aWidth = aMaxWidth; - } - else - { - aWidth = (aMaxHeight*aWidth)/aHeight; - aHeight = aMaxHeight; - } -} - - - - -// All the helper functions - - -// returns the file name - -TFileName RsUtils::FileName( const TFileName& aFullName ) - { - TParse parse; - parse.Set(aFullName, NULL, NULL); - return parse.NameAndExt(); - } - - -/** Test whether a path points to ROM. The file does not need to exist - */ -TBool RsUtils::PathIsInRom(const TFileName &aFileName) - { - LOG("RsUtils::PathIsInRom begin"); - TParsePtrC parseSource( aFileName ); - TInt driveId; - TFileName path; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveId ); - PathInfo::GetFullPath( path, driveId, PathInfo::ERomRootPath ); - TParsePtrC parseRom( path ); - - TBool res = ( parseSource.Drive().CompareF( parseRom.Drive() ) == 0 ) ? ETrue : EFalse; - LOG1("RsUtils::PathIsInRom res: %d", res); - return res; - } - -/** Returns a fullname with a drive not in rom - */ -TFileName RsUtils::PathNotRom(const TFileName &aFileName) - { - LOG1("RsUtils::PathNotRom aFileName: %S", &aFileName); - - if( PathIsInRom( aFileName ) ) - { - LOG("RsUtils::PathNotRom file in rom"); - TParse parse; - - TInt driveId; - TFileName path; - DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, driveId ); - PathInfo::GetRootPath( path, driveId ); - TParsePtrC parsePhoneDrive( path ); - - TFileName drive = parsePhoneDrive.Drive(); - parse.Set(drive, &aFileName, NULL); - return parse.FullName(); - } - else - { - LOG("RsUtils::PathNotRom file NOT in rom"); - return aFileName; - } - } - - - -TBool RsUtils::FileExists(const TDesC& aFileName, RFs& aFs) -{ - return (BaflUtils::FileExists(aFs, aFileName)); -} - -TInt RsUtils::FileSize(const TDesC& aFileName, TInt& aSize, RFs& aFs) -{ - TEntry theFile; - TInt error = aFs.Entry(aFileName, theFile); - aSize = theFile.iSize; - return error; -} - - - -HBufC* RsUtils::ConcatenateStringsLC(const TDesC& aDes1, const TDesC& aDes2) -{ - const TInt newLen=aDes1.Length()+aDes2.Length(); - HBufC* newBuf=HBufC::NewLC(newLen); - *newBuf=aDes1; - TPtr newPtr(newBuf->Des()); - newPtr.Append(aDes2); - *newBuf=newPtr; - return newBuf; -} - -HBufC* RsUtils::ConcatenateStringsLC(const TDesC& aDes1, const TDesC& aDes2, const TDesC& aDes3) -{ - HBufC* twoSt=ConcatenateStringsLC(aDes1,aDes2); - HBufC* allThree=ConcatenateStringsLC(*twoSt,aDes3); - CleanupStack::Pop(allThree); - CleanupStack::PopAndDestroy(twoSt); - CleanupStack::PushL(allThree); - return allThree; -} - - -// WARNING: This function uses User::WaitForRequest, -// so check carefully where to use it to avoid View Server 11 panic -TBool RsUtils::IsBluetoothOn() - { - const TUid KPowerModeSettingNotifierUid = {0x100059E2}; // Notifier id for BT power mode setting - TPckgBuf pckg( ETrue ); // Input parameter - TPckgBuf resultPckg( EFalse ); // Output parameter - RNotifier notif; - if( notif.Connect() == KErrNone ) - { - TRequestStatus stat; - notif.StartNotifierAndGetResponse(stat, KPowerModeSettingNotifierUid, pckg, resultPckg); - User::WaitForRequest(stat); - notif.CancelNotifier(KPowerModeSettingNotifierUid); - notif.Close(); - } - return resultPckg(); - } - -TLanguage RsUtils::GetPhoneLanguage() -{ - return User::Language(); -} - - -TInt RsUtils::CreateDataFolder( RFs& aSession, TDes& aPath, TDriveNumber aDrive ) - { - LOG1("RsUtils::CreateDataFolder aDrive: %d", aDrive); - _LIT( KColon, ":" ); - TChar drive; - TInt err = aSession.DriveToChar( aDrive, drive ); - if( !err ) - { - err = aSession.CreatePrivatePath( aDrive ); - if( !err ) - { - TFileName path; - aSession.PrivatePath( path ); - aPath.Zero(); - aPath.Append( drive ); - aPath.Append( KColon ); - aPath.Append( path ); - } - } - LOG1("RsUtils::CreateDataFolder end with aPath: %S", &aPath); - LOG1("RsUtils::CreateDataFolder end with err: %d", err); - return err; - } - - -TInt RsUtils::ValidateCacheFile( RFs& aSession, const TDesC& aFileName, - TTimeIntervalMinutes aValidPeriod, TBool& aDeleted ) - { - aDeleted = EFalse; - TEntry entry; - TInt err = aSession.Entry( aFileName, entry ); - - if( !err ) - { - TTime now; - now.UniversalTime(); - now -= aValidPeriod; - if( entry.iModified < now ) - { - // cache file was not used for a aValidPeriod period of time; delete it - err = aSession.Delete( aFileName ); - if( !err ) aDeleted = ETrue; - } - } - LOG1("RsUtils::ValidateCacheFile aDeleted: %d", aDeleted); - LOG1("RsUtils::ValidateCacheFile err: %d", err); - return err; - } - -void RsUtils::LogL( const CBufBase& aBuffer ) - { - #ifdef ENABLE_LOGGING - #define _BUFBASE_LOGGING_ - #ifdef _BUFBASE_LOGGING_ - LOG("BUFBASE LOG BEGIN"); - HBufC8* buffer=HBufC8::NewLC(KLogBufferSize); - TPtr8 bufferPtr(buffer->Des()); - TInt sizeleft=aBuffer.Size(); - TInt amountToRead=KLogBufferSize; - TInt location=0; - while(sizeleft>0) - { - if(sizeleft* http = aBuffer.Http(); - if( http ) - { - LOG1("http->Count: %d", http->Count()); - for( TInt i = 0; i < http->Count(); i++ ) - { - LOG1("i: %d", i); - LogL(*((*http)[i])); - } - } - LOG1("CObexBaseObject::AppParam length: %d", aBuffer.AppParam().Length()); - LogL(aBuffer.AppParam()); - - - LOG("OBEXBASE LOG END"); - #endif // _OBEXBASE_LOGGING_ - #endif // ENABLE_LOGGING - } - -void RsUtils::LogL( const TDesC8& aBuffer ) - { - #ifdef ENABLE_LOGGING - HBufC16* bufC16 = HBufC16::NewLC( aBuffer.Length() ); - TPtr16 ptr16 = bufC16->Des(); - ptr16.Copy( aBuffer ); - LogL( *bufC16 ); - CleanupStack::PopAndDestroy(); // bufC16 - #endif // ENABLE_LOGGING - } - -void RsUtils::LogL( const TDesC16& aBuffer ) - { - #ifdef ENABLE_LOGGING - TInt sizeleft = aBuffer.Length(); - TInt amountToRead = KLogBufferSize; - TInt location = 0; - while( sizeleft > 0 ) - { - if( sizeleft < KLogBufferSize ) - amountToRead = sizeleft; - HBufC16* buffer = aBuffer.Mid( location, amountToRead ).AllocL(); - _LIT( KFormattedString, "ACHTUNG!!! FORMATTED STRING ACHTUNG!!!" ); - _LIT( KFormatMark, "%" ); - if( buffer->Find( KFormatMark ) != KErrNotFound ) - { - delete buffer; - buffer = NULL; - buffer = KFormattedString().AllocL(); - } - LOG1("%S", buffer); - delete buffer; - buffer = NULL; - sizeleft -= amountToRead; - location += amountToRead; - } - #endif // ENABLE_LOGGING - } - -void RsUtils::LogFileL( const TFileName& aName ) - { - #ifdef ENABLE_LOGGING - //#define _FILE_LOGGING_ - #ifdef _FILE_LOGGING_ - LOG("FILE LOG BEGIN"); - - RFile file; - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - User::LeaveIfError( file.Open( fs, aName, EFileStream|EFileRead|EFileShareAny ) ); - CleanupClosePushL( file ); - TInt fileSize; - User::LeaveIfError( file.Size( fileSize ) ); - HBufC8* buffer=HBufC8::NewLC( KLogBufferSize ); - TPtr8 bufferPtr( buffer->Des() ); - TInt sizeleft = fileSize; - TInt amountToRead = KLogBufferSize; - TInt location = 0; - while( sizeleft > 0 ) - { - if( sizeleft < KLogBufferSize ) - amountToRead = sizeleft; - - User::LeaveIfError( file.Read( location, bufferPtr, amountToRead ) ); - LogL( *buffer ); - sizeleft -= amountToRead; - location += amountToRead; - } - CleanupStack::PopAndDestroy( 3 ); // buffer, file, fs - - LOG("FILE LOG END"); - #endif // _FILE_LOGGING_ - #endif // ENABLE_LOGGING - } - -//-------------------------------------------------------------------------------------------- -// -// RsUtils::GetLocalBTNameL -// -//-------------------------------------------------------------------------------------------- -void RsUtils::GetLocalBTNameL(TDes8& aName) - { - LOG("[RsUtils::GetLocalBTNameL] BEGIN"); - RSocketServ socketServ; - User::LeaveIfError( socketServ.Connect() ); - TProtocolDesc pInfo; - TBuf<0x100> name; - TInt error = KErrNone; - - _LIT( BTLinkManager, "BTLinkManager" ); - error = socketServ.FindProtocol( BTLinkManager(), pInfo ); - LOG1("[RsUtils::GetLocalBTNameL] socketServ.FindProtocol ends with: %d", error ); - if( KErrNone == error ) - { - RHostResolver hostResolver; - error = hostResolver.Open( socketServ, pInfo.iAddrFamily, pInfo.iProtocol ); - LOG1("[RsUtils::GetLocalBTNameL] hostResolver.Open ends with: %d", error ); - if( KErrNone == error ) - { - hostResolver.GetHostName( name ); - hostResolver.Close(); - } - aName.Copy( name ); - } - if ( error != KErrNone ) - { - aName.Zero(); - // KServiceClass == own ID - aName.AppendNum(KServiceClass, EHex); - } - socketServ.Close(); - LOG82("[CBtPrintingDevice::GetLocalBTNameL]\t GetLocalBTNameL(%S) %d", &aName, error); - LOG("[RsUtils::GetLocalBTNameL] END"); - - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/bwins/dpofprotdllu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/bwins/dpofprotdllu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/data/01007781.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/data/01007781.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - -// Declares info for DPOF -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x01007781; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x10208A1E; - implementations = - { - // Info for DPOF - IMPLEMENTATION_INFO - { - implementation_uid = 0x10208A20; - version_no = 1; - display_name = "DPOF"; - default_data = "DPOF"; - opaque_data = ""; - } - }; - } - }; - } diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/data/dpof.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/data/dpof.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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 -#include - -#include "imageprint.rh" -#include "printcapabilitycodes.h" -#include "imageprintvariant.h" - -STRUCT STRING - { - LTEXT text; - } - -RESOURCE STRING r_qtn_print_dpof_confirmation_dialog {text=qtn_print_dpof_confirmation_dialog;} - - -enum PrinterClass // should come from ImgPrintKonst.h -{ - EDefault = 0, - EBigAdaptive = 1, - ESmallAdaptive = 2, - EDesk = 3, - ELinked = 99 -}; - -RESOURCE RS_CAPABILITIES dpof_Capabilities -{ - - capabilities = - { - RS_CAPABILITY - { - printerclass=EDefault; - capabilityid=EPrintCapabPaperSize; - type=1; - defaultvalue=EPrintCapabPaperSizeAuto; - low=1; - high=400; - enumcodes={ - EPrintCapabPaperSizeAuto,0 - }; - linkid=0; - printerclass=EDefault; - }, - RS_CAPABILITY - { - printerclass=EDefault; - capabilityid=EPrintCapabLayout; - type=1; - defaultvalue=EPrintCapabLayout1UpMedium; - low=0; - high=0; - enumcodes={ - EPrintCapabLayout1UpMedium,0 - ,EPrintCapabLayout2Up,0 - ,EPrintCapabLayout4Up,0 - ,EPrintCapabLayout6Up,0 - ,EPrintCapabLayout9Up,0 - ,EPrintCapabLayout12Up,0 -#ifdef IMG_PRINT_DYNAMIC_PRINT_SETTINGS - ,EPrintCapabLayout16Up,0 -#endif - }; - linkid=0; - } - }; - -} diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/eabi/dpofprotdllu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/eabi/dpofprotdllu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZTI12CFileManager @ 2 NONAME ; ## - _ZTI13CRsDpofEngine @ 3 NONAME ; ## - _ZTI15CCapabilityInfo @ 4 NONAME ; ## - _ZTI15CPrinterElement @ 5 NONAME ; ## - _ZTI16CCapabilityArray @ 6 NONAME ; ## - _ZTI18CConfirmationQuery @ 7 NONAME ; ## - _ZTI19CDPOFPrintingDevice @ 8 NONAME ; ## - _ZTI20CPrinterCapabilities @ 9 NONAME ; ## - _ZTI9CPrintJob @ 10 NONAME ; ## - _ZTV12CFileManager @ 11 NONAME ; ## - _ZTV13CRsDpofEngine @ 12 NONAME ; ## - _ZTV15CCapabilityInfo @ 13 NONAME ; ## - _ZTV15CPrinterElement @ 14 NONAME ; ## - _ZTV16CCapabilityArray @ 15 NONAME ; ## - _ZTV18CConfirmationQuery @ 16 NONAME ; ## - _ZTV19CDPOFPrintingDevice @ 17 NONAME ; ## - _ZTV20CPrinterCapabilities @ 18 NONAME ; ## - _ZTV9CPrintJob @ 19 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/group/bld.inf --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -dpofprotdll.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/group/dpofprotdll.mmp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/group/dpofprotdll.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "../../../inc/logdef.h" - -deffile dpofprotdll.def - -TARGET dpofprotdll.dll -TARGETTYPE PLUGIN -CAPABILITY CAP_ECOM_PLUGIN - -UID 0x10009D8D 0x01007781 - -APP_LAYER_SYSTEMINCLUDE - -USERINCLUDE . ../inc ../src -USERINCLUDE ../../../ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintServer/inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../../inc -USERINCLUDE ../../../../clog/inc - -SOURCEPATH ../src - -SOURCE cdpofprintingdevice.cpp -SOURCE crsdpofengine.cpp -SOURCE rsutils.cpp -SOURCE cprintjob.cpp -SOURCE cprinterelement.cpp -SOURCE ccapabilityinfo.cpp -SOURCE ccapabilityarray.cpp -SOURCE cprintercapabilities.cpp -SOURCE main.cpp -SOURCE cfilemanager.cpp -SOURCE cconfirmationquery.cpp - -START RESOURCE ../data/01007781.rss -TARGET dpofprotdll.rsc -END - -START RESOURCE ../data/dpof.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -HEADER -TARGETPATH resource/imageprintdata/protocols -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY estor.lib -LIBRARY bafl.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY platformenv.lib -LIBRARY sysutil.lib -LIBRARY commonengine.lib -LIBRARY aknnotify.lib -LIBRARY eiksrv.lib - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/ccapabilityarray.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/ccapabilityarray.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CCapabilityArray class definition. -* -*/ - - -#ifndef CCAPABILITYARRAY_H -#define CCAPABILITYARRAY_H - -#include -#include - -#include "ccapabilityinfo.h" - -/** - * @brief Class that stores an array of CCapabilityInfo objects. - * - * class CCapabilityArray - Holds instances of all the capabilities for a particular - * transport type (protocol). This array is populated during the constructor of the protocol object. - * One array for each transport type. - */ -class CCapabilityArray : public CBase - { - public: - static CCapabilityArray* NewL(TResourceReader& aReader); - ~CCapabilityArray(); - TInt Count() const; - CCapabilityInfo* operator[](TInt aIndex) const; - CCapabilityInfo* LinkedCapability(TInt aLink) const; - - private: - void ConstructL(TResourceReader& aReader); - void AddDataL(TResourceReader& aReader); - - private: - RPointerArray iDataArray; - }; - -#endif // CCAPABILITYARRAY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/ccapabilityinfo.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/ccapabilityinfo.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CCapabilityInfo class definition. -* -*/ - - -#ifndef CCAPABILITYINFO_H -#define CCAPABILITYINFO_H - -#include -#include - -#include "tprintcapability.h" - -/** - * @brief Class that stores a printer's capability information, which is obtained from a resource file. - * - * class CCapabilityInfo - Holds all of the information about a Capability. Each capability - * described in the resource file will have a single instance of the CCapabilityInfo created for it. - * This class also includes the current setting, which is only used if the capability is - * actually in use by the current print job. - */ -class CCapabilityInfo : public CBase - { - public: - - static CCapabilityInfo* NewLC(TResourceReader& aReader); - ~CCapabilityInfo(); - - TPrintCapability& Capability(); - TInt SetCurrentValue( TInt aValue ); - TInt PrinterClass() const; - TInt LinkID() const; - TInt CurrentValue() const; - TInt ValueLink( TInt aValue ); - CCapabilityInfo* CopyL() const; - - private: - void ConstructL(TResourceReader& aReader); - - private: - TPrintCapability iCapability; - RArray iLinks; - TInt iLinkID; - TInt iPrinterClass; - TInt iCurrentValue; - }; - -#endif // CCAPABILITYINFO_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cconfirmationquery.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cconfirmationquery.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -#ifndef CCONFIRMATIONQUERY_H -#define CCONFIRMATIONQUERY_H - -#include -#include - -#include "mconfirmationnotify.h" - -class CConfirmationQuery : public CActive -{ -public: - - ~CConfirmationQuery(); - - static CConfirmationQuery* NewL( MConfirmationNotify& aNotify ); - - static CConfirmationQuery* NewLC( MConfirmationNotify& aNotify ); - - void CConfirmationQuery::StartWaitingAnswer( ); - -protected: // from CActive - - void RunL(); - - void RunError(); - - void DoCancel(); - -protected: // construction - - CConfirmationQuery(MConfirmationNotify& aNotify); - - void ConstructL(); - -private: - - MConfirmationNotify& iNotify; - TBool iCancelledByUser; -}; - - -#endif // CCONFIRMATIONQUERY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cdpofprintingdevice.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cdpofprintingdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CDPOFPrintingDevice class definition. -* -*/ - - -#ifndef CDPOFPRINTINGDEVICE_H -#define CDPOFPRINTINGDEVICE_H - -#include -#include -#include - -#include "mprotprintingdevice.h" -#include "crsdpofengine.h" -#include "tmapping.h" -#include "cconfirmationquery.h" -#include "mconfirmationnotify.h" - -// FORWARD DECLARATIONS -class CPrinterCapabilities; -class CPrinterElement; -class CCapabilityArray; -class CPrintJob; -class TSetting; - - -/** - * @brief CDPOFPrintingDevice implements MProtPrintingDevice. This makes the class the "published" class of the DLL it is in. - */ -class CDPOFPrintingDevice : public CActive, public MProtPrintingDevice, public MDpofEngineObserver, public MConfirmationNotify - { - public: - static MProtPrintingDevice* NewL(); - - // Default constructor and destructor. - CDPOFPrintingDevice(); - ~CDPOFPrintingDevice(); - - public: // From MProtPrintingDevice - - // General. - void ConstructL(const TDesC& aDLLPath); - TVersion Version(); - TUint SupportedProtocols(); - // Discovery. - void StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocols = 0); - TInt RemoveCachedDeviceL(TInt aDeviceID); - void CancelDiscovery(TBool aDoCallBack = ETrue); - // Print. - TInt CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver); - void SubmitPrintJobL(); - TInt CancelPrintJob(); - TInt ContinuePrintJobL(); - TInt GetNumPrintPages(); - TInt GetPrintJobStatus(); - TInt GetPrinterStatus(TInt aDeviceID); - // Capabilities. - TInt GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs); - TInt GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability); - TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); - TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); - // Preview. - TInt GetNumPreviewPages(); - TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFsBitmapHandle); - TInt CreatePreviewImage(TInt aPageNumber); - - void RegisterIdleObserver(MProtIdleObserver * /*aObserver*/) {}; - - public: // MBTOnNotify - void BTOnCompleteL( TBool aResult ); - void ConfirmationQueryCompleteL ( TInt aError ); - - void OverwriteExistingJobL (); - - - void SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ); - - public: // From MDpofEngineObserver - - void HandleDpofEngineEventL(const TInt aStatus, const TInt aRetCode); - - protected: // From CActive - - void DoCancel(); - void RunL(); - - private: - // Utils. - // Capabilities Section. - CCapabilityArray* LoadCapabilityL(RResourceFile& aResFile, TInt aCapID); - CPrinterElement* FindDeviceL(TInt aPrinterID); - TBool FindSetting(TInt aCapabilityID, TSetting& aSetting); - TInt AddReadyRequestAndSetActive( TInt aRequest ); - TInt CheckReadyRequestAndSetActive(); - // Set MMC printer - void SetMMCPrinterL(); - - // Confirmation to override existing autoprint file - void ShowConfirmationQueryL(); - - private: // data - - /// Protocol Capabilities. - CCapabilityArray* iCapabilities; - /// Array to save all the devices discovered. - RPointerArray iDeviceList; - /// Print job object. - CPrintJob* iPrintJob; - - /// DPOF Engine. - CRsDpofEngine *iDPOF; - - /// Array to save all the icon / template pairs supported by a protocol. - RArray iMappingArray; - - /// Print error. - TInt iPrintError; - /// Print error message code. - TInt iPrintErrorMsgCode; - - RArray iReadyRequests; - - TBool iCancelledByUser; - - CConfirmationQuery* iConfirmationQuery; - - CAknGlobalConfirmationQuery* iPQ; - - HBufC* iQuestion; - }; - -#endif // CDPOFPRINTINGDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cfilemanager.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cfilemanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2004-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 CFILEMANAGER_H -#define CFILEMANAGER_H - -#include -#include - -class CFileManager : public CActive - { - public: - - static CFileManager* NewL( RFs& aFs ); - ~CFileManager(); - - public: - - TInt Copy( const TDesC& aFile, const TDesC& aDir, TRequestStatus& aStatus ); - void CancelCopy(); - TInt RmDir( const TDesC& aDir, TRequestStatus& aStatus ); - void CancelRmDir(); - - private: - - CFileManager( RFs& aFs ); - void ConstructL(); - - protected: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - - private: - - void CloseCopy(); - void InitCopyL( const TDesC& aFile, const TDesC& aDir ); - - private: - - enum TOperation - { - EFileManCopy = 0, - EBufferCopy, - ERemoveDir - }; - - private: // data - - RFs& iFs; - CFileMan* iFileMan; - TOperation iOperation; - TRequestStatus* iCallerStatus; - RFile iSource; - RFile iDest; - HBufC8* iBuffer; - TInt iBytesLeft; - TInt iBytesNum; - }; - - -#endif // CFILEMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprintercapabilities.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprintercapabilities.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrinterCapabilities class definition. -* -*/ - - -#ifndef CPRINTERCAPABILITIES_H -#define CPRINTERCAPABILITIES_H - -#include -#include - -#include "ccapabilityarray.h" - -/** - * @brief Class that stores a printer class capabilities in full detail. - * - * class PrinterCapabilities - An array which holds pointers to capabilities that - * exist in the CapabilitiesArray(s). Each printer that is found will have it's own - * PrinterCapabilities object, and when the PrinterCapability functions are called from - * the ClientAPI, the data is obtained directly from this PrinterCapabilities class. - * Different printers may refer back to the same object from the capabilities Array. - * When the PrinterCapabilities object is created, it will contain the default - * capabilities and current settings. If the printer is selected for the print job, - * the settings and configuration may change to reflect the current print job settings. - * - * BUILDING PRINTER CAPABILITIES - * Each resource contains a printerclass field, which identifies which class of printer this - * capability is defined for. When a printer is discovered and a new PrinterCapabilities - * object is created, the CapabilitiyArray is searched for capabilites with that class to - * add. This occurs in the BuildCCapabilityArray function. - * - * While a resource file can have the same capabilitiy defined multiple times for multiple - * PrinterClasses, A PrinterClass can have a capability defined only once for the class. - * One of the classes is "ELinked". Capabilities of this class are dependent upon the current - * value of other capabilities and can be linked into one or more other PrinterCapability arrays. - * Each enumerated value in the resource is a value pair, with the second number being a link code. - * If non-zero, then the resource with right LinkID is also added to the PrinterCapabilites. - * When SetCurrentCapability is called and a current value is changed, the linked capability must - * also be checked to see if it is changed. - * - * Note that setting the current value can only occur for the current print job, but when it does - * the capabilities for a particular printer can actually change during the life of the job, - * requiring the application to get the printer capabilities multiple times. - * Notes on implementation Limitations: - * - * The current implementation uses one and only one CapabilitiesInfo object for - * each capabiltiy described in the resource file. All references to the capability - * refer back to this object. This is fine as long as there is only one print job. - * When we have multiple print jobs, this will not work for two reasons. - * - * 1 - There could be multiple current settings fora particular capability. - * - * 2 - Different jobs could configure linked capabilities for a printer. - */ -class CPrinterCapabilities : public CBase - { - public: - static CPrinterCapabilities* NewL(CCapabilityArray* aSourceArray, TInt aPrinterClass); - ~CPrinterCapabilities(); - TInt Count() const; - void GetIDs(RArray& aCapabilityIDs) const; - TInt GetCapability(TInt aCapabilityID, TPrintCapability& aCapability) const; - TInt SetCurrentValueL(TInt aCapabilityID, TInt aValue); - TBool GetCurrentValue(TInt aCapabilityID, TInt &aCapabilityValue) const; - - private: - CPrinterCapabilities(CCapabilityArray* aSourceArray, TInt aPrinterClass); - void ConstructL(); - void BuildCapabilityArrayL(); - - private: - TInt iPrinterClass; - RPointerArray iPrinterDataArray; - CCapabilityArray* iSourceArray; - }; - -#endif // CPRINTERCAPABILITIES_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprinterelement.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprinterelement.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrinterElement class definition and the Transport enum. -* -*/ - - -#ifndef CPRINTERELEMENT_H -#define CPRINTERELEMENT_H - -#include - -#include "tprinter.h" -#include "cprintercapabilities.h" - -/// Possible transports for a print job. -enum Transport - { - BPPTrans, - DPOFTrans - }; - -class CPrinterElement : public CBase - { - public: - ~CPrinterElement(); - static CPrinterElement* NewLC(); - - private: - CPrinterElement(); - - public: - Transport iTransport; - TPrinter iPrinter; - TInt iTransportData; - TInt iPrinterClass; - CPrinterCapabilities* iPrinterCapabilities; - }; - -#endif // CPRINTERELEMENT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprintjob.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprintjob.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrintJob class definition and the PJS enum. -* -*/ - - -#ifndef CPRINTJOB_H -#define CPRINTJOB_H - -#include - -#include "tsetting.h" - -/// Possible states of a print job. -enum PJS - { - PJSNone, - PJSCreated, - PJSSubmitted - }; - -class CPrintJob : public CBase - { - public: - CPrintJob(); - ~CPrintJob(); - PJS iState; - TInt iPrinterID; - TInt iTransport; - RPointerArray iImages; - RArray iSettings; - }; - -#endif // CPRINTJOB_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/crsdpofengine.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/crsdpofengine.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsDpofEngine & TRsPhoneImage class definitions and -* the MDpofEngineObserver interface definition. -* -*/ - - -#ifndef CRSDPOFENGINE_H -#define CRSDPOFENGINE_H - -#include -#include - -class CFileManager; - -/// Possible DPOF status. -enum TRsDpofPrintStatus - { - ECopyImageFiles, - EDeleteDirectory, - EDPOFGenerate, - EJobCompleted, - EJobCancelled, - EJobError - }; - -class MDpofEngineObserver - { - public: - virtual void HandleDpofEngineEventL(const TInt aStatus, const TInt aRetCode)=0; - }; - -class TRsPhoneImage - { - public: - TInt iIndex; - TBool iCopied; - }; - - -/** - * \brief Brief Description - * - * Detailed Description - */ -class CRsDpofEngine : public CActive - { - public: - - enum TRsDpofImageLayout - { - EOnePerPageSmall = 0, - EOnePerPageMedium, - EOnePerPageLarge, - EOnePerPage4x6, - ETwoPerPage, - EFourPerPage, - ESixPerPage, - ENinePerPage, - ETwelvePerPage, - ESixteenPerPage - }; - - - static CRsDpofEngine* NewL(MDpofEngineObserver& aObs); - ~CRsDpofEngine(); - - void SetImageFileNamesL(const RPointerArray& aImageList); - void SetImageLayout(TRsDpofImageLayout aImageLayout); - TInt PrintL(); - TInt GetPrintPercentage(); - void Stop(); - void StartDiscovery(TRequestStatus& aStatus); - TBool WasCancelled() const; - TBool HasMmc() const; - TBool AutoPrintFileExists(); - void SetMMCPathL(); - - void SetNumsOfCopiesL( const RArray& aNumsOfCopies ); - - protected: /// From CActive - - void DoCancel(); - void RunL(); - - private: - - void ConstructL(); - CRsDpofEngine(MDpofEngineObserver& aObs); - TInt WriteSpecificSizeFileL(); - TInt WriteMultipleFileL(); - TInt PrepareFilenamesL(); - void CreateDpofFileL(); - TInt CleanupTempImages(); - TInt CopyPhoneImagesToMMC(); - TRsPhoneImage* GetNextImageInfoForCopy(); - static TInt CreateDpofFileCbL(TAny *aObj); - void DoCreateDpofFileL(); - - private: - - HBufC* iMmcDrive; - TBool iHasMmc; - RPointerArray iFileNames; - TInt iImageLayout; - HBufC* iAutoPrintFile; - HBufC* iTempFolder; - MDpofEngineObserver& iObs; - TRsDpofPrintStatus iStep; - RFs iFs; - RArray iPhoneImageArray; - TRsPhoneImage* iCurrentPhoneImage; - CFileManager* iFileManager; - TFileName iTempFile; - TBool iShouldCancel; - CPeriodic* iDpofPeriodic; - TInt iPhoneImgsSize; - - RArray iNumsOfCopies; - }; - -#endif // CRSDPOFENGINE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/imgprintkonst.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/imgprintkonst.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the PrintSessionStatus and PrinterClass enumerations, -* as well as some constants. -* -*/ - - -#ifndef IMGPRINTKONST_H -#define IMGPRINTKONST_H - -/// Status available for the PrintSession. -/// @deprecated The PrintSession class was removed completely. If no one else uses this, this will be left out in future versions. -enum PrintSessionStatus - { - EStatusNone = 0, - EPrinterDiscovered, - ERemovePrinter, - EDiscoveryDone, - EPrintJobProgress, - EPrintError, - EPrintJobDone, - EPreviewImage, - EServerError, - ECancelJob, - ECancelDiscovery, - - ELast - - }; - -/// Printer classes' available. -enum PrinterClass - { - EDefault = 0, - EBigAdaptive = 1, - ESmallAdaptive = 2, - EDesk = 3, - ELinked = 99 - }; - -#endif // IMGPRINTKONST_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/mconfirmationnotify.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/mconfirmationnotify.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004-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 MCONFIRMATIONNOTIFY_H -#define MCONFIRMATIONNOTIFY_H - -#include - -class MConfirmationNotify - { - public: - virtual void ConfirmationQueryCompleteL (TInt aError) = 0; - }; - -#endif // MCONFIRMATIONNOTIFY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/rsconstants.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/rsconstants.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2004-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: File contains defines, and literal strings of global scope. -* -*/ - - -#ifndef RSCONSTANTS_H -#define RSCONSTANTS_H - -#include - -const TInt KMaxPrintedPathLength=16; -const TInt KMinWidthOrHeight=200; -const TInt KStickersHelpPage = 1; -const TInt KImagesHelpPage = 2; - - -// log to file of heap useage -//#define _HEAP_LOGGING_ 1 - -// file logging EX-cluding mimeout.txt -//#define _LOGGING_ 1 - -// Out of memory tests when generating XHtml and sending -//#define __OOM_TEST_SENDING__ 1 - -// Allows debugging of the mime package and print job on the emulator with no bluetooth present. -//#define __PRINT_TO_FILE__ 1 - -// mimeout.txt logging -//#define _MIMEOUT_LOGGING_ 1 - -#ifdef __PRINT_TO_FILE__ -#ifndef _MIMEOUT_LOGGING_ -#define _MIMEOUT_LOGGING_ 1 -#endif -#endif // __PRINT_TO_FILE__ - -/// Extension for temporary files. -_LIT(KTmpExtension, ".tmp"); - -#endif // RSCONSTANTS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/rsutils.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/rsutils.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the RsUtils class definitions. -* -*/ - - -#ifndef RSUTILS_H -#define RSUTILS_H - -#include -#include - -/** -* The RsUtils class contains static utility functions useful to the whole application -* such as descriptor manipulations. -*/ -class RsUtils - { - public: - - static TBool FileExists( const TDesC& aFileName, RFs& aFs ); - static TBool PathExists( const TDesC& aFilePath, RFs& aFs ); - static TInt DriveFreeSpace( TChar aDrive, RFs& aFs, TUint32& aSpace ); - static TInt CumulativeFileSize( const TDesC& aFileName, RFs& aFs, TInt& aCumulativeSize ); - static TBool FileInDir( const TDesC& aFileName, const TDesC& aDirName ); - static TBool FileOnDrive( TChar aDrive, const TDesC& aFileName ); - }; - -#endif // RSUTILS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/tmapping.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/tmapping.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the TMapping class definition. -* -*/ - - -#ifndef TMAPPING_H -#define TMAPPING_H - -#include - -class TMapping - { - public: - TMapping(TInt aX, TInt aY) - { - iImagesPerPage = aX; - iCode = aY; - } - TInt iCode; - TInt iImagesPerPage; - }; - -#endif // TMAPPING_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/tsetting.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/tsetting.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the TSetting class definition. -* -*/ - - -#ifndef TSETTING_H -#define TSETTING_H - -#include - -class TSetting - { - public: - TInt iCapabilityID; - TInt iValue; - }; - -#endif // TSETTING_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/ccapabilityarray.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/ccapabilityarray.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CCapabilityArray class definition. -* -*/ - - -#include "ccapabilityarray.h" - -//********************************************************************** -// CCapabilityArray -//********************************************************************** -CCapabilityArray* CCapabilityArray::NewL(TResourceReader& aReader) - { - CCapabilityArray* self=new (ELeave) CCapabilityArray; - CleanupStack::PushL(self); - self->ConstructL(aReader); - CleanupStack::Pop(self); - return self; - } - - -CCapabilityArray::~CCapabilityArray() - { - iDataArray.ResetAndDestroy(); - iDataArray.Close(); - } - -void CCapabilityArray::ConstructL( TResourceReader& aReader ) - { - AddDataL( aReader ); - } - -void CCapabilityArray::AddDataL(TResourceReader& aReader) - { - TInt count = aReader.ReadInt16(); - for( TInt i = 0; i < count; i++ ) - { - CCapabilityInfo* info = CCapabilityInfo::NewLC( aReader ); - iDataArray.AppendL( info ); - CleanupStack::Pop( info ); - } - } - -CCapabilityInfo* CCapabilityArray::operator[]( TInt aIndex ) const - { - return iDataArray[aIndex]; - } - -CCapabilityInfo* CCapabilityArray::LinkedCapability( TInt aLink ) const - { - CCapabilityInfo* capInfo = NULL; - for( TInt i = 0; i < iDataArray.Count() && !capInfo; i++ ) - { - if( iDataArray[i]->LinkID() == aLink ) - { - capInfo = iDataArray[i]; - } - } - - return capInfo; - } - -TInt CCapabilityArray::Count() const - { - return iDataArray.Count(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/ccapabilityinfo.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/ccapabilityinfo.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CCapabilityInfo class definition. -* -*/ - - -#include "ccapabilityinfo.h" - -//********************************************************************** -// CCapabilityInfo -//********************************************************************** -void CCapabilityInfo::ConstructL(TResourceReader& aReader) - { - iPrinterClass = aReader.ReadInt32(); - iCapability.iCapabilityID = aReader.ReadInt32(); - iCapability.iType = (TPrintCapability::ECapType)aReader.ReadInt32(); - iCapability.iDefaultValue = aReader.ReadInt32(); - iCapability.iLow = aReader.ReadInt32(); - iCapability.iHigh = aReader.ReadInt32(); - - TInt count = aReader.ReadInt16()/2; - iCapability.iEnumCount = count; - - for( TInt i = 0; i < count ; i++ ) - { - TInt value = aReader.ReadInt32(); - iCapability.iEnumCodes[i] = value; - value = aReader.ReadInt32(); - iLinks.Append(value); - } - iLinkID = aReader.ReadInt32(); - iCurrentValue = 0; - } - - -CCapabilityInfo* CCapabilityInfo::NewLC(TResourceReader& aReader) - { - CCapabilityInfo* self=new (ELeave) CCapabilityInfo; - CleanupStack::PushL(self); - self->ConstructL(aReader); - return self; - } - -CCapabilityInfo::~CCapabilityInfo() - { - iLinks.Close(); - } - -TInt CCapabilityInfo::SetCurrentValue( TInt aValue ) - // returns the link number from the resource file - { - if( aValue == iCurrentValue ) - return 0; - - iCurrentValue = aValue; - if( iCapability.iType == TPrintCapability::Enum ) // links are only on Enums. - { - for( TInt i = 0 ; i < iCapability.iEnumCount; i++ ) - { - if( iCapability.iEnumCodes[i] == aValue ) - { - return iLinks[i]; - } - } - } - return 0; - } - -TInt CCapabilityInfo::ValueLink( TInt aValue ) - { - if( iCapability.iType == TPrintCapability::Enum ) // links are only on Enums. - { - for( TInt i = 0; i < iCapability.iEnumCount; i++ ) - { - if( iCapability.iEnumCodes[i] == aValue ) - { - return iLinks[i]; - } - } - } - return 0; - } - -CCapabilityInfo* CCapabilityInfo::CopyL() const - { - CCapabilityInfo *workCap = new (ELeave) CCapabilityInfo; - CleanupStack::PushL(workCap); - - workCap->iPrinterClass = iPrinterClass; - workCap->iCapability.iCapabilityID = iCapability.iCapabilityID; - workCap->iCapability.iType = iCapability.iType; - workCap->iCapability.iDefaultValue = iCapability.iDefaultValue; - workCap->iCapability.iLow = iCapability.iLow; - workCap->iCapability.iHigh = iCapability.iHigh; - workCap->iCapability.iEnumCount = iCapability.iEnumCount; - - for( TInt i = 0; i < iCapability.iEnumCount; i++ ) - { - workCap->iCapability.iEnumCodes[i] = iCapability.iEnumCodes[i]; - workCap->iLinks.AppendL( iLinks[i] ); - } - - workCap->iLinkID = iLinkID; - workCap->iCurrentValue = iCurrentValue; - - CleanupStack::Pop(workCap); - return workCap; - } - - -TInt CCapabilityInfo::CurrentValue() const - { - return iCurrentValue; - } - -TInt CCapabilityInfo::LinkID() const - { - return iLinkID; - } - -TInt CCapabilityInfo::PrinterClass() const - { - return iPrinterClass; - } - -TPrintCapability& CCapabilityInfo::Capability() - { - return iCapability; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cconfirmationquery.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cconfirmationquery.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2004-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: - * -*/ - - -#include - -#include "clog.h" -#include "cconfirmationquery.h" - -CConfirmationQuery::CConfirmationQuery( MConfirmationNotify& aNotify ) : CActive( CActive::EPriorityStandard), -iNotify (aNotify) - { - CActiveScheduler::Add( this ); - } - -CConfirmationQuery::~CConfirmationQuery() - { - Cancel(); - } - -// ============================ MEMBER FUNCTIONS ============================== - -// ---------------------------------------------------------------------------- -// CConfirmationQuery::NewL() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CConfirmationQuery* CConfirmationQuery::NewL( MConfirmationNotify& aNotify ) - { - CConfirmationQuery* self = CConfirmationQuery::NewLC( aNotify ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CConfirmationQuery::NewLC() -// Symbian two-phased constructor. -// ---------------------------------------------------------------------------- -// -CConfirmationQuery* CConfirmationQuery::NewLC( MConfirmationNotify& aNotify ) - { - CConfirmationQuery* self; - self = new ( ELeave ) CConfirmationQuery( aNotify ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CConfirmationQuery::ConstructL() -// Perform second phase construction of this object. -// ---------------------------------------------------------------------------- -// -void CConfirmationQuery::ConstructL() - { - - } - -void CConfirmationQuery::StartWaitingAnswer( ) - { - // Start active object and set iStatus = KRequestPending - SetActive(); - } - -void CConfirmationQuery::RunL() - { - LOG1("[CConfirmationQuery::RunL]\t iStatus: %d", iStatus.Int()); - if (iStatus == KErrNone || iStatus == KErrCancel || iStatus == EAknSoftkeyYes || iStatus == EAknSoftkeyNo ) - { - iNotify.ConfirmationQueryCompleteL(iStatus.Int()); - } - LOG("[CConfirmationQueryCConfirmationQuery::RunL]\t out"); - } - -void CConfirmationQuery::RunError() - { - - } - -void CConfirmationQuery::DoCancel() - { - - } - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cdpofprintingdevice.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cdpofprintingdevice.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,969 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CDPOFPrintingDevice class definition. -* -*/ - - -#include -#include -#include -#include - -#include "cdpofprintingdevice.h" -#include "cconfirmationquery.h" -#include "cprintercapabilities.h" -#include "cprinterelement.h" -#include "imgprintkonst.h" -#include "tsetting.h" -#include "rsutils.h" -#include "printcapabilitycodes.h" -#include "printmessagecodes.h" -#include "imageprint.h" -#include "clog.h" -#include "cprintjob.h" - -// CONSTANTS -namespace - { - /// DPOF Version Major. - const TInt KDPOFVersionMajor = 0; - /// DPOF Version Minor. - const TInt KDPOFVersionMinor = 0; - /// DPOF Version Build. - const TInt KDPOFVersionBuild = 1; - - _LIT( KResourceFileName, "imageprintdata\\protocols\\dpof.rsc" ); - - const TInt KMmcPrinterId = 1; - _LIT( KMmcPrinterName, "Memory Card" ); - } - - -MProtPrintingDevice* CDPOFPrintingDevice::NewL() - { - return new (ELeave) CDPOFPrintingDevice(); - } - - -CDPOFPrintingDevice::CDPOFPrintingDevice() : CActive( CActive::EPriorityStandard ), - iPrintError( KErrNone ), - iPrintErrorMsgCode( 0 ) - { - CActiveScheduler::Add(this); - } - -void CDPOFPrintingDevice::ConstructL(const TDesC& /*aDLLPath*/) - { - LOG("CDPOFPrintingDevice::ConstructL begin"); - - iCancelledByUser = EFalse; - - iPrintJob = new (ELeave) CPrintJob(); - - iMappingArray.AppendL(TMapping(1,EPrintCapabLayout1UpMedium)); - iMappingArray.AppendL(TMapping(2,EPrintCapabLayout2Up)); - iMappingArray.AppendL(TMapping(4,EPrintCapabLayout4Up)); - iMappingArray.AppendL(TMapping(6,EPrintCapabLayout6Up)); - iMappingArray.AppendL(TMapping(9,EPrintCapabLayout9Up)); - iMappingArray.AppendL(TMapping(12,EPrintCapabLayout12Up)); - iMappingArray.AppendL(TMapping(16,EPrintCapabLayout16Up)); - - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - // Loading nearest Loc File. - - TFileName resourceFileName; - resourceFileName.Append( KDC_RESOURCE_FILES_DIR ); - resourceFileName.Append( KResourceFileName ); - BaflUtils::NearestLanguageFile( fs, resourceFileName ); - RResourceFile resourceFile; - resourceFile.OpenL( fs, resourceFileName ); - - CleanupClosePushL( resourceFile ); - iCapabilities = LoadCapabilityL( resourceFile, DPOF_CAPABILITIES ); - CleanupStack::PopAndDestroy( 2 ); // resourceFile, fs - - iDPOF = CRsDpofEngine::NewL( *this ); - - SetMMCPrinterL(); - - LOG("CDPOFPrintingDevice::ConstructL end"); - } - -void CDPOFPrintingDevice::SetMMCPrinterL() - { - LOG("CDPOFPrintingDevice::SetMMCPrinterL begin"); - - // New implementation - LOG("CDPOFPrintingDevice::SetMMCPrinterL calling iDPOF->SetMMCPathL ..."); - iDPOF->SetMMCPathL(); - - if( iDPOF->HasMmc() ) - { - CPrinterElement* printElem = CPrinterElement::NewLC(); - printElem->iPrinter.iDisplayName = KMmcPrinterName; - printElem->iPrinter.iPrinterID = KMmcPrinterId; - printElem->iPrinter.iProperties = TPrinter::SupportsPreview; - printElem->iPrinter.iProtocol = KImagePrint_PrinterProtocol_DPOF; - printElem->iTransport = DPOFTrans; - printElem->iPrinterClass = EDefault; - printElem->iPrinterCapabilities = CPrinterCapabilities::NewL( iCapabilities, printElem->iPrinterClass ); - User::LeaveIfError( iDeviceList.Append( printElem ) ); - CleanupStack::Pop( printElem ); - printElem = NULL; - } - - LOG("CDPOFPrintingDevice::SetMMCPrinterL end"); - } - - -CDPOFPrintingDevice::~CDPOFPrintingDevice() - { - LOG("CDPOFPrintingDevice::~CDPOFPrintingDevice begin"); - Cancel(); - delete iDPOF; - delete iCapabilities; - iDeviceList.ResetAndDestroy(); - iDeviceList.Close(); - iMappingArray.Close(); - delete iPrintJob; - iReadyRequests.Close(); - REComSession::DestroyedImplementation( iDtor_ID_Key ); - - if (iConfirmationQuery) - { - delete iConfirmationQuery; - iConfirmationQuery = NULL; - } - - if (iPQ) - { - delete iPQ; - iPQ = NULL; - } - - if (iQuestion) - { - delete iQuestion; - iQuestion = NULL; - } - - LOG("CDPOFPrintingDevice::~CDPOFPrintingDevice end"); - } - - -TVersion CDPOFPrintingDevice::Version() - { - return TVersion(KDPOFVersionMajor, KDPOFVersionMinor, KDPOFVersionBuild); - } - -TUint CDPOFPrintingDevice::SupportedProtocols() - { - return KImagePrint_PrinterProtocol_DPOF; - } - - -void CDPOFPrintingDevice::StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocol) - { - LOG1("CDPOFPrintingDevice::StartDiscoveryL aProtocol: %d", aProtocol); - iDiscoveryObserver = &aObserver; - Cancel(); - if( aProtocol & KImagePrint_PrinterProtocol_DPOF ) - { - LOG("CDPOFPrintingDevice::StartDiscoveryL protocol match, starting discovery..."); - iDPOF->StartDiscovery( iStatus ); - if( !IsActive() ) SetActive(); - } - else - { - LOG("CDPOFPrintingDevice::StartDiscoveryL NO protocol match, ending discovery..."); - AddReadyRequestAndSetActive( EDiscoveryDone ); - } - LOG("CDPOFPrintingDevice::StartDiscoveryL end"); - } - - -TInt CDPOFPrintingDevice::RemoveCachedDeviceL( TInt aDeviceID ) - { - LOG1("CDPOFPrintingDevice::RemoveCachedDeviceL aDeviceID: %d", aDeviceID); - CPrinterElement* targetPrinter = FindDeviceL( aDeviceID ); - LOG1("CDPOFPrintingDevice::RemoveCachedDeviceL targetPrinter address: %d", (TInt)targetPrinter); - return ( targetPrinter ) ? KErrNone : KErrInvalidData; - } - -void CDPOFPrintingDevice::CancelDiscovery( TBool aDoCallBack ) - { - LOG1("CDPOFPrintingDevice::CancelDiscovery aDoCallBack: %d", aDoCallBack); - if( aDoCallBack ) - { - AddReadyRequestAndSetActive( ECancelDiscovery ); - } - LOG("CDPOFPrintingDevice::CancelDiscovery end"); - } - - -TInt CDPOFPrintingDevice::CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver) - { - LOG1("CDPOFPrintingDevice::CreatePrintJobL aDeviceID: %d", aDeviceID); - LOG1("CDPOFPrintingDevice::CreatePrintJobL aImages.Count(): %d", aImages.Count()); - - iPrintEventObserver = &aObserver; - iPrintJob->iState = PJSNone; // Reset value until Job is fully setup in case of a leave. - CPrinterElement *TargetPrinter = FindDeviceL( aDeviceID ); - if( TargetPrinter == NULL ) - { - LOG("CDPOFPrintingDevice::CreatePrintJobL no device found, returning error"); - return KErrInvalidData; - } - - iPrintJob->iTransport = DPOFTrans; - iPrintJob->iPrinterID = aDeviceID; - TInt NumImages = aImages.Count(); - iPrintJob->iImages.ResetAndDestroy(); - for (TInt i = 0 ; i < NumImages; i++) - { - HBufC* Image = aImages[i]->AllocLC(); - User::LeaveIfError( iPrintJob->iImages.Append( Image ) ); - CleanupStack::Pop(Image); - } - LOG("CDPOFPrintingDevice::CreatePrintJobL image names copied"); - - // Now we can access the capabilities and fill in the printer settings. - RArray CapabilityIDs; - CleanupClosePushL( CapabilityIDs ); - GetDeviceCapabilityIDsL( aDeviceID, CapabilityIDs ); - LOG1("CDPOFPrintingDevice::CreatePrintJobL capability ids count: %d", CapabilityIDs.Count()); - - iPrintJob->iSettings.Reset(); - for (TInt i = 0; i < CapabilityIDs.Count(); i++) - { - TPrintCapability capability; - GetDeviceCapabilityL(aDeviceID, CapabilityIDs[i], capability); - TInt nCurrentValue; - TBool bHasValue = TargetPrinter->iPrinterCapabilities->GetCurrentValue(CapabilityIDs[i], nCurrentValue); - TSetting Setting; - Setting.iCapabilityID = capability.iCapabilityID; - if (bHasValue) - Setting.iValue = nCurrentValue; - else - Setting.iValue = capability.iDefaultValue; - - User::LeaveIfError(iPrintJob->iSettings.Append(Setting)); - } - LOG("CDPOFPrintingDevice::CreatePrintJobL capabilities copied"); - - CleanupStack::PopAndDestroy(); // CapabilityIDs - - iPrintJob->iState = PJSCreated; - LOG("CDPOFPrintingDevice::CreatePrintJobL end"); - return KErrNone; - } - - -void CDPOFPrintingDevice::SubmitPrintJobL() - { - LOG("CDPOFPrintingDevice::SubmitPrintJobL begin"); - - if( iDPOF->AutoPrintFileExists() ) - { - ShowConfirmationQueryL(); - } - else - { - OverwriteExistingJobL (); - } - - LOG("CDPOFPrintingDevice::SubmitPrintJobL end"); - } - -void CDPOFPrintingDevice::ShowConfirmationQueryL() - { - LOG("CDPOFPrintingDevice::ShowConfirmationQueryL begin"); - - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - TFileName resourceFileName; - resourceFileName.Append ( KDC_RESOURCE_FILES_DIR ); - resourceFileName.Append ( KResourceFileName ); - BaflUtils::NearestLanguageFile( fs, resourceFileName ); - RResourceFile resFile; - resFile.OpenL( fs, resourceFileName ); - CleanupClosePushL( resFile ); - HBufC8 *resBuffer = resFile.AllocReadLC( R_QTN_PRINT_DPOF_CONFIRMATION_DIALOG ); - TResourceReader reader; - reader.SetBuffer( resBuffer ); - TPtrC ptrQuestion = reader.ReadTPtrC(); - iQuestion = ptrQuestion.AllocL(); - CleanupStack::PopAndDestroy( 3 ); // resBuffer, resFile, fs - - iPQ = CAknGlobalConfirmationQuery::NewL(); - - iConfirmationQuery = CConfirmationQuery::NewL( *this ); - - iConfirmationQuery->StartWaitingAnswer( ); - - iPQ->ShowConfirmationQueryL( iConfirmationQuery->iStatus, *iQuestion, R_AVKON_SOFTKEYS_YES_NO ); - - LOG("CDPOFPrintingDevice::ShowConfirmationQueryL end"); - } - - -TInt CDPOFPrintingDevice::CancelPrintJob() - { - LOG1("CDPOFPrintingDevice::CancelPrintJob begin with job state: %d", iPrintJob->iState); - TInt retVal(KErrNone); - - if( iPrintJob->iState == PJSSubmitted ) - { - LOG("CDPOFPrintingDevice::CancelPrintJob calling iDPOF->Stop()"); - iDPOF->Stop(); - iPrintJob->iState = PJSCreated; - AddReadyRequestAndSetActive( EPrintJobDone ); - } - else - { - retVal = KErrInvalidSequence; - } - - LOG1("CDPOFPrintingDevice::CancelPrintJob end with code: %d", retVal); - return retVal; - } - -TInt CDPOFPrintingDevice::ContinuePrintJobL() - { - LOG1("CDPOFPrintingDevice::ContinuePrintJobL returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CDPOFPrintingDevice::GetNumPrintPages() - { - LOG1("CDPOFPrintingDevice::GetNumPrintPages begin with job state: %d", iPrintJob->iState); - if( iPrintJob->iState == PJSNone ) - { - LOG("CDPOFPrintingDevice::GetNumPrintPages job state == PJSNone, ending with 0"); - return 0; - } - - - TInt ImagesPerPage = 1; - TInt NumPrintPages; - TInt NumImages = iPrintJob->iImages.Count(); - - // Get Num images per page from the mapping table. - TSetting Setting; - FindSetting(EPrintCapabLayout, Setting); - - for (TInt j = 0; j < iMappingArray.Count(); j++) - { - if (iMappingArray[j].iCode == Setting.iValue) - { - ImagesPerPage = iMappingArray[j].iImagesPerPage; - break; - } - } - - if( ImagesPerPage == 0 ) // Stickers, Uses only one image, and populates a single page - NumPrintPages = 1; - else - NumPrintPages = (NumImages + ImagesPerPage - 1) / ImagesPerPage; - - LOG1("CDPOFPrintingDevice::GetNumPrintPages returns: %d", NumPrintPages); - return NumPrintPages; - } - -TInt CDPOFPrintingDevice::GetPrintJobStatus() - { - LOG1("CDPOFPrintingDevice::GetPrintJobStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CDPOFPrintingDevice::GetPrinterStatus(TInt /*aDeviceID*/) - { - LOG1("CDPOFPrintingDevice::GetPrinterStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CDPOFPrintingDevice::GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs) - { - LOG1("CDPOFPrintingDevice::GetDeviceCapabilityIDsL begins with aDeviceID: %d", aDeviceID); - TInt err(KErrNone); - aCapabilityIDs.Reset(); - CPrinterElement* TargetPrinter = FindDeviceL(aDeviceID); - if( TargetPrinter ) - { - TargetPrinter->iPrinterCapabilities->GetIDs(aCapabilityIDs); - } - else - { - err = KErrInvalidData; - } - LOG1("CDPOFPrintingDevice::GetDeviceCapabilityIDsL ends with err: %d", err); - return err; - } - -TInt CDPOFPrintingDevice::GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability) - { - LOG1("CDPOFPrintingDevice::GetDeviceCapabilityL begins with aDeviceID: %d", aDeviceID); - LOG1("CDPOFPrintingDevice::GetDeviceCapabilityL begins with aCapabilityID: %d", aCapabilityID); - TInt err(KErrNone); - CPrinterElement* TargetPrinter = FindDeviceL(aDeviceID); - if( TargetPrinter ) - { - TargetPrinter->iPrinterCapabilities->GetCapability(aCapabilityID, aCapability); - } - else - { - err = KErrInvalidData; - } - LOG1("CDPOFPrintingDevice::GetDeviceCapabilityL ends with err: %d", err); - return err; - } - -TInt CDPOFPrintingDevice::GetJobSetting(TInt aCapabilityID, TInt& aValue) - { - LOG1("CDPOFPrintingDevice::GetJobSetting begins with aCapabilityID: %d", aCapabilityID); - TInt err(KErrNone); - if( iPrintJob->iState == PJSNone ) - { - err = KErrInvalidSequence; - } - else - { - TSetting Setting; - if( FindSetting(aCapabilityID, Setting) ) - { - aValue = Setting.iValue; - } - else - { - err = KErrInvalidData; - } - } - LOG1("CDPOFPrintingDevice::GetJobSetting ends with err: %d", err); - return err; - } - -TInt CDPOFPrintingDevice::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - LOG1("CDPOFPrintingDevice::SetJobSettingL begins with aCapabilityID: %d", aCapabilityID); - LOG1("CDPOFPrintingDevice::SetJobSettingL begins with aValue: %d", aValue); - LOG1("CDPOFPrintingDevice::SetJobSettingL begins with aAffectedCapability: %d", aAffectedCapability); - - if( iPrintJob->iState == PJSNone ) - { - LOG("CDPOFPrintingDevice::SetJobSettingL job state == PJSNone"); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with: %d", KErrInvalidSequence); - return KErrInvalidSequence; - } - - aAffectedCapability = 0; - TSetting Setting; - if( FindSetting(aCapabilityID, Setting) == EFalse ) - { - LOG("CDPOFPrintingDevice::SetJobSettingL FindSetting == EFalse"); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with: %d", KErrInvalidData); - return KErrInvalidData; - } - - // Get the Target printer and capability - TPrintCapability TargetCapability; - CPrinterElement* TargetPrinter = FindDeviceL( iPrintJob->iPrinterID ); - if( TargetPrinter == NULL ) - { - LOG("CDPOFPrintingDevice::SetJobSettingL TargetPrinter == NULL"); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with: %d", KErrInvalidData); - return KErrInvalidData; - } - - TargetPrinter->iPrinterCapabilities->GetCapability(aCapabilityID, TargetCapability); - - // Check Validity against the target capability ranges - if ((TargetCapability.iType == TPrintCapability::Int) || - (TargetCapability.iType == TPrintCapability::Float)) - { - if (((aValue < TargetCapability.iLow) && (TargetCapability.iLow != -1)) || - ((aValue > TargetCapability.iHigh) && (TargetCapability.iHigh != -1))) - { - LOG("CDPOFPrintingDevice::SetJobSettingL capability ranges error"); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with: %d", KErrInvalidData); - return KErrInvalidData; - } - - } - else // enum - { - TBool Valid = EFalse; - for (TInt i = 0; i < TargetCapability.iEnumCount; i++) - { - if (aValue == TargetCapability.iEnumCodes[i]) - { - Valid = ETrue; - break; - } - } - if (!Valid) - { - LOG("CDPOFPrintingDevice::SetJobSettingL !Valid"); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with: %d", KErrInvalidData); - return KErrInvalidData; - } - } - - for (TInt i = 0; i < iPrintJob->iSettings.Count(); i++) - { - if (aCapabilityID == iPrintJob->iSettings[i].iCapabilityID) - { - iPrintJob->iSettings[i].iValue = aValue; - break; - } - } - - aAffectedCapability = TargetPrinter->iPrinterCapabilities->SetCurrentValueL(aCapabilityID, aValue); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with aAffectedCapability: %d", aAffectedCapability); - LOG1("CDPOFPrintingDevice::SetJobSettingL ends with code: %d", KErrNone); - return KErrNone; - } - - -TInt CDPOFPrintingDevice::GetNumPreviewPages() - { - LOG1("CDPOFPrintingDevice::GetNumPreviewPages ends with: %d", 1); - return 1; - } - -TInt CDPOFPrintingDevice::GetJobTemplateIconL( TInt /*aTemplateID*/, TInt& /*aFsBitmapHandle*/ ) - { - return KErrNone; - } - - -TInt CDPOFPrintingDevice::CreatePreviewImage(TInt /*aPageNumber*/) - { - return KErrNone; - } - - -void CDPOFPrintingDevice::HandleDpofEngineEventL(const TInt aStatus, const TInt aRetCode) - { - LOG1("CDPOFPrintingDevice::HandleDpofEngineEventL begins with aStatus: %d", aStatus); - LOG1("CDPOFPrintingDevice::HandleDpofEngineEventL begins with aRetCode: %d", aRetCode); - - iPrintError = aRetCode; - iPrintErrorMsgCode = 0; - - if( (aRetCode != KErrNone) && !(aRetCode==KErrCancel && aStatus==EJobCancelled) ) - { - AddReadyRequestAndSetActive( EPrintError ); - } - else - { - switch(aStatus) - { - case EDeleteDirectory: - case ECopyImageFiles: - case EDPOFGenerate: - AddReadyRequestAndSetActive( EPrintJobProgress ); - break; - case EJobError: - AddReadyRequestAndSetActive( EPrintError ); - break; - case EJobCompleted: - case EJobCancelled: - AddReadyRequestAndSetActive( EPrintJobDone ); - break; - default: - break; - } - } - LOG("CDPOFPrintingDevice::HandleDpofEngineEventL end"); - } - -void CDPOFPrintingDevice::DoCancel() - { - } - -void CDPOFPrintingDevice::RunL() - { - LOG1("CDPOFPrintingDevice::RunL begins with iStatus.Int: %d", iStatus.Int()); - PrintSessionStatus PEStatus = (PrintSessionStatus)iStatus.Int(); - - switch ( PEStatus ) - { - case KErrNone: - break; - case EPrinterDiscovered: - { - TPrinter foundPrinter; - foundPrinter.iDisplayName = KMmcPrinterName; - foundPrinter.iPrinterID = KMmcPrinterId; - foundPrinter.iProperties = TPrinter::SupportsPreview; - foundPrinter.iProtocol = KImagePrint_PrinterProtocol_DPOF; - foundPrinter.iVendor = TPrinter::EVendorNone; - - LOG("CDPOFPrintingDevice::RunL printer discovered, informing observer"); - if( iDiscoveryObserver ) - { - iDiscoveryObserver->FoundDeviceL( foundPrinter ); - } - AddReadyRequestAndSetActive( EDiscoveryDone ); - break; - } - case EDiscoveryDone: - { - LOG("CDPOFPrintingDevice::RunL discovery done, informing observer"); - if( iDiscoveryObserver ) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNone, 0); - } - break; - } - case ECancelDiscovery: - { - LOG("CDPOFPrintingDevice::RunL discovery cancelled, informing observer"); - if( iDiscoveryObserver ) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrCancel, 0); - } - break; - } - case EPrintError: - { - LOG("CDPOFPrintingDevice::RunL print error, informing observer"); - LOG1("CDPOFPrintingDevice::RunL print error iPrintError: %d", iPrintError); - LOG1("CDPOFPrintingDevice::RunL print error iPrintErrorMsgCode: %d", iPrintErrorMsgCode); - if( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobErrorEvent( iPrintError, iPrintErrorMsgCode ); - } - iPrintJob->iState = PJSCreated; - break; - } - case EPrintJobProgress: - { - LOG("CDPOFPrintingDevice::RunL job progress, informing observer"); - if( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobProgressEvent(EActive, iDPOF->GetPrintPercentage(), ECopying); - } - break; - } - case EPrintJobDone: - { - iPrintJob->iState = PJSCreated; // go back to created so it can be re-submitted - if( iPrintEventObserver ) - { - LOG1("CDPOFPrintingDevice::RunL job done percentage: %d", iDPOF->GetPrintPercentage()); - - if (iDPOF->WasCancelled() ) - { - LOG("CDPOFPrintingDevice::RunL job cancelled"); - iPrintEventObserver->PrintJobProgressEvent(EDone, iDPOF->GetPrintPercentage(), ECancelling); - } - else - { - LOG("CDPOFPrintingDevice::RunL job done"); - iPrintEventObserver->PrintJobProgressEvent(EDone, 100, ENoMessage); - } - } - break; - } - - default: - { - LOG("CDPOFPrintingDevice::RunL default, informing observer"); - if( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobErrorEvent(KErrGeneral, 0); - } - iPrintJob->iState = PJSCreated; - break; - } - } - - CheckReadyRequestAndSetActive(); - LOG("CDPOFPrintingDevice::RunL end"); - } - - -CCapabilityArray* CDPOFPrintingDevice::LoadCapabilityL(RResourceFile& aResFile, TInt aCapID) - { - LOG1("CDPOFPrintingDevice::LoadCapabilityL begins with capID: %d", aCapID); - HBufC8* res = aResFile.AllocReadLC(aCapID); - TResourceReader theReader; - theReader.SetBuffer( res ); - CCapabilityArray *capabilities = CCapabilityArray::NewL( theReader ); - CleanupStack::PopAndDestroy(); // res - LOG("CDPOFPrintingDevice::LoadCapabilityL end"); - return capabilities; - } - - -CPrinterElement* CDPOFPrintingDevice::FindDeviceL(TInt aDeviceID) - { - LOG1("CDPOFPrintingDevice::FindDeviceL begins with aDeviceID: %d", aDeviceID); - // Add this here to fix problem - // if application is started without MMC and then user insert MMC in the phone ->cannot find MMC - if( iDeviceList.Count() == 0 ) - { - SetMMCPrinterL(); - } - for( TInt i = 0; i < iDeviceList.Count(); i++ ) - { - if(iDeviceList[i]->iPrinter.iPrinterID == aDeviceID ) - { - LOG("CDPOFPrintingDevice::FindDeviceL device found"); - return iDeviceList[i]; - } - } - LOG("CDPOFPrintingDevice::FindDeviceL device NOT found"); - return NULL; - } - -TBool CDPOFPrintingDevice::FindSetting(TInt aCapabilityID, TSetting& aSetting) - { - LOG1("CDPOFPrintingDevice::FindSetting begins with aCapabilityID: %d", aCapabilityID); - for(TInt i = 0; i < iPrintJob->iSettings.Count(); i++) - { - if (aCapabilityID == iPrintJob->iSettings[i].iCapabilityID) - { - aSetting = iPrintJob->iSettings[i]; - LOG("CDPOFPrintingDevice::FindSetting setting found"); - return ETrue; - } - } - LOG("CDPOFPrintingDevice::FindSetting setting NOT found"); - return EFalse; - } -/* -TInt CDPOFPrintingDevice::AddReadyRequestAndSetActive( TInt aRequest ) - { - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive aRequest: %d", aRequest); - TInt err = iReadyRequests.Append( aRequest ); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive err: %d", err); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive iReadyRequests.Count(): %d", iReadyRequests.Count()); - if( !err ) - { - TInt request = iReadyRequests[0]; - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive request: %d", request); - iReadyRequests.Remove( 0 ); - iStatus = KRequestPending; - TRequestStatus* TempTRS = &iStatus; - if( !IsActive() ) SetActive(); - User::RequestComplete( TempTRS, request ); - } - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive return: %d", err); - return err; - } - -TInt CDPOFPrintingDevice::CheckReadyRequestAndSetActive() - { - LOG("CDPOFPrintingDevice::CheckReadyRequestAndSetActive begin"); - TInt count = iReadyRequests.Count(); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive count: %d", count); - TInt err( KErrNotFound ); - if( count ) - { - TInt request = iReadyRequests[0]; - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive request: %d", request); - iReadyRequests.Remove( 0 ); - iStatus = KRequestPending; - TRequestStatus* TempTRS = &iStatus; - if( !IsActive() ) SetActive(); - User::RequestComplete( TempTRS, request ); - err = KErrNone; - } - LOG1("CDPOFPrintingDevice::CheckReadyRequestAndSetActive return: %d", err); - return err; - } -*/ - -TInt CDPOFPrintingDevice::AddReadyRequestAndSetActive( TInt aRequest ) - { - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive aRequest: %d", aRequest); - TInt err = iReadyRequests.Append( aRequest ); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive err: %d", err); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive iReadyRequests.Count(): %d", iReadyRequests.Count()); - if( !err ) - { - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive IsActive(): %d", IsActive()); - if( !IsActive() ) - { - TInt request = iReadyRequests[0]; - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive request: %d", request); - iReadyRequests.Remove( 0 ); - iStatus = KRequestPending; - TRequestStatus* TempTRS = &iStatus; - SetActive(); - User::RequestComplete( TempTRS, request ); - } - } - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive return: %d", err); - return err; - } - -TInt CDPOFPrintingDevice::CheckReadyRequestAndSetActive() - { - LOG("CDPOFPrintingDevice::CheckReadyRequestAndSetActive begin"); - TInt count = iReadyRequests.Count(); - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive count: %d", count); - TInt err( KErrNotFound ); - if( count ) - { - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive IsActive(): %d", IsActive()); - if( !IsActive() ) - { - TInt request = iReadyRequests[0]; - LOG1("CDPOFPrintingDevice::AddRequestAndSetActive request: %d", request); - iReadyRequests.Remove( 0 ); - iStatus = KRequestPending; - TRequestStatus* TempTRS = &iStatus; - SetActive(); - User::RequestComplete( TempTRS, request ); - err = KErrNone; - } - } - LOG1("CDPOFPrintingDevice::CheckReadyRequestAndSetActive return: %d", err); - return err; - } - -void CDPOFPrintingDevice::ConfirmationQueryCompleteL ( TInt aError ) - { - TBool answer = ( aError == EAknSoftkeyYes ); - if( answer ) - { - iCancelledByUser = EFalse; // user want to write file - OverwriteExistingJobL (); - } - else - { - iCancelledByUser = ETrue; - } - - if( iDPOF->AutoPrintFileExists() ) - { - if( iCancelledByUser ) - { - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ECancellingNoMessage ); - LOG("CDPOFPrintingDevice::SubmitPrintJobL end"); - return; - } - } - } - -void CDPOFPrintingDevice::OverwriteExistingJobL () - { - iPrintError = KErrNone; - iPrintErrorMsgCode = 0; - - CRsDpofEngine::TRsDpofImageLayout layout; - iDPOF->SetImageFileNamesL(iPrintJob->iImages); - TSetting layoutSetting; - FindSetting(EPrintCapabLayout, layoutSetting); - LOG1("CDPOFPrintingDevice::OverwriteExistingJobL layoutSetting.iValue: %d", layoutSetting.iValue); - switch(layoutSetting.iValue) - { - case EPrintCapabLayout1UpSmall: - layout = CRsDpofEngine::EOnePerPageSmall; - break; - case EPrintCapabLayout1UpMedium: - case EPrintCapabLayout1UpLarge: - layout = CRsDpofEngine::EOnePerPageLarge; - break; - case EPrintCapabLayout2Up: - layout = CRsDpofEngine::ETwoPerPage; - break; - case EPrintCapabLayout4Up: - layout = CRsDpofEngine::EFourPerPage; - break; - case EPrintCapabLayout6Up: - layout = CRsDpofEngine::ESixPerPage; - break; - case EPrintCapabLayout9Up: - layout = CRsDpofEngine::ENinePerPage; - break; - case EPrintCapabLayout12Up: - layout = CRsDpofEngine::ETwelvePerPage; - break; - case EPrintCapabLayout16Up: - layout = CRsDpofEngine::ESixteenPerPage; - break; - default: - layout = CRsDpofEngine::EOnePerPageMedium; - break; - } - - iDPOF->SetImageLayout(layout); - LOG1("CDPOFPrintingDevice::OverwriteExistingJobL 1 iStatus.Int(): %d", iStatus.Int()); - TInt err = iDPOF->PrintL(); - LOG1("CDPOFPrintingDevice::OverwriteExistingJobL iDPOF->PrintL() error: %d", err); - LOG1("CDPOFPrintingDevice::OverwriteExistingJobL 2 iStatus.Int(): %d", iStatus.Int()); - - if( err ) - { - iPrintError = err; - iPrintErrorMsgCode = ENoMessage; - AddReadyRequestAndSetActive( EPrintError ); - } - else - { - LOG("CDPOFPrintingDevice::OverwriteExistingJobL job submitted"); - iPrintJob->iState = PJSSubmitted; - if(!IsActive()) SetActive(); - } - } - - -void CDPOFPrintingDevice::SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ) - { - LOG("CDPOFPrintingDevice::SetNumsOfCopiesL begin"); - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL iPrintJob->iState: %d", iPrintJob->iState); - TInt err( KErrNone ); - if( iPrintJob->iState != PJSCreated ) - { - err = KErrInvalidSequence; - } - if( !err ) - { - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL iPrintJob->iImages.Count(): %d", iPrintJob->iImages.Count()); - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL aNumsOfCopies.Count(): %d", aNumsOfCopies.Count()); - if( iPrintJob->iImages.Count() != aNumsOfCopies.Count() ) - { - err = KErrInvalidData; - } - } - if( !err ) - { - TInt count = aNumsOfCopies.Count(); - for( TInt i = 0; i < count && !err; i++ ) - { - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL i: %d", i); - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL aNumsOfCopies[i]: %d", aNumsOfCopies[i]); - if( aNumsOfCopies[i] <= 0 ) - { - err = KErrInvalidData; - } - } - } - if( !err ) - { - iDPOF->SetNumsOfCopiesL( aNumsOfCopies ); - } - aErr = err; - LOG1("CDPOFPrintingDevice::SetNumsOfCopiesL aErr: %d", aErr); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cfilemanager.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cfilemanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* -* Copyright (c) 2004-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 "cfilemanager.h" -#include "rsutils.h" -#include "clog.h" - -// CONSTANTS -namespace - { - const TInt KBufferSize = 1000; - } - -#define USE_CFILEMAN_FIRST - -CFileManager* CFileManager::NewL( RFs& aFs ) - { - CFileManager* self = new ( ELeave ) CFileManager( aFs ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CFileManager::CFileManager( RFs& aFs ) : CActive( CActive::EPriorityHigh ), - iFs( aFs ), - iBuffer( NULL ) - - { - CActiveScheduler::Add( this ); - } - -CFileManager::~CFileManager() - { - Cancel(); - CloseCopy(); - if(iBuffer) - { - delete iBuffer; - iBuffer = NULL; - } - delete iFileMan; - } - -void CFileManager::ConstructL() - { - iFileMan = CFileMan::NewL( iFs ); - } - - -TInt CFileManager::Copy( const TDesC& aFile, const TDesC& aDir, TRequestStatus& aStatus ) - { - LOG( "CFileManager::Copy begin" ); - Cancel(); - CloseCopy(); - iCallerStatus = &aStatus; - TInt err( KErrNone ); -#ifdef USE_CFILEMAN_FIRST - // check if file is used by another application - err = iSource.Open( iFs, aFile, EFileRead | EFileShareReadersOnly ); - LOG1("CFileManager::Copy check err: %d", err); - iSource.Close(); - if( !err ) - { - err = iFileMan->Copy( aFile, aDir, CFileMan::EOverWrite, iStatus ); - LOG1("CFileManager::Copy iFileMan->Copy err: %d", err); - if( !err ) - { - iOperation = EFileManCopy; - SetActive(); - } - } - else -#endif - { - iOperation = EBufferCopy; - TRAP( err, InitCopyL( aFile, aDir ) ); - LOG1( "CFileManager::Copy InitCopyL err: %d", err ); - if( err ) - { - CloseCopy(); - } - else - { - TPtr8 ptr = iBuffer->Des(); - LOG1( "CFileManager::Copy iBytesNum: %d", iBytesNum ); - iSource.Read( ptr, iBytesNum, iStatus ); - LOG( "CFileManager::Copy call to SetActive()" ); - SetActive(); - } - } - LOG1( "CFileManager::Copy end with: %d", err ); - return err; - } - - -void CFileManager::DoCancel() - { - LOG( "CFileManager::DoCancel begin" ); - CloseCopy(); - LOG( "CFileManager::DoCancel end" ); - } - -void CFileManager::RunL() - { - LOG1( "CFileManager::RunL iStatus: %d", iStatus.Int() ); - LOG1( "CFileManager::RunL iOperation: %d", iOperation ); - - if( iStatus == KErrNone ) - { - switch( iOperation ) - { - case ERemoveDir: - { - LOG( "CFileManager::RunL directory removed" ); - User::RequestComplete( iCallerStatus, iStatus.Int() ); - } - break; - case EFileManCopy: - { - LOG( "CFileManager::RunL file copied" ); - User::RequestComplete( iCallerStatus, iStatus.Int() ); - } - break; - case EBufferCopy: - { - TPtr8 ptr = iBuffer->Des(); - LOG( "CFileManager::RunL call to RFile::Write()" ); - User::LeaveIfError( iDest.Write( ptr, iBytesNum ) ); - iBytesLeft -= iBytesNum; - if( iBytesLeft ) - { - iBytesNum = ( KBufferSize < iBytesLeft ) ? KBufferSize : iBytesLeft; - LOG1( "CFileManager::RunL iBytesLeft: %d", iBytesLeft ); - iSource.Read( ptr, iBytesNum, iStatus ); - SetActive(); - } - else - { - User::LeaveIfError( iDest.Flush() ); - CloseCopy(); - LOG( "CFileManager::RunL file copied" ); - User::RequestComplete( iCallerStatus, iStatus.Int() ); - } - } - break; - default: - break; - } - } - else - { - CloseCopy(); - User::RequestComplete( iCallerStatus, iStatus.Int() ); - } - } - -TInt CFileManager::RunError( TInt aError ) - { - LOG1( "CFileManager::RunError aError: %d", aError ); - return KErrNone; - } - -void CFileManager::CloseCopy() - { - LOG( "CFileManager::CloseCopy begin" ); - iSource.Close(); - iDest.Close(); - delete iBuffer; - iBuffer = NULL; - iBytesLeft = 0; - iBytesNum = 0; - LOG( "CFileManager::CloseCopy end" ); - } - -void CFileManager::InitCopyL( const TDesC& aFile, const TDesC& aDir ) - { - LOG( "CFileManager::InitCopyL begin" ); - TInt err = iSource.Open( iFs, aFile, EFileRead | EFileShareReadersOnly ); - LOG1("CFileManager::InitCopyL file.Open (shareread mode): %d", err); - if ( err != KErrNone ) - { - err = iSource.Open( iFs, aFile, EFileRead | EFileShareAny ); - LOG1("CFileManager::InitCopyL file.Open (shareany mode): %d", err); - } - User::LeaveIfError( err ); - - TParsePtrC parse( aFile ); - TFileName writeFileName( aDir ); - writeFileName.Append( parse.NameAndExt() ); - User::LeaveIfError( iDest.Replace( iFs, writeFileName, EFileWrite ) ); - iBuffer = HBufC8::NewL( KBufferSize ); - User::LeaveIfError( iSource.Size( iBytesLeft ) ); - LOG1( "CFileManager::InitCopyL file size: %d", iBytesLeft ); - iBytesNum = ( KBufferSize < iBytesLeft ) ? KBufferSize : iBytesLeft; - LOG( "CFileManager::InitCopyL end" ); - } - -void CFileManager::CancelCopy() - { - LOG("CFileManager::CancelCopy begin"); - if( IsActive() ) - { - Cancel(); - User::RequestComplete( iCallerStatus, KErrCancel ); - } - LOG("CFileManager::CancelCopy end"); - } - -void CFileManager::CancelRmDir() - { - LOG("CFileManager::CancelRmDir begin"); - if( IsActive() ) - { - Cancel(); - User::RequestComplete( iCallerStatus, KErrCancel ); - } - LOG("CFileManager::CancelRmDir end"); - } - -TInt CFileManager::RmDir( const TDesC& aDir, TRequestStatus& aStatus ) - { - LOG1("CFileManager::RmDir aDir: %S", &aDir); - TInt err( KErrNone ); - Cancel(); - iCallerStatus = &aStatus; - if( RsUtils::PathExists( aDir, iFs ) ) - { - err = iFileMan->RmDir( aDir, iStatus ); - iOperation = ERemoveDir; - if( !err ) SetActive(); - } - else - { - User::RequestComplete( iCallerStatus, KErrNone ); - } - LOG1("CFileManager::RmDir return: %d", err); - return err; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprintercapabilities.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprintercapabilities.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrinterCapabilities class definition. -* -*/ - - -#include "cprintercapabilities.h" -#include "imageprint.h" - -//********************************************************************** -// CPrinterCapabilities -//********************************************************************** - -CPrinterCapabilities::CPrinterCapabilities(CCapabilityArray* aSourceArray, TInt aPrinterClass) - { - iSourceArray = aSourceArray; - iPrinterClass = aPrinterClass; - } - -CPrinterCapabilities::~CPrinterCapabilities() - { - iPrinterDataArray.ResetAndDestroy(); - iPrinterDataArray.Close(); - } - -CPrinterCapabilities* CPrinterCapabilities::NewL(CCapabilityArray* aSourceArray, TInt aPrinterClass) - { - CPrinterCapabilities* self=new (ELeave) CPrinterCapabilities(aSourceArray,aPrinterClass); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -void CPrinterCapabilities::ConstructL() - { - BuildCapabilityArrayL(); - } - -void CPrinterCapabilities::BuildCapabilityArrayL() - { - CCapabilityInfo* capInfo; - CCapabilityInfo* workCap; - TInt count = iSourceArray->Count(); - - for( TInt i = 0; i < count; i++ ) - { - capInfo = (*iSourceArray)[i]; - if( capInfo->PrinterClass() == iPrinterClass ) - { - workCap = capInfo->CopyL(); - CleanupStack::PushL( workCap ); - iPrinterDataArray.AppendL( workCap ); - CleanupStack::Pop(); // workCap - TInt link = workCap->SetCurrentValue( workCap->Capability().iDefaultValue ); - if( link ) - { - workCap = iSourceArray->LinkedCapability( link )->CopyL(); - CleanupStack::PushL( workCap ); - iPrinterDataArray.AppendL( workCap ); - CleanupStack::Pop(); // workCap - } - } - } - } - -void CPrinterCapabilities::GetIDs( RArray& aCapabilityIDs ) const - { - for( TInt nCnt = 0; nCnt < iPrinterDataArray.Count(); nCnt++ ) - { - aCapabilityIDs.Append( iPrinterDataArray[nCnt]->Capability().iCapabilityID ); - } - } - -TInt CPrinterCapabilities::GetCapability( TInt aCapabilityID, TPrintCapability& aCapability ) const - { - TInt err( KErrInvalidData ); - for( TInt nCnt = 0; nCnt < iPrinterDataArray.Count() && err; nCnt++ ) - { - if( iPrinterDataArray[nCnt]->Capability().iCapabilityID == aCapabilityID ) - { - aCapability = iPrinterDataArray[nCnt]->Capability(); - err = KErrNone; - } - } - return err; - } - -TInt CPrinterCapabilities::SetCurrentValueL( TInt aCapabilityID, TInt aValue ) - // returns any affected capability ID - { - // locate the capability - CCapabilityInfo* capInfo = NULL; - for( TInt nCnt = 0; nCnt < iPrinterDataArray.Count() && !capInfo; nCnt++ ) - { - if( iPrinterDataArray[nCnt]->Capability().iCapabilityID == aCapabilityID ) - { - capInfo = iPrinterDataArray[nCnt]; - } - } - - TInt affectedCapability( 0 ); - - if( capInfo && aValue != capInfo->CurrentValue() ) - { - // has changed - TInt currentLink = capInfo->ValueLink( capInfo->CurrentValue() ); - TInt newLink = capInfo->SetCurrentValue( aValue ); - - if( newLink != currentLink ) - { - // Find and Delete the old link - for( TInt nCnt = 0; nCnt < iPrinterDataArray.Count(); nCnt++ ) - { - if( iPrinterDataArray[nCnt]->LinkID() == currentLink ) - { - CCapabilityInfo *tmpCap; - tmpCap = iPrinterDataArray[nCnt]; - iPrinterDataArray.Remove(nCnt); - delete tmpCap; - break; - } - } - - // add the new link - if( newLink ) - { - capInfo = iSourceArray->LinkedCapability( newLink ); - affectedCapability = capInfo->Capability().iCapabilityID; - CCapabilityInfo* tmpCap = capInfo->CopyL(); - CleanupStack::PushL( tmpCap ); - iPrinterDataArray.AppendL( tmpCap ); - CleanupStack::Pop(); // tmpCap - } - } - } - - return affectedCapability; - } - -TBool CPrinterCapabilities::GetCurrentValue( TInt aCapabilityID, TInt &aCapabilityValue ) const - { - TBool result( EFalse ); - - for( TInt nCnt = 0; nCnt < iPrinterDataArray.Count() && !result; nCnt++ ) - { - if( iPrinterDataArray[nCnt]->Capability().iCapabilityID == aCapabilityID ) - { - aCapabilityValue = iPrinterDataArray[nCnt]->CurrentValue(); - result = ETrue; - } - } - - return result; - } - - -TInt CPrinterCapabilities::Count() const - { - return iPrinterDataArray.Count(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprinterelement.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprinterelement.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrinterElement class definition and the Transport enum. -* -*/ - - -#include - -#include "cprinterelement.h" - -//********************************************************************** -// CPrinterElement -//********************************************************************** -CPrinterElement::CPrinterElement() - { - } - -CPrinterElement* CPrinterElement::NewLC() - { - CPrinterElement* self = new (ELeave) CPrinterElement(); - CleanupStack::PushL(self); - return self; - } - -CPrinterElement::~CPrinterElement() - { - delete iPrinterCapabilities; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprintjob.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/cprintjob.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CPrintJob class definition and the PJS enum. -* -*/ - - -#include - -#include "cprintjob.h" - -//********************************************************************** -// CPrintJob -//********************************************************************** -CPrintJob::CPrintJob() : iState( PJSNone ) - { - } - -CPrintJob::~CPrintJob() - { - iImages.ResetAndDestroy(); - iImages.Close(); - iSettings.Close(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/crsdpofengine.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/crsdpofengine.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,759 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsDpofEngine & TRsPhoneImage class definitions and -* the MDpofEngineObserver interface definition. -* -*/ - - -#include -#include -#include -#include -#include - -#include "crsdpofengine.h" -#include "rsutils.h" -#include "imgprintkonst.h" -#include "clog.h" -#include "cfilemanager.h" - -// CONSTANTS -namespace - { - _LIT(KBackslash, "\\"); - const TInt KCopyPercentage = 90; - const TInt KAutoPrintFileAddon=2048; - - _LIT(KDpofAutoPrintFilename, "\\MISC\\AUTPRINT.MRK"); - _LIT(KDpofAutoPrintTempFolder, "\\DPOF\\"); - _LIT8(KDoubleQuote, "\""); - - _LIT8(KCrLf, "\r\n"); - _LIT8(KDpofHeader, "[HDR]\r\nGEN REV = 01.10\r\nGEN CRT = \"ImagePrint\" -02.10\r\nGEN DTM = "); - _LIT8(KDpofJobAndPid, "[JOB]\r\nPRT PID = "); - _LIT8(KDpofPrtTypSizeSmall, "PRT TYP = SIZ -03\r\n"); - _LIT8(KDpofPrtTypSizeMedium, "PRT TYP = STD\r\n"); - _LIT8(KDpofPrtTypSizeLarge, "PRT TYP = SIZ -05\r\n"); - _LIT8(KDpofPrtTypSize4x6, "PRT TYP = STD\r\n"); - _LIT8(KDpofPrtTypSize2pp, "PRT TYP = MUL -02\r\n"); - _LIT8(KDpofPrtTypSize4pp, "PRT TYP = MUL -04\r\n"); - _LIT8(KDpofPrtTypSize6pp, "PRT TYP = MUL -06\r\n"); - _LIT8(KDpofPrtTypSize9pp, "PRT TYP = MUL -09\r\n"); - _LIT8(KDpofPrtTypSize12pp, "PRT TYP = MUL -12\r\n"); - _LIT8(KDpofPrtTypSize16pp, "PRT TYP = MUL -16\r\n"); - _LIT8(KDpofPrtQtyAndImgFmt, "PRT QTY = 001\r\nIMG FMT = EXIF2 -J\r\n"); - _LIT8(KDpofImgSrc, "IMG SRC = "); - - _LIT8(KDateFormat,"%4d:%02d:%02d:%02d:%02d:%02d"); - _LIT( KDotDot, ".." ); - _LIT( KSlash, "/" ); - const TInt KDpofDelay = 500000; - } - - - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -CRsDpofEngine* CRsDpofEngine::NewL(MDpofEngineObserver& aObs) - { - CRsDpofEngine* self = new (ELeave) CRsDpofEngine(aObs); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -void CRsDpofEngine::ConstructL() - { - LOG("CRsDpofEngine::ConstructL begin"); - User::LeaveIfError( iFs.Connect() ); - iFileManager = CFileManager::NewL( iFs ); - LOG("CRsDpofEngine::ConstructL end"); - } - -CRsDpofEngine::CRsDpofEngine(MDpofEngineObserver& aObs) : - CActive(CActive::EPriorityStandard), - iHasMmc(EFalse), - iImageLayout(0), - iObs(aObs), - iShouldCancel(EFalse) - { - CActiveScheduler::Add(this); - } - -CRsDpofEngine::~CRsDpofEngine() - { - Cancel(); - if(iDpofPeriodic) iDpofPeriodic->Cancel(); - delete iDpofPeriodic; - delete iMmcDrive; - delete iAutoPrintFile; - delete iTempFolder; - iFileNames.ResetAndDestroy(); - iFileNames.Close(); - iPhoneImageArray.Close(); - delete iFileManager; - iFs.Close(); - iNumsOfCopies.Close(); - } - -void CRsDpofEngine::SetMMCPathL() - { - LOG("CRsDpofEngine::SetMMCPathL begin"); - - TFileName fileInfo; - TInt driveId; - TFileName path; - User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveId ) ); - User::LeaveIfError( PathInfo::GetRootPath( path, driveId ) ); - HBufC* mmcRoot = path.AllocLC(); - - LOG1("CRsDpofEngine::SetMMCPathL mmcRoot: %S", mmcRoot); - iHasMmc = ( mmcRoot && mmcRoot->Length() && RsUtils::PathExists( *mmcRoot, iFs ) ); - - if( iHasMmc ) - { - LOG("CRsDpofEngine::SetMMCPathL MMC found"); - iMmcDrive = mmcRoot->Left( 2 ).AllocL(); - fileInfo.Copy( *iMmcDrive ); - fileInfo.Append( KDpofAutoPrintFilename ); - iAutoPrintFile = fileInfo.AllocL(); - fileInfo.Copy( *iMmcDrive ); - fileInfo.Append( KDpofAutoPrintTempFolder ); - iTempFolder = fileInfo.AllocL(); - } - - CleanupStack::PopAndDestroy( mmcRoot ); - - LOG("CRsDpofEngine::SetMMCPathL end"); - } -TInt CRsDpofEngine::CleanupTempImages() - { - LOG("CRsDpofEngine::CleanupTempImages begin"); - iStatus = KRequestPending; - TInt retVal = iFileManager->RmDir( *iTempFolder, iStatus ); - if( !retVal && !IsActive() ) SetActive(); - LOG1("CRsDpofEngine::CleanupTempImages reurn: %d", retVal); - return retVal; - } - -void CRsDpofEngine::SetImageFileNamesL(const RPointerArray& aImageList) - { - LOG("CRsDpofEngine::SetImageFileNamesL begin"); - iFileNames.ResetAndDestroy(); - for( TInt i = 0; i < aImageList.Count(); i++) - { - HBufC* fileName = aImageList[i]->AllocLC(); - LOG1("CRsDpofEngine::SetImageFileNamesL file: %S", fileName); - User::LeaveIfError( iFileNames.Append( fileName ) ); - CleanupStack::Pop( fileName ); - } - LOG("CRsDpofEngine::SetImageFileNamesL end"); - } - -void CRsDpofEngine::SetImageLayout(TRsDpofImageLayout aImageLayout) - { - iImageLayout = aImageLayout; - } - - -TInt CRsDpofEngine::PrintL() - { - LOG("CRsDpofEngine::PrintL begin"); - TInt retVal( KErrNone ); - iPhoneImgsSize = 0; - - iShouldCancel = EFalse; - iPhoneImageArray.Reset(); - - // Check if there are phone memory images, and add up their total space - LOG("CRsDpofEngine::PrintL checking phone memory images..."); - for( TInt i = 0; i < iFileNames.Count() && !retVal; i++ ) - { - if( !RsUtils::FileOnDrive( (*iMmcDrive)[0], *(iFileNames[i]) ) ) - { - LOG1("CRsDpofEngine::PrintL phone memory image: %S", iFileNames[i]); - TRsPhoneImage phoneImage; - phoneImage.iIndex = i; - phoneImage.iCopied = EFalse; - iPhoneImageArray.AppendL( phoneImage ); - retVal = RsUtils::CumulativeFileSize( *(iFileNames[i]), iFs, iPhoneImgsSize ); - LOG1("CRsDpofEngine::PrintL error checking phone memory images: %d", retVal); - } - } - LOG("CRsDpofEngine::PrintL checking phone memory images end"); - LOG1("CRsDpofEngine::PrintL checking phone memory images, size: %d", iPhoneImgsSize); - - if( !retVal ) - { - retVal = CleanupTempImages(); - LOG1("CRsDpofEngine::PrintL error deleting temp folder: %d", retVal); - if( retVal == KErrNone ) - { - iStep = EDeleteDirectory; - iObs.HandleDpofEngineEventL( EDeleteDirectory, retVal ); - } - } - - LOG1("CRsDpofEngine::PrintL return: %d", retVal); - return retVal; - } - - -TInt CRsDpofEngine::PrepareFilenamesL() - { - LOG("CRsDpofEngine::PrepareFilenamesL begin"); - TInt retVal( KErrNone ); - - - // Walk through the list of files - // - replacing long names with short names - // - "\" with "/" - // - MMC drive "e:" with ".." - - LOG1("CRsDpofEngine::PrepareFilenamesL iFileNames->Count(): %d", iFileNames.Count()); - for( TInt i = 0; i < iFileNames.Count(); i++ ) - { - LOG1("CRsDpofEngine::PrepareFilenamesL original: %S", iFileNames[i]); - - TFileName shortFilename; - retVal = iFs.GetShortName( *(iFileNames[i]), shortFilename ); - if( retVal != KErrNone ) - { - LOG1("CRsDpofEngine::PrepareFilenamesL 1 error getting short name: %d", retVal); - return retVal; - } - - TParse parse; - parse.Set( *(iFileNames[i]), NULL, NULL ); - parse.Set( parse.DriveAndPath(), NULL, NULL ); - while( !parse.IsRoot() ) - { - TBuf<16> shortDir; - retVal = iFs.GetShortName( parse.DriveAndPath(), shortDir ); - if( retVal != KErrNone ) - { - LOG1("CRsDpofEngine::PrepareFilenamesL 2 error getting short name: %d", retVal); - return retVal; - } - - shortFilename.Insert( 0, KSlash ); - shortFilename.Insert( 0, shortDir ); - - parse.PopDir(); - } - shortFilename.Insert( 0, KSlash ); - shortFilename.Insert( 0, KDotDot ); - - delete iFileNames[i]; - iFileNames[i] = NULL; - iFileNames[i] = shortFilename.AllocL(); - - LOG1("CRsDpofEngine::PrepareFilenamesL changed: %S", iFileNames[i]); - } - - LOG1("CRsDpofEngine::PrepareFilenamesL end with: %d", retVal); - return retVal; - } - -TInt CRsDpofEngine::WriteSpecificSizeFileL() - { - LOG("CRsDpofEngine::WriteSpecificSizeFile begin"); - // Creates the autoprint file for a Specific Size image print - RFile autoPFile; - TBuf8<256> tempDes; - TTime currTime; - TDateTime currDT; - currTime.HomeTime(); - currDT = currTime.DateTime(); - - // Open the autoprint file - TInt retVal = autoPFile.Replace( iFs, *iAutoPrintFile, EFileWrite ); - if( retVal != KErrNone ) - { - LOG1("CRsDpofEngine::WriteSpecificSizeFile error opening autoprint file: %d", retVal); - return retVal; - } - - CleanupClosePushL(autoPFile); - RFileWriteStream writeStream(autoPFile); - CleanupClosePushL(writeStream); - - // Write the common header information - LOG("CRsDpofEngine::WriteSpecificSizeFile Write the common header information"); - writeStream.WriteL(KDpofHeader); - tempDes.Format(KDateFormat, currDT.Year(), (currDT.Month()+1), (currDT.Day()+1), currDT.Hour(), currDT.Minute(), currDT.Second()); - writeStream.WriteL(tempDes); - writeStream.WriteL(KCrLf); - - // For each image in the array - LOG("CRsDpofEngine::WriteSpecificSizeFile For each image in the array"); - LOG1("CRsDpofEngine::WriteSpecificSizeFile iFileNames->Count(): %d", iFileNames.Count()); - - TInt pid( 1 ); - - - for( TInt i = 0; i < iFileNames.Count(); i++ ) - { - LOG1("CRsDpofEngine::WriteSpecificSizeFile i: %d", i); - LOG1("CRsDpofEngine::WriteSpecificSizeFile iNumsOfCopies[i]: %d", iNumsOfCopies[i]); - for( TInt j = 0; j < iNumsOfCopies[i]; j++ ) - { - pid += j; - // write a job section, followed by the PID - LOG1("CRsDpofEngine::WriteSpecificSizeFile write a job section, followed by the PID: %d", pid); - writeStream.WriteL(KDpofJobAndPid); - tempDes.NumFixedWidth( pid, EDecimal, 3 ); - writeStream.WriteL(tempDes); - writeStream.WriteL(KCrLf); - - LOG1("CRsDpofEngine::WriteSpecificSizeFile iImageLayout: %d", iImageLayout); - switch( iImageLayout ) - { - case EOnePerPageSmall: - writeStream.WriteL(KDpofPrtTypSizeSmall); - break; - case EOnePerPageMedium: - writeStream.WriteL(KDpofPrtTypSizeMedium); - break; - case EOnePerPageLarge: - writeStream.WriteL(KDpofPrtTypSizeLarge); - break; - case EOnePerPage4x6: - writeStream.WriteL(KDpofPrtTypSize4x6); - break; - default: - break; - } - - LOG1("CRsDpofEngine::WriteSpecificSizeFile file: %S", iFileNames[i]); - writeStream.WriteL(KDpofPrtQtyAndImgFmt); - writeStream.WriteL(KDpofImgSrc); - writeStream.WriteL(KDoubleQuote); - tempDes.Copy(*(iFileNames[i])); - writeStream.WriteL(tempDes); - writeStream.WriteL(KDoubleQuote); - writeStream.WriteL(KCrLf); - } - } - - - writeStream.CommitL(); - CleanupStack::PopAndDestroy(2); // writeStream, autoPFile - - LOG1("CRsDpofEngine::WriteSpecificSizeFile end with: %d", retVal); - return retVal; - } - -TInt CRsDpofEngine::WriteMultipleFileL() - { - LOG("CRsDpofEngine::WriteMultipleFile begin"); - // Creates the autoprint file for a Multiple image print - TInt retVal=KErrNone; - RFile autoPFile; - TBuf8<256> tempDes; - TTime currTime; - TDateTime currDT; - currTime.HomeTime(); - currDT = currTime.DateTime(); - - // Open the autoprint file - retVal = autoPFile.Replace( iFs, *iAutoPrintFile, EFileWrite ); - if( retVal != KErrNone ) - { - LOG1("CRsDpofEngine::WriteMultipleFile error opening autoprint file: %d", retVal); - return retVal; - } - - CleanupClosePushL(autoPFile); - RFileWriteStream writeStream(autoPFile); - CleanupClosePushL(writeStream); - - // Write the common header information - LOG("CRsDpofEngine::WriteMultipleFile Write the common header information"); - writeStream.WriteL(KDpofHeader); - tempDes.Format(KDateFormat, currDT.Year(), (currDT.Month()+1), (currDT.Day()+1), currDT.Hour(), currDT.Minute(), currDT.Second()); - writeStream.WriteL(tempDes); - writeStream.WriteL(KCrLf); - - // Start the job section, followed by the PID - LOG("CRsDpofEngine::WriteMultipleFile Start the job section, followed by the PID"); - writeStream.WriteL(KDpofJobAndPid); - tempDes.NumFixedWidth(1, EDecimal, 3); - writeStream.WriteL(tempDes); - writeStream.WriteL(KCrLf); - - LOG1("CRsDpofEngine::WriteMultipleFile iImageLayout: %d", iImageLayout); - switch (iImageLayout) - { - case ETwoPerPage: - writeStream.WriteL(KDpofPrtTypSize2pp); - break; - case EFourPerPage: - writeStream.WriteL(KDpofPrtTypSize4pp); - break; - case ESixPerPage: - writeStream.WriteL(KDpofPrtTypSize6pp); - break; - case ENinePerPage: - writeStream.WriteL(KDpofPrtTypSize9pp); - break; - case ETwelvePerPage: - writeStream.WriteL(KDpofPrtTypSize12pp); - break; - case ESixteenPerPage: - writeStream.WriteL(KDpofPrtTypSize16pp); - break; - default: - break; - } - writeStream.WriteL(KDpofPrtQtyAndImgFmt); - - // For each image in the array - LOG("CRsDpofEngine::WriteMultipleFile For each image in the array"); - LOG1("CRsDpofEngine::WriteMultipleFile iFileNames->Count(): %d", iFileNames.Count()); - - - for( TInt i = 0; i < iFileNames.Count(); i++) - { - LOG1("CRsDpofEngine::WriteMultipleFile i: %d", i); - LOG1("CRsDpofEngine::WriteMultipleFile iNumsOfCopies[i]: %d", iNumsOfCopies[i]); - for( TInt j = 0; j < iNumsOfCopies[i]; j++ ) - { - LOG1("CRsDpofEngine::WriteMultipleFile file: %S", iFileNames[i]); - // add it to the job section - writeStream.WriteL(KDpofImgSrc); - writeStream.WriteL(KDoubleQuote); - tempDes.Copy(*(iFileNames[i])); - writeStream.WriteL(tempDes); - writeStream.WriteL(KDoubleQuote); - writeStream.WriteL(KCrLf); - } - } - - - writeStream.CommitL(); - CleanupStack::PopAndDestroy(2); // writeStream, autoPFile - - LOG1("CRsDpofEngine::WriteMultipleFile end with: %d", retVal); - return retVal; - } - -void CRsDpofEngine::DoCancel() - { - LOG("CRsDpofEngine::DoCancel begin"); - iShouldCancel = ETrue; - LOG("CRsDpofEngine::DoCancel end"); - } - -void CRsDpofEngine::Stop() - { - LOG("CRsDpofEngine::Stop begin"); - iShouldCancel = ETrue; - iFileManager->CancelCopy(); - iFileManager->CancelRmDir(); - LOG("CRsDpofEngine::Stop end"); - } - -void CRsDpofEngine::RunL() - { - LOG1("CRsDpofEngine::RunL called with iStatus.Int(): %d", iStatus.Int()); - TInt retVal( KErrNone ); - - if( iStatus.Int() != KErrNone ) - { - LOG("CRsDpofEngine::RunL there was an error, so cleanup"); - iObs.HandleDpofEngineEventL(iStep, iStatus.Int()); - } - else - { - LOG1("CRsDpofEngine::RunL iStep: %d", iStep); - switch( iStep ) - { - case ECopyImageFiles: - { - // change those filename array entries so that the filename is now correct - TParsePtrC parsePtr( *(iFileNames[iCurrentPhoneImage->iIndex]) ); - iTempFile.Append( parsePtr.NameAndExt() ); - delete iFileNames[iCurrentPhoneImage->iIndex]; - iFileNames[iCurrentPhoneImage->iIndex] = NULL; - iFileNames[iCurrentPhoneImage->iIndex] = iTempFile.AllocL(); - iCurrentPhoneImage->iCopied = ETrue; - - retVal = CopyPhoneImagesToMMC(); - LOG1("CRsDpofEngine::RunL CopyPhoneImagesToMMC returned: %d", retVal); - if( retVal == KErrNone ) - { - iObs.HandleDpofEngineEventL(iStep, retVal); - } - else if( retVal == KErrCancel ) - { - CreateDpofFileL(); - } - else - { - iObs.HandleDpofEngineEventL( iStep, retVal ); - } - } - break; - case EDeleteDirectory: - { - LOG1("CRsDpofEngine::RunL iPhoneImageArray.Count(): %d", iPhoneImageArray.Count()); - if( iPhoneImageArray.Count() ) - { - TUint32 size( 0 ); - RsUtils::DriveFreeSpace( (*iMmcDrive)[0], iFs, size ); - - if( SysUtil::MMCSpaceBelowCriticalLevelL( &iFs, iPhoneImgsSize ) ) - { - LOG("CRsDpofEngine::PrintL below MMC critical level"); - retVal = KErrTooBig; - } - else if( size < ( iPhoneImgsSize + KAutoPrintFileAddon ) ) - { - LOG("CRsDpofEngine::PrintL NO room on MMC for phone memory images"); - retVal = KErrTooBig; - } - else - { - LOG("CRsDpofEngine::PrintL enough room on MMC for phone memory images"); - if( !RsUtils::PathExists( *iTempFolder, iFs ) ) - { - retVal = iFs.MkDir( *iTempFolder ); - LOG1("CRsDpofEngine::PrintL error making temp folder: %d", retVal); - if( !retVal ) - { - retVal = CopyPhoneImagesToMMC(); - LOG1("CRsDpofEngine::PrintL error copying phone memory images: %d", retVal); - } - } - } - - iObs.HandleDpofEngineEventL( ECopyImageFiles, retVal ); - } - else - { - CreateDpofFileL(); - iObs.HandleDpofEngineEventL( EDPOFGenerate, KErrNone ); - } - } - break; - default: - break; - } - } - LOG("CRsDpofEngine::RunL end"); - } - - -TInt CRsDpofEngine::CopyPhoneImagesToMMC() - { - LOG("CRsDpofEngine::CopyPhoneImagesToMMC begin"); - TInt retVal = KErrCancel; - iStep = ECopyImageFiles; - if( iShouldCancel ) - { - LOG1("CRsDpofEngine::CopyPhoneImagesToMMC iShouldCancel== ETrue, end with: %d", retVal); - return retVal; - } - - iCurrentPhoneImage = GetNextImageInfoForCopy(); - - if( iCurrentPhoneImage ) - { - // copy phone mem images to MMC card temp dir - TTime theTime; - theTime.HomeTime(); - iTempFile.Copy( *iTempFolder ); - iTempFile.AppendNumUC( theTime.Int64(), EHex ); - iTempFile.Append( KBackslash ); - retVal = iFs.MkDir( iTempFile ); - LOG1("CRsDpofEngine::CopyPhoneImagesToMMC error making directory: %d", retVal); - if( retVal == KErrNone ) - { - retVal = iFileManager->Copy( *(iFileNames[iCurrentPhoneImage->iIndex]), iTempFile, iStatus ); - LOG1("CRsDpofEngine::CopyPhoneImagesToMMC error copying: %d", retVal); - if( retVal == KErrNone ) - { - iStatus = KRequestPending; - if( !IsActive() ) SetActive(); - } - } - } - - LOG1("CRsDpofEngine::CopyPhoneImagesToMMC end with: %d", retVal); - return retVal; - } - -TRsPhoneImage* CRsDpofEngine::GetNextImageInfoForCopy() - { - TRsPhoneImage* phoneImage = NULL; - for( TInt i = 0; i < iPhoneImageArray.Count() && !phoneImage; i++ ) - { - if( iPhoneImageArray[i].iCopied == EFalse ) - { - phoneImage = &( iPhoneImageArray[i] ); - } - } - return phoneImage; - } - - -TInt CRsDpofEngine::GetPrintPercentage() - { - LOG("CRsDpofEngine::GetPrintPercentage begin"); - // compute the percentage of the printing job has been completed - TInt copied( 0 ); - TInt count = iPhoneImageArray.Count(); - - // assumes that writing to autoprint file takes 10% of the work - for( TInt i = 0; i < count; i++ ) - { - if( iPhoneImageArray[i].iCopied ) - copied++; - } - - TInt percentage = (copied == count) ? KCopyPercentage : ((copied*100)/count); - LOG1("CRsDpofEngine::GetPrintPercentage end with: %d", percentage); - return percentage; - } - -void CRsDpofEngine::CreateDpofFileL() - { - if(iDpofPeriodic) iDpofPeriodic->Cancel(); - delete iDpofPeriodic; - iDpofPeriodic = NULL; - iDpofPeriodic = CPeriodic::NewL(CActive::EPriorityStandard); - iDpofPeriodic->Start(KDpofDelay,KDpofDelay,TCallBack(CreateDpofFileCbL,this)); - } - -void CRsDpofEngine::StartDiscovery(TRequestStatus& aStatus) - { - LOG("CRsDpofEngine::StartDiscovery begin"); - aStatus = KRequestPending; - TRequestStatus *status = &aStatus; - if( iHasMmc ) - { - LOG1("CRsDpofEngine::StartDiscovery end with: %d", EPrinterDiscovered); - User::RequestComplete(status,EPrinterDiscovered); - } - else - { - LOG1("CRsDpofEngine::StartDiscovery end with: %d", EDiscoveryDone); - User::RequestComplete(status,EDiscoveryDone); - } - } - - -TBool CRsDpofEngine::WasCancelled() const - { - return iShouldCancel; - } - -TBool CRsDpofEngine::AutoPrintFileExists() - { - return ( RsUtils::FileExists( *iAutoPrintFile, iFs ) ); - } - -TInt CRsDpofEngine::CreateDpofFileCbL(TAny *aObj) - { - CRsDpofEngine* obj = static_cast(aObj); - if( obj->iDpofPeriodic ) obj->iDpofPeriodic->Cancel(); - obj->DoCreateDpofFileL(); - return EFalse; - } - -void CRsDpofEngine::DoCreateDpofFileL() - { - LOG("CRsDpofEngine::DoCreateDpofFileL begin"); - - TParsePtrC parse( *iAutoPrintFile ); - - // Delete existing autoprint file - if( RsUtils::FileExists( *iAutoPrintFile, iFs ) ) - { - LOG("CRsDpofEngine::DoCreateDpofFileL deleting existing autoprint file..."); - User::LeaveIfError( iFs.Delete( *iAutoPrintFile ) ); - } - else - { - LOG("CRsDpofEngine::DoCreateDpofFileL making sure that the autoprint file folder exists..."); - // Make sure that the autoprint file folder exists - if( !RsUtils::PathExists( parse.DriveAndPath(), iFs ) ) - User::LeaveIfError( iFs.MkDir( parse.DriveAndPath() ) ); - } - - // Ready the array of filenames for DPOF generation - LOG("CRsDpofEngine::DoCreateDpofFileL preparing file names..."); - PrepareFilenamesL(); - - TInt retVal=KErrNone; - // Generate autoprint file - LOG1("CRsDpofEngine::DoCreateDpofFileL printing layout: %d", iImageLayout); - switch( iImageLayout ) - { - case EOnePerPageSmall: - case EOnePerPageMedium: - case EOnePerPageLarge: - case EOnePerPage4x6: - retVal = WriteSpecificSizeFileL(); - break; - case ETwoPerPage: - case EFourPerPage: - case ESixPerPage: - case ENinePerPage: - case ETwelvePerPage: - case ESixteenPerPage: - retVal = WriteMultipleFileL(); - break; - default: - // Should never be here - User::Leave(KErrGeneral); - break; - } - - LOG1("CRsDpofEngine::DoCreateDpofFileL end with: %d", retVal); - if (retVal == KErrNone) - { - iObs.HandleDpofEngineEventL(EJobCompleted, KErrNone); - } - else - { - iObs.HandleDpofEngineEventL(EJobError, retVal); - } - } - -TBool CRsDpofEngine::HasMmc() const - { - return iHasMmc; - } - - -void CRsDpofEngine::SetNumsOfCopiesL( const RArray& aNumsOfCopies ) - { - LOG("CRsDpofEngine::SetNumsOfCopiesL begin"); - iNumsOfCopies.Reset(); - TInt count = aNumsOfCopies.Count(); - for( TInt i = 0; i < count; i++ ) - { - iNumsOfCopies.AppendL( aNumsOfCopies[i] ); - } - LOG("CRsDpofEngine::SetNumsOfCopiesL end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/main.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/main.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cdpofprintingdevice.h" - -// Entry point to the application DLL - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10208A20, CDPOFPrintingDevice::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/rsutils.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/src/rsutils.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the RsUtils class definitions. -* -*/ - - -#include - -#include "rsutils.h" - -// CONSTANTS -namespace - { - _LIT( KBackslash, "\\" ); - _LIT( KMatchPattern, "*" ); - } - - -TBool RsUtils::FileExists(const TDesC& aFileName, RFs& aFs) - { - return ( BaflUtils::FileExists( aFs, aFileName ) ); - } - -TBool RsUtils::PathExists(const TDesC& aFilePath, RFs& aFs) - { - if( aFilePath.Right( 1 ) == KBackslash ) - { - return ( BaflUtils::PathExists( aFs, aFilePath ) ); - } - else - { - TFileName filePath = aFilePath; - filePath.Append( KBackslash ); - return ( BaflUtils::PathExists( aFs, filePath ) ); - } - } - -TInt RsUtils::DriveFreeSpace( TChar aDrive, RFs& aFs, TUint32& aSpace ) - { - TInt mmcDriveNum; - TInt err = aFs.CharToDrive( aDrive, mmcDriveNum ); - if( !err ) - { - TVolumeInfo volInfo; - err = aFs.Volume( volInfo, mmcDriveNum ); - aSpace = volInfo.iFree; - } - return err; - } - - -TInt RsUtils::CumulativeFileSize( const TDesC& aFileName, RFs& aFs, TInt& aCumulativeSize ) - { - TEntry fileEntry; - TInt err = aFs.Entry( aFileName, fileEntry ); - if( !err ) - { - aCumulativeSize += fileEntry.iSize; - } - return err; - } - -TBool RsUtils::FileInDir( const TDesC& aFileName, const TDesC& aDirName ) - { - TFileName dir = aDirName; - if( dir.Right( 1 ) != KBackslash ) - { - dir.Append( KBackslash ); - } - dir.Append( KMatchPattern ); - TBool ret = ( aFileName.Match( dir ) == KErrNotFound ) ? EFalse : ETrue; - return ret; - } - -TBool RsUtils::FileOnDrive( TChar aDrive, const TDesC& aFileName ) - { - TParsePtrC parse( aFileName ); - TBool res = ( parse.Drive().LocateF( aDrive ) == KErrNotFound ) ? EFalse : ETrue; - return res; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/bwins/pdphotolibu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/bwins/pdphotolibu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/data/01007783.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/data/01007783.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - -// Declares info for Pict Bridge -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x01007783; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x10208A1E; - implementations = - { - // Info for Pict Bridge - IMPLEMENTATION_INFO - { - implementation_uid = 0x10208A22; - version_no = 1; - display_name = "PictBridge"; - default_data = "PictBridge"; - opaque_data = ""; - } - }; - } - }; - } diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/eabi/pdphotolibu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/eabi/pdphotolibu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZTI10CPBConnect @ 2 NONAME ; ## - _ZTI17CPBPrintingDevice @ 3 NONAME ; ## - _ZTI8CPBEvent @ 4 NONAME ; ## - _ZTV10CPBConnect @ 5 NONAME ; ## - _ZTV17CPBPrintingDevice @ 6 NONAME ; ## - _ZTV8CPBEvent @ 7 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/group/bld.inf --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -pdphotolib.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/group/pdphotolib.mmp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/group/pdphotolib.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -deffile pdphotolib.def - -TARGET pdphotolib.dll -TARGETTYPE PLUGIN -CAPABILITY CAP_ECOM_PLUGIN - -UID 0x10009D8D 0x01007783 - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/libc - -USERINCLUDE . ../inc ../src -USERINCLUDE ../../../ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintServer/inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../../ImagePrintUI/imageprintapp/inc -USERINCLUDE ../../../../clog/inc - -SOURCEPATH ../src -SOURCE cpbprintingdevice.cpp -SOURCE cpbconnect.cpp -SOURCE cpbevent.cpp -SOURCE main.cpp - - -START RESOURCE ../data/01007783.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -TARGET pdphotolib.rsc -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY pictbridge.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY usbwatcher.lib - -MACRO MCLF_OPERATION - -// End of File \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbconnect.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbconnect.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: Contains the CPBConnect class definition. -* -*/ - - -#ifndef CPBCONNECT_H -#define CPBCONNECT_H - -class MPBObserver; -class CPBEvent; -class CDpsEngine; - - -class CPBConnect : public CActive - { -public: - static CPBConnect* NewL( CDpsEngine& aEngine, MPBObserver& aObserver ); - CPBConnect( CDpsEngine& aEngine, MPBObserver& aObserver ); - ~CPBConnect(); - void ConstructL(); - - -protected: // from CActive - void RunL(); - void DoCancel(); - -private: - CDpsEngine& iDpsEngine; - MPBObserver& iObserver; - CPBEvent* iEvent; - }; - -#endif // CPBCONNECT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbevent.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbevent.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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: Contains the CPBConnect class definition. -* -*/ - - -#ifndef CPBEVENT_H -#define CPBEVENT_H - -#include -#include - -class MPBObserver; - - -class CPBEvent : public CActive - { -public: - static CPBEvent* NewL( CDpsEngine& aEngine, MPBObserver& aObserver ); - CPBEvent( CDpsEngine& aEngine, MPBObserver& aObserver ); - ~CPBEvent(); - void ConstructL(); - void Listen(); - -protected: // from CActive - void RunL(); - void DoCancel(); - -private: - CDpsEngine& iDpsEngine; - MPBObserver& iObserver; - TDpsEvents iEvent; - }; - -#endif // CPBEVENT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbprintingdevice.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/cpbprintingdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +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: Contains the CPBPrintingDevice class definition. -* -*/ - - -#ifndef CPBPRINTINGDEVICE_H -#define CPBPRINTINGDEVICE_H - -#include -#include - -#include "mprotprintingdevice.h" -#include "mpbobserver.h" -#include "printmessagecodes.h" -#include "printcapabilitycodes.h" - -class CDpsEngine; -class CPBConnect; -class RWriteStream; - -enum TPBProtocolState - { - EPBUninitialized = 0, - EPBDiscovery, - EPBReady, - EPBJobReady, - EPBSubmittingJob, - EPBPrinting, - EPBCancelling, - }; - -enum TPBJobSettingIndex - { - EPBSettingPaperSize = 0, - EPBSettingQuality = 1, - EPBSettingLayout = 2 - }; - -/** - * @brief CPBPrintingDevice implements MProtPrintingDevice. This makes the class the "published" class of the DLL it is in. - */ -class CPBPrintingDevice : public CActive, public MProtPrintingDevice, public MPBObserver - { -public: - static MProtPrintingDevice* NewL(); - - // Default constructor and destructor. - CPBPrintingDevice(); - ~CPBPrintingDevice(); - -public: // From MProtPrintingDevice - - // General. - void ConstructL(const TDesC& aDLLPath); - TVersion Version(); - TUint SupportedProtocols(); - // Discovery. - void StartDiscoveryL( MProtDiscoveryObserver& aObserver, TUint aProtocols = 0 ); - TInt RemoveCachedDeviceL( TInt aDeviceID ); - void CancelDiscovery( TBool aDoCallBack = ETrue ); - // Print. - TInt CreatePrintJobL( TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver ); - void SubmitPrintJobL(); - TInt CancelPrintJob(); - TInt ContinuePrintJobL(); - TInt GetNumPrintPages(); - TInt GetPrintJobStatus(); - TInt GetPrinterStatus( TInt aDeviceID ); - // Capabilities. - TInt GetDeviceCapabilityIDsL( TInt aDeviceID, RArray& aCapabilityIDs ); - TInt GetDeviceCapabilityL( TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability ); - TInt GetJobSetting( TInt aCapabilityID, TInt& aValue ); - TInt SetJobSettingL( TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability ); - // Preview. - TInt GetNumPreviewPages(); - TInt GetJobTemplateIconL( TInt aTemplateID, TInt& aFsBitmapHandle ); - TInt CreatePreviewImage( TInt aPageNumber ); - - void RegisterIdleObserver( MProtIdleObserver *aObserver ); - - void SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ); - -public: // from MPBObserver - void ConnectionNotifyL( TInt aStatus ); - void JobNotify( const TDpsGetJobStatus& aStatus ); - void PrinterNotify( const TDpsGetPrinterStatus& aStatus ); - -protected: // from CActive - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - -private: - void HandlePapersizesResponseL( TPrintCapability& aCapability ); - void HandleQualitiesResponseL( TPrintCapability& aCapability ); - void HandleLayoutsResponseL( TPrintCapability& aCapability ); - TInt GetPapersizeJobSetting( TInt& aValue ); - TInt GetQualityJobSetting( TInt& aValue ); - TInt GetLayoutJobSetting( TInt& aValue ); - TPrintMessageCodes DpsJobError( const TDpsJobEndReason& aReason ); - void HandlePaperError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ); - void HandleInkError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ); - void HandleHwError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ); - void HandleFileError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ); - TBool HasCapability( TPrintCapability& aCapability, TPrintCapabilityOptions aOption ); - void SaveConfigInfoL(); - void ReadConfigInfoL(); - void ExternalizeL( RWriteStream& aStream ) const; - -private: // data - CDpsEngine* iDpsEngine; - CPBConnect* iConnect; - CActiveSchedulerWait iWait; - TBool iPrinterConnected; - TPBProtocolState iState; - MProtIdleObserver* iIdleObserver; - RHashMap iCapToDps; - TDpsGetCapability iCap; - TDpsStartJob iStart; - TDpsAbortJob iAbort; - TDpsContinueJob iContinue; - TDpsGetPrinterStatus iPrinterS; - TDpsGetJobStatus iJobS; - TDpsConfigPrintService iConfigS; - HBufC* iCongFileName; - TPrinter iPrinter; - TUint iCancelRetry; - TInt iPrintingStateComplete; - TUint iUserSelectedPaperSize; - TBool iDisconnectPrinter; - TBool iNewJobOK; - }; - -#endif // CPBPRINTINGDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/mpbobserver.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/mpbobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: Contains the MPBObserver interface. -* -*/ - - -#ifndef MPBOBSERVER_H -#define MPBOBSERVER_H - -#include -#include - -class MPBObserver - { -public: - virtual void ConnectionNotifyL( TInt aStatus ) = 0; - virtual void JobNotify( const TDpsGetJobStatus& aStatus ) = 0; - virtual void PrinterNotify( const TDpsGetPrinterStatus& aStatus ) = 0; - }; - -#endif // MPBOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/mpersonalitynotify.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/inc/mpersonalitynotify.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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 MPERSONALITYNOTIFY_H -#define MPERSONALITYNOTIFY_H - -#include - -class MPersonalityNotify - { - public: - virtual void PersonalityQueryCompleteL() = 0; - virtual void SetPreviousPersonalityCompleteL() = 0; - - }; - -#endif // MPERSONALITYNOTIFY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbconnect.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbconnect.cpp Fri Jun 11 16:24:10 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: Contains the CPBConnect class definition. -* -*/ - - -#include -#include - -#include "cpbconnect.h" -#include "mpbobserver.h" -#include "cpbevent.h" -#include "clog.h" - -CPBConnect* CPBConnect::NewL( CDpsEngine& aEngine, MPBObserver& aObserver ) - { - LOG("CPBConnect::NewL begin"); - CPBConnect* self = new (ELeave) CPBConnect( aEngine, aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - LOG("CPBConnect::NewL end"); - return self; - } - -CPBConnect::CPBConnect(CDpsEngine& aEngine, MPBObserver& aObserver) : -CActive( CActive::EPriorityStandard ), iDpsEngine(aEngine), iObserver( aObserver ) - { - LOG("CPBConnect::CPBConnect begin"); - CActiveScheduler::Add( this ); - LOG("CPBConnect::CPBConnect end"); - } - -CPBConnect::~CPBConnect() - { - LOG("CPBConnect::~CPBConnect begin"); - Cancel(); - delete iEvent; - LOG("CPBConnect::~CPBConnect end"); - } - -void CPBConnect::ConstructL() - { - LOG("CPBConnect::ConstructL begin"); - iEvent = CPBEvent::NewL( iDpsEngine, iObserver ); - iDpsEngine.SetPrintMode( iStatus ); - SetActive(); - LOG("CPBConnect::ConstructL end"); - } - - -void CPBConnect::RunL() - { - LOG1("CPBConnect::RunL begin, status %d", iStatus.Int() ); - switch ( iStatus.Int() ) - { - case CDpsEngine::ENotConnected: - iObserver.ConnectionNotifyL( iStatus.Int() ); - iDpsEngine.ConnectStateNotify( iStatus ); - SetActive(); - break; - case CDpsEngine::EPrinterConnected: - iObserver.ConnectionNotifyL( iStatus.Int() ); - iDpsEngine.ConnectStateNotify( iStatus ); - SetActive(); - iEvent->Listen(); - break; - case CDpsEngine::EPrinterDisconnected: - iEvent->Cancel(); - iObserver.ConnectionNotifyL( iStatus.Int() ); - iDpsEngine.SetPrintMode( iStatus ); - SetActive(); - break; - case CDpsEngine::EOtherConnected: - iObserver.ConnectionNotifyL( iStatus.Int() ); - iDpsEngine.ConnectStateNotify( iStatus ); - SetActive(); - break; - case CDpsEngine::EWrongPrintModeConnected: - iObserver.ConnectionNotifyL( iStatus.Int() ); - iDpsEngine.ConnectStateNotify( iStatus ); - SetActive(); - iEvent->Listen(); - break; - default: - break; - } - LOG("CPBConnect::RunL end"); - } - -void CPBConnect::DoCancel() - { - LOG("CPBConnect::DoCancel begin"); - iDpsEngine.CancelPrintMode(); - LOG("CPBConnect::DoCancel end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbevent.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbevent.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: Contains the CPBConnect class definition. -* -*/ - - -#include -#include - -#include "cpbevent.h" -#include "mpbobserver.h" -#include "clog.h" - -CPBEvent* CPBEvent::NewL( CDpsEngine& aEngine, MPBObserver& aObserver ) - { - LOG("CPBEvent::NewL begin"); - CPBEvent* self = new (ELeave) CPBEvent(aEngine, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - LOG("CPBEvent::NewL end"); - return self; - } - -CPBEvent::CPBEvent( CDpsEngine& aEngine, MPBObserver& aObserver) : -CActive( CActive::EPriorityStandard ), iDpsEngine( aEngine ), iObserver( aObserver ) - { - LOG("CPBEvent::CPBEvent begin"); - CActiveScheduler::Add(this); - LOG("CPBEvent::CPBEvent end"); - } - -CPBEvent::~CPBEvent() - { - LOG("CPBEvent::~CPBEvent begin"); - Cancel(); - LOG("CPBEvent::~CPBEvent end"); - } - -void CPBEvent::ConstructL() - { - LOG("CPBEvent::ConstructL begin"); - LOG("CPBEvent::ConstructL end"); - } - -void CPBEvent::Listen() - { - LOG("CPBEvent::Listen begin"); - if ( !IsActive() ) - { - iDpsEngine.DpsEventNotify( iEvent, iStatus ); - SetActive(); - } - LOG("CPBEvent::Listen end"); - } - -void CPBEvent::RunL() - { - LOG2("CPBEvent::RunL begin, status %d event %d", iStatus.Int(), iEvent.iEvent ); - if (iEvent.iEvent == EDpsEvtNotifyJobStatus) - { - iObserver.JobNotify( iEvent.iJobEvent ); - } - else if (iEvent.iEvent == EDpsEvtNotifyDeviceStatus) - { - iObserver.PrinterNotify( iEvent.iPrinterEvent ); - } - Listen(); - LOG("CPBEvent::RunL end"); - } - -void CPBEvent::DoCancel() - { - LOG("CPBEvent::DoCancel begin"); - iDpsEngine.CancelDpsEventNotify(); - LOG("CPBEvent::DoCancel end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbprintingdevice.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/cpbprintingdevice.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1377 +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: Contains the CPBPrintingDevice class definition. -* -*/ - - -#include -#include -#include -#include - -#include "cpbprintingdevice.h" -#include "printcapabilitycodes.h" -#include "printmessagecodes.h" -#include "imageprint.h" -#include "cpbconnect.h" -#include "clog.h" - -// CONSTANTS -namespace - { - const TInt KPBVersionMajor = 0; - const TInt KPBVersionMinor = 0; - const TInt KPBVersionBuild = 1; - } - -const TInt KConfigLength = 16; -const TInt KMaxRetry = 10; -_LIT( KConfigInfoFile, "config.DPS"); - - -MProtPrintingDevice* CPBPrintingDevice::NewL() - { - return new (ELeave) CPBPrintingDevice(); - } - - -CPBPrintingDevice::CPBPrintingDevice() : -CActive( CActive::EPriorityStandard ), iState(EPBUninitialized), iDisconnectPrinter(EFalse) - { - CActiveScheduler::Add(this); - } - -void CPBPrintingDevice::ConstructL(const TDesC& /*aDLLPath*/) - { - LOG("CPBPrintingDevice::ConstructL begin"); - - iDpsEngine = CDpsEngine::GetEngineL(); - iConnect = CPBConnect::NewL( *iDpsEngine, *this ); - - iCongFileName = HBufC::NewL( iDpsEngine->DpsFolder().Length() + KConfigLength ); - TInt k = iDpsEngine->DpsFolder().Length() + KConfigLength; - iCongFileName->Des().Copy( iDpsEngine->DpsFolder() ); - iCongFileName->Des().Append( KConfigInfoFile ); - - iCancelRetry = 0; - - // for Cert software to indicate that printing state and idle state - iPrintingStateComplete = 0; - - iUserSelectedPaperSize = EDpsPaperSizeDefault; - iNewJobOK = ETrue; - - LOG("CPBPrintingDevice::ConstructL end"); - } - - -CPBPrintingDevice::~CPBPrintingDevice() - { - LOG("CPBPrintingDevice::~CPBPrintingDevice begin"); - Cancel(); - delete iConnect; - delete iCongFileName; - if ( iDpsEngine ) - { - iDpsEngine->Delete(); - } - REComSession::DestroyedImplementation( iDtor_ID_Key ); - LOG("CPBPrintingDevice::~CPBPrintingDevice end"); - } - - -TVersion CPBPrintingDevice::Version() - { - return TVersion(KPBVersionMajor, KPBVersionMinor, KPBVersionBuild); - } - -TUint CPBPrintingDevice::SupportedProtocols() - { - return KImagePrint_PrinterProtocol_PictBridge; - } - -void CPBPrintingDevice::StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocol) - { - LOG1("CPBPrintingDevice::StartDiscoveryL aProtocol: %d", aProtocol); - iDiscoveryObserver = &aObserver; - - if ( IsActive() ) - { - LOG1("CPBPrintingDevice::StartDiscoveryL invalid state %d, cannot start discovery", iState); - iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrInvalidSequence, 0 ); - return; - } - - if ( !( aProtocol & KImagePrint_PrinterProtocol_PictBridge ) ) - { - LOG("CPBPrintingDevice::StartDiscoveryL NO protocol match, ending discovery..."); - iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrNotSupported, 0 ); - return; - } - - if ( !iPrinterConnected ) - { - LOG("CPBPrintingDevice::StartDiscoveryL no printer connected, ending discovery"); - iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrNone, 0 ); - return; - } - - - // clear capability map - iCapToDps.Close(); - - iConfigS.iReqParam.Reset(); - iDpsEngine->GetDpsConfigL( iConfigS.iReqParam ); - iDpsEngine->DoDpsRequestL( &iConfigS, iStatus ); - iState = EPBDiscovery; - SetActive(); - LOG("CPBPrintingDevice::StartDiscoveryL setting state to Discovery"); - - LOG("CPBPrintingDevice::StartDiscoveryL end"); - } - - -TInt CPBPrintingDevice::RemoveCachedDeviceL( TInt aDeviceID ) - { - LOG1("CPBPrintingDevice::RemoveCachedDeviceL, aDeviceID: %d", aDeviceID); - return KErrInvalidData; - } - -void CPBPrintingDevice::CancelDiscovery( TBool aDoCallBack ) - { - LOG2("CPBPrintingDevice::CancelDiscovery aDoCallBack %d, iState %d", aDoCallBack, iState ); - if ( iState == EPBDiscovery ) - { - Cancel(); - if ( aDoCallBack && iDiscoveryObserver ) - { - //We're not interested if the call back leaves - TRAP_IGNORE( iDiscoveryObserver->DiscoveryStatusL( EDiscoveryCancelling, KErrNone, 0 ) ); - //We're not interested if the call back leaves - TRAP_IGNORE( iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrNone, 0 ) ); - } - iState = EPBUninitialized; - } - LOG("CPBPrintingDevice::CancelDiscovery end"); - } - - -TInt CPBPrintingDevice::CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver) - { - LOG2("CPBPrintingDevice::CreatePrintJobL begin, deviceid %d imagecount %d", aDeviceID, aImages.Count()); - iPrintEventObserver = &aObserver; - - if ( aDeviceID != 0 ) - { - LOG("CPBPrintingDevice::CreatePrintJobL invalid device"); - return KErrArgument; - } - - if ( iState != EPBReady && iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::CreatePrintJobL invalid state %d", iState); - if(iDisconnectPrinter) // If printer is disconnected then return KErrDisconnected. - return KErrDisconnected; - else - return KErrInvalidSequence; - } - - iStart.iReqParam.Reset(); - - // these must be appended in same order as PBJobSettingIndex - - TDpsArgsInt arg; - arg.iElement = EDpsArgPaperSize; - arg.iContent = EDpsPaperSizeDefault; - iStart.iReqParam.iJobConfig.Append(arg); - - arg.iElement = EDpsArgQuality; - arg.iContent = EDpsPrintQualityDefault; - iStart.iReqParam.iJobConfig.Append(arg); - - arg.iElement = EDpsArgLayout; - arg.iContent = EDpsLayoutDefault; - iStart.iReqParam.iJobConfig.Append(arg); - - for ( TInt i = 0; i < aImages.Count(); ++i ) - { - TDpsPrintInfo info; - info.Reset(); - const TDesC& image = *aImages[i]; - LOG1("CPBPrintingDevice::CreatePrintJobL image %S", &image); - info.iFile.Copy( image ); - iStart.iReqParam.iPrintInfo.Append( info ); - } - - LOG("CPBPrintingDevice::CreatePrintJobL setting state to JobReady"); - iState = EPBJobReady; - - LOG("CPBPrintingDevice::CreatePrintJobL end"); - return KErrNone; - } - -void CPBPrintingDevice::SubmitPrintJobL() - { - LOG("CPBPrintingDevice::SubmitPrintJobL begin"); - - // Checking that job is ready and printer has send aStatus.iRepParam.iNewJobOk - // Check PrinterNotify function - if ( iState == EPBJobReady && iNewJobOK ) - { - iDpsEngine->DoDpsRequestL( &iStart, iStatus ); - iState = EPBSubmittingJob; - SetActive(); - LOG("CPBPrintingDevice::SubmitPrintJobL setting state to SubmittingJob"); - } - else - { - LOG1("CPBPrintingDevice::SubmitPrintJobL invalid state %d", iState); - if( iDisconnectPrinter ) - { - User::Leave( KErrDisconnected ); - } - else - { - // Job or printer not ready, inform user - if( iPrintEventObserver ) - { - LOG("CPBPrintingDevice::SubmitPrintJobL sending EPbStatusErrorReasonHardwarePrinterBusy message to UI"); - iPrintEventObserver->PrinterStatusEvent( EPbStatusErrorReasonHardwarePrinterBusy ); - } - else - { - LOG1("CPBPrintingDevice::SubmitPrintJobL invalid state %d", iState); - User::Leave( KErrInvalidSequence ); - } - } - - } - - LOG("CPBPrintingDevice::SubmitPrintJobL end"); - } - -TInt CPBPrintingDevice::CancelPrintJob() - { - LOG("CPBPrintingDevice::CancelPrintJob begin"); - - if( iCancelRetry > KMaxRetry ) - { - return KErrInUse; - } - - if ( iState == EPBSubmittingJob || iState == EPBPrinting || iState == EPBCancelling ) - { - Cancel(); - iAbort.iReqParam.iAbortStyle = EDpsAbortStyleImmediately; - TRAPD( err, iDpsEngine->DoDpsRequestL( &iAbort, iStatus ) ); - if ( err != KErrNone ) - { - LOG1("CPBPrintingDevice::CancelPrintJob FATAL, DoDpsRequestL failed %d, setting state to Uninitialized", err); - iState = EPBUninitialized; - return KErrGeneral; - } - iState = EPBCancelling; - SetActive(); - LOG("CPBPrintingDevice::CancelPrintJob setting state to Cancelling"); - } - else if ( iState == EPBJobReady ) - { - LOG("CPBPrintingDevice::CancelPrintJob state is JobReady so doing nothing"); - return KErrNone; - } - else - { - LOG1("CPBPrintingDevice::CancelPrintJob invalid state %d", iState); - return KErrInvalidSequence; - } - - LOG("CPBPrintingDevice::CancelPrintJob end"); - return KErrNone; - } - -TInt CPBPrintingDevice::ContinuePrintJobL() - { - LOG1("CPBPrintingDevice::ContinuePrintJobL returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CPBPrintingDevice::GetNumPrintPages() - { - LOG("CPBPrintingDevice::GetNumPrintPages begin"); - - if ( iState != EPBJobReady && iState != EPBSubmittingJob && iState != EPBPrinting ) - { - LOG1("CPBPrintingDevice::GetNumPrintPages invalid state %d, returning 0", iState); - return 0; - } - - TInt imagesPerPage = 1; - TDpsArgsInt& config = iStart.iReqParam.iJobConfig[EPBSettingLayout]; - switch ( config.iContent ) - { - case EDpsLayout2Up: - imagesPerPage = 2; - break; - case EDpsLayout4Up: - imagesPerPage = 4; - break; - case EDpsLayout6Up: - imagesPerPage = 6; - break; - case EDpsLayout9Up: - imagesPerPage = 9; - break; - default: - break; - } - - TInt numPrintPages = (iStart.iReqParam.iPrintInfo.Count() + imagesPerPage - 1) / imagesPerPage; - LOG1("CPBPrintingDevice::GetNumPrintPages end, result %d", numPrintPages); - return numPrintPages; - } - -TInt CPBPrintingDevice::GetPrintJobStatus() - { - LOG1("CPBPrintingDevice::GetPrintJobStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CPBPrintingDevice::GetPrinterStatus(TInt /*aDeviceID*/) - { - LOG1("CPBPrintingDevice::GetPrinterStatus returns with: %d", KErrNotSupported); - return KErrNotSupported; - } - -TInt CPBPrintingDevice::GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs) - { - LOG1("CPBPrintingDevice::GetDeviceCapabilityIDsL begins with aDeviceID: %d", aDeviceID); - - if ( aDeviceID != 0 ) - { - LOG("CPBPrintingDevice::GetDeviceCapabilityL invalid device"); - return KErrArgument; - } - - if ( iState != EPBReady && iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::GetDeviceCapabilityL invalid state %d", iState); - return KErrInvalidSequence; - } - - aCapabilityIDs.Append( EPrintCapabLayout ); - aCapabilityIDs.Append( EPrintCapabQuality ); - aCapabilityIDs.Append( EPrintCapabPaperSize ); - - LOG("CPBPrintingDevice::GetDeviceCapabilityIDsL end"); - return KErrNone; - } - -TInt CPBPrintingDevice::GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability) - { - LOG2("CPBPrintingDevice::GetDeviceCapabilityL begins with aDeviceID %d, aCapabilityID %d", aDeviceID, aCapabilityID); - - if ( aDeviceID != 0 ) - { - LOG("CPBPrintingDevice::GetDeviceCapabilityL invalid device"); - return KErrArgument; - } - - if ( iState != EPBReady && iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::GetDeviceCapabilityL invalid state %d", iState); - return KErrInvalidSequence; - } - - if ( aCapabilityID == EPrintCapabPaperSize ) - { - // paper sizes - iCap.iRepParam.Reset(); - iCap.iReqParam.iCap = EDpsArgPaperSizes; - iDpsEngine->DoDpsRequestL(&iCap, iStatus); - SetActive(); - iWait.Start(); - HandlePapersizesResponseL( aCapability ); - - if ( !aCapability.iEnumCount ) - { - LOG("CPBPrintingDevice::GetDeviceCapabilityL paper sizes not supported, set to default"); - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSizeAuto; - iCapToDps.InsertL( EPrintCapabPaperSizeAuto, EDpsPaperSizeDefault ); - } - } - else if ( aCapabilityID == EPrintCapabQuality ) - { - // qualities - LOG("CPBPrintingDevice::GetDeviceCapabilityL qualities"); - iCap.iRepParam.Reset(); - iCap.iReqParam.iCap = EDpsArgQualities; - iDpsEngine->DoDpsRequestL( &iCap, iStatus ); - SetActive(); - iWait.Start(); - HandleQualitiesResponseL( aCapability ); - } - else if ( aCapabilityID == EPrintCapabLayout ) - { - // layouts - LOG("CPBPrintingDevice::GetDeviceCapabilityL layouts"); - iCap.iRepParam.Reset(); - iCap.iReqParam.iCap = EDpsArgLayouts; - iCap.iReqParam.iAttribute = iUserSelectedPaperSize; - LOG("CPBPrintingDevice::GetDeviceCapabilityL layouts dodpsrequest"); - iDpsEngine->DoDpsRequestL(&iCap, iStatus); - SetActive(); - LOG("CPBPrintingDevice::GetDeviceCapabilityL layouts wait"); - iWait.Start(); - HandleLayoutsResponseL( aCapability ); - } - else - { - LOG("CPBPrintingDevice::GetDeviceCapabilityL invalid capabilityID"); - return KErrArgument; - } - - LOG1("CPBPrintingDevice::GetDeviceCapabilityL iCapToDps count %d", iCapToDps.Count()); - - LOG("CPBPrintingDevice::GetDeviceCapabilityL end"); - return KErrNone; - } - -TInt CPBPrintingDevice::GetJobSetting(TInt aCapabilityID, TInt& aValue) - { - LOG1("CPBPrintingDevice::GetJobSetting begin, aCapabilityID %d", aCapabilityID); - - TInt err = KErrNone; - if ( iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::GetJobSetting invalid state %d", iState); - err = KErrInvalidSequence; - } - else if ( aCapabilityID == EPrintCapabPaperSize ) - { - err = GetPapersizeJobSetting( aValue ); - } - else if ( aCapabilityID == EPrintCapabQuality ) - { - err = GetQualityJobSetting( aValue ); - } - else if ( aCapabilityID == EPrintCapabLayout ) - { - err = GetLayoutJobSetting( aValue ); - } - else - { - LOG("CPBPrintingDevice::GetJobSetting invalid capabilityID"); - err = KErrArgument; - } - - LOG2("CPBPrintingDevice::GetJobSetting end, return code %d value %d", err, aValue); - return err; - } - -TInt CPBPrintingDevice::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - LOG2("CPBPrintingDevice::SetJobSettingL begin, aCapabilityID %d aValue %d", aCapabilityID, aValue); - - aAffectedCapability = aCapabilityID; - - RArray& config = iStart.iReqParam.iJobConfig; - TInt err = KErrNone; - if ( iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::SetJobSettingL invalid state %d", iState); - err = KErrInvalidSequence; - } - else if ( aCapabilityID == EPrintCapabPaperSize ) - { - TInt* dpsValue = iCapToDps.Find( aValue ); - if ( dpsValue ) - { - config[EPBSettingPaperSize].iContent = *dpsValue; - - // for CertSW: needs layouts for particular paper sizes - iUserSelectedPaperSize = config[EPBSettingPaperSize].iContent; - } - else - { - LOG("CPBPrintingDevice::SetJobSettingL invalid value"); - err = KErrInvalidData; - } - } - else if ( aCapabilityID == EPrintCapabQuality ) - { - TInt* dpsValue = iCapToDps.Find( aValue ); - if ( dpsValue ) - { - config[EPBSettingQuality].iContent = *dpsValue; - } - else - { - LOG("CPBPrintingDevice::SetJobSettingL invalid value"); - err = KErrInvalidData; - } - } - else if ( aCapabilityID == EPrintCapabLayout ) - { - TInt* dpsValue = iCapToDps.Find( aValue ); - if ( dpsValue ) - { - config[EPBSettingLayout].iContent = *dpsValue; - } - else - { - LOG("CPBPrintingDevice::SetJobSettingL invalid value"); - err = KErrInvalidData; - } - } - else - { - LOG("CPBPrintingDevice::SetJobSettingL invalid capabilityID"); - err = KErrArgument; - } - - LOG1("CPBPrintingDevice::SetJobSettingL end, return code %d", err); - return err; - } - - -TInt CPBPrintingDevice::GetNumPreviewPages() - { - LOG1("CPBPrintingDevice::GetNumPreviewPages ends with: %d", 1); - return 1; - } - -TInt CPBPrintingDevice::GetJobTemplateIconL( TInt /*aTemplateID*/, TInt& /*aFsBitmapHandle*/ ) - { - return KErrNone; - } - - -TInt CPBPrintingDevice::CreatePreviewImage(TInt /*aPageNumber*/) - { - return KErrNotSupported; - } - -void CPBPrintingDevice::RegisterIdleObserver( MProtIdleObserver *aObserver ) - { - iIdleObserver = aObserver; - } - -void CPBPrintingDevice::DoCancel() - { - iDpsEngine->CancelDpsRequest(); - if ( iWait.IsStarted() ) - { - LOG("CPBPritingDevice::DoCancel() calling iWait.AsyncStop()"); - iWait.AsyncStop(); - } - } - -void CPBPrintingDevice::RunL() - { - LOG2("CPBPrintingDevice::RunL begin, status %d state %d", iStatus.Int(), iState); - - if ( iWait.IsStarted() ) - { - LOG("CPBPrintingDevice::RunL calling iWait.AsyncStop() and returning"); - iWait.AsyncStop(); - return; - } - - if ( iStatus.Int() == KErrNone ) // everything ok - { - switch( iState ) - { - case EPBDiscovery: - { - iPrinter.iPrinterID = 0; - iPrinter.iProtocol = KImagePrint_PrinterProtocol_PictBridge; - iPrinter.iProperties = 0; - - if( iConfigS.iResult.iMajorCode == EDpsResultOk ) - { - iPrinter.iVendor = TPrinter::EVendorNone; - - HBufC* buf = HBufC::NewLC( iConfigS.iRepParam.iProductName.Length() ); - TPtr p = buf->Des(); - p.Copy( iConfigS.iRepParam.iProductName ); - if ( p.Length() > 84 ) - { - TPtrC p2 = p.Left( 84 ); - iPrinter.iDisplayName = p2; - } - else - { - iPrinter.iDisplayName = p; - } - - CleanupStack::PopAndDestroy( buf ); - LOG1("CPBPrinterDevice::RunL config displayname %S", &iPrinter.iDisplayName); - - // Config info have to be saved in file, because it can retrieved only once - // when cable is plugged in the device - SaveConfigInfoL(); - } - - if( iConfigS.iResult.iMajorCode == EDpsResultNotExecuted ) - { - // Read info from file - ReadConfigInfoL(); - } - - iDiscoveryObserver->FoundDeviceL( iPrinter ); - iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrNone, 0 ); - iState = EPBReady; - - // Close Dps request to avoid -14 error - iDpsEngine->CancelDpsRequest(); - iDpsEngine->CancelDpsEventNotify(); - - LOG("CPBPrintingDevice::RunL setting state to Ready"); - break; - } - case EPBSubmittingJob: - LOG2("CPBPrintingDevice::RunL submittingjob result major 0x%x minor 0x%x", iStart.iResult.iMajorCode, iStart.iResult.iMinorCode); - if ( iStart.iResult.iMajorCode == EDpsResultOk ) - { - LOG("CPBPrintingDevice::RunL setting state to Printing"); - iState = EPBPrinting; - - // for Cert software remove dialog from UI - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ENoMessage ); - } - else - { - LOG("CPBPrintingDevice::RunL error occurred, setting state to JobReady"); - iState = EPBJobReady; - if ( iPrintEventObserver ) - { - TPrintMessageCodes err = EPbStatusErrorReasonNoReason; - if ( iStart.iResult.iMajorCode == EDpsResultNotSupported && - iStart.iResult.iMinorCode == EDpsResultMissingParam ) - { - // image file is probably missing - err = EPbFileNotFound; - } - iPrintEventObserver->PrinterStatusEvent( err ); - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ECancelling ); - } - } - break; - case EPBCancelling: - LOG2("CPBPrintingDevice::RunL cancelling result major 0x%x minor 0x%x", iAbort.iResult.iMajorCode, iAbort.iResult.iMinorCode); - - if( iAbort.iResult.iMajorCode == EDpsResultNotExecuted ) - { - iCancelRetry++; - CancelPrintJob(); - } - - if( iAbort.iResult.iMajorCode == EDpsResultOk ) - { - if ( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ECancelling ); - } - - LOG("CPBPrintingDevice::RunL setting state to JobReady"); - iState = EPBJobReady; - iCancelRetry = 0; - } - break; - default: - LOG1("CPBPrintingDevice::RunL unrecognized state %d", iState); - break; - } - } - else // iStatus != KErrNone -> Handle error here - { - switch( iStatus.Int() ) - { - case KErrTimedOut: - LOG( "CPBPrintingDevice::RunL KErrTimedOut" ); - if ( iPrintEventObserver ) - { - LOG("CPBPrintingDevice::Timeout, finish printing..."); - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ECancelling ); - } - break; - default: - // Handle error here. - LOG2( "CPBPrintingDevice::RunL error, status %d state %d", iStatus.Int(), iState ); - break; - } - } - - LOG("CPBPrintingDevice::RunL end"); - } - -TInt CPBPrintingDevice::RunError( TInt aError ) - { - LOG1("CPBPrintingDevice::RunError code %d", aError); - if ( iWait.IsStarted() ) - { - LOG("CPBPrintingDevice::RunError calling iWait.AsyncStop()"); - iWait.AsyncStop(); - } - return KErrNone; - } - - -void CPBPrintingDevice::SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ) - { - LOG("CPBPrintingDevice::SetNumsOfCopiesL begin"); - - if ( iState != EPBJobReady ) - { - LOG1("CPBPrintingDevice::SetNumsOfCopiesL invalid state %d", iState); - aErr = KErrInvalidSequence; - } - else if ( aNumsOfCopies.Count() != iStart.iReqParam.iPrintInfo.Count() ) - { - LOG2("CPBPrintingDevice::SetNumsOfCopiesL counts don't match, %d %d", aNumsOfCopies.Count(), iStart.iReqParam.iPrintInfo.Count()); - aErr = KErrInvalidData; - } - else - { - for ( TInt i = 0; i < aNumsOfCopies.Count(); ++i ) - { - iStart.iReqParam.iPrintInfo[i].iCopies = aNumsOfCopies[i]; - } - aErr = KErrNone; - } - - LOG("CPBPrintingDevice::SetNumsOfCopiesL end"); - } - - -void CPBPrintingDevice::ConnectionNotifyL( TInt aStatus ) - { - LOG2("CPBPrintingDevice::ConnectionNotifyL begin, status %d iState %d", aStatus, iState); - switch ( aStatus ) - { - case CDpsEngine::ENotConnected: - LOG("CPBPrintingDevice::ConnectionNotify not connected"); - break; - case CDpsEngine::EPrinterConnected: - LOG("CPBPrintingDevice::ConnectionNotifyL printer connected"); - iPrinterConnected = ETrue; - iDisconnectPrinter = EFalse; - if ( iIdleObserver ) - { - LOG("CPBPrintingDevice::ConnectionNotifyL informing idle observer about connect"); - TEvent event = { KImagePrint_PrinterProtocol_PictBridge, ENotSpecified, EConnect }; - iIdleObserver->StatusEvent( event, KErrConnected, ENoMessage ); - } - break; - case CDpsEngine::EPrinterDisconnected: - iPrinterConnected = EFalse; - iDisconnectPrinter = ETrue; - if ( iState != EPBUninitialized ) - { - Cancel(); - if ( iState == EPBDiscovery ) - { - //We're not interested if the call back leaves - TRAP_IGNORE( iDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, KErrNone, 0 ) ); - } - LOG("CPBPrintingDevice::ConnectionNotifyL printer disconnected, setting state to Uninitialized"); - iState = EPBUninitialized; - } - if ( iIdleObserver ) - { - LOG("CPBPrintingDevice::ConnectionNotifyL informing idle observer about disconnect"); - TEvent event = { KImagePrint_PrinterProtocol_PictBridge, ENotSpecified, EDisconnect }; - iIdleObserver->StatusEvent( event, KErrDisconnected, ENoMessage ); - } - break; - case CDpsEngine::EOtherConnected: - LOG("CPBPrintingDevice::ConnectionNotify other connected"); - break; - case CDpsEngine::EWrongPrintModeConnected: - LOG("CPBPrintingDevice::ConnectionNotify Other personality"); - iPrinterConnected = ETrue; - iDisconnectPrinter = EFalse; - if ( iIdleObserver ) - { - LOG("CPBPrintingDevice::ConnectionNotifyL informing idle observer about connect"); - TEvent event = { KImagePrint_PrinterProtocol_PictBridge, ENotSpecified, EConnect }; - iIdleObserver->StatusEvent( event, KErrConnected, ENoMessage ); - } - break; - default: - LOG1("CPBPrintingDevice::ConnectionNotifyL unrecognized status %d", aStatus); - break; - } - LOG("CPBPrintingDevice::ConnectionNotifyL end"); - } - -void CPBPrintingDevice::JobNotify( const TDpsGetJobStatus& aStatus ) - { - LOG1("CPBPrintingDevice::JobNotify begin, state %d", iState); - LOG2("CPBPrintingDevice::JobNotify progress %d, prtPID %d", aStatus.iRepParam.iProgress, aStatus.iRepParam.iPrtPID); - LOG1("CPBPrintingDevice::JobNotify copyID %d", aStatus.iRepParam.iCopyID); - LOG2("CPBPrintingDevice::JobNotify filepath %S, images printed %d", &aStatus.iRepParam.iFilePath, aStatus.iRepParam.iImagesPrinted); - - if ( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobProgressEvent( EActive, aStatus.iRepParam.iProgress, ENoMessage ); - } - - LOG("CPBPrintingDevice::JobNotify end"); - } - -void CPBPrintingDevice::PrinterNotify( const TDpsGetPrinterStatus& aStatus ) - { - LOG1("CPBPrintingDevice::PrinterNotify begin, state %d", iState ); - LOG2("CPBPrintingDevice::PrinterNotify service status 0x%x, job status 0x%x", aStatus.iRepParam.iPrintStatus, aStatus.iRepParam.iJobStatus); - LOG2("CPBPrintingDevice::PrinterNotify error status 0x%x, job end reason 0x%x", aStatus.iRepParam.iErrorStatus, aStatus.iRepParam.iJobEndReason.iMajor); - LOG1("CPBPrintingDevice::PrinterNotify aStatus.iRepParam.iNewJobOk 0x%x,", aStatus.iRepParam.iNewJobOk); - - // New job checking that job is ok and device status is ok. - iNewJobOK = aStatus.iRepParam.iNewJobOk; - - TPBProtocolState oldState = iState; - if ( iState == EPBPrinting ) - { - // for SWCert software to indicate that printing state has executed - iPrintingStateComplete = 1; - - if ( aStatus.iRepParam.iJobStatus == EDpsJobStatusEndedOk ) - { - LOG("CPBPrintingDevice::PrinterNotify job finished successfully, setting state to JobReady"); - if ( iPrintEventObserver ) - { - LOG("CPBPrintingDevice::PrinterNotify job finished iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ENoMessage );"); - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ENoMessage ); - } - iState = EPBJobReady; - } - else if ( aStatus.iRepParam.iJobStatus != EDpsJobStatusNotEnded ) - { - LOG("CPBPrintingDevice::PrinterNotify job aborted, setting state to JobReady"); - if ( iPrintEventObserver ) - { - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ECancelling ); - } - iState = EPBJobReady; - } - } - - if ( iState == EPBJobReady ) - { - // for Cert software: CertSW doesn't give any indication about aStatus.iRepParam.iJobStatus - // it only indicate printer state. We have to send message to UI to remove generig progress bar. - if ( aStatus.iRepParam.iPrintStatus == EDpsPrintServiceStatusIdle && iPrintingStateComplete ) - { - // for Cert software to indicate that idle state has executed - iPrintingStateComplete = 0; - - if ( iPrintEventObserver ) - { - LOG("CPBPrintingDevice::PrinterNotify job finished iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ENoMessage );"); - - // for Cert software remove dialog from UI - iPrintEventObserver->PrintJobProgressEvent( EDone, 100, ENoMessage ); - } - } - } - - if ( !iPrintEventObserver ) - { - LOG("CPBPrintingDevice::PrinterNotify no event observer, returning"); - return; - } - - TPrintMessageCodes err = DpsJobError( aStatus.iRepParam.iJobEndReason ); - if ( err == ENoMessage && aStatus.iRepParam.iErrorStatus == EDpsErrorStatusFatal ) - { - // Show fatal error - err = EPbStatusErrorReasonHardwareFatal; - } - - if ( err == ENoMessage && aStatus.iRepParam.iErrorStatus == EDpsErrorStatusWarning ) - { - // Show warning - err = EPbStatusErrorReasonWarning; - } - - if ( err != ENoMessage ) - { - if ( oldState == EPBPrinting ) - { - LOG1("CPBPrintingDevice::PrinterNotify calling PrintJobErrorEvent with code %d", err); - iPrintEventObserver->PrintJobErrorEvent( err ); - } - else - { - LOG1("CPBPrintingDevice::PrinterNotify calling PrinterStatusEvent with code %d", err); - iPrintEventObserver->PrinterStatusEvent( err ); - } - } - - LOG("CPBPrintingDevice::PrinterNotify end"); - } - -void CPBPrintingDevice::HandlePapersizesResponseL( TPrintCapability& aCapability ) - { - LOG2("CPBPrintingDevice::HandlePapersizesResponseL result major 0x%x minor 0x%x", iCap.iResult.iMajorCode, iCap.iResult.iMinorCode); - LOG2("CPBPrintingDevice::HandlePapersizesResponseL cap 0x%x count %d", iCap.iRepParam.iCap, iCap.iRepParam.iContent.Count()); - - aCapability.iCapabilityID = EPrintCapabPaperSize; - aCapability.iType = TPrintCapability::Int; - aCapability.iDefaultValue = EPrintCapabPaperSizeAuto; - aCapability.iEnumCount = 0; - - if ( iCap.iResult.iMajorCode == EDpsResultOk ) - { - for ( TInt i = 0; i < iCap.iRepParam.iContent.Count() && aCapability.iEnumCount < KMaxEnumAmount; ++i ) - { - LOG1("CPBPrintingDevice::HandlePapersizesResponseL content 0x%x", iCap.iRepParam.iContent[i]); - switch ( iCap.iRepParam.iContent[i] ) - { - case EDpsPaperSizeDefault: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSizeAuto; - iCapToDps.InsertL( EPrintCapabPaperSizeAuto, EDpsPaperSizeDefault ); - break; - case EDpsPaperSizeLetter: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSizeLetter; - iCapToDps.InsertL( EPrintCapabPaperSizeLetter, EDpsPaperSizeLetter ); - break; - case EDpsPaperSizeA4: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSizeA4; - iCapToDps.InsertL( EPrintCapabPaperSizeA4, EDpsPaperSizeA4 ); - break; - case EDpsPaperSizeA6: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSizeA6; - iCapToDps.InsertL( EPrintCapabPaperSizeA6, EDpsPaperSizeA6 ); - break; - case EDpsPaperSize4x6: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSize4x6; - iCapToDps.InsertL( EPrintCapabPaperSize4x6, EDpsPaperSize4x6 ); - break; - case EDpsPaperSize2L: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabPaperSize5x7; - iCapToDps.InsertL( EPrintCapabPaperSize5x7, EDpsPaperSize2L ); - break; - default: - break; - } - } - } - } - - -void CPBPrintingDevice::HandleQualitiesResponseL( TPrintCapability& aCapability ) - { - LOG2("CPBPrintingDevice::HandleQualitiesResponseL result major 0x%x minor 0x%x", iCap.iResult.iMajorCode, iCap.iResult.iMinorCode); - LOG2("CPBPrintingDevice::HandleQualitiesResponseL cap 0x%x count %d", iCap.iRepParam.iCap, iCap.iRepParam.iContent.Count()); - - aCapability.iCapabilityID = EPrintCapabQuality; - aCapability.iType = TPrintCapability::Int; - aCapability.iDefaultValue = EPrintCapabQualityDefault; - aCapability.iEnumCount = 0; - - if ( iCap.iResult.iMajorCode == EDpsResultOk ) - { - for ( TInt i = 0; i < iCap.iRepParam.iContent.Count() && aCapability.iEnumCount < KMaxEnumAmount; ++i ) - { - LOG1("CPBPrintingDevice::HandleQualitiesResponseL content 0x%x", iCap.iRepParam.iContent[i]); - switch ( iCap.iRepParam.iContent[i] ) - { - case EDpsPrintQualityDefault: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabQualityDefault; - iCapToDps.InsertL( EPrintCapabQualityDefault, EDpsPrintQualityDefault ); - break; - case EDpsPrintQualityNormal: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabQualityNormal; - iCapToDps.InsertL( EPrintCapabQualityNormal, EDpsPrintQualityNormal ); - break; - case EDpsPrintQualityDraft: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabQualityDraft; - iCapToDps.InsertL( EPrintCapabQualityDraft, EDpsPrintQualityDraft ); - break; - case EDpsPrintQualityFine: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabQualityFine; - iCapToDps.InsertL( EPrintCapabQualityFine, EDpsPrintQualityFine ); - break; - default: - break; - } - } - } - if ( !aCapability.iEnumCount ) - { - LOG("CPBPrintingDevice::HandleQualitiesResponseL not supported, set to default"); - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabQualityDefault; - iCapToDps.InsertL( EPrintCapabQualityDefault, EDpsPrintQualityDefault ); - } - } - -void CPBPrintingDevice::HandleLayoutsResponseL( TPrintCapability& aCapability ) - { - LOG2("CPBPrintingDevice::HandleLayoutsResponseL result major 0x%x minor 0x%x", iCap.iResult.iMajorCode, iCap.iResult.iMinorCode); - LOG2("CPBPrintingDevice::HandleLayoutsResponseL cap 0x%x count %d", iCap.iRepParam.iCap, iCap.iRepParam.iContent.Count()); - - aCapability.iCapabilityID = EPrintCapabLayout; - aCapability.iType = TPrintCapability::Int; - aCapability.iDefaultValue = EPrintCapabLayout1Up; - aCapability.iEnumCount = 0; - - if ( iCap.iResult.iMajorCode == EDpsResultOk ) - { - for ( TInt i = 0; i < iCap.iRepParam.iContent.Count() && aCapability.iEnumCount < KMaxEnumAmount; ++i ) - { - LOG1("CPBPrintingDevice::HandleLayoutsResponseL content 0x%x", iCap.iRepParam.iContent[i]); - switch ( iCap.iRepParam.iContent[i] ) - { - case EDpsLayout1Up: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout1Up; - iCapToDps.InsertL( EPrintCapabLayout1Up, EDpsLayout1Up ); - break; - case EDpsLayout2Up: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout2Up; - iCapToDps.InsertL( EPrintCapabLayout2Up, EDpsLayout2Up ); - break; - case EDpsLayout4Up: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout4Up; - iCapToDps.InsertL( EPrintCapabLayout4Up, EDpsLayout4Up ); - break; - case EDpsLayout6Up: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout6Up; - iCapToDps.InsertL( EPrintCapabLayout6Up, EDpsLayout6Up ); - break; - case EDpsLayout9Up: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout9Up; - iCapToDps.InsertL( EPrintCapabLayout9Up, EDpsLayout9Up ); - break; - // do not support this EDpsLayoutBorderless, set default value - case EDpsLayoutBorderless: - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout1UpBorderless; - iCapToDps.InsertL( EPrintCapabLayout1UpBorderless, EDpsLayoutDefault ); - break; - default: - break; - } - } - } - if ( !aCapability.iEnumCount ) - { - LOG("CPBPrintingDevice::HandleLayoutsResponseL not supported, set to default"); - aCapability.iEnumCodes[aCapability.iEnumCount++] = EPrintCapabLayout1Up; - iCapToDps.InsertL( EPrintCapabLayout1Up, EDpsLayoutDefault ); - } - } - -TInt CPBPrintingDevice::GetPapersizeJobSetting( TInt& aValue ) - { - LOG("CPBPrintingDevice::GetPapersizeJobSetting begin"); - - TDpsArgsInt& paper = iStart.iReqParam.iJobConfig[EPBSettingPaperSize]; - switch ( paper.iContent ) - { - case EDpsPaperSizeDefault: - aValue = EPrintCapabPaperSizeAuto; - return KErrNone; - case EDpsPaperSizeLetter: - aValue = EPrintCapabPaperSizeLetter; - return KErrNone; - case EDpsPaperSizeA4: - aValue = EPrintCapabPaperSizeA4; - return KErrNone; - case EDpsPaperSizeA6: - aValue = EPrintCapabPaperSizeA6; - return KErrNone; - case EDpsPaperSize4x6: - aValue = EPrintCapabPaperSize4x6; - return KErrNone; - case EDpsPaperSize2L: - aValue = EPrintCapabPaperSize5x7; - return KErrNone; - default: - LOG1("CPBPrintingDevice::GetPapersizeJobSetting unknown %x", paper.iContent); - break; - } - - LOG("CPBPrintingDevice::GetPapersizeJobSetting end"); - return KErrInvalidData; - } - -TInt CPBPrintingDevice::GetQualityJobSetting( TInt& aValue ) - { - LOG("CPBPrintingDevice::GetQualityJobSetting begin"); - - TDpsArgsInt& config = iStart.iReqParam.iJobConfig[EPBSettingQuality]; - switch ( config.iContent ) - { - case EDpsPrintQualityDefault: - aValue = EPrintCapabQualityDefault; - return KErrNone; - case EDpsPrintQualityNormal: - aValue = EPrintCapabQualityNormal; - return KErrNone; - case EDpsPrintQualityDraft: - aValue = EPrintCapabQualityDraft; - return KErrNone; - case EDpsPrintQualityFine: - aValue = EPrintCapabQualityFine; - return KErrNone; - default: - LOG1("CPBPrintingDevice::GetQualityJobSetting unknown %x", config.iContent); - break; - } - - LOG("CPBPrintingDevice::GetQualityJobSetting end"); - return KErrInvalidData; - } - -TInt CPBPrintingDevice::GetLayoutJobSetting( TInt& aValue ) - { - LOG("CPBPrintingDevice::GetLayoutJobSetting begin"); - - TDpsArgsInt& config = iStart.iReqParam.iJobConfig[EPBSettingLayout]; - switch ( config.iContent ) - { - case EDpsLayoutDefault: - // Not supported default value is EPrintCapabLayout1UpBorderless - // because other protocols use it too - // EPrintCapabLayout1UpBorderless is mapped with EDpsLayoutDefault - aValue = EPrintCapabLayout1UpBorderless; - case EDpsLayout1Up: - aValue = EPrintCapabLayout1Up; - return KErrNone; - case EDpsLayout2Up: - aValue = EPrintCapabLayout2Up; - return KErrNone; - case EDpsLayout4Up: - aValue = EPrintCapabLayout4Up; - return KErrNone; - case EDpsLayout6Up: - aValue = EPrintCapabLayout6Up; - return KErrNone; - case EDpsLayout9Up: - aValue = EPrintCapabLayout9Up; - return KErrNone; - case EDpsLayoutBorderless: - aValue = EPrintCapabLayout1UpBorderless; - return KErrNone; - default: - LOG1("CPBPrintingDevice::GetLayoutJobSetting unknown %x", config.iContent); - break; - } - - LOG("CPBPrintingDevice::GetLayoutJobSetting end"); - return KErrInvalidData; - } - -TPrintMessageCodes CPBPrintingDevice::DpsJobError( const TDpsJobEndReason& aReason ) - { - TPrintMessageCodes err = ENoMessage; - switch ( aReason.iMajor ) - { - case EDpsJobErrorPaper: - LOG1("CPBPrintingDevice::DpsJobError paper error 0x%x", aReason.iPaperMinor); - HandlePaperError( aReason, err ); - break; - case EDpsJobErrorInk: - LOG1("CPBPrintingDevice::DpsJobError ink error 0x%x", aReason.iInkMinor); - HandleInkError( aReason, err ); - break; - case EDpsJobErrorHardware: - LOG1("CPBPrintingDevice::DpsJobError hardware error 0x%x", aReason.iHardMinor); - HandleHwError( aReason, err ); - break; - case EDpsJobErrorFile: - LOG1("CPBPrintingDevice::DpsJobError file error 0x%x", aReason.iFileMinor); - HandleFileError( aReason, err ); - break; - default: - break; - } - return err; - } -void CPBPrintingDevice::HandlePaperError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ) - { - switch ( aReason.iPaperMinor ) - { - case EDpsPaperEmpty: - aErr = EPbStatusErrorReasonPaperEmpty; - break; - case EDpsPaperLoad: - aErr = EPbStatusErrorReasonPaperLoad; - break; - case EDpsPaperEject: - aErr = EPbStatusErrorReasonPaperEject; - break; - case EDpsPaperMedia: - aErr = EPbStatusErrorReasonPaperMedia; - break; - case EDpsPaperJam: - aErr = EPbStatusErrorReasonPaperJam; - break; - case EDpsPaperNearlyEmpty: - aErr = EPbStatusErrorReasonPaperNearlyEmpty; - break; - case EDpsPaperTypeSizeNoMatch: - aErr = EPbStatusErrorReasonPaperCombination; - break; - default: - aErr = EPbStatusErrorReasonPaper; - break; - } - } - -void CPBPrintingDevice::HandleInkError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ) - { - switch ( aReason.iInkMinor ) - { - case EDpsInkEmpty: - aErr = EPbStatusErrorReasonInkEmpty; - break; - case EDpsInkLow: - aErr = EPbStatusErrorReasonInkLow; - break; - case EDpsInkWaste: - aErr = EPbStatusErrorReasonInkWaste; - break; - default: - aErr = EPbStatusErrorReasonInk; - break; - } - } - -void CPBPrintingDevice::HandleHwError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ) - { - switch ( aReason.iHardMinor ) - { - case EDpsHardFatal: - aErr = EPbStatusErrorReasonHardwareFatal; - break; - case EDpsHardServiceCall: - aErr = EPbStatusErrorReasonHardwareServiceCall; - break; - case EDpsHardNotAvailable: - aErr = EPbStatusErrorReasonHardwarePrinterUnavailable; - break; - case EDpsHardBusy: - aErr = EPbStatusErrorReasonHardwarePrinterBusy; - break; - case EDpsHardLever: - aErr = EPbStatusErrorReasonHardwareLever; - break; - case EDpsHardCoverOpen: - aErr = EPbStatusErrorReasonHardwareCoverOpen; - break; - case EDpsHardNoMarkingHead: - aErr = EPbStatusErrorReasonHardwareNoMarkingAgent; - break; - case EDpsHardInkCoverOpen: - aErr = EPbStatusErrorReasonHardwareCoverOpen; - break; - case EDpsHardNoInkCartridge: - aErr = EPbStatusErrorReasonHardwareNoInkCartridge; - break; - default: - aErr = EPbStatusErrorReasonHardware; - break; - } - } - -void CPBPrintingDevice::HandleFileError ( const TDpsJobEndReason& aReason, TPrintMessageCodes& aErr ) - { - switch ( aReason.iFileMinor ) - { - case EDpsFilePrintInfo: - aErr = EPbStatusErrorReasonFilePrintInfo; - break; - case EDpsFileDecode: - aErr = EPbStatusErrorReasonFileFileDecode; - break; - default: - aErr = EPbStatusErrorReasonFile; - break; - } - } - -TBool CPBPrintingDevice::HasCapability( TPrintCapability& aCapability, TPrintCapabilityOptions aOption ) - { - for ( TInt i = 0; i < aCapability.iEnumCount; ++i ) - { - if ( aCapability.iEnumCodes[i] == aOption ) - { - return ETrue; - } - } - return EFalse; - } - -void CPBPrintingDevice::SaveConfigInfoL() - { - LOG("CPBPrintingDevice::SaveConfigInfoL begin"); - - RFs rFs; - RFile file; - - User::LeaveIfError( rFs.Connect() ); - CleanupClosePushL( rFs ); - - User::LeaveIfError( file.Replace( rFs, iCongFileName->Des() ,EFileWrite ) ); // create the file for writing - - RFileWriteStream stream( file ); - CleanupClosePushL( stream ); - - ExternalizeL( stream ); - - CleanupStack::PopAndDestroy( &stream ); - CleanupStack::PopAndDestroy( &rFs ); - - LOG("CPBPrintingDevice::SaveConfigInfoL end"); - } - -void CPBPrintingDevice::ExternalizeL( RWriteStream& aStream ) const - { - LOG("CPBPrintingDevice::ExternalizeL begin"); - - aStream << iPrinter.iDisplayName; - aStream.WriteUint32L( iPrinter.iVendor ); - aStream.CommitL(); - - LOG("CPBPrintingDevice::ExternalizeL end"); - } - -void CPBPrintingDevice::ReadConfigInfoL() - { - LOG("CPBPrintingDevice::ReadConfigInfoL begin"); - - RFs rFs; - RFile file; - - User::LeaveIfError( rFs.Connect() ); - CleanupClosePushL( rFs ); - - User::LeaveIfError( file.Open( rFs, iCongFileName->Des() ,EFileRead ) ); - - RFileReadStream readStream( file ); - CleanupClosePushL( readStream ); - - readStream >> iPrinter.iDisplayName; - iPrinter.iVendor = readStream.ReadUint32L(); - - CleanupStack::PopAndDestroy( &readStream ); - CleanupStack::PopAndDestroy( &rFs ); - - LOG("CPBPrintingDevice::ReadConfigInfoL end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/main.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/pictbridge2/src/main.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cpbprintingdevice.h" - -// Entry point to the application DLL - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10208A22, CPBPrintingDevice::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/rom/deviceprotocols.iby --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/rom/deviceprotocols.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2004-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 DEVICEPROTOCOLS_IBY -#define DEVICEPROTOCOLS_IBY - -#include - -#ifdef FF_IMAGEPRINT_BT_PROTOCOL -IP_PLUGIN(btprotocol.dll,btprotocol.rsc) -data=DATAZ_\resource\imageprintdata\protocols\btprotocol.rsc resource\imageprintdata\protocols\btprotocol.rsc -DATA=DATAZ_\resource\imageprintdata\protocols\btxmltemplate.txt \resource\imageprintdata\protocols\btxmltemplate.txt -#endif - -#ifdef FF_IMAGEPRINT_MEMORYCARD_PROTOCOL -IP_PLUGIN(dpofprotdll.dll,dpofprotdll.rsc) -#endif - -#ifdef FF_IMAGEPRINT_PICTBRIDGE_PROTOCOL -IP_PLUGIN(pdphotolib.dll,pdphotolib.rsc) -#endif - -#ifdef FF_IMAGEPRINT_UPNP_PROTOCOL -//IP_PLUGIN(upnpprotocol.dll, upnpprotocol.rsc) -#endif - -file=ABI_DIR\IP_DIR\xhtmlfilecomposer.dll SHARED_LIB_DIR\xhtmlfilecomposer.dll -DATA=DATAZ_\resource\imageprintdata\protocols\xhtmltempl\xhtmlfiletemplate.txt \resource\imageprintdata\protocols\xhtmltempl\xhtmlfiletemplate.txt - -#endif // DEVICEPROTOCOLS_IBY - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/bwins/upnpprotocolu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/bwins/upnpprotocolu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - ?CancelJobL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@ABVTDesC8@@@Z @ 2 NONAME ; void CPrinterControlPoint::CancelJobL(class CUpnpDevice *, class TDesC8 const &) - ?GetPrinterAttributesL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@@Z @ 3 NONAME ; void CPrinterControlPoint::GetPrinterAttributesL(class CUpnpDevice *) - ?GetJobAttributesL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@ABVTDesC8@@@Z @ 4 NONAME ; void CPrinterControlPoint::GetJobAttributesL(class CUpnpDevice *, class TDesC8 const &) - ?GetMediaListL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@ABVTDesC8@@1@Z @ 5 NONAME ; void CPrinterControlPoint::GetMediaListL(class CUpnpDevice *, class TDesC8 const &, class TDesC8 const &) - ?GetMarginsL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@ABVTDesC8@@1@Z @ 6 NONAME ; void CPrinterControlPoint::GetMarginsL(class CUpnpDevice *, class TDesC8 const &, class TDesC8 const &) - ?ActionResponseReceivedL@CPrinterControlPoint@@UAEXPAVCUpnpAction@@@Z @ 7 NONAME ; void CPrinterControlPoint::ActionResponseReceivedL(class CUpnpAction *) - ?CancelJobL@CPrinterControlPoint@@QAEXH@Z @ 8 NONAME ; void CPrinterControlPoint::CancelJobL(int) - ?HttpResponseReceivedL@CPrinterControlPoint@@UAEXPAVCUpnpHttpMessage@@@Z @ 9 NONAME ; void CPrinterControlPoint::HttpResponseReceivedL(class CUpnpHttpMessage *) - ?DeviceDisappearedL@CPrinterControlPoint@@UAEXPAVCUpnpDevice@@@Z @ 10 NONAME ; void CPrinterControlPoint::DeviceDisappearedL(class CUpnpDevice *) - ?CreateJobL@CPrinterControlPoint@@QAEHPAVCUpnpDevice@@ABVTDesC8@@11111111H@Z @ 11 NONAME ; int CPrinterControlPoint::CreateJobL(class CUpnpDevice *, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int) - ?NewL@CPrinterControlPoint@@SAPAV1@AAVMPCPObserver@@@Z @ 12 NONAME ; class CPrinterControlPoint * CPrinterControlPoint::NewL(class MPCPObserver &) - ?PrintingFinishedL@CPrinterControlPoint@@QAEXPAVCUpnpDevice@@@Z @ 13 NONAME ; void CPrinterControlPoint::PrintingFinishedL(class CUpnpDevice *) - ?DeviceDiscoveredL@CPrinterControlPoint@@UAEXPAVCUpnpDevice@@@Z @ 14 NONAME ; void CPrinterControlPoint::DeviceDiscoveredL(class CUpnpDevice *) - ??1CPrinterControlPoint@@UAE@XZ @ 15 NONAME ; CPrinterControlPoint::~CPrinterControlPoint(void) - ?StateUpdatedL@CPrinterControlPoint@@UAEXPAVCUpnpService@@@Z @ 16 NONAME ; void CPrinterControlPoint::StateUpdatedL(class CUpnpService *) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/data/010208a27.rss --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/data/010208a27.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 - -// Declares info for UPnP implementation -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x10208A27; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x10208A1E; - implementations = - { - // Info for UPnP Protocol Module - IMPLEMENTATION_INFO - { - implementation_uid = 0x10208A28; - version_no = 1; - display_name = "UPnP"; - default_data = "UPnP"; - opaque_data = ""; - } - }; - } - }; - } diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/data/icon.bmp Binary file ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/data/icon.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/eabi/upnpprotocolu.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/eabi/upnpprotocolu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZN20CPrinterControlPoint10CancelJobLEP11CUpnpDeviceRK6TDesC8 @ 2 NONAME - _ZN20CPrinterControlPoint10CancelJobLEi @ 3 NONAME - _ZN20CPrinterControlPoint10CreateJobLEP11CUpnpDeviceRK6TDesC8S4_S4_S4_S4_S4_S4_S4_S4_i @ 4 NONAME - _ZN20CPrinterControlPoint11GetMarginsLEP11CUpnpDeviceRK6TDesC8S4_ @ 5 NONAME - _ZN20CPrinterControlPoint13GetMediaListLEP11CUpnpDeviceRK6TDesC8S4_ @ 6 NONAME - _ZN20CPrinterControlPoint13StateUpdatedLEP12CUpnpService @ 7 NONAME - _ZN20CPrinterControlPoint17DeviceDiscoveredLEP11CUpnpDevice @ 8 NONAME - _ZN20CPrinterControlPoint17GetJobAttributesLEP11CUpnpDeviceRK6TDesC8 @ 9 NONAME - _ZN20CPrinterControlPoint17PrintingFinishedLEP11CUpnpDevice @ 10 NONAME - _ZN20CPrinterControlPoint18DeviceDisappearedLEP11CUpnpDevice @ 11 NONAME - _ZN20CPrinterControlPoint21GetPrinterAttributesLEP11CUpnpDevice @ 12 NONAME - _ZN20CPrinterControlPoint21HttpResponseReceivedLEP16CUpnpHttpMessage @ 13 NONAME - _ZN20CPrinterControlPoint23ActionResponseReceivedLEP11CUpnpAction @ 14 NONAME - _ZN20CPrinterControlPoint4NewLER12MPCPObserver @ 15 NONAME - _ZN20CPrinterControlPointD0Ev @ 16 NONAME - _ZN20CPrinterControlPointD1Ev @ 17 NONAME - _ZN20CPrinterControlPointD2Ev @ 18 NONAME - _ZTI19CUPnPPrintingDevice @ 19 NONAME ; ## - _ZTI20CPrinterControlPoint @ 20 NONAME ; ## - _ZTI20CUPFileSharingActive @ 21 NONAME ; ## - _ZTV19CUPnPPrintingDevice @ 22 NONAME ; ## - _ZTV20CPrinterControlPoint @ 23 NONAME ; ## - _ZTV20CUPFileSharingActive @ 24 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/group/bld.inf --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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 -WINSCW ARMV5 - -PRJ_EXPORTS - -PRJ_MMPFILES -./upnpprotocol.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/group/upnpprotocol.mmp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/group/upnpprotocol.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -deffile upnpprotocol.def - -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/libc -SYSTEMINCLUDE /epoc32/include/ecom - -// Target information -TARGET upnpprotocol.dll -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x10208A27 - -VENDORID VID_DEFAULT -CAPABILITY CAP_ECOM_PLUGIN - -// Include paths -USERINCLUDE ../inc -USERINCLUDE ../../xhtmlfilecomposer/inc -USERINCLUDE ../../../ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintServer/inc -USERINCLUDE ../../../inc -USERINCLUDE ../../../../clog/inc - -// Sources -SOURCEPATH ../src -SOURCE main.cpp -SOURCE cupfilesharingactive.cpp -SOURCE cupnpprintingdevice.cpp -SOURCE cupprintercontainer.cpp -SOURCE cupprinter.cpp -SOURCE cupprintingjob.cpp -SOURCE cupprintfactory.cpp -SOURCE cupjobstate.cpp -SOURCE cprintercontrolpoint.cpp -SOURCE cjobstateevents.cpp - -// Resources -START RESOURCE ../data/010208a27.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -TARGET upnpprotocol.rsc -END - -// Bitmap -START BITMAP upnpicons.mbm -TARGETPATH resource/imageprintdata/protocols -HEADER -SOURCEPATH ../data -SOURCE c8 icon.bmp -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY bafl.lib -LIBRARY bitmaptransforms.lib -LIBRARY charconv.lib -LIBRARY upnpcontrolpointbase.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY esock.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY insock.lib -LIBRARY upnpipserversutils.lib -LIBRARY upnpserviceframework.lib -LIBRARY upnpavobjects.lib -LIBRARY avmediaserverclient.lib -LIBRARY xhtmlfilecomposer.lib -LIBRARY inetprotutil.lib // for charconversion. - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cjobstateevents.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cjobstateevents.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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: Declares CJobStateEvents class -* -*/ - - -#ifndef CJOBSTATEEVENTS_H -#define CJOBSTATEEVENTS_H - -#include "upconsts.h" - -#define KUPnPMaxReasonLen 50 -typedef TBuf8 TUPnPVariable; - -/* -* @class CJobStateEvents -* @description This class contains the state variables related to the job that is active at printer. -*/ -NONSHARABLE_CLASS(CJobStateEvents) : public CBase -{ - public: - enum TJobStateEvent - { - ENone = 0, - EPrinterState, - EPrinterStateReasons, - EJobIdList, - EJobEndState, - EJobMediaSheetsCompleted, - EContentCompleteList, - EJobAbortState - }; - - public: - - static CJobStateEvents* NewL(); - - static CJobStateEvents* NewLC(); - - static CJobStateEvents* NewL(CJobStateEvents &a); - - static CJobStateEvents* NewLC(CJobStateEvents &a); - - static CJobStateEvents* NewL( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState); - - static CJobStateEvents* NewLC( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState); - - void ConstructL( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState); - - void ConstructL(CJobStateEvents &a); - - ~CJobStateEvents(); - - CJobStateEvents(const CJobStateEvents &a); - - void Delete(); - - void InitL(); - - TBool ChangedEventL(const TDesC8 &aEvent, TJobStateEvent aEnum); - - void ContentCompleteL ( const TDesC8 &aEvent, TBool& aChanged ); - - void JobAbortStateL ( const TDesC8 &aEvent, TBool& aChanged ); - - TBool operator==(const CJobStateEvents &a); - - TBool operator!=(const CJobStateEvents &a); - - protected: - - CJobStateEvents(); - - - public: - HBufC8* iPrinterState; - HBufC8* iPrinterStateReasons; - HBufC8* iJobIdList; - HBufC8* iJobEndState; - HBufC8* iJobMediaSheetsCompleted; - HBufC8* iContentCompleteList; - HBufC8* iJobAbortState; -}; - -#endif // CJOBSTATEEVENTS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cprintercontrolpoint.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cprintercontrolpoint.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +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: Declares CPrinterControlPoint class -* -*/ - - -#ifndef CPRINTERCONTROLPOINT_H -#define CPRINTERCONTROLPOINT_H - -#include - -#include "mpcpobserver.h" -#include "cjobstateevents.h" -#include "upconsts.h" - -class CUpnpDevice; -class CUpnpAction; -class CUpnpHttpMessage; - -enum TPrintService -{ - EServiceNone = 0, - EPrintBasic, - EPrintEnhanced -}; - -// CLASS DECLARATION - -/** -* @brief Declares the CPrinterControlPoint -* -* Prior using the CPrinterControlPoint class, client application has to create -* the network connection for the selected IAP. If connection is not up and -* running, the CDispatcherEngine class construction will fail. -* -* The Printer Control Point starts XHTML folder sharing and printer search when it's constructed. -* -* See UPnP Print Design document for instuctions. -* -* @since Series60 2.0 -*/ -class CPrinterControlPoint : public CUpnpControlPoint//, public MUPnPSecurityObserver - { - public: // Constructors and destructors - - /** - * Create a CPrinterControlPoint object using two phase construction. - * @param aPCPObserver - * @param aFriendlyName Specifies the friendly name of the control point. - * @param aIapId IAP to use. - * @result pointer to created CPrinterControlPoint object. - */ - IMPORT_C static CPrinterControlPoint* NewL( MPCPObserver& aPCPObserver); - - /** - * Destructor. - */ - IMPORT_C ~CPrinterControlPoint(); - - public: // From MUPnPSecurityObserver - /** - * Function informs when file sharing is ready - * @since Series 60 3.0 - */ - - public: - - /** - * Create a print job to the printer. The XHTML-print files must be in folder defined by KUPnPDataPath. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aPrintFile XHTML-Print file's name WITHOUT path (NOTE: path for files defined in KUPnPDataPath) - * @param aCopies Number of copies of the document to be printed for the job. - * @param aSides Specifies how pages are to be imposed upon the sides of a selected medium for the job. - * @param aNumberUp Indicates the number of pages to impose upon a single side. - * @param aOrientationRequest Indicates the desired orientation for printed pages. - * @param aMediaSize Identifies the medium size name and dimensions. - * @param aMediaType Identtifies the medium type. - * @param aPrintQuality Specifies the print quality requested for the job. - * @param aPrintBasic Specifies the service to use for printing. - */ - IMPORT_C TInt CreateJobL( CUpnpDevice* aPrinter, - const TDesC8& aPrintFile, - const TDesC8& aUserName, - const TDesC8& aCopies, - const TDesC8& aSides, - const TDesC8& aNumberUp, - const TDesC8& aOrientationRequest, - const TDesC8& aMediaSize, - const TDesC8& aMediaType, - const TDesC8& aPrintQuality, - TBool aPrintBasic = EFalse ); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aJobId Print job ID of cancelled job. - */ - IMPORT_C void CancelJobL( CUpnpDevice* aPrinter, const TDesC8& aJobId ); - - /** - * Cancel a specified print job. Leaves if printer is invalid. - * @since Series60 3.0 - * @param aSessionId Print job ID of cancelled job. - */ - IMPORT_C void CancelJobL( const TInt aSessionId ); - - /** - * This function is used to query printer attributes. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - */ - IMPORT_C void GetPrinterAttributesL( CUpnpDevice* aPrinter ); - - /** - * This function is used to query job attributes of specified print job. - * @since Series60 3. - * @param aPrinter Printer to be used. - * @param aJobId Print job ID. - */ - IMPORT_C void GetJobAttributesL( CUpnpDevice* aPrinter, const TDesC8& aJobId ); - - /** - * This function is used to query margin information from printers supporting PrintEnhanced:1. - * If printer supports only PrintBasic:1, a function leaves with KErrNotSupported. - * - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aMediaSize - * @param aMediaType - */ - IMPORT_C void GetMarginsL( CUpnpDevice* aPrinter, const TDesC8& aMediaSize, const TDesC8& aMediaType ); - - /** - * Allows a client to determine a valid combinations of MediaType and MediaSize that the printer supports. - * Action is supported only in PrintEnhanced:1. - * If printer supports only PrintBasic:1, a function leaves with KErrNotSupported. - * - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aMediaSize - * @param aMediaType - */ - IMPORT_C void GetMediaListL( CUpnpDevice* aPrinter, const TDesC8& aMediaSize, const TDesC8& aMediaType ); - - - /** - * Informs the control point that printing has finished and the event unsubscription can be done. - * @since Series60 3. - * @param aPrinter Printer to be used. - * @param aJobId Print job ID. - */ - IMPORT_C void PrintingFinishedL( CUpnpDevice* aPrinter ); - - - // From CControlPoint - - /** - * StateUpdatedL - * @since Series60 3.0 - * @param aService the service state updated - */ - IMPORT_C void StateUpdatedL( CUpnpService* aService ); - - /** - * DeviceDiscoveredL - * @since Series60 3.0 - * @param aDevice the device found - */ - IMPORT_C void DeviceDiscoveredL( CUpnpDevice* aDevice ); - - /** - * DeviceDisappearedL - * @since Series60 3.0 - * @param aDevice - */ - IMPORT_C void DeviceDisappearedL( CUpnpDevice* aDevice ); - - /** - * ActionResponseReceivedL - * @since Series60 3.0 - * @param aAction the action received - */ - IMPORT_C void ActionResponseReceivedL( CUpnpAction* aAction ); - - /** - * HttpResponseReceivedL - * @since Series60 3.0 - * @param aMessage the HTTP response message - */ - IMPORT_C void HttpResponseReceivedL( CUpnpHttpMessage* aMessage ); - - private: - - /** - * First phase of the two phased construction. - * @param aPCPObserver - * @param aFriendlyName Specifies the friendly name of the control point. - */ - CPrinterControlPoint( MPCPObserver& aPCPOBserver ); - - /** - * Runs base classes ConstructL, starts XHTML folder sharing and starts - * printer search. - * - */ - void ConstructL( ); - - /** - * Get service from specified device. - * @since Series60 3.0 - * @param aPrinter Printer to be used. - * @param aService Service type - * @return Pointer to the resolved service - */ - CUpnpService* GetServiceFromDevice( CUpnpDevice* aPrinter, TPrintService& aService ); - - /* - * Function for parsing remote host address from Data Sink URL - * @param aDataSinkUrl - * @return Address - */ - const TPtrC8 DataSinkUrlAddress( const TDesC8& aDataSinkUrl ); - - /* - * Function for parsing path from Data Sink URL - * @param aDataSinkUrl - * @return Path - */ - const TPtrC8 DataSinkUrlPath( const TDesC8& aDataSinkUrl ); - - /* - * Function for parsing port from Data Sink URL - * @param aDataSinkUrl - * @return Port number - */ - TInt DataSinkUrlPort( const TDesC8& aDataSinkUrl ); - - /* - * Sends the CancelJob action to the printer - * @param aService Print service, from where the action will be created - * @param aJobId Id of the job to be cancelled - */ - void DoCancelJobL(CUpnpService& aService, const TDesC8& aJobId); - - - /* - * Function for removing tags (if exists) from actions received from UPnP - * @param aString Descriptor to remove tags - * @return Pointer to the descriptor without tags - */ - TPtrC8 RemoveTags( const TDesC8& aString); - - /* - * Function for writing the log of job state events - * @param aService - */ - void JobStateLog(CUpnpService* aService); - - - private: // Data - - //@var iPCPObserver PCP observer for callbacks, not owned - MPCPObserver& iPCPObserver; - - //@var iCancelledJobSIDs Contains session ids for jobs to be cancelled - RArray iCancelledJobSIDs; - - //@var iJobStateEvents Job state event maintainer - CJobStateEvents* iJobStateEvents; - -}; - -#endif // CPRINTERCONTROLPOINT_H - -// End Of File \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupfilesharingactive.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupfilesharingactive.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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: Declares CUPFileSharingActive class -* -*/ - - -#ifndef CUPFILESHARINGACTIVE_H -#define CUPFILESHARINGACTIVE_H - -#include -#include - -class CUpnpFileSharing; -class CUpnpItem; - -class CUPFileSharingActive : public CActive -{ - -public: - - static CUPFileSharingActive* NewL(); - - ~CUPFileSharingActive(); - -private: // Constructors - - CUPFileSharingActive(); - - void ConstructL(); - -protected: // from CActive - - void RunL(); - - void DoCancel(); - - TInt RunError( TInt aError ); - -public: // New Functions - - void ShareItemL( CUpnpItem& aItem ); - - void UnshareItemL( TInt aId ); - - void GetSharedItemL( TInt aId, CUpnpItem& aItem ); - -private: // data - - CUpnpFileSharing* iFileSharing; - -}; - -#endif // CUPFILESHARINGACTIVE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupjobstate.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupjobstate.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,362 +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: Declares CUPJobState class -* -*/ - - -#ifndef CUPJOBSTATE_H -#define CUPJOBSTATE_H - -#include - -#include "upconsts.h" - -/* -* @class TUPJobEndState -* @description This class contains the state variables related to the end / abort state -* of the job that is active at printer. -*/ -NONSHARABLE_CLASS(TUPJobEndState) -{ - public: - inline TUPJobEndState(){Init();} - - inline void Init() - { - iId.Set(KNullDesC8()); - iJobName.Set(KNullDesC8()); - iOriginator.Set(KNullDesC8()); - iSheets = KErrNotFound; - iState = EStateUnknown; - iReason = ENoMessage; - iAbortState = EFalse; - } - - TPtrC8 iId; - TPtrC8 iJobName; - TPtrC8 iOriginator; - TInt iSheets; - TUPnPState iState; - TInt iReason; - TBool iAbortState; -}; - -/* -* @class CUPJobState -* @description This class collects and maintains the processing state of the job that is active at printer. -*/ -NONSHARABLE_CLASS(CUPJobState) : public CBase -{ - public: - - /* - * @function NewL - * @description A method to create a new object. - */ - static CUPJobState* NewL(); - - /* - * @function NewLC - * @description A method to create a new object. - */ - static CUPJobState* NewLC(); - - /* - * @function ~CUPJobState - * @description Destructor - */ - ~CUPJobState(); - - /* - * @function Init - * @description Initializes private members - */ - void Init(); - - /* - * @function State - * @description Returns the stored state of the job - * @return TUPnPState - */ - TUPnPState State(); - - /* - * @function SetActiveId - * @description Sets the id for the active job at UPnPProtocol - * @return TUPnPState - */ - void SetActiveId(const TDesC8& aId); - - /* - * @function ActiveId - * @description Returns id of the job active at UPnPProtocol - * @return TUPnPState - */ - TPtrC8 ActiveId(); - - /* - * @function SheetsCompleted - * @description Returns the number of printed sheets of the job - * @return TInt - */ - TInt SheetsCompleted(); - - /* - * @function Reason - * @description Returns the reason code for the job state - * @return TInt - */ - TInt Reason(); - - /* - * @function SetSheetsToPrint - * @description Sets the number of the sheets about to print - * @param TInt - */ - void SetSheetsToPrint(TInt aSheets); - - /* - * @function SheetsToPrint - * @description Returns the number of the sheets about to print - * @return TInt - */ - TInt SheetsToPrint(); - - /* - * @function SetSheetsCompleted - * @description Returns and updates the job state according to the printed sheets - * @param TDesC8 Reference to the string value of printed sheets - */ - void SetSheetsCompleted(const TDesC8& aSheetsCompleted); - - /* - * @function Progress - * @description Returns progress percentage of the job - * @param TInt Number of the sheets sent to printer - * @return TInt - */ - TInt Progress(TInt aSheets); - - /* - * @function Progress - * @description Returns progress percentage of the job - * @return TInt - */ - TInt Progress(); - - /* - * @function UpdateJobState - * @description Returns the state of the job after updated with given arguments - * @param TDesC8& Printer state - * @param TDesC8& Reason for the printer state - * @param TDesC8& List of job ids pending at the printer queue - * @param TDesC8& Id of the currently handled job in printer - * @param TDesC8& Number of the sheets completed at printer - * @return TUPnPState - */ - TUPnPState UpdateJobState(const TDesC8& aPrinterState, const TDesC8& aReason, const TDesC8& aJobList, const TDesC8& aJobId, const TDesC8& aJobMediaSheetsCompleted); - - - /* - * @function GetErrorValue - * @description Maps the ImagePrint and device errors. - * @param TDesC8 Reference to device returned error code - * @return TInt Correspondent ImagePrint error code - */ - TInt GetErrorValue(const TDesC8& aError); - - /* - * @function PrinterStateUpdated - * @description Returns the state of the job after printer state updated - * @param TDesC8& New printer state - * @return TUPnPState - */ - TUPnPState PrinterStateUpdated( const TDesC8& aEvent ); - - /* - * @function PrinterStateReasonsUpdated - * @description Returns the state of the job after printer state reason updated - * @param TDesC8& Reason for the printer state - * @return TUPnPState - */ - TUPnPState PrinterStateReasonsUpdated( const TDesC8& aEvent ); - - /* - * @function JobIdListUpdated - * @description Returns the state of the job after job ID list updated - * @param TDesC8& List of job ids pending at the printer queue - * @return TUPnPState - */ - TUPnPState JobIdListUpdated( const TDesC8& aEvent ); - - /* - * @function JobEndStateUpdatedL - * @description Returns the state of the job after job end state updated - * @param TDesC8& The end state of last printed job. Format: - * ,,,, - * @return TUPnPState - */ - TUPnPState JobEndStateUpdatedL( const TDesC8& aEvent ); - - /* - * @function JobMediaSheetsCompletedUpdated - * @description Returns the state of the job after media sheets completed list updated - * @param TDesC8& Number of the printed sheets - * @return TUPnPState - */ - TUPnPState JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ); - - /* - * @function JobMediaSheetsCompletedUpdated - * @description Returns the state of the job after media sheets completed list updated - * @param TDesC8& ID of the current job - * @param TDesC8& Number of the printed sheets - * @return TUPnPState - */ - TUPnPState JobMediaSheetsCompletedUpdated(const TDesC8& aId, const TDesC8& aEvent ); - - /* - * @function JobAbortStateUpdatedL - * @description Returns the state of the job after job abort state updated - * @param TDesC8& The abort state of last aborted job. Format: - * ,,,,aborted, - * @return TUPnPState - */ - TUPnPState JobAbortStateUpdatedL( const TDesC8& aEvent ); - - /* - * @function ContentCompleteListUpdated - * @description Returns the state of the job after content completed list updated - * @param TDesC8& Number of the sheets completedly received in printer - * @return TUPnPState - */ - TUPnPState ContentCompleteListUpdated( const TDesC8& aEvent ); - - - protected: - - /* - * @function ConstructL - * @description Symbian second phase constructor - */ - void ConstructL(); - - /* - * @function State - * @description updates job's state according to the given state. - * @param TUPnPState State enumeration value - * @return TUPnPState - */ - TUPnPState State(TUPnPState aState); - - /* - * @function SetState - * @description Updates the stored state of the job - * @param TUPnPState state to update with - */ - void SetState(TUPnPState aState); - - /* - * @function SetJobList - * @description Returns and updates the job state according to the list of the jobs pending in printer. - * @param TDesC8 Reference to list of jobs - * @return TUPnPState - */ - TUPnPState SetJobList(const TDesC8& aJobIdList); - - /* - * @function PendingJobId - * @description Returns the position of active job in job list. - * @param TDesC8 Reference to list of jobs - * @return TInt - */ - TInt PendingJobId(const TDesC8& aJobIdList); - - /* - * @function SetId - * @description Updates the printer returned job id if necessary. - * @param TDesC8 Reference to printer returned id - */ - void SetId(const TDesC8& aId); - - /* - * @function InitErrorValues - * @description Initializes the error values stored in map for device vs. ImagePrint errors - */ - void InitErrorValues(); - - /* - * @function SetReason - * @description Sets the reason for job state. - * @param TInt Error value for the reason - */ - void SetReason(TInt aReason); - - /* - * @function ParseState - * @description Maps the states received from the device to state enumerations. - * @param TDesC8 Reference to state string - * @return TInt Corresponding state enumeration - */ - TUPnPState ParseState(const TDesC8& aState); - - /* - * @function ParseJobEndStateL - * @description Separates the elements of the job end and abort state for handling and returns - * KErrNotFound if the end state is not for the active job - * @param TDesC8& The end or abort state of last printed job. Formats: - * ,,,, - * ,,,,abort, - * @return TInt KErrNotFound if the end state is not for the active job - */ - TInt ParseJobEndStateL(const TDesC8& aJobEndState); - - private: - - /* - * @function CUPJobState - * @description Default constructor. - */ - CUPJobState(); - - private: - // @var iActiveId Id of the active job interested - TBuf8 iActiveId; - - // @var iId Id of the job - TBuf8 iId; - - // @var iSheetsCompleted Number of the completed sheets for the job - TInt iSheetsCompleted; - - // @var iReason Reason string of the state - TInt iReason; - - // @var iState Overall state of the job - TUPnPState iState; - - // @var iErrorValues Error values mapping array - RArray iErrorValues; - - // @var iEndState job end state info container - TUPJobEndState iEndState; - - // @var iSheetsToPrint Number of the pages to print - TInt iSheetsToPrint; - -}; -#endif // CUPJOBSTATE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cuplogger.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cuplogger.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +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: Declares logging macros and CUPLogger class -* -*/ - - -#ifndef CUPLOGGER_H -#define CUPLOGGER_H - -#include "logdef.h" - -/** - * NOTE: Link to flogger.lib in MMP file. Use DEBUGLIBRARY -keyword to avoid - * warnings in release builds. - * Example: DEBUGLIBRARY flogger.lib - */ - -/** - * Usage: LOG("[MODULE_NAME]\t Trace text here"); - * - * Trace target can be changed below (file logging needs directory c:\logs\upnp) - * #define __FLOGGING -row uncommented (default) = File logging - * #define __CLOGGING -row uncommented = Console logging - */ - -#ifdef ENABLE_LOGGING -// Define one of these flags: -// FLOGGING = File logging -// CLOGGING = Console logging -#define __FLOGGING__ -//#define __CLOGGING__ -#endif - - - -// Then actual definitions depending on the -// flag values. - -#ifdef ENABLE_LOGGING - - #include - #include - - - // Actual log file name - _LIT(KLogFile,"UALog.txt"); - - // Subdirectory under c:\logs -directory -- MUST EXIST. - _LIT(KLogDir, "upnp"); - - /// The format in which the time is formatted in log - _LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); - _LIT8( KLogTimeFormat8, "%02d.%02d:%02d:%06d "); - - /// The length of the string produced by KLogTimeFormat - const TInt KLogTimeFormatLength = 16; - - /// How many characters a log line can contain - const TInt KLogLineLength = 256; - - - #include - #include - - - // Define the top level macros - #define LOGS(a1, a2) {\ - TBuf<1000> log;\ - log.Append(_L(a1));\ - log.Append(a2);\ - Print(log );} - #define LOG8S(a1, a2) {\ - TBuf8<1000> log;\ - log.Append(_L8(a1));\ - log.Append(a2);\ - Print8(log );} - - #define LOG(a) {Print( _L(a) ) ;} - #define LOG1(s, v) {Print( _L(s), v );} - #define LOG2(s, v1, v2) {Print( _L(s), v1, v2 );} - - #define LOG8(a) {Print8( _L(a) );} - #define LOG81(s, v) {Print8( _L8(s), v );} - #define LOG82(s, v1, v2) {Print8( _L8(s), v1, v2 );} - - #ifdef __FLOGGING__ - - inline void Print( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf<256> buf; - buf.FormatList( aText, args ); - - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend ); - TBuf timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - VA_END( args ); - } - - inline void Print8( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf8<256> buf; - buf.FormatList( aText, args ); - - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend ); - TBuf8 timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat8, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - VA_END( args ); - } - - #else - // Console Logging on - #define Print RDebug::Print - - #define LOGS(a1, a2) {\ - TBuf<1000> log;\ - log.Append(_L(a1));\ - log.Append(a2);\ - Print(log );} - - #define LOG8S(a1, a2) {\ - TBuf8<1000> log;\ - log.Append(_L8(a1));\ - log.Append(a2);\ - Print(log );} - #endif // __FLOGGING__ - -#else - - // DEBUG build is not on --> no logging at all - #define LOG(a) - #define LOG8S(a1, a2) - - #define LOG1(s, v) - #define LOG2(s, v1, v2) - - #define LOG8(a) - #define LOG81(s, v) - #define LOG82(s, v1, v2) - -#endif // ENABLE_LOGGING - -#endif // CUPLOGGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupnpprintingdevice.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupnpprintingdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,359 +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: Declares CUPnPPrintingDevice class -* -*/ - - -#ifndef CUPNPPRINTINGDEVICE_H -#define CUPNPPRINTINGDEVICE_H - -#include -#include -#include -#include - -#include "imageprint.h" -#include "mprotprintingdevice.h" -#include "cprintercontrolpoint.h" -#include "printmessagecodes.h" -#include "cupprintercontainer.h" -#include "cuplogger.h" -#include "upconsts.h" -#include "cupprintingjob.h" - -_LIT8(KFriendlyName, "UPnPProtocol"); - -/// @brief The timeout to wait for first devices to be discovered -#define KPrinterDiscoveryTimeout TTimeIntervalMicroSeconds32(25000000) - -/// @brief The timeout to wait for responses during printing 60 seconds -#define KPrinterResponseTimeout TTimeIntervalMicroSeconds32(60000000) -//#define KPrinterResponseTimeout TTimeIntervalMicroSeconds32(30000000) - -/// @brief The timeout to wait for responses during printing -#define KPrinterSubmitTimeout TTimeIntervalMicroSeconds32(15000000) - -// @brief The times the timer can expire while printing is processing -#define KPendingLimit 5 - -#define KVersionMajor 0 -#define KVersionMinor 0 -#define KVersionBuild 1 - - -enum TUPnPProtocolState -{ - EUPnPUninitialized=0, - EUPnPDiscovery, - EUPnPReady, - EUPnPJobReady, - EUPnPSubmittingJob, - EUPnPPrintingStarted, - EUPnPPrinting, - EUPnPPrintingReady, - EUPnPCancelling, - EUPnPCancellingDiscovery -}; - -/* -* @class CUPnPPrintingDevice -* @description Implements the MProtPrintingDevice and MPCPObserver interfaces -* to integrate Image Print and UPnP stack. -* -*/ -class CUPnPPrintingDevice : public CBase, public MPCPObserver, public MProtPrintingDevice - { - public: - - /* - * @function CUPnPPrintingDevice - * @description C++ constructor - */ - CUPnPPrintingDevice(); - - /* - * @function NewProtocolL - * @description Called from Main.cpp to construct a new MProtPrintingDevice instance - */ - static MProtPrintingDevice* NewL(); - - /* - * @function ~CUPnPPrintingDevice - * @description Destructor. - */ - ~CUPnPPrintingDevice(); - - /* - * @function DiscoveryTimeoutCBL - * @description This static callback function is called by iPrinterTimer when the - * discovery timer event occurs. - * @param - * @return - */ - static TBool DiscoveryTimeoutCBL(TAny *aWho); - - /* - * @function StatusTimeoutCBL - * @description This static callback function is called by iPrinterTimer when the - * status timer event occurs. - * @param - * @return - */ - static TBool StatusTimeoutCBL(TAny *aWho); - - /* - * @function SubmitTimeoutCBL - * @description This static callback function is called by iPrinterTimer when the - * submit timer event occurs. - * @param TAny - * @return TInt - */ - static TInt SubmitTimeoutCBL(TAny *aWho); - - - - - // =============================== - // From MProtPrintingDevice. - // =============================== - // General - virtual void ConstructL(const TDesC& aDLLPath); - virtual TVersion Version(); - virtual TUint SupportedProtocols(); - // Discovery. - virtual void StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocols = 0); - virtual TInt RemoveCachedDeviceL(TInt aDeviceID); - virtual void CancelDiscovery(TBool aDoCallBack = ETrue); - // Print. - virtual TInt CreatePrintJobL(TInt aDeviceID, RPointerArray& aImages, MProtPrintEventObserver& aObserver); - virtual void SubmitPrintJobL(); - virtual TInt CancelPrintJob(); - virtual TInt ContinuePrintJobL(); - virtual TInt GetNumPrintPages(); - virtual TInt GetPrintJobStatus(); - virtual TInt GetPrinterStatus(TInt aDeviceID); - // Capabilities. - virtual TInt GetDeviceCapabilityIDsL(TInt aDeviceID, RArray& aCapabilityIDs); - virtual TInt GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability); - virtual TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); - virtual TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); - // Preview. - virtual TInt GetNumPreviewPages(); - virtual TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFsBitmapHandle); - virtual TInt CreatePreviewImage(TInt aPageNumber); - - virtual void RegisterIdleObserver(MProtIdleObserver* aObserver); - - virtual void SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ); - - // =============================== - // From MPCPObserver - // =============================== - virtual void CreateJobResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void CancelJobResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void GetPrinterAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void GetJobAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void GetMarginsResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void GetMediaListResponse( CUpnpAction* aAction, TInt aErrorCode ); - virtual void StateUpdatedResponse( const TDesC8& aPrinterState, - const TDesC8& aPrinterStateReasons, - const TDesC8& aJobIdList, - const TDesC8& aJobEndState, - const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aJobAbortState, - const TDesC8& aContentCompleteList ); - virtual void DeviceDiscoveredL( CUpnpDevice* aDevice ); - virtual void DeviceDisappeared( CUpnpDevice* aDevice ); - // state events - virtual void PrinterStateUpdated( const TDesC8& aEvent ); - virtual void PrinterStateReasonsUpdated( const TDesC8& aEvent ); - virtual void JobIdListUpdated( const TDesC8& aEvent ); - virtual void JobEndStateUpdated( const TDesC8& aEvent ); - virtual void JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ); - virtual void ContentCompleteListUpdated( const TDesC8& aEvent ); - virtual void JobAbortStateUpdated( const TDesC8& aEvent ); - - protected: - - - private: - - /* - * @function StartDiscoveryInternalL - * @description Non-leaving interface for MProtPrintingDevice method StartDiscoveryL - * for ImagePrint compliance. Informs observer about leaves by call back method. - * @param TInt protocol identifier bitmap - */ - void StartDiscoveryInternalL(TUint aProtocol); - - /* - * @function RestartControlPointL - * @description Restarts the printer control point - */ - void RestartControlPointL(); - - /* - * @function SendPrinterListL - * @description Returns the device list to MProtDiscoveryObserver object - * @param TBool - */ - void SendPrinterListL(TBool aSync = ETrue); - - /* - * @function DoDiscoveryTimeoutL - * @description Ends the first device discovery session. This function is called - * by the static callback function DiscoveryTimeoutCBL. - * @param TBool aDoCallBack If ETrue then protocol client is notified. - * @return TBool - */ - TBool DoDiscoveryTimeoutL(TBool aDoCallBack); - - /* - * @function DoSubmitTimeoutL - * @description This function is executed after submit time out expires. - * @return TInt - */ - void DoSubmitTimeoutL(); - - /* - * @function SubmitJobToPcpL - * @description Submits the printing job to PCP - * @param CDevice& Reference to the printer to be used in printing - * @param TInt The ID of the printer to be used in printing - */ - void SubmitJobToPcpL(CUpnpDevice& aPrinter, TInt aPrinterID); - - /* - * @function SubmitJobToPcpL - * @description Submits the printing job to PCP - * @param TInt The ID of the printer to be used in printing - */ - void SubmitJobToPcpL(TInt aDeviceID); - - /* - * @function DoStatusTimeoutL - * @description Handles time out event in printer communication. - * @return TBool - */ - TBool DoStatusTimeoutL(); - - /* - * @function InitJobL - * @description Initializes the printing jobs to job container - * @param TInt Printer for printing jobs - * @param RPointerArray File paths for files to be printed - */ - void InitJobL(TInt aDeviceId, RPointerArray& aImages); - - /* - * @function StartPrintingL - * @description Sends the printing jobs to the UPnP Printer Control Point - */ - void StartPrintingL(); - - /* - * @function DoCancelPrinting - * @description Cancels the ongoing printing job. Returns KErrInvalidSequence if state is not - * EUPnPSubmittingJob, EUPnPPrintingStarted or EUPnPPrinting. - * @return TInt System wide error code - */ - TInt DoCancelPrinting(); - - /* - * @function UpdatePrintingStatus - * @description Updates the status of printing jobs and informs the printing observer about progress and events - * @param const TDesC8& aPrinterState - */ - void UpdatePrintingStatus(const TUPnPState aJobState); - - - /* - * @function FinishPrinting - * @description Executes the basic operations to be done when printing is done. - */ - void FinishPrinting(); - - /* - * @function FinishPrinting - * @description Overloads FinishPrinting and informs observer about occurred error. - * @param TInt Symbian wide error code - * @param TInt ImagePrint specific (error) message code - */ - void FinishPrinting(TInt aErrorCode, TInt aErrorMessage); - - /* - * @function ResetTimer - * @description Resets the timer and initializes timer related flags. - */ - void ResetTimer(); - - /* - * @function StartTimer - * @description Starts the timer and resets it first. - * @param TTimeIntervalMicroSeconds32 Delay for the timer - * @param TTimeIntervalMicroSeconds32 Interval for timer to expire - * @param TCallBack Call back function when timer expires - */ - void StartTimer(TTimeIntervalMicroSeconds32 aDelay,TTimeIntervalMicroSeconds32 anInterval,TCallBack aCallBack); - - /* - * @function GetPrinter - * @description Returns a pointer to the current printer. - * @return CDevice* Current printer or NULL - */ - CUpnpDevice* GetPrinter(); - - private: - // @var iPrinterControl Control point to UPnP - CPrinterControlPoint* iPrinterControl; - - // @var iPrinterContainer Container for printers - CUPPrinterContainer* iPrinterContainer; - - // @var iPrintingJob Printing job - CUPPrintingJob* iPrintingJob; - - // @var iPrinterTimer Array of discovered printers - CPeriodic* iPrinterTimer; - - // @var iPrintFactory XHTML-print file factory - CUPPrintFactory* iPrintFactory; - - // @var iPrinterState State information of the object - TUPnPProtocolState iState; - - // @var iPrintersFound Indicates if there are printers found - TBool iPrintersFound; - - // @var iStatusTimeout This variable is set to ETrue when a status time out occurs - TBool iStatusTimeout; - - // @var iFbsBitmap (Dummy) bitmap for icon template - CFbsBitmap* iFbsBitmap; - - // @var iPendingCount Counter to avoid too long pending while printing - TInt iPendingCount; - - // @var iFriendlyName In Home network configuration defined name for the device - TBuf8<256> iFriendlyName; - - // @var iTriedReadCacheAndFail To check that never trying read cache file more than one time, if we don't have it. - TBool iTriedReadCacheAndFail; - - }; - -#endif // CUPNPPRINTINGDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprinter.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprinter.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +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: Declares CUPPrinter class -* -*/ - - -#ifndef CUPPRINTER_H -#define CUPPRINTER_H - -#include -#include - -#include "upconsts.h" -#include "tprinter.h" -#include "imageprint.h" - -/* -* @class CUPPrinter -* @description This class maps the printers between protocol client and -* UPnP printer control point. -*/ - -NONSHARABLE_CLASS(CUPPrinter) : public CBase - { - public: - /* - * @function NewL - * @description Constructs the CUPPrinter object - * @param CDevice* - * @param TInt Mapping id - */ - static CUPPrinter* NewL(CUpnpDevice& aDevice, const TInt aId); - - /* - * @function NewL - * @description Constructs the CUAPrinter object - * @param TInt Mapping id - * @param TDesC& UPnP UId - * @param TDesC& Display name of printer - */ - static CUPPrinter* NewL(const TInt aId, const TDesC8& aUId, const TDesC8& aDisplayName, const TInt aVendor); - - - /* - * @function Destructor - * @description Destructor - */ - ~CUPPrinter(); - - - /* - * @function Device - * @description Returns a pointer to CDevice - * @return CDevice* - */ - CUpnpDevice* Device(); - - /* - * @function ToTPrinter - * @description Returns the object as TPrinter - * @return TPrinter - */ - TPrinter ToTPrinter(); - - /* - * @function Id - * @description Returns the id of the device. - * NOTE: This id maps the printer requests from protocol client - * to a correct UPnP printer control point's printer - */ - TInt Id(); - - /* - * @function GetUId - * @description Returns the UPnP uid of the device. - */ - void GetUId(TDesC& aUId); - - /* - * @function IsDisappeared - * @description Returns ETrue if the printer is reported to be disappeared - * @return TBool - */ - TBool IsDisappeared(); - - /* - * @function SetDisappeared - * @description Sets the iDisappeared value as ETrue. Called when the printer is reported to be disappeared. - * @param TBool - */ - void SetDisappeared(TBool aDisappeared = ETrue); - /* - * @function UId - * @description Returns the printers UPnP UId - * @return TPtrC - */ - TPtrC8 UId(); - - /* - * @function DisplayName - * @description Returns the printers display name - * @return TPtrC - */ - TPtrC8 DisplayName(); - - /* - * @function SetDevice - * @description Sets the CDevice pointer. NOTE: The actual object is never owned by this class! - * @return CDevice* - */ - void SetDevice(CUpnpDevice* aDevice); - - /* - * @function SetCached - * @description Sets a flag if printer is cached in cache file or not - * @param TBool - */ - void SetCached(TBool aCached); - - /* - * @function Cached - * @description Returns a flag if printer is cached in cache file or not - * @return TBool - */ - TBool Cached(); - - /* - * @function Vendor - * @description Returns an enum value TPrinterVendor - * @return TPrinterVendor - */ - TPrinter::TPrinterVendor Vendor(); - - /* - * @function SetVendor - * @description Returns an enum value TPrinterVendor - * @return TPrinterVendor - */ - void SetVendor(const TDesC8& aManufacturer); - - protected: - - - private: - /* - * @function Constructor - * @description C++ constructor - */ - CUPPrinter(); - - /* - * @function ConstructL - * @description Construction's second phase - * @param CDevice* Pointer to UPnP device - * @param TInt Mapping id - * @param TDesC8& UPnP UId - * @param TDesC8& Display name of printer - */ - void ConstructL(CUpnpDevice* aDevice, const TInt aId, const TDesC8& aUId, const TDesC8& aDisplayName, const TInt aVendor); - - private: - - // @var iDevice Pointer to UPnP device object - CUpnpDevice* iDevice; - - // @var iId Printer id for client apps - TInt iId; - - // @var iUId Printer UPnP UId - HBufC8* iUId; - - // @var iDisplayName Printer's display name (UPnP Friendly name) - HBufC8* iDisplayName; - - // @var iDisappeared ETrue, when a disappearing notification is received for this printer - TBool iDisappeared; - - // @var iCached ETrue, if printer is cached in cache file. - TBool iCached; - - // @var iVendor TPrinter::TPrinterVendor value for defining vendor - TPrinter::TPrinterVendor iVendor; - - }; - -#endif // CUPPRINTER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintercontainer.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintercontainer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +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: Declares CUPPrinterContainer class -* -*/ - - -#ifndef CUPPRINTERCONTAINER_H -#define CUPPRINTERCONTAINER_H - -#include -#include - -#include "tprinter.h" -#include "cupprinter.h" -#include "imageprint.h" - -/* -* @class CUPPrinterContainer -* @description This class contains an array of discovered devices -* and methods for handling it. It also converts CDevice objects to -* TPrinter, where TPrinter's id is the index -*/ - -NONSHARABLE_CLASS(CUPPrinterContainer) : public CBase - { - public: - /* - * @function NewL - * @description Constructs the CUPPrinterContainer object - */ - static CUPPrinterContainer* NewL(); - - /* - * @function Destructor - * @description Releases the resources allocated by this object - */ - ~CUPPrinterContainer(); - - /* - * @function PrinterCount - * @description Returns the number of printers in iPrinters. - * @return TInt - */ - TInt PrinterCount(); - - /* - * @function AddPrinterL - * @description Adds a device to the device array. Called when - * a device is discovered. - * @param CDevice*& Reference to the pointer of the device - * @param TInt& The new id will be set to this value - * @return TInt Printer id of the added device - */ - void AddPrinterL(CUpnpDevice& aDevice, TInt& aId); - - /* - * @function RemovePrinter - * @description Removes a printer from the array. Called when - * a device is disappeared. - * @param CDevice& aDevice - * @return TInt Symbian error code - */ - TInt RemovePrinter(CUpnpDevice& aDevice); - - /* - * @function RemovePrinter - * @description Removes a printer from the array. Called when - * a device is disappeared. - * @param TInt aIndex - * @return TInt Symbian error code - */ - TInt RemovePrinter(TInt aIndex); - - /* - * @function PrinterIndex - * @description Returns the index number of the device in discovered - * printers array. If printer is not found -1 is returned. - * This function compares the Uuid's of the CDevices. - * @param CDevice - * @return TInt - */ - TInt PrinterIndex(CUpnpDevice& aDevice); - - /* - * @function PrinterIndex - * @description Returns the index number of the device in discovered - * printers array. If printer is not found -1 is returned. - * This function searches for matching CUPPrinter id's. - * @param CDevice* - * @return TInt - */ - TInt PrinterIndex(TInt aPrinterId); - - /* - * @function PrinterDisappeared - * @description Sets a printer as disappeared in printer array. - * @param CDevice - */ - void PrinterDisappeared(CUpnpDevice& aDevice); - - /* - * @function SyncPrinterArray - * @description Removes disappeared devices from iPrinters array. - */ - void SyncPrinterArray(); - - /* - * @function ReadCacheL - * @description Reads printer information from cache file into printer array - */ - void ReadCacheL(); - - /* - * @function UpdateCacheL - * @description Updates the cache file with available printers - */ - void UpdateCacheL(); - - /* - * @function CacheCurrentL - * @description Updates the current device in cache file - */ - void CacheCurrentL(); - - /* - * @function RemoveCachedDeviceL - * @description Removes the given device in cache file - * @param TInt Id of the device to remove - */ - TInt RemoveCachedDeviceL(TInt aDeviceID); - - /* - * @function UpdateCacheL - * @description Updates the cache file with available printers - * @param TInt Id of the device to add in cache - */ - void UpdateCacheL(TInt aDeviceID); - - /* - * @function ToTPrinter - * @description Returns a printer object as TPrinter by index. - * @param CDevice*& aDevice - * @return TPrinter - */ - TPrinter ToTPrinter(CUpnpDevice& aDevice); - - /* - * @function ToTPrinter - * @description Returns a printer object as TPrinter by index. - * @param TInt aIndex - * @return TPrinter - */ - TPrinter ToTPrinter(TInt aIndex); - - - /* - * @function GetDisappearedPrinters - * @description Initializes a pointer array with pointers to all disappeared printers - * @param RPointerArray Out param - */ - void GetDisappearedPrinters(RPointerArray& aArray); - - /* - * @function Printer - * @description Returns a pointer to CUPPrinter in printer array. - * @param CDevice& aDevice - * @return CUPPrinter* - */ - CUPPrinter* Printer(CUpnpDevice& aDevice); - - /* - * @function Printer - * @description Returns a pointer to CUPPrinter in printer array. - * @param TInt aId - * @return CUPPrinter* - */ - CUPPrinter* Printer(TInt aId); - - protected: - - - private: - /* - * @function Constructor - * @description C++ constructor - */ - CUPPrinterContainer(); - - - /* - * @function ConstructL - * @description Construction's second phase - */ - void ConstructL(); - - /* - * @function ToCDevice - * @description Returns a pointer to CUPPrinter's CDevice in printer array. - * @param TInt aIndex - * @return CDevice* - */ - CUpnpDevice* ToCDevice(TInt aIndex); - - /* - * @function GenerateId - * @description Generated an unique id number for a printer - * @return TInt Generated Id number - */ - TInt GenerateId(); - - /* - * @function AddCachedPrinterL - * @description Adds a cached printer to printer array - * @param TInt aId - * @param TDesC& aUPnPUId - * @param TDesC& aDisplayName - */ - void AddCachedPrinterL(TInt aId, TDesC8& aUPnPUId, TDesC8& aDisplayName, const TInt aVendor); - - /* - * @function ReadCacheFileL - * @description Reads the cached printers in iCacheBuffer - * NOTE: Creates the iCacheBuffer - */ - void ReadCacheFileL(); - - /* - * @function FindCachedPrinterL - * @description Returns requested printer data from the cache file and the start - * and end position of the printer data in file - * @param TInt ID of the printer to find - * @param TInt& Start position of the data in file - * @param TInt& End position of the data in file - * @return TPtrC8 Printer data in buffer pointer - */ - TPtrC8 FindCachedPrinterL(TInt aId, TInt& aStartPos, TInt& aEndPos); - - /* - * @function AddCachedPrinterL - * @description Adds a cached printer to printer array - * @param TInt aId - * @param TDesC& aUPnPUId - * @param TDesC& aDisplayName - */ - CUPPrinter* PrinterByIndex(TInt aIndex); - - - private: - // @var iPrinterArray Discovered devices - RPointerArray iPrinters; - - // @var iFsSession File server session - RFs iFsSession; - - - //@var iIdCounter Temprary id generation solution - TInt iIdCounter; - - //@var iCacheBuffer The content of the cached file. - HBufC8* iCacheBuffer; - }; - -#endif // CUPPRINTERCONTAINER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintfactory.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintfactory.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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: Declares CUPPrintFactory class -* -*/ - - -#ifndef CUPPRINTFACTORY_H -#define CUPPRINTFACTORY_H - -#include -#include -#include - -#include "cxhtmlfilecomposer.h" -#include "cimageinfo.h" -#include "printcapabilitycodes.h" -#include "tprintcapability.h" -#include "upconsts.h" - -/* -* @class CUPPrintFactory -* @description This class maps the printers between protocol client and -* UPnP printer control point. -*/ -NONSHARABLE_CLASS(CUPPrintFactory) : public CBase - { - public: - /* - * @function NewL - * @description Constructs the object - */ - static CUPPrintFactory* NewL(); - - /* - * @function Destructor - * @description Destructor - */ - ~CUPPrintFactory(); - - /* - * @function CreateXhtmlFileL - * @description Creates XHTML-Print template folder for printing job. - * @param aJobURIs Arrays of images' HTTP addresses to be printed - * @param aLayout Defines the print layout - * @param aPaperSize Paper size - * @param aQuality Print quality - * @param aXhtmlPrintFile Output parameter, which contains the filepath of created template file - * @param TInt& Returns the number of pages to print - */ - void CreateXhtmlFileL(const RArray& aJobURIs, const TInt aLayout, - const TInt aPaperSize, const TInt aQuality, - TDes& aXhtmlPrintFile, TInt& aPageCount); - - /* - * @function DeleteXhtmlFilesL - * @description Deletes all XHTML-print files files - */ - void DeleteXhtmlFilesL(); - - /* - * @function FileCount - * @description Returns the number of the files printed at this session. - * Number is same as in the latest filename. - * @return TInt - */ - TInt FileCount(); - - /* - * @function GetCapabilityIDs - * @description Returns the capability IDs of supported capabilities - * @param aCapabilityIDs Output parameter - */ - void GetCapabilityIDs(RArray& aCapabilityIDs); - - /* - * @function GetCapability - * @description Returns the default value of a capability - * @param aCapabilityID Id of the capability - * @param aCapability Output parameter - * @return System wide error code - */ - TInt GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability); - - /* - * @function GetPrintSetting - * @description Returns the requested capability value. - * If capability id is invalid KErrArgument is returned. - * @param TInt aCapabilityID - * @param TInt aValue - * @return TInt Error code - */ - TInt GetPrintSetting(TInt aCapabilityID, TInt& aCapability); - - /* - * @function SetPrintSetting - * @description Changes the value of an existing print setting. - * If setting is not supported KErrNotSupported is returned. - * @param TInt aCapabilityId - * @param TInt aValue - * @return TInt System wide error code - */ - TInt SetPrintSetting(TInt aCapabilityID, TInt aValue); - - protected: - - - private: - /* - * @function Constructor - * @description C++ constructor - */ - CUPPrintFactory(); - - /* - * @function ConstructL - * @description Construction's second phase - */ - void ConstructL(); - - /* - * @function InitCapabilities - * @description Initializes the supported capabilities array - */ - void InitCapabilities(); - - /* - * @function GetDefaultSettingsL - * @description Reads default printing settings from the file. - * @param TInt& returns layout value - * @param TInt& returns size value - * @param TInt& returns quality value - */ - void GetDefaultSettingsL(TInt& aLayout, TInt& aSize, TInt& aQuality); - - /* - * @function SetDefaultSettingsL - * @description Sets the currently stored default printing settings in file. - */ - void SetDefaultSettingsL(); - - private: - //@var iFileCount Counter used in XHTML-print file naming - TInt iFileCount; - - //@var iCapabilities Capabilities/ settings supported by XHTML-print file factory - RArray iCapabilities; - - //@var iFileSession File session for writing job settings in file. - RFs iFileSession; - }; - -#endif // CUPPRINTFACTORY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintingjob.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cupprintingjob.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,359 +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: Declares CUPPrintingJob class -* -*/ - - -#ifndef CUPPRINTINGJOB_H -#define CUPPRINTINGJOB_H - -#include -#include -#include - -#include "upconsts.h" -#include "tprintcapability.h" -#include "cupprintfactory.h" -#include "cupjobstate.h" - -class CUPPrinter; -class CUPFileSharingActive; - -enum TUpnpContainerType -{ - EImageAndVideo = 0 -}; - - -#define KMaxIdLength 10 - -/* -* @class CUPPrintingJob -* @description This class contains the necessary printing -* job information between UPnPStack and MProtPrintingDevice -*/ -NONSHARABLE_CLASS(CUPPrintingJob) : public CBase - { - public: - /* - * @function NewL - * @description Constructs the CUPPrintingJob object. - * NOTE: The ownership of aFileFactory does not change here! - * @param aPrinter Selected printer for the job - * @param aImages Array of images to be printed - * @param aFileFactory Pointer to XHTML-print file factory - * @param aUserName User name got from central repository - */ - static CUPPrintingJob* NewL(CUPPrinter* aPrinter, RArray& aImages, CUPPrintFactory* aFileFactory, const TDesC8& aUserName); - - /* - * @function Destructor - * @description Destroys the object and frees the memory allocated by this object - */ - ~CUPPrintingJob(); - - /* - * @function SetSessionId - * @description Initializes the session id used for printer communication with this job - * @param TInt aId - */ - void SetSessionId(TInt aId); - - /* - * @function SessionId - * @description Returns the session id - * @return TInt - */ - TInt SessionId(); - - /* - * @function SetJobId - * @description Initializes the job id - * @param TDesC& aId - */ - void SetJobId(const TDesC8& aId); - - /* - * @function GetJobId - * @description Returns the job id as const TDes8& - * @param const TDes8& - */ - void GetJobId(TDes8& aId); - - /* - * @function GetJobName - * @description Returns the file path - * @param TDes8& - */ - void GetJobName(TDes8& aJobName); - - /* - * @function ImageCount - * @description Returns the number of images in job. - * @return TInt - */ - TInt ImageCount(); - - /* - * @function Images - * @description Returns job's images as CImageInfo - * @param RArray Output parameter - */ - void Images(RArray& aImages); - - /* - * @function PrinterId - * @description Returns the printer id - * @param TInt - */ - TInt PrinterId(); - - /* - * @function ShareFileL - * @description Shares the images via UPnP Media Server and destroys object CUPnPItem. - * @param CUPnPItem* UPnP Item to share - */ - void ShareFileL(CUpnpItem* aItemToShare); - - /* - * @function ShareImagesL - * @description Shares the images via UPnP Media Server - */ - void ShareImagesL(); - - /* - * @function UnShareImages - * @description Removes the sharing of all images from UPnP Media Server - * @return TInt System wide error code - */ - TInt UnShareImages(); - - /* - * @function UnShareImages - * @description Removes the sharing of file from UPnP Media Server - * @param TInt UPnP item ID - * @return TInt System wide error code - */ - TInt UnShareFile(TInt aItemId); - - /* - * @function GetUserName - * @description Returns the user name - * @param TPtrC8& - */ - void GetUserName(TPtrC8& aDocFormat); - - /* - * @function SetNumsOfCopies - * @description Sets the number of copies for certain image. - * @param TInt aCapabilityId - * @param TInt aValue - * @return TInt System wide error code - */ - TInt SetNumsOfCopies( const RArray& aNumsOfCopies); - - /* - * @function XhtmlPrintFile - * @description Returns the file path of generated XHTML-Print file - * @param TDes8& - */ - void GetPrintFileL(TDes8& aPrintFile); - - /* - * @function Sheets - * @description Returns the total number of sheets the job requires - * @return TInt - */ - TInt Sheets(); - - /* - * @function Progress - * @description Returns the progress percentage of the job - * @return TInt - */ - TInt Progress(); - - /* - * @function JobState - * @description Returns the pointer to the job state maintainer - * @return CUPJobState - */ - CUPJobState* JobState(); - - /* - * @function JobStateReason - * @description Returns the reason for the job's state - * @return TInt - */ - TInt JobStateReason(); - - /** - * StateUpdatedResponse callback function DEPRECATED - * @since Series60 3.1 - * @param TDesC8& New printer state - * @param TDesC8& Reason for the printer state - * @param TDesC8& List of job ids pending at the printer queue - * @param TDesC8& Current job ID - * @param TDesC8& Number of the printed sheets - */ - TUPnPState UpdateJobState(const TDesC8& aPrinterState, - const TDesC8& aReason, - const TDesC8& aJobList, - const TDesC8& aJobId, - const TDesC8& aJobMediaSheetsCompleted); - - /* - * @function PrinterStateUpdated - * @description Returns the state of the job after printer state updated - * @param TDesC8& New printer state - * @return TUPnPState - */ - TUPnPState PrinterStateUpdated( const TDesC8& aEvent ); - - /* - * @function PrinterStateReasonsUpdated - * @description Returns the state of the job after printer state reason updated - * @param TDesC8& Reason for the printer state - * @return TUPnPState - */ - TUPnPState PrinterStateReasonsUpdated( const TDesC8& aEvent ); - - /* - * @function JobIdListUpdated - * @description Returns the state of the job after job ID list updated - * @param TDesC8& List of job ids pending at the printer queue - * @return TUPnPState - */ - TUPnPState JobIdListUpdated( const TDesC8& aEvent ); - - /* - * @function JobEndStateUpdatedL - * @description Returns the state of the job after job end state updated - * @param TDesC8& The end state of last printed job. Format: - * ,,,, - * @return TUPnPState - */ - TUPnPState JobEndStateUpdatedL( const TDesC8& aEvent ); - - /* - * @function JobMediaSheetsCompletedUpdated - * @description Returns the state of the job after media sheets completed list updated - * @param TDesC8& Number of the printed sheets - * @return TUPnPState - */ - TUPnPState JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ); - - /* - * @function JobMediaSheetsCompletedUpdated - * @description Returns the state of the job after media sheets completed list updated - * @param TDesC8& ID of the current job - * @param TDesC8& Number of the printed sheets - * @return TUPnPState - */ - TUPnPState JobMediaSheetsCompletedUpdated(const TDesC8& aId, const TDesC8& aEvent ); - - /* - * @function JobAbortStateUpdatedL - * @description Returns the state of the job after job abort state updated - * @param TDesC8& The abort state of last aborted job. Format: - * ,,,,aborted, - * @return TUPnPState - */ - TUPnPState JobAbortStateUpdatedL( const TDesC8& aEvent ); - - /* - * @function ContentCompleteListUpdated - * @description Returns the state of the job after content completed list updated - * @param TDesC8& Number of the sheets completedly received in printer - * @return TUPnPState - */ - TUPnPState ContentCompleteListUpdated( const TDesC8& aEvent ); - - - - protected: - /* - * @function ConstructL - * @description Construction's second phase - * @param aPriner Selected printer for the job - * @param aImages Array of images to be printed - */ - void ConstructL(CUPPrinter* aPrinter, RArray& aImages, const TDesC8& aUserName); - - private: - - /* - * @function CUPPrintingJob - * @description C++ constructor - * @param aPrinterId Id of the printer to be used for this job. - * - */ - CUPPrintingJob(CUPPrintFactory* aFileFactory); - - /* - * @function UPnPItemLC - * @description Returns the image's UPnP item for file sharing - * @param TInt Index of the image, which UPnP item is requested - * @param TDesC8& Name of the file used as base for UPnPItem - * @param TInt On return contains the UPnP item ID - * @return CUPnPItem* - */ - CUpnpItem* UPnPItemLC(TInt aItemId, const TDesC8& aFileName, const TDesC8& aObjectType, const TDesC8& aMimeType); - - private: - - //@var iSessionId Session id used in sending this job to printer - TInt iSessionId; - - //@var iJobId Id for printing job received from printer control point - TBuf8 iJobId; - - //@var iPrinterId Defines the printer to be used. Has to be a valid index of CUAPrinterContainer. - TInt iPrinterId; - - //@var iUserName Name of the user (phone model) - TPtrC8 iUserName; - - //@var iImages Job's images - RArray iImages; - - //@var iPrintFactory Object for creating XHTML-Print file - CUPPrintFactory* iPrintFactory; - - //@var iJobState Object to maintain job's state - CUPJobState* iJobState; - - //@var iSheets Number of sheets to print - TInt iSheets; - - //@var iXhtmlFileShareId ID for sharing xhtml file - TInt iXhtmlFileShareId; - - //@var iFileSharing File sharing resource - CUPFileSharingActive* iFileSharing; - - //@var iMediaServerClient Media server to map the file sharing resource - RUpnpMediaServerClient iMediaServerClient; - - //@var iiMediaServerAddress media server's ip and port address. - TFileName8 iMediaServerAddress; - - //@var iOrgMediaServerStatus mediaserver's running status before we use it. - TInt iOrgMediaServerStatus; - }; - -#endif // CUPPRINTINGJOB_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cuptimer.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/cuptimer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +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: Declares CUPTimer class -* -*/ - - -#ifndef CUPTIMER_H -#define CUPTIMER_H - -#include - -class CUpnpItem; - -class MUPTimerObserver - { - public: - - /** - * Method which is called when timer in CUPTimer expires - */ - virtual void TimerExpiredL(CUpnpItem* aItemToShare) = 0; - }; - -class CUPTimer : public CActive - { - - public: - - /** - * Static method for creating an instance - * @return CUPTimer object - */ - static CUPTimer* NewL(); - - /** - * Static method for creating an instance - * @return CUPTimer object - */ - static CUPTimer* NewLC(); - - /** - * Destructor - */ - ~CUPTimer(); - - /** - * Method for seting the active object active - */ - void SetActiveNow(); - - /** - * RunL - */ - void RunL(); - - /** - * RunError - * @param aError Symbian error code which should indicate what happened - */ - TInt RunError(TInt aError); - - /** - * DoCancel - */ - void DoCancel(); - - /** - * Method which will wait until given microseconds have passed and then call the given callback - * @param aObserver Observer class which called when timer expires - * @param aTimeOut Interval which waited before observer is called - * @param aStatus Request status object - */ - void WaitUntilTimeExpired(MUPTimerObserver* aObserver, - TTimeIntervalMicroSeconds32 aTimeOut, - CUpnpItem* aItemToShare);//, - // TRequestStatus &aStatus); - - /** - * CPeriodic timed out when this method is called - * @param aPtr Any pointer - * @return Error code - */ - static TInt TimedOut(TAny* aPtr); - - /** - * For canceling the request - */ - void CancelTimer(); - -private: - - /** - * ConstructL - */ - void ConstructL(); - - /** - * Private constructor - */ - CUPTimer(); - -private: - - /** - * Pointer to a observer class - */ - MUPTimerObserver* iObserver; - - /** - * Instance of periodic timer - */ - CPeriodic* iTimeOutTimer; - - CUpnpItem* iItemToShare; - - }; - -#endif // CUPTIMER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/mpcpobserver.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/mpcpobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +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: Declares the MPCPObserver interface class -* -*/ - - -#ifndef MPCPOBSERVER_H -#define MPCPOBSERVER_H - -#include -#include - -class CUpnpAction; -class CUpnpService; -class CUpnpDevice; -class CUpnpHttpMessage; - -/** -* @brief A virtual MPCPObserver class. -* -* @since Series60 3.1 -*/ -class MPCPObserver - { - public: // New interface functions - - /** - * CreateJobResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void CreateJobResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - /** - * CancelJobResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void CancelJobResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - /** - * GetPrinterAttributesResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetPrinterAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - /** - * GetJobAttributesResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetJobAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - /** - * GetMarginsResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetMarginsResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - /** - * GetMediaListResponse callback function - * @since Series60 3.1 - * @param aAction the action - * @param aErrorCode System wide error code - */ - virtual void GetMediaListResponse( CUpnpAction* aAction, TInt aErrorCode ) = 0; - - - /** - * StateUpdatedResponse callback function - * @since Series60 3.1 - * @param TDesC8& New printer state - * @param TDesC8& Reason for the printer state - * @param TDesC8& List of job ids pending at the printer queue - * @param TDesC8& The end state of last printed job. Format: - * ,,,, - * @param TDesC8& Number of the printed sheets - * @param TDesC8& The abort state of last aborted job. Format: - * ,,,,aborted, - * @param TDesC8& Number of the sheets completedly received in printer - */ - virtual void StateUpdatedResponse( const TDesC8& aPrinterState, - const TDesC8& aPrinterStateReasons, - const TDesC8& aJobIdList, - const TDesC8& aJobEndState, - const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aJobAbortState, - const TDesC8& aContentCompleteList ) = 0; - - /** - * DeviceDiscoveredL callback function - * @since Series60 3.1 - * @param aDevice the device discovered - */ - virtual void DeviceDiscoveredL( CUpnpDevice* aDevice ) = 0; - - /** - * DeviceDisappeared callback function - * @since Series60 3.1 - * @param aDevice the device disappeared - */ - virtual void DeviceDisappeared( CUpnpDevice* aDevice ) = 0; - - /* - * @function PrinterStateUpdated - * @description Returns the state of the job after printer state updated - * @param TDesC8& New printer state - */ - virtual void PrinterStateUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function PrinterStateReasonsUpdated - * @description Returns the state of the job after printer state reason updated - * @param TDesC8& Reason for the printer state - */ - virtual void PrinterStateReasonsUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function JobIdListUpdated - * @description Returns the state of the job after job ID list updated - * @param TDesC8& List of job ids pending at the printer queue - */ - virtual void JobIdListUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function JobEndStateUpdatedL - * @description Returns the state of the job after job end state updated - * @param TDesC8& The end state of last printed job. Format: - * ,,,, - */ - virtual void JobEndStateUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function JobMediaSheetsCompletedUpdated - * @description Returns the state of the job after media sheets completed list updated - * @param TDesC8& Number of the printed sheets - */ - virtual void JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function JobAbortStateUpdatedL - * @description Returns the state of the job after job abort state updated - * @param TDesC8& The abort state of last aborted job. Format: - * ,,,,aborted, - */ - virtual void JobAbortStateUpdated( const TDesC8& aEvent ) = 0; - - /* - * @function ContentCompleteListUpdated - * @description Returns the state of the job after content completed list updated - * @param TDesC8& Number of the sheets completedly received in printer - */ - virtual void ContentCompleteListUpdated( const TDesC8& aEvent ) = 0; - - }; - -#endif // MPCPOBSERVER_H - -// End Of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/upconsts.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/inc/upconsts.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +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: Common constants for UPnP printing -* -*/ - - -#ifndef UPCONSTS_H -#define UPCONSTS_H - -#include -#include - -#include "printmessagecodes.h" - -// Debugging -#define _DEBUG_OUT - -#define KUPnPIdBase 402216 -typedef TBuf8 TFileName8; - -// UPnP setting names -_LIT8(KUPnPPrintQuality, "PrintQuality"); -_LIT8(KUPnPNumberUp, "NumberUp"); -_LIT8(KUPnPMediaSize, "MediaSize"); - -// UPnP values -_LIT8(KUPnPDeviceSetting, "device-setting"); -_LIT8(KUPnPOne, "1"); -#define KUPnPDeviceSettingStrLength 15 - -// Actions -_LIT8( KCancelJob, "CancelJob" ); -_LIT8( KCreateJob, "CreateJob" ); -_LIT8( KCreateJobV2, "CreateJobV2" ); -_LIT8( KCreateURIJob, "CreateURIJob" ); -_LIT8( KGetJobAttr, "GetJobAttributes" ); -_LIT8( KGetMargins, "GetMargins" ); -_LIT8( KGetMediaList, "GetMediaList" ); -_LIT8( KGetPrinterAttr, "GetPrinterAttributes" ); -_LIT8( KGetPrinterAttrV2, "GetPrinterAttributesV2" ); - -// Arguments -_LIT8( KJobId, "JobId" ); -_LIT8( KJobIdList, "JobIdList" ); -_LIT8( KJobName, "JobName" ); -_LIT8( KUserName, "JobOriginatingUserName" ); -_LIT8( KCopies, "Copies" ); -_LIT8( KSides, "Sides" ); -_LIT8( KNumberUp, "NumberUp" ); -_LIT8( KOrientationRequest, "OrientationRequested" ); -_LIT8( KSize, "MediaSize" ); -_LIT8( KType, "MediaType" ); -_LIT8( KQuality, "PrintQuality" ); -_LIT8( KDataSink, "DataSink"); -_LIT8( KCriticalAttributes, "CriticalAttributesList" ); -//_LIT8( KCriticalAttributes, "A_ARG_TYPE_CriticalAttribList" ); -_LIT8( KDocFormat, "DocumentFormat" ); -_LIT8( KSourceURI, "SourceURI" ); -_LIT8( KSheetsCompleted, "JobMediaSheetsCompleted" ); -_LIT8( KPrinterState, "PrinterState" ); -_LIT8( KPrinterStateReasons, "PrinterStateReasons" ); -_LIT8( KInternetConnectState, "InternetConnectState" ); -_LIT8( KJobAbortState, "JobAbortState" ); -_LIT8( KJobEndState, "JobEndState" ); -_LIT8( KContentCompleteList, "ContentCompleteList" ); - -_LIT8( KPrintBasic, "PrintBasic:1" ); -_LIT8( KPrintEnhanced, "PrintEnhanced:1" ); -_LIT8( KJobIdErr, "-1"); - -// Job state -_LIT8(KUPnPJobStateSuccessful, "successful"); -_LIT8(KUPnPJobStateAborted, "aborted"); -_LIT8(KUPnPJobStateCanceled, "canceled"); - -// Printer states -_LIT8(KUPnPPrinterStateIdle, "idle"); -_LIT8(KUPnPPrinterStateProcessing, "processing" ); -_LIT8(KUPnPPrinterStateStopped, "stopped"); - -enum TUPnPState -{ - EJobStateSuccessful = 0, - EJobStateAborted, - EJobStateCanceled, - EPrinterStateIdle, - EPrinterStateProcessing, - EPrinterStateStopped, - EStatePrinting, - EStateReady, - EStatePending, - EStateUnknown -}; - -//UPnP PrinterStateReasons -_LIT8(KUPnPStateNone, "none"); -_LIT8(KUPnPStateAttentionRequired, "attention-required"); -_LIT8(KUPnPStateMediaJam, "media-jam"); -_LIT8(KUPnPStatePaused, "paused"); -_LIT8(KUPnPStateDoorOpen, "door-open"); -_LIT8(KUPnPStateMediaLow, "media-low"); -_LIT8(KUPnPStateMediaEmpty, "media-empty"); -_LIT8(KUPnPStateOutputAreaAlmostFull, "output-area-almost-full"); -_LIT8(KUPnPStateOutputAreaFull, "output-area-full"); -_LIT8(KUPnPStateMarkerSupplyLow, "marker-supply-low"); -_LIT8(KUPnPStateMarkerSupplyEmpty, "marker-supply-empty"); -_LIT8(KUPnPStateMarkerFailure, "marker-failure"); -_LIT8(KUPnPStateMediaChangeRequest, "media-change-request"); -_LIT8(KUPnPStateVendorDefined, "vendor-defined"); -_LIT8(KUPnPJobStateHwError, "hardware-error"); -_LIT8(KUPnPJobStateUriNotFound, "external-access-uri-not-found"); -_LIT8(KUPnPJobStateObjectFailure, "external-access-object-failure"); -_LIT8(KUPnPJobStateFormatError, "external-access-doc-format-error"); -_LIT8(KUPnPJobStateHttpError, "external-access-http-error"); -_LIT8(KUPnPJobStateCopies, "copies"); -_LIT8(KUPnPJobStateSides, "sides"); -_LIT8(KUPnPJobStateNumberUp, "number-up"); -_LIT8(KUPnPJobStateOrientationRequested,"orientation-requested"); -_LIT8(KUPnPJobStateMediaSize, "media-size"); -_LIT8(KUPnPJobStateMediaType, "media-type"); -_LIT8(KUPnPJobStatePrintQuality, "print-quality"); -_LIT8(KUPnPJobStateTextLayout, "text-layout"); -_LIT8(KUPnPJobStateImageLayout, "image-layout"); -_LIT8(KUPnPJobStateImageOrientation, "image-orientation"); -_LIT8(KUPnPJobStatePdlFidelity, "pdl-fidelity"); -_LIT8(KUPnPJobStateFontFamily, "font-family"); -_LIT8(KUPnPJobStateFontSize, "font-size"); - - -// Copies -#define KMaxCopiesLength 3 - -// Sides -_LIT8(KUPnPOneSided, "one-sided"); -_LIT8(KUPnPTwoSidedLongEdge, "two-sided-long-edge"); -_LIT8(KUPnPTwoSidedShortEdge, "two-sided-short-edge"); - -// Number up -_LIT8(KUPnP1Up, "1"); -_LIT8(KUPnP2Up, "2"); -_LIT8(KUPnP4Up, "4"); - -// Orientations -_LIT8(KUPnPPortrait, "portrait"); -_LIT8(KUPnPLandscape, "landscape"); -_LIT8(KUPnPReversePortrait, "reverse-portrait"); -_LIT8(KUPnPReverseLandscape,"reverse-landscape"); - -#define KUPnP270Deg 270; -#define KUPnPZeroDeg 0; -#define KUPnP90Deg 90; -#define KUPnP180Deg 180; - -// Media sizes -_LIT8(KUPnPNaLetterMediaSize, "na_letter_8.5x11in"); -_LIT8(KUPnPNaLegalMediaSize, "na_legal_8.5x14in"); -_LIT8(KUPnPIsoA4MediaSize, "iso_a4_210x297mm"); -_LIT8(KUPnPIsoC5MediaSize, "iso_c5_162x229mm"); -_LIT8(KUPnPIsoD1MediaSize, "iso_d1_110x220mm"); -_LIT8(KUPnPJisB4MediaSize, "jis_b4_257x364mm"); -_LIT8(KUPnPCustomXMmMediaSize, "custom_xxx_IIIxJJJmm"); -_LIT8(KUPnPCustomXInMediaSize, "custom_xxx_IIIxJJJin"); -_LIT8(KUPnPCustomMinMmMediaSize,"custom_min_xxx_IIIxJJJmm"); -_LIT8(KUPnPCustomMaxInMediaSize,"custom_max_xxx_IIIxJJJin"); - -// Custom sizes -_LIT8(KUPnPCustom4x6MediaSize, "custom_xxx_4x6in"); - -// Media types -_LIT8(KUPnPStationeryMediaType, "stationery"); -_LIT8(KUPnPStationeryInkjetMediaType, "stationery-inkjet"); -_LIT8(KUPnPTransparencyMediaType, "transparency"); -_LIT8(KUPnPEnvelopeMediaType, "envelope"); -_LIT8(KUPnPLabelsMediaType, "labels"); -_LIT8(KUPnPPhotographicMediaType, "photographic"); -_LIT8(KUPnPCardstockMediaType, "cardstock"); - -// Print quality -_LIT8(KUPnPNormalPrintQuality, "normal"); -_LIT8(KUPnPDraftPrintQuality, "draft"); -_LIT8(KUPnPHighPrintQuality, "high"); - -// Misc -_LIT8(KUPnPDocFormat, "application/xhtml-print"); -_LIT8(KUPnPUserName, "UPnP Print"); // Use instead the KUPnPAppFriendlyName name from central repository -_LIT( KUPnPDataPath, "c:\\system\\data\\upnp\\" ); -_LIT( KUPnPXhtmlPath, "c:\\system\\data\\upnp\\xhtml\\" ); -_LIT8(KHttpPrefix, "http://"); -_LIT8(KUPnPLineFeed8, "\n"); -_LIT( KUPnPLineFeed, "\n"); -_LIT8(KUPnPComma, ","); -_LIT8(KUPnPColon, ":"); -_LIT8(KUPnPSlash, "/"); - -// Upnp item type -_LIT8(KImageType, "object.item.imageItem"); -_LIT8(KTextType, "object.item.textItem"); - -// Mime type -_LIT8(KJpegMime, "image/jpeg"); -_LIT8(KHtmlMime, "text/html"); - -#define KMaxIdLength 10 - -// Print service -_LIT8(KUPnPServicePrint, "urn:schemas-upnp-org:service:PrintBasic:1"); - -/* -* @class TMapError -* @description This class contains the mapping for a single error - string / ImagePrint error code. -*/ -class TMapError -{ - public: - // @var iErrorCode ImagePrint error codes - TPrintMessageCodes iErrorCode; - - // @var iErrorString UPnP specific error string - TPtrC8 iErrorString; -}; - -#endif // UPCONSTS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cjobstateevents.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cjobstateevents.cpp Fri Jun 11 16:24:10 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: Declares CJobStateEvents class -* -*/ - - -#include - -#include "cjobstateevents.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// Constructors - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewL -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewL() -{ - CJobStateEvents *self = NewLC(); - CleanupStack::Pop(); // self - return self; -} - - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewLC -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewLC() -{ - CJobStateEvents *self = NewLC( - KNullDesC8(), KNullDesC8(), KNullDesC8(), KNullDesC8(), - KNullDesC8(), KNullDesC8(), KNullDesC8()); - return self; -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewL -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewL( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState) -{ - CJobStateEvents *self = NewLC( - aPrinterState, aPrinterStateReasons, aJobIdList,aJobEndState, - aJobMediaSheetsCompleted, aContentCompleteList, aJobAbortState); - CleanupStack::Pop(); // self - return self; -} - - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewLC -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewLC( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState) -{ - CJobStateEvents *self = new (ELeave) CJobStateEvents(); - CleanupStack::PushL(self); - self->ConstructL( - aPrinterState, aPrinterStateReasons, aJobIdList,aJobEndState, - aJobMediaSheetsCompleted, aContentCompleteList, aJobAbortState); - return self; -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewL -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewL(CJobStateEvents &a) -{ - CJobStateEvents *self = NewLC(a); - CleanupStack::Pop(); // self - return self; -} - - -// ----------------------------------------------------------------------------- -// CJobStateEvents::NewLC -// ----------------------------------------------------------------------------- -// -CJobStateEvents* CJobStateEvents::NewLC(CJobStateEvents &a) -{ - CJobStateEvents *self = new (ELeave) CJobStateEvents(); - CleanupStack::PushL(self); - - User::LeaveIfNull( a.iPrinterState ); - User::LeaveIfNull( a.iPrinterStateReasons ); - User::LeaveIfNull( a.iJobIdList ); - User::LeaveIfNull( a.iJobEndState ); - User::LeaveIfNull( a.iJobMediaSheetsCompleted ); - User::LeaveIfNull( a.iContentCompleteList ); - User::LeaveIfNull( a.iJobAbortState ); - - self->ConstructL( - a.iPrinterState->Des(), a.iPrinterStateReasons->Des(), a.iJobIdList->Des(), a.iJobEndState->Des(), - a.iJobMediaSheetsCompleted->Des(), a.iContentCompleteList->Des(), a.iJobAbortState->Des()); - return self; -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::ConstructL -// Two-phased constructor -// ----------------------------------------------------------------------------- -// -void CJobStateEvents::ConstructL( - const TDesC8& aPrinterState, const TDesC8& aPrinterStateReasons, const TDesC8& aJobIdList, - const TDesC8& aJobEndState,const TDesC8& aJobMediaSheetsCompleted, - const TDesC8& aContentCompleteList, const TDesC8& aJobAbortState) -{ - Delete(); - iPrinterState = aPrinterState.AllocL(); - iPrinterStateReasons = aPrinterStateReasons.AllocL(); - iJobIdList = aJobIdList.AllocL(); - iJobEndState = aJobEndState.AllocL(); - iJobMediaSheetsCompleted = aJobMediaSheetsCompleted.AllocL(); - iContentCompleteList = aContentCompleteList.AllocL(); - iJobAbortState = aJobAbortState.AllocL(); -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::ConstructL -// Two-phased constructor -// ----------------------------------------------------------------------------- -// -void CJobStateEvents::ConstructL(CJobStateEvents &a) -{ - ConstructL( - a.iPrinterState->Des(), a.iPrinterStateReasons->Des(), a.iJobIdList->Des(), a.iJobEndState->Des(), - a.iJobMediaSheetsCompleted->Des(), a.iContentCompleteList->Des(), a.iJobAbortState->Des()); -} - -// publics - -// ----------------------------------------------------------------------------- -// CJobStateEvents::ChangedEventL -// ----------------------------------------------------------------------------- -// -TBool CJobStateEvents::ChangedEventL(const TDesC8 &aEvent, TJobStateEvent aEnum) -{ - TBool changed(EFalse); - - switch( aEnum ) - { - case EPrinterState: - if(iPrinterState) - { - if(0 != aEvent.Compare(iPrinterState->Des())) - { - delete iPrinterState; - iPrinterState = NULL; - } - else break; - } - iPrinterState = aEvent.AllocL(); - changed = ETrue; - break; - case EPrinterStateReasons: - if(iPrinterStateReasons) - { - if(0 != aEvent.Compare(iPrinterStateReasons->Des())) - { - delete iPrinterStateReasons; - iPrinterStateReasons = NULL; - } - else break; - } - iPrinterStateReasons = aEvent.AllocL(); - changed = ETrue; - break; - case EJobIdList: - if(iJobIdList) - { - if(0 != aEvent.Compare(iJobIdList->Des())) - { - delete iJobIdList; - iJobIdList = NULL; - } - else break; - } - iJobIdList = aEvent.AllocL(); - changed = ETrue; - break; - case EJobEndState: - if(iJobEndState) - { - if(0 != aEvent.Compare(iJobEndState->Des())) - { - delete iJobEndState; - iJobEndState = NULL; - } - else break; - } - iJobEndState = aEvent.AllocL(); - changed = ETrue; - break; - case EJobMediaSheetsCompleted: - if(iJobMediaSheetsCompleted) - { - if(0 != aEvent.Compare(iJobMediaSheetsCompleted->Des())) - { - delete iJobMediaSheetsCompleted; - iJobMediaSheetsCompleted = NULL; - } - else break; - } - iJobMediaSheetsCompleted = aEvent.AllocL(); - changed = ETrue; - break; - case EContentCompleteList: - ContentCompleteL( aEvent, changed ); - break; - case EJobAbortState: - JobAbortStateL( aEvent, changed ); - break; - default: - break; - } - return changed; -} -void CJobStateEvents::ContentCompleteL ( const TDesC8 &aEvent, TBool& aChanged ) - { - if(iContentCompleteList) - { - if(0 != aEvent.Compare(iContentCompleteList->Des())) - { - delete iContentCompleteList; - iContentCompleteList = NULL; - } - else return; - } - iContentCompleteList = aEvent.AllocL(); - aChanged = ETrue; - - } - -void CJobStateEvents::JobAbortStateL ( const TDesC8 &aEvent, TBool& aChanged ) - { - if(iJobAbortState) - { - if(0 != aEvent.Compare(iJobAbortState->Des())) - { - delete iJobAbortState; - iJobAbortState = NULL; - } - else return; - } - iJobAbortState = aEvent.AllocL(); - aChanged = ETrue; - } - -// ----------------------------------------------------------------------------- -// CJobStateEvents::~CJobStateEvents -// C++ destructor -// ----------------------------------------------------------------------------- -// -CJobStateEvents::~CJobStateEvents() -{ - Delete(); -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::Delete -// ----------------------------------------------------------------------------- -// -void CJobStateEvents::Delete() -{ - if(iPrinterState) - delete iPrinterState; - iPrinterState = NULL; - - if(iPrinterStateReasons) - delete iPrinterStateReasons; - iPrinterStateReasons = NULL; - - if(iJobIdList) - delete iJobIdList; - iJobIdList = NULL; - - if(iJobEndState) - delete iJobEndState; - iJobEndState = NULL; - - if(iJobMediaSheetsCompleted) - delete iJobMediaSheetsCompleted; - iJobMediaSheetsCompleted = NULL; - - if(iContentCompleteList) - delete iContentCompleteList; - iContentCompleteList = NULL; - - if(iJobAbortState) - delete iJobAbortState; - iJobAbortState = NULL; -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::InitL -// ----------------------------------------------------------------------------- -// -void CJobStateEvents::InitL() -{ - Delete(); - iPrinterState = KNullDesC8().AllocL(); - iPrinterStateReasons = KNullDesC8().AllocL(); - iJobIdList = KNullDesC8().AllocL(); - iJobEndState = KNullDesC8().AllocL(); - iJobMediaSheetsCompleted = KNullDesC8().AllocL(); - iContentCompleteList = KNullDesC8().AllocL(); - iJobAbortState = KNullDesC8().AllocL(); -} - -// operators - -// ----------------------------------------------------------------------------- -// CJobStateEvents::operator== -// ----------------------------------------------------------------------------- -// -TBool CJobStateEvents::operator==(const CJobStateEvents& a) -{ - if ( iPrinterState && a.iPrinterState ) - { - if(0 != a.iPrinterState->Compare(iPrinterState->Des())) - return EFalse; - }else return EFalse; - if( iPrinterStateReasons && a.iPrinterStateReasons ) - { - if(0 != a.iPrinterStateReasons->Compare(iPrinterStateReasons->Des())) - return EFalse; - } - if( iJobIdList && a.iJobIdList ) - { - if(0 != a.iJobIdList->Compare(iJobIdList->Des())) - return EFalse; - }else return EFalse; - if( iJobEndState && a.iJobEndState ) - { - if(0 != a.iJobEndState->Compare(iJobEndState->Des())) - return EFalse; - }else return EFalse; - if( iJobMediaSheetsCompleted && a.iJobMediaSheetsCompleted ) - { - if(0 != a.iJobMediaSheetsCompleted->Compare(iJobMediaSheetsCompleted->Des())) - return EFalse; - }else return EFalse; - if( iContentCompleteList && a.iContentCompleteList ) - { - if(0 != a.iContentCompleteList->Compare(iContentCompleteList->Des())) - return EFalse; - }else return EFalse; - if( iJobAbortState && a.iJobAbortState ) - { - if(0 != a.iJobAbortState->Compare(iJobAbortState->Des())) - return EFalse; - }else return EFalse; - - return ETrue; -} - -// ----------------------------------------------------------------------------- -// CJobStateEvents::operator!= -// ----------------------------------------------------------------------------- -// -TBool CJobStateEvents::operator!=(const CJobStateEvents& a) -{ - return *this == a ? EFalse : ETrue; -} - -// protected - -// ----------------------------------------------------------------------------- -// CJobStateEvents::CJobStateEvents -// C++ default constructor -// ----------------------------------------------------------------------------- -// -CJobStateEvents::CJobStateEvents() -{ -} - -// End Of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cprintercontrolpoint.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cprintercontrolpoint.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,884 +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: Declares CPrinterControlPoint class -* -*/ - - -#include -#include -#include -#include -#include -#include - -#include "cuplogger.h" -#include "cprintercontrolpoint.h" -#include "mpcpobserver.h" - -// CONSTANTS -#define KMaxCancelReqs 100 - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::NewL -// Two-phased constructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CPrinterControlPoint* CPrinterControlPoint::NewL(MPCPObserver& aPCPObserver) -{ - LOG("[CPrinterControlPoint] \tCPrinterControlPoint::NewL"); - CPrinterControlPoint* self = new (ELeave) CPrinterControlPoint( aPCPObserver); - CleanupStack::PushL( self ); - self -> ConstructL( ); - CleanupStack::Pop( self ); - return self; -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::CPrinterControlPoint -// C++ default constructor -// ----------------------------------------------------------------------------- -// -CPrinterControlPoint::CPrinterControlPoint( MPCPObserver& aPCPObserver) - : CUpnpControlPoint(), iPCPObserver( aPCPObserver ) -{ -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::ConstructL -// Two-phased constructor -// ----------------------------------------------------------------------------- -// -void CPrinterControlPoint::ConstructL() -{ - LOG("[CPrinterControlPoint] \tCPrinterControlPoint::ConstructL"); - _LIT8( KPrinter, "Printer:1" ); - - // Base class ConstructL - CUpnpControlPoint::ConstructL( KPrinter()); - - // Share Xhtml folder (create if necessary) - RFs fsSession; - User::LeaveIfError( fsSession.Connect() ); - CleanupClosePushL( fsSession ); - TInt err = fsSession.MkDirAll( KUPnPXhtmlPath() ); - if (err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - CleanupStack::PopAndDestroy(&fsSession); - - iJobStateEvents = NULL; - - // Start printer search - TPtrC8 device_ptr; - device_ptr.Set( KPrinterDevice ); - SearchL( device_ptr ); - -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::~CPrinterControlPoint -// C++ default destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CPrinterControlPoint::~CPrinterControlPoint() -{ - LOG("[CPrinterControlPoint] \tCPrinterControlPoint::~CPrinterControlPoint()"); - iCancelledJobSIDs.Close(); - - if(iJobStateEvents) - { - delete iJobStateEvents; - } -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::CreateJobL -// Create printer job -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CPrinterControlPoint::CreateJobL( CUpnpDevice* aPrinter, const TDesC8& aPrintFile, - const TDesC8& aUserName, const TDesC8& aCopies, const TDesC8& aSides, - const TDesC8& aNumberUp, const TDesC8& aOrientationRequest, const TDesC8& aMediaSize, - const TDesC8& aMediaType, const TDesC8& aPrintQuality, TBool aPrintBasic ) -{ - LOG("[CPrinterControlPoint] \tCPrinterControlPoint::CreateJobL"); - - if(!aPrinter) - { - User::Leave(KErrArgument); - } - - if(iJobStateEvents) - { - iJobStateEvents->InitL(); - } - else - { - iJobStateEvents = CJobStateEvents::NewL(); - } - - // Set printer as authorized device - // - remove the previous printer address from allowed list - // - add the current printer address to allowed list - - TBuf8<20> logStr; - CUpnpHttpMessage::AddrOutput(aPrinter->Address(), logStr); - LOG81("[CPrinterControlPoint::CreateJobL]/t Printer address: %S", &logStr); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - - if (serviceType == EServiceNone) - { - User::Leave(KErrNotSupported); - } - - if (aPrintBasic) - { - // Force to use PrintBasic:1 - serviceType = EPrintBasic; - } - - // PrintBasic:1 or PrintEnhanced:1 supported - SubscribeL( service ); - CUpnpAction* action; - - // Create action according to service type - - if (serviceType == EPrintEnhanced) - { - LOG("[CPrinterControlPoint] \t -PrintEnhanced:1 - CreateJobV2"); - action = service->CreateActionLC( KCreateJobV2 ); - } - - else // serviceType == EPrintBasic - { - LOG("[CPrinterControlPoint] \t -PrintBasic:1 - CreateJob"); - action = service->CreateActionLC( KCreateJob() ); - } - - User::LeaveIfNull(action); - - // Common arguments for both action types - User::LeaveIfError(action -> SetArgumentL( KJobName, aPrintFile )); - User::LeaveIfError(action -> SetArgumentL( KUserName, aUserName)); - User::LeaveIfError(action -> SetArgumentL( KDocFormat, KUPnPDocFormat() )); - User::LeaveIfError(action -> SetArgumentL( KCopies, aCopies )); - User::LeaveIfError(action -> SetArgumentL( KSides, aSides )); - User::LeaveIfError(action -> SetArgumentL( KNumberUp, aNumberUp )); - User::LeaveIfError(action -> SetArgumentL( KOrientationRequest, aOrientationRequest )); - User::LeaveIfError(action -> SetArgumentL( KSize, aMediaSize )); - User::LeaveIfError(action -> SetArgumentL( KType, aMediaType )); - User::LeaveIfError(action -> SetArgumentL( KQuality, aPrintQuality )); - - if (serviceType == EPrintEnhanced) - { - // Fill in the rest arguments - User::LeaveIfError(action->SetArgumentL( KCriticalAttributes, KNullDesC8() )); - } - - // Send action - SendL( action ); - - // return session id - TInt sessionId = action->SessionId(); - CleanupStack::Pop(); // action - return sessionId; -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::PrintingFinishedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::PrintingFinishedL( CUpnpDevice* aPrinter ) -{ - - LOG("[CPrinterControlPoint::PrintingFinishedL] \t"); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if (serviceType == EServiceNone) - { - User::Leave(KErrNotSupported); - } - - // Service is PrintBasic:1 or PrintEnhanced:1 - Unsubscribe - UnsubscribeL(service); - - LOG("[CPrinterControlPoint::PrintingFinishedL] \t - unsubscribed... ...deleting event"); - - // init job state events - if ( iJobStateEvents ) - { - iJobStateEvents->InitL(); - } - // Remove last printer address from allowed list - - LOG("[CPrinterControlPoint::PrintingFinishedL] \t - out"); -} - - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::CancelJobL -// Cancel printer job -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::CancelJobL( CUpnpDevice* aPrinter, - const TDesC8& aJobId ) -{ - - LOG81("[CPrinterControlPoint] \tCPrinterControlPoint::CancelJobL %S", &aJobId); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if (serviceType == EServiceNone) - { - User::Leave(KErrNotSupported); - } - - // Service is PrintBasic:1 or PrintEnhanced:1 - DoCancelJobL(*service, aJobId); -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::CancelJobL -// Cancel printer job by session id -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::CancelJobL( const TInt aSessionId ) -{ - - LOG1("[CPrinterControlPoint::CancelJobL] \t by session id %d", aSessionId); - - // Add id to cancelled jobs - nothing else to do at this point - // Actual cancelling is done when a message with this session id and job id is received from printer - iCancelledJobSIDs.AppendL(aSessionId); - - // If number of pending cancel request exceeds KMaxCancelReqs delete the oldest request - if (iCancelledJobSIDs.Count() > KMaxCancelReqs) - { - iCancelledJobSIDs.Remove(0); - } - - -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::GetPrinterAttributesL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::GetPrinterAttributesL( CUpnpDevice* aPrinter ) -{ - - LOG("[CPrinterControlPoint::GetPrinterAttributesL]"); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if (serviceType == EServiceNone) - { - User::Leave(KErrNotSupported); - } - - if( serviceType == EPrintBasic ) - { - CUpnpAction* action = service -> CreateActionLC( KGetPrinterAttr ); - User::LeaveIfNull(action); - SendL( action ); - CleanupStack::Pop(); // action - } - - if( serviceType == EPrintEnhanced ) - { - CUpnpAction* action = service -> CreateActionLC( KGetPrinterAttrV2 ); - User::LeaveIfNull(action); - SendL( action ); - CleanupStack::Pop(); // action - } - -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::GetMarginsL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::GetMarginsL( CUpnpDevice* aPrinter, const TDesC8& aMediaSize, const TDesC8& aMediaType ) -{ - - LOG("[CPrinterControlPoint::GetMarginsL]"); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if( serviceType == EPrintEnhanced ) - { - CUpnpAction* action = service -> CreateActionLC( KGetMargins ); - User::LeaveIfNull(action); - User::LeaveIfError(action -> SetArgumentL( KSize, aMediaSize )); - User::LeaveIfError(action -> SetArgumentL( KType, aMediaType)); - SendL( action ); - CleanupStack::Pop(); // action - } - else - { - User::Leave(KErrNotSupported); - } - -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::GetMarginsL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::GetMediaListL( CUpnpDevice* aPrinter, const TDesC8& aMediaSize, const TDesC8& aMediaType ) -{ - - LOG("[CPrinterControlPoint::GetMediaListL]"); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if( serviceType == EPrintEnhanced ) - { - CUpnpAction* action = service -> CreateActionLC( KGetMediaList ); - User::LeaveIfNull(action); - User::LeaveIfError(action -> SetArgumentL( KSize, aMediaSize )); - User::LeaveIfError(action -> SetArgumentL( KType, aMediaType)); - SendL( action ); - CleanupStack::Pop(); // action - } - else - { - User::Leave(KErrNotSupported); - } - -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::GetJobAttributesL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::GetJobAttributesL( CUpnpDevice* aPrinter, - const TDesC8& aJobId ) -{ - - LOG("[CPrinterControlPoint::GetJobAttributesL]"); - - // Check services - TPrintService serviceType; - CUpnpService* service = GetServiceFromDevice( aPrinter, serviceType ); - - if (serviceType == EServiceNone) - { - User::Leave(KErrNotSupported); - } - - CUpnpAction* action = service -> CreateActionLC( KGetJobAttr ); - User::LeaveIfNull(action); - User::LeaveIfError(action -> SetArgumentL( KJobId, aJobId )); - SendL( action ); - CleanupStack::Pop(); // action - -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::StateUpdatedL -// From ControlPoint -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::StateUpdatedL( CUpnpService* aService ) -{ - // Seven evented state variables (see PrintEnhanced:1 and PrintBasic:1 specification for details): - // PrinterState, PrinterStateReasons, JobIdList, JobEndState, - // JobMediaSheetsConpleted, JobAbortState and ContentCompleteList - - // JobEndState == JobId,JobName,JobOriginatingUser, - // JobMediaSheetsConpleted,job-completion-state - - LOG("[CPrinterControlPoint::StateUpdatedL]"); - - User::LeaveIfNull(aService); - - JobStateLog(aService); - - CUpnpStateVariable* prntState = aService->StateVariable( KPrinterState() ); - CUpnpStateVariable* prntStateReasons = aService->StateVariable( KPrinterStateReasons() ); - CUpnpStateVariable* jobIdList = aService->StateVariable( KJobIdList() ); - CUpnpStateVariable* jobEndState = aService->StateVariable( KJobEndState() ); - CUpnpStateVariable* sheets = aService->StateVariable( KSheetsCompleted() ); - - // The next ones are supported only in PrintEnhanced:1 - CUpnpStateVariable* jobAbortState = aService->StateVariable( KJobAbortState() ); - CUpnpStateVariable* contentCompList = aService->StateVariable( KContentCompleteList() ); - - if ( iJobStateEvents ) - { - if( prntState ) - { - TPtrC8 ptr = RemoveTags( prntState->Value()); - if(iJobStateEvents->ChangedEventL(ptr, CJobStateEvents::EPrinterState)) - iPCPObserver.PrinterStateUpdated( ptr ); - } - if ( prntStateReasons ) - { - TPtrC8 ptr = RemoveTags( prntStateReasons->Value()); - if(iJobStateEvents->ChangedEventL(ptr, CJobStateEvents::EPrinterStateReasons)) - iPCPObserver.PrinterStateReasonsUpdated( ptr ); - } - - if ( jobIdList ) - { - TPtrC8 ptr = RemoveTags( jobIdList->Value()); - if(iJobStateEvents->ChangedEventL( ptr, CJobStateEvents::EJobIdList)) - iPCPObserver.JobIdListUpdated( ptr ); - } - - if ( jobEndState ) - { - TPtrC8 ptr = RemoveTags( jobEndState->Value()); - if(iJobStateEvents->ChangedEventL( ptr, CJobStateEvents::EJobEndState)) - iPCPObserver.JobEndStateUpdated( ptr ); - } - - if ( sheets ) - { - TPtrC8 ptr = RemoveTags( sheets->Value()); - if(iJobStateEvents->ChangedEventL(ptr, CJobStateEvents::EJobMediaSheetsCompleted)) - iPCPObserver.JobMediaSheetsCompletedUpdated( ptr ); - } - - if ( jobAbortState ) - { - TPtrC8 ptr = RemoveTags( jobAbortState->Value()); - if(iJobStateEvents->ChangedEventL(ptr, CJobStateEvents::EContentCompleteList)) - iPCPObserver.JobAbortStateUpdated( ptr ); - } - - if ( contentCompList ) - { - TPtrC8 ptr = RemoveTags( contentCompList->Value()); - if(iJobStateEvents->ChangedEventL( ptr, CJobStateEvents::EJobAbortState)) - iPCPObserver.ContentCompleteListUpdated( ptr ); - } - } -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DeviceDiscoveredL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::DeviceDiscoveredL( CUpnpDevice* aDevice) -{ - LOG("[CPrinterControlPoint::DeviceDiscoveredL]"); - iPCPObserver.DeviceDiscoveredL( aDevice ); -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DeviceDisappearedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::DeviceDisappearedL( CUpnpDevice* aDevice ) -{ - LOG("[CPrinterControlPoint::DeviceDisappearedL]"); - iPCPObserver.DeviceDisappeared( aDevice ); -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::ActionResponseReceivedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::ActionResponseReceivedL( CUpnpAction* aAction ) -{ - User::LeaveIfNull(aAction); - - LOG8S("[CPrinterControlPoint::ActionResponseReceivedL]\t - action: ", aAction->Name()); - - // First check out for pending cancel responses (ie. cancel requestes with session id) - TInt sessionId = aAction->SessionId(); - TInt index = iCancelledJobSIDs.Find(sessionId); - - if ( index >= 0 ) - { - // Cancel requested for this session's job - const TDesC8& jobId = aAction->ArgumentValue( KJobId() ); - - if (jobId.Length() > 0) - { - LOG("[CPrinterControlPoint::ActionResponseReceivedL] \t - Executing session id based canceling"); - DoCancelJobL( aAction->Service(), jobId); - - // Remove "queued" cancel job's session id from array - iCancelledJobSIDs.Remove(index); - - // No need to handle create job responses for this job id since it was canceled - if(( aAction->Name().Compare( KCreateJob ) == 0 ) || - ( aAction->Name().Compare( KCreateURIJob ) == 0)) - { - return; - } - } - } - - TInt err = KErrNone; - if( EHttp200Ok != aAction->Error() ) - { - err = aAction->Error(); - } - - // Check CreateJobResponse - if( aAction->Name().Compare( KCreateJob ) == 0 || aAction->Name().Compare( KCreateJobV2 ) == 0 ) - { - if( KErrNone == err ) - { - const TDesC8& jobName = aAction->ArgumentValue( KJobName() ); - const TDesC8& dataSinkUrl = aAction->ArgumentValue( KDataSink() ); - - // Send XHTML-print data (print data) via HTTP POST - - LOG("[CPrinterControlPoint] \t - Sending XHTML-print data via HTTP POST"); - TInetAddr addr; - CUpnpHttpMessage::AddrInput(addr, DataSinkUrlAddress( dataSinkUrl )); - addr.SetPort( DataSinkUrlPort( dataSinkUrl ) ); - - CUpnpHttpMessage* printDataMessage; - //CUpnpHttpMessage* printPictureMessage; - - - printDataMessage = RUpnpHttpMessageFactory::HttpPostL( addr, DataSinkUrlPath( dataSinkUrl ) ); - - //printPictureMessage = RUpnpHttpMessageFactory::HttpPostL( addr, DataSinkUrlPath( dataSinkUrl ) ); - - TFileName8 filePath; - filePath.Copy( KUPnPXhtmlPath() ); - filePath.Append(jobName); - printDataMessage->SetOutFilenameL( filePath ); - - TRAP(err, SendL( printDataMessage )); - - } - - iPCPObserver.CreateJobResponse( aAction, err ); - - - LOG1("[CPrinterControlPoint] \t - HTTP POST returns: %d", err); - } - else if( aAction->Name().Compare( KCreateURIJob ) == 0 ) - { - iPCPObserver.CreateJobResponse( aAction, err ); - } - else if( aAction->Name().Compare( KCancelJob ) == 0 ) - { - iPCPObserver.CancelJobResponse( aAction, err ); - } - else if( aAction->Name().Compare( KGetPrinterAttr ) == 0 ) - { - iPCPObserver.GetPrinterAttributesResponse( aAction, err ); - } - else if( aAction->Name().Compare( KGetPrinterAttrV2 ) == 0 ) - { - iPCPObserver.GetPrinterAttributesResponse( aAction, err ); - } - else if( aAction->Name().Compare( KGetJobAttr ) == 0 ) - { - iPCPObserver.GetJobAttributesResponse( aAction, err ); - } - else if( aAction->Name().Compare( KGetMargins ) == 0 ) - { - iPCPObserver.GetMarginsResponse( aAction, err ); - } - else if( aAction->Name().Compare( KGetMediaList ) == 0 ) - { - iPCPObserver.GetMediaListResponse( aAction, err ); - } - else - { - //to avoid lint error - } - -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::HttpResponseReceivedL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CPrinterControlPoint::HttpResponseReceivedL( - CUpnpHttpMessage* aMessage ) -{ - LOG("[CPrinterControlPoint::HttpResponseReceivedL] \t"); - if(aMessage) - { - LOG1( "[CPrinterControlPoint] \t - HTTP Response: %d", aMessage->Error() ); - } -} - -// private functions - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::GetServiceFromDevice -// ----------------------------------------------------------------------------- -// -CUpnpService* CPrinterControlPoint::GetServiceFromDevice( CUpnpDevice* aPrinter, TPrintService& aService ) -{ - LOG("[CPrinterControlPoint::GetServiceFromDevice]"); - CUpnpService* service = NULL; - aService = EServiceNone; - - if(!aPrinter) - { - return service; - } - - const RPointerArray& devices = DeviceList(); - - //Search of printer device - for( TInt i = 0; i < devices.Count(); i++ ) - { - if( devices[i]->DeviceType().Compare( aPrinter->DeviceType() ) == 0 && - devices[i]->Uuid().Compare( aPrinter->Uuid() ) == 0 ) - { - // Printer found - search of services - RPointerArray& services = devices[i]->ServiceList(); - - for( TInt j = 0; j < services.Count(); j++ ) - { - //PrintBasic:1 - if( services[j]->ServiceType().Compare( KPrintBasic ) == 0 ) - { - aService = EPrintBasic; - service = services[j]; - continue; // Continue to search for PrintEnhanced:1 - } - - // PrintEnhanced:1 - if( services[j]->ServiceType().Compare( KPrintEnhanced ) == 0 ) - { - aService = EPrintEnhanced; - service = services[j]; - break; - } - - } - break; - } - } - - return service; -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DataSinkUrlAddress -// ----------------------------------------------------------------------------- -// -const TPtrC8 CPrinterControlPoint::DataSinkUrlAddress( const TDesC8& aDataSinkUrl ) -{ - LOG("[CPrinterControlPoint::DataSinkUrlAddress] \t"); - - if ( aDataSinkUrl.Length() > UpnpHTTP::KHTTPUrl().Length() ) - { - TPtrC8 addrAndPath = aDataSinkUrl.Right(aDataSinkUrl.Length()-UpnpHTTP::KHTTPUrl().Length()); - TInt index = addrAndPath.Find( KUPnPColon() ); - if ( index == KErrNotFound ) - { - index = addrAndPath.Find( KUPnPSlash() ); - } - - if ( index == KErrNotFound ) - { - return TPtrC8( KNullDesC8().Ptr(), 0); - } - - TPtrC8 addr = addrAndPath.Left( index ); - - return addr; - } - - return TPtrC8( KNullDesC8().Ptr(), 0); -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DataSinkUrlPath -// ----------------------------------------------------------------------------- -// -const TPtrC8 CPrinterControlPoint::DataSinkUrlPath( const TDesC8& aDataSinkUrl ) -{ - LOG("[CPrinterControlPoint::DataSinkUrlPath] \t"); - - if ( aDataSinkUrl.Length() > KHttpPrefix().Length() ) - { - TPtrC8 addrAndPath = aDataSinkUrl.Right(aDataSinkUrl.Length()-KHttpPrefix().Length()); - TPtrC8 addr; - - // Find slash from URL and remove it, if it exists. - TInt index = addrAndPath.Find( KUPnPSlash() ); - // If not found, assume that path is right as is - if ( index == KErrNotFound ) - { - addr.Set( addrAndPath.Right( addrAndPath.Length() ) ); - } - // Slash found, copy data after it - else - { - addr.Set( addrAndPath.Right( addrAndPath.Length() - index ) ); - } - return addr; - } - else - { - return TPtrC8( KNullDesC8().Ptr(), 0); - } -} - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DataSinkUrlPort -// -// ----------------------------------------------------------------------------- -// -TInt CPrinterControlPoint::DataSinkUrlPort( const TDesC8& aDataSinkUrl ) -{ - LOG("[CPrinterControlPoint::DataSinkUrlPort] \t"); - - if (aDataSinkUrl.Length() > KHttpPrefix().Length()) - { - TPtrC8 addrAndPath = aDataSinkUrl.Right(aDataSinkUrl.Length()-KHttpPrefix().Length()); - TInt separIndex = addrAndPath.Find( KUPnPColon ); - if ( separIndex == KErrNotFound ) - { - return KDefaultHttpPortNumber; - } - TInt slashIndex = addrAndPath.Find( KUPnPSlash() ); - if ( slashIndex != -1 ) - { - TPtrC8 port = addrAndPath.Mid( separIndex+1, slashIndex-separIndex ); - - TLex8 lex( port ); - TInt prt; - lex.Val( prt ); - - return prt; - } - else - { - TPtrC8 port = addrAndPath.Right( addrAndPath.Length()-separIndex-1 ); - - TLex8 lex( port ); - TInt prt; - lex.Val( prt ); - - return prt; - } - } - return KDefaultHttpPortNumber; -} - - -// ----------------------------------------------------------------------------- -// CPrinterControlPoint::DoCancelJobL -// -// ----------------------------------------------------------------------------- -// -void CPrinterControlPoint::DoCancelJobL(CUpnpService& aService, const TDesC8& aJobId) -{ - LOG("[CPrinterControlPoint::DoCancelJobL]"); - CUpnpAction* action = aService.CreateActionLC( KCancelJob ); - User::LeaveIfNull(action); - User::LeaveIfError(action->SetArgumentL( KJobId, aJobId )); - SendL( action ); - CleanupStack::Pop(); // action -} - -//-------------------------------------------------------------------------------------------- -// -// CPrinterControlPoint::RemoveTags -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CPrinterControlPoint::RemoveTags( const TDesC8& aString) -{ - LOG("[CPrinterControlPoint::RemoveTags]\t"); - _LIT8(KUPnPStartTag, ">"); - _LIT8(KUPnPEndTag, ""); - - TPtrC8 midPtr; - midPtr.Set(aString); - - // Return if no tags - TInt startPos = aString.Find(KUPnPStartTag()); - if(KErrNotFound == startPos) - { - return midPtr; - } - - // Return if empty - if(KErrNotFound < aString.Match(KUPnPEmptyTag())) - { - return TPtrC8( KNullDesC8().Ptr(), 0); - } - - // Return the mid of tags - startPos += KUPnPStartTag().Length(); - - TInt endPos = aString.Find(KUPnPEndTag()); - if(KErrNotFound == endPos) - { - return midPtr; - } - - midPtr.Set(aString.Mid(startPos, endPos - startPos)); - return midPtr; -} - -//-------------------------------------------------------------------------------------------- -// -// CPrinterControlPoint::RemoveTags -// -//-------------------------------------------------------------------------------------------- -void CPrinterControlPoint::JobStateLog(CUpnpService* aService) -{ - if(!aService) - { - return; - } - LOG81("CPrinterControlPoint::JobStateLog\t prntState\t\t : %S", &(aService->StateVariable( KPrinterState() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t prntStateReasons: %S", &(aService->StateVariable( KPrinterStateReasons() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t jobIdList\t\t : %S", &(aService->StateVariable( KJobIdList() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t jobEndState\t : %S", &(aService->StateVariable( KJobEndState() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t sheets\t\t\t : %S", &(aService->StateVariable( KSheetsCompleted() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t jobAbortState\t : %S", &(aService->StateVariable( KJobAbortState() )->Value())); - LOG81("CPrinterControlPoint::JobStateLog\t contentCompList : %S", &(aService->StateVariable( KContentCompleteList() )->Value())); -} - -// End Of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupfilesharingactive.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupfilesharingactive.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +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: Declares CUPFileSharingActive class -* -*/ - - -#include -#include -#include - -#include "cupfilesharingactive.h" - -_LIT8( KRoot, "0" ); - - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::NewL -// ----------------------------------------------------------------------------- -// -CUPFileSharingActive* CUPFileSharingActive::NewL() - { - CUPFileSharingActive* self = new (ELeave) CUPFileSharingActive; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::RunL -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::RunL() - { - CActiveScheduler::Stop(); - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::DoCancel -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::DoCancel() - { - ; - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::RunError -// ----------------------------------------------------------------------------- -// -TInt CUPFileSharingActive::RunError( TInt aError ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::ShareItemL -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::ShareItemL( CUpnpItem& aItem ) - { - iStatus = KRequestPending; - iFileSharing->ShareItemL( KRoot, aItem, iStatus ); - SetActive(); - CActiveScheduler::Start(); - User::LeaveIfError( iStatus.Int() ); - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::UnShareItem -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::UnshareItemL( TInt aId ) - { - iFileSharing->UnshareItemL( aId, iStatus ); - SetActive(); - CActiveScheduler::Start(); - User::LeaveIfError( iStatus.Int() ); - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::GetSharedItemL -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::GetSharedItemL( TInt aId, CUpnpItem& aItem ) - { - iFileSharing->GetSharedItemL( aId, aItem , iStatus ); - SetActive(); - CActiveScheduler::Start(); - User::LeaveIfError(iStatus.Int()); - } - -// Constructors and destructor -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::CUPFileSharingActive -// ----------------------------------------------------------------------------- -// -CUPFileSharingActive::CUPFileSharingActive():CActive( EPriorityNormal ) - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::ConstructL -// ----------------------------------------------------------------------------- -// -void CUPFileSharingActive::ConstructL() - { - iFileSharing = CUpnpFileSharing::NewL(); - } - -// ----------------------------------------------------------------------------- -// CUPFileSharingActive::~CUPFileSharingActive -// ----------------------------------------------------------------------------- -// -CUPFileSharingActive::~CUPFileSharingActive() - { - Cancel(); - delete iFileSharing; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupjobstate.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupjobstate.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,779 +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: Declares CUPJobState class -* -*/ - - -#include - -#include "cupjobstate.h" -#include "upconsts.h" -#include "cupprintingjob.h" -#include "cuplogger.h" - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::NewL -// -//-------------------------------------------------------------------------------------------- -CUPJobState* CUPJobState::NewL() - { - CUPJobState *self = NewLC(); - CleanupStack::Pop(); // self - - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::NewLC -// -//-------------------------------------------------------------------------------------------- -CUPJobState* CUPJobState::NewLC() -{ - CUPJobState *self = new (ELeave) CUPJobState(); - CleanupStack::PushL(self); - self->ConstructL(); - - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::ConstructL() -{ - LOG("[CUPFileParser]\t ConstructL"); - Init(); - InitErrorValues(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::CUPJobState -// -//-------------------------------------------------------------------------------------------- -CUPJobState::~CUPJobState() -{ - Init(); - iErrorValues.Reset(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::Init -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::Init() -{ - iSheetsCompleted = KErrNotFound; - iSheetsToPrint = 0; // cannot be negative for progress - iId.Copy(KNullDesC8()); - iReason = ENoMessage; - iState = EStateUnknown; - iActiveId.Copy(KNullDesC8()); - iEndState.Init(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::InitErrorValues -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::InitErrorValues() -{ - TMapError err; - - err.iErrorCode = ENoMessage; - err.iErrorString.Set(KUPnPStateNone); - iErrorValues.Append(err); - - err.iErrorCode = EPbCheckPrinter; - err.iErrorString.Set(KUPnPStateAttentionRequired); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonPaperJam; - err.iErrorString.Set(KUPnPStateMediaJam); - iErrorValues.Append(err); - - err.iErrorCode = EPbCheckPrinter; - err.iErrorString.Set(KUPnPStatePaused); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonHardwareCoverOpen; - err.iErrorString.Set(KUPnPStateDoorOpen); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonPaperNearlyEmpty; - err.iErrorString.Set(KUPnPStateMediaLow); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonPaperEmpty; - err.iErrorString.Set(KUPnPStateMediaEmpty); - iErrorValues.Append(err); - - err.iErrorCode = ENoMessage; - err.iErrorString.Set(KUPnPStateOutputAreaAlmostFull); - iErrorValues.Append(err); - - err.iErrorCode = EPbCheckPrinter; - err.iErrorString.Set(KUPnPStateOutputAreaFull); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonInkLow; - err.iErrorString.Set(KUPnPStateMarkerSupplyLow); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonInkEmpty; - err.iErrorString.Set(KUPnPStateMarkerSupplyEmpty); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonInk; - err.iErrorString.Set(KUPnPStateMarkerFailure); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonPaperMedia; - err.iErrorString.Set(KUPnPStateMediaChangeRequest); - iErrorValues.Append(err); - - err.iErrorCode = EPbCheckPrinter; - err.iErrorString.Set(KUPnPStateVendorDefined); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateCopies); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateSides); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateNumberUp); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateOrientationRequested); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateMediaSize); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateMediaType); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStatePrintQuality); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateTextLayout); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateImageLayout); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateImageOrientation); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStatePdlFidelity); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateFontFamily); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateFontSize); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateFormatError); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateHttpError); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonHardware; - err.iErrorString.Set(KUPnPJobStateHwError); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateObjectFailure); - iErrorValues.Append(err); - - err.iErrorCode = EPbStatusErrorReasonFile; - err.iErrorString.Set(KUPnPJobStateUriNotFound); - iErrorValues.Append(err); - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::GetErrorValue -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::GetErrorValue(const TDesC8& aError) -{ - LOG81("[CUPJobState::GetErrorValue]\t for: %S", &aError); - for (TInt i = 0; i < iErrorValues.Count();++i) - { - if(0 == aError.Compare(iErrorValues[i].iErrorString)) - { -// LOG1("[CUPJobState::GetErrorValue]\t returns: %d", iErrorValues[i].iErrorCode); - return iErrorValues[i].iErrorCode; - } - } -// LOG("[CUPJobState::GetErrorValue]\t returns: EPbCheckPrinter"); - return EPbCheckPrinter; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetState -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::SetState(TUPnPState aState) -{ - LOG1("[CUPJobState::SetState]\t %d", aState); - - if(iActiveId.Length() < 1) - { - iState = EStateUnknown; - return; - } - - // return if state is one of the terminating states - if( EStateReady == iState || - EPrinterStateStopped == iState || - EStatePending == iState || - EJobStateAborted == iState || - EJobStateCanceled == iState ) - return; - - switch ( aState ) - { - case EPrinterStateStopped: - case EStatePending: - case EJobStateAborted: - case EJobStateCanceled: - case EStateReady: - Init(); - iState = aState; - break; - case EStatePrinting: - iState = aState; - break; - case EJobStateSuccessful: - iState = EStatePrinting; - break; - default: - if(0 == iId.Compare(ActiveId())) - { - if(SheetsToPrint() == SheetsCompleted()) - iState = EStateReady; - else if (EStateUnknown == iState) - iState = EStatePrinting; - } - break; - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::State -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::State() -{ -// LOG1("[CUPJobState::State]\t : %d",iState); - return iState; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetActiveId -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::SetActiveId(const TDesC8& aId) -{ - Init(); - iActiveId.Copy(aId); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::ActiveId -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CUPJobState::ActiveId() -{ - return iActiveId; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetSheetsCompleted -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::SetSheetsCompleted(const TDesC8& aSheetsCompleted) -{ -// LOG1("[CUPJobState::SetSheetsCompleted]\t - at the beginning SheetsCompleted(): %d",SheetsCompleted()); -// LOG8S("[CUPJobState::SetSheetsCompleted]\t - aSheetsCompleted: ",aSheetsCompleted); - - if(EStateReady == State()) - { - iSheetsCompleted = SheetsToPrint(); - LOG1("[CUPJobState::SetSheetsCompleted]\t - State ready, set SheetsToPrint(): %d",SheetsToPrint()); - } - else - { - TLex8 sheetsLex(aSheetsCompleted); - //Should here be an check about return value of Val??? /TTP - sheetsLex.Val(iSheetsCompleted); - } - LOG1("[CUPJobState::SetSheetsCompleted]\t - iSheetsCompleted: %d",SheetsCompleted()); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SheetsCompleted -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::SheetsCompleted() -{ - return iSheetsCompleted; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetReason -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::SetReason(TInt aReason) -{ - iReason = aReason; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::Reason -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::Reason() -{ - return iReason; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetJobList -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::SetJobList(const TDesC8& aJobIdList) -{ - TInt pos = PendingJobId(aJobIdList); - if(1 < pos) - SetState(EStatePending); - else if (1 == pos) - { - iId = ActiveId(); - SetState(EStatePrinting); - } - - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SetSheetsToPrint -// -//-------------------------------------------------------------------------------------------- -void CUPJobState::SetSheetsToPrint(TInt aSheets) -{ - LOG1("[CUPJobState::SetSheetsToPrint]\t aSheets\t = %d", aSheets); - if(0 < aSheets) - iSheetsToPrint = aSheets; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::SheetsToPrint -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::SheetsToPrint() -{ -// LOG1("[CUPJobState::SheetsToPrint]\t iSheetsToPrint\t = %d", iSheetsToPrint); - return iSheetsToPrint; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::Progress -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::Progress(TInt aSheets) -{ - TInt percentage = 0; - if(State() == EStateReady) - percentage = 100; - else if(0 < SheetsCompleted() && 0 < aSheets) - percentage = (((SheetsCompleted() << 8) / aSheets) * 100) >> 8; - -// LOG1("[CUPJobState::Progress]\t SheetsCompleted()\t = %d", SheetsCompleted()); -// LOG1("[CUPJobState::Progress]\t aSheets\t\t\t = %d", aSheets); - LOG1("[CUPJobState::Progress]\t percentage\t\t\t = %d%%", percentage); - - return percentage; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::Progress -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::Progress() -{ - return Progress(SheetsToPrint()); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::UpdateJobState -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::UpdateJobState(const TDesC8& aPrinterState, const TDesC8& aReason, const TDesC8& aJobList, const TDesC8& aJobId, const TDesC8& aSheetsCompleted) -{ - LOG81("[CUPJobState::UpdateJobState]\t active job: %S", &(ActiveId())); - - LOG81("[CUPJobState]\t - aPrinterState: %S", &aPrinterState); - LOG81("[CUPJobState]\t - aReason: %S", &aReason); - LOG81("[CUPJobState]\t - aJobList: %S", &aJobList); - LOG81("[CUPJobState]\t - aJobId: %S", &aJobId); - LOG81("[CUPJobState]\t - aSheetsCompleted: %S", &aSheetsCompleted); - - SetReason(GetErrorValue(aReason)); - - //Set sheets for progress - SetSheetsCompleted(aSheetsCompleted); - - // If printer state stopped, no reason to continue - if(KErrNotFound != aPrinterState.Find(KUPnPPrinterStateStopped())) - { - SetState(EPrinterStateStopped); - return State(); - } - - // If job is in the list, state is printing or pending. Else the job does not exist. - SetJobList(aJobList); - if(EStatePending == State()) - { - SetReason(EPbStatusErrorReasonHardwarePrinterBusy); - } - else if(State() == EStatePrinting && aJobId.Compare(ActiveId()) != 0 ) - { - LOG82("[CUPJobState::State]\t - Ready: iState: %d, aJobId; %S",iState, &aJobId); - SetState(EStateReady); - } - - return State(); -} - -//// PRIVATE /// - - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::CUPJobState -// -//-------------------------------------------------------------------------------------------- -CUPJobState::CUPJobState() -{ -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::PendingJobId -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::PendingJobId(const TDesC8& aJobIdList) -{ - if(0 >= aJobIdList.Length()) - return KErrNotFound; - - TInt count = 0; - TLex8 list(aJobIdList); - - TLex8 idLex(ActiveId()); - TInt activeId; - if (idLex.Val(activeId) != KErrNone) - { - return KErrArgument; - } - - while(!list.Eos() && count < 50) - { - ++count; - TInt val = KErrNotFound; - if(KErrNone == list.Val(val)) - { - if(activeId == val) - return count; - else - list.Inc(); - } - } - return KErrNotFound; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::ParseState -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::ParseState(const TDesC8& aState) -{ - if(KErrNotFound != aState.Find(KUPnPJobStateSuccessful())) - return EJobStateSuccessful; - if(KErrNotFound != aState.Find(KUPnPJobStateAborted())) - return EJobStateAborted; - if(KErrNotFound != aState.Find(KUPnPJobStateCanceled())) - return EJobStateCanceled; - if(KErrNotFound != aState.Find(KUPnPPrinterStateIdle())) - return EPrinterStateIdle; - if(KErrNotFound != aState.Find(KUPnPPrinterStateProcessing())) - return EPrinterStateProcessing; - if(KErrNotFound != aState.Find(KUPnPPrinterStateStopped())) - return EPrinterStateStopped; - - return EStateUnknown; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::ParseJobEndStateL -// -//-------------------------------------------------------------------------------------------- -TInt CUPJobState::ParseJobEndStateL(const TDesC8& aJobEndState) -{ -// LOG("[CUPJobState::ParseJobEndState]\t"); - iEndState.Init(); - TInt res = KErrNotFound; - - // Return if no data - if(1 > aJobEndState.Length()) - return res; - - // Parse current job and state from JobEndState - _LIT8(KSeparator, ","); - - RArray strings; - CleanupClosePushL(strings); - strings.Reset(); - - TPtrC8 ptr(aJobEndState); - TInt pos = aJobEndState.Find(KSeparator()); - while(KErrNotFound != pos) - { - strings.Append(ptr.Left(pos)); - pos += KSeparator().Length(); - ptr.Set(ptr.Right(ptr.Length() - pos)); - - pos = ptr.Find(KSeparator()); - if(KErrNotFound == pos) - strings.Append(ptr); - } - - // Assign strings in member variables if current job's state - if(1 <= strings.Count() && 0 == strings[0].Compare(ActiveId())) - { - if(1 <= strings.Count()) - { - iId.Copy(strings[0]); - iEndState.iId.Set(iId); - } - if(2 <= strings.Count()) - iEndState.iJobName.Set(strings[1]); - if(3 <= strings.Count()) - iEndState.iOriginator.Set(strings[2]); - if(4 <= strings.Count()) - { - SetSheetsCompleted(strings[3]); - iEndState.iSheets = SheetsCompleted(); - } - if(5 <= strings.Count()) - iEndState.iState = ParseState(strings[4]); - if(6 <= strings.Count()) - iEndState.iReason = GetErrorValue(strings[5]); - - res = KErrNone; - } - CleanupStack::PopAndDestroy( &strings ); - - return res; - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::PrinterStateUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::PrinterStateUpdated( const TDesC8& aEvent ) -{ - // If printer state not stopped, no reason to assign it - if(KErrNotFound < aEvent.Find(KUPnPPrinterStateStopped())) - { - SetState(EPrinterStateStopped); - } - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::PrinterStateReasonsUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::PrinterStateReasonsUpdated( const TDesC8& aEvent ) -{ - SetReason(GetErrorValue(aEvent)); - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::JobIdListUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::JobIdListUpdated( const TDesC8& aEvent ) -{ - //Check if pending - SetJobList(aEvent); - if(EStatePending == State()) - { - SetReason(EPbStatusErrorReasonHardwarePrinterBusy); - } - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::JobEndStateUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::JobEndStateUpdatedL( const TDesC8& aEvent ) -{ - // init id - iId.Copy(KNullDesC8()); - - // Parse if contains data and for this job - TInt res = ParseJobEndStateL(aEvent); - if(KErrNotFound != res) - { - SetState(iEndState.iState); - - // if any abort state updates never received, let's wait the one concerning this case - if(EJobStateAborted == iEndState.iState && iEndState.iAbortState) - return EStatePrinting; - } - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::JobMediaSheetsCompletedUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ) -{ - JobMediaSheetsCompletedUpdated(iId, aEvent); - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::JobMediaSheetsCompletedUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::JobMediaSheetsCompletedUpdated(const TDesC8& aId, const TDesC8& aEvent ) -{ - LOG82("[CUPJobState::JobMediaSheetsCompletedUpdated]\t - aId: %S aEvent: %S", &aId, &aEvent); - - // id matches to active id - if(0 == aId.Compare(ActiveId())) - { - SetSheetsCompleted(aEvent); - - // -1 for unknown, 0 for pending or processing (or finished) - if( (-1 == SheetsCompleted()) || (0 == SheetsCompleted()) ) - { - LOG81("[CUPJobState::JobMediaSheetsCompletedUpdated]\t - aId:%S\t",&aId); - } - else if (SheetsToPrint() == SheetsCompleted()) - { - LOG1("[CUPJobState::JobMediaSheetsCompletedUpdated]\t - state ready -> SheetsToPrint(): %d",SheetsToPrint()); - SetState(EStateReady); - } - else - { - LOG1("[CUPJobState::JobMediaSheetsCompletedUpdated]\t - state printing -> SheetsToPrint(): %d",SheetsToPrint()); - SetState(EStatePrinting); - } - } - - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::ContentCompleteListUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::ContentCompleteListUpdated( const TDesC8& /*aEvent*/ ) -{ - return State(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPJobState::JobAbortStateUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPJobState::JobAbortStateUpdatedL( const TDesC8& aEvent ) -{ - // Mark flag as true that any abort state messages never received - iEndState.iAbortState = ETrue; - - // Parse if contains data and for this job - TInt res = ParseJobEndStateL(aEvent); - if(KErrNotFound != res) - { - SetReason(iEndState.iReason); - SetState(iEndState.iState); - } - - return State(); -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupnpprintingdevice.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupnpprintingdevice.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1614 +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: Declares CUPnPPrintingDevice class -* -*/ - - -#include -#include -#include -#include -#include -#include - -#include "cupnpprintingdevice.h" -#include "cuplogger.h" -#include "upconsts.h" - -_LIT( KIconsFileName, "imageprintdata\\protocols\\upnpicons.mbm" ); - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::NewL -// -//-------------------------------------------------------------------------------------------- -MProtPrintingDevice* CUPnPPrintingDevice::NewL() - { - LOG("[CUPnPPrintingDevice]\t ConstructL"); - return new (ELeave) CUPnPPrintingDevice(); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::ConstructL(const TDesC& /*aDLLPath*/) - { - LOG("[CUPnPPrintingDevice]\t ConstructL"); - - iPrinterContainer = CUPPrinterContainer::NewL(); - iPrinterTimer = CPeriodic::NewL(CActive::EPriorityStandard); - iPrintFactory = CUPPrintFactory::NewL(); - - LOG("[CUPnPPrintingDevice]\t Done."); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::~CUPnPPrintingDevice -// -//-------------------------------------------------------------------------------------------- -CUPnPPrintingDevice::~CUPnPPrintingDevice() - { - if (iPrinterTimer){ - iPrinterTimer->Cancel(); - delete iPrinterTimer; - } - - if (iPrinterControl) - delete iPrinterControl; - - if (iFbsBitmap) - delete iFbsBitmap; - - if (iPrintingJob) - delete iPrintingJob; - - if (iPrinterContainer) - delete iPrinterContainer; - - if (iPrintFactory) - delete iPrintFactory; - - REComSession::DestroyedImplementation( iDtor_ID_Key ); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DiscoveryTimeoutCBL -// -//-------------------------------------------------------------------------------------------- -TBool CUPnPPrintingDevice::DiscoveryTimeoutCBL(TAny *aWho) - { - CUPnPPrintingDevice *cbTarget = static_cast(aWho); - return cbTarget->DoDiscoveryTimeoutL(ETrue); - } - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::StatusTimeoutCBL -// -//-------------------------------------------------------------------------------------------- -TBool CUPnPPrintingDevice::StatusTimeoutCBL(TAny *aWho) - { - CUPnPPrintingDevice *cbTarget = static_cast(aWho); - TInt res = KErrNone; - TInt err = KErrNone; - TRAP(err, res = cbTarget->DoStatusTimeoutL()); - if(KErrNone != err) - { - cbTarget->FinishPrinting(KErrTimedOut, err); - //Don't run the callback again - res = EFalse; - } - return res; - } - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SubmitTimeoutCBL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::SubmitTimeoutCBL(TAny *aWho) - { - CUPnPPrintingDevice *cbTarget = static_cast(aWho); - cbTarget->DoSubmitTimeoutL(); - return EFalse; // Don't run the callback again - } - - - - -// =============================== -// From MProtPrintingDevice. -// =============================== -// General -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::Version -// -//-------------------------------------------------------------------------------------------- -TVersion CUPnPPrintingDevice::Version() - { - LOG("[CUPnPPrintingDevice]\t Version"); - return TVersion(KVersionMajor, KVersionMinor, KVersionBuild); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SupportedProtocols -// -//-------------------------------------------------------------------------------------------- -TUint CUPnPPrintingDevice::SupportedProtocols() - { - return KImagePrint_PrinterProtocol_UPnP; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::RegisterIdleObserver -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::RegisterIdleObserver(MProtIdleObserver* /*aObserver*/) -{ - -} - - -// Discovery. -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::StartDiscoveryL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocol) -{ - LOG("[CUPnPPrintingDevice]\t StartDiscoveryL"); - iDiscoveryObserver = &aObserver; - iPrintersFound = EFalse; - - - TRAPD(err, StartDiscoveryInternalL(aProtocol)) - if(KErrNone != err) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, err, 0); - } - - return; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::StartDiscoveryL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::StartDiscoveryInternalL(TUint aProtocol) - { - LOG("[CUPnPPrintingDevice]\t StartDiscoveryInternalL"); - - if (!(aProtocol & KImagePrint_PrinterProtocol_UPnP)) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNotSupported, 0); - return; - } - - switch ( iState ) - { - case EUPnPDiscovery: // Already discovering - break; - case EUPnPUninitialized: - { - LOG("[CUPnPPrintingDevice]\t starting discovery"); - // (Re)start printer control point - RestartControlPointL(); - // No devices available - return printers from cache and start timer - SendPrinterListL(EFalse); - } - break; - case EUPnPJobReady: - case EUPnPReady: - { - LOG("[CUPnPPrintingDevice]\t returning latest printer list"); - SendPrinterListL(); - } - break; - case EUPnPCancellingDiscovery: - case EUPnPCancelling: - case EUPnPPrintingStarted: - case EUPnPPrinting: - default: - { - LOG("[CUPnPPrintingDevice]\t cannot start discovery"); - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrInvalidSequence, 0); - break; - } - - } - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::RemoveCachedDeviceL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::RemoveCachedDeviceL(TInt aDeviceID) - { - LOG("[CUPnPPrintingDevice::RemoveCachedDeviceL]"); - return iPrinterContainer->RemoveCachedDeviceL(aDeviceID); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CancelDiscovery -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::CancelDiscovery(TBool aDoCallBack) - { - LOG("[CUPnPPrintingDevice]\t CancelDiscovery"); - if (iState == EUPnPDiscovery) - { - iState = EUPnPCancellingDiscovery; - if (aDoCallBack && iDiscoveryObserver) - { - //We're not interested if the call back leaves - TRAP_IGNORE(iDiscoveryObserver->DiscoveryStatusL(EDiscoveryCancelling, KErrNone, 0)); - } - - // This needs to be trapped since this function is not named as leaving - no need to chekc the error value - TRAP_IGNORE( DoDiscoveryTimeoutL( EFalse ) ); - } - } - -// Print -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CreatePrintJobL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::CreatePrintJobL(TInt aDeviceId, RPointerArray& aImages, MProtPrintEventObserver& aObserver) - { - LOG("[CUPnPPrintingDevice]\t CreatePrintJobL"); - iPrintEventObserver = &aObserver; - - switch ( iState ) - { - case EUPnPReady: - case EUPnPJobReady: - { - LOG("[CUPnPPrintingDevice]\t initializing job container"); - InitJobL(aDeviceId, aImages); - return KErrNone; - } - case EUPnPCancelling: - case EUPnPPrintingStarted: - case EUPnPPrinting: - case EUPnPCancellingDiscovery: - case EUPnPUninitialized: - default: - { - LOG("[CUPnPPrintingDevice]\t cannot create job"); - break; - } - - } - return KErrInvalidSequence; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SubmitPrintJobL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::SubmitPrintJobL() - { - - LOG("[CUPnPPrintingDevice]\t SubmitPrintJobL"); - TInt err = KErrNone; - - switch ( iState ) - { - case EUPnPPrintingStarted: - case EUPnPPrinting: - break; // Already printing - case EUPnPJobReady: - { - LOG("[CUPnPPrintingDevice]\t submitting jobs"); - - // Share jobs - TRAP(err, iPrintingJob->ShareImagesL()); - if (err != KErrNone) - { - LOG1("[CUPnPPrintingDevice]\t -Sharing failed: %d", err); - break; - } - - LOG1("[CUPnPPrintingDevice::SubmitPrintJobL]\t start printing with state=%d", iState); - iState = EUPnPSubmittingJob; - TRAP(err, StartPrintingL()); - if (err != KErrNone) - iState = EUPnPJobReady; - - LOG1("[CUPnPPrintingDevice::SubmitPrintJobL]\t StartPrintingL leaves with %d", err); - LOG1("[CUPnPPrintingDevice::SubmitPrintJobL]\t state=%d", iState); - } - break; - case EUPnPDiscovery: - case EUPnPCancelling: - case EUPnPCancellingDiscovery: - case EUPnPUninitialized: - case EUPnPReady: - default: - { - LOG("[CUPnPPrintingDevice]\t Invalid sequence to submit job"); - err = KErrInvalidSequence; - } - break; - } - - if(KErrNone != err) - { - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(EObexSendError, err); - else - User::Leave(err); - } - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CancelPrintJob -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::CancelPrintJob() - { - LOG("[CUPnPPrintingDevice]\t CancelPrintJob"); - return DoCancelPrinting(); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::ContinuePrintJobL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::ContinuePrintJobL() - { - return KErrInvalidSequence; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetNumPrintPages -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetNumPrintPages() -{ - if( iPrintingJob ) - return iPrintingJob->Sheets(); - else - return KErrInvalidSequence; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetPrintJobStatus -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetPrintJobStatus() - { - if (iState == EUPnPPrinting) - return KErrInvalidSequence; - return KErrNone; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetPrinterStatus -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetPrinterStatus(TInt /*aDeviceId*/) - { - return KErrNone; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetDeviceCapabilityIDsL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetDeviceCapabilityIDsL(TInt /*aDeviceID*/, RArray& aCapabilityIDs) - { - LOG("[CUPnPPrintingDevice]\t GetDeviceCapabilityIDsL"); - - if (iState == EUPnPUninitialized) - { - LOG("[CUPnPPrintingDevice]\t No devices discovered"); - return KErrInvalidSequence; - } - - // Return supported settings from XHTML file factory - iPrintFactory->GetCapabilityIDs(aCapabilityIDs); - return KErrNone; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetDeviceCapabilityL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetDeviceCapabilityL(TInt /*aDeviceID*/, TInt aCapabilityID, TPrintCapability& aCapability) - { - LOG("[CUPnPPrintingDevice]\t GetDeviceCapabilityL"); - - if (iState == EUPnPUninitialized) - { - LOG("[CUPnPPrintingDevice]\t No devices discovered"); - return KErrInvalidSequence; - } - - // Return value from XHTML-print file factory - return iPrintFactory->GetCapability(aCapabilityID, aCapability); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetJobSetting -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetJobSetting(TInt aCapabilityID, TInt& aValue) - { - LOG("[CUPnPPrintingDevice]\t GetJobSetting"); - if (iState != EUPnPJobReady) - { - LOG("[CUPnPPrintingDevice]\t Invalid state"); - return KErrInvalidSequence; - } - - return iPrintFactory->GetPrintSetting(aCapabilityID, aValue); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SetJobSettingL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - LOG("[CUPnPPrintingDevice]\t SetJobSettingL"); - if (iState != EUPnPJobReady) - { - LOG("[CUPnPPrintingDevice]\t Invalid state"); - return KErrInvalidSequence; - } - - // Set setting in job container - aAffectedCapability = aCapabilityID; - return iPrintFactory->SetPrintSetting(aCapabilityID, aValue); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetNumPreviewPages -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetNumPreviewPages() - { - return KErrNotSupported; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetJobTemplateIconL -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::GetJobTemplateIconL(TInt /*aTemplateID*/, TInt& aFsBitmapHandle) - { - TInt res = KErrNone; - - if(iFbsBitmap) - aFsBitmapHandle = iFbsBitmap->Handle(); - else - { - iFbsBitmap = new (ELeave) CFbsBitmap(); - TFileName iconsFileName; - iconsFileName.Append( KDC_RESOURCE_FILES_DIR ); - iconsFileName.Append( KIconsFileName ); - res = iFbsBitmap->Load( iconsFileName ,EMbmUpnpiconsIcon ); - - if( res == KErrNone ) - aFsBitmapHandle = iFbsBitmap->Handle(); - else - { - aFsBitmapHandle = 0; - delete iFbsBitmap; - iFbsBitmap = NULL; - } - } - - return res; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CreatePreviewImage -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::CreatePreviewImage(TInt /*aPageNumber*/) - { - return KErrNotSupported; - } - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SetNumsOfCopiesL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ) -{ - if(iState != EUPnPJobReady) - aErr = KErrInvalidSequence; - else - aErr = iPrintingJob->SetNumsOfCopies(aNumsOfCopies); - - return; -} - -// ========================================================================================== -// From MPCPObserver -// ========================================================================================== -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CreateJobResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::CreateJobResponse( CUpnpAction* aAction, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::CreateJobResponse]\t Error: %d", aErrorCode); - - if(!aAction) - return; - - if (iState == EUPnPCancelling || iPrintingJob->SessionId() != aAction->SessionId()) - return; - - if(KErrNone != aErrorCode) - { - FinishPrinting(EObexConnectError, aErrorCode); - return; - } - - ResetTimer(); - iPrintingJob->SetJobId(aAction->ArgumentValue(KJobId())); - - iState = EUPnPPrintingStarted; - - TBuf8 id; - iPrintingJob->GetJobId(id); - - LOG("[CUPnPPrintingDevice]\t ******"); - LOG81("[CUPnPPrintingDevice]\t -Printing started with job id: * %S", &id); - LOG("[CUPnPPrintingDevice]\t ******"); - - // Printing started - restart timer - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(StatusTimeoutCBL, this) ); -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CancelJobResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::CancelJobResponse( CUpnpAction* /*aAction*/, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::CancelJobResponse]\t Error: %d", aErrorCode); - - FinishPrinting(aErrorCode, KErrNone); - if (iPrintEventObserver && KErrNone == aErrorCode) - iPrintEventObserver->PrintJobProgressEvent(EDone, iPrintingJob->Progress(), ECancelling); -} -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetPrinterAttributesResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::GetPrinterAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::GetPrinterAttributesResponse]\t Error: %d", aErrorCode); - - if(!aAction) - return; - - if (KErrNone != aErrorCode) - { - FinishPrinting(KErrGeneral, aErrorCode); - return; - } - - // Cancel and restart timer - // Read printer attributes from action and update job status - TUPnPState state = EStateUnknown; - TRAPD(err, state = iPrintingJob->UpdateJobState(aAction->ArgumentValue( KPrinterState() ), - aAction->ArgumentValue( KPrinterStateReasons() ), - aAction->ArgumentValue( KJobIdList() ), - aAction->ArgumentValue( KJobId() ), - aAction->ArgumentValue( KSheetsCompleted() ) ) ); - if(KErrNone != err) - { - FinishPrinting(KErrGeneral, err); - return; - } - - UpdatePrintingStatus(state); -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetJobAttributesResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::GetJobAttributesResponse( CUpnpAction* aAction, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::GetJobAttributesResponse]\t Error: %d", aErrorCode); - - if (KErrNone != aErrorCode) - { - LOG1("[CUPnPPrintingDevice:.GetJobAttributesResponse]\t - GetPrinterAttributesL with error: %d", aErrorCode); - - TInt err = KErrNone; - CUpnpDevice* printer = GetPrinter(); - if(!printer) - err = KErrNoMemory; - else - TRAP(err, iPrinterControl->GetPrinterAttributesL(printer)); - - if(KErrNone != err) - FinishPrinting(KErrGeneral, err); - - return; - } - - if(!aAction) - return; - - LOG81("[CUPnPPrintingDevice::GetJobAttributesResponse]\t sheets: ", &(aAction->ArgumentValue( KSheetsCompleted() ))); - LOG81("[CUPnPPrintingDevice::GetJobAttributesResponse]\t name: ", &(aAction->ArgumentValue( KJobName() ))); - LOG81("[CUPnPPrintingDevice::GetJobAttributesResponse]\t origin: ", &(aAction->ArgumentValue( KUserName() ))); - LOG81("[CUPnPPrintingDevice::GetJobAttributesResponse]\t id: ", &(aAction->ArgumentValue( KJobId() ))); - - TBuf8 id; - iPrintingJob->GetJobId(id); - - TUPnPState state = EStateUnknown; - state = iPrintingJob->JobMediaSheetsCompletedUpdated(id, aAction->ArgumentValue( KSheetsCompleted() ) ); - - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetMarginsResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::GetMarginsResponse( CUpnpAction* /*aAction*/, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::GetMarginsResponse]\t Error: %d", aErrorCode); - if (KErrNone != aErrorCode) - { - FinishPrinting(KErrGeneral, aErrorCode); - return; - } - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetMediaListResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::GetMediaListResponse( CUpnpAction* /*aAction*/, TInt aErrorCode ) -{ - LOG1("[CUPnPPrintingDevice::GetMediaListResponse]\t Error: %d", aErrorCode); - if (KErrNone != aErrorCode) - { - FinishPrinting(KErrGeneral, aErrorCode); - return; - } - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::StateUpdatedResponse -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::StateUpdatedResponse( const TDesC8& /*aPrinterState*/, - const TDesC8& /*aPrinterStateReasons*/, - const TDesC8& /*aJobIdList*/, - const TDesC8& /*aJobEndState*/, - const TDesC8& /*aJobMediaSheetsCompleted*/, - const TDesC8& /*aJobAbortState*/, - const TDesC8& /*aContentCompleteList*/ ) -{ - LOG("[CUPnPPrintingDevice::StateUpdatedResponse]\t"); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::PrinterStateUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::PrinterStateUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::PrinterStateUpdated]\t:%S",&aEvent); - iStatusTimeout = EFalse; - TUPnPState state = iPrintingJob->PrinterStateUpdated(aEvent); - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::PrinterStateReasonsUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::PrinterStateReasonsUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::PrinterStateReasonsUpdated]\t: %S",&aEvent); - iStatusTimeout = EFalse; - TUPnPState state = iPrintingJob->PrinterStateReasonsUpdated(aEvent); - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::JobIdListUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::JobIdListUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::JobIdListUpdated]\t:%S",&aEvent); - iStatusTimeout = EFalse; - TUPnPState state = iPrintingJob->JobIdListUpdated(aEvent); - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::JobEndStateUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::JobEndStateUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::JobEndStateUpdated]\t:%S",&aEvent); - - TUPnPState state = EStateUnknown; - TRAPD(err, state = iPrintingJob->JobEndStateUpdatedL(aEvent)); - if(KErrNone != err) - { - LOG1("[CUPnPPrintingDevice::JobEndStateUpdated]\t leaving with error %d. Continue with timer.",err); - return; - } - - iStatusTimeout = EFalse; - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::JobMediaSheetsCompletedUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::JobMediaSheetsCompletedUpdated]\t:%S",&aEvent); - iStatusTimeout = EFalse; - TUPnPState state = iPrintingJob->JobMediaSheetsCompletedUpdated(aEvent); - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::ContentCompleteListUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::ContentCompleteListUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::ContentCompleteListUpdated]\t:%S",&aEvent); - iStatusTimeout = EFalse; - TUPnPState state = iPrintingJob->ContentCompleteListUpdated(aEvent); - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::JobAbortStateUpdated -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::JobAbortStateUpdated( const TDesC8& aEvent ) -{ - // no need to check the states: we're not printing - if(EUPnPPrintingStarted != iState && EUPnPPrinting != iState) - return; - - LOG81("[CUPnPPrintingDevice::JobAbortStateUpdated]\t:%S",&aEvent); - - TUPnPState state = EStateUnknown; - TRAPD(err, state = iPrintingJob->JobAbortStateUpdatedL(aEvent)); - if(KErrNone != err) - { - LOG1("[CUPnPPrintingDevice::JobAbortStateUpdatedL]\t leaving with error %d. Continue with timer.",err); - return; - } - - iStatusTimeout = EFalse; - UpdatePrintingStatus(state); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DeviceDiscoveredL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::DeviceDiscoveredL( CUpnpDevice* aDevice ) -{ - - LOG("[CUPnPPrintingDevice::DeviceDiscovered]\t "); - TInt id; - TInt err = KErrNone; - - if(!aDevice) - return; - - //Trap this: the iDiscoveryObserver will othervise never know about error - TRAP(err, iPrinterContainer->AddPrinterL(*aDevice, id)); - - // Inform about error and leave - if(KErrNone != err && KErrAlreadyExists != err) - { - if(iDiscoveryObserver && iState == EUPnPDiscovery) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, err, 0); - } - User::Leave(err); - } - - iPrintersFound = ETrue; - if (iState == EUPnPUninitialized) - { - iState = EUPnPReady; - } - - if(iState == EUPnPDiscovery && iDiscoveryObserver && KErrAlreadyExists != err) - { - - TInt index = iPrinterContainer->PrinterIndex(id); - TPrinter printer = iPrinterContainer->ToTPrinter(index); - iDiscoveryObserver->FoundDeviceL(printer); - } - - if (iState == EUPnPSubmittingJob) - { - // Check if the discovered printer is the one we're trying to print with - if (iPrintingJob->PrinterId() == id) - { - // Stop submit timer and submit job - ResetTimer(); - TRAP(err, SubmitJobToPcpL(*aDevice, id) ); - - // If error occured inform client - leaving not necessary here - if (err != KErrNone) - { - if (iPrintEventObserver) - { - iPrintEventObserver->PrintJobErrorEvent(EObexConnectError, err); - } - iState = EUPnPJobReady; - } - } - } - LOG("[CUPnPPrintingDevice::DeviceDiscovered]\t -out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DeviceDisappeared -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::DeviceDisappeared( CUpnpDevice* aDevice ) -{ - LOG("[CUPnPPrintingDevice]\t DeviceDisappeared"); - if ( aDevice ) - { - // Notify protocol client if we're in discovery state - if(iState == EUPnPDiscovery && iDiscoveryObserver) - { - TInt index = iPrinterContainer->PrinterIndex( *aDevice ); - if (index >= 0) - { - LOG("[CUPnPPrintingDevice]\t informing observer"); - TPrinter printer = iPrinterContainer->ToTPrinter(index); - - // Notification needs to be trapped because this is not a leaving function - TRAP_IGNORE(iDiscoveryObserver->RemoveDeviceL(printer)); - - iPrinterContainer->RemovePrinter(index); - } - } - else - { - LOG("[CUPnPPrintingDevice]\t saving to disappeared list"); - // Trapped because this is not a leaving function - TRAP_IGNORE(iPrinterContainer->PrinterDisappeared( *aDevice )); - } - } - if ( iPrinterContainer->PrinterCount() < 1 ) - { - iPrintersFound = EFalse; - } -} - - -///////////////////////// -// Protected. -///////////////////////// - - -///////////////////////// -// Private. -///////////////////////// -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::CUPnPPrintingDevice -// -//-------------------------------------------------------------------------------------------- -CUPnPPrintingDevice::CUPnPPrintingDevice() - { - iPrinterTimer = NULL; - iState = EUPnPUninitialized; - iPrintersFound = EFalse; - iTriedReadCacheAndFail = EFalse; - ResetTimer(); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::RestartControlPointL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::RestartControlPointL() - { - if (iPrinterControl) - { - delete iPrinterControl; - iPrinterControl = NULL; - } - - iFriendlyName.Copy(KUPnPUserName()); - - CUpnpSettings *rep = CUpnpSettings::NewL( KCRUidUPnPStack ); - CleanupStack::PushL(rep); - //Get Access Point from central repository - TInt iapId = -1; - User::LeaveIfError( rep->Get( CUpnpSettings::KUPnPStackIapId, iapId )); - - //Check accessPoint and leave if not ok - if( iapId < 0 ) - { - if(iDiscoveryObserver) - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrAbort, 0); - User::Leave( KErrAbort ); - } - - CleanupStack::PopAndDestroy(rep); - - - // Create printer control point - search starts right away - LOG("[CUPnPPrintingDevice]\t - Printer control point"); - iPrinterControl = CPrinterControlPoint::NewL(*this); - } - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SendPrinterListL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::SendPrinterListL(TBool aSync) -{ -LOG("[CUPnPPrintingDevice]\t SendPrinterListL Begin"); - TInt err = KErrNone; - if (aSync) - { - // Remove disappeared devices from array - iPrinterContainer->SyncPrinterArray(); - } - - if (iPrinterContainer->PrinterCount() < 1 && !iTriedReadCacheAndFail) - { - // Read printer cache - LOG("[CUPnPPrintingDevice]\t SendPrinterListL xxx trying read cache file"); - TRAP(err, iPrinterContainer->ReadCacheL()); - if(KErrNone != err) - { - LOG1("[CUPnPPrintingDevice]\t SendPrinterListL xxx some error file reading %d", err); - if(err == KErrNotFound) - { - iPrintersFound = EFalse; - iTriedReadCacheAndFail = ETrue; - } - else - User::Leave(err); - } - else - { - LOG("[CUPnPPrintingDevice]\t SendPrinterListL xxx cachefile readed"); - iPrintersFound = EFalse; - } - - if(aSync) - { - RestartControlPointL(); - } - } - - if (iPrinterContainer->PrinterCount() > 0 && iDiscoveryObserver) - { - for (TInt i=0; i< iPrinterContainer->PrinterCount(); i++) - { - TPrinter t = iPrinterContainer->ToTPrinter(i); - iDiscoveryObserver->FoundDeviceL( t ); - } - } - - if (!iPrintersFound) - { - // start timed search - StartTimer(KPrinterDiscoveryTimeout, KPrinterDiscoveryTimeout, TCallBack(DiscoveryTimeoutCBL, this) ); - iState = EUPnPDiscovery; - iTriedReadCacheAndFail = EFalse; - } - else if(iDiscoveryObserver) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNone, 0); - } - else - { - User::LeaveIfNull(iDiscoveryObserver); - } - LOG("[CUPnPPrintingDevice]\t SendPrinterListL end"); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DoDiscoveryTimeoutL -// -//-------------------------------------------------------------------------------------------- -TBool CUPnPPrintingDevice::DoDiscoveryTimeoutL(TBool aDoCallBack) -{ - LOG("[CUPnPPrintingDevice]\t DoDiscoveryTimeOut"); - - ResetTimer(); - switch( iState ) - { - case EUPnPCancellingDiscovery: - { - LOG("[CUPnPPrintingDevice]\t cancelling discovery"); - - if (iPrinterContainer->PrinterCount() > 0) - { - iPrintersFound = ETrue; - } - - if (aDoCallBack && iDiscoveryObserver) - { - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNone, 0); - } - - } - break; - case EUPnPDiscovery: - { - LOG("[CUPnPPrintingDevice]\t discovery timeout"); - - // Notify about cached devices, which weren't discovered - RPointerArray cachedPrinters; - CleanupClosePushL(cachedPrinters); - iPrinterContainer->GetDisappearedPrinters(cachedPrinters); - for (TInt i=0; i < cachedPrinters.Count(); i++) - { - TPrinter printer = cachedPrinters[i]->ToTPrinter(); - iDiscoveryObserver->RemoveDeviceL(printer); - } - - CleanupStack::PopAndDestroy(); //cachedPrinters - - // Remove disappeared printers and cached printers, which weren't found printers from container - iPrinterContainer->SyncPrinterArray(); - - if (iPrinterContainer->PrinterCount() > 0) - { - iPrintersFound = ETrue; - } - - // Notify client's observer - if (aDoCallBack && iDiscoveryObserver) - iDiscoveryObserver->DiscoveryStatusL(EDiscoveryFinished, KErrNone, 0); - - } - break; - default: - break; - } - - if (!iPrintersFound) - { - LOG("[CUPnPPrintingDevice]\t no printers found"); - iState = EUPnPUninitialized; - } - else - { - iState = EUPnPReady; - } - - //Don't run this callback again - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DoStatusTimeoutL -// -//-------------------------------------------------------------------------------------------- -TBool CUPnPPrintingDevice::DoStatusTimeoutL() -{ - LOG("[CUPnPPrintingDevice]\t DoStatusTimeOut"); - - if (iState == EUPnPCancelling || iState == EUPnPSubmittingJob) - { - // Printer did not response to cancel or create job - LOG("[CUPnPPrintingDevice]\t - no response for cancel or create."); - FinishPrinting(KErrGeneral, EPbCheckPrinter); - return EFalse; // do not call again - } - - if (iState == EUPnPPrinting || iState == EUPnPPrintingStarted) - { - --iPendingCount; - - // No printing status notifications received - CUpnpDevice* printer = GetPrinter(); - if (!printer || iStatusTimeout || 0 > iPendingCount) - { - // print error - cancel printing - LOG("[CUPnPPrintingDevice]\t - print error - cancel printing."); - LOG1("[CUPnPPrintingDevice]\t - iStatusTimeout: %d", iStatusTimeout); - LOG1("[CUPnPPrintingDevice]\t - iPendingCount: %d", iPendingCount); - ResetTimer(); - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(KErrTimedOut, EPbCheckPrinter); - DoCancelPrinting(); - return EFalse; // do not call again - } - - iStatusTimeout = ETrue; - - LOG1("[CUPnPPrintingDevice]\t - GetPrinterAttributesL with iState: %d", iState); - iPrinterControl->GetPrinterAttributesL(printer); - - /*LOG1("[CUPnPPrintingDevice]\t - GetJobAttributesL with iState: %d", iState); - TBuf8 id; - iPrintingJob->GetJobId(id); - iPrinterControl->GetJobAttributesL(printer, id);*/ - } - - return ETrue; // call again -} - - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::InitJobL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::InitJobL(TInt aDeviceId, RPointerArray& aImages) -{ - LOG("[CUPnPPrintingDevice::InitJobL]\t"); - - // Check that device exists - CUPPrinter* printer = iPrinterContainer->Printer(aDeviceId); - if (!printer) - { - LOG("[CUPnPPrintingDevice]\t printer not found"); - User::Leave(KErrArgument); - } - - // Create job - if (iPrintingJob) - { - delete iPrintingJob; - iPrintingJob = NULL; - } - - // Change format of file list - RArray imageList; - CleanupClosePushL(imageList); - for (TInt i=0; i < aImages.Count(); i++) - { - LOG81("[InitJobL]\t ", aImages[i]); - imageList.Append( *(aImages[i]) ); - } - - // Create job object - iPrintingJob = CUPPrintingJob::NewL(printer, imageList, iPrintFactory, iFriendlyName); - CleanupStack::PopAndDestroy(&imageList); - - // Update state and return - iState = EUPnPJobReady; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::StartPrintingL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::StartPrintingL() -{ - LOG("[CUPnPPrintingDevice::StartPrintingL]\t"); - ResetTimer(); - - // Get pointer to correct CDevice - CUPPrinter* upPrinter = static_cast(User::LeaveIfNull( - iPrinterContainer->Printer(iPrintingJob->PrinterId()))); - - CUpnpDevice* printer = upPrinter->Device(); - - if (!printer) - { - LOG("[CUPnPPrintingDevice]\t -UPnP Printer pointer was NULL"); - - // Try to discover selected printer - start timer - StartTimer(KPrinterSubmitTimeout, KPrinterSubmitTimeout, TCallBack(SubmitTimeoutCBL, this) ); - return; - } - - // Send create job to PCP - SubmitJobToPcpL(*printer, iPrintingJob->PrinterId()); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DoSubmitTimeoutL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::DoSubmitTimeoutL() -{ - LOG("[CUPnPPrintingDevice]\t CUPnPPrintingDevice::DoSubmitTimeoutL"); - - ResetTimer(); - - TRAPD(err, SubmitJobToPcpL(iPrintingJob->PrinterId())); - - if( err != KErrNone) - { - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(EObexConnectError, err); - iState = EUPnPJobReady; - } - -} - - - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SubmitJobToPcpL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::SubmitJobToPcpL(TInt aDeviceID) -{ - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL(TInt)]\t"); - - // Get pointer to correct CDevice - CUPPrinter* printer = NULL; - - TInt printerIndex = iPrinterContainer->PrinterIndex(aDeviceID); - if (printerIndex >= 0) - { - printer = - static_cast (User::LeaveIfNull(iPrinterContainer->Printer(printerIndex))); - SubmitJobToPcpL(*(printer->Device()), aDeviceID); - } - else - { - User::LeaveIfNull(printer); - } - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::SubmitJobToPcpL -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::SubmitJobToPcpL(CUpnpDevice& aPrinter, TInt aPrinterID) -{ - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL(CDevice&, TInt)]\t"); - - // Init settings - TPtrC8 userName; - iPrintingJob->GetUserName(userName); - - // Get and convert xhtml file - TFileName8 fileName; - - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL]\t -before GetPrintFileL call"); - iPrintingJob->GetPrintFileL(fileName); - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL]\t -after GetPrintFile call"); - - User::LeaveIfNull(&aPrinter); - - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL]\t -before CreateJobL call"); - TInt sessionId = iPrinterControl->CreateJobL(&aPrinter, fileName, userName, KUPnPOne(), KUPnPDeviceSetting(), - KUPnPDeviceSetting(), KUPnPDeviceSetting(), KUPnPDeviceSetting(), KUPnPDeviceSetting(), KUPnPDeviceSetting()); - LOG("[CUPnPPrintingDevice::SubmitJobToPcpL]\t -after CreateJobL call"); - - iPrintingJob->SetSessionId(sessionId); - iPendingCount = KPendingLimit + iPrintingJob->ImageCount(); - - LOG1("[CUPnPPrintingDevice]\t -Printing started successfully - timer can expire %d times", iPendingCount); - - //Add printer in cache if doesn't exist - iPrinterContainer->UpdateCacheL(aPrinterID); - - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(StatusTimeoutCBL, this) ); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::DoCancelPrintJob() -// -//-------------------------------------------------------------------------------------------- -TInt CUPnPPrintingDevice::DoCancelPrinting() -{ - LOG("[CUPnPPrintingDevice]\t DoCancelPrinting()"); - - if (iState == EUPnPPrintingStarted || iState == EUPnPPrinting || iState == EUPnPSubmittingJob) - { - // Cancel printer response timer first - LOG("[CUPnPPrintingDevice]\t -Canceling timer"); - ResetTimer(); - - // Cancel current job - iState = EUPnPCancelling; - CUpnpDevice* printer = GetPrinter(); - if (!printer) - { - LOG("[CUPnPPrintingDevice]\t Invalid printer"); - return KErrArgument; - } - - TInt err; - TBuf8 id; - iPrintingJob->GetJobId(id); - - if (id.Length() >= 1) - { - LOG81("[CUPnPPrintingDevice]\t Cancel with job id %S", &id); - TRAP(err, iPrinterControl->CancelJobL(printer, id)) - } - else - { - LOG81("[CUPnPPrintingDevice]\t Cancel with session id %S", iPrintingJob->SessionId()); - TRAP(err, iPrinterControl->CancelJobL(iPrintingJob->SessionId()) ); - } - - if(KErrNone != err) - { - LOG1("[CUPnPPrintingDevice]\t Cancel failed with error %d -> roughly finish printing ", err); - FinishPrinting(KErrGeneral, err); - return err; - } - - // Start timer for cancel response - StartTimer(KPrinterResponseTimeout, KPrinterResponseTimeout, TCallBack(StatusTimeoutCBL, this) ); - - return KErrNone; - } - - if (iState == EUPnPJobReady) - { - return KErrNone; - } - - return KErrInvalidSequence; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::UpdatePrintingStatus() -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::UpdatePrintingStatus(TUPnPState aJobState) -{ - LOG1("[CUPnPPrintingDevice::UpdatePrintingStatus]\t - JobState: %d", aJobState); - - /* Printer stopped */ - if(EPrinterStateStopped == aJobState || EStatePending == aJobState) - { - iStatusTimeout = EFalse; - // Finish printing if reason found. Otherwise wait timer or new message - if(ENoMessage != iPrintingJob->JobState()->Reason()) - { - LOG1("[CUPnPPrintingDevice]\t - state NOK -> Cancel with %d", iPrintingJob->JobStateReason()); - if (iPrintEventObserver) - iPrintEventObserver->PrintJobErrorEvent(KErrGeneral, iPrintingJob->JobStateReason()); - DoCancelPrinting(); - } - return; - } - - // Job aborted - if(EJobStateAborted == aJobState) - { - LOG("[CUPnPPrintingDevice]\t - EJobStateAborted -> Finish"); - FinishPrinting(KErrGeneral, iPrintingJob->JobStateReason()); - return; - } - - if(EStateReady == aJobState) - { - // Printing finished for current job - LOG("[CUPnPPrintingDevice]\t - Printing finished"); - iPrintEventObserver->PrintJobProgressEvent(EDone, iPrintingJob->Progress(), ENoMessage); - - // FinishPrinting - FinishPrinting(); - return; - } - - iPrintEventObserver->PrintJobProgressEvent(EActive, iPrintingJob->Progress(), ENoMessage); - iStatusTimeout = EFalse; - LOG("[CUPnPPrintingDevice::UpdatePrintingStatus]\t - out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::FinishPrinting -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::FinishPrinting() -{ - LOG("[CUPnPPrintingDevice::FinishPrinting]\t "); - - LOG("[CUPnPPrintingDevice]\t -Reset timer"); - ResetTimer(); - - LOG("[CUPnPPrintingDevice]\t -Unshare"); - iPrintingJob->UnShareImages(); - - LOG("[CUPnPPrintingDevice]\t -Init ids"); - iPrintingJob->SetJobId(KNullDesC8()); - iPrintingJob->SetSessionId(KErrNotFound); - iPendingCount = KPendingLimit; - - LOG("[CUPnPPrintingDevice]\t -Update state"); - if(NULL != GetPrinter()) - iState = EUPnPJobReady; - else - iState = EUPnPReady; - LOG1("[CUPnPPrintingDevice]\t FinishPrinting: state=%d", iState); - - - // Inform control point - // No can do if this leaves -> ignore leave - TRAP_IGNORE(iPrinterControl->PrintingFinishedL(GetPrinter())); - LOG("[CUPnPPrintingDevice::FinishPrinting]\t -out"); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::FinishPrinting -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::FinishPrinting(TInt aErrorCode, TInt aErrorMessage) -{ - FinishPrinting(); - - if (iPrintEventObserver && KErrNone != aErrorCode) - iPrintEventObserver->PrintJobErrorEvent(aErrorCode, aErrorMessage); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::GetPrinter -// -//-------------------------------------------------------------------------------------------- -CUpnpDevice* CUPnPPrintingDevice::GetPrinter() -{ - LOG("[CUPnPPrintingDevice::GetPrinter]"); - - if(iPrintingJob) - { - CUPPrinter* uaPrinter = iPrinterContainer->Printer(iPrintingJob->PrinterId()); - if (uaPrinter) - { - return uaPrinter->Device(); - } - } - return NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::ResetTimer -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::ResetTimer() -{ - LOG("[CUPnPPrintingDevice::ResetTimer]\t"); - - if(iPrinterTimer) - iPrinterTimer->Cancel(); - iStatusTimeout = EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPnPPrintingDevice::ResetTimer -// -//-------------------------------------------------------------------------------------------- -void CUPnPPrintingDevice::StartTimer(TTimeIntervalMicroSeconds32 aDelay, - TTimeIntervalMicroSeconds32 anInterval, - TCallBack aCallBack) -{ - LOG("[CUPnPPrintingDevice::StartTimer]\t"); - - ResetTimer(); - - iPrinterTimer->Start(aDelay, anInterval, aCallBack ); - -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprinter.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprinter.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +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: Declares CUPPrinter class -* -*/ - - -#include - -#include "cupprinter.h" -#include "cuplogger.h" -#include "tprintcapability.h" - -// Public functions -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::~CUPPrinter -// -//-------------------------------------------------------------------------------------------- -CUPPrinter::~CUPPrinter() -{ - if ( iUId ) - { - delete iUId; - } - - if ( iDisplayName ) - { - delete iDisplayName; - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::NewL -// -//-------------------------------------------------------------------------------------------- -CUPPrinter* CUPPrinter::NewL(CUpnpDevice& aDevice, TInt aId) -{ - CUPPrinter* self = new (ELeave) CUPPrinter(); - CleanupStack::PushL(self); - self->ConstructL(&aDevice, aId, aDevice.Uuid(), aDevice.DescriptionProperty(UpnpMediaServerSettings::KModelName()), TPrinter::EVendorNone); - CleanupStack::Pop(); // self - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::NewL -// -//-------------------------------------------------------------------------------------------- -CUPPrinter* CUPPrinter::NewL(const TInt aId, const TDesC8& aUId, const TDesC8& aDisplayName, const TInt aVendor) -{ - CUPPrinter* self = new (ELeave) CUPPrinter(); - CleanupStack::PushL(self); - self->ConstructL(NULL, aId, aUId, aDisplayName, aVendor); - CleanupStack::Pop(); // self - return self; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::Device -// -//-------------------------------------------------------------------------------------------- -CUpnpDevice* CUPPrinter::Device() -{ - return iDevice; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::SetCached -// -//-------------------------------------------------------------------------------------------- -void CUPPrinter::SetCached(TBool aCached) -{ - iCached = aCached; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::Cached -// -//-------------------------------------------------------------------------------------------- -TBool CUPPrinter::Cached() -{ - return iCached; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::Vendor -// -//-------------------------------------------------------------------------------------------- -TPrinter::TPrinterVendor CUPPrinter::Vendor() - { - return iVendor; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::SetVendor -// -//-------------------------------------------------------------------------------------------- -void CUPPrinter::SetVendor(const TDesC8& aManufacturer) - { - LOG("[CUPPrinter::SetVendor]\t Begin"); - iVendor = TPrinter::EVendorNone; - // At the moment this functionality is not used, but no Vendor is set. - LOG("[CUPPrinter::SetVendor]\t End"); - } - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::ToTPrinter -// -//-------------------------------------------------------------------------------------------- -TPrinter CUPPrinter::ToTPrinter() -{ - TInt cached(0); - TPrinter printer; - printer.iPrinterID = iId; - printer.iDisplayName.Copy(iDisplayName->Des()); - printer.iVendor = Vendor(); - // cast boolean value to integer - cached = Cached(); - printer.iProperties = cached | TPrinter::SupportsPreview; - printer.iProtocol = KImagePrint_PrinterProtocol_UPnP; - - LOG1("[CUPPrinter::ToTPrinter]\t printer.iVendor = %d", printer.iVendor) - - return printer; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::Id -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinter::Id() - { - return iId; - } - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::UId -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CUPPrinter::UId() -{ - if ( iUId ) - { - return TPtrC8( iUId->Des() ); - } - else - { - return TPtrC8( KNullDesC8 ); - } - -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::DisplayName -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CUPPrinter::DisplayName() -{ - if ( iDisplayName ) - { - return TPtrC8( iDisplayName->Des() ); - } - else - { - return TPtrC8( KNullDesC8 ); - } - -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::IsDisappeared -// -//-------------------------------------------------------------------------------------------- -TBool CUPPrinter::IsDisappeared() -{ - return iDisappeared; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::SetDisappeared -// -//-------------------------------------------------------------------------------------------- -void CUPPrinter::SetDisappeared(TBool aDisappeared) -{ - iDisappeared = aDisappeared; - - if (iDisappeared) - { - iDevice = NULL; - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::SetDevice -// -//-------------------------------------------------------------------------------------------- -void CUPPrinter::SetDevice(CUpnpDevice* aDevice) -{ - iDevice = aDevice; - - if (!aDevice) - return; - - // Update display name - delete iDisplayName; - iDisplayName = NULL; - - iDisplayName = aDevice->DescriptionProperty(UpnpMediaServerSettings::KModelName()).Alloc(); -} - -// Protected functions - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::ConstructL( -// -//-------------------------------------------------------------------------------------------- -void CUPPrinter::ConstructL(CUpnpDevice* aDevice, const TInt aId, const TDesC8& aUId, const TDesC8& aDisplayName, const TInt aVendor) -{ - iId = aId; - iUId = aUId.AllocL(); - iDisplayName = aDisplayName.AllocL(); - iVendor = (TPrinter::TPrinterVendor)aVendor; - - if (aDevice) - { - // Discovered device - iDevice = aDevice; - iDisappeared = EFalse; - - SetVendor(iDevice->DescriptionProperty(UpnpMediaServerSettings::KManufacturer())); - } - else - { - // Cached device - iDisappeared = ETrue; - } - - iCached = EFalse; -} - -// Private functions -//-------------------------------------------------------------------------------------------- -// -// CUPPrinter::CUPPrinter -// -//-------------------------------------------------------------------------------------------- -CUPPrinter::CUPPrinter() -{ -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintercontainer.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintercontainer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,776 +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: Declares CUPPrinterContainer class -* -*/ - - -#include "cupprintercontainer.h" -#include "cuplogger.h" -#include "upconsts.h" - -_LIT(KUPnPPrinterCache, "printers.txt"); - -#define KMaxCacheFileSize 512 - -// Public functions - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::~CUPPrinterContainer -// -//-------------------------------------------------------------------------------------------- -CUPPrinterContainer::~CUPPrinterContainer() -{ - iPrinters.ResetAndDestroy(); - iPrinters.Close(); - iFsSession.Close(); - if(iCacheBuffer) - delete iCacheBuffer; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::NewL -// -//-------------------------------------------------------------------------------------------- -CUPPrinterContainer* CUPPrinterContainer::NewL() -{ - CUPPrinterContainer* self = new (ELeave) CUPPrinterContainer(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::Printer -// -//-------------------------------------------------------------------------------------------- -CUPPrinter* CUPPrinterContainer::Printer(CUpnpDevice& aDevice) -{ - TInt index = PrinterIndex(aDevice); - if(KErrNotFound != index) - { - return PrinterByIndex(index); - } - else - return NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::Printer -// -//-------------------------------------------------------------------------------------------- -CUPPrinter* CUPPrinterContainer::Printer(TInt aId) -{ - TInt index = PrinterIndex(aId); - if(KErrNotFound != index) - { - return PrinterByIndex(index); - } - else - return NULL; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ToTPrinter -// -//-------------------------------------------------------------------------------------------- -TPrinter CUPPrinterContainer::ToTPrinter(CUpnpDevice& aDevice) -{ - TInt index = PrinterIndex(aDevice); - return ToTPrinter(index); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ToTPrinter -// -//-------------------------------------------------------------------------------------------- -TPrinter CUPPrinterContainer::ToTPrinter(TInt aIndex) -{ - if (aIndex >= iPrinters.Count() ) - { - TPrinter nullPrinter; - nullPrinter.iPrinterID = KErrNotFound; - nullPrinter.iProtocol = 0; - nullPrinter.iProperties = TPrinter::Cached; - return nullPrinter; - } - - return iPrinters[aIndex]->ToTPrinter(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::PrinterCount -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::PrinterCount() -{ - return iPrinters.Count(); -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::AddPrinterL -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::AddPrinterL(CUpnpDevice& aDevice, TInt& aId) -{ - aId = KErrNotFound; - - // Check if the discovered printer is cached/ disappeared - for (TInt i=0; i < iPrinters.Count(); i++) - { - if (iPrinters[i]->UId().Compare(aDevice.Uuid()) == 0) - { - // Printer already in array - update pointer - iPrinters[i]->SetDevice(&aDevice); - if (iPrinters[i]->IsDisappeared()) - { - // remove disappeared flag - iPrinters[i]->SetDisappeared(EFalse); - } - aId = iPrinters[i]->Id(); - User::Leave(KErrAlreadyExists); - } - } - - // New printer - append to list - TInt id = GenerateId(); - CUPPrinter* newPrinter = CUPPrinter::NewL(aDevice, id); - CleanupStack::PushL(newPrinter); - iPrinters.AppendL(newPrinter); - CleanupStack::Pop(newPrinter); - aId = id; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::RemovePrinter -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::RemovePrinter(CUpnpDevice& aDevice) -{ - TInt index = PrinterIndex(aDevice); - if(KErrNotFound != index) - { - return RemovePrinter(index); - } - else - return index; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::RemovePrinter -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::RemovePrinter(TInt aIndex) -{ - if (aIndex >= iPrinters.Count() || aIndex < 0) - return KErrArgument; - CUPPrinter* temp = iPrinters[aIndex]; - iPrinters.Remove(aIndex); - if (temp) - { - delete temp; - temp = NULL; - } - return KErrNone; -} -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::RemovePrinter -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::RemoveCachedDeviceL(TInt aDeviceID) -{ - TInt err = KErrNone; - TBool cached = EFalse; - - for (TInt i=0; i < iPrinters.Count(); i++) - { - if (iPrinters[i]->Id() == aDeviceID) - { - cached = iPrinters[i]->Cached(); - iPrinters[i]->SetCached(EFalse); - break; - } - } - - if(!cached) - return KErrNone; - - ReadCacheFileL(); - - TInt startPos = 0; - TInt endPos = 0; - - FindCachedPrinterL(aDeviceID, startPos, endPos); - - LOG1("[CUPPrinterContainer::RemoveCachedDeviceL]\t startPos:\t%d", startPos); - LOG1("[CUPPrinterContainer::RemoveCachedDeviceL]\t endPos:\t%d", endPos); - - if(0 < endPos) - { - //Remove printer form the buffer - iCacheBuffer->Des().Delete(startPos, endPos-startPos); - - //Write buffer in file - RFile cacheFile; - CleanupClosePushL(cacheFile); - TInt err = cacheFile.Replace( iFsSession, KUPnPPrinterCache, EFileWrite); - if (err == KErrNone) - { - err = cacheFile.Write(iCacheBuffer->Des()); - } - CleanupStack::PopAndDestroy(&cacheFile); - } - - delete iCacheBuffer; - iCacheBuffer = NULL; - - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::Printer -// -//-------------------------------------------------------------------------------------------- -CUPPrinter* CUPPrinterContainer::PrinterByIndex(TInt aIndex) -{ - if (aIndex >= iPrinters.Count() || aIndex < 0) - return NULL; - return iPrinters[aIndex]; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::PrinterIndex -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::PrinterIndex(CUpnpDevice& aDevice) -{ - TPtrC8 uuid = aDevice.Uuid(); - TInt count = iPrinters.Count(); - for (TInt i=0; iIsDisappeared()) - tempUuid.Set( (iPrinters[i])->Device()->Uuid() ); - - if (uuid.Compare(tempUuid) == 0) - return i; - } - return KErrNotFound; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::PrinterIndex -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::PrinterIndex(TInt aId) -{ - TInt count = iPrinters.Count(); - for (TInt i=0; iId()) - return i; - } - - return KErrNotFound; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::PrinterDisappeared -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::PrinterDisappeared(CUpnpDevice& aDevice) -{ - // Check if device is found from iPrinters array. If so add to disappeared array. - TInt index = PrinterIndex(aDevice); - if ( index >=0 ) - { - iPrinters[index]->SetDisappeared(ETrue); - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::SyncPrinterArray -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::SyncPrinterArray() -{ - for(TInt i=0; iIsDisappeared()) - { - RemovePrinter(i); - i--; - } - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::UpdateCache -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::UpdateCacheL() -{ - // Calculate size for buffer - TInt bufSize = 0; - for (TInt i=0; i < iPrinters.Count(); i++) - { - bufSize += 3; // Separators and line feed - - TBuf8<10> id; - id.AppendNum(iPrinters[i]->Id()); - TBuf8<10> vendor; - vendor.AppendNum(iPrinters[i]->Vendor()); - - bufSize += id.Length(); - bufSize += iPrinters[i]->DisplayName().Length(); - bufSize += vendor.Length(); - bufSize += iPrinters[i]->UId().Length(); - } - - // Create buffer - if(iCacheBuffer) - { - delete iCacheBuffer; - iCacheBuffer = NULL; - } - - iCacheBuffer = HBufC8::NewL(bufSize); - - // Write buffer - for (TInt i=0; i < iPrinters.Count(); i++) - { - iCacheBuffer->Des().AppendNum(iPrinters[i]->Id()); - iCacheBuffer->Des().Append(KUPnPComma()); - iCacheBuffer->Des().Append(iPrinters[i]->DisplayName()); - iCacheBuffer->Des().Append(KUPnPComma()); - iCacheBuffer->Des().AppendNum(iPrinters[i]->Vendor()); - iCacheBuffer->Des().Append(KUPnPComma()); - iCacheBuffer->Des().Append(iPrinters[i]->UId()); - iCacheBuffer->Des().Append(KUPnPLineFeed8()); - } - - // Write buffer to file - RFile cacheFile; - TInt err = cacheFile.Replace( iFsSession, KUPnPPrinterCache, EFileWrite); - if (err == KErrNone) - { - err = cacheFile.Write(iCacheBuffer->Des()); - } - cacheFile.Close(); - User::LeaveIfError(err); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::UpdateCache -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::UpdateCacheL(TInt aDeviceId) -{ - - // Get correct printer - CUPPrinter* printer = NULL; - for (TInt i=0; i < iPrinters.Count(); i++) - { - if(iPrinters[i]->Id() == aDeviceId) - { - printer = iPrinters[i]; - break; - } - } - User::LeaveIfNull(printer); - - // Calculate size for buffer - TInt bufSize = 0; - if(!printer->Cached()) - { - TBuf8<10> id; - id.AppendNum(printer->Id()); - - TBuf8<10> vendor; - vendor.AppendNum(printer->Vendor()); - vendor.Append(_L8(" ")); - - bufSize += id.Length(); - bufSize += KUPnPComma().Length(); - bufSize += printer->DisplayName().Length(); - bufSize += KUPnPComma().Length(); - bufSize += vendor.Length(); - bufSize += KUPnPComma().Length(); - bufSize += printer->UId().Length(); - bufSize += KUPnPLineFeed().Length(); - - // Create buffer - HBufC8* fileBuffer = HBufC8::NewL(bufSize); - CleanupStack::PushL(fileBuffer); - - fileBuffer->Des().AppendNum(printer->Id()); - fileBuffer->Des().Append(KUPnPComma()); - fileBuffer->Des().Append(printer->DisplayName()); - fileBuffer->Des().Append(KUPnPComma()); - fileBuffer->Des().Append(vendor); - fileBuffer->Des().Append(KUPnPComma()); - fileBuffer->Des().Append(printer->UId()); - fileBuffer->Des().Append(KUPnPLineFeed()); - - - RFile cacheFile; - CleanupClosePushL(cacheFile); - TInt fSize = 0; - // Find end of file to write if exists - TInt err = cacheFile.Open( iFsSession, KUPnPPrinterCache, EFileWrite); - if (err == KErrNone) - { - cacheFile.Size(fSize); - ++fSize; - } - else - { - // Write buffer to file - User::LeaveIfError(cacheFile.Replace( iFsSession, KUPnPPrinterCache, EFileWrite)); - } - User::LeaveIfError(cacheFile.Write(fSize, fileBuffer->Des())); - printer->SetCached(ETrue); - - CleanupStack::PopAndDestroy(2); // fileBuffer, cacheFile - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::GetDisappearedPrinters -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::GetDisappearedPrinters(RPointerArray& aArray) -{ - for (TInt i=0; i < iPrinters.Count(); i++) - { - if (iPrinters[i]->IsDisappeared()) - { - aArray.Append(iPrinters[i]); - } - } -} - -/////////////////////////// -// Protected functions -/////////////////////////// -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::ConstructL() -{ - iCacheBuffer = NULL; - - // Init file server session - User::LeaveIfError( iFsSession.Connect() ); - - TInt err = iFsSession.MkDirAll( KUPnPDataPath ); - if (err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - - User::LeaveIfError(iFsSession.SetSessionPath( KUPnPDataPath )); -} - -/////////////////////////// -// Private functions -/////////////////////////// -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::CUPPrinterContainer -// -//-------------------------------------------------------------------------------------------- -CUPPrinterContainer::CUPPrinterContainer() -{ - iIdCounter = 0; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ToCDevice -// -//-------------------------------------------------------------------------------------------- -CUpnpDevice* CUPPrinterContainer::ToCDevice(TInt aIndex) -{ - if (aIndex >= iPrinters.Count() || aIndex < 0 || iPrinters[aIndex]->IsDisappeared()) - return NULL; - return iPrinters[aIndex]->Device(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ReadCacheL -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::ReadCacheL() -{ - LOG("[CUPPrinterContainer::ReadCacheL]\t"); - - ReadCacheFileL(); - - TPtr8 bufferPtr( iCacheBuffer->Des() ); - - // Add cached devices. - while (bufferPtr.Find(KUPnPLineFeed8()) >= 0) - { - // Read id - TInt separPos = bufferPtr.Find(KUPnPComma()); - TInt lfPos = bufferPtr.Find(KUPnPLineFeed8()); - - if (lfPos < 1 || lfPos < separPos) - { - break; // No id could be read - } - - TPtrC8 idStr = bufferPtr.Left(separPos); - TInt id; - TLex8 lex(idStr); - TInt error = lex.Val(id); - User::LeaveIfError( error ); - - bufferPtr = bufferPtr.Right(bufferPtr.Length()-separPos-1); - - // Read display name - separPos = bufferPtr.Find(KUPnPComma()); - lfPos = bufferPtr.Find(KUPnPLineFeed8()); - - if (lfPos < 1 || lfPos < separPos) - { - break; // No name could be read - } - - TPtrC8 name = bufferPtr.Left(separPos); - TBuf8<100> dispName; - dispName.Copy(name); - bufferPtr = bufferPtr.Right(bufferPtr.Length()-separPos-1); - - // Read vendor - separPos = bufferPtr.Find(KUPnPComma()); - lfPos = bufferPtr.Find(KUPnPLineFeed8()); - - if (lfPos < 1 || lfPos < separPos) - { - break; // No vendor could be read - } - - TPtrC8 vendorStr = bufferPtr.Left(separPos); - TInt vendor; - TLex8 lexV(vendorStr); - TInt err = lexV.Val(vendor); - - // FIX: if error reading vendor, use default 0 and return err to none - if ( err != KErrNone ) - { - vendor = 0; - err = KErrNone; - } - - bufferPtr = bufferPtr.Right(bufferPtr.Length()-separPos-1); - - //Read uid - separPos = bufferPtr.Find(KUPnPComma()); - lfPos = bufferPtr.Find(KUPnPLineFeed8()); - - if ( (lfPos < 1) || (lfPos > separPos && separPos >= 0 ) ) - { - break; // No uid could be read - } - - TPtrC8 uid = bufferPtr.Left(lfPos); - - // Add cached printer - if (err == KErrNone) - { - AddCachedPrinterL(id, uid, dispName, vendor); - } - - bufferPtr = bufferPtr.Right(bufferPtr.Length()-lfPos-1); - - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::FindCachedPrinterL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CUPPrinterContainer::FindCachedPrinterL(TInt aId, TInt& aStartPos, TInt& aEndPos) -{ - LOG("[CUPPrinterContainer::FindCachedPrinterL]\t"); - - User::LeaveIfNull(iCacheBuffer); - TPtrC8 bufferPtr( iCacheBuffer->Des() ); - - TBuf8<10> reqId; - reqId.AppendNum(aId); - - aStartPos = 0; - aEndPos = 0; - - // Find cached device. - while (bufferPtr.Find(KUPnPLineFeed8()) >= 0) - { - aStartPos = aEndPos; - - // Read id - TInt separPos = bufferPtr.Find(KUPnPComma()); - TInt lfPos = bufferPtr.Find(KUPnPLineFeed8()); - - if (lfPos < 1 || lfPos < separPos) - { - break; // No id could be read - } - - aEndPos += lfPos+1; - - LOG81("[CUPPrinterContainer::FindCachedPrinterL]\t bufferPtr: %S", &bufferPtr); - - //Find next printer if id doesn't match - if(0 != reqId.Compare(bufferPtr.Left(separPos))) - { - bufferPtr.Set(bufferPtr.Right(bufferPtr.Length()-lfPos-1)); - continue; - } - else - { - return bufferPtr.Left(aEndPos); - } - } - - return NULL; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::ReadCacheFileLC -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::ReadCacheFileL() -{ - LOG("[CUPPrinterContainer::ReadCacheFileL]\t"); - - RFile cacheFile; - CleanupClosePushL(cacheFile); - - TInt err = cacheFile.Open( iFsSession, KUPnPPrinterCache, EFileRead ); - - if (err == KErrNone) - { - - TInt fileSize = 0; - err = cacheFile.Size(fileSize); - if(err != KErrNone) - fileSize = KMaxCacheFileSize; - - iCacheBuffer = HBufC8::NewL(fileSize); - - TPtr8 bufferPtr( iCacheBuffer->Des() ); - bufferPtr.Zero(); - - err = cacheFile.Read(bufferPtr); - } - - if (err != KErrNone) - { - // Problem in opening or reading cache file - if (iCacheBuffer) - { - delete iCacheBuffer; - iCacheBuffer = NULL; - } - iCacheBuffer = HBufC8::NewL(0); - // printer not found from cache, leave! - User::Leave( KErrNotFound ); - } - - CleanupStack::PopAndDestroy(); //cacheFile -} - - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::GenerateIdL -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrinterContainer::GenerateId() -{ - TInt id = -1; - for (TInt i=1; i < iPrinters.Count()+2; i++) - { - TInt j; - for (j=0; j < iPrinters.Count(); j++) - { - if (iPrinters[j]->Id() == i) - { - break; - } - } - - if (j == iPrinters.Count()) - { - id = i; - break; - } - } - - return id; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrinterContainer::AddCachedPrinterL -// -//-------------------------------------------------------------------------------------------- -void CUPPrinterContainer::AddCachedPrinterL(TInt aId, TDesC8& aUPnPUId, TDesC8& aDisplayName, TInt aVendor) -{ - LOG("[CUPPrinterContainer::AddCachedPrinterL]"); - CUPPrinter* newPrinter = CUPPrinter::NewL(aId, aUPnPUId, aDisplayName, aVendor); - newPrinter->SetCached(ETrue); - CleanupStack::PushL(newPrinter); - iPrinters.AppendL(newPrinter); - CleanupStack::Pop(newPrinter); -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintfactory.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintfactory.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,401 +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: Declares CUPPrintFactory class -* -*/ - - - -#include - -#include "cupprintfactory.h" -#include "upconsts.h" -#include "cuplogger.h" - -_LIT( KHtmFileName, "UPnPPrint_%d.xhtml" ); -_LIT(KUPnPSettingsFile, "settings.txt"); - -// (TInt64 == 21 chars)*2 + , + \n --> must fit in 50 -const TInt KSettingsLength = 50; - - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::NewL -// ----------------------------------------------------------------------------- -// -CUPPrintFactory* CUPPrintFactory::NewL( ) -{ - CUPPrintFactory* self = new (ELeave) CUPPrintFactory(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::~CUPPrintFactory -// Destructor -// ----------------------------------------------------------------------------- -// -CUPPrintFactory::~CUPPrintFactory( ) -{ - // No can do if deleting fails -> ignore leave - TRAP_IGNORE( DeleteXhtmlFilesL() ); - iFileSession.Close(); - iCapabilities.Close(); -} - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::CreateXhtmlFileL -// ----------------------------------------------------------------------------- -// -void CUPPrintFactory::CreateXhtmlFileL(const RArray& aJobURIs, const TInt aLayout, - const TInt aPaperSize, const TInt aQuality, - TDes& aXhtmlPrintFile, TInt& aPageCount) -{ - if ( aJobURIs.Count() < 1 ) - { - User::Leave( KErrArgument ); - } - - iFileCount++; - - //Create XHTML-print file - aXhtmlPrintFile.Format(KHtmFileName(), iFileCount); - - // parse XHTML-file - CXhtmlFileComposer *fileParser = CXhtmlFileComposer::NewLC(KUPnPXhtmlPath()); - fileParser->CreateXhtmlFileL(aJobURIs, aLayout, aPaperSize, aQuality, aXhtmlPrintFile, aPageCount); - CleanupStack::PopAndDestroy(fileParser); -} - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::DeleteXhtmlFilesL -// ----------------------------------------------------------------------------- -// -void CUPPrintFactory::DeleteXhtmlFilesL( ) -{ - CFileMan* fileMan = CFileMan::NewL( iFileSession ); - CleanupStack::PushL( fileMan ); - fileMan->RmDir( KUPnPXhtmlPath() ); - CleanupStack::PopAndDestroy(fileMan); -} - - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::FileCount -// ----------------------------------------------------------------------------- -// -TInt CUPPrintFactory::FileCount() -{ - return iFileCount; -} - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::GetCapabilityIDs -// ----------------------------------------------------------------------------- -// -void CUPPrintFactory::GetCapabilityIDs(RArray& aCapabilityIDs ) -{ - for (TInt i=0; i < iCapabilities.Count(); i++) - { - aCapabilityIDs.Append(iCapabilities[i].iCapabilityID); - } -} - -// ----------------------------------------------------------------------------- -// CUPPrintFactory::GetCapability -// ----------------------------------------------------------------------------- -// -TInt CUPPrintFactory::GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability) -{ - for (TInt i=0; i < iCapabilities.Count(); i++) - { - if (aCapabilityID == iCapabilities[i].iCapabilityID) - { - // copy capability to ouput param - aCapability.iCapabilityID = aCapabilityID; - aCapability.iDefaultValue = iCapabilities[i].iDefaultValue; - aCapability.iType = iCapabilities[i].iType; - aCapability.iEnumCount = 0; - - - for (TInt j=0; j < iCapabilities[i].iEnumCount; j++) - { - aCapability.iEnumCodes[j] = iCapabilities[i].iEnumCodes[j]; - aCapability.iEnumCount++; - } - - return KErrNone; - } - } - - return KErrNotSupported; -} - -//-------------------------------------------------------------------------------------------- -// CUPPrintFactory::GetPrintSetting -//-------------------------------------------------------------------------------------------- -TInt CUPPrintFactory::GetPrintSetting(TInt aCapabilityID, TInt& aValue) -{ - for (TInt i=0; i= fileSize) - fileSize = 250; - - // Create buffer - HBufC8* fileBuffer = HBufC8::NewL(fileSize); - CleanupStack::PushL(fileBuffer); - - TPtr8 bufferPtr( fileBuffer->Des() ); - bufferPtr.Zero(); - - User::LeaveIfError(file.Read(bufferPtr)); - LOG81("bufferPtr: %S", &bufferPtr); - - TInt stopper = 0; - TInt pos = bufferPtr.Find(KUPnPLineFeed8()); - while (pos > 0 && stopper < 20) - { - ++stopper; - LOG("----------------"); - - TLex8 lex(bufferPtr.Left(pos)); - LOG81("bufferPtr.Left(pos): %S", &(bufferPtr.Left(pos))); - - // get id - if ((lex.Peek()).IsDigit()) - { - TInt id; - TInt err = lex.Val(id); - LOG1("id: %d", id); - - bufferPtr = bufferPtr.Right(bufferPtr.Length() - lex.Offset()-1); - lex.Assign(bufferPtr); - - //get value - if ((lex.Peek()).IsDigit()) - { - switch( id ) - { - case EPrintCapabLayout: - User::LeaveIfError(lex.Val(aLayout)); - LOG1("aLayout: %d", aLayout); - break; - case EPrintCapabPaperSize: - User::LeaveIfError(lex.Val(aSize)); - LOG1("aSize: %d", aLayout); - break; - case EPrintCapabQuality: - User::LeaveIfError(lex.Val(aQuality)); - LOG1("aQuality: %d", aQuality); - break; - default: - break; - } - - bufferPtr = bufferPtr.Right(bufferPtr.Length() - lex.Offset()-1); - lex.Assign(bufferPtr); - } - } - // find next - pos = bufferPtr.Find(KUPnPLineFeed8()); - } - CleanupStack::PopAndDestroy(2); //fileBuffer, file -} - -//-------------------------------------------------------------------------------------------- -// CUPPrintFactory::SetDefaultSettingsL -//-------------------------------------------------------------------------------------------- -void CUPPrintFactory::SetDefaultSettingsL() -{ - LOG("[CUAPrintingJobContainer::SetDefaultSettingsL]\t"); - - // Create buffer - HBufC8* settingsBuf = HBufC8::NewL(KSettingsLength * iCapabilities.Count()); - CleanupStack::PushL(settingsBuf); - - for (TInt i=0; i settingsStr; - settingsStr.AppendNum(iCapabilities[i].iCapabilityID); - settingsStr.Append(KUPnPComma()); - settingsStr.AppendNum(iCapabilities[i].iDefaultValue); - settingsStr.Append(KUPnPLineFeed8()); - - settingsBuf->Des().Append(settingsStr); - } - - RFile file; - User::LeaveIfError(file.Replace(iFileSession, KUPnPSettingsFile, EFileWrite)); - CleanupClosePushL(file); - file.Write(settingsBuf->Des()); - - CleanupStack::PopAndDestroy(2); //file, settingsBuf -} - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintingjob.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupprintingjob.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,709 +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: Declares CUPPrintingJob class -* -*/ - - -#include -#include //utf8 conversions -#include -#include - -#include "cupprintingjob.h" -#include "cupprinter.h" -#include "cuplogger.h" -#include "cupprintfactory.h" -#include "printcapabilitycodes.h" -#include "cupfilesharingactive.h" - - - -_LIT8(KResource, "res"); -_LIT(KMediaTypes, "image/jpeg:*,audio/mpeg:MP3,audio/mp4:AAC_ISO_320,video/mp4:AVC_MP4_BL_CIF15_AAC_520,application/vnd.pwg-xhtml-print+xml:*"); - -// Public functions -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::NewL -// -//-------------------------------------------------------------------------------------------- -CUPPrintingJob* CUPPrintingJob::NewL(CUPPrinter* aPrinter, RArray& aImages, - CUPPrintFactory* aFileFactory, const TDesC8& aUserName) -{ - CUPPrintingJob* self = new (ELeave) CUPPrintingJob(aFileFactory); - CleanupStack::PushL(self); - self->ConstructL(aPrinter, aImages, aUserName); - CleanupStack::Pop(); // self - return self; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::~CUPPrintingJob -// -//-------------------------------------------------------------------------------------------- -CUPPrintingJob::~CUPPrintingJob() -{ - // Stop sharing - UnShareImages(); - - if(iFileSharing) - delete iFileSharing; - - if(iOrgMediaServerStatus != RUpnpMediaServerClient::EStartedOnline) - { - iMediaServerClient.Stop(); - if(iOrgMediaServerStatus == RUpnpMediaServerClient::EStartedOffline) - { - iMediaServerClient.StartOffline(); - } - } - - iMediaServerClient.Close(); - - iImages.Close(); - - if(iJobState) - delete iJobState; -} - -//-------------------------------------------------------------------------------------------- -// -// CUAPrintingJob::SetSessionId -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::SetSessionId(TInt aId) -{ - iSessionId = aId; -} - - -//-------------------------------------------------------------------------------------------- -// -// CUAPrintingJob::SessionId -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::SessionId() -{ - return iSessionId; -} - - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::SetJobId -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::SetJobId(const TDesC8& aId) -{ - iJobId.Copy(aId); - iJobState->SetActiveId(aId); - // SetActiveId initializes iJobState -> set sheets to print - iJobState->SetSheetsToPrint(Sheets()); - - LOG1("[CUPPrintingJob::SetJobId]\t Sheets(). %d", Sheets()); - -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::GetJobId -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::GetJobId(TDes8& aId) -{ - aId.Copy(iJobId); -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::GetJobName -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::GetJobName(TDes8& aJobName) -{ - // Return the name of first image - if (iImages.Count() > 0) - { - iImages[0].GetFilePath(aJobName); - } - else - { - aJobName.Append(KNullDesC8()); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::ImageCount -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::ImageCount() -{ - return iImages.Count(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::Images -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::Images(RArray& aImages) -{ - for (TInt i=0; i < iImages.Count(); i++) - { - aImages.Append(iImages[i]); - } -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::PrinterId -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::PrinterId() -{ - return iPrinterId; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::GetUserName -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::GetUserName(TPtrC8& aUserName) -{ - aUserName.Set(iUserName); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::ShareFileL -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::ShareFileL(CUpnpItem* aItemToShare) -{ - User::LeaveIfNull(aItemToShare); - - LOG81("[CUPPrintingJob::ShareFileL]\t ShareFileL: %S", &(aItemToShare->RefId())); - - TRAPD( err, iFileSharing->ShareItemL(*aItemToShare)); - - if (KErrAlreadyExists == err) - { - // Resolve http address of the already shared file - TLex8 tmp(aItemToShare->Id()); - TInt tmpId; - tmp.Val(tmpId); - - iFileSharing->GetSharedItemL(tmpId, *aItemToShare); - - } - else if(err == KErrNotFound) - { - LOG("[CUPPrintingJob]\t - ShareItemL: file not found"); - User::Leave(EPbFileNotFound); - } - else if(err != KErrNone) - { - LOG1("[CUPPrintingJob]\t - ShareItemL: %d", err); - User::Leave(err); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::ShareImagesL -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::ShareImagesL() -{ - LOG("[CUPPrintingJob]\t ShareImagesL"); - TBuf8<1024> tmpUri; - for (TInt i=0; iGetElements(); - for(TInt j = 0; jName() == KResource) - tmpUri.Copy(tmpElementArray[j]->Value()); - - // Parse shared folder address in the "res"-element value. - TFileName8 itemAddress; - TBuf8<1024> tmpPartOfUri; - tmpPartOfUri.Copy( tmpUri.Mid(28)); - itemAddress.Copy(iMediaServerAddress); - itemAddress.Append(tmpPartOfUri); - - - // Set http address and id to image information - iImages[i].SetUri(itemAddress, ETrue); - LOG82("[CPrintJob::ShareImagesL]\t iFilePath: \"%S\", iUri: \"%S\"", &name, &itemAddress); - - TPtrC8 tmp = upnpItem->Id(); - TLex8 lex( tmp ); - TInt id; - lex.Val( id ); - iImages[i].SetId(id); - - CleanupStack::PopAndDestroy( upnpItem ); - - } -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::UnShareImages -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::UnShareImages() -{ - LOG("[CUPPrintingJob]\t UnShareImages"); - - for (TInt i=0; i < iImages.Count(); i++) - { - UnShareFile(iImages[i].Id()); - } - - return KErrNone; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::UnShareFile -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::UnShareFile(TInt aItemId) -{ - LOG("[CUPPrintingJob::UnShareFile]"); - - if (aItemId < 0) - { - // Not shared because no item id is set - return KErrNone; - } - - TBuf8 itemIdStr; - itemIdStr.AppendNum(aItemId); - LOG1("[CUPPrintingJob::UnShareFile]\t Item id = %d", aItemId); - - TRAPD(err, iFileSharing->UnshareItemL(aItemId)); - LOG1("[CUPPrintingJob::UnShareFile]\t err = %d", err); - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::SetNumsOfCopies -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::SetNumsOfCopies( const RArray& aNumsOfCopies) -{ - TInt err = KErrNone; - - for(TInt arrayIx = 0, imgIx = 0; arrayIx < aNumsOfCopies.Count(); ++arrayIx) - { - if(iImages[imgIx].Index() < aNumsOfCopies.Count()) - { - TInt copies = aNumsOfCopies[iImages[imgIx].Index()]; - if(0 < copies) - iImages[imgIx].SetCopies(copies); - ++imgIx; - } - else - err = KErrCorrupt; - } - return err; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::GetPrintFileL -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::GetPrintFileL(TDes8& aPrintFile) -{ - TInt layout; - TInt paper; - TInt quality; - TBuf8<1024> tmpUri; - - iPrintFactory->GetPrintSetting(EPrintCapabLayout, layout); - iPrintFactory->GetPrintSetting(EPrintCapabPaperSize, paper); - iPrintFactory->GetPrintSetting(EPrintCapabQuality, quality); - - TFileName tmpFile; - tmpFile.Copy(aPrintFile); - iPrintFactory->CreateXhtmlFileL( iImages, layout, paper, quality, tmpFile, iSheets ); - aPrintFile.Copy(tmpFile); -} - - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::Sheets -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::Sheets() -{ - if(0 == iSheets) - { - TInt layout; - TInt layoutNbr = 0; - TInt imageNbr = 0; - - iPrintFactory->GetPrintSetting(EPrintCapabLayout, layout); - - switch( layout ) - { - case EPrintCapabLayout1Up: - case EPrintCapabLayout1UpBorderless: - case EPrintCapabLayout1UpBorder: - layoutNbr = 1; - break; - case EPrintCapabLayout2Up: - layoutNbr = 2; - break; - case EPrintCapabLayout4Up: - layoutNbr = 4; - break; - case EPrintCapabLayout6Up: - layoutNbr = 6; - break; - case EPrintCapabLayout9Up: - layoutNbr = 9; - break; - case EPrintCapabLayout12Up: - layoutNbr = 12; - break; - case EPrintCapabLayout16Up: - layoutNbr = 16; - break; - default: - break; - } - - for (TInt i = 0; iProgress(Sheets()); -} - - -// Protected functions -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CUPPrintingJob::ConstructL(CUPPrinter* aPrinter, RArray& aImages, const TDesC8& aUserName) -{ - _LIT(KHttpPrefixLow16, "http://"); - - if (aImages.Count() < 1) - { - User::Leave(KErrArgument); - } - - // Initialize iImages array - for (TInt i=0 ; iSetId(KErrNotFound); - imageInfo->SetIndex(i); - imageInfo->SetCopies(1); - - if (aImages[i].Compare(KHttpPrefixLow16()) < 0 ) - { - // Images with file path - imageInfo->SetFilePathL(aImages[i]); - } - else - { - // Images with HTTP address - imageInfo->SetUriL(aImages[i]); - } - iImages.Append( *imageInfo ); - CleanupStack::PopAndDestroy( imageInfo ); - } - - // Set printer - iPrinterId = aPrinter->Id(); - - iUserName.Set(aUserName); - iJobState = CUPJobState::NewL(); - iSheets = 0; - - iFileSharing = CUPFileSharingActive::NewL(); - - // Connect to the local media server and open file sharing session - LOG("[CUPPrintingJob::ConstructL]\t Media server connected"); - User::LeaveIfError(iMediaServerClient.Connect()); - - // get original MS status and start MS if needed. - // If MS is in wrong status(started offline mode) then stop MS and start it in online-mode. - iMediaServerClient.Status(iOrgMediaServerStatus); - if(iOrgMediaServerStatus != RUpnpMediaServerClient::EStartedOnline) - { - if(iOrgMediaServerStatus == RUpnpMediaServerClient::EStartedOffline) - { - iMediaServerClient.Stop(); - } - CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL(); - TBuf8<1024> media; - - //// Supported Media - media.Copy(KMediaTypes); - settings->SetL(UpnpMediaServerSettings::ESupportedMedia, media); - delete settings; - LOG("[CUPPrintingJob::ConstructL]\t Media server start"); - User::LeaveIfError(iMediaServerClient.Start()); - } - - // Get Media server ip address and port number. - TFileName8 tmpAddress; - TInetAddr timppi; - TInt err = iMediaServerClient.GetAddress(timppi); - - TFileName addr16; - timppi.Output(addr16); - - // Address - iMediaServerAddress.Copy( KHttpPrefix() ); - iMediaServerAddress.Append(addr16); - - // Port - iMediaServerAddress.Append( KUPnPColon() ); - iMediaServerAddress.AppendNum(timppi.Port()); -} - - -// Private functions -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::CUPPrintingJob -// -//-------------------------------------------------------------------------------------------- -CUPPrintingJob::CUPPrintingJob(CUPPrintFactory* aFileFactory) : -iSessionId(KErrNotFound), -iPrintFactory(aFileFactory), -iXhtmlFileShareId(0) -{ -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::UPnPItem -// -//-------------------------------------------------------------------------------------------- -CUpnpItem* CUPPrintingJob::UPnPItemLC(TInt aItemId, const TDesC8& aFileName, const TDesC8& aObjectType, const TDesC8& aMimeType) -{ - // Init upnp item - CUpnpItem* upnpItem = CUpnpItem::NewL(); - CleanupStack::PushL(upnpItem); - - upnpItem->SetRefIdL(aFileName); - TFileName8 tmpTitle; - TInt tmpLocate = aFileName.LocateReverse( TChar( '\\' ) ); - tmpLocate++; - tmpTitle.Copy(aFileName.Mid(tmpLocate)); - upnpItem->SetTitleL(tmpTitle); - upnpItem->SetObjectClassL(aObjectType); - - TBuf8 itemIdStr; - itemIdStr.AppendNum(aItemId); - upnpItem->SetIdL(itemIdStr); - upnpItem->SetRestricted(0); - _LIT8(KDefParentId, "0"); - upnpItem->SetParentIdL(KDefParentId); - - // Convert FileName to the unicode that MediaServer can handle it correct. - HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(aFileName); - CleanupStack::PushL(buf); - - CUpnpProtocolInfo* protocolInfo = CUpnpProtocolInfo::NewL(); - CleanupStack::PushL(protocolInfo); - protocolInfo->SetFirstFieldL(_L8("http-get")); - protocolInfo->SetSecondFieldL(_L8("*")); - protocolInfo->SetThirdFieldL(aMimeType); - protocolInfo->SetFourthFieldL(_L8("*")); - - upnpItem->AddResourceL(buf->Des(), protocolInfo->ProtocolInfoL()); - CleanupStack::Pop(protocolInfo); - CleanupStack::PopAndDestroy(buf); - - return upnpItem; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::UpdateJobState -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::UpdateJobState(const TDesC8& aPrinterState, const TDesC8& aReason, const TDesC8& aJobList, const TDesC8& aJobId, const TDesC8& aJobMediaSheetsCompleted) -{ -// LOG("[CUPPrintingJob::UpdateJobState]\t"); - - return iJobState->UpdateJobState(aPrinterState, aReason, aJobList, aJobId, aJobMediaSheetsCompleted); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobStateReason -// -//-------------------------------------------------------------------------------------------- -TInt CUPPrintingJob::JobStateReason() -{ - return iJobState->Reason(); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobState -// -//-------------------------------------------------------------------------------------------- -CUPJobState* CUPPrintingJob::JobState() -{ - return iJobState; -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::PrinterStateUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::PrinterStateUpdated( const TDesC8& aEvent ) -{ - return iJobState->PrinterStateUpdated(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::PrinterStateReasonsUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::PrinterStateReasonsUpdated( const TDesC8& aEvent ) -{ - return iJobState->PrinterStateReasonsUpdated(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobIdListUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::JobIdListUpdated( const TDesC8& aEvent ) -{ - return iJobState->JobIdListUpdated(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobEndStateUpdatedL -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::JobEndStateUpdatedL( const TDesC8& aEvent ) -{ - return iJobState->JobEndStateUpdatedL(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobMediaSheetsCompletedUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ) -{ - return iJobState->JobMediaSheetsCompletedUpdated(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobMediaSheetsCompletedUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::JobMediaSheetsCompletedUpdated(const TDesC8& aId, const TDesC8& aEvent ) -{ - return iJobState->JobMediaSheetsCompletedUpdated(aId, aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::JobAbortStateUpdatedL -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::JobAbortStateUpdatedL( const TDesC8& aEvent ) -{ - return iJobState->JobAbortStateUpdatedL(aEvent); -} - -//-------------------------------------------------------------------------------------------- -// -// CUPPrintingJob::ContentCompleteListUpdated -// -//-------------------------------------------------------------------------------------------- -TUPnPState CUPPrintingJob::ContentCompleteListUpdated( const TDesC8& aEvent ) -{ - return iJobState->ContentCompleteListUpdated(aEvent); -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cuptimer.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cuptimer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +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: Declares CUPTimer class -* -*/ - - -#include -#include - -#include "cuptimer.h" - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CUPTimer* CUPTimer::NewL() - { - CUPTimer* self = NewLC(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -CUPTimer* CUPTimer::NewLC() - { - CUPTimer* self = new (ELeave) CUPTimer(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// ~CUPTimer -// --------------------------------------------------------------------------- -// -CUPTimer::~CUPTimer() - { - - Cancel(); - - if (iTimeOutTimer) - { - delete iTimeOutTimer; - iTimeOutTimer = NULL; - } - } - -// --------------------------------------------------------------------------- -// SetActiveNow -// --------------------------------------------------------------------------- -// -void CUPTimer::SetActiveNow() - { - TRequestStatus* statusPtr = &iStatus; - User::RequestComplete (statusPtr, KErrNone); - } - -// --------------------------------------------------------------------------- -// RunL -// --------------------------------------------------------------------------- -// -void CUPTimer::RunL() - { - iTimeOutTimer->Cancel(); - iObserver->TimerExpiredL(iItemToShare); - } - -// --------------------------------------------------------------------------- -// RunL -// --------------------------------------------------------------------------- -// -TInt CUPTimer::RunError(TInt aError) - { - Cancel(); - - return aError; - } - -// --------------------------------------------------------------------------- -// DoCancel -// --------------------------------------------------------------------------- -// -void CUPTimer::DoCancel() - { - if (iTimeOutTimer->IsActive()) - { - iTimeOutTimer->Cancel(); - } - return; - } - -// --------------------------------------------------------------------------- -// WaitUntilTimeExpired -// --------------------------------------------------------------------------- -// -void CUPTimer::WaitUntilTimeExpired(MUPTimerObserver* aObserver, - TTimeIntervalMicroSeconds32 aTimeOut, - CUpnpItem* aItemToShare)//, - // TRequestStatus &aStatus) - { - - /* This might be a little bit dangerous but server knows when to start timer */ - Cancel(); - - iItemToShare = aItemToShare; - - if(!IsActive()) - { - SetActive(); - } - - - iObserver = aObserver; - - // Start the time out timer - TRAPD(trapError, iTimeOutTimer = CPeriodic::NewL(EPriorityBackground)); - if (trapError != KErrNone) - { - - } - - TCallBack callback(CUPTimer::TimedOut,(TAny*)(this)); - iTimeOutTimer->Start(aTimeOut, aTimeOut, callback); - - iStatus = KRequestPending; - } - - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CUPTimer::ConstructL() - { - CActiveScheduler::Add(this); - } - -// --------------------------------------------------------------------------- -// CUPTimer -// --------------------------------------------------------------------------- -// -CUPTimer::CUPTimer() : CActive(EPriorityNormal) - { - - } - -// --------------------------------------------------------------------------- -// CancelTimer -// --------------------------------------------------------------------------- -// - -void CUPTimer::CancelTimer() - { - Cancel(); - } - -// --------------------------------------------------------------------------- -// TimedOut -// --------------------------------------------------------------------------- -// -TInt CUPTimer::TimedOut(TAny* aPtr) - { - CUPTimer* obj = reinterpret_cast(aPtr); - if (obj) - { - obj->SetActiveNow(); - } - - return KErrNone; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/main.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/main.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "cupnpprintingdevice.h" - -// Entry point to the application DLL - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10208A28, CUPnPPrintingDevice::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/bwins/xhtmlfilecomposeru.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/bwins/xhtmlfilecomposeru.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -EXPORTS - ??0CImageInfo@@QAE@XZ @ 1 NONAME ; CImageInfo::CImageInfo(void) - ?UnitToPixel@CXhtmlFileComposer@@AAENN@Z @ 2 NONAME ; double CXhtmlFileComposer::UnitToPixel(double) - ?CreateXhtmlFileL@CXhtmlFileComposer@@QAEXABV?$RArray@VCImageInfo@@@@HHHABVTDesC16@@AAHH@Z @ 3 NONAME ; void CXhtmlFileComposer::CreateXhtmlFileL(class RArray const &, int, int, int, class TDesC16 const &, int &, int) - ?UriLog@CImageInfo@@SAXABVTDesC16@@AAVTDes16@@@Z @ 4 NONAME ; void CImageInfo::UriLog(class TDesC16 const &, class TDes16 &) - ??1CXhtmlFileComposer@@UAE@XZ @ 5 NONAME ; CXhtmlFileComposer::~CXhtmlFileComposer(void) - ?Index@CImageInfo@@QBEHXZ @ 6 NONAME ; int CImageInfo::Index(void) const - ??0CImageInfo@@QAE@ABV0@@Z @ 7 NONAME ; CImageInfo::CImageInfo(class CImageInfo const &) - ?EncodeFileNameL@CImageInfo@@AAEXAAVTDes8@@@Z @ 8 NONAME ; void CImageInfo::EncodeFileNameL(class TDes8 &) - ?EncodeUriL@CImageInfo@@QAEXABVTDesC16@@AAVTDes8@@@Z @ 9 NONAME ; void CImageInfo::EncodeUriL(class TDesC16 const &, class TDes8 &) - ?GetFilePath@CImageInfo@@QBEXAAVTDes8@@@Z @ 10 NONAME ; void CImageInfo::GetFilePath(class TDes8 &) const - ?EncodeUriL@CImageInfo@@QAEXABVTDesC8@@AAVTDes8@@@Z @ 11 NONAME ; void CImageInfo::EncodeUriL(class TDesC8 const &, class TDes8 &) - ?PixelToUnit@CXhtmlFileComposer@@AAE?AVTSizeReal@@V2@@Z @ 12 NONAME ; class TSizeReal CXhtmlFileComposer::PixelToUnit(class TSizeReal) - ?ConvertToUnicodeL@CImageInfo@@SAXABVTDesC8@@AAVTDes16@@@Z @ 13 NONAME ; void CImageInfo::ConvertToUnicodeL(class TDesC8 const &, class TDes16 &) - ?GetUriL@CImageInfo@@QBEXAAVTDes16@@@Z @ 14 NONAME ; void CImageInfo::GetUriL(class TDes16 &) const - ?SetId@CImageInfo@@QAEXH@Z @ 15 NONAME ; void CImageInfo::SetId(int) - ?Id@CImageInfo@@QBEHXZ @ 16 NONAME ; int CImageInfo::Id(void) const - ?UriLog@CImageInfo@@SAXABVTDesC8@@@Z @ 17 NONAME ; void CImageInfo::UriLog(class TDesC8 const &) - ?UriLog@CImageInfo@@SAXABVTDesC16@@@Z @ 18 NONAME ; void CImageInfo::UriLog(class TDesC16 const &) - ?SetUriL@CImageInfo@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CImageInfo::SetUriL(class TDesC16 const &) - ?ConstructL@CImageInfo@@IAEXXZ @ 20 NONAME ; void CImageInfo::ConstructL(void) - ?Copies@CImageInfo@@QBEHXZ @ 21 NONAME ; int CImageInfo::Copies(void) const - ?GetEncodedUriL@CImageInfo@@QAEXAAVTDes8@@@Z @ 22 NONAME ; void CImageInfo::GetEncodedUriL(class TDes8 &) - ?NewL@CImageInfo@@SAPAV1@ABV1@@Z @ 23 NONAME ; class CImageInfo * CImageInfo::NewL(class CImageInfo const &) - ?UnitToPixel@CXhtmlFileComposer@@AAE?AVTSizeReal@@V2@@Z @ 24 NONAME ; class TSizeReal CXhtmlFileComposer::UnitToPixel(class TSizeReal) - ??1CImageInfo@@UAE@XZ @ 25 NONAME ; CImageInfo::~CImageInfo(void) - ?SetFilePath@CImageInfo@@QAEXABVTDesC8@@@Z @ 26 NONAME ; void CImageInfo::SetFilePath(class TDesC8 const &) - ?CompareUri@CImageInfo@@QAEHABVTDesC8@@@Z @ 27 NONAME ; int CImageInfo::CompareUri(class TDesC8 const &) - ?NewLC@CImageInfo@@SAPAV1@ABV1@@Z @ 28 NONAME ; class CImageInfo * CImageInfo::NewLC(class CImageInfo const &) - ?NewLC@CXhtmlFileComposer@@SAPAV1@ABVTDesC16@@@Z @ 29 NONAME ; class CXhtmlFileComposer * CXhtmlFileComposer::NewLC(class TDesC16 const &) - ?SetUri@CImageInfo@@QAEXABVTDesC8@@H@Z @ 30 NONAME ; void CImageInfo::SetUri(class TDesC8 const &, int) - ?SetCopies@CImageInfo@@QAEXH@Z @ 31 NONAME ; void CImageInfo::SetCopies(int) - ?GetFilePathL@CImageInfo@@QBEXAAVTDes16@@@Z @ 32 NONAME ; void CImageInfo::GetFilePathL(class TDes16 &) const - ?SetFilePathL@CImageInfo@@QAEXABVTDesC16@@@Z @ 33 NONAME ; void CImageInfo::SetFilePathL(class TDesC16 const &) - ?CompareFilePath@CImageInfo@@QAEHABVTDesC8@@@Z @ 34 NONAME ; int CImageInfo::CompareFilePath(class TDesC8 const &) - ?CompareUri@CImageInfo@@QAEHABVTDesC16@@@Z @ 35 NONAME ; int CImageInfo::CompareUri(class TDesC16 const &) - ?NewL@CXhtmlFileComposer@@SAPAV1@ABVTDesC16@@@Z @ 36 NONAME ; class CXhtmlFileComposer * CXhtmlFileComposer::NewL(class TDesC16 const &) - ?ConvertToUTF8L@CImageInfo@@SAXABVTDesC16@@AAVTDes8@@@Z @ 37 NONAME ; void CImageInfo::ConvertToUTF8L(class TDesC16 const &, class TDes8 &) - ?NewL@CImageInfo@@SAPAV1@XZ @ 38 NONAME ; class CImageInfo * CImageInfo::NewL(void) - ?SetIndex@CImageInfo@@QAEXH@Z @ 39 NONAME ; void CImageInfo::SetIndex(int) - ?GetUri@CImageInfo@@QBEXAAVTDes8@@@Z @ 40 NONAME ; void CImageInfo::GetUri(class TDes8 &) const - ?NewLC@CImageInfo@@SAPAV1@XZ @ 41 NONAME ; class CImageInfo * CImageInfo::NewLC(void) - ?UriLog@CImageInfo@@SAXABVTDesC8@@AAVTDes8@@@Z @ 42 NONAME ; void CImageInfo::UriLog(class TDesC8 const &, class TDes8 &) - ?CompareFilePath@CImageInfo@@QAEHABVTDesC16@@@Z @ 43 NONAME ; int CImageInfo::CompareFilePath(class TDesC16 const &) - ?PixelToUnit@CXhtmlFileComposer@@AAENN@Z @ 44 NONAME ; double CXhtmlFileComposer::PixelToUnit(double) - ?AppendL@CImageInfo@@SAXPAVHBufC8@@ABVTDesC8@@@Z @ 45 NONAME ; void CImageInfo::AppendL(class HBufC8 *, class TDesC8 const &) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/data/xhtmlfiletemplate.txt --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/data/xhtmlfiletemplate.txt Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - XHTML-print template - - - - - <> - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/eabi/xhtmlfilecomposeru.def --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/eabi/xhtmlfilecomposeru.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -EXPORTS - _ZN10CImageInfo10CompareUriERK6TDesC8 @ 1 NONAME - _ZN10CImageInfo10CompareUriERK7TDesC16 @ 2 NONAME - _ZN10CImageInfo10ConstructLEv @ 3 NONAME - _ZN10CImageInfo10EncodeUriLERK6TDesC8R5TDes8 @ 4 NONAME - _ZN10CImageInfo10EncodeUriLERK7TDesC16R5TDes8 @ 5 NONAME - _ZN10CImageInfo11SetFilePathERK6TDesC8 @ 6 NONAME - _ZN10CImageInfo12SetFilePathLERK7TDesC16 @ 7 NONAME - _ZN10CImageInfo14ConvertToUTF8LERK7TDesC16R5TDes8 @ 8 NONAME - _ZN10CImageInfo14GetEncodedUriLER5TDes8 @ 9 NONAME - _ZN10CImageInfo15CompareFilePathERK6TDesC8 @ 10 NONAME - _ZN10CImageInfo15CompareFilePathERK7TDesC16 @ 11 NONAME - _ZN10CImageInfo15EncodeFileNameLER5TDes8 @ 12 NONAME - _ZN10CImageInfo17ConvertToUnicodeLERK6TDesC8R6TDes16 @ 13 NONAME - _ZN10CImageInfo4NewLERKS_ @ 14 NONAME - _ZN10CImageInfo4NewLEv @ 15 NONAME - _ZN10CImageInfo5NewLCERKS_ @ 16 NONAME - _ZN10CImageInfo5NewLCEv @ 17 NONAME - _ZN10CImageInfo5SetIdEi @ 18 NONAME - _ZN10CImageInfo6SetUriERK6TDesC8i @ 19 NONAME - _ZN10CImageInfo6UriLogERK6TDesC8 @ 20 NONAME - _ZN10CImageInfo6UriLogERK6TDesC8R5TDes8 @ 21 NONAME - _ZN10CImageInfo6UriLogERK7TDesC16 @ 22 NONAME - _ZN10CImageInfo6UriLogERK7TDesC16R6TDes16 @ 23 NONAME - _ZN10CImageInfo7AppendLEP6HBufC8RK6TDesC8 @ 24 NONAME - _ZN10CImageInfo7SetUriLERK7TDesC16 @ 25 NONAME - _ZN10CImageInfo8SetIndexEi @ 26 NONAME - _ZN10CImageInfo9SetCopiesEi @ 27 NONAME - _ZN10CImageInfoC1ERKS_ @ 28 NONAME - _ZN10CImageInfoC1Ev @ 29 NONAME - _ZN10CImageInfoC2ERKS_ @ 30 NONAME - _ZN10CImageInfoC2Ev @ 31 NONAME - _ZN10CImageInfoD0Ev @ 32 NONAME - _ZN10CImageInfoD1Ev @ 33 NONAME - _ZN10CImageInfoD2Ev @ 34 NONAME - _ZN18CXhtmlFileComposer11PixelToUnitE9TSizeReal @ 35 NONAME - _ZN18CXhtmlFileComposer11PixelToUnitEd @ 36 NONAME - _ZN18CXhtmlFileComposer11UnitToPixelE9TSizeReal @ 37 NONAME - _ZN18CXhtmlFileComposer11UnitToPixelEd @ 38 NONAME - _ZN18CXhtmlFileComposer16CreateXhtmlFileLERK6RArrayI10CImageInfoEiiiRK7TDesC16Rii @ 39 NONAME - _ZN18CXhtmlFileComposer4NewLERK7TDesC16 @ 40 NONAME - _ZN18CXhtmlFileComposer5NewLCERK7TDesC16 @ 41 NONAME - _ZN18CXhtmlFileComposerD0Ev @ 42 NONAME - _ZN18CXhtmlFileComposerD1Ev @ 43 NONAME - _ZN18CXhtmlFileComposerD2Ev @ 44 NONAME - _ZNK10CImageInfo11GetFilePathER5TDes8 @ 45 NONAME - _ZNK10CImageInfo12GetFilePathLER6TDes16 @ 46 NONAME - _ZNK10CImageInfo2IdEv @ 47 NONAME - _ZNK10CImageInfo5IndexEv @ 48 NONAME - _ZNK10CImageInfo6CopiesEv @ 49 NONAME - _ZNK10CImageInfo6GetUriER5TDes8 @ 50 NONAME - _ZNK10CImageInfo7GetUriLER6TDes16 @ 51 NONAME - _ZTI10CImageInfo @ 52 NONAME ; ## - _ZTI18CXhtmlFileComposer @ 53 NONAME ; ## - _ZTV10CImageInfo @ 54 NONAME ; ## - _ZTV18CXhtmlFileComposer @ 55 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/group/bld.inf --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004-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: Build file for XHTML File Composer library -* -*/ - - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_EXPORTS -../data/xhtmlfiletemplate.txt /epoc32/data/z/resource/imageprintdata/protocols/xhtmlfiletemplate.txt - -PRJ_MMPFILES -./xhtmlfilecomposer.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/group/xhtmlfilecomposer.mmp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/group/xhtmlfilecomposer.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -deffile xhtmlfilecomposer.def - -TARGET xhtmlfilecomposer.dll - -TARGETTYPE dll -UID 0x1000008d 0x200009E5 - -CAPABILITY ALL -TCB - -// Include paths -USERINCLUDE ../inc -USERINCLUDE ../../../ImagePrintLibrary/inc -USERINCLUDE ../../../inc - -APP_LAYER_SYSTEMINCLUDE - -// Sources -SOURCEPATH ../src -SOURCE cxhtmlfilecomposer.cpp -SOURCE cimageinfo.cpp - -DEBUGLIBRARY flogger.lib - -LIBRARY charconv.lib -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY imageconversion.lib -LIBRARY jpegyuvdecoder.lib -LIBRARY inetprotutil.lib -LIBRARY platformenv.lib - -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cimageinfo.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cimageinfo.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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: Contains the declarations for miscellanous image information. -* -*/ - - -#ifndef CIMAGEINFO_H -#define CIMAGEINFO_H - -#include "xhtmlfilecomposerconst.h" - -/** -* @class CImageInfo -* @brief A simple class for miscellaneous information of an image to be printed. -* -* This class contains information of the image, required in several phases of the process. -* The data included is not all required for composing XHTML file but also for other use of the -* image data from the printing job creation to the end of job printing. -*/ -class CImageInfo : public CBase -{ - public: - IMPORT_C CImageInfo(); - IMPORT_C CImageInfo(const CImageInfo& a); - IMPORT_C ~CImageInfo(); - - // statics - IMPORT_C static CImageInfo* NewL(); - IMPORT_C static CImageInfo* NewL(const CImageInfo& a); - IMPORT_C static CImageInfo* NewLC(); - IMPORT_C static CImageInfo* NewLC(const CImageInfo& a); - - - IMPORT_C static void ConvertToUTF8L(const TDesC& aSource, TDes8& aResult); - - IMPORT_C static void ConvertToUnicodeL(const TDesC8& aSource, TDes& aResult); - - IMPORT_C static void AppendL(HBufC8* aWhere, const TDesC8& aWhat); - - IMPORT_C static void UriLog(const TDesC8& aUri); - IMPORT_C static void UriLog(const TDesC& aUri); - IMPORT_C static void UriLog(const TDesC8& aUri, TDes8& aConvert); - IMPORT_C static void UriLog(const TDesC& aUri, TDes& aConvert); - - // non-statics - IMPORT_C void EncodeUriL(const TDesC16& aDecodedUri, TDes8& aEncodedUri); - IMPORT_C void EncodeUriL(const TDesC8& aDecodedUri, TDes8& aEncodedUri); - - IMPORT_C void SetUri(const TDesC8& aUri, const TBool aEncoded=EFalse); - IMPORT_C void SetUriL(const TDesC& aUri); - - IMPORT_C void GetUri(TDes8& aUri) const; - IMPORT_C void GetUriL(TDes& aUri) const; - IMPORT_C void GetEncodedUriL(TDes8& aUri); - IMPORT_C TBool CompareUri(const TDesC& aUri); - IMPORT_C TBool CompareUri(const TDesC8& aUri); - - IMPORT_C void SetFilePath(const TDesC8& aFilePath); - IMPORT_C void SetFilePathL(const TDesC& aFilePath); - - IMPORT_C void GetFilePath(TDes8& aFilePath) const; - IMPORT_C void GetFilePathL(TDes& aFilePath) const; - IMPORT_C TBool CompareFilePath(const TDesC& aFilePath); - IMPORT_C TBool CompareFilePath(const TDesC8& aFilePath); - - IMPORT_C void SetId(const TInt aId); - IMPORT_C TInt Id() const; - - IMPORT_C void SetCopies(const TInt aCopies); - IMPORT_C TInt Copies() const; - - IMPORT_C void SetIndex(const TInt aIndex); - IMPORT_C TInt Index() const; - - - protected: - IMPORT_C void ConstructL(); - - private: - IMPORT_C void EncodeFileNameL(TDes8& aString); - - /** @var TFileName8 iUri - * @brief Image's shared uri used as a reference to the image. */ - TFileName8 iUri; - TBool iEncoded; - - /** @var TFileName8 iFilePath - * @brief File location in local file system otherway zero length. */ - TFileName8 iFilePath; - - /** @var TInt iId - * @brief Id of shared image. */ - TInt iId; - - /** @var TInt iCopies - * @brief Number of copies to print of this image */ - TInt iCopies; - - /** @var TInt iIndex - * @brief Index for mapping the number of copies to correct image */ - TInt iIndex; -}; - -#endif // CIMAGEINFO_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cxfclogger.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cxfclogger.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +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: Declares logging macros -* -*/ - - -#ifndef CXFCLOGGER_H -#define CXFCLOGGER_H - -#include "logdef.h" - -/** - * @file CXFCLogger.h - * @brief Declares logging macros. - * - * @note Link to flogger.lib in MMP file. Use DEBUGLIBRARY -keyword to avoid - * warnings in release builds.\n - * @code DEBUGLIBRARY flogger.lib @endcode - * - * @b Usage: \n - * @code LOG("[MODULE_NAME]\t Trace text here"); @endcode - * - * Trace target can be changed below (file logging needs directory @c c:\\logs\\upnp )\n - * #define __FLOGGING__ -row uncommented (default) = File logging \n - * #define __CLOGGING__ -row uncommented = Console logging \n - */ - - -#ifdef ENABLE_LOGGING -// Define one of these flags: -// FLOGGING = File logging -// CLOGGING = Console logging -#define __FLOGGING__ -//#define __CLOGGING__ -#endif - -// Then actual definitions depending on the -// flag values. - -#ifdef ENABLE_LOGGING - - #include - #include - - - // Actual log file name - _LIT(KLogFile,"CXFPLog.txt"); - - // Subdirectory under c:\logs -directory -- MUST EXIST. - _LIT(KLogDir, "upnp"); - - /// The format in which the time is formatted in log - _LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); - _LIT8( KLogTimeFormat8, "%02d.%02d:%02d:%06d "); - - // The length of the string produced by KLogTimeFormat - const TInt KLogTimeFormatLength = 16; - - // How many characters a log line can contain - const TInt KLogLineLength = 256; - - - #include - #include - - - // Define the top level macros - #define LOG(a) {Print( _L(a) ) ;} - #define LOG1(s, v) {Print( _L(s), v );} - #define LOG2(s, v1, v2) {Print( _L(s), v1, v2 );} - - #define LOG8(a) {Print8( _L8(a) );} - #define LOG81(s, v) {Print8( _L8(s), v );} - #define LOG82(s, v1, v2) {Print8( _L8(s), v1, v2 );} - - #ifdef __FLOGGING__ - - inline void Print( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf<256> buf; - buf.FormatList( aText, args ); - - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend ); - TBuf timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - VA_END( args ); - } - - inline void Print8( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf8<256> buf; - buf.FormatList( aText, args ); - - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend ); - TBuf8 timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat8, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - VA_END( args ); - } - - #else - // Console Logging on - #define Print RDebug::Print - - #define LOGS(a1, a2) {\ - TBuf<1000> log;\ - log.Append(_L(a1));\ - log.Append(a2);\ - Print(log );} - - #define LOG8S(a1, a2) {\ - TBuf8<1000> log;\ - log.Append(_L8(a1));\ - log.Append(a2);\ - Print(log );} - #endif // __FLOGGING__ - -#else - - // DEBUG build is not on --> no logging at all - #define LOG(a) - #define LOG1(s, v) - #define LOG2(s, v1, v2) - - #define LOG8(a) - #define LOG81(s, v) - #define LOG82(s, v1, v2) - -#endif // ENABLE_LOGGING - -#endif // CXFCLOGGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cxhtmlfilecomposer.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/cxhtmlfilecomposer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +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: Defines the CXhtmlFileComposer class. -* -*/ - - -#ifndef CXHTMLFILECOMPOSER_H -#define CXHTMLFILECOMPOSER_H - -#include -#include -#include - -#include "xfctemplates.h" -#include "xhtmlfilecomposerconst.h" -#include "cimageinfo.h" - -/** -* @class CXhtmlFileComposer -* @brief Implements the printing job compose to a XHTML file. -*/ - -/** -* @example ExampleOfCreateXhtmlFile.cpp -* This example -* @li creates a list of images to be included in XHTML-file as CImageInfo classes -* @li creates a new instance of this class -* @li calls the CreateXhtmlFileL method to create the physical file -*/ - -class CXhtmlFileComposer : public CBase - { - public: - - /** - * @enum TMeasureUnit - * - * The measure type is used in XHTML file for describing the unit for dimensions like - * page, frame and image sizes, frame positions at the page etc. - * Depending of the paper size type the two units of the measure is used: inches and millimeters. - */ - enum TMeasureUnit - { - EUAInches, ///<@brief Inch unit identifier. - EUAMillis ///<@brief Millimeter unit identifier. - }; - - public: - - /** NewL - * @brief Creates a new instance of XHTML file composer. - * @param aPath The path the XHTML file will be located.\n - * If @a aPath is empty, the @ref KXFPDefaultResultPath is used to open the file - * server session and to create path. Otherway the file name given in method - * @ref CreateXhtmlFileL can be the name of the file without path. - * @return Pointer to the instance. - */ - IMPORT_C static CXhtmlFileComposer* NewL(const TDesC& aPath); - - /** NewLC - * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. - * @param aPath The path the XHTML file will be located.\n - * If @a aPath is empty, the @ref KXFPDefaultResultPath is used to open the file - * server session and to create path. Otherway the file name given in method - * @ref CreateXhtmlFileL can be the name of the file without path. - * @return Pointer to the instance. - */ - IMPORT_C static CXhtmlFileComposer* NewLC(const TDesC& aPath); - - /** ~CXhtmlFileComposer - * @brief Destructor. - */ - IMPORT_C ~CXhtmlFileComposer(); - - /** CreateXhtmlFileL - * @brief Writes the XHTML-Print document of the job according to the given parameters. - * @param aImages Array of the images to write in file - * @param aLayout Jobs' Number up setting - * @param aPaperSize Jobs' Media size setting - * @param aQuality Jobs' Quality setting not implemented - * @param aXhtmlPrintFile The name of the file to generate. The file name can be given - * without the path, when the file is located in the @a aPath given when the - * instance of this class is created. The @a aXhtmlPrintFile can be also given - * with the path, but then the path must already exist. - * @param aPageCount Returns the number of pages to print - */ - IMPORT_C void CreateXhtmlFileL(const RArray& aImages, const TInt aLayout, - const TInt aPaperSize, const TInt aQuality, - const TDesC& aXhtmlPrintFile, TInt& aPageCount, TBool aDataFile = EFalse); - - - protected: - - /** ConstructL - * @brief Symbian second phase constructor. - * @param aPath The path the XHTML file will be located.\n - * If @a aPath is empty, the @ref KXFPDefaultResultPath is used to open the file - * server session and the path is created. This ensures the argument @a aXhtmlPrintFile - * of the method @ref CreateXhtmlFileL can be given without path. - */ - void ConstructL(const TDesC& aPath); - - - private: - - /** CXhtmlFileComposer - * @brief C++ constructor - */ - CXhtmlFileComposer(); - - /** UnitToPixel - * @brief Converts current unit to pixels. - * @param aValue Inch/millimeter value - * @return Pixel value - */ - IMPORT_C TReal UnitToPixel(TReal aValue); - - /** UnitToPixel - * @brief Converts current unit to pixels. - * @param aValue Inch/millimeter value - * @return Pixel value - */ - IMPORT_C TSizeReal UnitToPixel(TSizeReal aValue); - - /** PixelToUnit - * @brief Converts pixels to current unit. - * @param aValue pixel value - * @return Inch/millimeter value - */ - IMPORT_C TReal PixelToUnit(TReal aValue); - - /** PixelToUnit - * @brief Converts pixels to current unit. - * @param aValue pixel value - * @return Inch/millimeter value - */ - IMPORT_C TSizeReal PixelToUnit(TSizeReal aValue); - - /** ReadTemplateL - * @brief Reads the template file in iFileBuf - */ - void ReadTemplateFileL(); - - /** GetRatioL - * @brief Counts the croping and scaling of the image - * @param aNewSize Cropped and scaled size for the image - * @param aImageSize Full string to define the margin in XHTML file - */ - void GetRatioL(TSizeReal &aNewSize, TSizeReal aImageSize); - - /** ComposeUnitL - * @brief Converts the template to current unit (millimeters or inches) in member buffer. - */ - void ComposeUnitL(); - - /** ComposeTemplateL - * @brief Replaces the template with string value in member buffer - * @param aStr String to convert for - * @param aTemplate Template to convert - */ - void ComposeTemplateL(const TDesC8 &aStr, const TDesC8 &aTemplate); - - /** ComposeTemplateL - * @brief Replaces the template with number value in member buffer - * @param aValue Number to convert for - * @param aTemplate Template to convert - */ - void ComposeTemplateL(const TInt aValue, const TDesC8 &aTemplate); - - /** ComposeFileL - * @brief Composes the data in the template in member buffer - * @param aImageName Image name and path - * @param aImgSize Image size - */ - void ComposeFileL(const TDes8 &aImageName, TSizeReal aImgSize, TBool aDataFile = EFalse); - - /** PageData - * @brief Collects the paper size related data to page arguments - * @param aPaperSize Media size - */ - void PageData(TInt aPaperSize); - - /** LayoutData - * @brief Collects the layout related data to image frame arguments - * @param aLayout Layout - * @param aPositions Array of the image positions on the page - */ - void LayoutData(TInt aLayout, RArray &aPositions); - - /** FinalizeBufferL - * @brief Trims the member buffer tail. Replacing the template strings from - * the buffer makes the data length in the buffer vary and generates - * rubbish in the end of buffer. - * @return Pointer to the buffer data. - */ - TPtrC8 FinalizeBufferL(); - - /** SetPageTypeL - * @brief Creates a new XHTML div for page. Last/only one must be always @c page_last. - */ - void SetPageTypeL(); - - /** GetTemplateStringL - * @brief Reads the requested element's template for the XHTML file. - * @param aStart Start marker tag for the element - * @param aEnd End marker tag for the element - * @param aTemplate Reference to the template element read - * @return Pointer to the template element read - */ - TPtrC8 GetTemplateStringL(const TDesC8& aStart, const TDesC8& aEnd, TDes8& aTemplate); - - /** AddTemplateStringL - * @brief Adds the template element in XHTML buffer - * @param const TDesC8& The template element to add - * @param const TDesC8& A marker tag to where to add the element - */ - void AddTemplateStringL(const TDesC8& aTemplate,const TDesC8& aTag); - - /** GetImageSize - * @brief Returns the size in pixels of the image file - * @param CImageInfo Image's info - * @return Image size - */ - TSizeReal GetImageSizeL(CImageInfo aImage); - - /** AddPageL - * @brief Adds the new page element in XHTML template if last one is full - * @param aCurrentImage Index of the current image - * @param aPositionIndex Reference to the index of the image position at page - * @param aPageCount Reference to the page counter - * @return True if page added, False if not. - */ - TBool AddPageL(TInt aCurrentImage, TInt& aPositionIndex, TInt& aPageCount); - - /** CreateMatrix - * @brief Creates a list of positions at page for the grid of images. - * @param aRows Number of rows at one page - * @param aColumns Number of columns at one page - * @param aPortrait Orientation of the paper vs. images - * @param aPositions Reference to the array of the positions - */ - void CreateMatrix(TInt aRows, TInt aColumns, RArray& aPositions); - - /** GetImageNameL - * @brief Returns the name of the image for IMG tag. - * @param aImageInfo Image details - * @param aImageName Reference to the image name - */ - void GetImageNameL(CImageInfo aImageInfo, TDes8 &aImageName, TBool aDataFile = EFalse); - - /** SizeAndOrientationL - * @brief Returns the size and orientation of the image. - * @param aImageInfo Image details - * @param aImageSize Reference to the image size - * @param aFramePortrait Returns True if image is portrait, otherway False - */ - void SizeAndOrientationL(const CImageInfo aImageInfo, TSizeReal& aImageSize, TBool& aFramePortrait); - - /** ComposePositionL - * @brief Composes the position string identifier values in XHTML file. - * @param aPositionIndex index of the position to compose - * @param aPositions The array of the positions - */ - void ComposePositionL(TInt aPositionIndex, RArray& aPositions); - - /** FormatReal - * @brief Composes the position string identifier values in XHTML file. - * @param aNumber float number to convert - * @param aString Converted string type of "%f<>" - */ - void FormatReal(TRealX aNumber, TDes8& aString); - - private: - - /** @var TSizeReal iPaperSize - * Paper size to print */ - TSizeReal iPaperSize; - - /** @var TInt iPaperType - * Measurement unit (millimeters or inches) in XHTML file */ - TInt iPaperType; - - /** @var TReal iPageMargin - * Marginals at the page */ - TReal iPageMargin; - - /** @var TSizeReal iImageFrame - * Frame to contain an image */ - TSizeReal iImageFrame; - - /** @var HBufC8* iFileBuf - * Buffer to read the template file */ - HBufC8* iFileBuf; - - /** @var RFs iFsSession - * File server session */ - RFs iFsSession; - - /** @var TInt iImagesPerPage - * Number of the images at one page */ - TInt iImagesPerPage; - - /** @var TBool iImagePortrait - * The orientation of the image. TRUE if portrait, FALSE if landscape */ - TBool iImagePortrait; - - /** @var TBool iPagePortrait - * The orientation of the page. TRUE if portrait, FALSE if landscape */ - TBool iPagePortrait; - - /** @var TBlock iPageTemplate - * Page element template of the XHTML file */ - TBlock iPageTemplate; - - /** @var TBlock iFrameTemplate - * Frame element template of the XHTML file */ - TBlock iFrameTemplate; - - /** @var TBlock iPositionTemplate - * Image position element template of the XHTML file */ - TBlock iPositionTemplate; - - /** @var TBlock iImageTemplate - * Image element template of the XHTML file */ - TBlock iImageTemplate; - }; - -#endif // CXHTMLFILECOMPOSER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/xfctemplates.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/xfctemplates.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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: Contains template tags and sections used to handle XHTML template file. -* -*/ - - -#ifndef XFCTEMPLATES_H -#define XFCTEMPLATES_H - - -#include "cxhtmlfilecomposer.h" - - _LIT( KXHTMLTemplate, "z:\\resource\\imageprintdata\\protocols\\xhtmltempl\\xhtmlfiletemplate.txt" ); - -_LIT8(KPageWidth, "<>"); -_LIT8(KPageHeight, "<>"); -_LIT8(KPageMargin, "<>"); - -_LIT8(KImgWidth, "<>"); -_LIT8(KImgHeight, "<>"); -_LIT8(KImgMargin, "<>"); -_LIT8(KImgOrientation, "<>"); - -_LIT8(KPositionTop, "<>"); -_LIT8(KPositionLeft, "<>"); - -_LIT8(KImgFrameWidth, "<>"); -_LIT8(KImgFrameHeight, "<>"); - -_LIT8(KId, "<>"); -_LIT8(KPosId, "<>"); -_LIT8(KDetId, "<>"); - -_LIT8(KUnit, "<>"); -_LIT8(KTop, "top:"); -_LIT8(KLeft, "left:"); - -_LIT8(KDeg, "%ddeg"); - -_LIT8(KFramePosition, "<>"); -_LIT8(KPositionStart, "<>"); -_LIT8(KPositionEnd, "<>"); - -_LIT8(KImgDetails, "<>"); -_LIT8(KImgStart, "<>"); -_LIT8(KImgEnd, "<>"); - -_LIT8(KEndTag, ""); - -_LIT8(KPage, "<>"); - -_LIT8(KPageType, "<>"); -_LIT8(KPageFirsts, "page"); -_LIT8(KPageLast, "page_last"); - -_LIT8(KPageStart, "<>"); -_LIT8(KPageEnd, "<>"); - -_LIT8(KFrame, "<>"); -_LIT8(KFrameStart, "<>"); -_LIT8(KFrameEnd, "<>"); - -_LIT8(KImgName, "<>"); - - -#endif // XFCTEMPLATES_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/xhtmlfilecomposerconst.h --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/inc/xhtmlfilecomposerconst.h Fri Jun 11 16:24:10 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: Contains the constant definitions used for composing XHTML file. -* -*/ - - -#ifndef XHTMLFILECOMPOSERCONST_H -#define XHTMLFILECOMPOSERCONST_H - -/** - * @name Constants - */ -//@{ -/** Frame ratio defined for all image frames - * - * Paper is used maximally. That is, the image frames at certain layout - * are calculated to fill the whole page what ever an aspect ratio of a frame will be.\n - * It is wanted to use defined aspect ratio for all images at all layouts. It is more - * effectual to perform an image at reasonable aspect ratio despiting of the unused space - * left on page. - */ -const TReal KFrameRatio = 1.3325; - -/** Relation between inches and millimieters. - * @note 25.4 is the amount to multiply inch to get millimeters. - */ -const TReal KInchDivider = 25.4; - -/** DPI (dots per inch) divider to convert the image size in pixels to the same unit as the paper is.*/ -const TInt KDpiDivider = 150; -//@} - -/** - * @ref Constants - */ -//@{ -/** Maximum size of template file */ -const TInt KXFCMaxFileSize = 2048; - -/** Maximum length for XHTML value to be set in final XHTML file */ -const TInt KXFCMaxSettingLen = 110; - -/** Maximum length for template element for XHTML block before assigning */ -const TInt KXFCMaxBlockLen = 250; -//@} - - -/** - * @ref Constants - */ -//@{ -/** Degree value for image orientation*/ -const TInt KXFC270Deg = 270; -const TInt KXFCZeroDeg = 0; -const TInt KXFC90Deg = 90; -const TInt KXFC180Deg = 180; -//@} - -/** - * @name Literal constants - */ -//@{ -/// Default path for the XHTML-file -_LIT( KXFCDefaultResultPath, "c:\\system\\data\\xhtml\\" ); - -/// Mime type identifier for JPEG -_LIT8( KMimeJpeg, "image/jpeg" ); - -_LIT8(KMimeXhtml, "application/xhtml+xml"); - -/// Characters -_LIT8( KPros8, "%" ); -_LIT8( KUnderScore8, "_" ); -_LIT( KPros, "%" ); -_LIT( KUnderScore, "_" ); -_LIT8( KBackSlash, "\\" ); -_LIT8( KSlash, "/" ); - -/// URL encode values -_LIT8( KAmpUrlEncoded, "%26" ); -_LIT8( KSemiColonUrlEncoded, "%3b" ); -_LIT8( KSlashUrlEncoded, "%2f" ); -_LIT8( KQuestionMarkUrlEncoded, "%3f" ); -_LIT8( KAtUrlEncoded, "%40" ); -_LIT8( KEqualsUrlEncoded, "%3d" ); -_LIT8( KPlusUrlEncoded, "%2b" ); -_LIT8( KDollarUrlEncoded, "%24" ); -_LIT8( KCommaUrlEncoded, "%2c" ); -_LIT8( KAposUrlEncoded, "%27" ); -_LIT8( KLeftBracketUrlEncoded, "%5b" ); -_LIT8( KRightBracketUrlEncoded, "%5d" ); -_LIT8( KHashUrlEncoded, "%23" ); -_LIT8( KBackSlashUrlEncoded, "%5c" ); -_LIT8( KColonUrlEncoded, "%3a" ); - -//@} - -/** @typedef typedef TBuf8 TXhtmlSetting - * @brief Type definition for XHTML setting value string */ -typedef TBuf8 TXhtmlSetting; - -/** @typedef typedef TBuf8 TBlock - * @brief Type definition for XHTML element block */ -typedef TBuf8 TBlock; - -/** @typedef typedef TBuf8 TFileName8 - * @brief Type definition for 8-bit filename buffer */ -typedef TBuf8 TFileName8; - - -/** -* @class TSizeReal -* @brief A type class to store a size (width, height) with floating values. -* -*/ -class TSizeReal -{ - public: - //@{ - /// Constructors - inline TSizeReal(){iWidth = 0; iHeight = 0;} - inline TSizeReal(const TSize &a){iWidth = a.iWidth; iHeight = a.iHeight;} - inline TSizeReal(const TReal aW, const TReal aH){iWidth = aW; iHeight = aH;} - inline TSizeReal(const TInt aW, const TInt aH){iWidth = aW; iHeight = aH;} - inline TSizeReal(const TReal aW, const TInt aH){iWidth = aW; iHeight = aH;} - inline TSizeReal(const TInt aW, const TReal aH){iWidth = aW; iHeight = aH;} - //@} - - inline void SetSize(const TReal aW, const TReal aH){iWidth = aW; iHeight = aH;} - inline void SetSize(const TInt aW, const TInt aH){iWidth = aW; iHeight = aH;} - inline void SetSize(const TReal aW, const TInt aH){iWidth = aW; iHeight = aH;} - inline void SetSize(const TInt aW, const TReal aH){iWidth = aW; iHeight = aH;} - - // Arithmetic operators - inline TSizeReal operator*(const TSizeReal& a) const - {TSizeReal x; x.iWidth = iWidth * a.iWidth; x.iHeight = iHeight * a.iHeight; return x;} - - inline TSizeReal operator*(const TReal& a) const - {TSizeReal x; x.iWidth = iWidth * a; x.iHeight = iHeight * a; return x;} - - inline TSizeReal operator/(const TReal& a) const - {TSizeReal x; x.iWidth = iWidth / a; x.iHeight = iHeight / a; return x;} - - inline TSizeReal operator/(const TSizeReal& a) const - {TSizeReal x; x.iWidth = iWidth / a.iWidth; x.iHeight = iHeight / a.iHeight; return x;} - - inline TSizeReal operator-(const TReal& a) const - {TSizeReal x; x.iWidth = iWidth - a; x.iHeight = iHeight - a; return x;} - - inline TSizeReal operator-(const TSizeReal& a) const - {TSizeReal x; x.iWidth = iWidth - a.iWidth; x.iHeight = iHeight - a.iHeight; return x;} - - inline TSizeReal operator+(const TReal& a) const - {TSizeReal x; x.iWidth = iWidth + a; x.iHeight = iHeight + a; return x;} - - inline TSizeReal operator+(const TSizeReal& a) const - {TSizeReal x; x.iWidth = iWidth + a.iWidth; x.iHeight = iHeight + a.iHeight; return x;} - - inline TSizeReal operator-=(const TReal& a) - {iWidth = iWidth - a; iHeight = iHeight - a; return *this;} - - inline TSizeReal operator-=(const TSizeReal& a) - {iWidth = iWidth - a.iWidth; iHeight = iHeight - a.iHeight; return *this;} - - inline TSizeReal operator+=(const TReal& a) - {iWidth = iWidth + a; iHeight = iHeight + a; return *this;} - - inline TSizeReal operator+=(const TSizeReal& a) - {iWidth = iWidth + a.iWidth; iHeight = iHeight + a.iHeight; return *this;} - - inline TSizeReal operator*=(const TReal& a) - {iWidth = iWidth * a; iHeight = iHeight * a; return *this;} - - inline TSizeReal operator*=(const TSizeReal& a) - {iWidth = iWidth * a.iWidth; iHeight = iHeight * a.iHeight; return *this;} - - inline TSizeReal operator/=(const TReal& a) - {iWidth = iWidth / a; iHeight = iHeight / a; return *this;} - - inline TSizeReal operator/=(const TSizeReal& a) - {iWidth = iWidth / a.iWidth; iHeight = iHeight / a.iHeight; return *this;} - - // Compare operators - inline TBool operator==(const TSizeReal& a) const - {if((iWidth == a.iWidth) && (iHeight == a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator!=(const TSizeReal& a) const - {if((iWidth != a.iWidth) && (iHeight != a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator<=(const TSizeReal& a) const - {if((iWidth <= a.iWidth) && (iHeight <= a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator>=(const TSizeReal& a) const - {if((iWidth >= a.iWidth) && (iHeight >= a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator<(const TSizeReal& a) const - {if((iWidth < a.iWidth) && (iHeight < a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator>(const TSizeReal& a) const - {if((iWidth > a.iWidth) && (iHeight > a.iHeight))return ETrue; - else return EFalse;} - - inline TBool operator==(const TReal& a) const - {if((iWidth == a) && (iHeight == a))return ETrue; - else return EFalse;} - - inline TBool operator!=(const TReal& a) const - {if((iWidth != a) && (iHeight != a))return ETrue; - else return EFalse;} - - inline TBool operator<=(const TReal& a) const - {if((iWidth <= a) && (iHeight <= a))return ETrue; - else return EFalse;} - - inline TBool operator>=(const TReal& a) const - {if((iWidth >= a) && (iHeight >= a))return ETrue; - else return EFalse;} - - inline TBool operator<(const TReal& a) const - {if((iWidth < a) && (iHeight < a))return ETrue; - else return EFalse;} - - inline TBool operator>(const TReal& a) const - {if((iWidth > a) && (iHeight > a))return ETrue; - else return EFalse;} - - // Change width to height and vice versa - inline void Reverse() - {TSizeReal x(iHeight, iWidth); iWidth = x.iWidth; iHeight = x.iHeight;} - - // Get the ratio of of width vs. height - inline TReal Ratio() - {return iWidth/iHeight;} - - public: - TReal iWidth; - TReal iHeight; -}; - -#endif // XHTMLFILECOMPOSERCONST_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/src/cimageinfo.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/src/cimageinfo.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,627 +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: Contains the declarations for miscellanous image information. -* -*/ - - -#include // curi8 -#include // curi16 -#include // uriutils -#include //utf8 conversions - -#include "cimageinfo.h" -#include "cxfclogger.h" - -// log macros for static methods - -#ifdef ENABLE_LOGGING -//#define LOCAL_LOGGING -#endif - -#ifdef LOCAL_LOGGING - -#define I_LOG(a) LOG(a) -#define I_LOG1(s, v) LOG1(s, v) -#define I_LOG2(s, v1, v2) LOG2(s, v1, v2) - -#define I_LOG8(a) LOG8(a) -#define I_LOG81(s, v) LOG81(s, v) -#define I_LOG82(s, v1, v2) LOG82(s, v1, v2) - -#else - -#ifdef ENABLE_LOGGING -#undef ENABLE_LOGGING -#endif - -#define I_LOG(a) -#define I_LOG1(s, v) -#define I_LOG2(s, v1, v2) - -#define I_LOG8(a) -#define I_LOG81(s, v) -#define I_LOG82(s, v1, v2) - - -#endif - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo* CImageInfo::NewL() -{ - CImageInfo *self = NewLC(); - CleanupStack::Pop(); // self - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo* CImageInfo::NewL(const CImageInfo& a) -{ - CImageInfo *self = NewLC(a); - CleanupStack::Pop(); // self - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo* CImageInfo::NewLC() -{ - CImageInfo *self = new (ELeave) CImageInfo(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo* CImageInfo::NewLC(const CImageInfo& a) -{ - CImageInfo *self = new (ELeave) CImageInfo(a); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::ConstructL() -{ - -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo::CImageInfo() : - iUri(KNullDesC8()), - iEncoded(EFalse), - iFilePath(KNullDesC8()), - iId(KErrNotFound), - iCopies(1), - iIndex(KErrNotFound) -{ - -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo::CImageInfo(const CImageInfo &a) : - iUri(a.iUri), - iEncoded(a.iEncoded), - iFilePath(a.iFilePath), - iId(a.iId), - iCopies(a.iCopies), - iIndex(a.iIndex) -{ - -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CImageInfo -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CImageInfo::~CImageInfo() -{ - -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::UriLog -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::UriLog(const TDesC8& aUri) -{ -#ifdef ENABLE_LOGGING - TFileName8 uri; - UriLog(aUri, uri); - LOG81("[CImageInfo::UriLog]\t \"%S\"", &uri); -#else // prevent warning in compiler - aUri.Length(); -#endif -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::UriLog -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::UriLog(const TDesC& aUri) -{ -#ifdef ENABLE_LOGGING - TFileName uri; - UriLog(aUri, uri); - LOG1("[CImageInfo::UriLog(const TDesC&)]\t \"%S\"", &uri); -#else // prevent warning in compiler - aUri.Length(); -#endif -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::UriLog -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::UriLog(const TDesC8& aUri, TDes8& aConvert) -{ -#ifdef ENABLE_LOGGING - - I_LOG2("[CImageInfo::UriLog(const TDesC8&, TDes8&)]\t %d - %d", aConvert.MaxLength(), aUri.Length()); - if(aUri.Length() >= aConvert.MaxLength()) - { - aConvert.Copy(aUri.Left(aConvert.MaxLength())); - } - else - { - aConvert.Copy(aUri); - } - - TInt pos = aConvert.Find(KPros8()); - while(pos != KErrNotFound) - { - if(KErrNotFound != pos && pos < aConvert.Length()) - aConvert.Replace(pos, KPros8().Length(), KUnderScore8()); - - pos = aConvert.Find(KPros8()); - } -#else // prevent warning in compiler - aUri.Length(); - aConvert.Length(); -#endif -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::UriLog -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::UriLog(const TDesC& aUri, TDes& aConvert) -{ -#ifdef ENABLE_LOGGING - I_LOG2("[CImageInfo::UriLog(const TDesC&, TDes&)]\t %d - %d", aConvert.MaxLength(), aUri.Length()); - if(aUri.Length() >= aConvert.MaxLength()) - { - aConvert.Copy(aUri.Left(aConvert.MaxLength())); - } - else - { - aConvert.Copy(aUri); - } - - TInt pos = aConvert.Find(KPros()); - while(pos != KErrNotFound) - { - if(KErrNotFound != pos && pos < aConvert.Length()) - aConvert.Replace(pos, KPros().Length(), KUnderScore()); - - pos = aConvert.Find(KPros()); - } -#else // prevent warning in compiler - aUri.Length(); - aConvert.Length(); -#endif -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::ConvertL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::ConvertToUTF8L(const TDesC& aSource, TDes8& aResult) -{ - HBufC8* buf = EscapeUtils::ConvertFromUnicodeToUtf8L(aSource); - if(buf) - { - I_LOG2("[CImageInfo::ConvertToUTF8L]\t %d - %d", aResult.MaxLength(), buf->Des().Length()); - aResult.Copy(buf->Des()); - delete buf; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::ConvertL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::ConvertToUnicodeL(const TDesC8& aSource, TDes& aResult) -{ - HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(aSource); - if(buf) - { - I_LOG2("[CImageInfo::ConvertToUnicodeL]\t %d - %d", aResult.MaxLength(), buf->Des().Length()); - aResult.Copy(buf->Des()); - delete buf; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::EncodeUriL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::EncodeUriL(const TDesC8& aDecodedUri, TDes8& aEncodedUri) -{ - TFileName unicodeUri; - ConvertToUnicodeL( aDecodedUri, unicodeUri ); - EncodeUriL(unicodeUri, aEncodedUri); -} -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::EncodeUriL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::EncodeUriL(const TDesC16& aDecodedUri, TDes8& aEncodedUri) -{ - I_LOG("[CImageInfo::EncodeUriL]"); - CUri8* uri8 = UriUtils::CreateUriL( aDecodedUri ); - CleanupStack::PushL( uri8 ); - HBufC16* uriBuf = uri8->Uri().DisplayFormL(); - CleanupStack::PushL( uriBuf ); - - //alloc enough memory: encoding replaces one char with three: '%XX' - HBufC8* uriBuf8 = HBufC8::NewLC(KMaxFileName*3); - - TPtr8 buf8Ptr(uriBuf8->Des()); - ConvertToUTF8L( uriBuf->Des(), buf8Ptr ); - I_LOG("[CImageInfo::EncodeUriL]\t <-ConvertToUTF8L"); - - // encode additionally the following characters - //";" | "?" | "@" | "&" | "=" | "+" | "$" | "," - // no encoding of "/" or ":" for paths - - TInt pos = buf8Ptr.LocateReverse('/'); - I_LOG1("[CImageInfo::EncodeUriL]\t pos %d", pos); - if(KErrNotFound != pos) - { - TPtr8 namePtr(buf8Ptr.LeftTPtr(pos)); - I_LOG1("[CImageInfo::EncodeUriL]\t namePtr.Length() %d", namePtr.Length()); - UriLog(namePtr); - - I_LOG("[CImageInfo::EncodeUriL]\t ->EncodeFileNameL"); - EncodeFileNameL(namePtr); - } - - if(buf8Ptr.Length() > aEncodedUri.MaxLength()) - User::Leave(KErrOverflow); - - aEncodedUri.Copy(buf8Ptr); - I_LOG("[CImageInfo::EncodeUriL]\t aEncodedUri:"); - UriLog(aEncodedUri); - - CleanupStack::PopAndDestroy( uriBuf8 ); - CleanupStack::PopAndDestroy( uriBuf ); - CleanupStack::PopAndDestroy( uri8 ); -} - - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetUri(const TDesC8& aUri, const TBool aEncoded) -{ - iUri.Copy(aUri); - iEncoded = aEncoded; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetUriL(const TDesC& aUri) -{ - ConvertToUTF8L(aUri, iUri); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::GetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::GetUri(TDes8& aUri) const -{ - aUri.Copy(iUri); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::GetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::GetUriL(TDes& aUri) const -{ - ConvertToUnicodeL( iUri, aUri ); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::GetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::GetEncodedUriL(TDes8& aUri) -{ - I_LOG1("[CImageInfo::EncodeUriL]\t iEncoded = %d", iEncoded); - - if(iEncoded) - GetUri(aUri); - else - EncodeUriL(iUri, aUri); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CompareUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TBool CImageInfo::CompareUri(const TDesC& aUri) -{ - if(KNullDesC() == aUri && KNullDesC8() == iUri) - return ETrue; - - TFileName8 tmpUri8; - //First try copy (if earlier copied 8->16 the conversion cannot be done anymore): - tmpUri8.Copy(aUri); - if(CompareUri(tmpUri8)) - return ETrue; - - //Then convert: - TRAPD(err, ConvertToUTF8L(aUri, tmpUri8)); - if(KErrNone == err) - return CompareUri(tmpUri8); - - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CompareUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TBool CImageInfo::CompareUri(const TDesC8& aUri) -{ - if(0 == iUri.Compare(aUri)) - return ETrue; - - TFileName8 encodedUri; - TRAPD(err, EncodeUriL(iUri, encodedUri)); - if(KErrNone == err && 0 == encodedUri.Compare(aUri)) - return ETrue; - - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetFilePath(const TDesC8& aFilePath) -{ - iFilePath = aFilePath; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetFilePathL(const TDesC& aFilePath) -{ - ConvertToUTF8L(aFilePath, iFilePath); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::GetFilePath(TDes8& aFilePath) const -{ - aFilePath.Copy(iFilePath); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::GetFilePathL(TDes& aFilePath) const -{ - ConvertToUnicodeL(iFilePath, aFilePath); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CompareFilePath -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TBool CImageInfo::CompareFilePath(const TDesC& aFilePath) -{ - if(KNullDesC() == aFilePath && KNullDesC8() == iFilePath) - return ETrue; - - TFileName8 tmpFile8; - TRAPD(err, ConvertToUTF8L(aFilePath, tmpFile8)); - if(KErrNone == err) - return CompareFilePath(tmpFile8); - - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::CompareFilePath -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TBool CImageInfo::CompareFilePath(const TDesC8& aFilePath) -{ - if(0 == iFilePath.Compare(aFilePath)) - return ETrue; - - return EFalse; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetId(const TInt aId) -{ - iId = aId; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TInt CImageInfo::Id() const -{ - return iId; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetCopies(const TInt aCopies) -{ - iCopies = aCopies; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TInt CImageInfo::Copies() const -{ - return iCopies; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::SetIndex(const TInt aIndex) -{ - iIndex = aIndex; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::SetUri -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TInt CImageInfo::Index() const -{ - return iIndex; -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::EncodeFileNameL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::EncodeFileNameL(TDes8& aFileName) -{ - - HBufC8* result = HBufC8::NewLC(aFileName.MaxLength()); - - for(TInt i = 0; i < result->Length(); ++i) - { - TUint8 ch = aFileName[i]; - switch(ch) - { - case ':': - AppendL(result, KColonUrlEncoded()); - break; - case '/': - AppendL(result, KSlashUrlEncoded()); - break; - default: - TBufC8<1> character(&ch); - AppendL(result, character); - break; - } - } - aFileName.Copy(result->Des()); - CleanupStack::PopAndDestroy(result); -} - -//-------------------------------------------------------------------------------------------- -// -// CImageInfo::Append -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CImageInfo::AppendL(HBufC8* aWhere, const TDesC8& aWhat) -{ - if( (aWhere->Length() + aWhat.Length()) >= aWhere->Des().MaxLength()) - { - I_LOG2("[CImageInfo::AppendL]\t %d - %d", aWhat.Length(), aWhere->Length()); - aWhere = aWhere->ReAllocL(aWhere->Des().MaxLength() + aWhat.Length()); - } - - aWhere->Des().Append(aWhat); -} - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/src/cxhtmlfilecomposer.cpp --- a/ImagePrint/ImagePrintEngine/DeviceProtocols/xhtmlfilecomposer/src/cxhtmlfilecomposer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,992 +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: Defines the CXhtmlFileComposer class. -* -*/ - - -#include - -#ifdef _DEBUG -#include -#include -#endif - -#include "cxhtmlfilecomposer.h" -#include "printcapabilitycodes.h" -#include "cxfclogger.h" - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::NewL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CXhtmlFileComposer* CXhtmlFileComposer::NewL(const TDesC& aPath) - { - CXhtmlFileComposer *self = NewLC(aPath); - CleanupStack::Pop(); // self - - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::NewLC -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CXhtmlFileComposer* CXhtmlFileComposer::NewLC(const TDesC& aPath) - { - CXhtmlFileComposer *self = new (ELeave) CXhtmlFileComposer(); - CleanupStack::PushL(self); - - if(0 >= aPath.Length()) - { - self->ConstructL(KXFCDefaultResultPath()); - } - else - { - self->ConstructL(aPath); - } - - return self; - } - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::CreateXhtmlFileL -// -//-------------------------------------------------------------------------------------------- -EXPORT_C void CXhtmlFileComposer::CreateXhtmlFileL(const RArray& aImages, const TInt aLayout, - const TInt aPaperSize, const TInt /*aQuality*/, - const TDesC& aXhtmlPrintFile,TInt& aPageCount, TBool aDataFile) -{ - LOG("[CXhtmlFileComposer]\t WriteJobControlFileL"); - - // Get page and layout related data - PageData(aPaperSize); - - RArray positions; - CleanupClosePushL(positions); - LayoutData(aLayout, positions); - - ReadTemplateFileL(); - - // init counter variables - aPageCount = 0; - TInt posIx = 0; - TInt copies = 0; - TInt currentImgNum = 0; - TInt imageCount = aImages.Count(); - - // loop for images - for(TInt imgIx = 0; imgIx < aImages.Count(); imgIx++) - { - /**** Handle copies ****/ - copies = aImages[imgIx].Copies(); - imageCount += copies - 1; // decrease current image from copies - - // Create template blocks for each copy - while(1 <= copies && imageCount > currentImgNum) - { - AddPageL(currentImgNum, posIx, aPageCount); - AddTemplateStringL(iFrameTemplate, KFrame()); - - // add frame position template once per position for all pages - if(1 == aPageCount) - { - AddTemplateStringL(iPositionTemplate, KFramePosition()); - ComposePositionL(posIx, positions); - } - ComposeTemplateL(posIx+1, KPosId()); - --copies; - ++currentImgNum; - } - - // add image details - AddTemplateStringL(iImageTemplate, KImgDetails()); - ComposeTemplateL(1+imgIx, KDetId()); - - // Get correct name for the image - TFileName8 imageName; - GetImageNameL(aImages[imgIx], imageName, aDataFile); - - /**** Image size and orientation ****/ - TSizeReal imageSize(0,0); - TBool framePortrait = EFalse; - - SizeAndOrientationL(aImages[imgIx], imageSize, framePortrait); - - /**** Image scaling & cropping ****/ - TSizeReal scaledSize; - GetRatioL(scaledSize, imageSize); - - // Turn frame and scaled size in correct orientation again - if(framePortrait != iImagePortrait) - { - scaledSize.Reverse(); - iImageFrame.Reverse(); - } - - ComposeFileL(imageName, scaledSize, aDataFile); - - }// End of loop for images - CleanupStack::PopAndDestroy( &positions ); - - // Compose the correct unit in file - ComposeUnitL(); - - /**** Create result file ****/ - RFile newFile; - CleanupClosePushL( newFile ); - User::LeaveIfError( newFile.Replace( iFsSession, aXhtmlPrintFile, EFileWrite) ); - newFile.Write( FinalizeBufferL() ); - CleanupStack::PopAndDestroy( &newFile ); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::~CXhtmlFileComposer -// -//-------------------------------------------------------------------------------------------- -EXPORT_C CXhtmlFileComposer::~CXhtmlFileComposer() -{ - iFsSession.Close(); - if(iFileBuf) - delete iFileBuf; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::UnitToPixel -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TReal CXhtmlFileComposer::UnitToPixel(TReal aValue) -{ - TReal tmp = aValue; - if(EUAMillis == iPaperType) - tmp = aValue/(TReal)KInchDivider; - - tmp = tmp*(TReal)KDpiDivider; - - return tmp; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::UnitToPixel -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TSizeReal CXhtmlFileComposer::UnitToPixel(TSizeReal aValue) -{ - TSizeReal tmp = aValue; - if(EUAMillis == iPaperType) - tmp = aValue/(TReal)KInchDivider; - - tmp = tmp*(TReal)KDpiDivider; - - return tmp; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::PixelToUnit -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TReal CXhtmlFileComposer::PixelToUnit(TReal aValue) -{ - TReal tmp = aValue/(TReal)KDpiDivider; - if(EUAMillis == iPaperType) - tmp = tmp*(TReal)KInchDivider; - - return tmp; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::PixelToUnit -// -//-------------------------------------------------------------------------------------------- -EXPORT_C TSizeReal CXhtmlFileComposer::PixelToUnit(TSizeReal aValue) -{ - TSizeReal tmp = aValue/(TReal)KDpiDivider; - if(EUAMillis == iPaperType) - tmp = tmp*(TReal)KInchDivider; - - return tmp; -} - -// PROTECTED - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ConstructL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ConstructL(const TDesC& aPath) -{ - LOG("[CXhtmlFileComposer::ConstructL]\t"); - - User::LeaveIfError( iFsSession.Connect() ); - iFsSession.SetSessionPath( aPath ); - iFsSession.MkDirAll( aPath ); - - iPaperSize.SetSize(0,0); - iPaperType = 0; - iPageMargin = 0; - iImageFrame.SetSize(0,0); - iFileBuf = NULL; - iImagesPerPage = 0; - iImagePortrait=EFalse; - iPagePortrait = ETrue; - iPageTemplate.Copy(KNullDesC8()); - iFrameTemplate.Copy(KNullDesC8()); - iPositionTemplate.Copy(KNullDesC8()); - iImageTemplate.Copy(KNullDesC8()); - - LOG("[CXhtmlFileComposer::ConstructL]\t Done."); -} - -// PRIVATE - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::CXhtmlFileComposer -// -//-------------------------------------------------------------------------------------------- -CXhtmlFileComposer::CXhtmlFileComposer() -{ -} - - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::GetRatioL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::GetRatioL(TSizeReal &aNewSize, TSizeReal aImageSize) -{ - LOG("[CXhtmlFileComposer::GetRatioL]\t ********************************"); - - TRealX margin = 0; - TXhtmlSetting marginStr, tmpStr; - - LOG2("[CXhtmlFileComposer::GetRatioL]\t aImageSize: %fx%f", PixelToUnit(aImageSize.iWidth), PixelToUnit(aImageSize.iHeight)); - LOG2("[CXhtmlFileComposer::GetRatioL]\t iImageFrame: %fx%f", PixelToUnit(iImageFrame.iWidth), PixelToUnit(iImageFrame.iHeight)); - LOG2("[CXhtmlFileComposer::GetRatioL]\t image ratio: %f vs. frame ratio %f", aImageSize.Ratio(), iImageFrame.Ratio()); - - TReal relativeRatio = aImageSize.Ratio() / iImageFrame.Ratio(); - LOG2("[CXhtmlFileComposer::GetRatioL]\t relativeRatio: %f, iPageMargin %f", relativeRatio, iPageMargin); - - // crop borderless: if iPageMargin == 0, the margin must be negative - if((1 < relativeRatio && iPageMargin) || (1 > relativeRatio && !iPageMargin)) - { - LOG("[CXhtmlFileComposer::GetRatioL]\t *Match width*"); - aNewSize.SetSize(iImageFrame.iWidth, iImageFrame.iWidth/aImageSize.Ratio()); - margin = (iImageFrame.iHeight-aNewSize.iHeight)/2; - - if((!iPagePortrait && !iPageMargin && iImagePortrait) || iPagePortrait) - marginStr.Copy(KTop()); - else - marginStr.Copy(KLeft()); - } - else - { - LOG("[CXhtmlFileComposer::GetRatioL]\t *Match height*"); - aNewSize.SetSize(iImageFrame.iHeight*aImageSize.Ratio(), iImageFrame.iHeight); - margin = (iImageFrame.iWidth-aNewSize.iWidth)/2; - - if((!iPagePortrait && !iPageMargin && iImagePortrait) || iPagePortrait) - marginStr.Copy(KLeft()); - else - marginStr.Copy(KTop()); - } - - FormatReal(PixelToUnit(margin), tmpStr); - marginStr.Append(tmpStr); - - LOG2("[CXhtmlFileComposer::GetRatioL]\t aNewSize: %fx%f", PixelToUnit(aNewSize.iWidth), PixelToUnit(aNewSize.iHeight)); - LOG81("[CXhtmlFileComposer::GetRatioL]\t \"%S\"", &marginStr); - - // margin not needed anymore: compose margin into file buffer - ComposeTemplateL(marginStr, KImgMargin()); - LOG("[CXhtmlFileComposer::GetRatioL]\t ********************************"); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ComposeUnitL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ComposeUnitL() -{ - LOG("[CXhtmlFileComposer]\t ComposeUnit"); - - if(EUAMillis == iPaperType) - { - _LIT8(KMm, "mm"); - ComposeTemplateL(KMm(), KUnit()); - } - else - { - _LIT8(KIn, "in"); - ComposeTemplateL(KIn(), KUnit()); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ComposeFile -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ComposeFileL(const TDes8 &aImageName, TSizeReal aImgSize, TBool aDataFile) -{ - LOG("[CXhtmlFileComposer]\t ComposeFile"); - - // Format page settings in file - TXhtmlSetting pageWidthStr, pageHeightStr, pageMarginStr; - - FormatReal(PixelToUnit(iPaperSize.iWidth), pageWidthStr); - ComposeTemplateL(pageWidthStr, KPageWidth()); - - FormatReal(PixelToUnit(iPaperSize.iHeight), pageHeightStr); - ComposeTemplateL(pageHeightStr, KPageHeight()); - - FormatReal(iPageMargin, pageMarginStr); - ComposeTemplateL(pageMarginStr, KPageMargin()); - - // Format image frame settings in file - TXhtmlSetting imgFrameWidthStr, imgFrameHeightStr; - - FormatReal(PixelToUnit(iImageFrame.iWidth), imgFrameWidthStr); - ComposeTemplateL(imgFrameWidthStr, KImgFrameWidth()); - - FormatReal(PixelToUnit(iImageFrame.iHeight), imgFrameHeightStr); - ComposeTemplateL(imgFrameHeightStr, KImgFrameHeight()); - - // Format image settings in file - TXhtmlSetting imgWidthStr, imgHeightStr; - - FormatReal(PixelToUnit(aImgSize.iWidth), imgWidthStr); - ComposeTemplateL(imgWidthStr, KImgWidth()); - - FormatReal(PixelToUnit(aImgSize.iHeight), imgHeightStr); - ComposeTemplateL(imgHeightStr, KImgHeight()); - -/////////// - HBufC8* data = NULL; - if(aDataFile) - { - - TFileName imgFile; - imgFile.Copy(aImageName); - - LOG("[CXhtmlFileComposer]\t ComposeFileL - read image data"); - // Open the template file and read it into buffer - RFile file; - CleanupClosePushL(file); - - User::LeaveIfError( file.Open( iFsSession, imgFile, EFileRead | EFileShareReadersOnly ) ); - LOG("[CXhtmlFileComposer]\t ComposeFileL - file opened"); - - TInt fileSize = 0; - User::LeaveIfError( file.Size(fileSize) ); - LOG1("[CXhtmlFileComposer]\t ComposeFileL - file size %d",fileSize); - - _LIT8(KDataUrl, "data:image/jpeg;base64,"); - - data = HBufC8::NewLC(fileSize + KDataUrl().Length()); - TPtr8 dataPtr( data->Des() ); - - dataPtr.Zero(); - file.Read(dataPtr); - - dataPtr.Insert(0, KDataUrl()); - - ComposeTemplateL(dataPtr, KImgName()); - LOG("[CXhtmlFileComposer]\t ComposeFileL - file composed"); - - CleanupStack::PopAndDestroy(2); // data, file - } -/////////// - else - { - // Format image name in file - ComposeTemplateL(aImageName, KImgName()); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ComposeTemplateL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ComposeTemplateL(const TInt aValue, const TDesC8 &aTemplate) -{ -// LOG("[CXhtmlFileComposer]\t ComposeTemplateL"); - - TBuf8 valueStr; - valueStr.Zero(); - valueStr.AppendNum(aValue); - - ComposeTemplateL(valueStr, aTemplate); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ComposeTemplateL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ComposeTemplateL(const TDesC8 &aStr, const TDesC8 &aTemplate) -{ -// LOG("[CXhtmlFileComposer]\t ComposeTemplateL"); - - User::LeaveIfNull(iFileBuf); - - TInt pos = iFileBuf->Find(aTemplate); - while(KErrNotFound != pos) - { - TInt requiredSize = iFileBuf->Des().Length() + aStr.Length(); - if(iFileBuf->Des().MaxLength() < requiredSize) - { - iFileBuf = iFileBuf->ReAllocL(requiredSize); - } - iFileBuf->Des().Replace(pos, aTemplate.Length(), aStr); - pos = iFileBuf->Find(aTemplate); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::SetPageTypeL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::SetPageTypeL() -{ - LOG("[CXhtmlFileComposer]\t SetPageTypeL"); - - User::LeaveIfNull(iFileBuf); - - TXhtmlSetting pageType(KPageFirsts()); - - TInt pos = iFileBuf->Find(KPageType()); - if(KErrNotFound >= pos) - User::Leave(KErrCorrupt); - - while(KErrNotFound != pos) - { - // check if next exists to assign correct page type in template - TPtrC8 tmpBuf; - tmpBuf.Set(iFileBuf->Mid(pos+KPageType().Length())); - - if(KErrNotFound == tmpBuf.Find(KPageType())) - pageType.Copy(KPageLast()); - - // replace correct page type in first found position - TInt requiredSize = iFileBuf->Des().Length() + pageType.Length(); - if(iFileBuf->Des().MaxLength() < requiredSize) - { - iFileBuf = iFileBuf->ReAllocL(requiredSize); - } - iFileBuf->Des().Replace(pos, KPageType().Length(), pageType); - pos = iFileBuf->Find(KPageType()); - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::FinalizeBufferL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXhtmlFileComposer::FinalizeBufferL() -{ - LOG("[CXhtmlFileComposer]\t FinalizeBufferL"); - - User::LeaveIfNull(iFileBuf); - - SetPageTypeL(); - - // Remove markers from the buffer - TInt pos = iFileBuf->Find(KPage()); - if(KErrNotFound != pos) - iFileBuf->Des().Delete(pos, KPage().Length()); - - pos = iFileBuf->Find(KFrame()); - if(KErrNotFound != pos) - iFileBuf->Des().Delete(pos, KFrame().Length()); - - pos = iFileBuf->Find(KImgDetails()); - if(KErrNotFound != pos) - iFileBuf->Des().Delete(pos, KImgDetails().Length()); - - pos = iFileBuf->Find(KFramePosition()); - if(KErrNotFound != pos) - iFileBuf->Des().Delete(pos, KFramePosition().Length()); - - // Cut the template to the end tag - pos = iFileBuf->Find(KEndTag()); - if(KErrNotFound == pos) - User::Leave(KErrCorrupt); - - TInt dataLen = pos + KEndTag().Length(); - TPtrC8 tail = iFileBuf->Des().Left(dataLen); - - return tail; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::PageData -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::PageData(TInt aPaperSize) -{ - LOG("[CXhtmlFileComposer]\t PageData"); - - const TSizeReal KSizeA4(210.0, 297.0); - const TSizeReal KSizeA6(105.0, 148.5); - const TSizeReal KSizeLetter(8.5, 11.0); - const TSizeReal KSize4x6(4.0, 6.0); - const TSizeReal KSize5x7(5.0, 7.0); - - switch(aPaperSize) - { - case EPrintCapabPaperSizeA4: - iPaperType = CXhtmlFileComposer::EUAMillis; - iPaperSize = UnitToPixel(KSizeA4); - iPageMargin = 3.0; - break; - case EPrintCapabPaperSizeA6: - iPaperType = CXhtmlFileComposer::EUAMillis; - iPaperSize = UnitToPixel(KSizeA6); - iPageMargin = 3.0; - break; - case EPrintCapabPaperSizeLetter: - iPaperType = CXhtmlFileComposer::EUAInches; - iPaperSize = UnitToPixel(KSizeLetter); - iPageMargin = 0.12; - break; - case EPrintCapabPaperSize5x7: - iPaperType = CXhtmlFileComposer::EUAInches; - iPaperSize = UnitToPixel(KSize5x7); - iPageMargin = 0.12; - break; - case EPrintCapabPaperSizeAuto: - case EPrintCapabPaperSizeSticker: - case EPrintCapabPaperSize4x6: - default: - iPaperType = CXhtmlFileComposer::EUAInches; - iPaperSize = UnitToPixel(KSize4x6); - iPageMargin = 0.12; - break; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::LayoutData -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::LayoutData(TInt aLayout, RArray& aPositions) -{ - LOG1("[CXhtmlFileComposer::LayoutData]\t aLayout: %d", aLayout); - - TSizeReal pos(0,0); - - switch(aLayout) - { - case EPrintCapabLayout1UpBorder: - iImagesPerPage = 1; - iPagePortrait = EFalse; - CreateMatrix(1/*rows*/, 1/*columns*/, aPositions); - break; - case EPrintCapabLayout2Up: - iImagesPerPage = 2; - iPagePortrait = ETrue; - CreateMatrix(2, 1, aPositions); - break; - case EPrintCapabLayout4Up: - iImagesPerPage = 4; - iPagePortrait = EFalse; - CreateMatrix(2, 2, aPositions); - break; - case EPrintCapabLayout6Up: - iImagesPerPage = 6; - iPagePortrait = ETrue; - CreateMatrix(3, 2, aPositions); - break; - case EPrintCapabLayout9Up: - iImagesPerPage = 9; - iPagePortrait = EFalse; - CreateMatrix(3, 3, aPositions); - break; - case EPrintCapabLayout12Up: - iImagesPerPage = 12; - iPagePortrait = ETrue; - CreateMatrix(4, 3, aPositions); - break; - case EPrintCapabLayout16Up: - iImagesPerPage = 16; - iPagePortrait = EFalse; - CreateMatrix(4, 4, aPositions); - break; - case EPrintCapabLayout1Up: - case EPrintCapabLayout1UpBorderless: - default: - iImagesPerPage = 1; - iPageMargin = 0; - iImageFrame = iPaperSize; - iPagePortrait = EFalse; - aPositions.Append(pos); - break; - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::CreateMatrix -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::CreateMatrix(TInt aRows, TInt aColumns, RArray& aPositions) -{ - LOG("[CXhtmlFileComposer]\t CreateMatrix"); - - TSizeReal pos; - TSizeReal matrix(aColumns,aRows); - TSizeReal relativeSize(KFrameRatio, 1); - - if(!iPagePortrait) - { - matrix.Reverse(); - relativeSize.Reverse(); - } - - // count print area: paper size - margins - TSizeReal margins(matrix); - margins += 1; - margins *= UnitToPixel(iPageMargin); - LOG2("[CXhtmlFileComposer::CreateMatrix]\t margins: %fx%f", PixelToUnit(margins.iWidth), PixelToUnit(margins.iHeight)); - - TSizeReal printArea = (iPaperSize - margins); - LOG2("[CXhtmlFileComposer::CreateMatrix]\t printArea: %fx%f", PixelToUnit(printArea.iWidth), PixelToUnit(printArea.iHeight)); - - // Count frame size - - iImageFrame = printArea/matrix; - LOG2("[CXhtmlFileComposer::CreateMatrix]\t iImageFrame bef. ratio: %fx%f", PixelToUnit(iImageFrame.iWidth), PixelToUnit(iImageFrame.iHeight)); - - LOG1("[CXhtmlFileComposer::CreateMatrix]\t frame ratio: %f", iImageFrame.Ratio()); - - // force frame ratio to KFrameRatio ratio - LOG1("[CXhtmlFileComposer::CreateMatrix]\t relativeRatio: %f", relativeSize.Ratio()); - - TReal relativeRatio = relativeSize.Ratio()/iImageFrame.Ratio(); - if(1 < relativeRatio) - { - iImageFrame.iHeight /= relativeRatio; - } - else if(1 > relativeRatio) - { - iImageFrame.iWidth *= relativeRatio; - } - - LOG2("[CXhtmlFileComposer::CreateMatrix]\t iImageFrame aft. ratio: %fx%f", PixelToUnit(iImageFrame.iWidth), PixelToUnit(iImageFrame.iHeight)); - LOG1("[CXhtmlFileComposer::CreateMatrix]\t --> ratio: %f (1.3325/0.7505)", iImageFrame.Ratio()); - - // Count the empty space on page to centerise the frame set - TSizeReal frameSetSize(iImageFrame*matrix); - TSizeReal emptySpace = (printArea - frameSetSize) / 2; - - LOG2("[CXhtmlFileComposer::CreateMatrix]\t frameSetSize:\t %fx%f", PixelToUnit(frameSetSize.iWidth), PixelToUnit(frameSetSize.iHeight)); - LOG2("[CXhtmlFileComposer::CreateMatrix]\t emptySpace:\t %fx%f", PixelToUnit(emptySpace.iWidth), PixelToUnit(emptySpace.iHeight)); - - // if only one image/page, no need to calculate positions. - if(0 >= aColumns || 0 >= aRows) - { - aPositions.Append(pos); - return; - } - - emptySpace.Reverse(); - - for(TInt row = 0; row < aRows; ++row) - { - LOG1("[CXhtmlFileComposer::CreateMatrix]\t row: %d", row); - pos.iWidth = (iImageFrame.iHeight+UnitToPixel(iPageMargin)) * row; - pos.iWidth += emptySpace.iWidth; - for(TInt col = 0; col < aColumns; ++col) - { - pos.iHeight = (iImageFrame.iWidth+UnitToPixel(iPageMargin)) * col; - pos.iHeight += emptySpace.iHeight; - LOG2("[CXhtmlFileComposer::CreateMatrix]\t col: %fx%f", PixelToUnit(pos.iWidth), PixelToUnit(pos.iHeight)); - aPositions.Append(pos); - } - } -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::ReadTemplateL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ReadTemplateFileL() -{ - LOG("[CXhtmlFileComposer]\t ReadTemplateL"); - // Open the template file and read it into buffer - RFile templateFile; - CleanupClosePushL(templateFile); - -#ifdef _DEBUG - //_LIT(KFile, "e:\\UPnPXHTMLTemplate.xhtml"); - _LIT(KFileName, "UPnPXHTMLTemplate.xhtml"); - TInt drive; - TFileName path; - - DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, drive); - PathInfo::GetRootPath(path, drive); - path.Append(KFileName()); - - TInt e = templateFile.Open( iFsSession, path, EFileRead); - if(KErrNone != e) -#endif - { - User::LeaveIfError( templateFile.Open( iFsSession, KXHTMLTemplate(), EFileRead) ); - } - TInt fileSize = 0; - TInt err = templateFile.Size(fileSize); - if(KErrNone != err) - fileSize = KXFCMaxFileSize; - - iFileBuf = HBufC8::NewL(fileSize); - TPtr8 bufferPtr( iFileBuf->Des() ); - - bufferPtr.Zero(); - templateFile.Read(bufferPtr); - - CleanupStack::PopAndDestroy(&templateFile); - - // Separate page, frame position, image details and frame - // template elements from the template buffer - GetTemplateStringL(KPageStart(), KPageEnd(), iPageTemplate); - GetTemplateStringL(KFrameStart(), KFrameEnd(), iFrameTemplate); - GetTemplateStringL(KPositionStart(), KPositionEnd(),iPositionTemplate); - GetTemplateStringL(KImgStart(), KImgEnd(), iImageTemplate); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::GetTemplateStringL -// -//-------------------------------------------------------------------------------------------- -TPtrC8 CXhtmlFileComposer::GetTemplateStringL(const TDesC8 &aStart, const TDesC8 &aEnd, TDes8 &aTemplate) -{ - User::LeaveIfNull(iFileBuf); - - TInt start = iFileBuf->Find(aStart); - if(KErrNotFound == start) - User::Leave(KErrCorrupt); - - TInt end = iFileBuf->Find(aEnd); - if(KErrNotFound == end) - User::Leave(KErrCorrupt); - - TPtrC8 ptr = iFileBuf->Des().Mid(start+aStart.Length(), end-start-aStart.Length()); - - if(aTemplate.MaxLength() < ptr.Length()) - User::Leave(KErrOverflow); - - aTemplate = ptr; - iFileBuf->Des().Delete(start, ptr.Length()+aStart.Length()+aEnd.Length()); - return ptr; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::AddTemplateStringL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::AddTemplateStringL(const TDesC8 &aTemplate,const TDesC8 &aTag) -{ - User::LeaveIfNull(iFileBuf); - - TInt pos = iFileBuf->Find(aTag); - if(KErrNotFound == pos) - User::Leave(KErrCorrupt); - - TInt requiredSize = iFileBuf->Des().Length() + aTemplate.Length(); - if(iFileBuf->Des().MaxLength() < requiredSize) - { - iFileBuf = iFileBuf->ReAllocL(requiredSize); - } - iFileBuf->Des().Insert(pos, aTemplate); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::GetImageDataL -// -//-------------------------------------------------------------------------------------------- -TSizeReal CXhtmlFileComposer::GetImageSizeL(CImageInfo aImage) -{ - TSizeReal imageSize(0,0); - TFileName name; - aImage.GetFilePathL(name); - if(name.Compare(KNullDesC())) - { - // Test file existing - TEntry data; - TInt err = iFsSession.Entry(name, data); - User::LeaveIfError(err); - - // Get image size in pixels - CImageDecoder *id = NULL; - TRAP(err, id = CImageDecoder::FileNewL(iFsSession, name, KMimeJpeg())); - - if(KErrNone == err) - { - TFrameInfo frameInfo; - frameInfo = id->FrameInfo(); - imageSize = frameInfo.iOverallSizeInPixels; - } - - if(id) - delete id; - } - LOG2("[CXhtmlFileComposer]\t Image size: %fx%f", imageSize.iWidth, imageSize.iHeight); - return imageSize; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::AddPageL -// -//-------------------------------------------------------------------------------------------- -TBool CXhtmlFileComposer::AddPageL(TInt aCurrentImage, TInt& aPositionIndex, TInt& aPageCount) -{ - TBool ret = EFalse; - // increase position index by default and reset it in case of new page - ++aPositionIndex; - - User::LeaveIfNull(iFileBuf); - if(0 >= iImagesPerPage) - User::Leave(KErrArgument); - - TInt modulo = aCurrentImage % iImagesPerPage; - - if(0 == modulo) - { - //delete current page's frame marker before... - TInt pos = iFileBuf->Find(KFrame()); - if(KErrNotFound != pos) - iFileBuf->Des().Delete(pos, KFrame().Length()); - - // ...add the new page template and reset position index - AddTemplateStringL(iPageTemplate, KPage()); - aPositionIndex = 0; - ++aPageCount; - ret = ETrue; - } - return ret; -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::GetImageName -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::GetImageNameL(CImageInfo aImageInfo, TDes8 &aImageName, TBool aDataFile) -{ - aImageInfo.GetEncodedUriL(aImageName); - if(0 >= aImageName.Length() || aDataFile) - { - aImageInfo.GetFilePath(aImageName); - if(0 >= aImageName.Length()) - User::Leave(KErrArgument); - } - - LOG81("[CXhtmlFileComposer]\t Image: %S", &aImageName); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::SizeAndOrientationL -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::SizeAndOrientationL(const CImageInfo aImageInfo, TSizeReal& aImageSize, TBool& aFramePortrait) -{ - aImageSize = GetImageSizeL(aImageInfo); - - // If the size of any of the sides is zero, set the size as frame size - if(0 >= aImageSize.iWidth) - aImageSize = iImageFrame; - - // orientations - iImagePortrait = (aImageSize.iWidth < aImageSize.iHeight ? ETrue : EFalse); - aFramePortrait = (iImageFrame.iWidth < iImageFrame.iHeight ? ETrue : EFalse); - - // Set orientation in degrees - TInt orientation = KXFCZeroDeg; - if(aFramePortrait != iImagePortrait) - orientation = KXFC90Deg; - - // Set orientation in template - TXhtmlSetting orientationStr; - orientationStr.Format(KDeg(), orientation); - ComposeTemplateL(orientationStr, KImgOrientation()); - - // Set image and image frame temporarily in same orientation - if(aFramePortrait != iImagePortrait) - iImageFrame.Reverse(); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::GetImageName -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::ComposePositionL(TInt aPositionIndex, RArray& aPositions) -{ - TSizeReal position(0,0); - if(aPositions.Count() <= aPositionIndex) - aPositionIndex = 0; - - if(0 < aPositions.Count()) - position = aPositions[aPositionIndex]; - - // Format position - TXhtmlSetting positionTopStr, positionLeftStr; - - FormatReal(PixelToUnit(position.iWidth), positionTopStr); - ComposeTemplateL(positionTopStr, KPositionTop()); - - FormatReal(PixelToUnit(position.iHeight), positionLeftStr); - ComposeTemplateL(positionLeftStr, KPositionLeft()); -} - -//-------------------------------------------------------------------------------------------- -// -// CXhtmlFileComposer::FormatReal -// -//-------------------------------------------------------------------------------------------- -void CXhtmlFileComposer::FormatReal(TRealX aNumber, TDes8& aString) -{ - TRealFormat form; - form.iPlaces = 4; - form.iPoint = TChar('.'); - form.iType = KDoNotUseTriads | KRealFormatFixed; - - aString.Num(aNumber, form); - aString.Append(KUnit()); -} - -// End of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/imageprint.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/imageprint.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2004-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: Client include file for the ImagePrint server. Contains the -* CImagePrint class definition, and the following interfaces: -* MIdleObserver, MPrinterDiscoveryObserver and MPrintEventObserver -* -*/ - - -#ifndef IMAGEPRINT_H -#define IMAGEPRINT_H - -#include - -class TPrinter; -class TEvent; - -_LIT( KTabChar, "\t" ); -_LIT( KParamFile, "\\system\\data\\T_AIW_TEMP.DAT"); - -/// Error constant defined to indicate Invalid Sequence. -const TInt KErrInvalidSequence = -50; -/// Error constant defined to indicate Invalid Data. -const TInt KErrInvalidData = -51; -/// Error constant defined to indicate that a printer has been connected -const TInt KErrConnected = -500; - -/// BPP Protocol Identifier. -const TUint KImagePrint_PrinterProtocol_BPP = 1; -/// BIP Protocol Identifier. -const TUint KImagePrint_PrinterProtocol_BIP = 2; -/// OPP Protocol Identifier (Printer). -const TUint KImagePrint_PrinterProtocol_OPP_Printer = 4; -/// DPOF Protocol Identifier. -const TUint KImagePrint_PrinterProtocol_DPOF = 8; -/// PictBridge Protocol Identifier. -const TUint KImagePrint_PrinterProtocol_PictBridge = 16; -/// OPP Protocol Identifier (PC). -const TUint KImagePrint_PrinterProtocol_OPP_PC = 32; -/// UPnP Protocol Identifier -const TUint KImagePrint_PrinterProtocol_UPnP = 64; - -/// Enums used to specify the current state in the DiscoveryStatusL callback. -enum TDiscoveryStatus - { - EDiscoverying = 0, - EDiscoveryFinished = 1, - EDiscoveryCancelling = 2 - }; - -/// Enums used to specify the current state in the PrintJobProgressEvent callback. -enum TPrintJobProgressEventStatus - { - EActive = 0, - EDone = 1 - }; - -/** - * @brief Interface to be implemented by the class using CImagePrint. It is used by CImagePrint to report anything related - * to the discovery process. - */ -class MPrinterDiscoveryObserver - { - public: - /** - * Called by Image Printer Server to notify the client application that a printer was discovered. - * @param aPrinterInfo Contains printer information of the discovered device. - */ - virtual void FoundPrinterL( const TPrinter& aPrinterInfo ) = 0; - /** - * Called by Image Printer Server to notify the client application that an operation - * has completed, either successfully or with an error. - * @param aStatus Indicate the status of the discovery process. One of the values of \c ::TDiscoveryStatus - * @param aErrorCode \c KErrNone if there was no error, otherwise another of the system-wide error codes. - * @param aErrorStringCode StringCode - Descriptive text that can be used to further explain error. - */ - virtual void DiscoveryStatusL( TInt aStatus, - TInt aErrorCode, - TInt aErrorStringCode ) = 0; - /** - * Called by Image Printer Server to notify the client application that a printer - * returned from the cache was not discovered during the discovery phase, - * and should be removed from the UI. If this call is needed, it will be made - * after all BPP printers have been returned, but before the discovery completes. - * @param aPrinterInfo Contains printer information of the printer that was not found during discovery - */ - virtual void RemovePrinterL( const TPrinter& aPrinterInfo ) = 0; - }; - -/** - * @brief Interface to be implemented by the class using CImagePrint. It is used by CImagePrint to report anything related - * to the printing process, once it is started. - */ -class MPrintEventObserver - { - public: - virtual void PrintJobProgressEvent( TInt aStatus, - TInt aPercentCompletion, - TInt aJobStateCode ) = 0; - - virtual void PrintJobErrorEvent( TInt aError, - TInt aErrorStringCode ) = 0; - - virtual void PrinterStatusEvent( TInt aError, - TInt aErrorStringCode ) = 0; - - virtual void PreviewImageEvent( TInt aFsBitmapHandle ) = 0; - - virtual void ShowMessageL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - - virtual TBool AskYesNoQuestionL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - - virtual const TDesC& AskForInputL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - }; - -/** - * @brief Interface to be implemented by the class using CImagePrint. It is used by CImagePrint to report - * anything related to status changes in the handling protocol. - * @sa CImagePrint::RegisterIdleObserver - */ -class MIdleObserver - { - public: - /** Called by CImagePrint to notify of events. The meaning of the event and associated error and mesage codes - * is protocol dependant. - */ - virtual void StatusEvent( const TEvent &aEvent, - TInt aError, - TInt aMsgCode ) = 0; - }; - - -#endif // IMAGEPRINT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/imageprint.rh --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/imageprint.rh Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the following interfaces: MProtPrintingDevice, -* MProtIdleObserver, MProtPrintEventObserver and MProtDiscoveryObserver. -* -*/ - - -STRUCT RS_CAPABILITY -{ - LONG printerclass; - LONG capabilityid; - LONG type; - LONG defaultvalue; - LONG low; - LONG high; - LONG enumcodes[]; //code and link pair - LONG linkid; -} - -STRUCT RS_CAPABILITIES -{ - STRUCT capabilities[]; -} diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/mprotprintingdevice.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/mprotprintingdevice.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the following interfaces: MProtPrintingDevice, -* MProtIdleObserver, MProtPrintEventObserver and MProtDiscoveryObserver. -* -*/ - - -#ifndef MPROTPRINTINGDEVICE_H -#define MPROTPRINTINGDEVICE_H - -#include - -#include "tprinter.h" -#include "tprintcapability.h" -#include "tidleevent.h" - -const TInt DEVICE_ID_FIELD_MASK = 0x03FFFFFF; // most significant bits: 0000 0011 rest is 1's -const TInt PROTOCOL_ID_FIELD_MASK = 0xFC000000; // most significant bits: 1111 1100 -const TInt PROTOCOL_ID_CLEAR_MASK = 0x0000003F; // less siginificant bits: 0011 1111 -const TInt PROTOCOL_ID_BIT_COUNT = 6; - - -/** - * @brief Interface to be implemented by a class observing the discovery events of a class implementing MProtPrintingDevice. - * - * Interface used by a Protocol implementing "MProtPrintingDevice" to report back any device found or not found and - * the general status of the discovery process. This should be implemented by the class using "MProtPrintingDevice"; in - * this case, it's already implemented in a class in the Image Print Library. - */ -class MProtDiscoveryObserver - { - public: - virtual void FoundDeviceL( TPrinter& aDeviceInfo ) = 0; - virtual void RemoveDeviceL( TPrinter& aDeviceInfo ) = 0; - - /** - * @brief - * @param aStatus ( EDiscovering | ECancellingDiscovery | EDoneDiscovery | EDiscoveryFinished ) - * EDiscovering = currently discovering - * ECancellingDiscovery = cancel request on discovery - * EDiscoveryFinished = on discovery time-out - * @param aErrorCode - * @param aErrorStringCode - */ - virtual void DiscoveryStatusL( TInt aStatus, - TInt aErrorCode, - TInt aErrorStringCode = KErrNone ) = 0; - }; - -/** - * @brief Interface to be implemented by a class observing the printing events of a class implementing MProtPrintingDevice. - * - * Interface used by a Protocol implementing "MProtPrintingDevice" to report back the printing progress, any error or - * the printer status. This should be implemented by the class using "MProtPrintingDevice"; in this case, it's already - * implemented in a class in the Image Print Library. - * These methods should be used only when actual printing is ongoing - */ -class MProtPrintEventObserver - { - public: - /** - * @brief Method to inform observer about printing proggress. - * - * @param aStatus Defines the printing status defined in ImagePrint.h. - * @param aPercent Percents of job readiness. - * @param aJobStateCode Job's state defined in PrintMessageCodes.h. - */ - virtual void PrintJobProgressEvent( TInt aStatus, - TInt aPercent, - TInt aJobStateCode ) = 0; - - /** - * @brief Method to inform observer about error occured during printing. - * - * @param aErrorCode Defines the error code that is symbian wide or defined in PrintMessageCodes.h. - * @param aErrorStringCode Reserved for future use. - */ - virtual void PrintJobErrorEvent( TInt aErrorCode, - TInt aErrorStringCode = KErrNone ) = 0; - - /** - * @brief Method to inform observer about error concerning the printing device. - * - * @param aErrorCode Defines the error code that is symbian wide or defined in PrintMessageCodes.h. - * @param aErrorStringCode Reserved for future use. - */ - virtual void PrinterStatusEvent( TInt aErrorCode, - TInt aErrorStringCode = KErrNone ) = 0; - - // DEPRECATED - DO NOT USE - virtual void PreviewImageEvent( TInt aFsBitmapHandle ) = 0; - - // DEPRECATED - DO NOT USE - virtual void ShowMessageL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - - // DEPRECATED - DO NOT USE - virtual TBool AskYesNoQuestionL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - - // DEPRECATED - DO NOT USE - virtual const TDesC& AskForInputL( TInt aMsgLine1Code, - TInt aMsgLine2Code ) = 0; - }; - -/** - * @brief Interface to be implemented by CImagePrint. It is used to report - * anything related to status changes in the handling protocol. - * @sa MProtPrintingDevice::RegisterIdleObserver - */ -class MProtIdleObserver - { - public: - /** Called by a protocol to notify CImagePrint of events. The meaning of the event and associated error and mesage codes - * is protocol dependant. This should be used only when actual printing is not ongoing. - */ - virtual void StatusEvent( const TEvent &aEvent, - TInt aError, - TInt aMsgCode ) = 0; - }; - -/** - * @brief Interface to be implemented in the Polymorphic DLLs. - * - * Interface to be implemented by any printing protocol that wants to be added to the Image Print library, so it can - * be seen by the library and used in a transparent way. This implementation should be encapsulated within a Polymorphic - * DLL and put in a specific directory. - */ -class MProtPrintingDevice - { - public: - // General. - /** - * @brief Part of the standard construction pattern. - * @param aDLLPath Path where the DLL was found so it can know where it is located and use that information - * when looking for resource files and such. The path includes the DLL itself. - */ - virtual void ConstructL( const TDesC& aDLLPath ) = 0; - /** - * @brief Reports the Version of the DLL. - * @return A TVersion object containing the version of the protocol. - */ - virtual TVersion Version() = 0; - /** - * @brief Returns the Protocols supported by the DLL. It can be any of the KImagePrint_PrinterProtocol* constants. - * @return An OR'ed value with the supported protocols information. - */ - virtual TUint SupportedProtocols() = 0; - // Discovery. - /** - * @brief Starts the discovery process. - * - * This process is to find whatever printing device is available nearby. After this call server waits - * DiscoveryStatusL from MProtDiscoveryObserver to be called with value aStatus = EDiscoveryFinished - * after the discovey is finished. - * @param aObserver The discovery observer. - * @param aProtocol Used to indicate what protocols to search for. 0 = all, 1 = BPP, 2 = BIP, 4 = OPP, 8 = DPOF, 16 = PB. - * @return Any standard Symbian error code. - */ - virtual void StartDiscoveryL( MProtDiscoveryObserver& aObserver, - TUint aProtocol = 0 ) = 0; - /** - * @brief Removes a specified cached printer. - * @param[in] aDeviceID The ID of the printer the client wants to remove. - * @return Any standard Symbian error code or ( KErrInvalidSequence and KErrInvalidData ). - */ - virtual TInt RemoveCachedDeviceL( TInt aDeviceID ) = 0; - - /** - * @brief Cancels the discovery process. - * The caller expects to get notification of cancelled discovery via 'DiscoveryStatusL' with value 'EDiscoveryCancelling' - * @param[in] aDoCallBack Flag to indicate whether to call back the observer or not. Default = True. - */ - virtual void CancelDiscovery( TBool aDoCallBack = ETrue ) = 0; - - // Print. - /** - * @brief Creates a print job in the specified printer. - * @param[in] aDeviceID The ID of the printer where the client wishes to create the print job. - * @param aImages Array containing the full names of the files to print. - * @param aObserver The print event observer. - * @return Any standard Symbian error code or ( KErrInvalidSequence and KErrInvalidData ). - */ - virtual TInt CreatePrintJobL( TInt aDeviceID, - RPointerArray& aImages, - MProtPrintEventObserver& aObserver ) = 0; - /** - * @brief Submits a print job already created. - */ - virtual void SubmitPrintJobL() = 0; - /** - * @brief Cancels the print job. - */ - virtual TInt CancelPrintJob() = 0; - /** - * @brief Continues printing and / or submitting a print job. Implementation may vary from protocol to protocol. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt ContinuePrintJobL() = 0; - /** - * @brief Gets the number of pages to be printed. - * @return Number of pages to print. - */ - virtual TInt GetNumPrintPages() = 0; - /** - * DEPRECATED - DO NOT USE - * @brief Gets the status of the printing job created. - * @return Printing job status. - */ - virtual TInt GetPrintJobStatus() = 0; - /** - * DEPRECATED - DO NOT USE - * @brief Gets the status of the printer. - * @param[in] aDeviceID The ID of the printer the client wants to know about. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt GetPrinterStatus( TInt aDeviceID ) = 0; - // Capabilities. - /** - * @brief Gets the IDs of the capabilities supported by the printer specified. - * @param[in] aDeviceID The ID of the printer the client wants to know about. - * @param[out] aCapabilityIDs Array containing the ID's of the capabilities of the specified printer. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt GetDeviceCapabilityIDsL( TInt aDeviceID, - RArray& aCapabilityIDs ) = 0; - /** - * @brief Gets the detail of a certain capability of a certain printer. - * @param[in] aDeviceID The exposed ID of the printer the client wants to know about. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[out] aCapability Capability information. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt GetDeviceCapabilityL( TInt aDeviceID, - TInt aCapabilityID, - TPrintCapability& aCapability ) = 0; - /** - * @brief Gets a setting (i.e., papersize selected) from an existing job. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[out] aValue Capability value. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt GetJobSetting( TInt aCapabilityID, - TInt& aValue ) = 0; - /** - * @brief Sets a print job setting. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[in] aValue New capability value. - * @param[out] aAffectedCapability ID of any affected capability. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt SetJobSettingL( TInt aCapabilityID, - TInt aValue, - TInt& aAffectedCapability ) = 0; - // Preview. - /** - * DEPRECATED - DO NOT USE - * @brief Gets the number of pages in the preview. - * @return Number of pages in the preview. - */ - virtual TInt GetNumPreviewPages() = 0; - /** - * DEPRECATED - DO NOT USE - * @brief Gets the icon representing a given layout or template. - * @param[in] aTemplateID ID of the template / layout of interest. - * @param[out] aFsBitmapHandle Handle to the appropriate bitmap. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt GetJobTemplateIconL( TInt aTemplateID, - TInt& aFsBitmapHandle ) = 0; - /** - * DEPRECATED - DO NOT USE - * @brief Creates a preview image. - * @param[in] aPageNumber Page number to create preview image of. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - virtual TInt CreatePreviewImage( TInt aPageNumber ) = 0; - - /** - * @brief Destructor. - */ - virtual ~MProtPrintingDevice() {} - - - /** - * @brief Registers the IdleObserver to send idle event notifications - * @param A pointer to an object implementing MIdleObserver interface that will be notified of events - * @note In order to stop sending notifications, send NULL as the parameter. - */ - virtual void RegisterIdleObserver( MProtIdleObserver *aObserver ) = 0; - - - /** - * @brief Number of copies setter. Must be called after the print job is created but before - * submission. Amount of array elements must be the same with the amount of image files - * in the print job. Array elements must be greater than 0. - * @param aNumsOfCopies number of copies array - * @param aErr contains error code on return - */ - virtual void SetNumsOfCopiesL( const RArray& aNumsOfCopies, - TInt& aErr ) = 0; - - public: - TUid iDtor_ID_Key; - protected: - /// Protocol API observer. - MProtDiscoveryObserver* iDiscoveryObserver; - /// Protocol API observer. - MProtPrintEventObserver* iPrintEventObserver; - }; - -#endif // MPROTPRINTINGDEVICE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/printcapabilitycodes.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/printcapabilitycodes.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the TPrintCapabilityCodes and TPrintCapabilityOptions enumerations. -* -*/ - - -#ifndef PRINTCAPABILITYCODES_H -#define PRINTCAPABILITYCODES_H - -/// All the printer capabilities -enum TPrintCapabilityCodes - { - EPrintCapabLayout = 500, - EPrintCapabPaperSize = 501, - EPrintCapabQuality = 502 - }; - -/// Print capability generic options -enum TPrintCapabilityOptions - { - // Generic - EPrintCapabYes = 1000, - EPrintCapabNo = 1001, - EPrintCapabOn = 1002, - EPrintCapabOff = 1003, - - // Quality - EPrintCapabQualityDefault = 1100, - EPrintCapabQualityNormal = 1101, - EPrintCapabQualityDraft = 1102, - EPrintCapabQualityFine = 1103, - - // Paper size - EPrintCapabPaperSizeAuto = 1200, - EPrintCapabPaperSizeLetter = 1201, - EPrintCapabPaperSizeA4 = 1221, - EPrintCapabPaperSizeA6 = 1222, - EPrintCapabPaperSize4x6 = 1250, - EPrintCapabPaperSize5x7 = 1251, - EPrintCapabPaperSizeSticker = 1270, - - // Layout - EPrintCapabLayout1Up = 1501, - EPrintCapabLayout2Up = 1502, - //EPrintCapabLayout3Up = 1503, - EPrintCapabLayout4Up = 1504, - //EPrintCapabLayout5Up = 1505, - EPrintCapabLayout6Up = 1506, - EPrintCapabLayout9Up = 1509, - EPrintCapabLayout12Up = 1512, - EPrintCapabLayout16Up = 1513, - EPrintCapabLayout16UpStick = 1516, - EPrintCapabLayout1UpSmall = 1551, - EPrintCapabLayout1UpMedium = 1552, - EPrintCapabLayout1UpLarge = 1553, - EPrintCapabLayout1UpBorderless = 1554, - EPrintCapabLayout1UpBorder = 1555, - //EPrintCapabLayout1UpPassport = 1556, - //EPrintCapabLayout1UpPassportSF = 1557, // SmallFormat paper - - EPrintCapabLayout2UpPassport508x508Lg = 1558, - EPrintCapabLayout2UpPassport254x364Lg = 1559, - EPrintCapabLayout2UpPassport350x450Lg = 1560, - EPrintCapabLayout2UpPassport364x508Lg = 1561, - EPrintCapabLayout2UpPassport450x550Lg = 1562, - - EPrintCapabLayout2UpPassport508x508Sm = 1563, - - EPrintCapabLayout4UpStick = 1564, - EPrintCapabLayout1UpStick = 1565, - - EPrintCapabLayout2UpPassport254x364Sm = 1566, - EPrintCapabLayout2UpPassport350x450Sm = 1567, - EPrintCapabLayout2UpPassport364x508Sm = 1568, - EPrintCapabLayout2UpPassport450x550Sm = 1569, - - EPrintCapabLayoutLast = 3000 - }; - -#endif // PRINTCAPABILITYCODES_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/printmessagecodes.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/printmessagecodes.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +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: Contains the TPrintErrorMessageCodes and TPrintMessageCodes enumerations. -* -*/ - - -#ifndef PRINTMESSAGECODES_H -#define PRINTMESSAGECODES_H - -/// Global printing Error Message Codes. -// All supported by UI -enum TPrintErrorMessageCodes -{ - EObexConnectError = -3000, - EObexSendError = -3001, - EObexDisconnectError = -3002, - EObexGeneralError = -3003, -}; - -/// Global printing Message Codes. -enum TPrintMessageCodes -{ - // No message - ENoMessage = 0, - - // Print Progress Codes - EJobPending = 3100, - EPrinting = 3101, - ECopying = 3102, - ECancelling = 3103, - ECancellingNoMessage = 3104, - - // Pict Bridge - EPbOutOfPaper = 3300, ///<@deprecated Use TPrintMessageCodes::EPbStatusErrorReasonPaperEmpty - EPbCheckPrinter = 3301, - EPbPrinterIsDisconnected = 3302, - EPbPrinterIsConnected = 3303, - EPbFileNotSupported = 3304, - EPbFileNotFound = 3305, - - EPbStatusErrorReasonNoReason, /*3306*/ ///<@brief No reason - EPbStatusErrorReasonPaper, ///<@brief Paper-related error - EPbStatusErrorReasonInk, ///<@brief Ink-related error - EPbStatusErrorReasonHardware, ///<@brief Hardware-related error - EPbStatusErrorReasonFile, ///<@brief File-related error - EPbStatusErrorReasonPaperEmpty, /*3311*/ ///<@brief Paper is empty - EPbStatusErrorReasonPaperLoad, ///<@brief Load error - paper not loaded correctly - EPbStatusErrorReasonPaperEject, ///<@brief Eject error - paper not ejected correctly - EPbStatusErrorReasonPaperMedia, ///<@brief Media error - paper is not detected, paper skewed, roll paper connot be cut or torn-off - EPbStatusErrorReasonPaperJam, ///<@brief Paper jam - EPbStatusErrorReasonPaperNearlyEmpty, ///<@brief Paper nearly empty - EPbStatusErrorReasonPaperCombination, ///<@brief Paper type / paper size combination not supported, or paper found in printer does not match request - EPbStatusErrorReasonInkEmpty, /*18*/ ///<@brief Ink empty - EPbStatusErrorReasonInkLow, ///<@brief Ink low - EPbStatusErrorReasonInkWaste, ///<@brief Waste ink error (waste-ink reservior full). - EPbStatusErrorReasonHardwareFatal, /*21*/ ///<@brief Fatal error - EPbStatusErrorReasonWarning, // warning - EPbStatusErrorReasonHardwareServiceCall, ///<@brief Service call - EPbStatusErrorReasonHardwarePrinterUnavailable, ///<@brief Printer unavailable (performing maintenance or otherwise occupied) - EPbStatusErrorReasonHardwarePrinterBusy, ///<@brief Printer busy (processing a job from another source, e.g. a PC) - EPbStatusErrorReasonHardwareLever, ///<@brief Lever error (lever position not correct) - EPbStatusErrorReasonHardwareCoverOpen, ///<@brief Cover open - EPbStatusErrorReasonHardwareNoMarkingAgent, ///<@brief No marking agent (e.g. missing printer head) - EPbStatusErrorReasonHardwareInkCoverOpen, ///<@brief Ink cover open - EPbStatusErrorReasonHardwareNoInkCartridge, ///<@brief No ink cartridge - EPbStatusErrorReasonFilePrintInfo, /*31*/ ///<@brief printInfo error (specified <printInfo> is too large). - EPbStatusErrorReasonFileFileDecode, ///<@brief File decode error (picture format of specified image cannot be decoded). - - // Printer status reasons - EPrintReasonAttentionRequired, /*33*/ ///<@brief Indicates reason other than those listed - EPrintReasonPaused, ///<@brief Someone has paused the printer and the PrinterState is "stopped". In this state, a Printer may not produce printed output. - EPrintReasonOutputAreaAlmostFull, ///<@brief One or more output area is almost full: e.g., tray, stacker, collator. - EPrintReasonOutputAreaFull, ///<@brief One or more output area is full: e.g., tray, stacker, collator. - EPrintReasonMarkerSupplyLow, ///<@brief The device is low on at least one marker supply: e.g., toner, ink, ribbon. - EPrintReasonMarkerSupplyEmpty, ///<@brief The device is out of at least one marker supply: e.g., toner, ink, ribbon. - EPrintReasonMarkerFailure, ///<@brief The device has at least one marking device which has failed and requires service or replacement: e.g., pen. - - // OBEX response codes - EObexReserved, ///<@brief Reserved - EObexContinue, ///<@brief Continue - EObexOKSuccess, ///<@brief OK, Success - EObexCreated, ///<@brief Created - EObexAccepted, ///<@brief Accepted - EObexNonAuthoritativeInformation, ///<@brief Non-Authoritative Information - EObexNoContent, ///<@brief No Content - EObexResetContent, ///<@brief Reset Content - EObexPartialContent, ///<@brief Partial Content - EObexMultipleChoices, ///<@brief Multiple Choices - EObexMovedPermanently, ///<@brief Moved Permanently - EObexMovedTemporarily, ///<@brief Moved Temporarily - EObexSeeOther, ///<@brief See Other - EObexNotModified, ///<@brief Not Modified - EObexUseProxy, ///<@brief Use Proxy - EObexBadRequest, ///<@brief Bad Request - server could not understand the request - EObexUnauthorized, ///<@brief Unauthorized - EObexPaymentRequired, ///<@brief Payment required - EObexForbidden, ///<@brief Forbidden: operation is understood but refused - EObexNotFound, ///<@brief Not found DPS: Object or File does not exist. - EObexMethodNotAllowed, ///<@brief Method not allowed - EObexNotAcceptable, ///<@brief Not acceptable - EObexProxyAuthRequired, ///<@brief Proxy authentication is required - EObexRequestTimedOut, ///<@brief Request timed out - EObexConflict, ///<@brief Conflict - EObexGone, ///<@brief Gone - EObexLengthRequired, ///<@brief Length Required - EObexPreconditionFailed, ///<@brief Precondition failed - EObexRequestedEntityTooLarge, ///<@brief Requested entity is too large - EObexRequestedURLTooLarge, ///<@brief Requested URL is too large - EObexUnsupportedMediaType, ///<@brief Unsupported media type. Note: Refers to MIME media-type - EObexInternalReceiverError, ///<@brief Internal receiver error - EObexNotImplemented, ///<@brief Not implemented - EObexBadGateway, ///<@brief Bad Gateway - EObexServiceUnavailable, ///<@brief Service Unavailable - EObexGatewayTimeout, ///<@brief Gateway Timeout - EObexHTTPVersionNotSupported, ///<@brief HTTP protocol version is not supported - EObexDatabaseFull, ///<@brief Database Full - EObexDatabaseLocked, ///<@brief Database Locked - - EKErrIrObexRespTimedOut = -5572, // OBEX command timed out - -}; - -enum TOperationStatusCodes -{ - EOperationStatusOk = 0x0000, ///<@brief successful-ok - EOperationStatusOkIgnoredOrSubstitutedAttributes = 0x0001, ///<@brief successful-ok-ignored-or-substituted-attributes - EOperationStatusOkConflictingAttributes = 0x0002, ///<@brief successful-ok-conflicting-attributes - EOperationStatusClientBadRequest = 0x0400, ///<@brief client-error-bad-request - EOperationStatusClientForbidden = 0x0401, ///<@brief client-error-forbidden - EOperationStatusClientNotAuthenticated = 0x0402, ///<@brief client-error-not-authenticated - EOperationStatusClientNotAuthorized = 0x0403, ///<@brief client-error-not-authorized - EOperationStatusClientNotPossible = 0x0404, ///<@brief client-error-not-possible - EOperationStatusClientTimeout = 0x0405, ///<@brief client-error-timeout - EOperationStatusClientNotFound = 0x0406, ///<@brief client-error-not-found - EOperationStatusClientGone = 0x0407, ///<@brief client-error-gone - EOperationStatusClientRequestEntityTooLarge = 0x0408, ///<@brief client-error-request-entity-too-large - EOperationStatusClientRequestValueTooLong = 0x0409, ///<@brief client-error-request-value-too-long - EOperationStatusClientDocumentFormatNotSupported = 0x040a, ///<@brief client-error-document-format-not-supported - EOperationStatusClientAttributesOrValuesNotSupported = 0x040b, ///<@brief client-error-attributes-or-values-not-supported - EOperationStatusClientUriSchemeNotSupported = 0x040c, ///<@brief client-error-uri-scheme-not-supported - EOperationStatusClientCharsetNotSupported = 0x040d, ///<@brief client-error-charset-not-supported - EOperationStatusClientConflictingAttributes = 0x040e, ///<@brief client-error-conflicting-attributes - EOperationStatusClientCompressionNotSupported = 0x040f, ///<@brief client-error-compression-not-supported - EOperationStatusClientCompression = 0x0410, ///<@brief client-error-compression-error - EOperationStatusClientDocumentFormat = 0x0411, ///<@brief client-error-document-format-error - EOperationStatusClientDocumentAccess = 0x0412, ///<@brief client-error-document-access-error - EOperationStatusClientMediaNotLoaded = 0x0418, ///<@brief client-error-media-not-loaded - EOperationStatusServerInternalError = 0x0500, ///<@brief server-error-internal-error - EOperationStatusServerOperation = 0x0501, ///<@brief server-error-operation-not-supported - EOperationStatusServerServiceUnavailable = 0x0502, ///<@brief server-error-service-unavailable - EOperationStatusServerVersionNotSupported = 0x0503, ///<@brief server-error-version-not-supported - EOperationStatusServerDeviceError = 0x0504, ///<@brief server-error-device-error - EOperationStatusServerTemporaryError = 0x0505, ///<@brief server-error-temporary-error - EOperationStatusServerNotAcceptingJobs = 0x0506, ///<@brief server-error-not-accepting-jobs - EOperationStatusServerBusy = 0x0507, ///<@brief server-error-busy - EOperationStatusServerJobCanceled = 0x0508, ///<@brief server-error-job-canceled - EOperationStatusServerMultipleDocument = 0x0509 ///<@brief server-error-multiple-document-jobs-not-supported -}; - -#endif // PRINTMESSAGECODES_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tidleevent.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tidleevent.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the types necesary for MIdleObserver TPrinter class definition. -* -*/ - - -#ifndef IDLEEVENT_H -#define IDLEEVENT_H - -/** The severity associated of the notification. - */ -enum TSeverity - { - ///The event doesn't have a specific severity. Used in cases where severity is irrelevant, unknown or can be ignored. - ENotSpecified, - ///The event does not cause an error - ENoError, - ///The event was caused by a warning. Generally this is recoverable. - EWarning, - ///The event was caused by a fatal error. Generally this is not recoverable - EFatal, - ///The event was caused by a severe error. Generally this is a async leave - ESevere - }; - -/** The type of event the observer is being notified of. The types of events being raised vary by protocol - */ -enum TEventType - { - ///The protocol has made a connection to the printer, device or transport - EConnect, - ///The protocol has been disconnected from the printer, device or transport - EDisconnect, - ///The protocol can be disconnected - EDisconnectReady, - ///The protocol cannot be disconnected - EDisconnectNotReady, - ///The device or printer is ready to accept print jobs - EPrintReady, - ///The device or printer is not ready to accept print jobs - EPrintNotReady, - ///The event is notifying a change in the device status, or is reporting an error sent from the device - EPrinterStatus, - ///The event is notifying that the capabilities that the printer supports have changed - EPrinterCapabilityChanged, - ///The event is notifying that asynchronous leave has happened - EAsynchronousLeave - }; - -/** The event object. This object provides information about the event. - */ -class TEvent - { - public: - /** The protocol that is sending the notification - * @sa KImagePrint_PrinterProtocol_BPP @sa KImagePrint_PrinterProtocol_BIP @sa KImagePrint_PrinterProtocol_OPP - * @sa KImagePrint_PrinterProtocol_DPOF @sa KImagePrint_PrinterProtocol_PictBridge - */ - TInt iProtocol; - ///The associated severity of the event - TSeverity iSeverity; - ///What kind of event is being sent - TEventType iEventType; - }; - - -#endif // IDLEEVENT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tprintcapability.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tprintcapability.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: Contains the TPrintCapability class definition. -* -*/ - - -#ifndef TPRINTCAPABILITY_H -#define TPRINTCAPABILITY_H - -#include - -/** - * @brief A printer capability abstraction. - * - * Class describing a capability (i.e. paper sizes or layouts) supported by a printing device. - * Published as part of the ImagePrint Server API. - */ - -#define KMaxEnumAmount 20 - -class TPrintCapability - { - public: - enum ECapType - { - Int = 0, - Enum = 1, - Float = 2 - }; - - TInt iCapabilityID; - ECapType iType; - TInt iDefaultValue; - TInt iLow; - TInt iHigh; - TInt iEnumCount; - TInt iEnumCodes[KMaxEnumAmount]; - }; - -#endif // TPRINTCAPABILITY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tprinter.h --- a/ImagePrint/ImagePrintEngine/ImagePrintLibrary/inc/tprinter.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the TPrinter class definition. -* -*/ - - -#ifndef TPRINTER_H -#define TPRINTER_H - -#include - -/** - * @brief A printer abstraction. - * - * Class representing the basic properties of a printing device. - * Published as part of the ImagePrint Server API. - */ -class TPrinter - { - public: - enum TPrinterProperty - { - Cached = 1, - SupportsPreview = 2 - }; - enum TPrinterVendor - { - EVendorNone = 0, // No Vendor - EVendorHp - // Add other vendors - }; - TInt iPrinterID; - TBuf<84> iDisplayName; - TUint iProperties; - TUint iProtocol; - TUint iVendor; - }; - -#endif // TPRINTER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/bwins/imageprintclientu.def --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/bwins/imageprintclientu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -EXPORTS - ?StartDiscovery@RImagePrintClient@@QAEHAAVTDiscoveryGuardData@@IAAVTRequestStatus@@@Z @ 1 NONAME ; int RImagePrintClient::StartDiscovery(class TDiscoveryGuardData &, unsigned int, class TRequestStatus &) - ?Guard@CJobGuard@@QAEHHAAV?$RPointerArray@VTDesC16@@@@AAVMPrintEventObserver@@@Z @ 2 NONAME ; int CJobGuard::Guard(int, class RPointerArray &, class MPrintEventObserver &) - ?CancelStartDiscovery@RImagePrintClient@@QBEHXZ @ 3 NONAME ; int RImagePrintClient::CancelStartDiscovery(void) const - ?GetJobStatus@RImagePrintClient@@QBEHXZ @ 4 NONAME ; int RImagePrintClient::GetJobStatus(void) const - ?ContinueDiscovery@RImagePrintClient@@QAEHAAVTDiscoveryGuardData@@AAVTRequestStatus@@@Z @ 5 NONAME ; int RImagePrintClient::ContinueDiscovery(class TDiscoveryGuardData &, class TRequestStatus &) - ?ReleaseEngine@RImagePrintClient@@QBEHXZ @ 6 NONAME ; int RImagePrintClient::ReleaseEngine(void) const - ??1CIdleGuard@@UAE@XZ @ 7 NONAME ; CIdleGuard::~CIdleGuard(void) - ?Guard@CDiscoveryGuard@@QAEHAAVMPrinterDiscoveryObserver@@I@Z @ 8 NONAME ; int CDiscoveryGuard::Guard(class MPrinterDiscoveryObserver &, unsigned int) - ?ContinuePrintJob@RImagePrintClient@@QBEHXZ @ 9 NONAME ; int RImagePrintClient::ContinuePrintJob(void) const - ?SetNumberOfCopies@RImagePrintClient@@QBEHABV?$RArray@H@@@Z @ 10 NONAME ; int RImagePrintClient::SetNumberOfCopies(class RArray const &) const - ?GetNumPreviewPages@RImagePrintClient@@QBEHXZ @ 11 NONAME ; int RImagePrintClient::GetNumPreviewPages(void) const - ?ContinueCreateJob@RImagePrintClient@@QAEHAAVTJobGuardData@@AAVTRequestStatus@@@Z @ 12 NONAME ; int RImagePrintClient::ContinueCreateJob(class TJobGuardData &, class TRequestStatus &) - ?CancelDiscovery@RImagePrintClient@@QBEHXZ @ 13 NONAME ; int RImagePrintClient::CancelDiscovery(void) const - ?ConnectL@RImagePrintClient@@QAEHXZ @ 14 NONAME ; int RImagePrintClient::ConnectL(void) - ?GetJobTemplateIcon@RImagePrintClient@@QBEHHAAH@Z @ 15 NONAME ; int RImagePrintClient::GetJobTemplateIcon(int, int &) const - ?RemoveCachedPrinter@RImagePrintClient@@QBEHH@Z @ 16 NONAME ; int RImagePrintClient::RemoveCachedPrinter(int) const - ?ReserveEngine@RImagePrintClient@@QBEHXZ @ 17 NONAME ; int RImagePrintClient::ReserveEngine(void) const - ?SetForeground@RImagePrintClient@@QBEHH@Z @ 18 NONAME ; int RImagePrintClient::SetForeground(int) const - ??1CDiscoveryGuard@@UAE@XZ @ 19 NONAME ; CDiscoveryGuard::~CDiscoveryGuard(void) - ?Guard@CIdleGuard@@QAEXPAVMIdleObserver@@@Z @ 20 NONAME ; void CIdleGuard::Guard(class MIdleObserver *) - ??1CJobGuard@@UAE@XZ @ 21 NONAME ; CJobGuard::~CJobGuard(void) - ?IsPictBridgeMode@RImagePrintClient@@QBEHXZ @ 22 NONAME ; int RImagePrintClient::IsPictBridgeMode(void) const - ?RegisterIdleObserver@RImagePrintClient@@QAEHAAVTIdleGuardData@@AAVTRequestStatus@@@Z @ 23 NONAME ; int RImagePrintClient::RegisterIdleObserver(class TIdleGuardData &, class TRequestStatus &) - ??0RImagePrintClient@@QAE@XZ @ 24 NONAME ; RImagePrintClient::RImagePrintClient(void) - ?CountConnections@RImagePrintClient@@QBEHAAH@Z @ 25 NONAME ; int RImagePrintClient::CountConnections(int &) const - ?GetPrinterStatus@RImagePrintClient@@QBEHH@Z @ 26 NONAME ; int RImagePrintClient::GetPrinterStatus(int) const - ?CancelRegisterIdleObserver@RImagePrintClient@@QBEHXZ @ 27 NONAME ; int RImagePrintClient::CancelRegisterIdleObserver(void) const - ?GetJobSetting@RImagePrintClient@@QBEHHAAH@Z @ 28 NONAME ; int RImagePrintClient::GetJobSetting(int, int &) const - ?CreateJob@RImagePrintClient@@QAEHHAAVTJobGuardData@@AAV?$RPointerArray@VTDesC16@@@@AAVTRequestStatus@@@Z @ 29 NONAME ; int RImagePrintClient::CreateJob(int, class TJobGuardData &, class RPointerArray &, class TRequestStatus &) - ?NewL@CIdleGuard@@SAPAV1@AAVRImagePrintClient@@@Z @ 30 NONAME ; class CIdleGuard * CIdleGuard::NewL(class RImagePrintClient &) - ?SupportedProtocols@RImagePrintClient@@QBEHXZ @ 31 NONAME ; int RImagePrintClient::SupportedProtocols(void) const - ?Close@RImagePrintClient@@QAEXXZ @ 32 NONAME ; void RImagePrintClient::Close(void) - ?CancelCreateJob@RImagePrintClient@@QBEHXZ @ 33 NONAME ; int RImagePrintClient::CancelCreateJob(void) const - ?SubmitPrintJob@RImagePrintClient@@QBEHXZ @ 34 NONAME ; int RImagePrintClient::SubmitPrintJob(void) const - ?GetNumPrintPages@RImagePrintClient@@QBEHXZ @ 35 NONAME ; int RImagePrintClient::GetNumPrintPages(void) const - ?SetJobSetting@RImagePrintClient@@QBEHHHAAH@Z @ 36 NONAME ; int RImagePrintClient::SetJobSetting(int, int, int &) const - ?GetPrinterCapability@RImagePrintClient@@QBEHHHAAVTPrintCapability@@@Z @ 37 NONAME ; int RImagePrintClient::GetPrinterCapability(int, int, class TPrintCapability &) const - ?NewL@CJobGuard@@SAPAV1@AAVRImagePrintClient@@@Z @ 38 NONAME ; class CJobGuard * CJobGuard::NewL(class RImagePrintClient &) - ?CancelPrintJob@RImagePrintClient@@QBEHXZ @ 39 NONAME ; int RImagePrintClient::CancelPrintJob(void) const - ?GetPrinterCapabilityIDs@RImagePrintClient@@QBEHHAAV?$RArray@H@@@Z @ 40 NONAME ; int RImagePrintClient::GetPrinterCapabilityIDs(int, class RArray &) const - ?NewL@CDiscoveryGuard@@SAPAV1@AAVRImagePrintClient@@@Z @ 41 NONAME ; class CDiscoveryGuard * CDiscoveryGuard::NewL(class RImagePrintClient &) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/eabi/imageprintclientu.def --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/eabi/imageprintclientu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -EXPORTS - _ZN10CIdleGuard4NewLER17RImagePrintClient @ 1 NONAME - _ZN10CIdleGuard5GuardEP13MIdleObserver @ 2 NONAME - _ZN10CIdleGuardD0Ev @ 3 NONAME - _ZN10CIdleGuardD1Ev @ 4 NONAME - _ZN10CIdleGuardD2Ev @ 5 NONAME - _ZN15CDiscoveryGuard4NewLER17RImagePrintClient @ 6 NONAME - _ZN15CDiscoveryGuard5GuardER25MPrinterDiscoveryObserverj @ 7 NONAME - _ZN15CDiscoveryGuardD0Ev @ 8 NONAME - _ZN15CDiscoveryGuardD1Ev @ 9 NONAME - _ZN15CDiscoveryGuardD2Ev @ 10 NONAME - _ZN17RImagePrintClient14StartDiscoveryER19TDiscoveryGuardDatajR14TRequestStatus @ 11 NONAME - _ZN17RImagePrintClient17ContinueCreateJobER13TJobGuardDataR14TRequestStatus @ 12 NONAME - _ZN17RImagePrintClient17ContinueDiscoveryER19TDiscoveryGuardDataR14TRequestStatus @ 13 NONAME - _ZN17RImagePrintClient20RegisterIdleObserverER14TIdleGuardDataR14TRequestStatus @ 14 NONAME - _ZN17RImagePrintClient5CloseEv @ 15 NONAME - _ZN17RImagePrintClient8ConnectLEv @ 16 NONAME - _ZN17RImagePrintClient9CreateJobEiR13TJobGuardDataR13RPointerArrayI7TDesC16ER14TRequestStatus @ 17 NONAME - _ZN17RImagePrintClientC1Ev @ 18 NONAME - _ZN17RImagePrintClientC2Ev @ 19 NONAME - _ZN9CJobGuard4NewLER17RImagePrintClient @ 20 NONAME - _ZN9CJobGuard5GuardEiR13RPointerArrayI7TDesC16ER19MPrintEventObserver @ 21 NONAME - _ZN9CJobGuardD0Ev @ 22 NONAME - _ZN9CJobGuardD1Ev @ 23 NONAME - _ZN9CJobGuardD2Ev @ 24 NONAME - _ZNK17RImagePrintClient12GetJobStatusEv @ 25 NONAME - _ZNK17RImagePrintClient13GetJobSettingEiRi @ 26 NONAME - _ZNK17RImagePrintClient13ReleaseEngineEv @ 27 NONAME - _ZNK17RImagePrintClient13ReserveEngineEv @ 28 NONAME - _ZNK17RImagePrintClient13SetForegroundEi @ 29 NONAME - _ZNK17RImagePrintClient13SetJobSettingEiiRi @ 30 NONAME - _ZNK17RImagePrintClient14CancelPrintJobEv @ 31 NONAME - _ZNK17RImagePrintClient14SubmitPrintJobEv @ 32 NONAME - _ZNK17RImagePrintClient15CancelCreateJobEv @ 33 NONAME - _ZNK17RImagePrintClient15CancelDiscoveryEv @ 34 NONAME - _ZNK17RImagePrintClient16ContinuePrintJobEv @ 35 NONAME - _ZNK17RImagePrintClient16CountConnectionsERi @ 36 NONAME - _ZNK17RImagePrintClient16GetNumPrintPagesEv @ 37 NONAME - _ZNK17RImagePrintClient16GetPrinterStatusEi @ 38 NONAME - _ZNK17RImagePrintClient16IsPictBridgeModeEv @ 39 NONAME - _ZNK17RImagePrintClient17SetNumberOfCopiesERK6RArrayIiE @ 40 NONAME - _ZNK17RImagePrintClient18GetJobTemplateIconEiRi @ 41 NONAME - _ZNK17RImagePrintClient18GetNumPreviewPagesEv @ 42 NONAME - _ZNK17RImagePrintClient18SupportedProtocolsEv @ 43 NONAME - _ZNK17RImagePrintClient19RemoveCachedPrinterEi @ 44 NONAME - _ZNK17RImagePrintClient20CancelStartDiscoveryEv @ 45 NONAME - _ZNK17RImagePrintClient20GetPrinterCapabilityEiiR16TPrintCapability @ 46 NONAME - _ZNK17RImagePrintClient23GetPrinterCapabilityIDsEiR6RArrayIiE @ 47 NONAME - _ZNK17RImagePrintClient26CancelRegisterIdleObserverEv @ 48 NONAME - _ZTI10CIdleGuard @ 49 NONAME ; ## - _ZTI15CDiscoveryGuard @ 50 NONAME ; ## - _ZTI9CJobGuard @ 51 NONAME ; ## - _ZTV10CIdleGuard @ 52 NONAME ; ## - _ZTV15CDiscoveryGuard @ 53 NONAME ; ## - _ZTV9CJobGuard @ 54 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/group/bld.inf --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004-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 - -PRJ_EXPORTS - -../rom/imageprintserver.iby CORE_APP_LAYER_IBY_EXPORT_PATH( imageprintserver.iby ) - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES -imageprintserver.mmp -imageprintclient.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/group/imageprintclient.mmp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/group/imageprintclient.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "../../inc/logdef.h" - -deffile imageprintclient.def - -TARGET imageprintclient.dll -TARGETTYPE dll -CAPABILITY CAP_CLIENT_DLL -UID 0x1000008D 0x101FFAA5 - -APP_LAYER_SYSTEMINCLUDE - -USERINCLUDE . ../inc -USERINCLUDE ../src/client -USERINCLUDE ../src/server -USERINCLUDE ../../ImagePrintLibrary/inc -USERINCLUDE ../../inc -USERINCLUDE ../../../clog/inc - -SOURCEPATH ../src/client - -SOURCE rimageprintclient.cpp -SOURCE cidleguard.cpp -SOURCE cdiscoveryguard.cpp -SOURCE cjobguard.cpp - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/group/imageprintserver.mmp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/group/imageprintserver.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "../../inc/logdef.h" -#include "../inc/imageprintserveruid.h" - -TARGET imageprintserver.exe -TARGETTYPE exe -CAPABILITY CAP_SERVER - -UID 0x1000008D KIMAGEPRINTSERVERUID3 -EPOCSTACKSIZE 0x4000 -EPOCHEAPSIZE 0x1000 0x1000000 - -APP_LAYER_SYSTEMINCLUDE - -USERINCLUDE . ../inc ../src/server ../src/client -USERINCLUDE ../../ImagePrintLibrary/inc -USERINCLUDE ../../inc -USERINCLUDE ../../../clog/inc - -SOURCEPATH ../src/server - -SOURCE main.cpp -SOURCE cimageprintserver.cpp -SOURCE cimageprintsession.cpp -SOURCE cprotocolsloader.cpp -SOURCE cimageprintbody.cpp -SOURCE crsimageparser.cpp -SOURCE cserveridleguard.cpp -SOURCE cserverdiscoveryguard.cpp -SOURCE cserverjobguard.cpp -SOURCE cimageprintscheduler.cpp -SOURCE cnumofcopies.cpp -SOURCE tmessagewrp2.cpp - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY fbscli.lib -LIBRARY ecom.lib -LIBRARY centralrepository.lib -LIBRARY usbman.lib -LIBRARY usbwatcher.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cdiscoveryguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cdiscoveryguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2004-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 CDISCOVERYGUARD_H -#define CDISCOVERYGUARD_H - -#include - -class RImagePrintClient; -class MPrinterDiscoveryObserver; -class TDiscoveryGuardData; - -class CDiscoveryGuard : public CActive - { - public: - - /** - * 2-phase constructor - * - * @param aClient client for communication with server process - * @return new object - */ - IMPORT_C static CDiscoveryGuard* NewL( RImagePrintClient& aClient ); - - /** - * Destructor - */ - IMPORT_C ~CDiscoveryGuard(); - - public: - - /** - * Start printer discovery (and watching for discovery events) - * for one or several protocols - * - * @param aObserver observer for notifications about discovery events - * @param aProtocols OR:ed protocol ids - * @return error code - */ - IMPORT_C TInt Guard( MPrinterDiscoveryObserver& aObserver, TUint aProtocols ); - - private: - - CDiscoveryGuard( RImagePrintClient& aClient ); - void ConstructL(); - - private: // from CActive - - void RunL(); - void DoCancel(); - - private: // data - - RImagePrintClient& iClient; - MPrinterDiscoveryObserver* iObserver; - TDiscoveryGuardData* iData; - }; - - -#endif // CDISCOVERYGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cidleguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cidleguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2004-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 CIDLEGUARD_H -#define CIDLEGUARD_H - -#include - -class RImagePrintClient; -class MIdleObserver; -class TIdleGuardData; - -class CIdleGuard : public CActive - { - public: - - /** - * 2-phase constructor - * - * @param aClient client for communication with server process - * @return new object - */ - IMPORT_C static CIdleGuard* NewL( RImagePrintClient& aClient ); - - /** - * Destructor - */ - IMPORT_C ~CIdleGuard(); - - public: - - /** - * Start watching for idle events - * - * @param aObserver observer for notifications about idle events - */ - IMPORT_C void Guard( MIdleObserver* aObserver ); - - private: - - CIdleGuard( RImagePrintClient& aClient ); - void ConstructL(); - - private: // from CActive - - void RunL(); - void DoCancel(); - - private: // data - - RImagePrintClient& iClient; - MIdleObserver* iObserver; - TIdleGuardData* iData; - }; - - -#endif // CIDLEGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintbody.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintbody.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CImagePrintBody class definition. -* -*/ - - -#ifndef CIMAGEPRINTBODY_H -#define CIMAGEPRINTBODY_H - -#include - -#include "imageprint.h" -#include "cprotocolsloader.h" -#include "cimageprintscheduler.h" -#include "mprotprintingdevice.h" - -/** - * - * This class is in charge of discoverying devices across the protocols available, of creating - * a print job in the right printer and right protocol, etc. It can be considered a controller. - * Implements the MProtPrintingDevice observers (MProtDiscoveryObserver, MProtPrintEventObserver) so it can act - * accordingly when the protocols report or need something. - */ -class CImagePrintBody : public CBase, public MProtDiscoveryObserver, public MProtPrintEventObserver, public MProtIdleObserver - { - public: - - /** - * 2-phase constructor - * - * @return new object - */ - static CImagePrintBody* NewL(); - - /** - * Destructor - */ - ~CImagePrintBody(); - - /** - * Start discovery for one or several protocols - * - * @param aObserver observer for notifications about discovery events - * @param aProtocols OR:ed protocol ids - * @return error code - */ - TInt StartDiscovery(MPrinterDiscoveryObserver& aObserver, TUint aProtocols = 0); - - /** - * Cancel discovery - */ - void CancelDiscovery(); - - /** - * Creates print job - * - * @param aPrinterID printer id - * @param aImages array of image file names to be printed - * @param aObserver observer for notifications about print job events - * @return error code - */ - TInt CreatePrintJobL(TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver); - - /** - * Start actual printing of previously created print job - */ - void SubmitPrintJobL(); - - /** - * Cancel print job - * - * @return error code - */ - TInt CancelPrintJob(); - - /** - * Continue print job - * - * @return error code - */ - TInt ContinuePrintJobL(); - - /** - * Print pages amount getter - * - * @return amount of print pages with current settings for current print job - */ - TInt GetNumPrintPages(); - - /** - * Job status getter - * - * @return job status code - */ - TInt GetJobStatus(); - - /** - * Printer status getter - * - * @param aPrinterID printer id - * @return printer status code - */ - TInt GetPrinterStatus(TInt aPrinterID); - - /** - * Printer capability id getter - * - * @param aPrinterID printer id - * @param aCapabilityIDs place holder for capability ids supported by printer - * @return error code - */ - TInt GetPrinterCapabilityIDsL(TInt aPrinterID, RArray& aCapabilityIDs); - - /** - * Printer capability getter - * - * @param aPrinterID printer id - * @param aCapabilityID capability id - * @param aCapability place holder for capability - * @return error code - */ - TInt GetPrinterCapabilityL(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability); - - /** - * Printer setting getter - * - * @param aCapabilityID capability id - * @param aValue place holder for capability value - * @return error code - */ - TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); - - /** - * Printer setting setter - * - * @param aCapabilityID capability id - * @param aValue capability value - * @param aAffectedCapability affected capability id - * @return error code - */ - TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); - - /** - * Preview pages amount getter for current protocol - * - * @return preview pages amount - */ - TInt GetNumPreviewPages(); - - /** - * Template icon getter - * - * @param aTemplateID template id - * @param aFbsBitmapHandle place holder for template bitmap handle - * @return error code - */ - TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFbsBitmapHandle); - - /** - *Creates a preview image - * - * @param aPageNumber Page number to create preview image of - * @return error code - */ - TInt CreatePreviewImage(TInt aPageNumber); - - /** - * Remove cached printer - * - * @param aPrinterID printer id - * @return error code - */ - TInt RemoveCachedPrinterL(TInt aPrinterID); - - /** - * Supported protocols getter - * - * @return OR:ed protocol ids - */ - TUint SupportedProtocols(); - - /** - * Register observer for idle events receiving - * - * @param aObserver observer - */ - void RegisterIdleObserver(MIdleObserver* aObserver); - - /** - * Number of copies setter for current print job - * - * @param aNumsOfCopies number of copies array - * @param aErr place holder for error code - */ - void SetNumsOfCopiesL(const RArray& aNumsOfCopies, TInt& aErr); - - /** - * Handle session disconnection - * - * @param aIdleObserver idle observer object of that session - * @param aDiscoveryObserver discovery observer object of that session - * @param aEventObserver print job observer object of that session - */ - void HandleSessionDisconnect( const MIdleObserver* aIdleObserver, - const MPrinterDiscoveryObserver* aDiscoveryObserver, - const MPrintEventObserver* aEventObserver ); - - private: // from MProtDiscoveryObserver - void FoundDeviceL(TPrinter& aDeviceInfo); - void DiscoveryStatusL(TInt aStatus, TInt aErrorCode, TInt aErrorStringCode); - void RemoveDeviceL(TPrinter& aDeviceInfo); - - private: // from MProtPrintEventObserver - void PrintJobProgressEvent(TInt aStatus, TInt aPercent, TInt aJobStateCode); - void PrintJobErrorEvent(TInt aErrorCode, TInt aErrorStringCode); - void PrinterStatusEvent(TInt aErrorCode, TInt aErrorStringCode); - void PreviewImageEvent(TInt aFsBitmapHandle); - void ShowMessageL(TInt aMsgLine1Code, TInt aMsgLine2Code); - TBool AskYesNoQuestionL(TInt aMsgLine1Code, TInt aMsgLine2Code); - const TDesC& AskForInputL(TInt aMsgLine1Code, TInt aMsgLine2Code); - - private: // from MProtIdleObserver - void StatusEvent(const TEvent &aEvent, TInt aError, TInt aMsgCode); - - private: - CImagePrintBody(); - void ConstructL(); - TInt FindInternalDeviceReference(TInt aExternalDeviceID, TInt& aInternalDeviceID, MProtPrintingDevice*& aProtToUse); - TInt ValidateImagesL(const RPointerArray& aImageList, TInt &aInvalidCount); - CImagePrintScheduler& ActiveScheduler() const; - void TryNextDiscovery(); - static TInt TryNextDiscoveryL(TAny* aObj); - void DoTryNextDiscoveryL(); - - private: - /// Class loader and manager. - CProtocolsLoader* iClassLoader; - /// Pointer to store the current protocol in use for discovery. - MProtPrintingDevice* iCurrentProtocol; - /// Pointer to store the current protocol in use for creating a print job. - MProtPrintingDevice* iCurrentPrintJobProtocol; - /// ImagePrint Observer. - MPrinterDiscoveryObserver* iPrinterDiscoveryObserver; - /// ImagePrint Observer. - MPrintEventObserver* iPrinterPrintEventObserver; - /// ImagePrint Idle Observer. - MIdleObserver* iPrinterIdleObserver; - /// Used to store the requested protocols. - TUint iProtocolsRequested; - /// Array of the image filenames to print. - RPointerArray iImageFileNames; - /// Enables async discovery - CIdle* iIdleDiscovery; - - TBool iDiscoveryCancelled; - }; - -#endif // CIMAGEPRINTBODY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintscheduler.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintscheduler.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTSCHEDULER_H -#define CIMAGEPRINTSCHEDULER_H - -#include - -class MProtIdleObserver; - -class CImagePrintScheduler : public CActiveScheduler - { - public: // from CActiveScheduler - void Error(TInt aError) const; - public: - - /** - * Idle observer setter. Asynchronous errors (leaves) will be - * propagated to this observer - * - * @param aIdleObserver idle observer - */ - void SetIdleObserver( MProtIdleObserver& aIdleObserver ); - - /** - * Current protocol id setter - * - * @param aProtocol current protocol id - */ - void SetCurrentProtocol( TInt aProtocol ); - - private: - MProtIdleObserver* iIdleObserver; - TInt iCurrentProtocol; - }; - - -#endif // CIMAGEPRINTSCHEDULER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintserver.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTSERVER_H -#define CIMAGEPRINTSERVER_H - -#include -#include - -class CImagePrintBody; - -// ---------------------------------------------------------------------------------------- -// Server's policy here -// ---------------------------------------------------------------------------------------- - -// Total number of ranges -const TUint KImagePrintRangeCount = 2; - -// Definition of the ranges of IPC numbers -const TInt KImagePrintRanges[KImagePrintRangeCount] = - { - 0, // implemented 0-38 - 39 // non implemented function end of range check ; ENotSupported - }; - -// Policy to implement for each of the above ranges -const TUint8 KImagePrintElementsIndex[KImagePrintRangeCount] = - { - CPolicyServer::EAlwaysPass, // applies to 0th range - CPolicyServer::ENotSupported // applies to 1st range (out of range IPC) - }; - -// Package all the above together into a policy -const CPolicyServer::TPolicy KImagePrintPolicy = - { - CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass - KImagePrintRangeCount, // number of ranges - KImagePrintRanges, // ranges array - KImagePrintElementsIndex, // elements<->ranges index - NULL, // array of elements - }; -class CImagePrintServer : public CPolicyServer - { - public: - - /** - * 2-phase constructor - * - * @return new object. The object is left on the cleanup stack - */ - static CImagePrintServer* NewLC(); - - /** - * Destructor - */ - ~CImagePrintServer(); - - /** - * Increase session counter - */ - void AddSession(); - - /** - * Decrease session counter. If the counter is decreased to 0, the - * server is shut down - */ - void RemoveSession(); - - /** - * Session count getter - * - * @return session count - */ - TInt SessionCount() const; - - /** - * Reserve printing engine to the session - * - * @param aSession session that claims the printing engine - * @return error code - */ - TInt ReserveEngine( const CSession2* aSession ); - - /** - * Release printing engine by the session - * - * @param aSession session that wants to release the printing engine - * @return error code - */ - TInt ReleaseEngine( const CSession2* aSession ); - - /** - * Printing engine getter - * - * @return printing engine - */ - CImagePrintBody& Engine() const; - - private: - - TInt RunError( TInt aError ); - CImagePrintServer(); - void ConstructL(); - CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; - - private: - - TInt iConnsCount; - - const CSession2* iEngineHolder; - - CImagePrintBody* iEngine; - - RFbsSession iFbs; - }; - - -#endif // CIMAGEPRINTSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintsession.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cimageprintsession.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTSESSION_H -#define CIMAGEPRINTSESSION_H - -#include - -#include "tprintcapability.h" -#include "tmessagewrp2.h" - -class CImagePrintServer; -class CServerIdleGuard; -class CServerDiscoveryGuard; -class CServerJobGuard; -class CNumOfCopies; - - -class CImagePrintSession : public CSession2 - { - public: // from CSession2 - void CreateL(); - - private: - ~CImagePrintSession(); - CImagePrintServer& Server(); - void ServiceL( const RMessage2& aMessage ); - void Disconnect(const RMessage2 &aMessage); - - private: - void ServiceFirstPartL( TInt aIndex ); - void ServiceSecondPartL( TInt aIndex ); - void ServiceThirdPartL ( TInt aIndex ); - void CountConnectionsL( TMessageWrp2& aMessage ); - void SetForegroundL( TMessageWrp2& aMessage ); - void ReserveEngine( TMessageWrp2& aMessage ); - void ReleaseEngine( TMessageWrp2& aMessage ); - void SupportedProtocols( TMessageWrp2& aMessage ); - void GetNumPrintPages( TMessageWrp2& aMessage ); - void GetJobStatus( TMessageWrp2& aMessage ); - void GetPrinterStatus( TMessageWrp2& aMessage ); - void CancelDiscovery( TMessageWrp2& aMessage ); - void SubmitPrintJobL( TMessageWrp2& aMessage ); - void CancelPrintJob( TMessageWrp2& aMessage ); - void ContinuePrintJobL( TMessageWrp2& aMessage ); - void RemoveCachedPrinterL( TMessageWrp2& aMessage ); - void GetJobTemplateIconL( TMessageWrp2& aMessage ); - void GetNumPreviewPages( TMessageWrp2& aMessage ); - void SetJobSettingL( TMessageWrp2& aMessage ); - void GetJobSettingL( TMessageWrp2& aMessage ); - void GetPrinterCapabilityL( TMessageWrp2& aMessage ); - void GetPrinterCapIdL( TMessageWrp2& aMessage ); - void GetPrinterCapTypeL( TMessageWrp2& aMessage ); - void GetPrinterCapDefL( TMessageWrp2& aMessage ); - void GetPrinterCapLowL( TMessageWrp2& aMessage ); - void GetPrinterCapHighL( TMessageWrp2& aMessage ); - void GetPrinterCapEnumCountL( TMessageWrp2& aMessage ); - void GetPrinterCapEnumL( TMessageWrp2& aMessage ); - void GetPrinterCapabilityIDsCountL( TMessageWrp2& aMessage ); - void GetPrinterCapabilityIDL( TMessageWrp2& aMessage ); - void RegisterIdleObserverL( TMessageWrp2& aMessage ); - void CancelRegisterIdleObserverL( TMessageWrp2& aMessage ); - void StartDiscoveryL( TMessageWrp2& aMessage ); - void ContinueDiscoveryL( TMessageWrp2& aMessage ); - void PrepareJobL( TMessageWrp2& aMessage ); - void CreateJobL( TMessageWrp2& aMessage ); - void ContinueCreateJobL( TMessageWrp2& aMessage ); - void CancelStartDiscoveryL( TMessageWrp2& aMessage ); - void CancelCreateJobL( TMessageWrp2& aMessage ); - void IsPictBridgeModeL( TMessageWrp2& aMessage ); - void SetNumberOfCopiesCountL( TMessageWrp2& aMessage ); - void SetNumberOfCopiesL( TMessageWrp2& aMessage ); - - private: // data - - RPointerArray iMsgWrappers; - RArray iCapabilityIDs; - CServerIdleGuard* iIdleGuard; - CServerDiscoveryGuard* iDiscoveryGuard; - CServerJobGuard* iJobGuard; - TPrintCapability iCapability; - CNumOfCopies* iNumOfCopies; - TBool iConnected; - }; - - -#endif // CIMAGEPRINTSESSION_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cjobguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cjobguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2004-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 CJOBGUARD_H -#define CJOBGUARD_H - -#include - -class RImagePrintClient; -class MPrintEventObserver; -class TJobGuardData; - -class CJobGuard : public CActive - { - public: - - /** - * 2-phase constructor - * - * @param aClient client for communication with server process - * @return new object - */ - IMPORT_C static CJobGuard* NewL( RImagePrintClient& aClient ); - - /** - * Destructor - */ - IMPORT_C ~CJobGuard(); - - public: - - /** - * Create print job and start watching for print job events - * - * @param aPrinterID printer id - * @param aImages array of image file names to be printed - * @param aObserver observer for notifications about print job events - * @return error code - */ - IMPORT_C TInt Guard( TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver ); - - private: - - CJobGuard( RImagePrintClient& aClient ); - void ConstructL(); - - private: // from CActive - - void RunL(); - void DoCancel(); - - private: // data - - RImagePrintClient& iClient; - MPrintEventObserver* iObserver; - TJobGuardData* iData; - }; - - -#endif // CJOBGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cnumofcopies.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cnumofcopies.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2004-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 CNUMOFCOPIES_H -#define CNUMOFCOPIES_H - -#include - -class CNumOfCopies : public CBase - { - public: - - /** - * 2-phase constructor - * - * @return new object - */ - static CNumOfCopies* NewL(); - - /** - * Destructor - */ - ~CNumOfCopies(); - - private: - CNumOfCopies(); - void ConstructL(); - - public: - - /** - * Set the amount of coming array elements - * - * @param aCount amount of coming array elements - */ - void Reset( TInt aCount ); - - /** - * Append next element to the array - * - * @param aNumOfCopies number of copies array element - * @param aFull place holder for value which indicates that - * all elements are added to the array - */ - void AddNumOfCopyL( TInt aNumOfCopies, TBool& aFull ); - - /** - * Number of copies array getter - * - * @return number of copies array - */ - const RArray& NumsOfCopies() const; - - private: // data - TInt iCount; - RArray iNumsOfCopies; - }; - - -#endif // CNUMOFCOPIES_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cprotocolsloader.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cprotocolsloader.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CProtocolsLoader class definition. -* -*/ - - -#ifndef CPROTOCOLSLOADER_H -#define CPROTOCOLSLOADER_H - -#include - -class MProtPrintingDevice; - -class CProtocolsLoader : public CBase - { - public: - - static CProtocolsLoader* NewL(); - ~CProtocolsLoader(); - - /** - * Gets the number of protocol implementations that could be loaded. - * @return Number of protocols available. - */ - TInt GetNumberOfProtocolsAvailable() const; - - /** - * Gets the next protocol in the internal list of protocols. - * - * Returns a pointer to the next protocol in the list. If the end of the list is reached, it starts the list over. - * The order in which protocols will be returned is: DPOF, BPP, PictBridge, any other protocols (sorted alpha- - * betically). This pointer should not be deleted. - * @return Pointer to the next protocol instance. - */ - MProtPrintingDevice* GetNextProtocol(); - - /** - * Gets the protocol located in the position specified. - * @param aIndex Index of the desired protocol. If there are 3 protocols, the valid indexes are: 0, 1, 2. - * @return Pointer to the next protocol instance. This pointer should not be deleted. - */ - MProtPrintingDevice* GetProtocolAt(TInt aIndex); - - /** - * Resets the inner pointers to the beginning of the protocols' list. - */ - void Reset(); - - /** - * Returns the index of the current protocol - */ - TInt GetProtocolIndex() const; - - /** - * @brief Returns the Protocols supported by the DLL. It can be any of the KImagePrint_PrinterProtocol* constants. - * @return An OR'ed value with the supported protocols information. - */ - TUint SupportedProtocols() const; - - private: - - CProtocolsLoader(); - void ConstructL(); - void LoadL(); - static void CleanupProt( TAny* aData ); - - private: // data - - /// Used to store the number of protocols loaded and available for use. - TInt iAvailableProtocols; - - /// Index of the next protocol available. - TInt iProtIndex; - - /// Pointer array used to store the reference to the protocols. - RPointerArray iProtocols; - - /// OR'ed value with the supported protocols information. - TUint iSupportedProtocols; - }; - -#endif // CPROTOCOLSLOADER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/crsimageparser.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/crsimageparser.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsImageParser class definition. -* -*/ - - -#ifndef CRSIMAGEPARSER_H -#define CRSIMAGEPARSER_H - -#include -#include - -class CRsImageParser : public CBase - { - public: - enum TImageEncoding - { - EUnknown = 0, - ENonDiffHuffmanBaseline = 0xc0, - ENonDiffHuffmanExtendedSeq, - ENonDiffHuffmanProgressive, - ENonDiffHuffmanLossless, - EUnused1, - EDiffHuffmanSequential, - EDiffHuffmanProgressive, - EDiffHuffmanLossless, - EReserved, - ENonDiffArithExtendedSeq, - ENonDiffArithProgressive, - ENonDiffArithLossless, - EUnused2, - EDiffArithSequential, - EDiffArithProgressive, - EDiffArithLossless - }; - - /** - * 2-phase constructor - * - * @return new object. The object is left on the cleanup stack - */ - static CRsImageParser* NewLC(); - - /** - * Destructor - */ - ~CRsImageParser(); - - /** - * JPEG image validator - * - * @param aFileName image file name - * @param aValid place holder for validity indicator - * @param aErr place holder for error code - */ - void ValidateL( const TDesC& aFileName, TBool& aValid, TInt& aErr ); - - private: - - CRsImageParser(); - void ConstructL(); - TBool Validate( TInt aStartOfDataOffset, TInt aWidth, TInt aHeight, TInt aSize, TInt aEncoding, TInt aErr ); - TInt ReadData( RFile& aFile, TInt aStartByte, TDes8& aData ); - - private: - - RFs iFs; - }; - -#endif // CRSIMAGEPARSER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserverdiscoveryguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserverdiscoveryguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2004-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 CSERVERDISCOVERYGUARD_H -#define CSERVERDISCOVERYGUARD_H - -#include - -#include "imageprint.h" -#include "tdiscoveryguarddata.h" - -class CImagePrintBody; -class TMessageWrp2; - -class CServerDiscoveryGuard : public CBase, public MPrinterDiscoveryObserver - { - public: - - /** - * 2-phase constructor - * - * @param aEngine printing engine - * @return new object - */ - static CServerDiscoveryGuard* NewL( CImagePrintBody& aEngine ); - - /** - * Destructor - */ - ~CServerDiscoveryGuard(); - - private: // from MPrinterDiscoveryObserver - - void FoundPrinterL(const TPrinter& aPrinterInfo); - void DiscoveryStatusL(TInt aStatus, TInt aErrorCode, TInt aErrorStringCode); - void RemovePrinterL(const TPrinter& aPrinterInfo); - - public: - - /** - * Start discovery and set this object as discovery events observer - * - * @param aMessage message contains OR:ed protocol ids - */ - TInt StartL( TMessageWrp2& aMessage ); - - /** - * Continue waiting for discovery events - * - * @param aMessage message completed upon event arrival - */ - void ContinueL( TMessageWrp2& aMessage ); - - /** - * Stop waiting for discovery events. Cancel waiting message - */ - void Stop(); - - private: - - CServerDiscoveryGuard( CImagePrintBody& aEngine ); - void ConstructL(); - void ProcessL(); - - private: // data - - CImagePrintBody& iEngine; - TMessageWrp2* iMessage; - RArray iBuffer; - TBool iRequestActive; - }; - - -#endif // CSERVERDISCOVERYGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserveridleguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserveridleguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2004-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 CSERVERIDLEGUARD_H -#define CSERVERIDLEGUARD_H - -#include - -#include "imageprint.h" -#include "tidleguarddata.h" - -class TEvent; -class CImagePrintBody; -class TMessageWrp2; - -class CServerIdleGuard : public CBase, public MIdleObserver - { - public: - - /** - * 2-phase constructor - * - * @param aEngine printing engine - * @return new object - */ - static CServerIdleGuard* NewL( CImagePrintBody& aEngine ); - - /** - * Destructor - */ - ~CServerIdleGuard(); - - private: // from MIdleObserver - - void StatusEvent(const TEvent &aEvent, TInt aError, TInt aMsgCode); - - public: - - /** - * Start and continue waiting for idle events - * - * @param aMessage message completed upon event arrival - */ - void Guard( TMessageWrp2& aMessage ); - - /** - * Stop waiting for idle events. Cancel waiting message - */ - void Stop(); - - private: - - CServerIdleGuard( CImagePrintBody& aEngine ); - void ConstructL(); - void DoStatusEventL( const TEvent &aEvent, TInt aError, TInt aMsgCode ); - void Process( TInt aErr = KErrNone ); - void DoProcessL(); - - private: // data - - CImagePrintBody& iEngine; - TMessageWrp2* iMessage; - RArray iBuffer; - TBool iRequestActive; - }; - - -#endif // CSERVERIDLEGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserverjobguard.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserverjobguard.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2004-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 CSERVERJOBGUARD_H -#define CSERVERJOBGUARD_H - -#include - -#include "imageprint.h" -#include "tjobguarddata.h" - -class CImagePrintBody; -class TMessageWrp2; - -class CServerJobGuard : public CBase, public MPrintEventObserver - { - public: - - /** - * 2-phase constructor - * - * @param aEngine printing engine - * @return new object - */ - static CServerJobGuard* NewL( CImagePrintBody& aEngine ); - - /** - * Destructor - */ - ~CServerJobGuard(); - - private: // from MPrintEventObserver - - void PrintJobProgressEvent(TInt aStatus, TInt aPercentCompletion, TInt aJobStateCode); - void PrintJobErrorEvent(TInt aError, TInt aErrorStringCode); - void PrinterStatusEvent(TInt aError, TInt aErrorStringCode); - void PreviewImageEvent(TInt aFsBitmapHandle); - void ShowMessageL(TInt aMsgLine1Code, TInt aMsgLine2Code); - TBool AskYesNoQuestionL(TInt aMsgLine1Code, TInt aMsgLine2Code); - const TDesC& AskForInputL(TInt aMsgLine1Code, TInt aMsgLine2Code); - - public: - - /** - * Prepare print job by copying image file name into internal buffer - * - * @param aMessage message contains file name of one image. - */ - void PrepareL( TMessageWrp2& aMessage ); - - /** - * Create print job and set this object as print job events observer - * - * @param aMessage message contains printer id - */ - TInt CreateL( TMessageWrp2& aMessage ); - - /** - * Continue waiting for print job events - * - * @param aMessage message completed upon event arrival - */ - void ContinueCreateL( TMessageWrp2& aMessage ); - - /** - * Stop waiting for print job events. Cancel waiting message - */ - void Stop(); - - private: - - CServerJobGuard( CImagePrintBody& aEngine ); - void ConstructL(); - void Process( TInt aErr = KErrNone ); - void DoProcessL(); - void DoPreProcessL( const TJobGuardData& aData ); - - private: // data - - CImagePrintBody& iEngine; - TMessageWrp2* iMessage; - RArray iBuffer; - RPointerArray iImages; - TBool iRequestActive; - }; - - -#endif // CSERVERJOBGUARD_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/imageprintclientserver.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/imageprintclientserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTCLIENTSERVER_H -#define IMAGEPRINTCLIENTSERVER_H - -#include - -#include "imageprintserveruid.h" - -_LIT( KImagePrintServerName, "imageprintserver" ); -_LIT( KImagePrintServerImg, "imageprintserver" ); // EXE name - -const TInt KMaxImagePrintMessage = 512; -const TInt KImagePrintServerMajor = 0; -const TInt KImagePrintServerMinor = 0; -const TInt KImagePrintServerBuild = 0; - -enum TImagePrintMessages - { - ECountConnections = 0, - ESetForeground, - EReserveEngine, - EReleaseEngine, - ESupportedProtocols, - EGetNumPrintPages, - EGetJobStatus, - EGetPrinterStatus, - ECancelDiscovery, - ESubmitPrintJob, - ECancelPrintJob, // 10 - EContinuePrintJob, - ERemoveCachedPrinter, - EGetJobTemplateIcon, - EGetNumPreviewPages, - ESetJobSetting, - EGetJobSetting, - EGetPrinterCapability, - EGetPrinterCapId, - EGetPrinterCapType, - EGetPrinterCapDef, // 20 - EGetPrinterCapLow, - EGetPrinterCapHigh, - EGetPrinterCapEnumCount, - EGetPrinterCapEnum, - EGetPrinterCapabilityIDsCount, - EGetPrinterCapabilityID, - ERegisterIdleObserver, - ECancelRegisterIdleObserver, - EStartDiscovery, - EContinueDiscovery, // 30 - EPrepareJob, - ECreateJob, - EContinueCreateJob, - ECancelStartDiscovery, - ECancelCreateJob, - EIsPictBridgeMode, - ESetNumberOfCopiesCount, - ESetNumberOfCopies // 38 - }; - -#endif// IMAGEPRINTCLIENTSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/imageprintserveruid.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/imageprintserveruid.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTSERVERUID_H -#define IMAGEPRINTSERVERUID_H - -// Image Print Server UID3 - -#define KIMAGEPRINTSERVERUID3 0x101FFAA4 - -#endif // IMAGEPRINTSERVERUID_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/rimageprintclient.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/rimageprintclient.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -/* -* Copyright (c) 2004-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 RIMAGEPRINTCLIENT_H -#define RIMAGEPRINTCLIENT_H - -#include - -class TPrintCapability; -class TIdleGuardData; -class TDiscoveryGuardData; -class TJobGuardData; - -class RImagePrintClient : public RSessionBase - { - public: - - /** - * Constructor - */ - IMPORT_C RImagePrintClient(); - - /** - * Connect to the ImagePrint server - * - * @return KErrNone if successful, otherwise another of the system-wide error codes - */ - IMPORT_C TInt ConnectL(); - - /** - * Close the session - */ - IMPORT_C void Close(); - - /** - * Count connections to the server ( all clients in all prosesses ) - * - * @param aConnections holder for connnections count - * @return KErrNone if successful, otherwise another of the system-wide error codes - */ - IMPORT_C TInt CountConnections( TInt& aConnections ) const; - - /** - * Inform server about foreground/background state of the client - * - * @param aFg foreground/background flag - * @return KErrNone if successful, otherwise another of the system-wide error codes - */ - IMPORT_C TInt SetForeground( TInt aFg ) const; - - - /** - * Reserves ImagePrint engine for this client - * - * @return KErrNone if successful, KErrInUse if used by another client - */ - IMPORT_C TInt ReserveEngine() const; - - /** - * Releases ImagePrint engine - * - * @return KErrNone if successful, KErrInUse if used by another client - */ - IMPORT_C TInt ReleaseEngine() const; - - /** - * Get protocols supported by ImagePrint engine - * - * @return OR:ed protocols or KErrInUse if used by another client - */ - IMPORT_C TInt SupportedProtocols() const; - - /** - * Gets the number of pages to be printed - * - * @return Number of pages to print or KErrInUse if used by another client - */ - IMPORT_C TInt GetNumPrintPages() const; - - /** - * Gets the status of the printing job created - * - * @return Printing job status or KErrInUse if used by another client - */ - IMPORT_C TInt GetJobStatus() const; - - /** - * Gets the status of the printer - * - * @param aPrinterID The exposed ID of the printer the client wants to know about. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt GetPrinterStatus( TInt aPrinterID ) const; - - /** - * Cancel discovery - * - * @return KErrNone or KErrInUse if used by another client - */ - IMPORT_C TInt CancelDiscovery() const; - - /** - * Submits a print job already created. The actual job execution is asynchronous so this - * function returns immediately. If successful, notification of job status and job - * completion is received by the client through the MPrintEventObserver. - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt SubmitPrintJob() const; - - /** - * Cancels the print job. This is an asynchronous command. MPrintEventObserver::PrintJobProgressEvent - * will be called with the status of TPrintJobProgressEventStatus::EDone when the cancellation - * is completed. The notification can potentially be received by the client before - * this command returns to the client. - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt CancelPrintJob() const; - - /** - * Continues printing and / or submitting a print job. - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt ContinuePrintJob() const; - - /** - * Removes a specified cached printer. - * - * @param aPrinterID The exposed ID of the printer the client wants to remove. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt RemoveCachedPrinter( TInt aPrinterID ) const; - - /** - * Gets the icon representing a given layout or template. - * - * @param aTemplateID ID of the template / layout of interest. - * @param aFbsBitmapHandle Handle to the appropriate bitmap. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt GetJobTemplateIcon( TInt aTemplateID, TInt& aFbsBitmapHandle ) const; - - /** - * Gets the number of pages in the preview. - * - * @return Number of pages in the preview. - */ - IMPORT_C TInt GetNumPreviewPages() const; - - /** - * Sets a print job setting. - * - * @param aCapabilityID ID of the capability of interest. - * @param aValue New capability value. - * @param aAffectedCapability ID of any affected capability. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt SetJobSetting( TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability ) const; - - /** - * Gets a setting configured for the created print job. - * - * @param aCapabilityID ID of the capability of interest. - * @param aValue Capability value. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt GetJobSetting( TInt aCapabilityID, TInt& aValue ) const; - - /** - * Gets the detail of a certain capability of a certain printer. - * - * @param aPrinterID The exposed ID of the printer the client wants to know about. - * @param aCapabilityID ID of the capability of interest. - * @param aCapability Capability information. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt GetPrinterCapability(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability) const; - - /** - * Gets the IDs of the capabilities supported by the printer specified. - * - * @param aPrinterID The exposed ID of the printer the client wants to know about. - * @param aCapabilityIDs Array containing the ID's of the capabilities of the specified printer. - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt GetPrinterCapabilityIDs( TInt aPrinterID, RArray& aCapabilityIDs ) const; - - /** - * Registers the IdleObserver to send idle event notifications. Asynchronous function. - * - * @param aData place holder for idle event. On function completion contains idle event data. - * @param aStatus request status - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt RegisterIdleObserver( TIdleGuardData& aData, TRequestStatus& aStatus ); - - /** - * Cancel registering idle observer - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt CancelRegisterIdleObserver() const; - - /** - * Start discovery and set request for discovery event. Asynchronous function. - * - * @param aData place holder for discovery event. On function completion contains discovery event data. - * @param aProtocols OR:ed protocol ids - * @param aStatus request status - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt StartDiscovery( TDiscoveryGuardData& aData, TUint aProtocols, TRequestStatus& aStatus ); - - /** - * Set next request for discovery event. Asynchronous function. - * - * @param aData place holder for discovery event. On function completion contains discovery event data. - * @param aStatus request status - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt ContinueDiscovery( TDiscoveryGuardData& aData, TRequestStatus& aStatus ); - - /** - * Create print job and set request for print job event. Asynchronous function. - * - * @param aPrinterID printer id - * @param aData place holder for print job event. On function completion contains print job event data. - * @param aImages array of image file names - * @param aStatus request status - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt CreateJob( TInt aPrinterID, TJobGuardData& aData, RPointerArray& aImages, TRequestStatus& aStatus ); - - /** - * Set next request for print job event. Asynchronous function. - * - * @param aData place holder for print job event. On function completion contains print job event data. - * @param aStatus request status - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt ContinueCreateJob( TJobGuardData& aData, TRequestStatus& aStatus ); - - /** - * Cancel starting discovery - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt CancelStartDiscovery() const; - - /** - * Cancel creating print job - * - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt CancelCreateJob() const; - - /** - * PictBridge USB mode checker - * - * @return TInt value more than 0, if PictBridge USB mode is on; 0 if off; negative value if error - */ - IMPORT_C TInt IsPictBridgeMode() const; - - /** - * Set number of copies - * - * @param aArray array of number of copies elements. Each array element corresponds to the array - * of image file names of created print job - * @return Any standard Symbian error code or error codes [ KErrInvalidSequence (-50) / KErrInvalidData (-51) ]. - */ - IMPORT_C TInt SetNumberOfCopies( const RArray& aArray ) const; - - public: - - /** - * Version getter - * - * @return version of the client - */ - TVersion Version() const; - - private: - - TPtr8 iDicsoveryDataPtr; - TPtr8 iIdleDataPtr; - TPtr8 iJobDataPtr; - TPrintCapability* iCapability; - }; - - -#endif // RIMAGEPRINTCLIENT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tdiscoveryguarddata.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tdiscoveryguarddata.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2004-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 TDISCOVERYGUARDDATA_H -#define TDISCOVERYGUARDDATA_H - -#include - -#include "tprinter.h" - -class TDiscoveryGuardData - { - public: - - enum TCallbackNum - { - EFoundCb = 0, - EStatusCb, - ERemoveCb - }; - - public: - - TPrinter iPrinterInfo; - TInt iStatus; - TInt iErrorCode; - TInt iErrorStringCode; - TCallbackNum iCb; - }; - -#endif // TDISCOVERYGUARDDATA_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tidleguarddata.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tidleguarddata.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2004-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 TIDLEGUARDDATA_H -#define TIDLEGUARDDATA_H - -#include - -#include "tidleevent.h" - -class TIdleGuardData - { - public: - - TEvent iEvent; - TInt iError; - TInt iMsgCode; - }; - -#endif // TIDLEGUARDDATA_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tjobguarddata.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tjobguarddata.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2004-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 TJOBGUARDDATA_H -#define TJOBGUARDDATA_H - -#include - -class TJobGuardData - { - public: - - enum TCallbackNum - { - EProgressEventCb = 0, - EErrorEventCb, - EStatusEventCb, - EImageEventCb - }; - - public: - - TInt iStatus; - TInt iPercentCompletion; - TInt iJobStateCode; - TInt iError; - TInt iErrorStringCode; - TInt iFsBitmapHandle; - TCallbackNum iCb; - }; - -#endif // TJOBGUARDDATA_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tmessagewrp2.h --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/inc/tmessagewrp2.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2004-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 TMESSAGEWRP2_H -#define TMESSAGEWRP2_H - -#include - -class TMessageWrp2 - { - public: - - /** - * Message wrapper constructor - * - * @param aMessage message to be wrapped - * @param aConnected session connection flag - */ - TMessageWrp2( const RMessage2& aMessage, const TBool& aConnected ); - - public: - - /** - * If session connected, write descriptor to the wrapped message - * - * @param aParam message parameter id - * @param aDes descriptor - * @param aOffset offset from the start of the client's descriptor - */ - void WriteL(TInt aParam, const TDesC8 &aDes, TInt aOffset=0) const; - - /** - * If session connected, complete the wrapped message - * - * @param aReason completion code - */ - void Complete(TInt aReason) const; - - /** - * If session connected, gets the 1st message argument as an integer value - * - * @return 1st message argument as an integer value - */ - TInt Int0() const; - - /** - * If session connected, gets the 2nd message argument as an integer value - * - * @return 2nd message argument as an integer value - */ - TInt Int1() const; - - /** - * If session connected, gets the length of a descriptor argument - * in the client's process - * - * @param aParam index value identifying the argument - * @return the length of the descriptor or error code - */ - TInt GetDesLength(TInt aParam) const; - - /** - * If session connected, read data from the specified offset within - * the 8-bit descriptor argument, into the specified target descriptor - * - * @param aParam message parameter id - * @param aDes target descriptor - * @param aOffset offset from the start of the client's descriptor - */ - void ReadL(TInt aParam, TDes8 &aDes, TInt aOffset=0) const; - - /** - * If session connected, read data from the specified offset within - * the 16-bit descriptor argument, into the specified target descriptor - * - * @param aParam message parameter id - * @param aDes target descriptor - * @param aOffset offset from the start of the client's descriptor - */ - void ReadL(TInt aParam, TDes16 &aDes, TInt aOffset=0) const; - - /** - * Panic the client thread - * - * @param aCategory category descriptor - * @param aReason reason id - */ - void Panic(const TDesC &aCategory, TInt aReason) const; - - /** - * Gets the the number of the function requested by the client - * - * @return the function number - */ - TInt Function() const; - - /** - * Sets the disposable state. Disposable means that the message needs not - * to be preserved - * - * @param aDisposable disposable flag - */ - void SetDisposable( TBool aDisposable ); - - /** - * Gets the disposable state - * - * @return the disposable flag - */ - TBool Disposable() const; - - private: // data - RMessage2 iMessage; - const TBool& iConnected; - TBool iDisposable; - }; - - -#endif // TMESSAGEWRP2_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/rom/imageprintserver.iby --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/rom/imageprintserver.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTSERVER_IBY -#define IMAGEPRINTSERVER_IBY - -#include - -file=ABI_DIR\IP_DIR\imageprintserver.exe PROGRAMS_DIR\imageprintserver.exe -file=ABI_DIR\IP_DIR\imageprintclient.dll SHARED_LIB_DIR\imageprintclient.dll - -#endif // IMAGEPRINTSERVER_IBY \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cdiscoveryguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cdiscoveryguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2004-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 "cdiscoveryguard.h" -#include "rimageprintclient.h" -#include "imageprint.h" -#include "tdiscoveryguarddata.h" - -EXPORT_C CDiscoveryGuard* CDiscoveryGuard::NewL( RImagePrintClient& aClient ) - { - CDiscoveryGuard* self = new ( ELeave ) CDiscoveryGuard( aClient ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CDiscoveryGuard::CDiscoveryGuard( RImagePrintClient& aClient ) : - CActive( CActive::EPriorityStandard ), - iClient( aClient ) - { - CActiveScheduler::Add( this ); - } - -EXPORT_C CDiscoveryGuard::~CDiscoveryGuard() - { - Cancel(); - delete iData; - } - -void CDiscoveryGuard::ConstructL() - { - iData = new (ELeave) TDiscoveryGuardData; - } - -EXPORT_C TInt CDiscoveryGuard::Guard( MPrinterDiscoveryObserver& aObserver, TUint aProtocols ) - { - Cancel(); - iObserver = &aObserver; - TInt err = iClient.StartDiscovery( *iData, aProtocols, iStatus ); - if( !err ) - { - SetActive(); - } - return err; - } - -void CDiscoveryGuard::RunL() - { - if( iStatus == KErrNone && iObserver ) - { - switch( iData->iCb ) - { - case TDiscoveryGuardData::EFoundCb: - iObserver->FoundPrinterL( iData->iPrinterInfo ); - break; - case TDiscoveryGuardData::EStatusCb: - iObserver->DiscoveryStatusL( iData->iStatus, iData->iErrorCode, iData->iErrorStringCode ); - break; - case TDiscoveryGuardData::ERemoveCb: - iObserver->RemovePrinterL( iData->iPrinterInfo ); - break; - default: - break; - } - - iClient.ContinueDiscovery( *iData, iStatus ); - SetActive(); - } - } - -void CDiscoveryGuard::DoCancel() - { - iClient.CancelStartDiscovery(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cidleguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cidleguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2004-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 "cidleguard.h" -#include "rimageprintclient.h" -#include "imageprint.h" -#include "tidleguarddata.h" -#include "clog.h" - -EXPORT_C CIdleGuard* CIdleGuard::NewL( RImagePrintClient& aClient ) - { - CIdleGuard* self = new ( ELeave ) CIdleGuard( aClient ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CIdleGuard::CIdleGuard( RImagePrintClient& aClient ) : - CActive( CActive::EPriorityStandard ), - iClient( aClient ) - { - CActiveScheduler::Add( this ); - } - -EXPORT_C CIdleGuard::~CIdleGuard() - { - Cancel(); - delete iData; - } - -void CIdleGuard::ConstructL() - { - iData = new (ELeave) TIdleGuardData; - } - -EXPORT_C void CIdleGuard::Guard( MIdleObserver* aObserver ) - { - Cancel(); - iObserver = aObserver; - iClient.RegisterIdleObserver( *iData, iStatus ); - SetActive(); - } - -void CIdleGuard::RunL() - { - LOG1("CIdleGuard::RunL iStatus.Int(): %d", iStatus.Int()); - LOG1("CIdleGuard::RunL iData->iEvent.iProtocol: %d", iData->iEvent.iProtocol); - LOG1("CIdleGuard::RunL iData->iEvent.iSeverity: %d", iData->iEvent.iSeverity); - LOG1("CIdleGuard::RunL iData->iEvent.iEventType: %d", iData->iEvent.iEventType); - LOG1("CIdleGuard::RunL iData->iError: %d", iData->iError); - LOG1("CIdleGuard::RunL iData->iMsgCode: %d", iData->iMsgCode); - if( iStatus == KErrNone && iObserver ) - { - iObserver->StatusEvent( iData->iEvent, iData->iError, iData->iMsgCode ); - iClient.RegisterIdleObserver( *iData, iStatus ); - SetActive(); - } - } - -void CIdleGuard::DoCancel() - { - iClient.CancelRegisterIdleObserver(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cjobguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/cjobguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2004-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 "cjobguard.h" -#include "rimageprintclient.h" -#include "imageprint.h" -#include "clog.h" -#include "tjobguarddata.h" - -EXPORT_C CJobGuard* CJobGuard::NewL( RImagePrintClient& aClient ) - { - CJobGuard* self = new ( ELeave ) CJobGuard( aClient ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CJobGuard::CJobGuard( RImagePrintClient& aClient ) : - CActive( CActive::EPriorityHigh ), - iClient( aClient ) - { - CActiveScheduler::Add( this ); - } - -EXPORT_C CJobGuard::~CJobGuard() - { - Cancel(); - delete iData; - } - -void CJobGuard::ConstructL() - { - iData = new (ELeave) TJobGuardData; - } - -EXPORT_C TInt CJobGuard::Guard( TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver ) - { - LOG1("CJobGuard::Guard begin with aPrinterID: %d", aPrinterID); - Cancel(); - iObserver = &aObserver; - TInt err = iClient.CreateJob( aPrinterID, *iData, aImages, iStatus ); - if( !err ) - { - SetActive(); - } - LOG1("CJobGuard::Guard end with err: %d", err); - return err; - } - -void CJobGuard::RunL() - { - LOG1("CJobGuard::RunL begin with iStatus.Int(): %d", iStatus.Int()); - if( iStatus == KErrNone && iObserver ) - { - switch( iData->iCb ) - { - case TJobGuardData::EProgressEventCb: - LOG("CJobGuard::RunL TJobGuardData::EProgressEventCb"); - LOG1("CJobGuard::RunL iData->iStatus: %d", iData->iStatus); - LOG1("CJobGuard::RunL iData->iPercentCompletion: %d", iData->iPercentCompletion); - LOG1("CJobGuard::RunL iData->iJobStateCode: %d", iData->iJobStateCode); - iObserver->PrintJobProgressEvent( iData->iStatus, iData->iPercentCompletion, iData->iJobStateCode ); - break; - case TJobGuardData::EErrorEventCb: - LOG("CJobGuard::RunL TJobGuardData::EErrorEventCb"); - LOG1("CJobGuard::RunL iData->iError: %d", iData->iError); - LOG1("CJobGuard::RunL iData->iErrorStringCode: %d", iData->iErrorStringCode); - iObserver->PrintJobErrorEvent( iData->iError, iData->iErrorStringCode ); - break; - case TJobGuardData::EStatusEventCb: - LOG("CJobGuard::RunL TJobGuardData::EStatusEventCb"); - LOG1("CJobGuard::RunL iData->iError: %d", iData->iError); - LOG1("CJobGuard::RunL iData->iErrorStringCode: %d", iData->iErrorStringCode); - iObserver->PrintJobErrorEvent( iData->iError, iData->iErrorStringCode ); - break; - case TJobGuardData::EImageEventCb: - LOG("CJobGuard::RunL TJobGuardData::EImageEventCb"); - LOG1("CJobGuard::RunL iData->iFsBitmapHandle: %d", iData->iFsBitmapHandle); - iObserver->PreviewImageEvent( iData->iFsBitmapHandle ); - break; - default: - break; - } - - iClient.ContinueCreateJob( *iData, iStatus ); - SetActive(); - } - LOG("CJobGuard::RunL end"); - } - -void CJobGuard::DoCancel() - { - iClient.CancelCreateJob(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/rimageprintclient.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/client/rimageprintclient.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,554 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "rimageprintclient.h" -#include "imageprintclientserver.h" -#include "tprintcapability.h" -#include "clog.h" -#include "tidleguarddata.h" -#include "tdiscoveryguarddata.h" -#include "tjobguarddata.h" - -namespace - { - // Server startup code - TInt StartServer() - { - // EPOC and EKA2 is easy, we just create a new server process. Simultaneous - // launching of two such processes should be detected when the second one - // attempts to create the server object, failing with KErrAlreadyExists. - RProcess server; - TInt r = server.Create( KImagePrintServerImg, KNullDesC ); - - if( r != KErrNone ) - return r; - TRequestStatus stat; - server.Rendezvous(stat); - if (stat!=KRequestPending) - server.Kill(0); // abort startup - else - server.Resume(); // logon OK - start the server - User::WaitForRequest(stat); // wait for start or death - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); - - server.Close(); - return r; - } - } - -TVersion RImagePrintClient::Version() const - { - return TVersion( KImagePrintServerMajor, KImagePrintServerMinor, KImagePrintServerBuild ); - } - -EXPORT_C RImagePrintClient::RImagePrintClient() : RSessionBase(), - iDicsoveryDataPtr(NULL, 0, 0), - iIdleDataPtr(NULL, 0, 0), - iJobDataPtr(NULL, 0, 0) - { - iCapability = NULL; - } - -EXPORT_C TInt RImagePrintClient::ConnectL() - { - LOG1("RImagePrintClient::Connect Handle(): %d", Handle()); - // check against double-connect - if( Handle() != KNullHandle ) return KErrAlreadyExists; - - iCapability = new (ELeave) TPrintCapability(); - if( ! iCapability ) return KErrNoMemory; - - TInt retry = 2; - for (;;) - { - LOG1("RImagePrintClient::Connect retry: %d", retry); - TInt r = CreateSession( KImagePrintServerName, Version() ); - LOG1("RImagePrintClient::Connect r after CreateSession: %d", r); - - if( r != KErrNotFound && r!= KErrServerTerminated ) - return r; - if( --retry == 0 ) - return r; - r = StartServer(); - LOG1("RImagePrintClient::Connect r after StartServer: %d", r); - if( r != KErrNone && r != KErrAlreadyExists ) - return r; - } - } - -EXPORT_C void RImagePrintClient::Close() - { - LOG("RImagePrintClient::Close begin"); - if( iCapability ) - { - delete iCapability; - iCapability = NULL; - } - RSessionBase::Close(); - LOG("RImagePrintClient::Close end"); - } - -EXPORT_C TInt RImagePrintClient::CountConnections( TInt& aConnections ) const - { - TPckg connsBuf( aConnections ); - return SendReceive( ECountConnections, TIpcArgs( &connsBuf ) ); - } - -EXPORT_C TInt RImagePrintClient::SetForeground( TInt aFg ) const - { - return SendReceive( ESetForeground, TIpcArgs( aFg ) ); - } - -EXPORT_C TInt RImagePrintClient::ReserveEngine() const - { - return SendReceive( EReserveEngine ); - } - -EXPORT_C TInt RImagePrintClient::ReleaseEngine() const - { - return SendReceive( EReleaseEngine ); - } - -EXPORT_C TInt RImagePrintClient::SupportedProtocols() const - { - LOG("RImagePrintClient::SupportedProtocols ESupportedProtocols"); - TInt prots = SendReceive( ESupportedProtocols ); - LOG1("RImagePrintClient::SupportedProtocols end with: %d", prots); - return prots; - } - -EXPORT_C TInt RImagePrintClient::GetNumPrintPages() const - { - LOG("RImagePrintClient::GetNumPrintPages EGetNumPrintPages"); - TInt pages = SendReceive( EGetNumPrintPages ); - LOG1("RImagePrintClient::GetNumPrintPages end with: %d", pages); - return pages; - } - -EXPORT_C TInt RImagePrintClient::GetJobStatus() const - { - LOG("RImagePrintClient::GetJobStatus EGetJobStatus"); - TInt status = SendReceive( EGetJobStatus ); - LOG1("RImagePrintClient::GetJobStatus end with: %d", status); - return status; - } - -EXPORT_C TInt RImagePrintClient::GetPrinterStatus( TInt aPrinterID ) const - { - LOG1("RImagePrintClient::GetPrinterStatus EGetPrinterStatus aPrinterID: %d", aPrinterID); - TInt status = SendReceive( EGetPrinterStatus, TIpcArgs( aPrinterID ) ); - LOG1("RImagePrintClient::GetPrinterStatus end with: %d", status); - return status; - } - -EXPORT_C TInt RImagePrintClient::CancelDiscovery() const - { - LOG("RImagePrintClient::CancelDiscovery ECancelDiscovery"); - TInt err = SendReceive( ECancelDiscovery ); - LOG1("RImagePrintClient::CancelDiscovery end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::SubmitPrintJob() const - { - LOG("RImagePrintClient::SubmitPrintJob ESubmitPrintJob"); - TInt err = SendReceive( ESubmitPrintJob ); - LOG1("RImagePrintClient::SubmitPrintJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::CancelPrintJob() const - { - LOG("RImagePrintClient::CancelPrintJob ECancelPrintJob"); - TInt err = SendReceive( ECancelPrintJob ); - LOG1("RImagePrintClient::CancelPrintJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::ContinuePrintJob() const - { - LOG("RImagePrintClient::ContinuePrintJob EContinuePrintJob"); - TInt err = SendReceive( EContinuePrintJob ); - LOG1("RImagePrintClient::ContinuePrintJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::RemoveCachedPrinter( TInt aPrinterID ) const - { - LOG1("RImagePrintClient::RemoveCachedPrinter ERemoveCachedPrinter aPrinterID: %d", aPrinterID); - TInt err = SendReceive( ERemoveCachedPrinter, TIpcArgs( aPrinterID ) ); - LOG1("RImagePrintClient::RemoveCachedPrinter end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::GetJobTemplateIcon( TInt aTemplateID, TInt& aFbsBitmapHandle ) const - { - TPckg handleBuf( aFbsBitmapHandle ); - LOG1("RImagePrintClient::GetJobTemplateIcon EGetJobTemplateIcon aTemplateID: %d", aTemplateID); - TInt err = SendReceive( EGetJobTemplateIcon, TIpcArgs( aTemplateID, &handleBuf ) ); - LOG1("RImagePrintClient::GetJobTemplateIcon aFbsBitmapHandle: %d", aFbsBitmapHandle); - LOG1("RImagePrintClient::GetJobTemplateIcon end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::GetNumPreviewPages() const - { - LOG("RImagePrintClient::GetNumPreviewPages EGetNumPreviewPages"); - TInt pages = SendReceive( EGetNumPreviewPages ); - LOG1("RImagePrintClient::GetNumPreviewPages end with: %d", pages); - return pages; - } - -EXPORT_C TInt RImagePrintClient::SetJobSetting( TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability ) const - { - TPckg capBuf( aAffectedCapability ); - LOG1("RImagePrintClient::SetJobSetting ESetJobSetting aCapabilityID: %d", aCapabilityID); - LOG1("RImagePrintClient::SetJobSetting ESetJobSetting aValue: %d", aValue); - TInt err = SendReceive( ESetJobSetting, TIpcArgs( aCapabilityID, aValue, &capBuf ) ); - LOG1("RImagePrintClient::SetJobSetting aAffectedCapability: %d", aAffectedCapability); - LOG1("RImagePrintClient::SetJobSetting end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::GetJobSetting( TInt aCapabilityID, TInt& aValue ) const - { - TPckg valueBuf( aValue ); - LOG1("RImagePrintClient::GetJobSetting EGetJobSetting aCapabilityID: %d", aCapabilityID); - TInt err = SendReceive( EGetJobSetting, TIpcArgs( aCapabilityID, &valueBuf ) ); - LOG1("RImagePrintClient::GetJobSetting aValue: %d", aValue); - LOG1("RImagePrintClient::GetJobSetting end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::GetPrinterCapability(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability) const - { - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapability aPrinterID: %d", aPrinterID); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapability aCapabilityID: %d", aCapabilityID); - TInt err = SendReceive( EGetPrinterCapability, TIpcArgs( aPrinterID, aCapabilityID ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapability err: %d", err); - - if( !err ) - { - TInt capId; - TPckg capIdBuf( capId ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapId"); - err = SendReceive( EGetPrinterCapId, TIpcArgs( &capIdBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapId err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapId capId: %d", capId); - if( !err ) - { - iCapability->iCapabilityID = capId; - } - } - - if( !err ) - { - TInt type; - TPckg typeBuf( type ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapType"); - err = SendReceive( EGetPrinterCapType, TIpcArgs( &typeBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapType err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapType type: %d", type); - if( !err ) - { - iCapability->iType = static_cast(type); - } - } - - if( !err ) - { - TInt def; - TPckg defBuf( def ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapDef"); - err = SendReceive( EGetPrinterCapDef, TIpcArgs( &defBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapDef err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapDef def: %d", def); - if( !err ) - { - iCapability->iDefaultValue = def; - } - } - - if( !err ) - { - TInt low; - TPckg lowBuf( low ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapLow"); - err = SendReceive( EGetPrinterCapLow, TIpcArgs( &lowBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapLow err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapLow low: %d", low); - if( !err ) - { - iCapability->iLow = low; - } - } - - if( !err ) - { - TInt high; - TPckg highBuf( high ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapHigh"); - err = SendReceive( EGetPrinterCapHigh, TIpcArgs( &highBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapHigh err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapHigh high: %d", high); - if( !err ) - { - iCapability->iHigh = high; - } - } - - if( !err ) - { - TInt count; - TPckg countBuf( count ); - LOG("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnumCount"); - err = SendReceive( EGetPrinterCapEnumCount, TIpcArgs( &countBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnumCount err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnumCount count: %d", count); - - if( !err ) - { - iCapability->iEnumCount = count; - for( TInt i = 0; i < count && ! err; i++ ) - { - TInt value; - TPckg valueBuf( value ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnum i: %d",i); - TInt err = SendReceive( EGetPrinterCapEnum, TIpcArgs( i, &valueBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnum err: %d", err); - LOG1("RImagePrintClient::GetPrinterCapability EGetPrinterCapEnum value: %d", value); - - if( !err ) - { - iCapability->iEnumCodes[i] = value; - } - } - } - } - - if( !err ) - { - aCapability = *iCapability; - } - - LOG1("RImagePrintClient::GetPrinterCapability end with: %d", err); - return err; - } - - -EXPORT_C TInt RImagePrintClient::GetPrinterCapabilityIDs( TInt aPrinterID, RArray& aCapabilityIDs ) const - { - TInt count; - TPckg countBuf( count ); - - LOG1("RImagePrintClient::GetPrinterCapabilityIDs EGetPrinterCapabilityIDsCount aPrinterID: %d", aPrinterID); - TInt err = SendReceive( EGetPrinterCapabilityIDsCount, TIpcArgs( aPrinterID, &countBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapabilityIDs EGetPrinterCapabilityIDsCount err: %d", err); - if( !err ) - { - LOG1("RImagePrintClient::GetPrinterCapabilityIDs EGetPrinterCapabilityIDsCount count: %d", count); - for( TInt i = 0; i < count && !err; i++ ) - { - TInt capability; - TPckg capBuf( capability ); - LOG1("RImagePrintClient::GetPrinterCapabilityIDs EGetPrinterCapabilityID i: %d", i); - err = SendReceive( EGetPrinterCapabilityID, TIpcArgs( i, &capBuf ) ); - LOG1("RImagePrintClient::GetPrinterCapabilityIDs EGetPrinterCapabilityID err: %d", err); - if( !err ) - { - LOG1("RImagePrintClient::GetPrinterCapabilityIDs capability id: %d", capability); - err = aCapabilityIDs.Append( capability ); - LOG1("RImagePrintClient::GetPrinterCapabilityIDs append err: %d", err); - } - } - } - - LOG1("RImagePrintClient::GetPrinterCapabilityIDs end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::RegisterIdleObserver( TIdleGuardData& aData, TRequestStatus& aStatus ) - { - LOG("RImagePrintClient::RegisterIdleObserver EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::RegisterIdleObserver EReserveEngine err: %d", err); - if( !err ) - { - LOG("RImagePrintClient::RegisterIdleObserver ERegisterIdleObserver"); - iIdleDataPtr.Set(reinterpret_cast(&aData), sizeof(aData), sizeof(aData)); - SendReceive( ERegisterIdleObserver, TIpcArgs( &iIdleDataPtr ), aStatus ); - } - LOG1("RImagePrintClient::RegisterIdleObserver end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::CancelRegisterIdleObserver() const - { - LOG("RImagePrintClient::CancelRegisterIdleObserver ECancelRegisterIdleObserver"); - TInt err = SendReceive( EReleaseEngine ); - LOG1("RImagePrintClient::RegisterIdleObserver EReleaseEngine err: %d", err); - - err = SendReceive( ECancelRegisterIdleObserver ); - LOG1("RImagePrintClient::RegisterIdleObserver ECancelRegisterIdleObserver err: %d", err); - - LOG1("RImagePrintClient::CancelRegisterIdleObserver end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::StartDiscovery( TDiscoveryGuardData& aData, TUint aProtocols, TRequestStatus& aStatus ) - { - LOG("RImagePrintClient::StartDiscovery EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::StartDiscovery EReserveEngine err: %d", err); - if( !err ) - { - LOG1("RImagePrintClient::StartDiscovery EStartDiscovery aProtocols: %d", aProtocols); - err = SendReceive( EStartDiscovery, TIpcArgs( aProtocols ) ); - LOG1("RImagePrintClient::StartDiscovery EStartDiscovery err: %d", err); - } - if( !err ) - { - LOG("RImagePrintClient::StartDiscovery EContinueDiscovery"); - iDicsoveryDataPtr.Set(reinterpret_cast(&aData), sizeof(aData), sizeof(aData)); - SendReceive( EContinueDiscovery, TIpcArgs( &iDicsoveryDataPtr ), aStatus ); - } - LOG1("RImagePrintClient::StartDiscovery end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::ContinueDiscovery( TDiscoveryGuardData& aData, TRequestStatus& aStatus ) - { - LOG("RImagePrintClient::ContinueDiscovery EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::ContinueDiscovery EReserveEngine err: %d", err); - if( !err ) - { - LOG("RImagePrintClient::ContinueDiscovery EContinueDiscovery"); - iDicsoveryDataPtr.Set(reinterpret_cast(&aData), sizeof(aData), sizeof(aData)); - SendReceive( EContinueDiscovery, TIpcArgs( &iDicsoveryDataPtr ), aStatus ); - } - LOG1("RImagePrintClient::ContinueDiscovery end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::CreateJob( TInt aPrinterID, TJobGuardData& aData, RPointerArray& aImages, TRequestStatus& aStatus ) - { - LOG("RImagePrintClient::CreateJob EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::CreateJob EReserveEngine err: %d", err); - if( !err ) - { - TInt count = aImages.Count(); - LOG1("RImagePrintClient::CreateJob aImages.Count(): %d", aImages.Count()); - for( TInt i = 0; i < count && !err; i++ ) - { - LOG("RImagePrintClient::CreateJob EPrepareJob"); - err = SendReceive( EPrepareJob, TIpcArgs( aImages[i] ) ); - LOG1("RImagePrintClient::CreateJob EPrepareJob err: %d", err); - } - } - if( !err ) - { - LOG("RImagePrintClient::CreateJob ECreateJob"); - err = SendReceive( ECreateJob, TIpcArgs( aPrinterID ) ); - LOG1("RImagePrintClient::CreateJob ECreateJob err: %d", err); - } - if( !err ) - { - LOG("RImagePrintClient::CreateJob EContinueCreateJob"); - iJobDataPtr.Set(reinterpret_cast(&aData), sizeof(aData), sizeof(aData)); - SendReceive( EContinueCreateJob, TIpcArgs( &iJobDataPtr ), aStatus ); - } - LOG1("RImagePrintClient::CreateJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::ContinueCreateJob( TJobGuardData& aData, TRequestStatus& aStatus ) - { - LOG("RImagePrintClient::ContinueCreateJob EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::ContinueCreateJob EReserveEngine err: %d", err); - if( !err ) - { - LOG("RImagePrintClient::ContinueCreateJob EContinueCreateJob"); - iJobDataPtr.Set(reinterpret_cast(&aData), sizeof(aData), sizeof(aData)); - SendReceive( EContinueCreateJob, TIpcArgs( &iJobDataPtr ), aStatus ); - } - LOG1("RImagePrintClient::ContinueCreateJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::CancelStartDiscovery() const - { - LOG("RImagePrintClient::CancelStartDiscovery ECancelStartDiscovery"); - TInt err = SendReceive( ECancelStartDiscovery ); - LOG1("RImagePrintClient::CancelStartDiscovery end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::CancelCreateJob() const - { - LOG("RImagePrintClient::CancelCreateJob ECancelCreateJob"); - TInt err = SendReceive( ECancelCreateJob ); - LOG1("RImagePrintClient::CancelCreateJob end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::IsPictBridgeMode() const - { - LOG("RImagePrintClient::IsPictBridgeMode EIsPictBridgeMode"); -#ifdef __WINS__ - TInt err( KErrNotFound ); -#else - TInt err = SendReceive( EIsPictBridgeMode ); -#endif - LOG1("RImagePrintClient::IsPictBridgeMode end with: %d", err); - return err; - } - -EXPORT_C TInt RImagePrintClient::SetNumberOfCopies( const RArray& aArray ) const - { - LOG("RImagePrintClient::SetNumberOfCopies EReserveEngine"); - TInt err = SendReceive( EReserveEngine ); - LOG1("RImagePrintClient::SetNumberOfCopies EReserveEngine err: %d", err); - if( !err ) - { - TInt count = aArray.Count(); - LOG1("RImagePrintClient::SetNumberOfCopies count: %d", count); - LOG("RImagePrintClient::SetNumberOfCopies ESetNumberOfCopiesCount"); - err = SendReceive( ESetNumberOfCopiesCount, TIpcArgs( count ) ); - LOG1("RImagePrintClient::SetNumberOfCopies ESetNumberOfCopiesCount err: %d", err); - for( TInt i = 0; i < count && !err; i++ ) - { - LOG1("RImagePrintClient::SetNumberOfCopies i: %d", i); - LOG("RImagePrintClient::SetNumberOfCopies ESetNumberOfCopies"); - err = SendReceive( ESetNumberOfCopies, TIpcArgs( aArray[i] ) ); - LOG1("RImagePrintClient::SetNumberOfCopies ESetNumberOfCopies err: %d", err); - } - } - LOG1("RImagePrintClient::SetNumberOfCopies end with: %d", err); - return err; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintbody.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintbody.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,691 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CImagePrintBody class definition. -* -*/ - - -#include - -#include "cimageprintbody.h" -#include "crsimageparser.h" -#include "clog.h" - -CImagePrintBody* CImagePrintBody::NewL() - { - CImagePrintBody* self = new (ELeave) CImagePrintBody(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CImagePrintBody::~CImagePrintBody() - { - LOG("CImagePrintBody::~CImagePrintBody begin"); - delete iClassLoader; - iImageFileNames.ResetAndDestroy(); - delete iIdleDiscovery; - LOG("CImagePrintBody::~CImagePrintBody end"); - } - -TInt CImagePrintBody::StartDiscovery(MPrinterDiscoveryObserver& aObserver, TUint aProtocols) - { - LOG1("CImagePrintBody::StartDiscovery aProtocols: %d", aProtocols); - iPrinterDiscoveryObserver = &aObserver; - - if( iCurrentProtocol ) - { - iCurrentProtocol->CancelDiscovery( EFalse ); - } - - iCurrentProtocol = NULL; - iClassLoader->Reset(); - iProtocolsRequested = aProtocols; - iDiscoveryCancelled = EFalse; - TryNextDiscovery(); - - LOG("CImagePrintBody::StartDiscovery end"); - return KErrNone; - } - -void CImagePrintBody::CancelDiscovery() - { - LOG("CImagePrintBody::CancelDiscovery begin"); - iDiscoveryCancelled = ETrue; - if( iCurrentProtocol ) - { - iCurrentProtocol->CancelDiscovery(); - } - LOG("CImagePrintBody::CancelDiscovery end"); - } - - -TInt CImagePrintBody::CreatePrintJobL(TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver) - { - LOG("CImagePrintBody::CreatePrintJobL begin"); - iPrinterPrintEventObserver = &aObserver; - iCurrentPrintJobProtocol = NULL; - - if( iCurrentProtocol ) - { - iCurrentProtocol->CancelDiscovery( EFalse ); - } - - TInt DeviceID; - TInt err = FindInternalDeviceReference( aPrinterID, DeviceID, iCurrentPrintJobProtocol ); - if( !err ) - { - TInt count = aImages.Count(); - if( count ) - { - iImageFileNames.ResetAndDestroy(); - for( TInt i = 0; i < count; ++i ) - { - HBufC* fileName = aImages[i]->AllocLC(); - iImageFileNames.AppendL( fileName ); - CleanupStack::Pop(); // fileName - } - - ActiveScheduler().SetCurrentProtocol( iCurrentPrintJobProtocol->SupportedProtocols() ); - err = iCurrentPrintJobProtocol->CreatePrintJobL( DeviceID, aImages, *this ); - } - else - { - err = KErrInvalidData; - } - } - - LOG1("CImagePrintBody::CreatePrintJobL return: %d", err); - return err; - } - - -void CImagePrintBody::SubmitPrintJobL() - { - LOG1("CImagePrintBody::SubmitPrintJobL iCurrentPrintJobProtocol: %d", iCurrentPrintJobProtocol); - TInt err( KErrNone ); - - if( !iCurrentPrintJobProtocol ) - { - err = KErrInvalidSequence; - } - if( !err ) - { - TInt invalidImages; - err = ValidateImagesL( iImageFileNames, invalidImages ); - LOG1("CImagePrintBody::SubmitPrintJobL ValidateImagesL returns: %d", err); - } - - User::LeaveIfError( err ); - - iCurrentPrintJobProtocol->SubmitPrintJobL(); - - LOG("CImagePrintBody::SubmitPrintJobL end"); - } - - -TInt CImagePrintBody::CancelPrintJob() - { - LOG("CImagePrintBody::CancelPrintJob begin"); - TInt err( KErrNone ); - if( !iCurrentPrintJobProtocol ) - { - err = KErrInvalidSequence; - } - if( !err ) - { - err = iCurrentPrintJobProtocol->CancelPrintJob(); - } - LOG1("CImagePrintBody::CancelPrintJob return: %d", err); - return err; - } - - -TInt CImagePrintBody::ContinuePrintJobL() - { - LOG("CImagePrintBody::ContinuePrintJobL begin"); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->ContinuePrintJobL(); - } - LOG1("CImagePrintBody::ContinuePrintJobL return: %d", err); - return err; - } - - -TInt CImagePrintBody::GetNumPrintPages() - { - LOG("CImagePrintBody::GetNumPrintPages begin"); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->GetNumPrintPages(); - } - LOG1("CImagePrintBody::GetNumPrintPages return: %d", err); - return err; - } - -TInt CImagePrintBody::GetJobStatus() - { - LOG("CImagePrintBody::GetJobStatus begin"); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->GetPrintJobStatus(); - } - LOG1("CImagePrintBody::GetJobStatus return: %d", err); - return err; - } - -TInt CImagePrintBody::GetPrinterStatus(TInt aPrinterID) - { - LOG1("CImagePrintBody::GetPrinterStatus aPrinterID: %d", aPrinterID); - TInt DeviceID; - MProtPrintingDevice* theProtToQuery = NULL; - TInt err = FindInternalDeviceReference( aPrinterID, DeviceID, theProtToQuery ); - if( !err ) - { - err = theProtToQuery->GetPrinterStatus( DeviceID ); - } - LOG1("CImagePrintBody::GetPrinterStatus return: %d", err); - return err; - } - -TInt CImagePrintBody::GetPrinterCapabilityIDsL(TInt aPrinterID, RArray& aCapabilityIDs) - { - LOG1("CImagePrintBody::GetPrinterCapabilityIDsL aPrinterID: %d", aPrinterID); - TInt DeviceID; - MProtPrintingDevice* theProtToQuery = NULL; - - TInt err = FindInternalDeviceReference( aPrinterID, DeviceID, theProtToQuery ); - if( !err ) - { - err = theProtToQuery->GetDeviceCapabilityIDsL( DeviceID, aCapabilityIDs ); - } - else if( err == KErrNotFound ) - { - err = KErrInvalidData; - } - - LOG1("CImagePrintBody::GetPrinterCapabilityIDsL return: %d", err); - return err; - } - -TInt CImagePrintBody::GetPrinterCapabilityL(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability) - { - LOG1("CImagePrintBody::GetPrinterCapabilityL aPrinterID: %d", aPrinterID); - LOG1("CImagePrintBody::GetPrinterCapabilityL aCapabilityID: %d", aCapabilityID); - TInt DeviceID; - MProtPrintingDevice* theProtToQuery = NULL; - - TInt err = FindInternalDeviceReference( aPrinterID, DeviceID, theProtToQuery ); - if( !err ) - { - err = theProtToQuery->GetDeviceCapabilityL( DeviceID, aCapabilityID, aCapability ); - } - else if( err == KErrNotFound ) - { - err = KErrInvalidData; - } - - LOG1("CImagePrintBody::GetPrinterCapabilityL return: %d", err); - return err; - } - -TInt CImagePrintBody::GetJobSetting(TInt aCapabilityID, TInt& aValue) - { - LOG1("CImagePrintBody::GetJobSetting aCapabilityID: %d", aCapabilityID); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->GetJobSetting( aCapabilityID, aValue ); - } - LOG1("CImagePrintBody::GetJobSetting return: %d", err); - return err; - } - -TInt CImagePrintBody::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - LOG1("CImagePrintBody::SetJobSettingL aCapabilityID: %d", aCapabilityID); - LOG1("CImagePrintBody::SetJobSettingL aValue: %d", aValue); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->SetJobSettingL( aCapabilityID, aValue, aAffectedCapability ); - } - LOG1("CImagePrintBody::SetJobSettingL return: %d", err); - return err; - } - -TInt CImagePrintBody::GetNumPreviewPages() - { - LOG("CImagePrintBody::GetNumPreviewPages"); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->GetNumPreviewPages(); - } - LOG1("CImagePrintBody::GetNumPreviewPages return: %d", err); - return err; - } - -TInt CImagePrintBody::GetJobTemplateIconL( TInt aTemplateID, TInt& aFbsBitmapHandle ) - { - LOG1("CImagePrintBody::GetJobTemplateIconL aTemplateID: %d", aTemplateID); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->GetJobTemplateIconL( aTemplateID, aFbsBitmapHandle ); - } - LOG1("CImagePrintBody::GetJobTemplateIconL return: %d", err); - return err; - } - -TInt CImagePrintBody::CreatePreviewImage(TInt aPageNumber) - { - LOG1("CImagePrintBody::CreatePreviewImage aPageNumber: %d", aPageNumber); - TInt err( KErrInvalidSequence ); - if( iCurrentPrintJobProtocol ) - { - err = iCurrentPrintJobProtocol->CreatePreviewImage(aPageNumber); - } - LOG1("CImagePrintBody::CreatePreviewImage return: %d", err); - return err; - } - -TInt CImagePrintBody::RemoveCachedPrinterL(TInt aPrinterID) - { - LOG1("CImagePrintBody::RemoveCachedPrinterL aPrinterID: %d", aPrinterID); - TInt DeviceID; - MProtPrintingDevice* theProtToQuery = NULL; - TInt err = FindInternalDeviceReference( aPrinterID, DeviceID, theProtToQuery ); - if( !err ) - { - err = theProtToQuery->RemoveCachedDeviceL( DeviceID ); - } - LOG1("CImagePrintBody::RemoveCachedPrinterL return: %d", err); - return err; - } - -TUint CImagePrintBody::SupportedProtocols() - { - LOG("CImagePrintBody::SupportedProtocols begin"); - TUint prots = iClassLoader->SupportedProtocols(); - LOG1("CImagePrintBody::SupportedProtocols return: %d", prots); - return prots; - } - -void CImagePrintBody::RegisterIdleObserver(MIdleObserver *aObserver) - { - LOG("CImagePrintBody::RegisterIdleObserver begin"); - iPrinterIdleObserver = aObserver; - LOG("CImagePrintBody::RegisterIdleObserver end"); - } - -// From MProtDiscoveryObserver. -void CImagePrintBody::FoundDeviceL(TPrinter& aDeviceInfo) - { - LOG("CImagePrintBody::FoundDeviceL begin"); - if( iPrinterDiscoveryObserver ) - { - //Check that device id is valid, there can't be any bits in the protocol field (higher bits) - if( !( PROTOCOL_ID_FIELD_MASK & aDeviceInfo.iPrinterID ) ) - { - // Get the protocol index number - TInt protocolIndex = iClassLoader->GetProtocolIndex(); - - // Left shift this number so that it occupies the higher X bits (the PROTOCOL_ID_BIT_COUNT highest bits) - protocolIndex <<= sizeof(TInt)*8 - PROTOCOL_ID_BIT_COUNT; - - // Add the protocol index number to the device id - aDeviceInfo.iPrinterID |= protocolIndex; - - // Forward the FoundPrinterL callback to the observer - iPrinterDiscoveryObserver->FoundPrinterL( aDeviceInfo ); - } - } - LOG("CImagePrintBody::FoundDeviceL end"); - } - -void CImagePrintBody::DiscoveryStatusL( TInt aStatus, TInt aErrorCode, TInt aErrorStringCode ) - { - LOG1("CImagePrintBody::DiscoveryStatusL aStatus: %d", aStatus); - LOG1("CImagePrintBody::DiscoveryStatusL aErrorCode: %d", aErrorCode); - LOG1("CImagePrintBody::DiscoveryStatusL aErrorStringCode: %d", aErrorStringCode); - if( iPrinterDiscoveryObserver ) - { - switch( aStatus ) - { - case EDiscoveryFinished: // Done with 1 protocol. - { - // When Bluetooth discovery is finished, but Bluetooth is not enabled pass error code to UI. - if ( aErrorCode == ENoConnection ) - { - iPrinterDiscoveryObserver->DiscoveryStatusL( aStatus, aErrorCode, aErrorStringCode ); - } - iCurrentProtocol = NULL; - TUint doDiscovery = iProtocolsRequested & iClassLoader->SupportedProtocols(); - LOG1("CImagePrintBody::DiscoveryStatusL doDiscovery: %d", doDiscovery); - LOG1("CImagePrintBody::DiscoveryStatusL iDiscoveryCancelled: %d", iDiscoveryCancelled); - if( ( !doDiscovery && aErrorCode == KErrCancel ) || iDiscoveryCancelled ) - { - iPrinterDiscoveryObserver->DiscoveryStatusL( aStatus, aErrorCode, aErrorStringCode ); - } - else - { - TryNextDiscovery(); - } - } - break; - default: // Discovering, Cancelling. - iCurrentProtocol = NULL; - iPrinterDiscoveryObserver->DiscoveryStatusL( aStatus, aErrorCode, aErrorStringCode ); - break; - } - } - LOG("CImagePrintBody::DiscoveryStatusL end"); - } - - -void CImagePrintBody::RemoveDeviceL(TPrinter& aDeviceInfo) - { - LOG("CImagePrintBody::RemoveDeviceL begin"); - if( iPrinterDiscoveryObserver ) - { - if (PROTOCOL_ID_FIELD_MASK & aDeviceInfo.iPrinterID) - { //Invalid id, reject printer - } - else - { // Get the protocol index number - TInt protocolIndex = iClassLoader->GetProtocolIndex(); - - // Left shift this number so that it occupies the higher X bits (the PROTOCOL_ID_BIT_COUNT highest bits) - protocolIndex <<= sizeof(TInt)*8 - PROTOCOL_ID_BIT_COUNT; - - // Add the protocol index number to the device id - aDeviceInfo.iPrinterID |= protocolIndex; - - // Forward the RemovePrinterL callback to the observer - iPrinterDiscoveryObserver->RemovePrinterL( aDeviceInfo ); - } - } - LOG("CImagePrintBody::RemoveDeviceL end"); - } - -// From MProtPrintEventObserver. -void CImagePrintBody::PrintJobProgressEvent(TInt aStatus, TInt aPercent, TInt aJobStateCode) - { - LOG1("CImagePrintBody::PrintJobProgressEvent aStatus: %d", aStatus); - LOG1("CImagePrintBody::PrintJobProgressEvent aPercent: %d", aPercent); - LOG1("CImagePrintBody::PrintJobProgressEvent aJobStateCode: %d", aJobStateCode); - if( iPrinterPrintEventObserver ) - iPrinterPrintEventObserver->PrintJobProgressEvent(aStatus, aPercent, aJobStateCode); - LOG("CImagePrintBody::PrintJobProgressEvent end"); - } - -void CImagePrintBody::PrintJobErrorEvent(TInt aErrorCode, TInt aErrorStringCode) - { - LOG1("CImagePrintBody::PrintJobErrorEvent aErrorCode: %d", aErrorCode); - LOG1("CImagePrintBody::PrintJobErrorEvent aErrorStringCode: %d", aErrorStringCode); - if( iPrinterPrintEventObserver ) - iPrinterPrintEventObserver->PrintJobErrorEvent(aErrorCode, aErrorStringCode); - LOG("CImagePrintBody::PrintJobErrorEvent end"); - } - -void CImagePrintBody::PrinterStatusEvent(TInt aErrorCode, TInt aErrorStringCode) - { - LOG1("CImagePrintBody::PrinterStatusEvent aErrorCode: %d", aErrorCode); - LOG1("CImagePrintBody::PrinterStatusEvent aErrorStringCode: %d", aErrorStringCode); - if( iPrinterPrintEventObserver ) - iPrinterPrintEventObserver->PrinterStatusEvent(aErrorCode, aErrorStringCode); - LOG("CImagePrintBody::PrinterStatusEvent end"); - } - -void CImagePrintBody::PreviewImageEvent(TInt aFsBitmapHandle) - { - LOG1("CImagePrintBody::PreviewImageEvent aFsBitmapHandle: %d", aFsBitmapHandle); - if( iPrinterPrintEventObserver ) - iPrinterPrintEventObserver->PreviewImageEvent(aFsBitmapHandle); - LOG("CImagePrintBody::PreviewImageEvent end"); - } - -void CImagePrintBody::ShowMessageL(TInt aMsgLine1Code, TInt aMsgLine2Code) - { - LOG1("CImagePrintBody::ShowMessageL aMsgLine1Code: %d", aMsgLine1Code); - LOG1("CImagePrintBody::ShowMessageL aMsgLine2Code: %d", aMsgLine2Code); - if( iPrinterPrintEventObserver ) - iPrinterPrintEventObserver->ShowMessageL(aMsgLine1Code, aMsgLine2Code); - LOG("CImagePrintBody::ShowMessageL end"); - } - -TBool CImagePrintBody::AskYesNoQuestionL(TInt aMsgLine1Code, TInt aMsgLine2Code) - { - LOG1("CImagePrintBody::AskYesNoQuestionL aMsgLine1Code: %d", aMsgLine1Code); - LOG1("CImagePrintBody::AskYesNoQuestionL aMsgLine2Code: %d", aMsgLine2Code); - TBool res( EFalse ); - if( iPrinterPrintEventObserver ) - { - res = iPrinterPrintEventObserver->AskYesNoQuestionL(aMsgLine1Code, aMsgLine2Code); - } - LOG1("CImagePrintBody::AskYesNoQuestionL return: %d", res); - return res; - } - -const TDesC& CImagePrintBody::AskForInputL(TInt aMsgLine1Code, TInt aMsgLine2Code) - { - LOG1("CImagePrintBody::ShowMessageL aMsgLine1Code: %d", aMsgLine1Code); - LOG1("CImagePrintBody::ShowMessageL aMsgLine2Code: %d", aMsgLine2Code); - if( iPrinterPrintEventObserver ) - { - return iPrinterPrintEventObserver->AskForInputL(aMsgLine1Code, aMsgLine2Code); - } - else - { - return KNullDesC; - } - } - -void CImagePrintBody::StatusEvent(const TEvent& aEvent, TInt aError, TInt aMsgCode) - { - LOG1("CImagePrintBody::StatusEvent aError: %d", aError); - LOG1("CImagePrintBody::StatusEvent aMsgCode: %d", aMsgCode); - LOG1("CImagePrintBody::StatusEvent aEvent.iProtocol: %d", aEvent.iProtocol); - LOG1("CImagePrintBody::StatusEvent aEvent.iSeverity: %d", aEvent.iSeverity); - LOG1("CImagePrintBody::StatusEvent aEvent.iEventType: %d", aEvent.iEventType); - - if( iPrinterIdleObserver ) - { - iPrinterIdleObserver->StatusEvent( aEvent, aError, aMsgCode ); - } - - if( aEvent.iEventType == EAsynchronousLeave ) - { - // a protocol threw an async leave - // we continue with other protocols - TUint doDiscovery = iProtocolsRequested & iClassLoader->SupportedProtocols(); - if( doDiscovery ) TryNextDiscovery(); - } - LOG("CImagePrintBody::StatusEvent end"); - } - -CImagePrintBody::CImagePrintBody() : - iCurrentProtocol( NULL ), - iCurrentPrintJobProtocol( NULL ) - { - LOG("CImagePrintBody::CImagePrintBody begin"); - LOG("CImagePrintBody::CImagePrintBody end"); - } - -void CImagePrintBody::ConstructL() - { - LOG("CImagePrintBody::ConstructL begin"); - iClassLoader = CProtocolsLoader::NewL(); - iClassLoader->Reset(); - for( TInt x=0; x < iClassLoader->GetNumberOfProtocolsAvailable(); ++x ) - { - iClassLoader->GetNextProtocol()->RegisterIdleObserver( this ); - } - - iIdleDiscovery = CIdle::NewL( CActive::EPriorityIdle ); - ActiveScheduler().SetIdleObserver( *this ); - LOG("CImagePrintBody::ConstructL end"); - } - -CImagePrintScheduler& CImagePrintBody::ActiveScheduler() const - { - LOG("CImagePrintBody::ActiveScheduler begin"); - CImagePrintScheduler* scheduler = static_cast( CActiveScheduler::Current() ); - LOG("CImagePrintBody::ActiveScheduler end"); - return *scheduler; - } - -TInt CImagePrintBody::FindInternalDeviceReference(TInt aExternalDeviceID, TInt& aInternalDeviceID, MProtPrintingDevice*& aProtToUse) - { - LOG1("CImagePrintBody::FindInternalDeviceReference aExternalDeviceID: %d", aExternalDeviceID); - TInt err( KErrNotFound ); - - aProtToUse = NULL; - - // Separate the external id into the corresponding fields - TInt protId = aExternalDeviceID & PROTOCOL_ID_FIELD_MASK; - - TInt deviceId = aExternalDeviceID & DEVICE_ID_FIELD_MASK; - protId >>= (sizeof(TInt)*8 - PROTOCOL_ID_BIT_COUNT); - // If TInt is more than 4 bytes the mask should clear everything but the 6 least significant bits - protId &= PROTOCOL_ID_CLEAR_MASK; //remove 1's if the original protId was negative - - // Check that the external ID does indeed belong to one of the currently - // loaded protocols - if( protId >= 0 && protId < iClassLoader->GetNumberOfProtocolsAvailable() ) - { - aInternalDeviceID = deviceId; - aProtToUse = iClassLoader->GetProtocolAt(protId); - if( aProtToUse ) err = KErrNone; - } - - LOG1("CImagePrintBody::FindInternalDeviceReference return: %d", err); - return err; - } - -TInt CImagePrintBody::ValidateImagesL(const RPointerArray& aImageList, TInt &aInvalidCount) - { - LOG1("CImagePrintBody::ValidateImagesL aImageList.Count(): %d", aImageList.Count()); - aInvalidCount = 0; - TInt lastError = KErrNone; - CRsImageParser *imageParser = CRsImageParser::NewLC(); - - for( TInt nCnt=0; nCnt < aImageList.Count(); ++nCnt ) - { - LOG1("CImagePrintBody::ValidateImagesL nCnt: %d", nCnt); - LOG1("CImagePrintBody::ValidateImagesL image: %S", aImageList[nCnt]); - TBool valid; - imageParser->ValidateL(*(aImageList[nCnt]), valid, lastError); - LOG1("CImagePrintBody::ValidateImagesL valid: %d", valid); - LOG1("CImagePrintBody::ValidateImagesL lastError: %d", lastError); - if( !valid ) - { - ++aInvalidCount; - } - } - - CleanupStack::PopAndDestroy(imageParser); - LOG1("CImagePrintBody::ValidateImagesL aInvalidCount: %d", aInvalidCount); - LOG1("CImagePrintBody::ValidateImagesL ends with: %d", lastError); - return lastError; - } - -void CImagePrintBody::TryNextDiscovery() - { - LOG("CImagePrintBody::TryNextDiscovery begin"); - iIdleDiscovery->Cancel(); - iIdleDiscovery->Start(TCallBack(TryNextDiscoveryL, this)); - LOG("CImagePrintBody::TryNextDiscovery end"); - } - -void CImagePrintBody::DoTryNextDiscoveryL() - { - LOG("CImagePrintBody::DoTryNextDiscoveryL begin"); - TUint doDiscovery = iProtocolsRequested & iClassLoader->SupportedProtocols(); - LOG1("CImagePrintBody::DoTryNextDiscoveryL doDiscovery: %d", doDiscovery); - if( doDiscovery ) - { - TBool found( EFalse ); - TInt protId( 0 ); - TInt count = iClassLoader->GetNumberOfProtocolsAvailable(); - LOG1("CImagePrintBody::DoTryNextDiscoveryL count: %d", count); - for( TInt i = 0; i < count && !found; i++ ) - { - iCurrentProtocol = iClassLoader->GetNextProtocol(); - protId = iCurrentProtocol->SupportedProtocols(); - if( iProtocolsRequested & protId ) found = ETrue; - } - LOG1("CImagePrintBody::DoTryNextDiscoveryL found: %d", found); - LOG1("CImagePrintBody::DoTryNextDiscoveryL protId: %d", protId); - if( found ) - { - TUint temp = KMaxTUint ^ protId; - iProtocolsRequested &= temp; - LOG1("CImagePrintBody::DoTryNextDiscoveryL iProtocolsRequested: %d", iProtocolsRequested); - ActiveScheduler().SetCurrentProtocol( protId ); - iCurrentProtocol->StartDiscoveryL( *this, protId ); - } - } - else - { - iPrinterDiscoveryObserver->DiscoveryStatusL( EDiscoveryFinished, 0, 0 ); - } - LOG("CImagePrintBody::DoTryNextDiscoveryL end"); - } - -TInt CImagePrintBody::TryNextDiscoveryL(TAny* aObj) - { - LOG("CImagePrintBody::TryNextDiscoveryL begin"); - CImagePrintBody* obj = static_cast(aObj); - obj->DoTryNextDiscoveryL(); - LOG("CImagePrintBody::TryNextDiscoveryL end"); - return EFalse; - } - -void CImagePrintBody::SetNumsOfCopiesL( const RArray& aNumsOfCopies, TInt& aErr ) - { - LOG1("CImagePrintBody::SetNumberOfCopiesL aNumsOfCopies.Count(): %d", aNumsOfCopies.Count()); - - if( iCurrentPrintJobProtocol ) - { - iCurrentPrintJobProtocol->SetNumsOfCopiesL( aNumsOfCopies, aErr ); - LOG1("CImagePrintBody::SetNumberOfCopiesL aErr: %d", aErr); - } - - LOG("CImagePrintBody::SetNumberOfCopiesL end"); - } - -void CImagePrintBody::HandleSessionDisconnect( const MIdleObserver* aIdleObserver, - const MPrinterDiscoveryObserver* aDiscoveryObserver, - const MPrintEventObserver* aEventObserver ) - { - LOG1("CImagePrintBody::HandleSessionDisconnect aIdleObserver address: %d", aIdleObserver); - LOG1("CImagePrintBody::HandleSessionDisconnect iPrinterIdleObserver address: %d", iPrinterIdleObserver); - LOG1("CImagePrintBody::HandleSessionDisconnect aDiscoveryObserver address: %d", aDiscoveryObserver); - LOG1("CImagePrintBody::HandleSessionDisconnect iPrinterDiscoveryObserver address: %d", iPrinterDiscoveryObserver); - LOG1("CImagePrintBody::HandleSessionDisconnect aEventObserver address: %d", aEventObserver); - LOG1("CImagePrintBody::HandleSessionDisconnect iPrinterPrintEventObserver address: %d", iPrinterPrintEventObserver); - if( aIdleObserver == iPrinterIdleObserver ) iPrinterIdleObserver = NULL; - if( aEventObserver == iPrinterPrintEventObserver ) iPrinterPrintEventObserver = NULL; - if( aDiscoveryObserver == iPrinterDiscoveryObserver ) iPrinterDiscoveryObserver = NULL; - LOG("CImagePrintBody::HandleSessionDisconnect end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintscheduler.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintscheduler.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-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 "cimageprintscheduler.h" -#include "mprotprintingdevice.h" -#include "tidleevent.h" -#include "printmessagecodes.h" -#include "clog.h" - -void CImagePrintScheduler::Error(TInt aError) const - { - LOG1("CImagePrintScheduler::Error aError: %d", aError); - if( iIdleObserver ) - { - TEvent event; - event.iProtocol = iCurrentProtocol; - event.iSeverity = ESevere; - event.iEventType = EAsynchronousLeave; - LOG("CImagePrintScheduler::Error informing observer"); - iIdleObserver->StatusEvent( event, aError, ENoMessage ); - } - LOG("CImagePrintScheduler::Error end"); - } - -void CImagePrintScheduler::SetIdleObserver( MProtIdleObserver& aIdleObserver ) - { - LOG("CImagePrintScheduler::SetIdleObserver begin"); - iIdleObserver = &aIdleObserver; - LOG("CImagePrintScheduler::SetIdleObserver end"); - } - -void CImagePrintScheduler::SetCurrentProtocol( TInt aProtocol ) - { - LOG1("CImagePrintScheduler::SetCurrentProtocol aProtocol: %d", aProtocol); - iCurrentProtocol = aProtocol; - LOG("CImagePrintScheduler::SetCurrentProtocol end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintserver.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintserver.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* -* Copyright (c) 2004-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 "cimageprintserver.h" -#include "imageprintclientserver.h" -#include "cimageprintsession.h" -#include "clog.h" -#include "cimageprintbody.h" - -namespace - { - // panic - _LIT( KImagePrintServerPanic, "CIPSer" ); - enum TImagePrintServerPanic - { - EBadDescriptor - }; - - void PanicClient( const RMessage2& aMessage, TImagePrintServerPanic aCategory ) - { - aMessage.Panic( KImagePrintServerPanic, aCategory ); - } - } - - -CImagePrintServer* CImagePrintServer::NewLC() - { - CImagePrintServer* server = new (ELeave) CImagePrintServer(); - CleanupStack::PushL( server ) ; - server->ConstructL(); - return server; - } - - -CImagePrintServer::CImagePrintServer() - : CPolicyServer( 0, KImagePrintPolicy, ESharableSessions ) - { - } - -CImagePrintServer::~CImagePrintServer() - { - LOG("CImagePrintServer::~CImagePrintServer begin"); - delete iEngine; - iFbs.Disconnect(); - LOG("CImagePrintServer::~CImagePrintServer end"); - } - -void CImagePrintServer::ConstructL() - { - LOG("CImagePrintServer::ConstructL begin"); - StartL( KImagePrintServerName ); - User::LeaveIfError( iFbs.Connect() ); - iEngine = CImagePrintBody::NewL(); - LOG("CImagePrintServer::ConstructL end"); - } - -void CImagePrintServer::AddSession() - { - LOG("CImagePrintServer::AddSession begin"); - ++iConnsCount; - LOG("CImagePrintServer::AddSession end"); - } - -void CImagePrintServer::RemoveSession() - { - --iConnsCount; - LOG1("CImagePrintServer::RemoveSession iConnsCount: %d", iConnsCount); - if( iConnsCount == 0 ) - { - delete iEngine; - iEngine = NULL; - iFbs.Disconnect(); - CActiveScheduler::Stop(); - } - LOG("CImagePrintServer::RemoveSession end"); - } - -TInt CImagePrintServer::SessionCount() const - { - LOG("CImagePrintServer::SessionCount begin"); - LOG1("CImagePrintServer::SessionCount return: %d", iConnsCount); - return iConnsCount; - } - -TInt CImagePrintServer::RunError( TInt aError ) - { - LOG1("CImagePrintServer::RunError aError: %d", aError); - if( aError == KErrBadDescriptor ) - { - PanicClient( Message(), EBadDescriptor ); - } - else - { - Message().Complete( aError ); - } - ReStart(); - LOG("CImagePrintServer::RunError end"); - return KErrNone; - } - - -CSession2* CImagePrintServer::NewSessionL( const TVersion& aVersion, const RMessage2& ) const - { - LOG("CImagePrintServer::NewSessionL begin"); - TBool supported = User::QueryVersionSupported( TVersion( KImagePrintServerMajor, - KImagePrintServerMinor, - KImagePrintServerBuild ), - aVersion ); - if( !supported ) - { - User::Leave( KErrNotSupported ); - } - - LOG("CImagePrintServer::NewSessionL end"); - return new (ELeave) CImagePrintSession(); - } - -TInt CImagePrintServer::ReserveEngine( const CSession2* aSession ) - { - LOG("CImagePrintServer::ReserveEngine begin"); - TInt err( KErrInUse ); - if( iEngineHolder == aSession || !iEngineHolder ) - { - iEngineHolder = aSession; - err = KErrNone; - } - LOG1("CImagePrintServer::ReserveEngine return: %d", err); - return err; - } - -TInt CImagePrintServer::ReleaseEngine( const CSession2* aSession ) - { - LOG("CImagePrintServer::ReleaseEngine begin"); - TInt err( KErrInUse ); - if( iEngineHolder == aSession || !iEngineHolder ) - { - iEngineHolder = NULL; - err = KErrNone; - } - LOG1("CImagePrintServer::ReleaseEngine return: %d", err); - return err; - } - -CImagePrintBody& CImagePrintServer::Engine() const - { - LOG("CImagePrintServer::Engine begin"); - LOG("CImagePrintServer::Engine end"); - return *iEngine; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintsession.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cimageprintsession.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,800 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "cimageprintsession.h" -#include "imageprintclientserver.h" -#include "cimageprintserver.h" -#include "clog.h" -#include "cimageprintbody.h" -#include "cserveridleguard.h" -#include "cserverdiscoveryguard.h" -#include "cserverjobguard.h" -#include "cnumofcopies.h" - -namespace - { - // panic - _LIT( KImagePrintSessionPanic, "CIPSes" ); - enum TImagePrintSessionPanic - { - ENotSupported - }; - - void PanicClient( const TMessageWrp2& aMessage, TImagePrintSessionPanic aCategory ) - { - aMessage.Panic( KImagePrintSessionPanic, aCategory ); - } - } - -CImagePrintSession::~CImagePrintSession() - { - LOG("CImagePrintSession::~CImagePrintSession begin"); - delete iNumOfCopies; - delete iIdleGuard; - delete iDiscoveryGuard; - delete iJobGuard; - iCapabilityIDs.Close(); - iMsgWrappers.ResetAndDestroy(); - iMsgWrappers.Close(); - Server().ReleaseEngine( this ); - Server().RemoveSession(); - LOG("CImagePrintSession::~CImagePrintSession end"); - } - -CImagePrintServer& CImagePrintSession::Server() - { - return *static_cast( const_cast( CSession2::Server() ) ); - } - -void CImagePrintSession::CreateL() - { - LOG("CImagePrintSession::CreateL begin"); - Server().AddSession(); - iIdleGuard = CServerIdleGuard::NewL( Server().Engine() ); - iDiscoveryGuard = CServerDiscoveryGuard::NewL( Server().Engine() ); - iJobGuard = CServerJobGuard::NewL( Server().Engine() ); - iNumOfCopies = CNumOfCopies::NewL(); - iConnected = ETrue; - LOG("CImagePrintSession::CreateL end"); - } - -void CImagePrintSession::Disconnect(const RMessage2 &aMessage) - { - LOG("CImagePrintSession::Disconnect begin"); - Server().Engine().HandleSessionDisconnect( iIdleGuard, iDiscoveryGuard, iJobGuard ); - iConnected = EFalse; - CSession2::Disconnect( aMessage ); - LOG("CImagePrintSession::Disconnect end"); - } - -void CImagePrintSession::ServiceL( const RMessage2& aMessage ) - { - LOG1("CImagePrintSession::ServiceL aMessage.Function(): %d", aMessage.Function()); - - // wrapper array clean begin - TInt index = iMsgWrappers.Count(); - LOG1("CImagePrintSession::ServiceL index: %d", index); - TBool result( EFalse ); - while( --index >= 0 && !result ) - { - if( ( iMsgWrappers[index] )->Disposable() ) - { - TMessageWrp2* toDispose = iMsgWrappers[index]; - iMsgWrappers.Remove( index ); - delete toDispose; - toDispose = NULL; - result = ETrue; - } - } - // wrapper array clean end - - TMessageWrp2* msgWrapper = new (ELeave) TMessageWrp2( aMessage, iConnected ); - TInt err = iMsgWrappers.Insert( msgWrapper, 0 ); - if( err ) - { - delete msgWrapper; - User::Leave( err ); - } - else - { - msgWrapper = NULL; - } - - TInt messageIndex = aMessage.Function(); - - if ( messageIndex <= EContinuePrintJob ) - { - ServiceFirstPartL( messageIndex ); - } - else if ( messageIndex >= ERemoveCachedPrinter && messageIndex <= EGetPrinterCapHigh ) - { - ServiceSecondPartL( messageIndex ); - } - else if ( messageIndex >= EGetPrinterCapEnumCount && messageIndex <= ESetNumberOfCopies ) - { - ServiceThirdPartL ( messageIndex ); - } - else - { - PanicClient( *iMsgWrappers[0], ENotSupported ); - } - - LOG("CImagePrintSession::ServiceL end"); - } -void CImagePrintSession::ServiceFirstPartL( TInt aIndex ) - { - switch( aIndex ) - { - case ECountConnections: - CountConnectionsL( *iMsgWrappers[0] ); - break; - - case ESetForeground: - SetForegroundL( *iMsgWrappers[0] ); - break; - - case EReserveEngine: - ReserveEngine( *iMsgWrappers[0] ); - break; - - case EReleaseEngine: - ReleaseEngine( *iMsgWrappers[0] ); - break; - - case ESupportedProtocols: - SupportedProtocols( *iMsgWrappers[0] ); - break; - - case EGetNumPrintPages: - GetNumPrintPages( *iMsgWrappers[0] ); - break; - - case EGetJobStatus: - GetJobStatus( *iMsgWrappers[0] ); - break; - - case EGetPrinterStatus: - GetPrinterStatus( *iMsgWrappers[0] ); - break; - - case ECancelDiscovery: - CancelDiscovery( *iMsgWrappers[0] ); - break; - - case ESubmitPrintJob: - SubmitPrintJobL( *iMsgWrappers[0] ); - break; - - case ECancelPrintJob: - CancelPrintJob( *iMsgWrappers[0] ); - break; - - case EContinuePrintJob: - ContinuePrintJobL( *iMsgWrappers[0] ); - break; - - default: - LOG1("[CImagePrintSession::ServiceFirstPartL]\t Method reached to an end with index: %d", aIndex); - break; - } - } - -void CImagePrintSession::ServiceSecondPartL( TInt aIndex ) - { - switch( aIndex ) - { - case ERemoveCachedPrinter: - RemoveCachedPrinterL( *iMsgWrappers[0] ); - break; - - case EGetJobTemplateIcon: - GetJobTemplateIconL( *iMsgWrappers[0] ); - break; - - case EGetNumPreviewPages: - GetNumPreviewPages( *iMsgWrappers[0] ); - break; - - case ESetJobSetting: - SetJobSettingL( *iMsgWrappers[0] ); - break; - - case EGetJobSetting: - GetJobSettingL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapability: - GetPrinterCapabilityL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapId: - GetPrinterCapIdL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapType: - GetPrinterCapTypeL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapDef: - GetPrinterCapDefL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapLow: - GetPrinterCapLowL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapHigh: - GetPrinterCapHighL( *iMsgWrappers[0] ); - break; - - default: - LOG1("[CImagePrintSession::ServiceSecondPartL]\t Method reached to an end with index: %d", aIndex); - break; - } - } - -void CImagePrintSession::ServiceThirdPartL( TInt aIndex ) - { - switch( aIndex ) - { - case EGetPrinterCapEnumCount: - GetPrinterCapEnumCountL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapEnum: - GetPrinterCapEnumL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapabilityIDsCount: - GetPrinterCapabilityIDsCountL( *iMsgWrappers[0] ); - break; - - case EGetPrinterCapabilityID: - GetPrinterCapabilityIDL( *iMsgWrappers[0] ); - break; - - case ERegisterIdleObserver: - RegisterIdleObserverL( *iMsgWrappers[0] ); - break; - - case ECancelRegisterIdleObserver: - CancelRegisterIdleObserverL( *iMsgWrappers[0] ); - break; - - case EStartDiscovery: - StartDiscoveryL( *iMsgWrappers[0] ); - break; - - case EContinueDiscovery: - ContinueDiscoveryL( *iMsgWrappers[0] ); - break; - - case EPrepareJob: - PrepareJobL( *iMsgWrappers[0] ); - break; - - case ECreateJob: - CreateJobL( *iMsgWrappers[0] ); - break; - - case EContinueCreateJob: - ContinueCreateJobL( *iMsgWrappers[0] ); - break; - - case ECancelStartDiscovery: - CancelStartDiscoveryL( *iMsgWrappers[0] ); - break; - - case ECancelCreateJob: - CancelCreateJobL( *iMsgWrappers[0] ); - break; - - case EIsPictBridgeMode: - IsPictBridgeModeL( *iMsgWrappers[0] ); - break; - - case ESetNumberOfCopiesCount: - SetNumberOfCopiesCountL( *iMsgWrappers[0] ); - break; - - case ESetNumberOfCopies: - SetNumberOfCopiesL( *iMsgWrappers[0] ); - break; - - default: - LOG1("[CImagePrintSession::ServiceThirdPartL]\t Method reached to an end with index: %d", aIndex); - break; - } - } - - -void CImagePrintSession::CountConnectionsL( TMessageWrp2& aMessage ) - { - TInt count = Server().SessionCount(); - TPckgC countDes( count ); - aMessage.WriteL( 0, countDes ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( KErrNone ); - } - -void CImagePrintSession::SetForegroundL( TMessageWrp2& aMessage ) - { - TInt fg = aMessage.Int0(); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( KErrNone ); - } - -void CImagePrintSession::ReserveEngine( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::ReleaseEngine( TMessageWrp2& aMessage ) - { - TInt err = Server().ReleaseEngine( this ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::SupportedProtocols( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - if( !err ) - { - TInt protocols = Server().Engine().SupportedProtocols(); - aMessage.Complete( protocols ); - } - else - { - aMessage.Complete( err ); - } - } - -void CImagePrintSession::GetNumPrintPages( TMessageWrp2& aMessage ) -{ - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - if( !err ) - { - TInt pages = Server().Engine().GetNumPrintPages(); - aMessage.Complete( pages ); - } - else - { - aMessage.Complete( err ); - } - } - -void CImagePrintSession::GetJobStatus( TMessageWrp2& aMessage ) -{ - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - if( !err ) - { - TInt status = Server().Engine().GetJobStatus(); - aMessage.Complete( status ); - } - else - { - aMessage.Complete( err ); - } - } - -void CImagePrintSession::GetPrinterStatus( TMessageWrp2& aMessage ) -{ - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - if( !err ) - { - TInt id = aMessage.Int0(); - TInt status = Server().Engine().GetPrinterStatus( id ); - aMessage.Complete( status ); - } - else - { - aMessage.Complete( err ); - } - } - -void CImagePrintSession::CancelDiscovery( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - Server().Engine().CancelDiscovery(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::SubmitPrintJobL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - Server().Engine().SubmitPrintJobL(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::CancelPrintJob( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - err = Server().Engine().CancelPrintJob(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::ContinuePrintJobL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - err = Server().Engine().ContinuePrintJobL(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::RemoveCachedPrinterL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt id = aMessage.Int0(); - err = Server().Engine().RemoveCachedPrinterL( id ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetJobTemplateIconL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt id = aMessage.Int0(); - TInt handle; - err = Server().Engine().GetJobTemplateIconL( id, handle ); - TPckgC handleDes( handle ); - aMessage.WriteL( 1, handleDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetNumPreviewPages( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - aMessage.SetDisposable( ETrue ); - if( !err ) - { - TInt num = Server().Engine().GetNumPreviewPages(); - aMessage.Complete( num ); - } - else - { - aMessage.Complete( err ); - } - } - -void CImagePrintSession::SetJobSettingL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt capabilityID = aMessage.Int0(); - TInt value = aMessage.Int1(); - TInt affectedCapability; - - LOG2("CImagePrintSession::SetJobSettingL || capabilityID = %d, value = %d", capabilityID, value ); - - err = Server().Engine().SetJobSettingL( capabilityID, value, affectedCapability ); - TPckgC affectedCapabilityDes( affectedCapability ); - aMessage.WriteL( 2, affectedCapabilityDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetJobSettingL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt capabilityID = aMessage.Int0(); - TInt value; - err = Server().Engine().GetJobSetting( capabilityID, value ); - TPckgC valueDes( value ); - aMessage.WriteL( 1, valueDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapabilityL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt printerID = aMessage.Int0(); - TInt capabilityID = aMessage.Int1(); - err = Server().Engine().GetPrinterCapabilityL( printerID, capabilityID, iCapability ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapIdL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC capIdDes( iCapability.iCapabilityID ); - aMessage.WriteL( 0, capIdDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapTypeL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC typeDes( iCapability.iType ); - aMessage.WriteL( 0, typeDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapDefL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC defDes( iCapability.iDefaultValue ); - aMessage.WriteL( 0, defDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapLowL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC lowDes( iCapability.iLow ); - aMessage.WriteL( 0, lowDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapHighL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC highDes( iCapability.iHigh ); - aMessage.WriteL( 0, highDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapEnumCountL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TPckgC countDes( iCapability.iEnumCount ); - aMessage.WriteL( 0, countDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapEnumL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt index = aMessage.Int0(); - TPckgC enumDes( iCapability.iEnumCodes[index] ); - aMessage.WriteL( 1, enumDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - - -void CImagePrintSession::GetPrinterCapabilityIDsCountL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - iCapabilityIDs.Reset(); - TInt printerID = aMessage.Int0(); - err = Server().Engine().GetPrinterCapabilityIDsL( printerID, iCapabilityIDs ); - if( !err ) - { - TInt count = iCapabilityIDs.Count(); - TPckgC countDes( count ); - aMessage.WriteL( 1, countDes ); - } - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::GetPrinterCapabilityIDL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - TInt index = aMessage.Int0(); - TInt id = iCapabilityIDs[index]; - TPckgC idDes( id ); - aMessage.WriteL( 1, idDes ); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::RegisterIdleObserverL( TMessageWrp2& aMessage ) - { - iIdleGuard->Guard( aMessage ); - } - -void CImagePrintSession::CancelRegisterIdleObserverL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - iIdleGuard->Stop(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::StartDiscoveryL( TMessageWrp2& aMessage ) - { - TInt err = iDiscoveryGuard->StartL( aMessage ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::ContinueDiscoveryL( TMessageWrp2& aMessage ) - { - iDiscoveryGuard->ContinueL( aMessage ); - } - -void CImagePrintSession::PrepareJobL( TMessageWrp2& aMessage ) - { - iJobGuard->PrepareL( aMessage ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( KErrNone ); - } - -void CImagePrintSession::CreateJobL( TMessageWrp2& aMessage ) - { - TInt err = iJobGuard->CreateL( aMessage ); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::ContinueCreateJobL( TMessageWrp2& aMessage ) - { - iJobGuard->ContinueCreateL( aMessage ); - } - -void CImagePrintSession::CancelStartDiscoveryL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - iDiscoveryGuard->Stop(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::CancelCreateJobL( TMessageWrp2& aMessage ) - { - TInt err = Server().ReserveEngine( this ); - if( !err ) - { - iJobGuard->Stop(); - } - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::IsPictBridgeModeL( TMessageWrp2& aMessage ) - { - RUsb usbManager; - TUsbDeviceState dState; - TInt personality; - TInt err = EFalse; - User::LeaveIfError( usbManager.Connect()); - User::LeaveIfError( usbManager.GetDeviceState(dState)); - User::LeaveIfError( usbManager.GetCurrentPersonalityId(personality)); - usbManager.Close(); - - /* - * If there is some problems with pictbridge, check from usbpersonalityids.h that constants haven't been changed. - */ - if( dState == EUsbDeviceStateConfigured && - ((personality == KUsbPersonalityIdMTP)||(personality == KUsbPersonalityIdPCSuiteMTP))) - err = ETrue; - - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::SetNumberOfCopiesCountL( TMessageWrp2& aMessage ) - { - LOG("CImagePrintSession::CheckNumberOfCopiesL begin"); - TInt count = aMessage.Int0(); - LOG1("CImagePrintSession::CheckNumberOfCopiesL count: %d", count); - TInt err = ( count > 0 ) ? KErrNone : KErrInvalidData; - if( !err ) - { - iNumOfCopies->Reset( count ); - } - LOG1("CImagePrintSession::CheckNumberOfCopiesL return: %d", err); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -void CImagePrintSession::SetNumberOfCopiesL( TMessageWrp2& aMessage ) - { - LOG("CImagePrintSession::SetNumberOfCopiesL begin"); - TInt copies = aMessage.Int0(); - LOG1("CImagePrintSession::SetNumberOfCopiesL copies: %d", copies); - TInt err = ( copies < 0 ) ? KErrInvalidData : KErrNone; - if( !err ) - { - TBool full; - iNumOfCopies->AddNumOfCopyL( copies, full ); - LOG1("CImagePrintSession::SetNumberOfCopiesL full: %d", full); - if( full ) - { - Server().Engine().SetNumsOfCopiesL( iNumOfCopies->NumsOfCopies(), err ); - } - } - LOG1("CImagePrintSession::SetNumberOfCopiesL return: %d", err); - aMessage.SetDisposable( ETrue ); - aMessage.Complete( err ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cnumofcopies.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cnumofcopies.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2004-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 "cnumofcopies.h" -#include "clog.h" - -CNumOfCopies* CNumOfCopies::NewL() - { - CNumOfCopies* obj = new (ELeave) CNumOfCopies(); - CleanupStack::PushL( obj ) ; - obj->ConstructL(); - CleanupStack::Pop(); // obj - return obj; - } - -CNumOfCopies::~CNumOfCopies() - { - LOG("CNumOfCopies::~CNumOfCopies begin"); - iNumsOfCopies.Close(); - LOG("CNumOfCopies::~CNumOfCopies end"); - } - -CNumOfCopies::CNumOfCopies() : iCount( 0 ) - { - } - -void CNumOfCopies::ConstructL() - { - } - -void CNumOfCopies::Reset( TInt aCount ) - { - LOG("CNumOfCopies::Reset begin"); - iCount = aCount; - iNumsOfCopies.Reset(); - LOG("CNumOfCopies::Reset end"); - } - -void CNumOfCopies::AddNumOfCopyL( TInt aNumOfCopies, TBool& aFull ) - { - LOG1("CNumOfCopies::AddNumOfCopyL aNumOfCopies: %d", aNumOfCopies); - iNumsOfCopies.AppendL( aNumOfCopies ); - aFull = ( iNumsOfCopies.Count() == iCount ) ? ETrue : EFalse; - LOG1("CNumOfCopies::AddNumOfCopyL end with aFull: %d", aFull); - } - -const RArray& CNumOfCopies::NumsOfCopies() const - { - return iNumsOfCopies; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cprotocolsloader.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cprotocolsloader.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CProtocolsLoader class definition. -* -*/ - - -#include - -#include "cprotocolsloader.h" -#include "mprotprintingdevice.h" -#include "clog.h" -#include "imageprint.h" - -namespace - { - const TUid KImagePrintEcomUid = { 0x10208A1E }; - } - -CProtocolsLoader* CProtocolsLoader::NewL() - { - LOG("[CProtocolsLoader::NewL]\t Begin"); - CProtocolsLoader* self = new (ELeave) CProtocolsLoader(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - LOG("[CProtocolsLoader::NewL]\t End"); - return self; - } - - -CProtocolsLoader::~CProtocolsLoader() - { - LOG("[CProtocolsLoader::~CProtocolsLoader]\t Begin"); - iProtocols.ResetAndDestroy(); - LOG("[CProtocolsLoader::~CProtocolsLoader]\t End"); - } - - -TInt CProtocolsLoader::GetNumberOfProtocolsAvailable() const - { - LOG("[CProtocolsLoader::GetNumberOfProtocolsAvailable]\t Begin"); - LOG1("[CProtocolsLoader::GetNumberOfProtocolsAvailable]\t return: %d", iAvailableProtocols); - LOG("[CProtocolsLoader::GetNumberOfProtocolsAvailable]\t End"); - return iAvailableProtocols; - } - - -MProtPrintingDevice* CProtocolsLoader::GetNextProtocol() - { - LOG("[CProtocolsLoader::GetNextProtocol]\t Begin"); - if (iAvailableProtocols <= 0) - return NULL; - - if (iProtIndex == iAvailableProtocols) - iProtIndex = 0; - - MProtPrintingDevice* temp = iProtocols[iProtIndex]; - iProtIndex++; - LOG("[CProtocolsLoader::GetNextProtocol]\t End"); - return temp; - } - - -MProtPrintingDevice* CProtocolsLoader::GetProtocolAt(TInt aIndex) - { - LOG("[CProtocolsLoader::GetProtocolAt]\t Begin"); - if( iAvailableProtocols <= 0 ) return NULL; - - MProtPrintingDevice* temp = NULL; - - if (aIndex < 0) - temp = (MProtPrintingDevice*) iProtocols[0]; - else - if (aIndex >= iAvailableProtocols) - temp = (MProtPrintingDevice*) iProtocols[iAvailableProtocols - 1]; - else - temp = (MProtPrintingDevice*) iProtocols[aIndex]; - - LOG("[CProtocolsLoader::GetProtocolAt]\t End"); - return temp; - - } - - -void CProtocolsLoader::Reset() - { - LOG("[CProtocolsLoader::Reset]\t Begin"); - iProtIndex = 0; - LOG("[CProtocolsLoader::Reset]\t End"); - } - - -TInt CProtocolsLoader::GetProtocolIndex() const - { - LOG("[CProtocolsLoader::GetProtocolIndex]\t Begin"); - - TInt retVal = iProtIndex - 1; - // The next check is probably unnecessary since GetNextProtocol() should only leave iProtIndex with - // a value between 1 and iAvailableProtocols - if (retVal < 0) - { - retVal = iProtocols.Count() - 1; - } - LOG1("[CProtocolsLoader::GetProtocolIndex] return: %d", retVal); - LOG("[CProtocolsLoader::GetProtocolIndex]\t End"); - return retVal; - } - - -TUint CProtocolsLoader::SupportedProtocols() const - { - LOG("[CProtocolsLoader::SupportedProtocols]\t Begin"); - LOG1("[CProtocolsLoader::SupportedProtocols] return: %d", iSupportedProtocols); - LOG("[CProtocolsLoader::SupportedProtocols]\t End"); - return iSupportedProtocols; - } - - -CProtocolsLoader::CProtocolsLoader() - { - LOG("[CProtocolsLoader::CProtocolsLoader]\t Begin"); - iAvailableProtocols = 0; - iProtIndex = 0; - iSupportedProtocols = 0; - LOG("[CProtocolsLoader::CProtocolsLoader]\t End"); - } - -void CProtocolsLoader::ConstructL() - { - LOG("[CProtocolsLoader::ConstructL]\t Begin"); - LoadL(); - LOG("[CProtocolsLoader::ConstructL]\t End"); - } - -void CProtocolsLoader::LoadL() - { - LOG("[CProtocolsLoader::LoadL]\t Begin"); - RImplInfoPtrArray infoArray; - REComSession::ListImplementationsL( KImagePrintEcomUid, infoArray ); - CleanupClosePushL( infoArray ); - MProtPrintingDevice* device = NULL; - LOG1("CProtocolsLoader::LoadL infoArray.Count(): %d", infoArray.Count()); - for( TInt i = 0; i < infoArray.Count(); i++ ) - { - LOG1("CProtocolsLoader::LoadL i: %d", i); - TPtrC8 dataType = infoArray[i]->DataType(); - TEComResolverParams resolverParams; - resolverParams.SetDataType( dataType ); - resolverParams.SetWildcardMatch( ETrue ); - TAny* prot = REComSession::CreateImplementationL( KImagePrintEcomUid, - _FOFF( MProtPrintingDevice, iDtor_ID_Key ), NULL, resolverParams ); - device = static_cast(prot); - TCleanupItem clItem( CleanupProt, device ); - CleanupStack::PushL( clItem ); - device->ConstructL( KNullDesC ); - LOG1("CProtocolsLoader::LoadL device->SupportedProtocols(): %d", device->SupportedProtocols()); - iProtocols.AppendL( device ); - iSupportedProtocols |= device->SupportedProtocols(); - CleanupStack::Pop(); // device - device = NULL; - } - - infoArray.ResetAndDestroy(); - CleanupStack::PopAndDestroy(); // infoArray - - iAvailableProtocols = iProtocols.Count(); - LOG("[CProtocolsLoader::LoadL]\t End"); - } - -void CProtocolsLoader::CleanupProt( TAny* aData ) - { - LOG("[CProtocolsLoader::CleanupProt]\t Begin"); - MProtPrintingDevice* prot = (MProtPrintingDevice*)aData; - delete prot; - LOG("[CProtocolsLoader::CleanupProt]\t End"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/crsimageparser.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/crsimageparser.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2004-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: Contains the CRsImageParser class definition. -* -*/ - - -// RsImageParser.cpp: implementation of the CRsImageParser class. -// -////////////////////////////////////////////////////////////////////// - -#include "crsimageparser.h" -#include "clog.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CRsImageParser* CRsImageParser::NewLC() - { - CRsImageParser* self = new (ELeave) CRsImageParser(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - - -void CRsImageParser::ConstructL() - { - User::LeaveIfError(iFs.Connect()); - } - - -CRsImageParser::~CRsImageParser() - { - iFs.Close(); - } - -CRsImageParser::CRsImageParser() - { - } - -void CRsImageParser::ValidateL( const TDesC& aFileName, TBool& aValid, TInt& aErr ) - { - LOG1("CRsImageParser::ValidateL aFileName: %S", &aFileName); - aValid = EFalse; - TInt dataPos( 0 ); - TBuf8<9> imgData; - TBool bAllDone( EFalse ); - TInt height( 0 ); - TInt width( 0 ); - TInt startOfDataOffset( 0 ); - TInt encoding( EUnknown ); - TInt size( 0 ); - - RFile file; - aErr = file.Open( iFs, aFileName, EFileRead | EFileShareReadersOnly ); - LOG1("CRsImageParser::ValidateL file.Open (shareread mode): %d", aErr); - if ( aErr != KErrNone ) - { - aErr = file.Open( iFs, aFileName, EFileRead | EFileShareAny ); - LOG1("CRsImageParser::ValidateL file.Open (shareany mode): %d", aErr); - } - - // magic numbers used here are JPEG format related - else // if ( aErr == KErrNone ) // 1 IF - { - CleanupClosePushL( file ); - aErr = file.Size( size ); - if( size && aErr == KErrNone ) // 2 IF - { - aErr = ReadData( file, dataPos, imgData ); - if( aErr == KErrNone && imgData.Length() == 9 ) // 3 IF - { - // First check for the JPEG header "FF D8" - if( imgData[0] == 0xff && imgData[1] == 0xd8 ) // 4 IF - { - // Start skipping headers until we find the one we're looking for - dataPos = (imgData[4] << 8) + imgData[5] + 4; - - aErr = ReadData( file, dataPos, imgData ); - - while( aErr == KErrNone && imgData.Length() == 9 && imgData[0] == 0xff ) - { - switch( imgData[1] ) - { - case 0xda: - // Start of data - startOfDataOffset = dataPos + ((imgData[2] << 8) + imgData[3] + 2); - bAllDone = ETrue; - break; - - case EDiffArithLossless: - encoding = imgData[1]; - height = (imgData[5] << 8) + imgData[6]; - width = (imgData[7] << 8) + imgData[8]; - break; - - default: - break; - } // SWITCH - - if( bAllDone ) - { - break; - } - else - { - dataPos += (imgData[2] << 8) + imgData[3] + 2; - aErr = ReadData( file, dataPos, imgData ); - } - } // WHILE - } // 4 IF - else - { - // Not a JPG - aErr = KErrCorrupt; - } - } // 3 IF - } // 2 IF - - CleanupStack::PopAndDestroy( &file ); - } // 1 IF - - aValid = Validate( startOfDataOffset, width, height, size, encoding, aErr ); - - LOG1("CRsImageParser::ValidateL aValid: %d", aValid); - LOG1("CRsImageParser::ValidateL aErr: %d", aErr); - LOG("CRsImageParser::ValidateL end"); - } - -TBool CRsImageParser::Validate( TInt aStartOfDataOffset, TInt aWidth, TInt aHeight, TInt aSize, TInt aEncoding, TInt aErr ) - { - if ( aStartOfDataOffset && aWidth && aHeight && aSize && aEncoding && !aErr ) - { - return ETrue; - } - else - { - return EFalse; - } - } - -TInt CRsImageParser::ReadData( RFile& aFile, TInt aStartByte, TDes8& aData ) - { - LOG("CRsImageParser::ReadData begin"); - TInt err = aFile.Read( aStartByte, aData ); - LOG1("CRsImageParser::ReadData return: %d", err); - return err; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserverdiscoveryguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserverdiscoveryguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2004-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 "cserverdiscoveryguard.h" -#include "cimageprintbody.h" -#include "clog.h" -#include "tmessagewrp2.h" - -CServerDiscoveryGuard* CServerDiscoveryGuard::NewL( CImagePrintBody& aEngine ) - { - CServerDiscoveryGuard* self = new ( ELeave ) CServerDiscoveryGuard( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CServerDiscoveryGuard::CServerDiscoveryGuard( CImagePrintBody& aEngine ) : iEngine( aEngine ), - iRequestActive( EFalse ) - { - } - -CServerDiscoveryGuard::~CServerDiscoveryGuard() - { - LOG("CServerDiscoveryGuard::~CServerDiscoveryGuard begin"); - iBuffer.Close(); - LOG("CServerDiscoveryGuard::~CServerDiscoveryGuard end"); - } - -void CServerDiscoveryGuard::ConstructL() - { - } - -TInt CServerDiscoveryGuard::StartL( TMessageWrp2& aMessage ) - { - LOG("CServerDiscoveryGuard::StartL begin"); - iRequestActive = EFalse; - iBuffer.Reset(); - TInt protocols = aMessage.Int0(); - TInt err = iEngine.StartDiscovery( *this, protocols ); - LOG1("CServerDiscoveryGuard::StartL err: %d", err); - return err; - } - -void CServerDiscoveryGuard::ContinueL( TMessageWrp2& aMessage ) - { - LOG("CServerDiscoveryGuard::ContinueL begin"); - if( iMessage ) iMessage->SetDisposable( ETrue ); - iMessage = &aMessage; - iRequestActive = ETrue; - if( iBuffer.Count() ) - { - LOG("CServerDiscoveryGuard::ContinueL before ProcessL"); - ProcessL(); - LOG("CServerDiscoveryGuard::ContinueL after ProcessL"); - } - LOG("CServerDiscoveryGuard::ContinueL end"); - } - -void CServerDiscoveryGuard::Stop() - { - LOG("CServerDiscoveryGuard::Stop begin"); - iBuffer.Reset(); - if( iRequestActive ) - { - LOG("CServerDiscoveryGuard::Stop cancelling..."); - iMessage->Complete( KErrCancel ); - iRequestActive = EFalse; - } - LOG("CServerDiscoveryGuard::Stop end"); - } - -void CServerDiscoveryGuard::FoundPrinterL(const TPrinter& aPrinterInfo) - { - LOG("CServerDiscoveryGuard::FoundPrinterL begin"); - LOG1("CServerDiscoveryGuard::FoundPrinterL aPrinterInfo.iProtocol: %d", aPrinterInfo.iProtocol); - LOG1("CServerDiscoveryGuard::FoundPrinterL aPrinterInfo.iProperties: %d", aPrinterInfo.iProperties); - LOG1("CServerDiscoveryGuard::FoundPrinterL aPrinterInfo.iPrinterID: %d", aPrinterInfo.iPrinterID); - LOG1("CServerDiscoveryGuard::FoundPrinterL aPrinterInfo.iDisplayName: %S", &(aPrinterInfo.iDisplayName)); - LOG1("CServerDiscoveryGuard::FoundPrinterL aPrinterInfo.iVendor: %d", aPrinterInfo.iVendor); - TDiscoveryGuardData data; - data.iCb = TDiscoveryGuardData::EFoundCb; - data.iPrinterInfo = aPrinterInfo; - User::LeaveIfError( iBuffer.Append( data ) ); - ProcessL(); - LOG("CServerDiscoveryGuard::FoundPrinterL end"); - } - -void CServerDiscoveryGuard::DiscoveryStatusL(TInt aStatus, TInt aErrorCode, TInt aErrorStringCode) - { - LOG("CServerDiscoveryGuard::DiscoveryStatusL begin"); - LOG1("CServerDiscoveryGuard::DiscoveryStatusL aStatus: %d", aStatus); - LOG1("CServerDiscoveryGuard::DiscoveryStatusL aErrorCode: %d", aErrorCode); - LOG1("CServerDiscoveryGuard::DiscoveryStatusL aErrorStringCode: %d", aErrorStringCode); - TDiscoveryGuardData data; - data.iCb = TDiscoveryGuardData::EStatusCb; - data.iStatus = aStatus; - data.iErrorCode = aErrorCode; - data.iErrorStringCode = aErrorStringCode; - User::LeaveIfError( iBuffer.Append( data ) ); - ProcessL(); - LOG("CServerDiscoveryGuard::DiscoveryStatusL end"); - } - -void CServerDiscoveryGuard::RemovePrinterL(const TPrinter& aPrinterInfo) - { - LOG("CServerDiscoveryGuard::RemovePrinterL begin"); - LOG1("CServerDiscoveryGuard::RemovePrinterL aPrinterInfo.iProtocol: %d", aPrinterInfo.iProtocol); - LOG1("CServerDiscoveryGuard::RemovePrinterL aPrinterInfo.iProperties: %d", aPrinterInfo.iProperties); - LOG1("CServerDiscoveryGuard::RemovePrinterL aPrinterInfo.iPrinterID: %d", aPrinterInfo.iPrinterID); - LOG1("CServerDiscoveryGuard::RemovePrinterL aPrinterInfo.iDisplayName: %S", &(aPrinterInfo.iDisplayName)); - TDiscoveryGuardData data; - data.iCb = TDiscoveryGuardData::ERemoveCb; - data.iPrinterInfo = aPrinterInfo; - User::LeaveIfError( iBuffer.Append( data ) ); - ProcessL(); - LOG("CServerDiscoveryGuard::RemovePrinterL end"); - } - -void CServerDiscoveryGuard::ProcessL() - { - LOG("CServerDiscoveryGuard::ProcessL begin"); - if( iBuffer.Count() && iRequestActive ) - { - LOG("CServerDiscoveryGuard::ProcessL step 1"); - TPtr8 ptr(reinterpret_cast(&(iBuffer[0])), sizeof(iBuffer[0]), sizeof(iBuffer[0])); - LOG("CServerDiscoveryGuard::ProcessL step 2"); - iMessage->WriteL( 0, ptr ); - LOG("CServerDiscoveryGuard::ProcessL step 3"); - iMessage->Complete( KErrNone ); - LOG("CServerDiscoveryGuard::ProcessL step 4"); - iRequestActive = EFalse; - LOG("CServerDiscoveryGuard::ProcessL step 5"); - iBuffer.Remove( 0 ); - LOG("CServerDiscoveryGuard::ProcessL step 6"); - } - LOG("CServerDiscoveryGuard::ProcessL end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserveridleguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserveridleguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2004-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 "cserveridleguard.h" -#include "cimageprintbody.h" -#include "tidleevent.h" -#include "clog.h" -#include "tmessagewrp2.h" - -CServerIdleGuard* CServerIdleGuard::NewL( CImagePrintBody& aEngine ) - { - CServerIdleGuard* self = new ( ELeave ) CServerIdleGuard( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CServerIdleGuard::CServerIdleGuard( CImagePrintBody& aEngine ) : iEngine( aEngine ), - iRequestActive( EFalse ) - { - } - -CServerIdleGuard::~CServerIdleGuard() - { - LOG("CServerIdleGuard::~CServerIdleGuard begin"); - iBuffer.Close(); - LOG("CServerIdleGuard::~CServerIdleGuard end"); - } - -void CServerIdleGuard::ConstructL() - { - } - -void CServerIdleGuard::StatusEvent( const TEvent &aEvent, TInt aError, TInt aMsgCode ) - { - LOG("CServerIdleGuard::StatusEvent begin"); - LOG1("CServerIdleGuard::StatusEvent aError: %d", aError); - LOG1("CServerIdleGuard::StatusEvent aMsgCode: %d", aMsgCode); - LOG1("CServerIdleGuard::StatusEvent aEvent.iProtocol: %d", aEvent.iProtocol); - LOG1("CServerIdleGuard::StatusEvent aEvent.iSeverity: %d", aEvent.iSeverity); - LOG1("CServerIdleGuard::StatusEvent aEvent.iEventType: %d", aEvent.iEventType); - TRAPD( err, DoStatusEventL( aEvent, aError, aMsgCode ) ); - LOG1("CServerIdleGuard::StatusEvent DoStatusEventL's TRAP err: %d", err); - Process( err ); - LOG("CServerIdleGuard::StatusEvent end"); - } - -void CServerIdleGuard::Guard( TMessageWrp2& aMessage ) - { - LOG("CServerIdleGuard::Guard begin"); - if( iMessage ) iMessage->SetDisposable( ETrue ); - iMessage = &aMessage; - iRequestActive = ETrue; - iEngine.RegisterIdleObserver( this ); - if( iBuffer.Count() ) - { - LOG("CServerIdleGuard::Guard before Process"); - Process(); - LOG("CServerIdleGuard::Guard after Process"); - } - LOG("CServerIdleGuard::Guard end"); - } - -void CServerIdleGuard::Stop() - { - LOG("CServerIdleGuard::Stop begin"); - if( iRequestActive ) - { - LOG("CServerIdleGuard::Stop cancelling..."); - iMessage->Complete( KErrCancel ); - iRequestActive = EFalse; - } - iEngine.RegisterIdleObserver( NULL ); - LOG("CServerIdleGuard::Stop end"); - } - -void CServerIdleGuard::DoStatusEventL( const TEvent &aEvent, TInt aError, TInt aMsgCode ) - { - LOG("CServerIdleGuard::DoStatusEventL begin"); - TIdleGuardData data; - data.iEvent = aEvent; - data.iError = aError; - data.iMsgCode = aMsgCode; - User::LeaveIfError( iBuffer.Append( data ) ); - LOG("CServerIdleGuard::DoStatusEventL end"); - } - -void CServerIdleGuard::Process( TInt aErr ) - { - LOG("CServerIdleGuard::Process begin"); - if( aErr ) - { - LOG1("CServerIdleGuard::Process aErr: %d", aErr); - iMessage->Complete( aErr ); - iRequestActive = EFalse; - } - else - { - LOG("CServerIdleGuard::Process calling DoProcessL"); - TRAPD( err, DoProcessL() ); - LOG1("CServerIdleGuard::Process DoProcessL's TRAP err: %d", err); - if( err ) - { - iMessage->Complete( err ); - iRequestActive = EFalse; - } - } - LOG("CServerIdleGuard::Process end"); - } - -void CServerIdleGuard::DoProcessL() - { - LOG("CServerIdleGuard::DoProcessL begin"); - if( iBuffer.Count() && iRequestActive ) - { - LOG("CServerIdleGuard::DoProcessL step 1"); - TPtr8 ptr(reinterpret_cast(&(iBuffer[0])), sizeof(iBuffer[0]), sizeof(iBuffer[0])); - LOG("CServerIdleGuard::DoProcessL step 2"); - iMessage->WriteL( 0, ptr ); - LOG("CServerIdleGuard::DoProcessL step 3"); - iMessage->Complete( KErrNone ); - LOG("CServerIdleGuard::DoProcessL step 4"); - iRequestActive = EFalse; - LOG("CServerIdleGuard::DoProcessL step 5"); - iBuffer.Remove( 0 ); - LOG("CServerIdleGuard::DoProcessL step 6"); - } - LOG("CServerIdleGuard::DoProcessL end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserverjobguard.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/cserverjobguard.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2004-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 "cserverjobguard.h" -#include "cimageprintbody.h" -#include "clog.h" -#include "tmessagewrp2.h" - -CServerJobGuard* CServerJobGuard::NewL( CImagePrintBody& aEngine ) - { - CServerJobGuard* self = new ( ELeave ) CServerJobGuard( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; - } - -CServerJobGuard::CServerJobGuard( CImagePrintBody& aEngine ) : iEngine( aEngine ), - iRequestActive( EFalse ) - { - } - -CServerJobGuard::~CServerJobGuard() - { - LOG("CServerJobGuard::~CServerJobGuard begin"); - iImages.ResetAndDestroy(); - iImages.Close(); - iBuffer.Close(); - LOG("CServerJobGuard::~CServerJobGuard end"); - } - -void CServerJobGuard::ConstructL() - { - } - -void CServerJobGuard::PrepareL( TMessageWrp2& aMessage ) - { - LOG("CServerJobGuard::PrepareL begin"); - TInt len = aMessage.GetDesLength( 0 ); - HBufC* buf = HBufC::NewLC( len ); - TPtr ptr( buf->Des() ); - aMessage.ReadL( 0, ptr ); - iImages.AppendL( buf ); - CleanupStack::Pop(); // buf - LOG("CServerJobGuard::PrepareL end"); - } - -void CServerJobGuard::Stop() - { - LOG("CServerJobGuard::Stop begin"); - iImages.ResetAndDestroy(); - if( iRequestActive ) - { - LOG("CServerJobGuard::Stop cancelling..."); - iMessage->Complete( KErrCancel ); - iRequestActive = EFalse; - } - LOG("CServerJobGuard::Stop end"); - } - -TInt CServerJobGuard::CreateL( TMessageWrp2& aMessage ) - { - LOG("CServerJobGuard::CreateL begin"); - iRequestActive = EFalse; - iBuffer.Reset(); - TInt printer = aMessage.Int0(); - TInt err = iEngine.CreatePrintJobL( printer, iImages, *this ); - LOG1("CServerJobGuard::CreateL err: %d", err); - if( err ) - { - iImages.ResetAndDestroy(); - } - LOG1("CServerJobGuard::CreateL return: %d", err); - return err; - } - -void CServerJobGuard::ContinueCreateL( TMessageWrp2& aMessage ) - { - LOG("CServerJobGuard::ContinueCreateL begin"); - if( iMessage ) iMessage->SetDisposable( ETrue ); - iMessage = &aMessage; - iRequestActive = ETrue; - if( iBuffer.Count() ) - { - LOG("CServerJobGuard::ContinueCreateL before ProcessL"); - Process(); - LOG("CServerJobGuard::ContinueCreateL after ProcessL"); - } - LOG("CServerJobGuard::ContinueCreateL end"); - } - -void CServerJobGuard::PrintJobProgressEvent(TInt aStatus, TInt aPercentCompletion, TInt aJobStateCode) - { - LOG("CServerJobGuard::PrintJobProgressEvent begin"); - LOG1("CServerJobGuard::PrintJobProgressEvent aStatus: %d", aStatus); - LOG1("CServerJobGuard::PrintJobProgressEvent aPercentCompletion: %d", aPercentCompletion); - LOG1("CServerJobGuard::PrintJobProgressEvent aJobStateCode: %d", aJobStateCode); - TJobGuardData data; - data.iCb = TJobGuardData::EProgressEventCb; - data.iStatus = aStatus; - data.iPercentCompletion = aPercentCompletion; - data.iJobStateCode = aJobStateCode; - TRAPD( err, DoPreProcessL( data ) ); - LOG1("CServerJobGuard::PrintJobProgressEvent DoPreProcessL's TRAP err: %d", err); - Process( err ); - LOG("CServerJobGuard::PrintJobProgressEvent end"); - } - -void CServerJobGuard::PrintJobErrorEvent(TInt aError, TInt aErrorStringCode) - { - LOG("CServerJobGuard::PrintJobErrorEvent begin"); - LOG1("CServerJobGuard::PrintJobErrorEvent aError: %d", aError); - LOG1("CServerJobGuard::PrintJobErrorEvent aErrorStringCode: %d", aErrorStringCode); - TJobGuardData data; - data.iCb = TJobGuardData::EErrorEventCb; - data.iError = aError; - data.iErrorStringCode = aErrorStringCode; - TRAPD( err, DoPreProcessL( data ) ); - LOG1("CServerJobGuard::PrintJobErrorEvent DoPreProcessL's TRAP err: %d", err); - Process( err ); - LOG("CServerJobGuard::PrintJobErrorEvent end"); - } - -void CServerJobGuard::PrinterStatusEvent(TInt aError, TInt aErrorStringCode) - { - LOG("CServerJobGuard::PrinterStatusEvent begin"); - LOG1("CServerJobGuard::PrinterStatusEvent aError: %d", aError); - LOG1("CServerJobGuard::PrinterStatusEvent aErrorStringCode: %d", aErrorStringCode); - TJobGuardData data; - data.iCb = TJobGuardData::EStatusEventCb; - data.iError = aError; - data.iErrorStringCode = aErrorStringCode; - TRAPD( err, DoPreProcessL( data ) ); - LOG1("CServerJobGuard::PrinterStatusEvent DoPreProcessL's TRAP err: %d", err); - Process( err ); - LOG("CServerJobGuard::PrinterStatusEvent end"); - } - -void CServerJobGuard::PreviewImageEvent(TInt aFsBitmapHandle) - { - LOG("CServerJobGuard::PreviewImageEvent begin"); - LOG1("CServerJobGuard::PreviewImageEvent aFsBitmapHandle: %d", aFsBitmapHandle); - TJobGuardData data; - data.iCb = TJobGuardData::EImageEventCb; - data.iFsBitmapHandle = aFsBitmapHandle; - TRAPD( err, DoPreProcessL( data ) ); - LOG1("CServerJobGuard::PreviewImageEvent DoPreProcessL's TRAP err: %d", err); - Process( err ); - LOG("CServerJobGuard::PreviewImageEvent end"); - } - -void CServerJobGuard::DoPreProcessL( const TJobGuardData& aData ) - { - LOG("CServerJobGuard::DoPreProcessL begin"); - User::LeaveIfError( iBuffer.Append( aData ) ); - LOG("CServerJobGuard::DoPreProcessL end"); - } - -void CServerJobGuard::DoProcessL() - { - LOG("CServerJobGuard::ProcessL begin"); - if( iBuffer.Count() && iRequestActive ) - { - LOG("CServerJobGuard::DoProcessL step 1"); - TPtr8 ptr(reinterpret_cast(&(iBuffer[0])), sizeof(iBuffer[0]), sizeof(iBuffer[0])); - LOG("CServerJobGuard::DoProcessL step 2"); - iMessage->WriteL( 0, ptr ); - LOG("CServerJobGuard::DoProcessL step 3"); - iMessage->Complete( KErrNone ); - LOG("CServerJobGuard::DoProcessL step 4"); - iRequestActive = EFalse; - LOG("CServerJobGuard::DoProcessL step 5"); - iBuffer.Remove( 0 ); - LOG("CServerJobGuard::DoProcessL step 6"); - } - LOG("CServerJobGuard::ProcessL end"); - } - -void CServerJobGuard::Process( TInt aErr ) - { - LOG("CServerJobGuard::Process begin"); - if( aErr ) - { - LOG1("CServerJobGuard::Process aErr: %d", aErr); - iMessage->Complete( aErr ); - iRequestActive = EFalse; - } - else - { - LOG("CServerJobGuard::Process calling DoProcessL"); - TRAPD( err, DoProcessL() ); - LOG1("CServerJobGuard::Process DoProcessL's TRAP err: %d", err); - if( err ) - { - iMessage->Complete( err ); - iRequestActive = EFalse; - } - } - LOG("CServerJobGuard::Process end"); - } - - - -// DEPRECATED - -void CServerJobGuard::ShowMessageL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ ) - { - } - -TBool CServerJobGuard::AskYesNoQuestionL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ ) - { - return EFalse; - } - -const TDesC& CServerJobGuard::AskForInputL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ ) - { - return KNullDesC; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/main.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/main.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "imageprintclientserver.h" -#include "cimageprintserver.h" -#include "cimageprintscheduler.h" -#include "clog.h" - -// init and run the server -static void RunTheServerL() - { -#ifndef __SECURE_API__ - User::LeaveIfError( RThread().Rename( KImagePrintServerName ) ); //Deprecated! Replace this with the line below as soon as possible -#else - User::LeaveIfError( RThread().RenameMe( KImagePrintServerName ) ); -#endif - - CActiveScheduler* scheduler = new (ELeave) CImagePrintScheduler; - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); - - CImagePrintServer::NewLC(); - - RProcess::Rendezvous( KErrNone ); - - CActiveScheduler::Start(); - CleanupStack::PopAndDestroy( 2 ); // CImagePrintServer, scheduler - } - -// Server process entry-point -TInt E32Main() - { - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt r( KErrNoMemory ); - if( cleanup ) - { - TRAP( r, RunTheServerL() ); - delete cleanup; - } - return r; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/tmessagewrp2.cpp --- a/ImagePrint/ImagePrintEngine/ImagePrintServer/src/server/tmessagewrp2.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "tmessagewrp2.h" -#include "clog.h" - -TMessageWrp2::TMessageWrp2( const RMessage2& aMessage, - const TBool& aConnected ) : - iConnected( aConnected ), - iDisposable( EFalse ) - - { - iMessage = aMessage; - } - -void TMessageWrp2::WriteL(TInt aParam, const TDesC8 &aDes, TInt aOffset) const - { - LOG("TMessageWrp2::WriteL begin"); - LOG1("TMessageWrp2::WriteL iConnected: %d", iConnected); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::WriteL iMessage.Function(): %d", iMessage.Function()); - iMessage.WriteL( aParam, aDes, aOffset ); - } - LOG("TMessageWrp2::WriteL end"); - } - -void TMessageWrp2::Complete(TInt aReason) const - { - LOG("TMessageWrp2::Complete begin"); - LOG1("TMessageWrp2::Complete iConnected: %d", iConnected); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::Complete iMessage.Function(): %d", iMessage.Function()); - iMessage.Complete( aReason ); - } - LOG("TMessageWrp2::Complete end"); - } - -TInt TMessageWrp2::Int0() const - { - LOG("TMessageWrp2::Int0 begin"); - LOG1("TMessageWrp2::Int0 iConnected: %d", iConnected); - TInt value( 0 ); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::Int0 iMessage.Function(): %d", iMessage.Function()); - value = iMessage.Int0(); - } - LOG("TMessageWrp2::Int0 end"); - return value; - } - -TInt TMessageWrp2::Int1() const - { - LOG("TMessageWrp2::Int1 begin"); - LOG1("TMessageWrp2::Int1 iConnected: %d", iConnected); - TInt value( 0 ); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::Int1 iMessage.Function(): %d", iMessage.Function()); - value = iMessage.Int1(); - } - LOG("TMessageWrp2::Int1 end"); - return value; - } - -TInt TMessageWrp2::GetDesLength(TInt aParam) const - { - LOG("TMessageWrp2::GetDesLength begin"); - LOG1("TMessageWrp2::GetDesLength iConnected: %d", iConnected); - TInt value( 0 ); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::GetDesLength iMessage.Function(): %d", iMessage.Function()); - value = iMessage.GetDesLength( aParam ); - } - LOG("TMessageWrp2::GetDesLength end"); - return value; - } - -void TMessageWrp2::ReadL(TInt aParam, TDes8 &aDes, TInt aOffset) const - { - LOG("TMessageWrp2::ReadL TDes8 begin"); - LOG1("TMessageWrp2::ReadL TDes8 iConnected: %d", iConnected); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::ReadL TDes8 iMessage.Function(): %d", iMessage.Function()); - iMessage.ReadL( aParam, aDes, aOffset ); - } - LOG("TMessageWrp2::ReadL TDes8 end"); - } - -void TMessageWrp2::ReadL(TInt aParam, TDes16 &aDes, TInt aOffset) const - { - LOG("TMessageWrp2::ReadL TDes16 begin"); - LOG1("TMessageWrp2::ReadL TDes16 iConnected: %d", iConnected); - if( !iMessage.IsNull() && iConnected ) - { - LOG1("TMessageWrp2::ReadL TDes16 iMessage.Function(): %d", iMessage.Function()); - iMessage.ReadL( aParam, aDes, aOffset ); - } - LOG("TMessageWrp2::ReadL TDes16 end"); - } - -TInt TMessageWrp2::Function() const - { - return iMessage.Function(); - } - -void TMessageWrp2::SetDisposable( TBool aDisposable ) - { - iDisposable = aDisposable; - } - -TBool TMessageWrp2::Disposable() const - { - return iDisposable; - } - -void TMessageWrp2::Panic(const TDesC &aCategory, TInt aReason) const - { - iMessage.Panic( aCategory, aReason ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/group/bld.inf --- a/ImagePrint/ImagePrintEngine/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS - -../DeviceProtocols/rom/deviceprotocols.iby CORE_APP_LAYER_IBY_EXPORT_PATH(deviceprotocols.iby) -../rom/imageprintengine.iby CORE_APP_LAYER_IBY_EXPORT_PATH(imageprintengine.iby) -../ImagePrintServer/rom/imageprintserver.iby CORE_APP_LAYER_IBY_EXPORT_PATH(imageprintserver.iby) - -../DeviceProtocols/btprotocol/data/btxmltemplate.txt /epoc32/data/z/resource/imageprintdata/protocols/btxmltemplate.txt -../DeviceProtocols/xhtmlfilecomposer/data/xhtmlfiletemplate.txt /epoc32/data/z/resource/imageprintdata/protocols/xhtmltempl/xhtmlfiletemplate.txt - -PRJ_PLATFORMS -WINSCW ARMV5 - -PRJ_MMPFILES - -../ImagePrintServer/group/imageprintclient.mmp -../ImagePrintServer/group/imageprintserver.mmp - -../DeviceProtocols/xhtmlfilecomposer/group/xhtmlfilecomposer.mmp -../DeviceProtocols/dpof/group/dpofprotdll.mmp -../DeviceProtocols/btprotocol/group/btprotocol.mmp -../DeviceProtocols/pictbridge2/group/pdphotolib.mmp -//../DeviceProtocols/upnpprotocolfw2/group/upnpprotocol.mmp - - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/inc/logdef.h --- a/ImagePrint/ImagePrintEngine/inc/logdef.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2004-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 LOGDEF_H -#define LOGDEF_H - -#ifdef _DEBUG -// logging is always enabled in debug builds -#define ENABLE_LOGGING -#else -// manually enable in release builds -//#define ENABLE_LOGGING -#endif // _DEBUG - -//#define LOG_TO_FILE - -#endif // LOGDEF_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintEngine/rom/imageprintengine.iby --- a/ImagePrint/ImagePrintEngine/rom/imageprintengine.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTENGINE_IBY -#define IMAGEPRINTENGINE_IBY - -#include -#include - -#endif // IMAGEPRINTENGINE_IBY \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/group/bld.inf --- a/ImagePrint/ImagePrintUI/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004-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 "../imageprinteng/group/bld.inf" -#include "../imageprintapp/group/bld.inf" -#include "../imgpprintdll/group/bld.inf" -#include "../imageprintprovider/group/bld.inf" - -PRJ_EXPORTS - -../rom/desw_imageprintui.iby CORE_APP_LAYER_IBY_EXPORT_PATH( desw_imageprintui.iby ) -../rom/imageprintresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( imageprintresources.iby ) - -PRJ_PLATFORMS -DEFAULT - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/aif.mbm Binary file ImagePrint/ImagePrintUI/imageprintapp/aif/aif.mbm has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/context_pane_icon_44x44.bmp Binary file ImagePrint/ImagePrintUI/imageprintapp/aif/context_pane_icon_44x44.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/context_pane_icon_44x44_mask_soft.bmp Binary file ImagePrint/ImagePrintUI/imageprintapp/aif/context_pane_icon_44x44_mask_soft.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/imageprintappaif.rss --- a/ImagePrint/ImagePrintUI/imageprintapp/aif/imageprintappaif.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 - -RESOURCE AIF_DATA - { - app_uid = 0x101FFA84; - num_icons = 2; - embeddability = KAppNotEmbeddable; - hidden = KAppIsHidden; - newfile = KAppDoesNotSupportNewFile; - } - -// End of File \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/list_icon_42x29.bmp Binary file ImagePrint/ImagePrintUI/imageprintapp/aif/list_icon_42x29.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/aif/list_icon_42x29_mask_soft.bmp Binary file ImagePrint/ImagePrintUI/imageprintapp/aif/list_icon_42x29_mask_soft.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/2x2inchsmall.bmp Binary file ImagePrint/ImagePrintUI/imageprintapp/data/2x2inchsmall.bmp has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/imageprintapp.rss --- a/ImagePrint/ImagePrintUI/imageprintapp/data/imageprintapp.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,522 +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: -* -*/ - - -// RESOURCE IDENTIFIER -NAME IGPR // 4 letter ID - -// INCLUDES - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "imageprintapp.hrh" - -// Maximum and minimum number -#define MIN_TINT_NAME -2147483646 -#define MAX_TINT_NAME 2147483647 - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf="ImagePrint"; } - -/** - * Application resource - */ -RESOURCE EIK_APP_INFO - { - menubar = r_settings_view_menubar; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -/** - * Main view resource - */ -RESOURCE AVKON_VIEW r_settings_view - { - menubar = r_settings_view_menubar; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -RESOURCE AVKON_VIEW r_empty_view - { - menubar = R_AVKON_MENUPANE_EMPTY; - cba = R_AVKON_SOFTKEYS_EMPTY; - } - -/** - * Main view menubar - */ -RESOURCE MENU_BAR r_settings_view_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_profile_list_view_menu; - txt = " "; // Won't be visible, "Options" is shown - } - }; - } - -/** - * Main view menupane - */ -RESOURCE MENU_PANE r_profile_list_view_menu - { - items = - { - MENU_ITEM - { - command = ESettingsChangeItem; - txt = qtn_print_settings_opt_change; - flags = EEikMenuItemAction;//Add for Single click event - }, - MENU_ITEM - { - command = ESettingsPrint; - txt = qtn_print_menu_opt_print; - }, - MENU_ITEM - { - command = ECmdPrintHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = ESettingsExit; - txt = qtn_print_menu_opt_exit; - } - }; - } - -RESOURCE LOCALISABLE_APP_INFO r_imageprintapp_localisable_app_info - { - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_app_caption_string; - number_of_icons = 1; - icon_file = APP_BITMAP_DIR"\\imageprintapp_aif.mif"; - }; - } - -/** - * Dialog resource for print progress note - */ -RESOURCE DIALOG r_print_progress_prog_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EBitmapCtrl; - id = EBrandingBitmap; - }, - DLG_LINE - { - type = EAknCtNote; - id = EPrintWaitNote; - control = AVERELL_NOTE - { - layout = EProgressLayout; - singular_label = qtn_print_progress_prompt; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -/** - * Dialog resource for plain print progress note - */ -RESOURCE DIALOG r_print_progress_plain_prog_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EPrintWaitNote; - control = AVERELL_NOTE - { - layout = EProgressLayout; - singular_label = qtn_print_progress_prompt; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -/** - * MMC printing completed dialog - */ -RESOURCE DIALOG r_mmc_printing_completed - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | - EEikDialogFlagCbaButtons; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EPrintProgressNote; - control = AVKON_NOTE - { - layout = EConfirmationLayout; - singular_label = qtn_print_mmc_print_note; - }; - } - }; - } - -/** - * Connect USB printer dialog - */ -RESOURCE DIALOG r_connect_usb - { - flags = EAknInformationNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteNoType; - control = AVKON_NOTE - { - layout = ENoteWithImageLayout; - singular_label = qtn_print_connect_usb_note; - }; - } - }; - } - -/** - * Confirmation dialog for "no printers" note - */ -RESOURCE DIALOG r_no_printers_confirmation - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = ENoPrintersConfirmation; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - }; - } - }; - } - -RESOURCE DIALOG r_cancel_printing_dialog - { - flags = EAknWaitNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = 1; - control= AVKON_NOTE - { - layout = EWaitLayout; - animation =R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// Image array for pop-up animation -RESOURCE ARRAY r_imageprint_animation_images - { - items = - { - BMPANIM_FRAME { bmpid=18; maskid=19; }, - BMPANIM_FRAME { bmpid=16; maskid=17; }, - BMPANIM_FRAME { bmpid=20; maskid=21; }, - BMPANIM_FRAME { bmpid=16; maskid=17; } - }; - } - -RESOURCE ARRAY r_bt_animation_for_popuplist_images - { - items= - { - BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup_2; maskid=EMbmBtnotifQgn_note_bt_popup_2_mask; }, - BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup; maskid=EMbmBtnotifQgn_note_bt_popup_mask; }, - BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup_3; maskid=EMbmBtnotifQgn_note_bt_popup_3_mask; }, - BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup; maskid=EMbmBtnotifQgn_note_bt_popup_mask; } - }; - } - -// Animation for searching devices popup-list -RESOURCE BMPANIM_DATA r_imageprint_animation - { - frameinterval = 200; - playmode = EAknBitmapAnimationPlayModeCycle; - bmpfile = APP_BITMAP_DIR"\\btnotif.mbm"; - frames = r_bt_animation_for_popuplist_images; - } - -/** - * Generic popup setting item - */ -RESOURCE AVKON_SETTING_PAGE r_setting_generic_protocol_page - { - //softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL;// removed due to single click - softkey_resource = R_AVKON_SOFTKEYS_CANCEL ; - type = EAknCtPopupSettingList; - editor_resource_id = r_empty_protocol_setting_list; - } - -RESOURCE POPUP_SETTING_LIST r_empty_protocol_setting_list - { - } - -RESOURCE CBA r_avkon_softkeys_stop - { - buttons = - { - CBA_BUTTON - { - txt = " "; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; - txt= qtn_clk_softkey_stop; - } - }; - } - - - -/** - * - * Resource strings - * - */ - -RESOURCE TBUF r_settings_imageprint_mmc_print_note { buf = qtn_print_mmc_print_note; } -RESOURCE TBUF r_settings_imageprint_mmc_print_note_one_picture { buf = qtn_print_mmc_print_note_one_picture; } -RESOURCE TBUF r_txt_imageprint_title_printsettings { buf = qtn_app_caption_string; } -RESOURCE TBUF r_printjob_images { buf = qtn_printjob_images; } -RESOURCE TBUF r_printjob_image { buf = qtn_printjob_image; } -RESOURCE TBUF r_print_selected_printer { buf = qtn_print_selected_printer; } -RESOURCE TBUF r_print_memory_card { buf = qtn_print_memory_card; } -RESOURCE TBUF r_print_no_printer { buf = qtn_print_no_printer; } - -RESOURCE TBUF r_qtn_print_progress_note_title { buf = qtn_print_progress_prompt; } -RESOURCE TBUF r_qtn_print_not_found_error { buf = qtn_print_not_found_error; } -RESOURCE TBUF r_qtn_print_no_printers { buf = qtn_print_no_printers; } -RESOURCE TBUF r_qtn_print_settings_default_usb { buf = qtn_print_settings_default_usb; } -RESOURCE TBUF r_qtn_print_settings_default_bt { buf = qtn_print_settings_default_bt; } -RESOURCE TBUF r_qtn_print_settings_default_wlan { buf = qtn_print_settings_default_wlan; } -RESOURCE TBUF r_qtn_print_wrongtype_note { buf = qtn_print_wrongtype_note; } -RESOURCE TBUF r_qtn_print_selectnew_note { buf = qtn_print_selectnew_note; } -RESOURCE TBUF r_qtn_print_concurrent_note { buf = qtn_print_concurrent_note; } -RESOURCE TBUF r_qtn_print_memory_card { buf = qtn_print_memory_card; } -RESOURCE TBUF r_qtn_print_settings_noc {buf = qtn_print_settings_noc; } -RESOURCE TBUF r_qtn_print_progress_prompt_cancel { buf = qtn_print_progress_prompt_cancel; } - -RESOURCE TBUF r_qtn_popup_list_title { buf = qtn_print_selectprinter_prompt; } -RESOURCE TBUF r_qtn_copy_progress_note_title { buf = qtn_print_progress_prompt_mmc; } -RESOURCE TBUF r_qtn_popup_list_title2 { buf = qtn_print_selectprinter_prompt2; } -RESOURCE TBUF r_qtn_search_again { buf = qtn_print_search_again; } - -RESOURCE TBUF r_note_imageprint_error_ink_out { buf = qtn_print_outofink_error; } -RESOURCE TBUF r_note_imageprint_error_paper_load { buf = qtn_print_paper_load_error; } -RESOURCE TBUF r_note_imageprint_error_paper_eject { buf = qtn_print_paper_eject_error; } -RESOURCE TBUF r_note_imageprint_error_paper_media { buf = qtn_print_paper_media_error; } -RESOURCE TBUF r_note_imageprint_error_paper_jam { buf = qtn_print_paper_jam_error; } -RESOURCE TBUF r_note_imageprint_error_paper_combination { buf = qtn_print_paper_combination_error; } -RESOURCE TBUF r_note_imageprint_error_paper_low { buf = qtn_print_paper_low_error; } -RESOURCE TBUF r_note_imageprint_error_paper { buf = qtn_print_paper_error; } -RESOURCE TBUF r_note_imageprint_error_ink_low { buf = qtn_print_inklow_error; } -RESOURCE TBUF r_note_imageprint_error_ink_waste { buf = qtn_print_ink_waste_error; } -RESOURCE TBUF r_note_imageprint_error_ink { buf = qtn_print_ink_error; } -RESOURCE TBUF r_note_imageprint_error_file_decode { buf = qtn_print_file_decode_error; } -RESOURCE TBUF r_note_imageprint_error_file { buf = qtn_print_file_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_cover_open { buf = qtn_print_hardware_cover_open_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_fatal { buf = qtn_print_hardware_fatal_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_servicecall { buf = qtn_print_hardware_servicecall_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_printer_unavailable { buf = qtn_print_hardware_printer_unavailable_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_printer_busy { buf = qtn_print_hardware_printer_busy_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_lever { buf = qtn_print_hardware_lever_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_no_marking_agent { buf = qtn_print_hardware_no_marking_agent_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_ink_cover_open { buf = qtn_print_hardware_ink_cover_open_error; } -RESOURCE TBUF r_note_imageprint_error_hardware_no_ink_cartridge { buf = qtn_print_hardware_no_ink_cartridge_error; } -RESOURCE TBUF r_note_imageprint_error_hardware { buf = qtn_print_hardware_error; } -RESOURCE TBUF r_note_imageprint_error_output_area_almost_full { buf = qtn_print_output_area_almost_full_error; } -RESOURCE TBUF r_note_imageprint_error_output_area_full { buf = qtn_print_output_area_full_error; } -RESOURCE TBUF r_note_imageprint_error_marker_supply_low { buf = qtn_print_marker_supply_low_error; } -RESOURCE TBUF r_note_imageprint_error_marker_supply_empty { buf = qtn_print_marker_supply_empty_error; } -RESOURCE TBUF r_note_imageprint_error_marker_failure { buf = qtn_print_marker_failure_error; } -RESOURCE TBUF r_note_imageprint_error_printer_paused { buf = qtn_print_paused_error; } -RESOURCE TBUF r_note_imageprint_error_paper_out { buf = qtn_print_outofpaper_error; } - -RESOURCE TBUF r_note_print_status_error { buf = qtn_print_status_error; } -RESOURCE TBUF r_note_send_print_error { buf = qtn_print_send_error; } -RESOURCE TBUF r_note_disconnect_print_error { buf = qtn_print_disconnect_error; } -RESOURCE TBUF r_note_general_print_error { buf = qtn_print_general_error; } -RESOURCE TBUF r_note_connect_print_error { buf = qtn_print_connect_error; } -RESOURCE TBUF r_note_imageprint_mmccopyfail { buf = qtn_print_note_mmccopyfail; } - -RESOURCE ARRAY r_default_printer_selection_popup_texts - { - items = - { - LBUF - { - txt = qtn_print_settings_default_bt; - }, - LBUF - { - txt = qtn_print_memory_card; - }, - LBUF - { - txt = qtn_print_settings_default_usb; - }, - LBUF - { - txt = qtn_print_settings_default_wlan; - } - }; - } - -RESOURCE DIALOG r_hidden_dialog - { - flags = EAknWaitNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVERELL_NOTE - { - layout = EWaitLayout; - singular_label = qtn_print_progress_prompt_pro; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_startwait_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVERELL_NOTE - { - layout = EWaitLayout; - singular_label = qtn_print_progress_prompt_pro; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_launch_wlan_wizard_query - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = qtn_launch_wlan_wizard_query_header; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = qtn_launch_wlan_wizard_query_msg; - }; - } - }; - } - -// Image print number of copies dialog resource. - -RESOURCE DIALOG r_noc_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ENumberLayout; - label = qtn_print_settings_noc; - control = AVKON_INTEGER_EDWIN - { - min = 1; - max = 999; - maxlength = 3; - unset_value=1; - }; - }; - } - }; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/imageprintapp_caption.rss --- a/ImagePrint/ImagePrintUI/imageprintapp/data/imageprintapp_caption.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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 -#include - -RESOURCE CAPTION_DATA -{ - caption=qtn_app_caption_string; -} diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_indi_print_cached.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_indi_print_cached.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_menu_print.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_menu_print.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_bt.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_bt.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_kiosk.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_kiosk.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ - - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - Adobe PDF library 6.66 - - - - - - - 2005-08-31T14:12:21+03:00 - 2005-08-31T12:01:27Z - Illustrator - 2005-08-31T14:12:21+03:00 - - - - JPEG - 256 - 256 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FXYq7FXYq7FXYqlWoeadCsarLdK8g/3VF+8avgeOw+nNVq+29Lg+qYJ7hufs/S5O PR5J8gxy+/MWRqrYWwQdpJjU/wDArt+Oczq/bCR2wwrzl+ofrc/H2WP4j8khvNd1W+r9ZuXZD/us Hin/AAK0Gcvq+1dTqP7yZI7uQ+Qc7Hp4Q5BUsNb1SyoLe4dUH+6yeSf8C1RkdJ2rqdP/AHcyB3cx 8jsjJp4T5hkVj57k2W9tww7yRGh/4Fv6502k9s5DbNC/OP6j+sOBk7NH8J+bILLzBpN5QRXCq5/3 XJ8Dfj1+jOn0nb2k1G0ZgS7pbH7efwcHJpckOYTDNw47sVdirsVdirsVdirsVdirsVdirsVdirsV dirsVdirsVdirsVdirsVdiqTal5v8vafVZrxHlH+6ov3jV8Dx2H0nNXqu2dNh+qYJ7hufs/S5WLR ZZ8h82L6j+aErVXTrQIO0s5qf+AXb/hjnOar2skdsUK85fqH63Y4uyR/Gfkxq/8AMWs6jUXd27of 91A8U/4FaDOa1faeoz/XMkd3IfIOwx6bHD6Qg1Oa4tqqpyBQqqciWKspyBQqqciWKqpyBYpjZaxq NpQQTsqj9gnkv/AmozP0na+q0393Mgd3MfI7NGTBCfMJ9Z+cn2W7gDeLxmh/4E/1zqdH7bSG2aF+ cf1H9YcLJ2eP4SndpremXVBHMFc/sP8ACfx6/RnU6Pt/R6jaMwJd0vSft5/Bwp6aceYR2blodirs VdirsVdirsVdirsVdirsVdirsVdirsVdirsVSPVfO3lnTKrPepJKP90w/vXr4HjUD6SM1up7W0+H 6pAnuG7l4dDlyco7eezENT/NyZ6ppdkIx2muDyP/AACmg/4I5z+p9qJcsUa85fqH63Z4uxh/Gfkx TUfM+u6nUXl5I8Z6xKeEf/ALRc53VdpZ8/1zJHdyHyDssWlx4/pCBU5ry3KqnIFCqpyJYoy1s7u5 P7iJnHiBt952ymeSMeZa5TA5pza+WbhqG4lWMfyr8R/gMw56wdA48tQOicWui6dBQ+n6jD9qT4vw 6fhmHPUTl1pollkVSfSLCbcxhG/mT4fw6ZGOeY6oGWQS+by/Ku8MgYfytsfvGZEdUOobRnHVByWt zB/exlR49R942y4TjLkWYkDyaU4lKspyJYqqnIFij7PVL+2oIZmVR+wd1+47ZsNH2xqtN/dzIHdz HyOzTkwQlzCc2vmp9hcwg/5cex+4/wBc6rR+3EhtnhfnH9R/WHDnoR/CU3ttX0+4oElAY/sP8J/H Os0XtDo9RtGYEu6XpP28/hbhz0848wjM3TS7FXYq7FXYq7FXYq7FXYq7FXYqkGr+e/K2lcluL5JJ l/3RB+9evgeNQv8AsiM12o7V0+L6pWe4buZh0GbJyjt57MJ1b85535JpNiIx2muTyb/kWhAH/BHN HqPaU8sca8z+ofrdrh7EH8cvkw7VPNnmHViRfX0kkbdYVPCP/gEop+nNBqe0M+b65Eju5D5O0xaP Fj+mIS5TmAW9WU5AsVVTkShHWmn31zT0YWZT+1Si/wDBHbKMmWMeZapTiOZTu08qzGhuZgg/kT4j 95pmFk1w/hDjy1I6BOrTRdNt6FYhIw/ak+I/d0/DMLJqZy6uPLLIpkpAFB0HTMYtK8NgpC8NkaQv BwIbxV2KoaXT7SXcxhT/ADLsfwyyOWQ6sxMhCSaOw3ieo8G2P3jLRqO9mMveh3t54vtoQPHqPvGW CYPJmJAuU4lVVTkCxVVORLFHWuo3lvQRSsFH7J3X7jmx0fbOq0393kkB3cx8js1TwxlzCa23mJth PED/AJSbfgf651mi9u5DbPjvzj+o/rDiT0XcUzg1KznpwkAY/stsfxzrtF7RaLU7QyAS7pek/bz+ FuJPBOPMInN21OxV2KuxV2KuxVj/AJ61+90Ly/Jf2ao04kSNfUBZRzNCaAjNd2pq5YMJnGrvq5ug 08cuXhlyeKav5t8x6vUX19LJG3WFTwj/AOATip+nOG1HaGfN9ciR3dPk9Vh0eLH9MQlGYbkuxVep yJYpjZaVqN1QwwMVP7Z+FfvNBmPkzwjzLVPJGPMp7Z+UHNDdzhfFI9z/AMEf6Zg5NeP4Q409V3BP LPRdMtqFIQzj9t/iP47ZhZNROXMuNLLI9UyBzGal4bAhcGyNIXhsFIXhsFIXhsjSF4bBSF4ORVdi h2KuxV2KqUlrA/VAD4jY5ITIZCRCHbTyP7tvob+uWDL3suNTMMqfaU08eoyXECmwuU4CqqpyBYqq nIlii4L26h/u5CAP2TuPuObLRdtavS/3WSQHdzHyOzVPFGXMJ9p9zJcWwkcDlUg09s9d9ne0sms0 oy5K4rI28nW5oCMqCJzetTsVdirsVYj+aoB8l3dR0khI/wCRgzT9vf4rL3j73Zdk/wB+Pj9zwvOB euTzSPJXmfVuLWlhIIW6Tyj0o6HuGenL/Y1zP0/ZmfN9MTXedg4mbXYsf1S3+aJtPJ1aG7n+aRD/ AI2b+mc9k7Q/mj5olqu4J5Z6NpdrQxQKWH7b/E34/wAMwsmonLmXGnllLmUxDZjU1Lw2BC8NkaQv DYKQvDYELw2RQvDYKQvDZGkLw2BC8NgpVwbI0heGwIX1wIdirsVdirsVdiqxoo26rv44RIptYben 2T9Bw8SeJES6dfQfbiPEftL8Q/DN1rfZ/WafeeM8PePUPs5fFqjnhLkVNTmkLYyHRv8AeIf6xz2D 2K/xAf1pOr1X1o7Otcd2KuxV2Kpfr2h2mt6a+nXbOsEjIzmMgN8DBgKkHwzG1eljnhwS5Hub9Pnl inxR5obSPJ/lrSQDZWESyL/u5x6kn/BvyI+jK9P2dgw/TEX38z9rPNrcuT6pFOczXFeTBs8Gp6le GyNIXhsCFwbBSF4bI0heGwIXhsiheGwUheGwUheGyNKvDYKQvDZFC8NgpC8NkaQvDYKQuBwIbxV2 KuxV2KuxV2Kstz6OdIoT2NpPvJGCx/aGx+8Zqtb2HpNV/eY4k942PzDZDLKPIrra2jt4/TQkrUkV 98t7M7Nx6PF4WO+Gyd/NGSZkbKrmwYOxV2KuxV2KuxV2KvIg2eEPVLw2RpC8NgpC8NkULw2CkLw2 CkLw2RpC4NgpV4bI0heGwUheGwIXhsjSF4bAheGyKF4bBSF4bIoXg4EN4q7FXYq7FXYqy3Po50js VdirsVdirsVdirsVdirsVePBs8Jp6teGwUheGwIfA2e8PLPUPqntiqWejnUcDzXG70ceBeN3o48C 8bvRx4F43ejjwLxu9HHgXjd6OPAvG70ceBeN3o48C8bvRx4F43ejjwLxu9HHgXjTP6p7Zy70ry/F X6T584u7dirsVZbn0c6R2KuxV2KuxV2KuxV2KuxV2KvGw2eFvWLw2BC8NkaQ+Cc93eVe0/VfbFUh 9HOx4HkeN3o48C8bvRx4F43ejjwLxu9HHgXjd6OPAvG70ceBeN3o48C8bvRx4F43ejjwLxu9HHgX jd6OPAvGn31X2zjnrni2Kv0nrnzi7t2KuxVlufRzpHYq7FXYq7FXYq7FXYq7FXYq8XDZ4bT1q8Ng QvDZFXwbnuryb6C+qe2KsX9HO64HiON3o48C8bvRx4F43ejjwLxu9HHgXjd6OPAvG70ceBeN3o48 C8bvRx4F43ejjwLxu9HHgXjd6OPAvGyj6p7Zwr2759xV+kgbPnJ3i4HAhvFWW59HOkdirsVdirsV dirsVdirsVdirxMNnh7168NkaQvDYKQvDYKQ8p+qe2e6PJsM9IZ6HwvAcTvSGPCvE70hjwrxO9IY 8K8TvSGPCvE70hjwrxO9IY8K8TvSGPCvE70hjwrxO9IY8K8TvSGPCvE70hjwrxMz+qe2eePfvoIN nzrTvl4bBSF4bIoXg4EMuz6OdI7FXYq7FXYq7FXYq7FXYq7FXiAbPEaewXhsihcGwUhUDZGkMD+q +2e5vJPPeGej0+d27hjS27hjS27hjS27hjS27hjS27hjS27hjS27hjS27hjS27hjS27hjS29C+q+ 2ecPoj2cNnzu79eGwUheGyNIXhsFIZln0Y6N2KuxV2KuxV2KuxV2KuxV2KvDA2eJPYrw2CkLw2RQ vDYKQkH1T2z3F5F5Zwz0qnza3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3c MaW3qf1T2zzV9Jelhs+eaegXhsjSF4bAq8NgpDNc+inQuxV2KuxV2KuxV2KuxV2KuxV4QGzxSnsl 4bAheGyNIXhsCFv1X2z295B43wz06nzG3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMaW3cMa W3cMaW3cMaW3sn1X2zzF9OZcGz57ehXhsjSrw2CkLw2RQznPol0DsVdirsVdirsVdirsVdirsVeC hs8Wp7NeGyNIXhsCFwbBSE6+qe2e2vHvCuGeo0+WW7hjS27hjS27hjS27hjS27hjS27hjS27hjS2 7hjS27hjS27hjS27hjS291+qe2eXPqaZBs+fKejXhsFIXhsCF4bI0hnufQ7z7sVdirsVdirsVdir sVdirsVeAhs8Ye0XhsjSF4bBSF4bIoZt9U9s9seOfPPDPVafKLdwxpbdwxpbdwxpbdwxpbdwxpbd wxpbdwxpbdwxpbdwxpbdwxpbdwxpbfQ31T2zyp9XQobPn56ReGwUheGyNIXhsFIegZ9CvPOxV2Ku xV2KuxV2KuxV2KuxV8+hs8Zp7VeGwIXhsCrw2RpD1P6r7Z7U8Y+aOGesU+R27hjS27hjS27hjS27 hjS27hjS27hjS27hjS27hjS27hjS27hjS27hjS2+l/qvtnk764xgNngFPSrw2RQvDYKQvDYEPRM+ g3nXYq7FXYq7FXYq7FXYq7FXYq+eg2eNvbrw2CkLw2RpC4NgQ9v+qe2e0PFu+qe2Ku+qe2Ku+qe2 Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2Ku+qe2KvPA2eBPTLw2RpC8 NgQvDZGkPSM+gnnHYq7FXYq7FXYq7FXYq7FXYq+dg2eO09wvDYELw2RpC8NgpC8NkaQvDYKQvDZG kLg2BC8NgpC8NkaQvDYKVeGyNIXhsCF4bAheGyNIXhsFIXhsiheGwUheGyNIXhsCF4bBSF4bIoel 59APNuxV2KuxV2KuxV2KuxV2KuxV85Bs8fe5XhsjSF4bBSF4bI0heGwUheGwIXhsjSF4bBSF4bI0 heGwUq8NgpC8NkaQuDYELw2RpC8NgpC8NkULw2CkLw2BC8NkaQvDYKQvDZFV4bBSHp+e/PMuxV2K uxV2KuxV2KuxV2KuJoK4q+bw2eQU90vDYELw2CkLw2RpC4NgpC8NkaQvDYELw2ClXhsjSF4bBSF4 bIoXhsFIXhsFIXhsiheGwUheGyNIXhsFIXBsjSF4bAheGwUq8NkaQvDYEPU898eYdirsVdirsVdi rsVdirsVdir571/S5dJ1m7sJAR6MhEZPeM7o30rTPLNbpjhyygeh+zo9rp8oyYxIdUEGzEptXhsi heGwUheGwUheGyKrw2CkLw2RpC4NgpC8NgpC8NkaQvDYELw2RpC8NgpC8NkaQvDYKQvDYELw2RVe GwUheGyNIXhsFIRml2j3l9DbKK82HL2UbsfuzM7O0Z1OeGMfxHf3dfsac0+CJL03PbXnHYq7FXYq 7FXYq7FXYq7FXYqxvzj5LtPMMCuGEGoQqRDcUqCK14P3K+Hhmp7U7Khqo3ymOR/Qfxs52i10sJ74 no8tv/I3mqxlKPp8s6jpJbqZlPv8FT94zi8/Y+pxmjAn+rv9z0OPX4Zj6gPfsxjVtY0rRbw2Os3s GmXoUObW8lSCUK32W4SFWoe22Y/8naj/AFOf+lP6mz81i/nx+YQo86eT/wDq+6f/ANJUH/NeD+Tt R/qc/wDSn9SPzWL+dH5hcPOvk7/q+6d/0lwf815H+TtR/qc/9Kf1I/NYv50fmF487eTv+r9p3/SX B/zXg/k7U/6nP/Sn9S/mcX86PzC4ed/Jv/V+07/pLg/5rwfybqf9Tn/pZfqR+Zxfzo/MLx538mf9 X/Tv+kuD/mvB/Jup/wBTn/pZfqR+Zxfzo/MLx548mf8AV/07/pLg/wCa8j/Jup/1Of8ApZfqR+Zx fzo/MLh558l/9X/Tf+kuD/mvB/Jup/1Of+ll+pH5nF/Oj8wvHnryV/1MGm/9JkH/ADXg/kzU/wCp 5P8ASy/Uv5nF/Oj8wuHnryT/ANTBpv8A0mQf814P5M1P+pZP9LL9SPzGP+dH5hePPfkn/qYdN/6T IP8AmvI/yZqf9Syf6WX6kfmMf86PzC4efPJH/Uw6Z/0mW/8AzXg/kzVf6lk/0sv1I/MY/wCdH5he PPvkf/qYtM/6TLf/AJrwfyXqv9Syf6WX6kfmMf8AOj8wuHn3yP8A9TFpn/SZb/8ANeD+S9V/qWT/ AEsv1L+Yx/zo/MLx5+8jf9TFpn/Sbb/815H+S9V/qWT/AEkv1I/MY/50fmF48/8AkX/qY9L/AOk2 3/5rwfyXqv8AUsn+kl+pH5jH/Oj8wuH5geRP+pj0v/pNt/8AmvB/JWq/1LJ/pJfqR4+P+cPmEw0b zL5e1q9Fjo+qWmpXrKXFrZzxTylV+03CNmag77YP5K1X+pZP9JL9SPHx/wA4fNk9p5c1u4cKtq8Y 7tKDGB/wVD92ZGn7A1mU0Mco+cvT97XPV449fkzXQdAg0uIsT6l04pJLTYD+VfbPQuxew4aKN/Vk lzP6B5fe6jU6k5D5Jrm9cV2KuxV2KuxV2KuxV2KuxV2KuxV2KvhX/nLz/wAnLc/8wNp/xE4q8VxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kvav+cQ//Jy23/MDd/8AERir7qxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2Kvlf/AJyH/Ib8y/On5kTa55f0+K5057W3iWV7iGI841IYcXZWxV5n/wBC n/nb/wBWeD/pMtv+qmKu/wChT/zt/wCrPB/0mW3/AFUxV3/Qp/52/wDVng/6TLb/AKqYq7/oU/8A O3/qzwf9Jlt/1UxV3/Qp/wCdv/Vng/6TLb/qpirv+hT/AM7f+rPB/wBJlt/1UxV3/Qp/52/9WeD/ AKTLb/qpirv+hT/zt/6s8H/SZbf9VMVd/wBCn/nb/wBWeD/pMtv+qmKu/wChT/zt/wCrPB/0mW3/ AFUxV3/Qp/52/wDVng/6TLb/AKqYq7/oU/8AO3/qzwf9Jlt/1UxV3/Qp/wCdv/Vng/6TLb/qpirv +hT/AM7f+rPB/wBJlt/1UxV3/Qp/52/9WeD/AKTLb/qpirv+hT/zt/6s8H/SZbf9VMVemf8AOPH5 DfmX5L/MiHXPMGnxW2nJa3ETSpcQynnIoCjijM2KvqjFXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq 7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX/9k= - - - - - - - uuid:98c671b0-8b65-4ea2-a622-4a99e13331d7 - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_mmc.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_mmc.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - -]> - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_bar.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_bar.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ - - - - - -]> - - - - - - - - 2005-12-13T08:31:39Z - 2005-12-13T08:31:39Z - Illustrator - - - - JPEG - 256 - 4 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA -AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK -DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f -Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgABAEAAwER -AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA -AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB -UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE -1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ -qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy -obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp -0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo -+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8ANR/0JN2+o/8AczwoXD/o -Snt9R/7mWHdGy4f9CWdvqP8A3Msl6kelcP8AoS/t9S/7mWH1o9K4f9CY9vqX/cyw+tHoXD/oTTt9 -S/7mOS/eI9DY/wChN+31L/uY4f3rH92uH/QnXb6l/wBzHJfvkfulw/6E97fU/wDuY4f334pH7pcP -+hP+31P/ALmGS/f/AIpH7lcP+hQu31P/ALmGH/CPxSP3P4tcP+hRe31P/uYZL/CfxSP3H4tcP+hS -O31P/uYYf8K8/sY/4P8Ai1w/6FL7fU/+5hkv8K8/sR/g/wCLXD/oU3t9U/6f8P8Ahfn9iP8ABvxb -Y/6FQ7fVP+n/AA/4Z5/Yj/BvL7Vw/wChU+31T/p/w/4Z5/Yj/BfL7Vw/6FV7fVP+n/H/AAzz+xH+ -CeX2tj/oVft9U/6fsP8Ahvn9iP8ABPL7Vw/6FZ7fVP8Ap+w/4b5/Yj/A/L7Wx/0K5/y6/wDT9j/h -vn9iP8D8vtXf9Yvf8uv/AE/Yf8O8/sR/gXl9rY/6Fg/5df8Ap+w/4d5/7FH+BeX2rh/0LF2+q/8A -T7j/AId5/wCxR/gXl9rY/wChZP8Al1/6fcP+H+f+xX/AfL/ZN/8AWM3/AC6/9PuP+H+f+xR/gPl/ -slw/6Fo/5df+n3D/AIf5/wCxR/gHl/sm/wDrGn/l1/6fcf8AD/P/AGKP8A8v9k3/ANY1/wDLt/0+ -4f8AXDz/ANiv+AeX+yb/AOsbP+Xb/p9x/wBcPP8A2KP9b/L/AGTf/WN3/Lt/0+4/64ef+xX/AFv8 -v9k7/rG//l2/6fMP+uHn/sUf63+X+yf/2Q== - - - - - - - image/svg+xml - - - - - - - - - - - - - - 2005-12-13T08:31:39Z - 2005-12-13T08:32:56Z - Illustrator - - - - JPEG - 256 - 4 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgABAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AgF9/yrr69cc/8Zc/Vfl6 XD068jXh/k+GdLl4+M34vM8uKvh5PL4eDgjXhchz4b+PmpD/AJVx/wB/p/wmQ9X+2/7Jn6P9p/2K 4f8AKuf+/wA/+EyQ4/8Abf8AZI9H+0/7FcP+Vdf9/l/wmS9f+2/7Jj6P9q/2K8f8q7/7/H/hMI4/ 9s/2SPR/tX+xXD/lXf8A3+H/AAmS9f8Atn+yR6P9q/2K4f8AKvP+/v8A+EyX7z/bP9kx9H+1f7Fs f8q8/wC/t/5J4f3n9P8A2S/u/wDa/wDYtj/lXv8A39n/ACTwjxP6f+yR+7/2v/Yrh/yr3/v6v+Se S/ef0v8AZI/d/wBD/Yt/8g+/7+n/AJJ4f3n9L/ZI/d/0P9i3/wAg+/7+f6fSw/vP6X+yX93/AEP9 i2P+Vf8A/fy/T6WH975/7JH7v+j/ALFv/kH/AP38n/JLJfvfP/ZI/d/0f9i3/wA6B/38X0+jh/e/ i1/d+X+xb/50D/v4f+SOH97+LR+78v8AYt/86D/2v/p9HH97+LX915fY7/nQf+19/wAkcf3v4tH7 r8U3/wA6F/2vP+SGP73y+1f3X4pv/nQv+13/AMkMP73y+1H7r8U7/nQv+1z/AMkMf3vl9q/uvP7H f86H/wBrj/khj+98vtX915/Y7/nQ/wDtbf8ATvj+9/o/av7rz+x3/Oh/9rX/AKd8f3v9H7V/df0v sb/50P8A7Wf/AE74/vf6P2r+6/pfY7/nRP8AtZf9O2P73+j9q/uv6f2O/wCdE/7WP/Ttj++/ofav 7r+n9jX/ADon/L//ANO2P77+h9q/uv6bv+dE/wCX7/p2x/ff0PtX91/Td/zon/L7/wBOuP77+h9q /uv9sa/50T/l8/6dcf339BP7r/bFkv8AgT03r9cpxNeP1WvTt75E+LX8CY+FY/vH/9k= - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_bar_short.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_bar_short.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ - - - - - -]> - - - - - - - - 2005-12-13T08:31:03Z - 2005-12-13T08:31:03Z - Illustrator - - - - JPEG - 256 - 8 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA -AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK -DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f -Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgACAEAAwER -AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA -AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB -UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE -1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ -qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy -obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp -0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo -+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8ALc9WfIXYq7FXYq7FXYq0 -RgStIxStIwMlhGBK0jAlYRgZArCMiyBWEYGQKwjAyBWEZFkCpkYGQKwjAyBWEZFkCsZcDIFTZciy -BU2XAyBWMuRZgqbLgZAqbLkWQKmRgZgqbLkWQKxlwMgVNlyLMFTZcDIFTZciyBU2XAQzBf/Z - - - - - - - image/svg+xml - - - - - - - - - - - - - - 2005-12-13T08:31:03Z - 2005-12-13T08:34:54Z - Illustrator - - - - JPEG - 256 - 8 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgACAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A5p5pm/MldamGhhv0bxT0 qJbkV4jlvIOX2s7XXy14ynwfo2/m/peF7Oj2ecI8b+83/nfo2SoXH5x9w/8AyLtP6ZiCfann8oOZ wdk+XzmuFx+cHcP/AMBaf0yQn2n+BBHB2V5fOa8XH5u9w/8AwFr/AEyXH2l+BBjwdl+XzmuE/wCb XcP/AMBa/wBMkJ9o/gRRwdl+XzmuE/5r9w//AAFr/TDx9ofgRY8HZn4M1wm/NPuH/wCAtv6ZLi1/ 44UcHZv4M1wm/M/uG/4C2/pkuLXfjhXh7O/Bk2JfzK7hv+At/wCmHi1v44UcPZ/4MmxL+Y3cN/wN v/TDxaz8cKOHQfjib9T8we4b/gYP6ZLi1f44UcOh/HE36nnzuG/4GD+mG9V+KXh0X44m+fnfuG/4 GH+mG9T+KRWj/HE3z85dw3/Aw/0w3qPxS1pPxxN8/NvcH/gYv6ZK8/4pFaX8W3y80dwfuj/pjeb8 Utab8W7l5j7g/dHjeX8UitP+Lb5a/wBwfuTD+9WsH4t1da7g/cmP7xf3P4tuurdwfuXH1o/dfi3f 7ke4P3Lj6l/du/0zuP1Y+pfQ6k/f+GO6+l1H74rs7ivfFba4wd/440Fsu42nf+ONRTcncLDv+tsa itza4aZ3p97YKgt5HcNH70+98agt5fxTXp6J3p9741jTeb8Uh75NJFu31enrVFN28d+uQyCFbc23 CcvF6uXwf//Z - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_handle.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_handle.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_left.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_left.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ - - - - - -]> - - - - - - - - - - - - - 2005-12-13T08:29:40Z - 2005-12-13T08:29:40Z - Illustrator - - - - JPEG - 256 - 248 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA+AEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FUNqOp6dplnJe6jcxWlpEKyTzu saD5sxAyUYGRoCyxlIRFnYPEfPf/ADk5p9oZLLyhbC+mFVOp3IZYAfGOL4Xf5txHsRm20/ZRO+Q1 5Osz9pAbQ383gXmXzf5l8y3313W9QmvZwax8zRI69o41oiD/AFQM3GPDDGKiKdZPLKZuRt6x/wA4 /wD5va1D5gtfKmt3T3mm3/7qwlnYvJBMBVEDn4ij048expSgrms7Q0cTEziKIdhotUeLhlyL6czR O4dirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqG1HUtP020kv NQuYrS0iFZJ5nVEHzZiBkoQMjQFljKYiLJoPF/O//OTGl2fqWnlO2+v3AqP0hcBktwfFI/hkf6eP 05t9P2RI75DXk6vP2pEbQF+bwXzR5x8y+Z7v61rl/LeOCTHGxpFHXtHGtEX6Bm5xYIYxURTqcmae Q3I2kLZYxCw4CyCfflyf+Qh+V/8Atr2P/UTHmNqf7uX9U/c5Gn/vI+8Pu7OTekdirsVdirsVdirs VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqG1DUtP020kvNQuY7S1iFZJ5nCIPmzEDJ QgZGgLLGcxEWTQeN+dv+ck9LtPUtPKtt9fnFR9fuAyQA+KR/C7/Tx+nNxp+x5HfIa8urqdR2tEbQ F+bwjzP5w8yeZrv61rd/LeOCTGjGkaV7RxrRF+gZu8WnhjFRFOny555DcjaRNljAKbYGYU2yLILD gLIJ9+XX/kw/K/8A217D/qJjzG1P93L+qfucjT/3kfeH3dnJvSOxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KuxVDahqNhp1o95f3MdraxCsk8zBEHzLUGShAyNRFljOYiLJoPHvO n/OR+mWnqWvla2+vTio+v3AZIAfFI/hd/p4/Tm603Y0jvkNeXV0+o7YiNsYvz6PDPM3m7zH5ku/r WtX0l24JMaMaRpXska0RfoGbzDp4YhURTpcueeQ3I2kbZa1hTbIswptkWQU2wMwptkWQWHAWQT78 uv8AyYflf/tr2H/UTHmNqf7uX9U/c5Gn/vI+8Pu7OTekdirsVdirsVdirsVdirsVdirsVdirsVdi rsVdirsVdirsVdiqHv8AULHT7WS7vriO1tYhWSeZgiD5lqDJQhKRqIssZzjEXI0HkPnL/nIrTbT1 LXyvb/XpxUfXrgMkAPikezv9PH6c3em7Fkd8hry6uk1PbURtjF+fR4f5k82+YvMd19Z1m+ku3BJj RjSNK9kjWiL9AzfYdPDEKgKdHm1E8puRtJGy1rCm2RZhTbAyCm2RZhDS3Ea7A8j4DNdqO0cePb6j 5Ow0+gyZN/pHmoxzO8m+wp0zE0eunmy0do1ycrV6OGLHY52vbNu6wLDgLIJ9+XX/AJMPyv8A9tew /wComPMbU/3cv6p+5yNP/eR94fd2cm9I7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVC 9vbOxtnur2eO2tohWSaVgiKPdmIGShAyNAWWM5iIsmg8n84/85CaTZc7Xy1B+kLkVH1yYMlup/yV 2eT/AIUe5zd6XsSct8h4R3dXR6rtuEdsY4j39HiPmbzf5j8yXP1jWL6S5INY4ieMSf6ka0VfnSud Bg02PEKgKdDm1OTKbmbSNsuagptkWQU2wMgptkSzCDnvYU2Hxt4Dp9+azU9qYsew9R8v1uz0/ZuT JufSPP8AUgZbmWTqaL/KM0Oo1+TLsTQ7g7vT6HHi5Cz3lSzCcxVt/wC8+jNn2T/e/B1/af8AdfFW bOjdCFhwFkE48jSPF538vSoaOmp2bKfcXCEZRqB+7l7i34frHvD70zkXpXYq7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYqoXl7Z2Vs91eTx21tGKyTSsERR7s1BkoQMjURZYzmIi5Gg8p83/wDOQGlW fO28twfpC4FR9cmDJbqf8ldnf/hR7nN7pew5y3yHhHd1dFqu3YR2xjiPf0/a8W8yebvMXmO59fWL 2S5INY4ieMSf6ka0VfurnQ4NLjwioCnns+qyZjczaSNlzSFNsiWQU2wMwpttkSWQCAuNSgjqE/eN 7dPvzVantbFj2j6j9nzdrpuysk95ekfb8ktmu55q8mov8o2Gc/qNfly8zt3B32n0OPFyG/eVHMNz HYq7FVW3/vPozZ9k/wB78HX9p/3XxVmzo3QhYcBZBNvJf/KZaD/20bT/AJPplGf6Je4t2H6x7w+9 s5F6Z2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KqN5e2dlbPc3k8dvbxisk0rBEUe7NQZKEJSNRFlj OcYi5Gg8r83fn5pVnztvLkH1+4FR9cmDJbqf8ldnf/hR7nN9pOwZy3ynhHd1/Y6DV9vwjtiHEe/p +14z5j82eYfMVz6+r3slyQaxxE8Yk/1I1oq/dXOiwaXHhFQFPOajV5MxuZtJDl7SFhyLILGwMgpu QASdgOpyJNM4i0sutXt46rF+9f2+z9+afVdsY4bQ9R+x3Gl7IyT3l6R9qVXF7cTn42ov8g2Gc/qd dlzfUdu7o9BptDjw/SN+/qoZhuW7FXYq7FXYqq2/959GbPsn+9+Dr+0/7r4qzZ0boQsOAsgm3kv/ AJTLQf8Ato2n/J9Moz/RL3Fuw/WPeH3tnIvTOxV2KuxV2KuxV2KuxV2KuxV2KuxVRu7y0srd7m7m S3t4xWSaVgiKPdmoMlCEpGoiyxnOMRcjQeXebPz50uz523l2D6/cCo+tzApAp/yV2d/+FHuc3+k7 AnLfKeEd3X9jz2r9oIR2xDiPeeX7fseN+YvNfmDzDcevq17JckGscRPGJP8AUjWij7q50mn0mPCK gKea1GryZjczf3JMcuaQsOBkFM4GQU3ZVBZiAB1J2GQlIAWWcYkmglV3rlvHVYR6r+PRfv75pdV2 1jhtD1H7HdaXsXJPefpH2pPc31zcn94/w9kGy/dnPanW5cx9R27uj0em0WLCPSN+/qh8xHKdirsV dirsVdirsVVbf+8+jNn2T/e/B1/af918VZs6N0IWHAWQTbyX/wAploP/AG0bT/k+mUZ/ol7i3Yfr HvD72zkXpnYq7FXYq7FXYq7FXYq7FXYqpXN1bWsD3F1KkEEYrJLIwRFHiWNAMlCBkaAssZzERcjQ eZ+a/wA89IsudvoEP6QuRt9Zkqlup9hs7/gPfN/pOwJy3ynhHd1/Y89rPaHHDbEOI9/T9rxzzF5q 1/zBcmfVbx7ihJjirxiSv8kY+EfrzptPpMeEVAV97y+p1mXObmb+75JKcvaAsOBkFhyLIKUjoiln YKo6sTQZCchEWTQbIRMjQFlJ73zDbx1W3Hqv/MdlH8Tmj1fbkIbY/Ufs/a73Sdh5J75PSPt/Ykl1 fXVyazOSOyjZR9Gc7qNZlzH1n4dHo9NosWEegfHqh8xXKdirsVdirsVdirsVdirsVVbf+8+jNn2T /e/B1/af918VZs6N0IWHAWQTbyX/AMploP8A20bT/k+mUZ/ol7i3YfrHvD72zkXpnYq7FXYq7FXY q7FXYqpXN1bWsD3FzKkEEYrJLIwRVHiWNAMlCBkaAssZzjEXI0Hmvmr88NJsudvoMX6QuRUfWZKp bqfYbO/4D3zoNH7PznvlPCO7r+x53W+0WOG2IcR7+n7XkPmHzZ5g8wT+rqt484BrHCPhiT/VjFFH z6502m0eLAKgK+/5vLanW5c5ucr+75JKcyXGCw4GQUzkWQUpZI40LyMEQdWY0AyE5xiLkaDZjhKR qIspHfeZYEJS1X1W/nbZf6nNBqu3oR2xjiPf0/b9j0Gk7AnLfIeEd3X9n2pDdX11dNymkLeC9FHy Gc5qNXkzG5m/uel0+jx4RUBX3qGYzkuxV2KuxV2KuxV2KuxV2KuxV2Kqtv8A3n0Zs+yf734Ov7T/ ALr4qzZ0boQsOAsgm3kv/lMtB/7aNp/yfTKM/wBEvcW7D9Y94fe2ci9M7FXYq7FXYq7FVK5ura1g ee5lSCCMVeWRgqqPEsaAZKEDI1EWWM5xiLkaDzfzT+duk2XO30KL9IXAqPrMlUgU+w2d/wAB750G j9nsk98p4R3df2POa32kxw2xDjPf0/WXkfmHzXr+vz+rql28wBrHCPhiT/VQfCPn1zqNNosWAVAV 9/zeU1Wuy5zeSV/d8kmOZLjLTgSsOBkFGeaKGMySuEQdWY0GVZMkYC5Gg24sUpnhiLKQX/mqFapZ r6jf78aoX6B1Oc/q+34jbEOI955PR6P2ekd8p4R3Dn+r72PXV7dXT8p5C/gD0HyHTOb1GqyZjczb 02n0mPCKhED8d6hmO5DsVdirsVdirsVdirsVdirsVdirsVdiqrb/AN59GbPsn+9+Dr+0/wC6+Ks2 dG6ELDgLIJj5VmMPmnR5gKmO+tnAPfjMpynMLgfcW7EfUPe++85B6Z2KuxV2KqVzc21rA89zKkEE Yq8sjBVUeJY0AyUIGRqIssZzjEXI0HnHmj87NKs+dvoUX1+4G31mSqQKfYbO/wCA986HR+z2Se+U 8I7uv7Hm9b7SY4bYhxnv6frLybX/ADVr2vzerql28wBqkP2Yk/1UHwj59c6nTaLFgFQFff8AN5LV a7LnN5JX5dPkk5zJcZacCVhwMlG4uIIIzJNIsaDqzGgyrLlhjHFIgBtxYZ5JcMASfJjmo+bo1qli nM/79eoH0L1+/Oc1ftCBtiF+Z/U9No/ZwnfMa8h+tjt1e3V3JzuJDI3avQfIdBnN59TkzG5m3p9P pceEVAUoZQ3uxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kqtv/efRmz7J/vfg6/tP+6+Ks2dG6EL DgLII3y7/wApDpf/ADFwf8nVyrL9J9zbj+oe99/5x707sVU57iC3hee4kWGGMcpJZGCqo8Sx2GSj EyNAWWMpiIsmg8481fnVpNjyt9CjGoXIqDcPVbdT7dGf6KD3zoNF7P5J75TwDu6/sec13tJjh6cQ 45d/T9v43eS6/wCate1+f1dUu3mANUh+zEn+qg+EfPrnVabRYsAqAr7/AJvI6rXZc5vJK/Lp8kpz KcR2KrTgZIe6u7a2jMlxIsaDuxp93jlObPDFHimQA34NPPLLhgDIsa1HzkN0sI6n/f0n8F/rnNav 2iHLEPif1fr+T0+j9mzzzH4D9J/V82N3N3c3UnqXEjSP4senyHQZzebUTyy4pkkvUYNPjxR4YARC jlLc7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYqq2/959GbPsn+9+Dr+0/7r4qzZ0boQsOA sgjfLv8AykOl/wDMXB/ydXKsv0n3NuP6h7333PcQW8Lz3EiwwxjlJLIwVVHiWOwzkYxMjQFl6WUx EWTQedeaPzq0ax52+iR/pG5G3rtVLdT+DP8ARQe+b/R+z2Se+Q8A7uv7Pxs85rfaTHDbEOOXf0/b +N3kvmHzb5g8wTepqd20qA1jt1+GJP8AVQbfT1zqtLocWAVAV59fm8lq9fm1BvJK/Lp8knzLcN2K uxVRu7y1tIjLcSLFGO7d/kOpynPqIYo8UzQbsGnyZZcMAZFi2p+dGNY9Pj4jp68g3/2K/wBfuzmN Z7RE7YR8T+gfr+T1ei9mgN8x/wA0fpP6vmxq5urm5kMlxI0rnuxr93hnN5s88suKZMi9Ph08MUeG AEQpZU3OxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kqtv/AHn0Zs+yf734Ov7T/uvi rNnRuhCw4CyCN8u/8pDpf/MXB/ydXKsv0n3NuP6h73r/AJm82a9r95JJqVw/phyY7OpEUW/QJ0qO lTvm50ehxYIgQHx6l5XW6/LqJEzJru6BJMzXCdirsVdiqhfG9Fs/1IIbj9gSV4/h3zH1Pi8B8KuP zcjS+F4g8W+Dyec6q2qG6b9I8/XHZ+lP8mm1PlnnutOc5P318Xn+jpXufSdAMAx/uK4PL9PW/eg8 w3NdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVVbf+8+jNn2T/e/B1/af918V Zs6N0IWHAWQRvl3/AJSHS/8AmLg/5OrlWX6T7m3H9Q976386/k9Z6vczajpEy2V9KS8sDj9xI56n 4d0J77H5Zgdn9vSxAQyDiiOvUfrZ9pez0c0jPGeGR6dD+p5Fr3lbXtBm9PVLN4ATRJftRt/qutVP yrXOr02txZxcJX9/yeQ1WhzYDWSNfd80pzKcR2KuxV2KqF5Y2l5EYrmJZE7V6j3B6jKNRpseaPDM WHI0+qyYZcWM8JYrqXkqVKyWEnNevoybN9DdD9OcvrPZ2Q3xG/I8/m9ZovaWJ2zCj3jl8v7WNz28 9vIYp42jkHVWFDnOZcU8cuGQIL02LNDJHigRIeSnlbY7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYqq2/959GbPsn+9+Dr+0/7r4qzZ0boQsOAsgjfLv8AykOl/wDMXB/ydXKsv0n3NuP6 h733/nHvTqVzbW11A8FzEk8Ego8UihlYeBU1ByUJmJuJosZwjIVIWHnfmf8AJXRr7nPokn6OuTv6 DVe3Y/iyfRUe2dBo/aHJDbKOMd/X9v43ec1vs3jnviPBLu6fs/GzyjzF5O8w+X5eOpWjJETRLlPj hb5ONvoNDnUaXX4s49B37uryer7Pzac+uO3f0+aSZmOE7FXYqtOBkhruytbuP07mJZV7chuPkeoz Hz6fHlFTAkHI0+pyYTcJGJYzqXk5hWSweo/3zId/ob+uc1rPZ488J+B/Qf1/N6nRe0gO2Yf5w/SP 1fJjlxa3FtIY542jcdmFPuznM2CeM8MwQXpsOeGWPFAiQUsqbXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FVW3/vPozZ9k/wB78HX9p/3XxVmzo3QhYcBZBE6LMIda0+YiojuYXIHfjIDlWQXE tsDuH6B5x707sVdiqyWKKaNopUWSNxR0cBlI8CDhjIg2OaJRBFHcPP8AzP8AkzoGpFp9Kb9F3R34 IOUDH/UqOH+xNPbN9o+38uPafrj9vz6/H5vP632dw5N8fol9ny6fD5PJ/MnkXzL5edjf2hNsOl5D V4T2+0B8PyYA51Gk7Sw5/pO/cef49zyWs7Mz6c+uPp7xy/HvY/me69acDJacCVhwMlC5tbe5jMc8 ayIezCv3eGU5sEMseGYBDfgzzxS4oExLG9Q8oLu9jJQ/76k/g39c5zV+zw54j8D+v9fzem0ftGeW YfEfpH6vkx25tLm2k9OeNo38COvyPfObzaeeI1MEF6bBqMeWPFAiQUspbnYq7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FVW3/ALz6M2fZP978HX9p/wB18VZs6N0IWHAWQVNP/wCOja/8Zo/+JDK58i2R 5v0IzjnqHYq7FXYq7FWmVXUqwDKwoyncEHscQaQRbBPM35P+WtW5z2IOl3jb1hAMJP8AlRbAf7Ej N5o+3s2LaXrj58/n+t0Wt9n8GXeHol5cvl+qnkfmf8vPNHl/nJd2pms1/wCPyCskVPFv2k/2QGdR pO1MOfaJqXcef7Xk9Z2Tn0+8hce8cv2fFjBzYOuWHAyWnAlYcDIKFxBDPGY5kEiHqrCoyrLijkHD IWG7FlnjlxRJBY/f+VYyS9m/A/76fcfQ3X7853V+z4O+I15H9b0mj9oSNsovzH6mP3Nnc2r8J4yj dq9D8j0Oc5n02TEamKelwanHmFwNqOUN7sVdirsVdirsVdirsVdirsVdirsVdiqrb/3n0Zs+yf73 4Ov7T/uvirNnRuhCw4CyCpp//HRtf+M0f/Ehlc+RbI836EZxz1DsVdirsVdirsVdirRAIodweoxV hPmf8o/K2tB5reP9GXzVPrW4Hpk/5cWyn/Y0ObjSdt5sWxPHHz/W6XWdhYM24HBLy/V/Y8h80/lj 5q8vh5pYPrditSbu2q6geLrTkn0invnUaTtbDn2B4ZdxeU1nY+fBuRxR7x+nuYgc2TrFhwMgsOBk FM5FkFKaKKVCkqB0PVWFRleTHGYqQsNuPJKBuJopFfeWYmq9o3pt/vtt1+g9RnP6vsGMt8R4T3Hk 9DpO35R2yjiHeOaRXNnc2rcZ4yngeoPyI2zndRpcmE1MU9Jp9VjzC4G1DMdyHYq7FXYq7FXYq7FX Yq7FXYq7FVW3/vPozZ9k/wB78HX9p/3XxVmzo3QhYcBZBU0//jo2v/GaP/iQyufItkeb9CM456h2 KuxV2KuxV2KuxV2KuxV2KsN80/lV5V18PKIfqF83S6tgFqf8uP7LfgffNrpO2M2Ha+KPcf1up1nY 2DPvXDLvH6Q8f81/lN5q0HnNHF+krBd/rNsCWA/y4t2X6Kj3zptJ2xhzbE8Mu4/reW1nYufDuBxx 7x+kMHbNq6pTORZBYcDILDkWQUpY0kQo6hlPVSKjITgJCpCw2QmYm4mik155dgerWzem38h3X+oz RarsOEt8Z4T3dHfaXt2cdsg4h39UkubO5tm4zIV8G6g/I5zuo0mTCamK+56PT6vHmFwN/eoZjOS7 FXYq7FXYq7FXYq7FXYqq2/8AefRmz7J/vfg6/tP+6+Ks2dG6ELDgLIKmn/8AHRtf+M0f/Ehlc+Rb I836EZxz1DsVdirsVdirsVdirsVdirsVdirsVYn5q/LHyp5j5S3Fv9Vvm3+u21Ecn/LFCr/SK++b HSdqZsGwNx7i63V9lYc+5FS7x+N3jfmv8mvNeil5rNP0tYipEtup9VQP54d2/wCB5Z02l7aw5dpe iXny+bzGr7EzYt4+uPlz+Tz91ZWKsCGBoQdiCM2zqFM5FkFhwMgpnAyCm6qylWAZT1B3GQlEEUdw zjIg2NilN5oUD1aA+k38vVf7M0mq7EhPfH6T9n7HeaXtucdsnqH2/tSe5sri3NJUoOzDcH6c57Ua PJhPqHx6PQ6fWY8w9J+HVQzFcp2KuxV2KuxV2KuxVVt/7z6M2fZP978HX9p/3XxVmzo3QhYcBZBU 0/8A46Nr/wAZo/8AiQyufItkeb9CM456h2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KsY80/lz5U8y h3vrQR3jDa+gpHMD4kgUf/Zg5naXtHNh+k+nuPJwNV2bhz/UPV3jn+Pe8Z82fkf5o0n1LjS6avZL uBEONwo94t+X+wJ+WdJpe28WTafol9nz/W81quw8uPeHrj9vy/U82ljkjdo5FKSISrIwIII6gg5t wb5OnquakcWQWHIsgsbAyCk4DAgioPUHISAIos4kg2EtutIgerRfu28Oq/dmn1PY2Oe8PSfsdzpe 2MkNp+ofalM9ncQH94vw/wAw3Gc9qNFlw/UNu/o9Bp9Zjy/Sd+7qo5iuU7FXYq7FXYqq2/8AefRm z7J/vfg6/tP+6+Ks2dG6ELDgLILrWVYruCV/sRyKzU8AwJyEhszjzfoVnGvUuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxVjvmjyB5W8zRsNTslNwRRb2Kkc69h8YHxU8GqPbMvTa7LhPpO3d0cPU 6DFmHqG/f1eL+bvyF8x6YHudEkGrWgqfRA4XKj/Urxf/AGJqf5c6PS9t457T9J+x5zVdh5Ibw9Y+ 15fc29xbzPBcRPDNGaPFIpVlPgVNCM3AkCLHJ05iQaPNQbFIU2yJZBTbAzCmwBFDuMiRbMGkvuNN hepT923t0+7NRqeyMc94+k/Y7bTdq5IbS9Q+1Lp7WaE/Evw/zDcZoNRosmH6ht39HfafW48v0nfu 6qOYjlOxV2Kqtv8A3n0Zs+yf734Ov7T/ALr4qzZ0boQsOAsgptkSzD9EM4x6l2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KpF5n8k+WfM0Hp6vZJNIBSO5X4Jk/1ZF+L6Dt7Zk6fWZMJ9B+H RxtRo8eYesfHq8W84f8AOPmt2PO58uTfpO2G/wBVl4pcqPY7JJ/wp9s6DS9twltkHCe/o89qexJx 3xniHd1eT31jeWNzJa3sEltcxGkkMqlHU+6sAc3MZiQsGw6eUDE0RRQjYUhTbIsgptgZBTbIlmEH PZRPuvwN7dPuzV6nsvHk3j6T9nydpp+08kNpeofjqgZbaWPqKj+YdM0Oo0OTFuRt3h3eDW48vI79 ylmG5arb/wB59GbPsn+9+Dr+0/7r4qzZ0boQsOAsgptkSzD9EM4x6l2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2KuxV2KpN5j8oeW/MlsINZsY7oKKRykFZU/wBSRaOv0HL8GpyYjcDTRn02 PKKmLeLecf8AnHTU7cvc+V7kXsO5+o3BVJh7LJsj/Tx+nN9pu24nbIK8xydFqexZDfGb8jzePanp eo6ZdvZ6jbS2l1H9uGZCjD3oex7HN1DJGYuJsOnnjlA1IUUC2FAU2yLMKbYGQU2yJZhDS20bbj4T 7ZrdR2bjybj0ny/U7HB2hkhsfUFGOJ0k36U65iaLRTw5bPKublavVwy4tud8l7ZuHVhYcBZBTbIl mH6IZxj1LsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSvX/LGgeYLQ2us2 MV7FQhfUX40r1KOKOh91OW4c88ZuJpqy4IZBUhbxXzl/zjbcJ6l15UvPWXqNOuyFf5RzbKfYOB/r ZvNP20DtkHxH6nSajsYjfGfgf1vFtZ0TV9GvGstVs5bK6XrFMpUkeK12Ye42zdY8sZi4mw6ieOUD UhRS1skgKbZFmFNsiyCm2BmFNsiyCw4CyCm2RLMP0QzjHqXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYq7FXYq7FXYq7FXYq7FXYq7FXYql+taBouuWTWWr2UV7at/uuVQ1D4qeqn3U1yzHllA3E0WvJij MVIWHivnT/nGiNhJdeUrzi27fo28NV+UcwFR7Bx/ss3Wn7Z6ZB8R+p1GfsjrjPwLw/zB5Z1/y/d/ VNZsJrGffiJVorAbEo4qrj3UkZuceaGQXE26nJilA1IUlDZJiFNsDMKbZFkFhwFkFNsiWYfohnGP UuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVB6to2lavZPY6 paRXtpJ9qGZA618RXoR2I3ycMkoG4miwnCMhUhYeLed/+cZdPuBJd+Ubr6nLuf0bdMzwn2jl+J1/ 2XL5jNvp+1yNsgvzDq8/ZYO8DXk8J80eTvMvli7+q65YS2bkkRyMKxSU7xyLVG+g5uMWeGQXE26r JhnjNSFJC2WMQsOAsgptkSzD9EM4x6l2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KobUNN0/UrR7PULWK8tJP7yCdFkRvmrAjJRmYmwaLGURIURbxnzx/zj HomoF7vyrc/ou5NT9Rn5SWzH/JbeSP8A4YeAGbXB2rIbTF/e67N2bE7w2eBebfIXmzypcmDXNPkt lJpFcgc4JP8AUlWqn5Vr4jNvi1EMguJdXkwTxn1Bkf5RflLrXm/XbS7ubWSHy3byLLd3kilUlVDX 0oiftlqUNPsjr2rj6zVxxxIB9TkaXTGZs/S//9k= - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_right.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_slider_right.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - -]> - - - - - - - - - - - - - 2005-12-13T08:30:12Z - 2005-12-13T08:30:12Z - Illustrator - - - - JPEG - 256 - 248 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA+AEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AW/M/8ztX8yavc2lpcvBo MDtFb28TFRKFNPVlpTnzpUA7AfST2fZ/Z8MUASLmfseM7Q7QnlmQDUB9rHvLPnrzT5ZlDaRfPFFX k9q3xwP48o2qu/iN/fMnUaPHmHrHx6uNp9Zkwn0H4dHtPlH/AJyE0G/9O28wwHS7s0BuY6yWzHxP V4/pqP8AKzntT2JOO+M8Q+16HTdtQltkHCfseq2l5aXlulzaTJcW8o5RzRMHRh4hlqDmmlExNEUX cxkJCwbCtkWTsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi rsVfDxz0Z85WnAlo4pTfy55x8yeW7n19HvpLaprJCDyif/XjaqN86VzHz6XHlFTFuRg1OTEbgae0 +UP+citKuzHa+ZrX6hMaA30HKSAnxZN5E+jlnP6nsSUd8Zvy6u/03bUZbZBXn0et6fqWn6japd2F zFd20n2JoXDofpUnNJOEompCi7uE4yFxNhE5Fk7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXw8c9GfOVpwJaOKVpwJWnAlM9A80eYPL139b0a+ls5duYQ1RwOzo ao4/1hlObTwyipi2/DnnjNxNPZ/J3/OR1rKUtfNVr9Xc7fpC1BaP5yRbsvzUn5ZodT2KRvjN+R/W 73TdtA7ZBXmHsOka1pOsWa3ul3cV5av0lhYMAfA03U+x3zSZMUoGpCi7vHljMXE2EblbN2KuxV2K uxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kvh456M+crTgS0cUrTgStOBK04E tHFKO0TzDrehXgvNIvZbK4GxeJqBgOzr9lh7MCMqy4YZBUhYbsWaeM3E0Xsvk7/nJEgJa+bLSvQf pG0X8ZISfvKH/Y5otT2L1xn4H9bu9N2z0yD4j9T2fQ/MWh69ZC90e9ivbc0q0TVKk9nU0ZD7MAc0 eXDPGakKLu8WaGQXE2ExytsdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir 4eOejPnK04EtHFLDPM3mfUtJ11Y4SslsYkZoHG1SWBII3BzQdodoZMGahvGhs7/s/s/Hnw2dpXzT LSfOOkagAjP9VuD/ALqlIAJ/yX6H9eZem7UxZdieGXn+txNT2XlxbgcUfL9SdnNi65o4pWnAlacC UVpes6tpF2t5pd3LZXK9JYXKGnWhp1HsdsryY4zFSFhsx5JQNxNF7F5O/wCck7yD07XzVZ/Wo9gd RtQElHu8OyN81K/I5pdT2MDvjNeR/W7rT9sEbZBfmHtvl7zX5d8xWgutFv4ryOlWVDSRPZ42o6H/ AFhmjzYJ4zUhTu8WeGQXE2m2UtrsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVfD xz0Z85WnAlo4pea/mD/x3l/4wJ/xJs5Htv8Av/8ANH6XrexP7j/OP6GM5qHbpxpPmnVtNokcnq24 /wB0SVZQP8k9V+jM/Tdo5cOwNx7i4Op7OxZdyKl3hmWlec9KvqRyn6pOf2JD8JPs/T76Zv8ATdq4 smx9MvP9boNT2Vlx7j1R8v1J52zZutaOBK04pWnAlXsNS1DTbuO80+5ktLqI1jnhco4+TKQchOAk KIsNkJmJsGi9f8m/85JaxZmO180Ww1C2FFN7bgR3A92TaOT6OP05ptR2PE74zR7ujt9P2vIbTFjv 6vcfLHnbyv5nt/W0XUIrogcpIK8Zk/14mo4+dKZo82myYjUhTu8OohkFxNp5lDc7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXw8c9GfOVpwJaOKXmv5g/8AHeX/AIwJ/wASbOR7b/v/APNH 6XrexP7j/OP6GM5qHbuxV2KpppfmTVdNosMvOAf7ok+JKe3cfRmbptflxcjY7i4eo0GLLzG/eGY6 X500u8AS4P1Sc9nPwE+z/wBaZv8ATdrYsm0vSfs+bodR2Vkx7x9Q+35J9UEVBqDuCM2dutWnFWjg ZLTilUtLy8srmO6s55La5iPKKeJijqfFWUgjISiJCjuGUZEGxzeteS/+cj/MOmlLbzJD+l7MbfWU 4x3Sj8Ek+mh/ys1Op7IhLeHpP2O10/as47T9Q+17r5S/MLyl5rh56NfpLOBWSzk/d3CfONt6e61H vmiz6XJiPqH6ndYNVDL9JZHmO5DsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVfEVzEIriWIGo jZlB+RpnooNi3zoijSicVaOKXmv5g/8AHeX/AIwJ/wASbOR7b/v/APNH6XrexP7j/OP6GM5qHbux V2KuxV2KplpfmDU9NIEEtYu8D/En3dvozL02uy4fpO3d0cTUaLHl+ob9/Vl2l+dNOuqR3X+izHar GsZP+t2+nN9pu1sc9pek/Y6PUdlZIbx9Q+1PwysoZSCp3BG4Izag26yqaOKVpwJWnAldBcT28yT2 8jQzRnlHLGxVlI7hhQjIkAiiyBI3D1XyV/zkV5q0YJa66n6bsV2EjtwulH/GWhD/AOzFT/Nmr1HZ WOe8fSfsdnp+05x2l6h9r3jyd+Z3k7zbGo0q+VbylX0+ekVwvj8BPxU8UJGaPUaPJi+obd/R3ODV 48v0nfuZXmK5LsVdirsVdirsVdirsVdirsVdirsVdirsVfEt/wD73XH/ABlf/iRz0SHIPnc/qKGO FDRxS81/MH/jvL/xgT/iTZyPbf8Af/5o/S9b2J/cf5x/QxnNQ7d2KuxV2KuxV2KuxVH6brepac3+ jSn0+8TfEh+j+mZOn1mTF9J27ujjZ9Jjy/UN+/qy3TPOlhccY7sfVpTty6xn6eo+nN9p+18c9p+k /Y6TUdlTjvH1D7U/V0dQ6MGRt1YGoI9iM2oIIsOsIINFo4qtOBLRxS0rujq6MVdSGVlNCCNwQRgK Q9Q8l/8AOQvnPQRHbaoRrmnrQUuGIuVX/Jn3J/2Yb6M1mo7Lxz3j6T9nydjg7SyQ2PqD3vyZ+bnk nzYI4rG9FvqL/wDSuuqRTV8EqeMn+wJzR6jRZMXMbd4dzg1mPJyO/czPMRynYq7FXYq7FXYq7FXY q7FXYq7FXYq+Jb//AHuuP+Mr/wDEjnokOQfO5/UUMcKGjil5r+YP/HeX/jAn/Emzke2/7/8AzR+l 63sT+4/zj+hjOah27sVdirsVdirsVdirsVdiqN0/WNQ09q20xVe8Z3Q/7E5kYNXkxfSf1OPn0uPL 9QZVpnnOznpHer9XlP7YqYz/ABXN7p+14S2n6T9jpdR2VOO8PUPtT9JI5EDxsHRujKQQfpGbWMgR Y3DrDEg0WzhVacCVpwJaqQag0I3BGBL0nyX+fvnjy4Y7e7m/TWmJQfV7tiZVX/iufdx7cuQHhmv1 HZuPJuPSfL9Tn4O0MkNj6g998k/nT5G81mO3guvqGpvQCwvKRuzHtG9eEnsAeXtmk1GgyY9yLHeH cYNbjybXRZ5mE5bsVdirsVdirsVdirsVdirsVfEt/wD73XH/ABlf/iRz0SHIPnc/qKGOFDRxS81/ MH/jvL/xgT/iTZyPbf8Af/5o/S9b2J/cf5x/QxnNQ7d2KuxV2KuxV2KuxV2KuxV2KuxVF2GqX1i/ K2lKA/aTqp+anbL8GpniNxNNObTwyCpBlGnec7aWkd6noP8A78WpQ/MdR+ObvT9rxltMcJ7+jps/ ZUo7wN/en8csUsYkicOjfZZSCD9IzbRkJCwbDrJRMTR2LZwoWnFLRwJWnAl6D5J/PLzz5WKQG5/S umLQGyvGZ+K+Ecv209huvtmDqOz8eTeqPk5uDW5IeYe/+R/z38j+aDHbST/ojVHoPqd4wVWY9opt kb2Box8M0mo7PyY9/qHk7fDroT25F6KCCKjpmC5jeKuxV2KuxV2KuxV2KviW/wD97rj/AIyv/wAS OeiQ5B87n9RQxwoaOKXmv5g/8d5f+MCf8SbOR7b/AL//ADR+l63sT+4/zj+hjOah27sVdirsVdir sVdirsVdirsVdirsVdiqJs9QvbJ+dtK0Z7qPsn5qdjl2HUTxm4mmrLghkFSFsl07zlC4CXyek3+/ UqV+kdR+ObrT9rxO2QV5uoz9lkbwN+TIIp4Z4xJC6yRnoymo/DNtCcZCwbDq5QMTRFFcckhacCVp wMlpxSznyR+c/njyjwgtbv67pibfo68rJEB/xWah4/kpp7ZhZ9DjybkUe8OVh1c8fI2H0B5H/wCc hPJHmIJb6hJ+g9TagMN2w9Bj/wAV3Hwr/wAHxOabP2dkhuPUPx0dth10J8/SXqCsrKGUhlYVVhuC D3Ga9zW8VdirsVdirsVfEt//AL3XH/GV/wDiRz0SHIPnc/qKGOFDRxS81/MH/jvL/wAYE/4k2cj2 3/f/AOaP0vW9if3H+cf0MZzUO3dirsVdirsVdirsVdirsVdirsVdirsVdirsVV7S+u7ST1LaVo27 06H5g7HLcWaeM3E015MMZipC2R6f5wRqJfJxPT1k3H0r1+7Nzp+1gdsg+IdTn7LI3gfgyCG4guIx JBIsiH9pTXNtDJGYuJsOsnCUTRFLjkkLTilacCWjgSzHyX+bfnjygUj0y+MunqanTbqstuR4KCeU f+wYZi59Hjycxv3uRh1U8fI7PoHyR/zkf5M10R2us10LUWop9Y8rVj/kz0HH/ZgAeJzTZ+zZw3j6 h9rtcOvhLY+kvWIpYpY1lidZInAZHUhlYHcEEdRmuIpzgV+KuxV2KvifVI2j1K7jb7STSK3zDEZ6 HjNxHufO8gqR96EOSQ0cUvNfzB/47y/8YE/4k2cj23/f/wCaP0vW9if3H+cf0MZzUO3dirsVdirs VdirsVdirsVdirsVdirsVdirsVdirsVVra7ubWT1LeRo38VPX5jvlmPLKBuJphkxxmKkLZDYebq0 S+jp/wAWx/xX+mbfB2t0yD4h1ebszrA/BP4Lm3uI/UgkWRD3U/rzb48sZi4mw6ueOUDUhS45NDRw JaxVrAllXk38z/OvlCVf0PqDi0Bq+nz1ltmruf3ZPw17lKH3zHz6XHk+ob9/VvxaiePkX0B5I/5y Y8qawY7TzDEdDvmoPXJMlozdPt05R1/yhQfzZp8/Zk47x9Q+12mHXxltLYvYLa5t7mBLi2lSeCUB opo2DoynoVZagjNaQRsXOBtVwJfFmvf8dvUP+Ymb/k4c9Cw/RH3B89zfXL3lLzk2DRxS81/MH/jv L/xgT/iTZyPbf9//AJo/S9b2J/cf5x/QxnNQ7d2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxVUguJ7eQSQyNG47qaZOGSUDcTRYzhGQoi0/sPNjCiXqcv+LU6/Sv8ATNtg7V6ZB8Q6zN2b 1gfgn9vdW9zEJIJBIh7jt8x2zcY8sZi4mw6yeOUDUhSpk2DWBLsVaxSyLyh+Yfm/yhc+roeoSQRM eUto37y3k/14mqtf8ofF4HKM2nhkHqDbizyh9JfRP5Z/85GaT5lvrfRtethperXDCO3mjJa1mkbY IOXxRs3QAkg+PbNLqezjAcUdx9rtdPrhM1LYvEde/wCO3qH/ADEzf8nDnYYfoj7g8Zm+uXvKXnJs Gjil5r+YP/HeX/jAn/Emzke2/wC//wA0fpet7E/uP84/oYzmodu7FXYq7FXYq7FXYq7FXYq7FXYq 7FXYq7FXYq7FXYq7FXYq7FXYqitPN+LgfUefreCeH+V2p88v05ycX7u7ac4hw+vkza0+t+gv1oIJ v2uFafjnUYuPh9dcXk89k4eL08lXLGDsVaxS0cCsh8l+R/NPmvVIbbQrSWTjIolvlBWG33rzeXYL QbgVqe2U5s8MYuRbsWKUz6U917/jt6h/zEzf8nDm2w/RH3B0Gb65e8pecmwaOKXmv5g/8d5f+MCf 8SbOR7b/AL//ADR+l63sT+4/zj+hjOah27sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsV diqpDBNPII4UMjnoqipycISkaiLLGcxEWTSfWPlORqPevwH++k3P0t0za4Oyid5mvIOtzdpDlAfF P7a0trWP04IxGvenU/M9Tm4xYo4xURTq8mWUzcjarljBrAl2Kp55U8j+avNd39W0LT5bsqQJZgOM Mdf9+StRF+VantlOXPDGLkabceGUzUQ+gPIv/OL+iWHp3nm25/Sl0KH6hAWjtVPgz/DJJ/wo9jmn z9qSO0Nvvdph7PA3lu9rsNPsNOtI7OwtorS0hHGK3gRY41HsqgAZq5SJNnm7CMQBQfGmvf8AHb1D /mJm/wCThz0HD9EfcHz7N9cveUvOTYNHFLzX8wf+O8v/ABgT/iTZyPbf9/8A5o/S9b2J/cf5x/Qx nNQ7d2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVVt7W4uZPTgjaR/BRX78njxymaiLLCeS MBcjTINP8osaPfPT/ilDv9Lf0zb6fsnrkPwDrM3afSA+LILe0trZOFvGsa96Dr8z1ObjHijAVEU6 ueWUzcja85Ni0cCWsVTzyr5H81ea7v6toWny3ZUgSzAcYY6/78laiL8q1PbKc2eGMXI0248Mpmoh 7/5F/wCcYNEsPTvPNlz+lLoUb6hAWjtVPgz/AAySf8KPY5p8/akjtDb73aYezwN5bva7DT7DTrSO zsLaK0tIRxit4EWONR7KoAGaqUjI2dy7GMQBQRGBLsVfFmvf8dvUP+Ymb/k4c9Cw/RH3B89zfXL3 lLzk2DRxS81/MH/jvL/xgT/iTZyPbf8Af/5o/S9b2J/cf5x/QxnNQ7d2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2KuxVWtrS5upPTt42kfwUdPmegyzHilM1EWWGTLGAuRpken+TwAHvpKnr6MfT6W/pm5 0/ZHXIfgHU5u1OkB8SyC3tbe2jEcEaxoOyj9fjm3x4owFRFB1c8kpm5G15ySFpxStOBKeeVfI/mn zXd/VtC0+W7KkCWYDjDHX/fkrURflWp7ZTmzwxi5Gm3FhlM1EPfvI3/OMOiWHp3nmy5/Sl0KH6hA WjtVPgz/AAySf8KPY5ps/akjtDb73a4ezojee72qw0+w060js7C2itLSEcYreFFjjUeyqABmrlIy NncuxjEAUERkUuxV2KuxV8W6+Cuu6iCKEXUwIPUH1Gz0HD9EfcHz3N9cveUuOWMGjil5r+YP/HeX /jAn/Emzke2/7/8AzR+l63sT+4/zj+hjOah27sVdirsVdirsVdirsVdirsVdirsVdiqIs7G7vJPT tomkbvToPmTsMtxYJ5DURbVlzQxi5GmS6d5NjWj38nM/75jqB9LdfuzdafsgDfIb8g6nP2qTtAfE sght4LeMRwxrHGOiqKDNvDHGAqIoOrnOUjZNleckxWnAlacDJOPLPk3zN5ovPqmh6fLeOCBJIopF HXvJI1EX6TlOXPDGLkabcWGUzURb37yJ/wA4x6NYiO882z/pK7Hxfo+Aslsp8Hf4ZJP+FHzzTajt WR2hsO/q7bB2cBvPd7VYafYadaR2dhbxWlpCOMVvCixxqPZVAAzVSkZGzuXZRiAKCIyKXYq7FXYq 7FXYq+M/Nv8AylOs/wDMdc/8nmzv9N/dR/qj7nz/AFP97L+sfvSg5c1NHFLzX8wf+O8v/GBP+JNn I9t/3/8Amj9L1vYn9x/nH9DGc1Dt3Yq7FXYq7FXYq7FXYq7FXYq7FUTZabfXr8LaFpKdWGyj5sdh l2HTzyGoi2nLnhjFyNMo03yZBHSS/f1W/wB9JUKPmep/DN3p+yIjfIb8nT5+1ZHaArzZBDBDBGI4 UWOMdFUUH4Zt4QjEVEUHVymZGybK44ULTilo4Epv5Z8m+ZvM959V0PT5bxwQJJFFIo695JGoi/Sc pzZ4YxcjTdiwymaiLe8+R/8AnGPSrT07vzbc/pC4FG/R9sWS3B8Hk+GR/o4/Tml1HasjtAV5u3wd mgbz3e1adpmnaZZx2WnW0VnaRCkcECLGg+SqAM1MpmRsmy7KMREUNkVkWTsVdirsVdirsVdirsVf Gfm3/lKdZ/5jrn/k82d/pv7qP9Ufc+f6n+9l/WP3pQcuamjil5r+YP8Ax3l/4wJ/xJs5Htv+/wD8 0fpet7E/uP8AOP6GM5qHbuxV2KuxV2KuxV2KuxV2Kouw0q/v342sRcD7T9FHzY7Zfg02TKaiLaM2 ohjFyLKtN8lWsVJL5/Xcf7qWoQfT1P4ZvNP2PGO8zxHu6Omz9rSltAUPtZDHFFFGI4kWONRRUUAA fQM28YiIoCg6uUjI2TZbOFC04ErTgSnHlryd5l8z3n1XQ7CW8cECSRRSKOveSRqIv0nKc2eGMXI0 3YsM8hqIt7v5I/5xl0q09O782XP6QnFD+j7YsluD4PJ8Mj/Rx+nNJqO1pHaArzdxg7MA3mb8ntOn aZp2mWcdlp1tFaWkQpHBCixoPkqgDNTKZkbJsuzjERFDYInIsnYq7FXYq7FXYq7FXYq7FXYq+M/N v/KU6z/zHXP/ACebO/0391H+qPufP9T/AHsv6x+9KDlzU0cUvNfzB/47y/8AGBP+JNnI9t/3/wDm j9L1vYn9x/nH9DGc1Dt3Yq7FXYq7FXYq7FUbp2jajqDUtoSyjrIdkH+yOZODSZMv0j9Tj59VjxfU WWaX5Ks4KSXrfWZf99iojH8W/wA9s3mm7IhHefqP2Ok1Ha05bQ9I+1kKRxxoEjUIi7KqgAD5AZto xAFDk6syJNlxwqtOBLRxSm/lryf5l8zXf1XRLCW8cECR1FIo695JGoi/ScozZ4YxcjTdiwTyGoi3 u3kn/nGfSrT07vzZc/X5xQ/o+3LJbg+DyfDI/wBHH6c0mo7XkdsYrzdzg7LA3mb8ns+naZp2mWkd np9tFaWkQpHBCixoPkqgDNRKZkbJsu0jERFAUETkWTsVdirsVdirsVdirsVdirsVdirsVfGfm3/l KdZ/5jrn/k82d/pv7qP9Ufc+f6n+9l/WP3pQcuamjil5r+YP/HeX/jAn/Emzke2/7/8AzR+l63sT +4/zj+hjOah27sVdirsVdiqP03Q9T1Fv9GhPp95m+FB9Pf6MytPo8mX6Rt39HGz6zHi+o793Vl+m eSdPtqPeH61MN+PSMfR3+nN9p+yMcN5+o/Y6LUdrTntD0j7WQKiIgRFCoooqqKAD2AzagACg6skk 2XHClacCVpwJTfy15Q8x+Zrz6poljJeSLT1HUUjjB6GSRqIv0nKc2eGMXI03YcE8hqIt7p5J/wCc adLtPTu/Ndz9fnFD+j7cskAPg8nwu/0cfpzR6jteR2xivN3Wn7KiN5m/J7Np2m6fptpHZ6fbRWlp EKRwQoqIPkqgDNPOZkbJsu1jARFAUETkWTsVdirsVdirsVdirsVdirsVdirsVdirsVfGfm3/AJSn Wf8AmOuf+TzZ3+m/uo/1R9z5/qf72X9Y/elBy5qaOKXmv5g/8d5f+MCf8SbOR7b/AL//ADR+l63s T+4/zj+hjOah27sVdiqZaX5e1TUiDbxcYe87/Cn39/ozM02hy5vpG3f0cTUa3Hi+o793VmGleSdN tKSXX+lzDswpGP8AY9/pzfabsjHDeXqP2Oi1Pa2Se0fSPtZAFVVCqAFGwA2AGbUCnV3bRxVo4GS0 4pTTy95U8xeY7z6pothLezbcygoiA95JGoiD/WOUZs8MYuRpuxYZ5DURb3HyV/zjVYW/p3fmy6+u S7H9HWpZIR7SS/C7/JePzOaPU9sE7YxXmXdafskDfIb8ns2maVpulWaWWm2sVnaR/YghQIg96L3P c5ppzlI3I2XbwgIigKCLyLJ2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KvjPzb/ylOs/8x1z/ AMnmzv8ATf3Uf6o+58/1P97L+sfvSg5c1NHFLzX8wf8AjvL/AMYE/wCJNnI9t/3/APmj9L1vYn9x /nH9DGc1Dt010ry1q2pcWhi4QH/d8nwpT27n6MzdN2flzchQ7y4Wp1+LFzNnuDMtK8laVZgPcD63 OO7j4AfZP61zoNN2Tix7y9R+z5Og1Pa2XJtH0j7fmn4AAAAoBsAM2lOtto4FWnFK04Epp5e8q+Yf Md59U0WxlvJtuZQURAe8kjURB/rHKc2eGMXI034cE8hqIt7f5L/5xssLf07vzZdfXJdj+jrUskI9 pJfhdvkvH5nNFqe2SdsYrzLu9P2QBvkN+QezaZpWm6XZpZabaxWdpH9iCFAiD3ovc9zmmnOUjcjZ dxCEYigKCKyDJ2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kvjnzyqr518wKoAUaleAAb AATvne6P+5h/Vj9zwOs/vp/1pfekRzIaGjilhfmfy1qWra8rwKEtxEitO5ooILbADcnOf7Q7PyZ8 9x+mhu7/ALP1+PBgqX1Wdkw0nyXpNhSSVfrc4/bkHwg+ydPvrmVpuycWPc+qXn+pxdT2rlybD0x8 v1p9mzda0cUrTgStOBKZ+X/KvmHzFefVNFsZbyXbmUFEQHu8hoiD/WOU5s8MYuRpvw4J5DURb27y Z/zjdYW/p3fmu5+ty7H9HWxZIR7SS7O3yXj8zmi1PbJO2MV5l3mm7HA3yG/IPZNN0vTdLs0stOtY rO0j+xBCgRR70Xue5zSznKRuRsu5hCMRURQRWQZOxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV8dee/+U38w/8AbTvP+oh873R/3MP6sfueB1n99P8ArS+9ITmQ0NHFK04ErTgStOBL RxSmfl/yt5g8xXf1TRrGW8l25lBREB7u5oiD/WOUZs8MYuZpvw4J5DURb2zyZ/zjhYW/C6813P1u XY/o62LJCPaSXZ2/2PH5nNDqe2idsYrzLvdN2MBvkN+Qexabpem6XZpZ6daxWlrH9iGFAij3oO57 nNLPJKZuRsu5hCMRURQRWQZuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 8dee/wDlN/MP/bTvP+oh873R/wBzD+rH7ngdZ/fT/rS+9ITmQ0NHFK04ErTgSmOheW9d1+8Fno9l LeT7chGPhUHu7mioPdjlObPDGLkabsOCeQ1EW9p8l/8AOOdrCY7vzXci5cb/AKNtiVj+UkuzN8lp 8zmh1XbRO2MV5l32l7GA3yG/IPZNN0vTtMtEs9OtorS1j+xDCgRR70Hc9zmjnklM3I2XdwxxgKiK CKyDN2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kvjrz3/AMpv5h/7 ad5/1EPne6P+5h/Vj9zwOs/vp/1pfekJzIaGjilMNC8t67r94LTR7KW8n25CMfCoPd3NFQe7HKc2 eGMXM0G7DgnkNRFvZ/J3/OOlrFwuvNVz677H9HWpKxj2kl2ZvktPmc0Gq7bJ2xivM/qd/pexQN8h vyH63sWl6Rpek2aWem2sVnap9mGFQi18TTqfc5osmSUzcjZd5jxxgKiKCLyDN2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kvnj87fy31W11y58x6bbvc6Zen1bv0 wWaCanxlgKng/wBrl2NRttXquydfGUBjkakOXmHle1tBKMzkiLiefkXmuh+XNc167FppFlLeT/tC MfCoPd3NFQe7HNtmzwxi5mg6nDgnkNQFl7N5P/5x2tYuF15pufXfY/o62JWMe0kuzN8lp8znP6rt wnbEK8z+p6DS9iAb5TfkP1vYNL0nTNKs0s9NtYrS1T7MUKhFr4mnU+5zRZMkpm5Gy73HjjAVEUEX kGbsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVf/2Q== - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_usb.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_usb.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - -]> - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_wlan.svg --- a/ImagePrint/ImagePrintUI/imageprintapp/data/qgn_prop_print_wlan.svg Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/bld.inf --- a/ImagePrint/ImagePrintUI/imageprintapp/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS - -PRJ_EXPORTS -// Export localised loc file -../loc/imageprintapp.loc APP_LAYER_LOC_EXPORT_PATH(imageprintapp.loc) -PRJ_MMPFILES - -imageprintapp.mmp - -PRJ_TESTMMPFILES - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv -OPTION TARGETFILE imgprintbitmaps.mif -OPTION HEADERFILE imgprintbitmaps.mbg -OPTION SOURCEDIR ../data -OPTION SOURCES -c8,8 qgn_prop_print_slider_bar.svg -c8,8 qgn_prop_print_slider_bar_short.svg -c8,8 qgn_prop_print_slider_handle.svg -c8,8 qgn_prop_print_slider_left.svg -c8,8 qgn_prop_print_slider_right.svg -c8,8 qgn_indi_print_cached.svg -c8,8 qgn_prop_print_bt.svg -c8,8 qgn_prop_print_kiosk.svg -c8,8 qgn_prop_print_mmc.svg -c8,8 qgn_prop_print_usb.svg -c8,8 qgn_prop_print_wlan.svg -END - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv -OPTION TARGETFILE imageprintapp_aif.mif -OPTION SOURCEDIR ../data -OPTION SOURCES -c8,8 qgn_menu_print.svg -END - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/imageprintapp.mmp --- a/ImagePrint/ImagePrintUI/imageprintapp/group/imageprintapp.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "../../inc/logdef.h" - -TARGET imageprintapp.exe -TARGETTYPE exe - -UID 0x100039CE 0x101FFA84 -CAPABILITY CAP_APPLICATION -VENDORID VID_DEFAULT - -EPOCSTACKSIZE 0x5000 // 20 kB, more stack size needed to handle avkon resorces - -SOURCEPATH ../src -SOURCE cimageprintapp.cpp -SOURCE cimageprintdoc.cpp -SOURCE cimageprintappui.cpp -SOURCE cimageprintblankcontainer.cpp -SOURCE cimageprintsettingscontainer.cpp -SOURCE cimageprintsettingsview.cpp -SOURCE cpropertiesboxmodel.cpp -SOURCE printapputil.cpp -SOURCE cimgpviewemptyview.cpp -SOURCE uimodefactory.cpp -SOURCE caiwmode.cpp -SOURCE cidlemode.cpp - -USERINCLUDE . ../inc ../../inc ../../../inc -USERINCLUDE ../../imageprintprovider/inc -USERINCLUDE ../../imgpprintdll/inc -USERINCLUDE ../../imageprinteng/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintServer/inc -USERINCLUDE ../../../clog/inc - -APP_LAYER_SYSTEMINCLUDE - -SOURCEPATH . -DOCUMENT ip_icons_dc.mk -DOCUMENT ip_icons_aif_scalable_dc.mk -DOCUMENT ip_icons_aif_bitmaps_dc.mk - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY avkon.lib -LIBRARY eikcore.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY imageprintengine.lib -LIBRARY eikcoctl.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY fbscli.lib -LIBRARY aknskins.lib -LIBRARY efsrv.lib -LIBRARY commonui.lib -LIBRARY hlplch.lib -LIBRARY etext.lib -LIBRARY gdi.lib -LIBRARY bitgdi.lib -LIBRARY usbman.lib -LIBRARY servicehandler.lib -LIBRARY estor.lib -LIBRARY ws32.lib -LIBRARY aknicon.lib -LIBRARY egul.lib -LIBRARY imageprintclient.lib -LIBRARY featmgr.lib -LIBRARY imgpprintdll.lib -LIBRARY apgrfx.lib -LIBRARY platformenv.lib -LIBRARY caf.lib -LIBRARY eikctl.lib -LIBRARY eikcdlg.lib - -START RESOURCE ../data/imageprintapp.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -HEADER -TARGETPATH APP_RESOURCE_DIR -END - -#ifdef RD_SCALABLE_UI - -SOURCEPATH . - START RESOURCE imageprintapp_reg.rss -DEPENDS imageprintapp.rsg - // Do not change the UID - TARGETPATH /private/10003a3f/apps - END // RESOURCE - -#else -SOURCEPATH ../data - START RESOURCE imageprintapp_caption.rss - #ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif - HEADER - TARGETPATH APP_RESOURCE_DIR - END // RESOURCE - -AIF imageprintapp.aif ../aif imageprintappaif.rss c12 context_pane_icon_44x44.bmp context_pane_icon_44x44_mask_soft.bmp list_icon_42x29.bmp list_icon_42x29_mask_soft.bmp - -#endif // RD_SCALABLE_UI - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/imageprintapp_reg.rss --- a/ImagePrint/ImagePrintUI/imageprintapp/group/imageprintapp_reg.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +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 -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x101FFA84 - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "ImagePrintApp"; - - localisable_resource_file = APP_RESOURCE_DIR"\\ImagePrintApp"; - - localisable_resource_id = R_IMAGEPRINTAPP_LOCALISABLE_APP_INFO; - - hidden = KAppIsHidden; - - embeddability = KAppEmbeddable; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_aif_bitmaps_dc.mk --- a/ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_aif_bitmaps_dc.mk Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\ImagePrintApp_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 list_icon_42x29.bmp \ - /c8,8 context_pane_icon_44x44.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_aif_scalable_dc.mk --- a/ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_aif_scalable_dc.mk Fri Jun 11 16:24:10 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\ImagePrintApp_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 ..\Data\qgn_menu_print.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_dc.mk --- a/ImagePrint/ImagePrintUI/imageprintapp/group/ip_icons_dc.mk Fri Jun 11 16:24:10 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\RESOURCE\APPS -HEADERDIR=\epoc32\include -ICONTARGETFILENAME=$(TARGETDIR)\IMGPrintBitmaps.MIF -HEADERFILENAME=$(HEADERDIR)\IMGPrintBitmaps.MBG - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 ..\Data\qgn_prop_print_slider_bar.svg \ - /c8,8 ..\Data\qgn_prop_print_slider_bar_short.svg \ - /c8,8 ..\Data\qgn_prop_print_slider_handle.svg \ - /c8,8 ..\Data\qgn_prop_print_slider_left.svg \ - /c8,8 ..\Data\qgn_prop_print_slider_right.svg \ - /c8,8 ..\Data\qgn_indi_print_cached.svg \ - /c8,8 ..\Data\qgn_prop_print_bt.svg \ - /c8,8 ..\Data\qgn_prop_print_kiosk.svg \ - /c8,8 ..\Data\qgn_prop_print_mmc.svg \ - /c8,8 ..\Data\qgn_prop_print_usb.svg \ - /c8,8 ..\Data\qgn_prop_print_wlan.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/caiwmode.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/caiwmode.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +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: -* -*/ - - -#ifndef CAIWMODE_H -#define CAIWMODE_H - -#include -#include - -#include "muimode.h" -#include "mprotocolobserver.h" -#include "muimodeobserver.h" - -class CUIProtocolController; -class CIFFactory; - -// CLASS DEFINITION -/** - * - * This class represents the embedded UI mode, - * i.e. aiw-initilized mode - * - */ -class CAiwMode : public CBase, - public MUIMode, - public MProtocolObserver - - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aUIModeObserver Ui mode observer - * @param aIFFactory Interface factory to be used - * - * @return Initialized instance of the class - */ - static CAiwMode* NewL( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ); - - /** - * Two-phase constructor - * - * @param aUIModeObserver Ui mode observer - * @param aIFFactory Interface factory to be used - * - * @return Initialized instance of the class - */ - static CAiwMode* NewLC( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ); - - protected: - - virtual ~CAiwMode(); - - private: - - CAiwMode( MUIModeObserver* aUIModeObserver ); - - void ConstructL( CIFFactory& aIFFactory ); - - public: // Methods derived from MUIMode - void SearchDefaultPrinterL(); - TBool ChangeDefaultPrinterL( TInt aProtocol ); - - public: // Methods derived from MProtocolObserver - void UsbCableDisconnected(); - - private: - - // Interface for callbacks - MUIModeObserver* iUIModeObserver; - - // Protocol controller for managing protocol changes etc. - CUIProtocolController* iUIProtocolController; - - // Interface factory - CIFFactory* iIFFactory; - - }; - -#endif // CAIWMODE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cidlemode.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cidlemode.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: -* -*/ - - -#ifndef CIDLEMODE_H -#define CIDLEMODE_H - -#include -#include - -#include "muimode.h" -#include "mprotocolobserver.h" - -class CUIProtocolController; -class MUIModeObserver; -class CIFFactory; - -// CLASS DEFINITION -/** - * - * This class represents the stand-alone UI mode, - * i.e. idle-launchable mode - * - */ -class CIdleMode : - public CBase, - public MUIMode, - public MProtocolObserver - { - public: // Constructors and destructors - - /** - * Two-phase constructors - * - * @param aUIModeObserver Ui mode observer - * @param aIFFactory Interface factory to be used - * - * @return Initialized instance of the class - */ - static CIdleMode* NewL( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ); - static CIdleMode* NewLC( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ); - - protected: - - virtual ~CIdleMode(); - - private: - - CIdleMode( MUIModeObserver* aUIModeObserver ); - - void ConstructL( CIFFactory& aIFFactory ); - - public: // Methods derived from MUIMode - void SearchDefaultPrinterL(); - TBool ChangeDefaultPrinterL( TInt aProtocol ); - - public: // Methods derived from MProtocolObserver - void UsbCableDisconnected(); - - private: - - // Interface for callbacks - MUIModeObserver* iUIModeObserver; - - // Protocol controller for managing protocol changes etc. - CUIProtocolController* iUIProtocolController; - - // Interface factory - CIFFactory* iIFFactory; - - }; - -#endif // CIDLEMODE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintapp.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintapp.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTAPP_H -#define CIMAGEPRINTAPP_H - -#include -#include - -/** -* UID of the application -*/ -const TUid KUidImagePrint = { 0x101FFA84 }; - -// CLASS DEFINITION -/** - * Application class - */ -class CImagePrintApp : public CAknApplication - { - - private: // Constructors and destructors - - CApaDocument* CreateDocumentL(); - - private: // Methods derived from CApaApplication - - TUid AppDllUid() const; - - }; - - -// INLINE FUNCTIONS - -#endif // CIMAGEPRINTAPP_H - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintappui.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintappui.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,261 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTAPPUI_H -#define CIMAGEPRINTAPPUI_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "midleprinteventobserver.h" -#include "rimageprintclient.h" -#include "muimodeobserver.h" - -class CAknNavigationDecorator; -class CDiscoveryDlgManager; -class CImagePrintDoc; -class CIMGPPrintDlgManager; -class MPrintSettings; -class MPrintPreview; -class CAknStaticNoteDialog; -class MUIMode; - -const TInt KPrinterNameID( 100 ); - -// CLASS DEFINITION -/** - * - * AppUi class - * - */ -class CImagePrintAppUi - : public CAknViewAppUi, - public MUIModeObserver - { - - public: // Constructors and destructors - - /** - * Second phase constructor - */ - void ConstructL(); - - /** - * Destructor - */ - virtual ~CImagePrintAppUi(); - - private: // Methods derived from CAknViewAppUi base class - - void HandleCommandL( TInt aCommand ); - - public: // Methods derived from MUIModeObserver - void ChangeViewL( TInt aView ); - void ExitApplication(); - - // Set text to navipane. - void SetNavipaneTextL( const TInt aCopiesOfImage, HBufC* aPaperSize = NULL ); - - public: // New methods - - /** - * Method is used to forward the selected images to engine. - * - * @param aFileArray, array that contains the selected images. - */ - void SetImageArrayL( CDesCArrayFlat* aFileArray ); - - /** - * Method returns the Dosument class od this application - * - * @return CimagePrintDoc document class - */ - CImagePrintDoc* GetDocument(); - - /** - * Method returns the image array - * - * @return CDesCArrayFlat array that contains the selected images - */ - CDesCArrayFlat* GetImageArray(); - - /** - * Launches application help - * - * @param aHelptext help text context - */ - void LaunchHelpApplicationL( const TDesC& aHelpText ); - - /** - * Gets the AIW state (iAiwState) - * - */ - TInt GetAiwState(); - - /** - * Returns UID of the application - * - * @return UID - */ - TInt GetApplicationUID(); - - /** - * Returns UID for the settings view - * - * @return UID - */ - TUid GetSettingsViewUid(); - - /** - * Returns AIW state. - * - * ETrue = Application is launched via AIW - * EFalse = Application is launched from active idle. - * - * @return AIW state. - */ - TBool AiwState(); - - /** - * Check orientation mode - * - * @return ETrue of orientation is portrait, otherwise EFalse - */ - TBool OrientationPortrait(); - - /** - * Check whether the operating resolution is QVGA - * - * @return ETrue if operating resolution is QVGA, otherwise EFalse - */ - TBool QVGAMode(); - - /** - * Gets the album call index - * - * @return album call index - */ - TInt GetAlbumCall(); - - /** - * Sets the album call index - * - * @param aAlbumCall album call index - */ - void SetAlbumCall(TInt aAlbumCall); - - /** - * Sets the validity status of images - * - * @param aStatus ETrue if images are valid, otherwise EFalse - */ - void SetValidImagesStatus( TBool aStatus ); - - /** - * callback for printer search in aiw mode - * - * @param aObj callback object - * - * @return status of the call - */ - static TInt SearchDefaultPrinterCbL( TAny* aObj ); - - private: // New methods - - CDesCArrayFlat* GetImagesFromAiwProviderL(); - - private: // Data - - // Used for navigation pane text - CAknNavigationDecorator* iNaviDecorator; - - // Offset for engine's resource file - TInt iResourceOffset; - - //Document class - CImagePrintDoc* iDoc; - - CIMGPPrintDlgManager* iPrintDlgManager; // use - - // Printed image files - CDesCArrayFlat* iFiles; - - // UID of the selected printer - TInt iPrinterUID; - - // Information about the state of usb discovery - TBool iUSBDiscoveryOngoing; - - // Is usb printer connected to phone - TBool iUSBPrinter; - - // USB connect/disconnect note - CAknProgressDialog* iUSBConnectionWaitNote; - - // Is usb device connected - TBool iUsbConnected; - - // Is USB printer selected - TBool iUSBPrinterSelected; - - // For AIW calls; - TInt iAiwState; - - RProperty iAiwCall; - - TBool iApplicationStarting; - - TBool iBTDiscovery; - - RImagePrintClient iImagePrintClient; - - TInt iAlbumCall; - - TBool iNotifyDone; - - // ETrue when exiting the application in AIW mode - TBool iExiting; - - TBool iFullDiscovery; - - TBool iDisconnectOnce; - - TBool iUsbWanted; - - TBool iValidImages; - - MUIMode* iUIMode; - - // idle object for performing search in aiw mode, owned - CIdle* iIdleSearch; - - }; - -#endif // CIMAGEPRINTAPPUI_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintblankcontainer.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintblankcontainer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTBLANKCONTAINER_H -#define CIMAGEPRINTBLANKCONTAINER_H - -#include - -class CAknViewAppUi; -class CAknsListBoxBackgroundControlContext; - -// CLASS DEFINITION -/** - * CImagePrintBlankContainer is used to show white background before - * the CImagePrintView is launched - */ -class CImagePrintBlankContainer - : public CCoeControl - { - - public: // Constructors and destructor - - /** - * Two-phase constructor - * - * @param aRect ClientRect of the owner control - * - * @return Initialized instance of CImagePrintBlankContainer - */ - static CImagePrintBlankContainer* NewL( TRect& aRect ); - static CImagePrintBlankContainer* NewLC( TRect& aRect ); - - /** - * Destructor - */ - virtual ~CImagePrintBlankContainer(); - - public: //Scalable UI - void HandleResourceChange( TInt aType ); - - protected: // 2:nd phase constructor and default constructor - - /** - * 2:nd phase constructor - * - * @param aRect ClientRect of the owner control - */ - void ConstructL( const TRect& aRect ); - - CImagePrintBlankContainer(); - - private: // Methods derived from CCoeControl - - void Draw( const TRect& aRect ) const; - - private: // Data - - // Skin control context for drawing the background bitmap - CAknsListBoxBackgroundControlContext* iSkinControlContext; - }; - -#endif // CIMAGEPRINTBLANKCONTAINER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintdoc.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintdoc.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTDOC_H -#define CIMAGEPRINTDOC_H - -#include -#include - -class CEikAppUi; -class CImagePrintEngine; -class CIFFactory; -class MPrintSettings; -class MPrintPreview; -class MPrintJob; -class MDiscovery; -class MIdlePrintEventObserver; - -/** - * - * Document class - * - */ -class CImagePrintDoc : public CAknDocument - { - public: // Constructors and destructors - - /** - * Two phase construction - * - * @Param aApp Application class of this application. - * - * @return Initialized instance of CImagePrintDoc - */ - static CImagePrintDoc* NewL(CEikApplication& aApp); - - /** - * Destructor. - */ - virtual ~CImagePrintDoc(); - - private: // Constructors and destructors - - /** - * Default constructor. - */ - CImagePrintDoc(CEikApplication& aApp); - - private: // Methods derived from CAknDocumnet - - /** - * Returns AppUi class - * - * @return Initialized instance of CEikAppUi - */ - CEikAppUi* CreateAppUiL(); - - public: // New methods - - /** - * Returns Engine - * - * @Return CImagePrintEngine Engine for this application - */ - CImagePrintEngine* Engine(); - - /** - * Returns discovery interface - * - * @return Device discovery interface - */ - MDiscovery* Discovery(); - - /** - * Returns print job interface - * - * @return Print job interface - */ - MPrintJob* PrintJob(); - - /** - * Returns print preview interface - * - * @return Print preview interface - */ - MPrintPreview* PrintPreview(); - - /** - * Returns settings interface - * - * @return Settings interface - */ - MPrintSettings* PrintSettings(); - - /** - * Initializes engine - */ - void InitializeEngineL(); - - /** - * Set selected images to engine. - * @param aArray array of printed image, ownership is transferred - */ - void SetImageArrayL( CDesCArrayFlat* aArray ); - - /** - * Restarts Image Print Engine - */ - void RestartEngine(); - - private: // Data - - // Engine for this application - CImagePrintEngine* iEngine; - }; - -#endif // CIMAGEPRINTDOC_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintsettingscontainer.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintsettingscontainer.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTSETTINGSCONTAINER_H -#define CIMAGEPRINTSETTINGSCONTAINER_H - -#include -#include -#include -#include -#include - -#include "midleprinteventobserver.h" - -class MObjectProvider; -class MPrintSettings; -class CPropertiesBoxModel; -class CImagePrintSettingsItemList; -class CImagePrintAppUi; -class MUIMode; - -/** - * - * Image print settings container - * - */ -class CImagePrintSettingsContainer - : public CCoeControl - { - - public: // Constructors and destructor - - /** - * Two-phase constructor - * @param aSettings Print settings interface - * @param aProvider Object provider for setting the MOP - * @paramt aClientRect The screen area - * @return Initialized instance of the class - */ - static CImagePrintSettingsContainer* NewL( - MPrintSettings* aSettings, - MObjectProvider* aProvider, - TRect aClientRect, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ); - - /** - * Destructor - */ - virtual ~CImagePrintSettingsContainer(); - - protected: // Constructors and destructor - - /** - * Constructor - * MPrintSettings* aSettings Print settings interface - */ - CImagePrintSettingsContainer( MPrintSettings* aSettings, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ); - - /** - * 2nd phase constructor - * MObjectProvider* aProvider Object provider for setting the MOP - * TRect aClientRect The screen area - */ - void ConstructL( MObjectProvider* aProvider, const TRect& aClientRect ); - - protected: // Methods derived from CCoeControl - - /** - * Returns the amount of owned UI controls - * - * @return Number of components - */ - TInt CountComponentControls() const; - - /** - * Gets the specified component of a compound control. - * - * @param aIndex The index of the control to get. - * @return The component control with an index of aIndex - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * Draws the control to the device screen - * - * @param aRect Modified area (not used) - */ - void Draw( const TRect& aRect ) const; - - void SizeChanged(); - void HandleResourceChange( TInt aType ); - - public: // New methods - - /** - * Starts editing the active item - */ - void EditItemL(); - - /** - * Starts the device discovery - * - * @param aProtocol protocol for which the discovery is done - * @param aHidden whether discovery is visible (dialog) or hidden - */ - void DoDiscoveryL( TInt aProtocol, TBool aHidden = EFalse ); - - /** - * Changes the text in status pane - * - * @param aName new text for status pane - */ - - void ChangeStatusPaneTextL( const TInt aCopiesOfImage ); - - /** - * Updates the size of settings list - * - * @param aRect new size for list - */ - void UpdateListSize( TRect aRect ); - - /** - * Tells ListBox to update itself as its' size has - * possible changed - */ - void UpdateListBox( ); - - protected: - - // Settings - MPrintSettings* iPrintSettings; - - // List box model - CPropertiesBoxModel* iModel; - - // Item list - CAknSettingStyleListBox* iListBox; - - // AppUi - CImagePrintAppUi* iAppUi; - - // USB connect note - CAknProgressDialog* iUSBConnectionWaitNote; - - MUIMode* iUIMode; - }; - -#endif // CIMAGEPRINTSETTINGSCONTAINER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintsettingsview.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimageprintsettingsview.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTSETTINGSVIEW_H -#define CIMAGEPRINTSETTINGSVIEW_H - -#include -#include -#include -#include -#include - -class MPrintSettings; -class MPrintJob; -class CImagePrintSettingsContainer; -class CIMGPPrintDlgManager; -class CImagePrintAppUi; -class MUIMode; - -const TUid KImageSettingsViewId = { 2 }; - -/** - * - * The settings view - * - */ -class CImagePrintSettingsView - : public CAknView - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aSettings Print settings - * @param aPrintJob Print job interface to the engine - * @return Initialized instance of this class - */ - static CImagePrintSettingsView* NewL( - MPrintSettings* aSettings, - MPrintJob* aPrintJob, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ); - static CImagePrintSettingsView* NewLC( - MPrintSettings* aSettings, - MPrintJob* aPrintJob, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ); - - /** - * Destructor - */ - virtual ~CImagePrintSettingsView(); - - protected: // Constructors and destructors - - /** - * Second-phase constructor - * - * @param aSettings Print settings - */ - void ConstructL( MPrintSettings* aSettings ); - - /** - * Constructor - * @param aPrintJob Print job interface to the engine - */ - CImagePrintSettingsView( MPrintJob* aPrintJob, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ); - - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - public: // Methods derived from CAknView - - /** - * Returns this view's ID - * @return View's Id - */ - TUid Id() const; - - /** - * Handles commands coming to the viwe - * @param aCommand The command ID - */ - void HandleCommandL(TInt aCommand); - - private: // Methods derived from CAknView - - /** - * Activates the view, creates container and other UI controls - * - * @param aPrevViewId Previous view's ID - * @param aCustomMessageId Custom message ID for the view (not used) - * @param aCustomMessage Custom messsage (not used) - */ - void DoActivateL( - const TVwsViewId &aPrevViewId, TUid aCustomMessageId, - const TDesC8 &aCustomMessage ); - - /** - * Called upon view deactivation - */ - void DoDeactivate(); - - /** - * Handle view foreground event - */ - void HandleForegroundEventL( TBool aForeground); - - private: // New methods - - /** - * Destroys control container and removes it from the stack - */ - void DestroyContainer(); - - /** - * Starts the printing sequence - */ - void StartPrintingL(); - void HandlePossibleLinkDisconnectionL(); - - private: // Data - - // Settings view control container - CImagePrintSettingsContainer* iContainer; - - // Pointer to the print settings interface - MPrintSettings* iSettings; - - // Pointer to print job interface - MPrintJob* iPrintJob; - - // Print dlg manager - CIMGPPrintDlgManager* iPrintDlgManager; - - //AppUI - CImagePrintAppUi* iAppUi; - - // Interface to UI mode - MUIMode* iUIMode; - }; - -#endif // CIMAGEPRINTSETTINGSVIEW_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cimgpviewemptyview.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cimgpviewemptyview.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMGPVIEWEMPTYVIEW_H -#define CIMGPVIEWEMPTYVIEW_H - -#include -#include - -class CImagePrintBlankContainer; - -const TUid KIMGPViewEmptyViewId = { 4 }; - -/** - * - * Empty view - * - */ -class CIMGPViewEmptyView : public CAknView - { - public: // Constructors and destructors - - /** - * Standard two-phase constructors - * - * @param aAppUi Pointer to Imageprint AppUi class - * @param aPrintJob Print job interface to the engine - * @return Initialized instance of the class - */ - static CIMGPViewEmptyView* NewL(); - - /** - * Destructor - */ - virtual ~CIMGPViewEmptyView(); - - protected: - - /** - * Constructor - * - */ - CIMGPViewEmptyView(); - - /** - * 2nd-phase constructor - */ - void ConstructL(); - - public: // Methods derived from CAknView - - TUid Id() const; - void HandleCommandL( TInt aCommand ); - private: // Methods derived from CAknView - - void DoActivateL ( const TVwsViewId &aPrevViewId, - TUid aCustomMessageId, - const TDesC8 &aCustomMessage ); - void DoDeactivate(); - - protected: - void SizeChanged(); - void HandleForegroundEventL( TBool aForeground ); - private: - CImagePrintBlankContainer* iContainer; - }; -#endif // CIMGPVIEWEMPTYVIEW_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/cpropertiesboxmodel.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/cpropertiesboxmodel.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* -* Copyright (c) 2004-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 CPROPERTIESBOXMODEL_H -#define CPROPERTIESBOXMODEL_H - -#include -#include -#include - -#include "mprintsettings.h" - -class CImagePrintSettingsContainer; -class CImagePrintEngine; - -const TInt KMaxListName = 128; - -/** - * - * List box model that handles the contents of the list box and launches - * the pop-up dialogs that are used . - * - */ -class CPropertiesBoxModel : - public CBase, - public MEikListBoxObserver, - public MDesCArray - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aSettings Print settings - * @return Initialized instance of CPropertiesBoxModel - */ - static CPropertiesBoxModel* NewL( CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ); - - static CPropertiesBoxModel* NewLC( CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ); - - /** - * Destructor - */ - virtual ~CPropertiesBoxModel(); - - private: // Constructors and destructors - - /** - * Constructor - * - * @param aSettings Print settings - */ - CPropertiesBoxModel( CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - public: // Methods derived from MEikListBoxObserver - - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - - /** - * Returns number of copies. - */ - TInt NumberOfCopies(); - - - private: // Methods derived from MDesCArray - - TInt MdcaCount() const; - TPtrC MdcaPoint( TInt aIndex ) const; - - private: // New methods - - /** - * Returns the index to the capability array from list box array - * - * @return Capability array index - */ - TUint CapabilityArrayIndex( TInt aListBoxIndex ) const; - - /** - * Stores current setting to the engine - */ - void SaveCurrentSelectionL( CBaseCapability &aCapab, CEikListBox* aListBox ); - - /** - * Launches list query for default printer - * - * @return wanted protocol - */ - TInt LaunchDefaultPrinterListL(); - - /** - * Stores number of copies value to the engine - * NOTE: Number of copies value is job based value since IP 6.2 - */ - void LaunchNumberOfCopiesDialogL(); - - /** - * Init print settings - */ - void InitSettingsL(); - - /** - * Sets DefaultPrinterItem for ListBox - */ - void SetDefaultPrinterItem() const; - - /** - * Sets SetNumberOfCopiesItem for ListBox - */ - void SetNumberOfCopiesItem() const; - - /** - * Sets other capability(template, papersize etc.) for ListBox - */ - void SetOtherCapability( const TInt &aIndex ) const; - - /** - * Sets number of copies value for settings - */ - void SetNumberOfCopiesValueL(); - - private: // Data - - CImagePrintEngine& iEngine; - MPrintSettings* iSettingsIF; // use - CPrintSettings* iPrintSettings; - TInt iCount; - TInt iNumberOfCopiesValue; - CImagePrintSettingsContainer* iContainer; - mutable TBuf iBuf; - HBufC* iDefaultPrinter; - HBufC* iNumberOfCopiesText; - HBufC* iMMC; - HBufC* iPictBridge; - }; - -#endif // CPROPERTIESBOXMODEL_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/imageprintapp.hrh --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/imageprintapp.hrh Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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 IMAGEPRINTAPP_HRH -#define IMAGEPRINTAPP_HRH - -enum TCustomControlsIDs - { - EPrintProgressNote = 0x2000, - EPrintWaitNote, - ENoPrintersConfirmation, - EBitmapCtrl, - EBrandingBitmap - }; - -// Commands for preview view -enum TPreviewView - { - ECmdPrint = 0x1000, - ECmdPrintSettings, - ECmdPrintNumberOfCopies, - ECmdPrintHelp = EAknCmdHelp - }; - -// Commands for the setting view's HandleCommandL() -enum TSettingsViewCommands - { - ESettingsChangeItem = 0x2200, - ESettingsPrint, - ESettingsExit - }; - -enum TImageSelectionViewCommands - { - ESelectMarked = 0x2400 - }; - -// View state for the binary setting items -enum TSettingsViewState - { - EOff = 0, - EOn = 1 - }; - -#endif // IMAGEPRINTAPP_HRH diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/imageprintconsts.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/imageprintconsts.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,460 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTCONSTS_H -#define IMAGEPRINTCONSTS_H - -// High resolution / Low resolution ratio. In LR mode all UI pixel -// parameter are half of corresponding HR parameter. -const TInt HLRatio( 2 ); - -// Preview Pane PORTRAIT -const TInt KPreviewPaneWidthPort( 256 ); -const TInt KPreviewPaneHeightPort( 256 ); -const TInt KPreviewPanePositionXPort( 0 ); -const TInt KPreviewPanePositionYPort( 0 ); -const TInt KTemplateIndLeftPosX1Port( 22 ); -const TInt KTemplateIndLeftPosY1Port( 228 ); -const TInt KTemplateIndLeftPosX2Port( 22 ); -const TInt KTemplateIndLeftPosY2Port( 252 ); -const TInt KTemplateIndLeftPosX3Port( 10 ); -const TInt KTemplateIndLeftPosY3Port( 240 ); -const TInt KTemplateIndRightPosX1Port( 236 ); -const TInt KTemplateIndRightPosY1Port( 228 ); -const TInt KTemplateIndRightPosX2Port( 236 ); -const TInt KTemplateIndRightPosY2Port( 252 ); -const TInt KTemplateIndRightPosX3Port( 248 ); -const TInt KTemplateIndRightPosY3Port( 240 ); -const TInt KPreviewPaneFontSizePort( 12 ); -const TInt KPortPaperWidthPort( 192 ); -const TInt KportPaperHeightPort( 256 ); -const TInt KPortPaperPositionXPort( 32 ); -const TInt KPortPaperPositionYPort( 0 ); -const TInt KLandPaperWidthPort( 256 ); -const TInt KLandPaperHeightPort( 192 ); -const TInt KLandPaperPositionXPort( 0 ); -const TInt KLandPaperPositionYPort( 32 ); -const TInt KPageNumberBoxPositionPortX( 170 ); -const TInt KPageNumberBoxSizePortX( 86 ); -const TInt KPageNumberBoxSizePortY( 35 ); - -// Preview Pane PORTRAIT QVGA -const TInt KPreviewPaneWidthPortQVGA( 200 ); // pane width -const TInt KPreviewPaneHeightPortQVGA( 200 ); // pane height -const TInt KPreviewPanePositionXPortQVGA( 0 ); // leftmost pos of pane -const TInt KPreviewPanePositionYPortQVGA( 0 ); // top pos of pane -const TInt KTemplateIndLeftPosX1PortQVGA( 20 ); //coordinates for left scroll arrow -const TInt KTemplateIndLeftPosY1PortQVGA( 176 ); -const TInt KTemplateIndLeftPosX2PortQVGA( 20 ); -const TInt KTemplateIndLeftPosY2PortQVGA( 196 ); -const TInt KTemplateIndLeftPosX3PortQVGA( 10 ); -const TInt KTemplateIndLeftPosY3PortQVGA( 186 ); -const TInt KTemplateIndRightPosX1PortQVGA( 180 ); //coordinates for right scroll arrow -const TInt KTemplateIndRightPosY1PortQVGA( 176 ); -const TInt KTemplateIndRightPosX2PortQVGA( 180 ); -const TInt KTemplateIndRightPosY2PortQVGA( 196 ); -const TInt KTemplateIndRightPosX3PortQVGA( 190 ); -const TInt KTemplateIndRightPosY3PortQVGA( 186 ); -const TInt KPortPaperWidthPortQVGA( 150 ); // portrait paper width -const TInt KportPaperHeightPortQVGA( 200 ); // portrait paper height -const TInt KPortPaperPositionXPortQVGA( 25 ); // portrait paper leftmost pos -const TInt KPortPaperPositionYPortQVGA( 0 ); // portrait paper top pos -const TInt KLandPaperWidthPortQVGA( 200 ); // landscape paper width -const TInt KLandPaperHeightPortQVGA( 150 ); // landscape paper height -const TInt KLandPaperPositionXPortQVGA( 0 ); // landscape paper leftmost pos -const TInt KLandPaperPositionYPortQVGA( 25 ); // landscape paper top pos -const TInt KPageNumberBoxPositionPortXQVGA( 128 ); // page number box leftmost pos -const TInt KPageNumberBoxSizePortXQVGA( 72 ); // page number box width -const TInt KPageNumberBoxSizePortYQVGA( 18 ); // page number box height - -// Preview Pane LANDSCAPE QVGA -const TInt KPreviewPaneWidthLandscapeQVGA( 192 ); // pane width -const TInt KPreviewPaneHeightLandscapeQVGA( 192 ); // pane height -const TInt KPreviewPanePositionXLandscapeQVGA( 0 ); // leftmost pos of pane -const TInt KPreviewPanePositionYLandscapeQVGA( 0 ); // top pos of pane -const TInt KTemplateIndLeftPosX1LandscapeQVGA( 20 ); //coordinates for left scroll arrow -const TInt KTemplateIndLeftPosY1LandscapeQVGA( 168 ); -const TInt KTemplateIndLeftPosX2LandscapeQVGA( 20 ); -const TInt KTemplateIndLeftPosY2LandscapeQVGA( 188 ); -const TInt KTemplateIndLeftPosX3LandscapeQVGA( 10 ); -const TInt KTemplateIndLeftPosY3LandscapeQVGA( 178 ); -const TInt KTemplateIndRightPosX1LandscapeQVGA( 172 ); //coordinates for right scroll arrow -const TInt KTemplateIndRightPosY1LandscapeQVGA( 168 ); -const TInt KTemplateIndRightPosX2LandscapeQVGA( 172 ); -const TInt KTemplateIndRightPosY2LandscapeQVGA( 188 ); -const TInt KTemplateIndRightPosX3LandscapeQVGA( 182 ); -const TInt KTemplateIndRightPosY3LandscapeQVGA( 178 ); -const TInt KportPaperWidthLandscapeQVGA( 144 ); // portrait paper width -const TInt KportPaperHeightLandscapeQVGA( 192 ); // portrait paper height -const TInt KPortPaperPositionXLandscapeQVGA( 24 ); // portrait paper leftmost pos -const TInt KPortPaperPositionYLandscapeQVGA( 0 ); // portrait paper top pos -const TInt KLandPaperWidthLandscapeQVGA( 192 ); // landscape paper width -const TInt KLandPaperHeightLandscapeQVGA( 144 ); // landscape paper height -const TInt KLandPaperPositionXLandscapeQVGA( 0 ); // landscape paper leftmost pos -const TInt KLandPaperPositionYLandscapeQVGA( 24 ); // landscape paper top pos -const TInt KPageNumberBoxPositionXLandscapeQVGA( 124 ); // page number box leftmost pos -const TInt KPageNumberBoxSizeXLandscapeQVGA( 68 ); // page number box width -const TInt KPageNumberBoxSizeYLandscapeQVGA( 18 ); // page number box height - -// Preview Pane LANDSCAPE -const TInt KPreviewPaneWidthLand( 288 ); -const TInt KPreviewPaneHeightLand( 288 ); -const TInt KPreviewPanePositionXLand( 0 ); -const TInt KPreviewPanePositionYLand( 0 ); -const TInt KTemplateIndLeftPosX1Land( 24 ); -const TInt KTemplateIndLeftPosY1Land( 258 ); -const TInt KTemplateIndLeftPosX2Land( 24 ); -const TInt KTemplateIndLeftPosY2Land( 282 ); -const TInt KTemplateIndLeftPosX3Land( 12 ); -const TInt KTemplateIndLeftPosY3Land( 270 ); -const TInt KTemplateIndRightPosX1Land( 264 ); -const TInt KTemplateIndRightPosY1Land( 258 ); -const TInt KTemplateIndRightPosX2Land( 264 ); -const TInt KTemplateIndRightPosY2Land( 282 ); -const TInt KTemplateIndRightPosX3Land( 276 ); -const TInt KTemplateIndRightPosY3Land( 270 ); -const TInt KPreviewPaneFontSizeLand( 12 ); -const TInt KPortPaperWidthLand( 216 ); -const TInt KPortPaperHeightLand( 288 ); -const TInt KPortPaperPositionXLand( 36 ); -const TInt KPortPaperPositionYLand( 0 ); -const TInt KLandPaperWidthLand( 288 ); -const TInt KLandPaperHeightLand( 216 ); -const TInt KLandPaperPositionXLand( 0 ); -const TInt KLandPaperPositionYLand( 36 ); -const TInt KPageNumberBoxPositionLandX( 202 ); -const TInt KPageNumberBoxSizeLandX( 86 ); -const TInt KPageNumberBoxSizeLandY( 35 ); - -// Browser Pane PORTRAIT -const TInt KBrowserPaneWidthPort( 96 ); -const TInt KBrowserPaneHeightPort( 256 ); -const TInt KBrowserPanePositionXPort( 256 ); -const TInt KBrowserPanePositionYPort( 0 ); -const TInt KDefaultCursorFillPositionXPort( 264 ); -const TInt KDefaultCursorFillPositionYPort( 20 ); -const TInt KCursorFillWidthPort( 79 ); -const TInt KCursorFillHeightPort( 69 ); -const TInt KMaxCursorRightSidePort( 346 ); -const TInt KMinCursorLeftSidePort( 60 ); -const TInt KCursorStepPort( 72 ); //42 -const TInt KDefaultThumbnailPositionXPort( 12 ); -const TInt KDefaultThumbnailPositionYPort( 24 ); -const TInt KThumbnailImgWidthPort( 72 ); // 72 -const TInt KThumbnailImgHeightPort( 62 ); // 65 -const TInt KCursorFillPenSizePort( 4 ); -const TInt KCursorPenSizePort( 4 ); -const TInt KMaxCursorTopPositionPort( 78 ); //check -const TInt KMaxCursorBottomPositionPort( 232 ); - -const TInt KImageIndUpPosX1Port( 292 ); -const TInt KImageIndUpPosY1Port( 14 ); -const TInt KImageIndUpPosX2Port( 316 ); -const TInt KImageIndUpPosY2Port( 14 ); -const TInt KImageIndUpPosX3Port( 304 ); -const TInt KImageIndUpPosY3Port( 2 ); -const TInt KImageIndDownPosX1Port( 292 ); -const TInt KImageIndDownPosY1Port( 242 ); -const TInt KImageIndDownPosX2Port( 316 ); -const TInt KImageIndDownPosY2Port( 242 ); -const TInt KImageIndDownPosX3Port( 304 ); -const TInt KImageIndDownPosY3Port( 254 ); - -// Browser Pane PORTRAIT QVGA -const TInt KBrowserPaneWidthPortQVGA( 40 ); // browser pane width -const TInt KBrowserPaneHeightPortQVGA( 200 ); // browser pane height -const TInt KBrowserPanePositionXPortQVGA( 200 ); // browser pane leftmost pos -const TInt KBrowserPanePositionYPortQVGA( 0 ); // browser pane top pos - -const TInt KDefaultCursorFillPositionXPortQVGA( 201 ); // cursor initial leftmost pos -const TInt KDefaultCursorFillPositionYPortQVGA( 43 ); // cursor initial top pos -const TInt KCursorFillWidthPortQVGA( 38 ); // cursor width -const TInt KCursorFillHeightPortQVGA( 33 ); // cursor height -const TInt KCursorStepPortQVGA( 40 ); // height pos diff between thumbnails -const TInt KDefaultThumbnailPositionXPortQVGA( 1 ); // 1st thumbnail initial leftmost pos -const TInt KDefaultThumbnailPositionYPortQVGA( 45 ); // 1st thumbnail initial top pos -const TInt KThumbnailImgWidthPortQVGA( 38 ); // thumbnail image width -const TInt KThumbnailImgHeightPortQVGA( 29 ); // thumbnail image height -const TInt KCursorPenSizePortQVGA( 4 ); // cursor frame size -const TInt KMaxCursorTopPositionPortQVGA( 55 ); // cursor top limit -const TInt KMaxCursorBottomPositionPortQVGA( 155 ); // cursor bottom limit - -const TInt KImageIndUpPosX1PortQVGA( 210 ); //coordinates for up scroll arrow -const TInt KImageIndUpPosY1PortQVGA( 25 ); -const TInt KImageIndUpPosX2PortQVGA( 230 ); -const TInt KImageIndUpPosY2PortQVGA( 25 ); -const TInt KImageIndUpPosX3PortQVGA( 220 ); -const TInt KImageIndUpPosY3PortQVGA( 15 ); -const TInt KImageIndDownPosX1PortQVGA( 210 ); //coordinates for down scroll arrow -const TInt KImageIndDownPosY1PortQVGA( 175 ); -const TInt KImageIndDownPosX2PortQVGA( 230 ); -const TInt KImageIndDownPosY2PortQVGA( 175 ); -const TInt KImageIndDownPosX3PortQVGA( 220 ); -const TInt KImageIndDownPosY3PortQVGA( 185 ); - -// Browser Pane LANDSCAPE QVGA -const TInt KBrowserPaneWidthLandscapeQVGA( 128 ); // browser pane width -const TInt KBrowserPaneHeightLandscapeQVGA( 192 ); // browser pane height -const TInt KBrowserPanePositionXLandscapeQVGA( 192 ); // browser pane leftmost pos -const TInt KBrowserPanePositionYLandscapeQVGA( 0 ); // browser pane top pos -const TInt KDefaultCursorFillPositionXLandscapeQVGA( 216 );// cursor initial leftmost pos -const TInt KDefaultCursorFillPositionYLandscapeQVGA( 3 ); // cursor initial top pos -const TInt KCursorFillWidthLandscapeQVGA( 79 ); // cursor width -const TInt KCursorFillHeightLandscapeQVGA( 60 ); // cursor height -const TInt KCursorStepLandscapeQVGA( 61 ); // height pos diff between thumbnails -const TInt KDefaultThumbnailPositionXLandscapeQVGA( 26 ); // 1st thumbnail initial leftmost pos -const TInt KDefaultThumbnailPositionYLandscapeQVGA( 5 ); // 1st thumbnail initial top pos -const TInt KThumbnailImgWidthLandscapeQVGA( 77 ); // thumbnail image width -const TInt KThumbnailImgHeightLandscapeQVGA( 58 ); // thumbnail image height -const TInt KCursorPenSizeLandscapeQVGA( 4 ); // cursor frame size -const TInt KMaxCursorTopPositionLandscapeQVGA( 10 ); // cursor top limit -const TInt KMaxCursorBottomPositionLandscapeQVGA( 155 ); // cursor bottom limit -const TInt KImageIndUpPosX1LandscapeQVGA( 199 ); //coordinates for up scroll arrow -const TInt KImageIndUpPosY1LandscapeQVGA( 30 ); -const TInt KImageIndUpPosX2LandscapeQVGA( 209 ); -const TInt KImageIndUpPosY2LandscapeQVGA( 30 ); -const TInt KImageIndUpPosX3LandscapeQVGA( 204 ); -const TInt KImageIndUpPosY3LandscapeQVGA( 20 ); -const TInt KImageIndDownPosX1LandscapeQVGA( 199 ); //coordinates for down scroll arrow -const TInt KImageIndDownPosY1LandscapeQVGA( 172 ); -const TInt KImageIndDownPosX2LandscapeQVGA( 209 ); -const TInt KImageIndDownPosY2LandscapeQVGA( 172 ); -const TInt KImageIndDownPosX3LandscapeQVGA( 204 ); -const TInt KImageIndDownPosY3LandscapeQVGA( 182 ); - -// Browser Pane LANDSCAPE -const TInt KBrowserPaneWidthLand( 128 ); -const TInt KBrowserPaneHeightLand( 288 ); -const TInt KBrowserPanePositionXLand( 288 ); -const TInt KBrowserPanePositionYLand( 0 ); -const TInt KDefaultCursorFillPositionXLand( 298 ); -const TInt KDefaultCursorFillPositionYLand( 21 ); -const TInt KCursorFillWidthLand( 108 ); -const TInt KCursorFillHeightLand( 82 ); -const TInt KMaxCursorRightSideLand( 346 ); -const TInt KMinCursorLeftSideLand( 60 ); -const TInt KCursorStepLand( 82 ); //42 -const TInt KDefaultThumbnailPositionXLand( 14 ); -const TInt KDefaultThumbnailPositionYLand( 25 ); -const TInt KThumbnailImgWidthLand( 100 ); -const TInt KThumbnailImgHeightLand( 74 ); -const TInt KCursorFillPenSizeLand( 4 ); -const TInt KCursorPenSizeLand( 4 ); -const TInt KMaxCursorTopPositionLand( 78 ); //check -const TInt KMaxCursorBottomPositionLand( 232 ); - -const TInt KImageIndUpPosX1Land( 340 ); -const TInt KImageIndUpPosY1Land( 14 ); -const TInt KImageIndUpPosX2Land( 364 ); -const TInt KImageIndUpPosY2Land( 14 ); -const TInt KImageIndUpPosX3Land( 352 ); -const TInt KImageIndUpPosY3Land( 2 ); -const TInt KImageIndDownPosX1Land( 340 ); -const TInt KImageIndDownPosY1Land( 274 ); -const TInt KImageIndDownPosX2Land( 364 ); -const TInt KImageIndDownPosY2Land( 274 ); -const TInt KImageIndDownPosX3Land( 352 ); -const TInt KImageIndDownPosY3Land( 286 ); - -// Browser pane general -const TInt KMaxTemplatesOnScreen( 3 ); // max image thumbnails to see in browse pane -const TInt KNoBrowserIndicators( 0 ); -const TInt KLeftBrowserIndicator( 1 ); -const TInt KRightBrowserIndicator( 2 ); -const TInt KBothBrowserIndicators( 3 ); -const TInt KCursorPositionOne( 1 ); -const TInt KCursorPositionTwo( 2 ); -const TInt KCursorPositionThree( 3 ); -const TInt KCursorFillColorR( 102 ); -const TInt KCursorFillColorG( 153 ); -const TInt KCursorFillColorB( 255 ); -const TInt KBrowserPaneCursorUp( -1 ); -const TInt KBrowserPaneCursorDown( 1 ); -const TInt KBrowserPaneCursorLeft( -1 ); -const TInt KBrowserPaneCursorRight( 1 ); - -//Info Pane - PORTRAIT -const TInt KInfoPaneWidth(352); -const TInt KInfoPaneHeight(32); -const TInt KInfoPanePositionX( 0 ); -const TInt KInfoPanePositionY( 256 ); - -//Info Pane - PORTRAIT QVGA -const TInt KInfoPaneWidthQVGA( 240 ); // info pane width -const TInt KInfoPaneHeightQVGA( 24 ); // info pane height -const TInt KInfoPanePositionXQVGA( 0 ); // info pane leftmost pos -const TInt KInfoPanePositionYQVGA( 200 ); // info pane top pos - -//Tooltip - GENERAL -const TInt KTooltipDelay( 3000000 ); -const TUint32 KTooltipTransparency( 0x333333 ); -const TInt KNumberInputInterval( 750000 ); - -//Tooltip - PORTRAIT -const TInt KTooltipWidthPort( 288 ); -const TInt KTooltipHeightPort( 226 ); -const TInt KTooltipPositionXPort( 32 ); -const TInt KTooltipPositionYPort( 15 ); -const TInt KTooltipPaddingPort( 10 ); - -//Tooltip - PORTRAIT QVGA -const TInt KTooltipWidthPortQVGA( 200 ); -const TInt KTooltipHeightPortQVGA( 170 ); -const TInt KTooltipPositionXPortQVGA( 20 ); -const TInt KTooltipPositionYPortQVGA( 15 ); -const TInt KTooltipPaddingPortQVGA( 10 ); - -//Tooltip - LANDSCAPE -const TInt KTooltipWidthLand( 352 ); -const TInt KTooltipHeightLand( 226 ); -const TInt KTooltipPositionXLand( 32 ); -const TInt KTooltipPositionYLand( 31 ); -const TInt KTooltipPaddingLand( 10 ); - -//Tooltip - LANDSCAPE QVGA -const TInt KTooltipWidthLandQVGA( 240 ); -const TInt KTooltipHeightLandQVGA( 170 ); -const TInt KTooltipPositionXLandQVGA( 35 ); -const TInt KTooltipPositionYLandQVGA( 11 ); -const TInt KTooltipPaddingLandQVGA( 10 ); - -//SliderQuery - GENERAL -const TUint32 KSliderQueryTransparency( 0x333333 ); - -//SliderQuery - PORTRAIT -const TInt KSliderQueryWidthPort( 352 ); -const TInt KSliderQueryHeightPort( 128 ); -const TInt KSliderQueryPositionXPort( 0 ); -const TInt KSliderQueryPositionYPort( 160 ); - -const TInt KSliderQueryButtonLeftXPort( 10 ); -const TInt KSliderQueryButtonLeftYPort( 75 ); -const TInt KSliderQueryBarXPort( 40 ); -const TInt KSliderQueryBarYPort( 84 ); -const TInt KSliderQueryButtonRightXPort( 322 ); -const TInt KSliderQueryButtonRightYPort( 75 ); - -const TInt KSliderQueryButtonSizeXPort( 20 ); -const TInt KSliderQueryButtonSizeYPort( 20 ); -const TInt KSliderQueryBarSizeXPort( 272 ); -const TInt KSliderQueryBarSizeYPort( 2 ); -const TInt KSliderQueryHandleSizeXPort( 42 ); -const TInt KSliderQueryHandleSizeYPort( 42 ); - -const TInt KSliderQueryTitlePosXPort( 10 ); -const TInt KSliderQueryTitlePosYPort( 0 ); -const TInt KSliderQueryTitleSizXPort( 282 ); -const TInt KSliderQueryTitleSizYPort( 64 ); - -const TInt KSliderQueryHandlePositionYPort( 64 ); - -//SliderQuery - PORTRAIT QVGA -const TInt KSliderQueryWidthPortQVGA( 240 ); -const TInt KSliderQueryHeightPortQVGA( 100 ); -const TInt KSliderQueryPositionXPortQVGA( 0 ); -const TInt KSliderQueryPositionYPortQVGA( 124 ); - -const TInt KSliderQueryButtonLeftXPortQVGA( 8 ); -const TInt KSliderQueryButtonLeftYPortQVGA( 59 ); -const TInt KSliderQueryBarXPortQVGA( 25 ); -const TInt KSliderQueryBarYPortQVGA( 65 ); -const TInt KSliderQueryButtonRightXPortQVGA( 218 ); -const TInt KSliderQueryButtonRightYPortQVGA( 59 ); - -const TInt KSliderQueryButtonSizeXPortQVGA( 14 ); -const TInt KSliderQueryButtonSizeYPortQVGA( 14 ); -const TInt KSliderQueryBarSizeXPortQVGA( 190 ); -const TInt KSliderQueryBarSizeYPortQVGA( 2 ); -const TInt KSliderQueryHandleSizeXPortQVGA( 32 ); -const TInt KSliderQueryHandleSizeYPortQVGA( 32 ); - -const TInt KSliderQueryTitlePosXPortQVGA( 8 ); -const TInt KSliderQueryTitlePosYPortQVGA( 0 ); -const TInt KSliderQueryTitleSizXPortQVGA( 190 ); -const TInt KSliderQueryTitleSizYPortQVGA( 50 ); - -const TInt KSliderQueryHandlePositionYPortQVGA( 50 ); - -//SliderQuery - LANDSCAPE -const TInt KSliderQueryWidthLand( 416 ); -const TInt KSliderQueryHeightLand( 144 ); -const TInt KSliderQueryPositionXLand( 0 ); -const TInt KSliderQueryPositionYLand( 144 ); - -const TInt KSliderQueryButtonLeftXLand( 19 ); -const TInt KSliderQueryButtonLeftYLand( 86 ); -const TInt KSliderQueryBarXLand( 58 ); -const TInt KSliderQueryBarYLand( 95 ); -const TInt KSliderQueryButtonRightXLand( 377 ); -const TInt KSliderQueryButtonRightYLand( 86 ); - -const TInt KSliderQueryButtonSizeXLand( 20 ); -const TInt KSliderQueryButtonSizeYLand( 20 ); -const TInt KSliderQueryBarSizeXLand( 299 ); -const TInt KSliderQueryBarSizeYLand( 2 ); -const TInt KSliderQueryHandleSizeXLand( 42 ); -const TInt KSliderQueryHandleSizeYLand( 42 ); - -const TInt KSliderQueryTitlePosXLand( 19 ); -const TInt KSliderQueryTitlePosYLand( 0 ); -const TInt KSliderQueryTitleSizXLand( 299 ); -const TInt KSliderQueryTitleSizYLand( 73 ); - -const TInt KSliderQueryHandlePositionYLand( 73 ); - -//SliderQuery - LANDSCAPE QVGA -const TInt KSliderQueryWidthLandQVGA( 320 ); -const TInt KSliderQueryHeightLandQVGA( 96 ); -const TInt KSliderQueryPositionXLandQVGA( 0 ); -const TInt KSliderQueryPositionYLandQVGA( 96 ); - -const TInt KSliderQueryButtonLeftXLandQVGA( 13 ); -const TInt KSliderQueryButtonLeftYLandQVGA( 57 ); -const TInt KSliderQueryBarXLandQVGA( 40 ); -const TInt KSliderQueryBarYLandQVGA( 63 ); -const TInt KSliderQueryButtonRightXLandQVGA( 293 ); -const TInt KSliderQueryButtonRightYLandQVGA( 57 ); - -const TInt KSliderQueryButtonSizeXLandQVGA( 14 ); -const TInt KSliderQueryButtonSizeYLandQVGA( 14 ); -const TInt KSliderQueryBarSizeXLandQVGA( 240 ); -const TInt KSliderQueryBarSizeYLandQVGA( 2 ); -const TInt KSliderQueryHandleSizeXLandQVGA( 32 ); -const TInt KSliderQueryHandleSizeYLandQVGA( 32 ); - -const TInt KSliderQueryTitlePosXLandQVGA( 13 ); -const TInt KSliderQueryTitlePosYLandQVGA( 0 ); -const TInt KSliderQueryTitleSizXLandQVGA( 240 ); -const TInt KSliderQueryTitleSizYLandQVGA( 48 ); - -const TInt KSliderQueryHandlePositionYLandQVGA( 48 ); - -// GENERAL -const TInt KScreenModePortrait = 0; -const TInt KScreenModeLandscape = 1; -const TInt KScreenModePortraitQVGA = 2; -const TInt KScreenModeLandscapeQVGA = 3; - -const TInt KScreenWidthPortrait = 352; -const TInt KScreenWidthLandscape = 416; -const TInt KScreenWidthPortraitQVGA = 240; -const TInt KScreenWidthLandscapeQVGA = 320; - -#endif // IMAGEPRINTCONSTS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/mprintingobserver.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/mprintingobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTINGOBSERVER_H -#define MPRINTINGOBSERVER_H - -#include -#include - -/** - * - * Interface for observing printing status - * - */ -class MPrintingObserver - { - public: // Abstract methods - - /** - * Receive info that printing process has been ended - * - * @param aPrintingCanceled ETrue if printing was ended by canceling - * the process, otherwise EFalse - */ - virtual void PrintingCompletedL( TBool aPrintingCanceled = EFalse ) = 0; - }; - -#endif // MPRINTINGOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/muimode.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/muimode.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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: -* -*/ - - -#ifndef MUIMODE_H -#define MUIMODE_H - -#include -#include - -class MDiscovery; - -/** - * - * Base class for UI mode classes - * - */ -class MUIMode - { - public: - - virtual ~MUIMode(){}; - - public: // New methods - - /** - * Called when applaction starts. Finds the default printer or - * starts the full discovery if it is not available - */ - virtual void SearchDefaultPrinterL() = 0; - - /** - * Called when specific protocol is needed. - */ - virtual TBool ChangeDefaultPrinterL( TInt aProtocol ) = 0; - - - }; - -#endif // MUIMODE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/muimodeobserver.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/muimodeobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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: -* -*/ - - -#ifndef MUIMODEOBSERVER_H -#define MUIMODEOBSERVER_H - -#include - -/** - * - * Observer class that informs AppUi class to change view, - * exit application etc. - * - */ -class MUIModeObserver - { - public: - - // available views - enum TView - { - ImageSelectionView, - PreviewView, - SettingsView - }; - - /** - * Changes the view to the given one - * - * @param aView the view to be changed to - */ - virtual void ChangeViewL( TInt aView ) = 0; - - /** - * Exits the application - */ - virtual void ExitApplication() = 0; - - /** - * Sets the text for navipane - * - * @param aCopiesOfImage image count for navepane - * @param aPaperSize paper size text for navipane - */ - virtual void SetNavipaneTextL( const TInt aCopiesOfImage, HBufC* aPaperSize = NULL ) = 0; - - }; - -#endif // MUIMODEOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/printapputil.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/printapputil.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2004-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 PRINTAPPUTIL_H -#define PRINTAPPUTIL_H - -#include - -/** - * - * Utility class that contains small static helper methods to group - * the common functionality - * - */ -class PrintAppUtil - { - public: - - /** - * Displays error note using given resource id as the text - * - * @param aResourceId Resource ID for the given error text - */ - static void ShowErrorNoteL( TInt aResourceId ); - - /** - * Displays information note using given resource id as the text - * - * @param aResourceId Resource ID for the given error text - */ - static void ShowInfoNoteL( TInt aResourceId ); - - /** - * Displays error note using given error code as the source - * for the text - * - * @param aErrCode Error code - */ - static void ShowErrorMsgL( TInt aErrCode ); - - /** - * Loads error message specifically created for printer application - * - * @param aErrCode Error code - * - * @return the error message string for given error code - */ - static HBufC* PrintErrorMsgLC( TInt aErrCode ); - - /** - * Returns filename with the application path - * - * @param aFileName The filename - * - * @return filename added to the application path - */ - static TFileName AddApplicationPath( const TDesC& aFileName ); - }; - - -#endif // PRINTAPPUTIL_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/inc/uimodefactory.h --- a/ImagePrint/ImagePrintUI/imageprintapp/inc/uimodefactory.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2004-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 UIMODEFACTORY_H -#define UIMODEFACTORY_H - -#include -#include - -#include "cimageprintappui.h" -#include "muimodeobserver.h" -#include "muimode.h" - -class CAiwMode; -class CIdleMode; -class CIFFactory; - -/** - * Factory class for UI mode objects - */ -class UIModeFactory - { - public: // Constructors and destructors - - /** - * Creates the UI mode specified with parametres - * - * @param aAiwMode Whether Aiw mode is the one to be created - * @param aUIModeObserver Pointer to UI mode observer - * @param aIFFactory Interface factory to be used - * - * @return The newly created UI mode object - */ - static MUIMode* CreateL( TBool aAiwMode, - MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ); - - protected: - - ~UIModeFactory(); - }; - -#endif // UIMODEFACTORY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/loc/imageprintapp.loc --- a/ImagePrint/ImagePrintUI/imageprintapp/loc/imageprintapp.loc Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,427 +0,0 @@ -/* -* Copyright (c) 2002-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: The localization file for user interface in Image Print R6.2 -* -*/ - - -/** -* Syntax of a logical name entry in this file is the following: -* -* // d:context description (line 1) -* // d:context description (line N) -* // l:P_No -* // r:n.n (n=0..N) -* -* #define qtn_?feature/?module_name_?freetext "?text" -* #define text_?feature/?module_name_?freetext "?text" -* -* where -* "qtn_" or "text_" starts a logical name, which does not -* contain dots. -* "d:" starts description line(s), which -* clarify entry's context with information like: -* 1. Is a word a verb in imperative or is it a noun ? -* - what does text "Set" mean ? -* 2. What will replace %U (unicode text parameter) or -* %N (number parameter) included in texts ? -* - is it phone number or email address ? -* "l:" starts a layout information (one line). -* "P" and "No" are symbols in LAF's information table -* - "P" is parent pane or current pane -* - "No" is reference number in table -* "r:" starts the release information line. Write here the release -* where the text will be used for the first time. -* -*/ - -// LOCALISATION STRINGS - -// d:Search again text on device discovery dialog -// l:list_single_pane_t1_cp2 -#define qtn_print_search_again "Search again" - -// d:Info note displayed to user to connect the cable -// l:popup_note_window -#define qtn_print_connect_usb_note "Connect USB printer" - -// d:Printing error note, notifies user that the printer has run out of paper -// l:popup_note_window -#define qtn_print_outofpaper_error "Out of paper" - -// d:Printing error note, notifies user to check the printer -// l:popup_note_window -#define qtn_print_status_error "Check status of printer" - -// d:Printing error note, couldn't find the file from device/MMC -// l:popup_note_window -#define qtn_print_not_found_error "File not found." - -// d:Printing error note, notifies user that the printer has run out of ink -// l:popup_note_window -#define qtn_print_outofink_error "Out of ink" - -// d:Printing error note, notifies user that the printer is running out of ink -// l:popup_note_window -#define qtn_print_inklow_error "Ink low" - -// d:Help command in the "Options" menu of Image Print -// l:list_single_pane_t1_cp2 -#define qtn_print_menu_opt_help "Help" - -// d:Text used in the wait note when either printer discovery or print job has been cancelled. -// l:popup_note_wait_window -#define qtn_print_progress_prompt_cancel "Cancelling" - -// d:(No printers) text on device discovery dialog while the search is ongoing and nothing has been found -// l:main_list_empty_pane/opt1 -#define qtn_print_no_printers "(No printers)" - -// d:Information dialog text that is shown after successful MMC printing -// d:There is an icon on the upper right corner of the note. -// l:popup_note_window -#define qtn_print_mmc_print_note "Images copied to memory card. Memory card may now be used in DPOF printer." - -// d:Information dialog text that is shown after after successful MMC printing with one picture -// d:There is an icon on the upper right corner of the note. -// l:popup_note_window -#define qtn_print_mmc_print_note_one_picture "Image copied to memory card. Memory card may now be used in DPOF printer." - -// d:Error note that is displayed, when MMC printing is failed. -// d:There is an icon on the upper right corner of the note. -// l:popup_note_window -#define qtn_print_note_mmccopyfail "Copying to memory card failed. Remove data from memory card and try again." - -// d:Printing error note -// d:Error note is displayed when the connection is unexpectedly terminated while the -// d:printer is printing or somehow connected to a printer. This can be caused by error in link (e.g. Bluetooth connection -// d:goes out-of-range or USB cable is disconnected) or then a software error happens, data is not transmitted and -// d:system timeout causes transmission to terminate. -// l:popup_note_window -#define qtn_print_disconnect_error "Connection to printer lost" - -// d: Obs. This string is also used in Image Print Title pane. -// d:Application's name on application shell -// l:list_single_large_graphic_pane_t1 -#define qtn_app_caption_string "Image print" - -// NOTE!!!!! THERE IS A SMALL GRAPHIC ANIMATION AT THE END OF THIS LINE -// d:Title text for device discovery popup list -// l:heading_pane_t1/opt1 -#define qtn_print_selectprinter_prompt "Select printer" - -// d:Text on the device discovery pop-up list -// l:list_single_large_graphic_pane_t1_cp2/opt1 -#define qtn_print_memory_card "Memory card" - -// d:Print command in the "Options" menu of the print view -// l:list_single_pane_t1_cp2 -#define qtn_print_menu_opt_print "Print" - -// d:Exit command in the "Options" menu of the print view -// l:list_single_pane_t1_cp2 -#define qtn_print_menu_opt_exit "Exit" - -// NOTE!!!!! ONLY ONE TEXT LINE ALLOWED -// d:Text on the print progress dialog -// l:popup_note_wait_window -#define qtn_print_progress_prompt "Printing" - -// NOTE!!!!! ONLY ONE TEXT LINE ALLOWED -// d:Text on the print progress dialog when copying files to MMC card -// l:popup_note_wait_window -#define qtn_print_progress_prompt_mmc "Copying" - -// d:Change command in the "Options" menu of the print settings view -// l:list_single_pane_t1_cp2 -#define qtn_print_settings_opt_change "Change" - -// d:Paper size capability presented in the list box in print settings view -// l:list_setting_pane_t1 -#define qtn_print_settings_paper_size "Paper size" - -// d:Paper size "Automatic" in the print settings view settings value -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_auto "Automatic" - -// d:Paper size "US Letter" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_letter "US Letter" - -// d:Paper size "A4" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_a4 "A4" - -// d:Paper size "A6" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_a6 "A6" - -// d:Paper size "4x6" in the print settings view list box / pop-up window -// d:4x6 means paper size of 4 inches by 6 inches. This needs to be converted -// d:in country localizations that use metric system -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_4x6 "4x6" - -// d:Paper size "5x7" in the print settings view list box / pop-up window -// d:5x7 means paper size of 5 inches by 7 inches. This needs to be converted -// d:in country localizations that use metric system -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_5x7 "5x7" - -// d:Paper size "Sticker" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_paper_size_sticker "Sticker" - -// d:Print quality capability presented in the list box in print settings view -// l:list_setting_pane_t1 -#define qtn_print_settings_print_quality "Print quality" - -// d:Print quality "Automatic" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_quality_auto "Automatic" - -// d:Print quality "Normal" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_quality_normal "Normal" - -// d:Print quality "Draft" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_quality_draft "Draft" - -// d:Print quality "Fine" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_quality_fine "Fine" - -// d:Printing error note -// d:Error note is displayed, when connection over the chosen transmission technology fails, -// d:e.g. application tries to establish connection to printer over Bluetooth, but it is unable -// d:to do so. -// l:popup_note_window -#define qtn_print_connect_error "Unable to connect to printer" - -// d:Printing error note -// l:popup_note_window -#define qtn_print_send_error "Unable to send image to printer. Printer may be busy" - -// d:Printing error note -// d:This is a generic error note that is displayed, when no specific error message is available. -// d:It tells to user that there has been problem during printing and (most probably) the printer -// d:will cancel its current print job. -// l:popup_note_window -#define qtn_print_general_error "Printing error" - -// d:Selected printer capability presented in the list box in print settings view -// l:list_setting_pane_t1 -#define qtn_print_selected_printer "Selected printer" - -// d:Default printer "PictBridge" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_settings_default_usb "PictBridge" - -// d:Default printer "Bluetooth" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_settings_default_bt "Bluetooth" - -// d:Printing information note. -// d:This note is used to inform the user that one or many files of unsupported type(other than .jpeg) has been -// d:selected and the application will discard them and continue with the images that are of the supported filetype(.jpeg). -// l:popup_note_window -#define qtn_print_wrongtype_note "Filetypes that are not supported will be removed from the selection." - -// d:Printing information note. -// d:This note is used to inform the user that (s)he has selected only images that are not supported -// d:by the application and has therefore to select new ones to print. -// d:This often follows the qtn_print_wrongtype_note note. -// l:popup_note_window/opt2 -#define qtn_print_selectnew_note "Select new images for printing." - -// d:Printing information note. -// d:The purpose of the note is to inform the user that printing is already ongoing -// d:and it may therefore not be initiated again elsewhere. -// l:popup_note_window/opt2 -#define qtn_print_concurrent_note "Application already in use." - -// d:Text used in the wait note when a hidden discovery is ongoing. -// l:popup_note_wait_window -#define qtn_print_progress_prompt_pro "Processing" - -// d:Default printer "WLAN printer" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_settings_default_wlan "WLAN printer" - -// d:Number of copies pop up prompt. -// l:list_setting_pane_t1 -#define qtn_print_settings_noc "Number of copies:" - -// d:Template capability as settings item in settings view -// l:list_setting_pane_t1 -#define qtn_print_settings_template "Images per page" - -// d:Template 1 per page "1 borderless" in the print settings view list box / pop-up window -// l:list_set_graphic_pane_t1 -#define qtn_print_settings_bless "1 borderless" - -// NOTE!!!!! THERE IS A SMALL GRAPHIC ANIMATION AT THE END OF THIS LINE -// d:Title text for device discovery popup list -// l:heading_pane_t1 -#define qtn_print_selectprinter_prompt2 "Searching" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_load_error "Paper not loaded correctly" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_eject_error "Paper not ejected correctly" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_media_error "Media error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_jam_error "Paper jam" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_combination_error "Paper type/size not supported" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_low_error "Input tray is low on paper" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paper_error "Paper-related error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_file_decode_error "Unable to decode image file" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_file_error "File-related error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_ink_waste_error "Waste-ink reservior full" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_ink_error "Ink-related error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_cover_open_error "Cover open" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_fatal_error "Fatal error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_servicecall_error "Service call" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_printer_unavailable_error "Printer unavailable" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_printer_busy_error "Printer busy" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_lever_error "Lever position not correct" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_no_marking_agent_error "No marking agent" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_ink_cover_open_error "Ink cover open" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_no_ink_cartridge_error "No ink cartridge" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_hardware_error "Hardware-related error" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_output_area_almost_full_error "Output area is almost full" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_output_area_full_error "Output area is full" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_marker_supply_low_error "Marker supply low" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_marker_supply_empty_error "Marker supply is empty" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_marker_failure_error "Marker device failed" - -// d:Printing error note, notifies user that problem occurred while printing -// l:popup_note_window -#define qtn_print_paused_error "Printer is paused" - -// d:Confirmation query for memory card printing -// l:popup_note_window -#define qtn_print_dpof_confirmation_dialog "Existing print job in memory card will be overwritten" - -// d:Confirmation query for launching wlan wizard, header -// l:heading_pane_t1 -#define qtn_launch_wlan_wizard_query_header "WLAN printer" - -// d:Confirmation query for launching wlan wizard, message -// l:popup_note_window -#define qtn_launch_wlan_wizard_query_msg "Home network access point must be defined. Do you want to start setup wizard to define it?" - -// d:Application interworking (AIW) menu command. -// d:Starts ImagePrint application. -// l:list_single_popup_submenu_pane_t1 -// r:6.2 -#define qtn_aiw_command_print "Print" - -// d: Text when there is no printer selected in settings view -// l: list_set_graphic_pane_t1 -// r: 6.2 -#define qtn_print_no_printer "No printer" - -// d:Navi pane text when multiple images are selected to print. -// d:Or when one image is selected to print multiple times (number of copies is greater than 1). -// d:%N contains the number of the selected images/copies of one image. -// d:E.g. '17 images', '2 images', '67 images' -// d:Maximum number of images is 999, so maximum length of %N is 3 characters ('999 images'). -// l:navi_navi_text_pane_t1 -// r:6.2 -#define qtn_printjob_images "%N images" - -// d:Navi pane text when only one image and one copy of it is selected to print. -// l:navi_navi_text_pane_t1 -// r:6.2 -#define qtn_printjob_image "1 image" - -CHARACTER_SET UTF8 - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/caiwmode.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/caiwmode.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +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: -* -*/ - - -#include "caiwmode.h" -#include "muimodeobserver.h" -#include "muimode.h" -#include "mprintsettings.h" -#include "cuiprotocolcontroller.h" -#include "ciffactory.h" -#include "mdiscoveryobserver.h" - -CAiwMode* CAiwMode::NewL( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ) - { - CAiwMode* self = NewLC( aUIModeObserver, aIFFactory ); - CleanupStack::Pop( self ); - return self; - } - -CAiwMode* CAiwMode::NewLC( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ) - { - CAiwMode* self = new ( ELeave ) CAiwMode( aUIModeObserver ); - CleanupStack::PushL( self ); - self->ConstructL( aIFFactory ); - return self; - } - -// Default constructor -CAiwMode::CAiwMode( MUIModeObserver* aUIModeObserver ) - { - iUIModeObserver = aUIModeObserver; - } - -// 2nd phase constructor -void CAiwMode::ConstructL( CIFFactory& aIFFactory ) - { - iIFFactory = &aIFFactory; - iUIProtocolController = CUIProtocolController::NewL( this, aIFFactory ); - } - -// Destructor -CAiwMode::~CAiwMode() - { - delete iUIProtocolController; - } - -void CAiwMode::SearchDefaultPrinterL() - { - iUIProtocolController->SearchDefaultPrinterL(); - iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView ); - } - -TBool CAiwMode::ChangeDefaultPrinterL( TInt aProtocol ) - { - TBool printerFound = iUIProtocolController-> - ChangeDefaultPrinterL( aProtocol ); - - return printerFound; - } - -void CAiwMode::UsbCableDisconnected() - { - if ( iIFFactory->SettingsIF()->GetCurrentPrinterProtocol() == - MDiscoveryObserver::EUSB ) - { - iUIModeObserver->ExitApplication(); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cidlemode.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cidlemode.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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: -* -*/ - - -#include "cidlemode.h" -#include "muimodeobserver.h" -#include "muimode.h" -#include "mprintsettings.h" -#include "cuiprotocolcontroller.h" -#include "ciffactory.h" -#include "mdiscoveryobserver.h" -#include "clog.h" - -CIdleMode* CIdleMode::NewL( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ) - { - CIdleMode* self = NewLC( aUIModeObserver, aIFFactory ); - CleanupStack::Pop( self ); - return self; - } - -CIdleMode* CIdleMode::NewLC( MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ) - { - CIdleMode* self = new ( ELeave ) CIdleMode( aUIModeObserver ); - CleanupStack::PushL( self ); - self->ConstructL( aIFFactory ); - return self; - } - -// Default constructor -CIdleMode::CIdleMode( MUIModeObserver* aUIModeObserver ) - { - iUIModeObserver = aUIModeObserver; - } - -// 2nd phase constructor -void CIdleMode::ConstructL( CIFFactory& aIFFactory ) - { - iIFFactory = &aIFFactory; - iUIProtocolController = CUIProtocolController::NewL( this, aIFFactory ); - } - -// Destructor -CIdleMode::~CIdleMode() - { - delete iUIProtocolController; - } - -void CIdleMode::SearchDefaultPrinterL() - { - LOG("void CIdleMode::SearchDefaultPrinterL() START"); - TBool printerFound = iUIProtocolController->SearchDefaultPrinterL(); - // If printer was found change to settings view - if( printerFound ) - { - LOG("void CIdleMode::SearchDefaultPrinterL() Printer found"); - iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView ); - } - // Printer was not found or discovery cancelled - else - { - LOG("void CIdleMode::SearchDefaultPrinterL() Printer not found"); - iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView ); - } - LOG("void CIdleMode::SearchDefaultPrinterL() END"); - } - -TBool CIdleMode::ChangeDefaultPrinterL( TInt aProtocol ) - { - TBool printerFound = iUIProtocolController-> - ChangeDefaultPrinterL( aProtocol ); - - return printerFound; - } - - -void CIdleMode::UsbCableDisconnected() - { - if ( iIFFactory->SettingsIF()->GetCurrentPrinterProtocol() == - MDiscoveryObserver::EUSB ) - { - // No leaving function. Ignore leave. - TRAP_IGNORE( iUIModeObserver->ChangeViewL( MUIModeObserver::ImageSelectionView )); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintapp.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintapp.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include "cimageprintapp.h" -#include "cimageprintdoc.h" - -LOCAL_C CApaApplication* NewApplication() - { - return new CImagePrintApp; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - -TUid CImagePrintApp::AppDllUid() const - { - return KUidImagePrint; - } - -CApaDocument* CImagePrintApp::CreateDocumentL() - { - return CImagePrintDoc::NewL( *this ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintappui.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintappui.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,550 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cimageprintappui.h" -#include "imageprint.h" -#include "cimageprintsettingsview.h" -#include "cimgpviewemptyview.h" -#include "cdiscoverydlgmanager.h" -#include "cimageprintdoc.h" -#include "printapputil.h" -#include "imageprintapp.hrh" -#include "mprintsettings.h" -#include "cimgpprintdlgmanager.h" -#include "clog.h" -#include "cimageprintengine.h" -#include "ciffactory.h" -#include "mdiscovery.h" -#include "cimgpprintutils.h" -#include "uimodefactory.h" -#include "muimode.h" -#include "muimodeobserver.h" -#include "caiwprintpreviewprovider.h" - -using namespace ContentAccess; - -_LIT( KEngineRsc, "imageprintengine.rsc" ); -_LIT8( KJpegFileType, "image/jpeg" ); - -// For navipane changes -_LIT( KLine, " - " ); -const TInt KLineLength(3); -const TInt32 KUid (0x101FFA84); - -// Second class constructor -void CImagePrintAppUi::ConstructL() - { - LOG("CImagePrintAppUi::ConstructL BEGIN"); - // Add EAknSingleClickCompatible to BaseConstructL function parameter for single click event - BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | EAknEnableMSK | EAknSingleClickCompatible ); - - FeatureManager::InitializeLibL(); - - // get the best matching resource for the current locale - TFileName file(NULL); - - file.Append( KDC_RESOURCE_FILES_DIR ); - file.Append( KEngineRsc ); - BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), file ); - iResourceOffset = iEikonEnv->AddResourceFileL( file ); - - iDoc = static_cast( CAknAppUi::Document() ); - - TRAPD( err, iDoc->InitializeEngineL() ); - if ( err == KErrInUse ) - { - LOG("Too many connections. Exiting..."); - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_CONCURRENT_NOTE ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - Exit(); - } - else - { - User::LeaveIfError( err ); - } - - if ( iDoc->Engine()->InterfaceFactory().IsApplicationAlreadyInUse() ) - { - LOG("Too many connections. Exiting..."); - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_CONCURRENT_NOTE ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - Exit(); - } - - iAiwState = ENotAiwCall; - TInt r = iAiwCall.Attach(KPrintPropertyCat,EPrintProperty,EOwnerProcess); - if (r == KErrNone) - { - iAiwCall.Get(KPrintPropertyCat,EPrintProperty,iAiwState); - } - - TBool aiw = EFalse; - if ( iAiwState == EAiwPrintCall ) - { - // Set the aiw call RProperty key back to default value so that - // if application for some reason crashes the value is not left for AIW mode. - iAiwCall.Set( KPrintPropertyCat,EPrintProperty, ENotAiwCall ); - SetImageArrayL(GetImagesFromAiwProviderL()); - aiw = ETrue; - } - - - iUIMode = UIModeFactory::CreateL( aiw, this, iDoc->Engine()->InterfaceFactory() ); - - LOG("CImagePrintAppUi::ConstructL CImagePrintSettingsView"); - CImagePrintSettingsView* settingsView = CImagePrintSettingsView::NewL( - iDoc->PrintSettings(), iDoc->PrintJob(), this, iUIMode ); - CleanupStack::PushL( settingsView ); - AddViewL( settingsView ); - CleanupStack::Pop( settingsView ); - - LOG("CImagePrintAppUi::ConstructL CIMGPViewEmptyView"); - CIMGPViewEmptyView* emptyView = CIMGPViewEmptyView::NewL(); - CleanupStack::PushL( emptyView ); - AddViewL( emptyView ); - CleanupStack::Pop( emptyView); - - SetDefaultViewL( *emptyView ); - // default printer search in aiw mode must be done via - // CIdle callback for UI to construct itself properly - iIdleSearch = CIdle::NewL( CActive::EPriorityStandard ); - iIdleSearch->Start( TCallBack( SearchDefaultPrinterCbL, this )); - - // Default value for printer UID before printer is selected. - iPrinterUID = -1; - - iCoeEnv->RootWin().EnableScreenChangeEvents(); - - iApplicationStarting = ETrue; - iAlbumCall = KErrNotFound; - LOG("CImagePrintAppUi::ConstructL END"); - } - -// aiw search callback -TInt CImagePrintAppUi::SearchDefaultPrinterCbL( TAny* aObj ) - { - LOG("CImagePrintAppUi::SearchDefaultPrinterCbL begin"); - CImagePrintAppUi* obj = static_cast( aObj ); - TRAPD( err, obj->iUIMode->SearchDefaultPrinterL() ); - if ( err != KErrNone ) - { - LOG1( "CImagePrintAppUi::SearchDefaultPrinterCbL search failed, err: %d", err ); - - if ( err == KErrDisconnected ) - { - HBufC* buf = StringLoader::LoadLC( R_NOTE_DISCONNECT_PRINT_ERROR ); - CAknErrorNote* errornote = new CAknErrorNote( ETrue ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - } - - // Closes program - obj->Exit(); - } - LOG("CImagePrintAppUi::SearchDefaultPrinterCbL end"); - return EFalse; - } - -// Destructor -CImagePrintAppUi::~CImagePrintAppUi() - { - FeatureManager::UnInitializeLib(); - delete iNaviDecorator; - - iEikonEnv->DeleteResourceFile( iResourceOffset ); - delete iPrintDlgManager; - delete iUSBConnectionWaitNote; - - if( iIdleSearch ) - { - iIdleSearch->Cancel(); - } - - delete iUIMode; - delete iIdleSearch; - - iAiwCall.Close(); - } - -// Handles global user events -void CImagePrintAppUi::HandleCommandL( - TInt aCommand ) - { - LOG1( "CImagePrintAppUi::HandleCommandL BEGIN: %d", aCommand ); - switch ( aCommand ) - { - case EAknCmdExit: - case EAknSoftkeyExit: - { - Exit(); - break; - } - case EEikCmdExit: - { - // Cancel current printjob because this command may have come from MMC removal - // cancelling may fail in engine if mmc writing was in critical point, so TRAP - TRAP_IGNORE( iDoc->PrintJob()->CancelL() ); - if ( iAiwState == EAiwPrintCall ) - { - User::Exit( EAiwPrintCall ); - } - else - { - Exit(); - } - break; - } - - case EAknSoftkeyBack: - { - break; - } - - case ESelectMarked: - { - if( iValidImages ) - { - iUIMode->SearchDefaultPrinterL(); - } - else - { - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_SELECTNEW_NOTE ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - } - break; - } - default: - break; - } - LOG( "CImagePrintAppUi::HandleCommandL END" ); - } - -void CImagePrintAppUi::LaunchHelpApplicationL( const TDesC& aHelpText ) - { - CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( 1 ); - CleanupStack::PushL( cntx ); - - //make uid - TUid uid; - uid.iUid = ( KUid ); - - cntx->AppendL( TCoeHelpContext( uid, aHelpText ) ); - CleanupStack::Pop( cntx ); - - //and launch help - takes ownership of context array - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), cntx ); - } - -// Set the image array -void CImagePrintAppUi::SetImageArrayL( CDesCArrayFlat* aFileArray ) - { - iFiles = aFileArray; - - // Sets default navipane text with no copies. - SetNavipaneTextL( 1 ); - - iDoc->SetImageArrayL( aFileArray ); - } - -// Get the image array -CDesCArrayFlat* CImagePrintAppUi::GetImageArray() - { - return iFiles; - } - -// Get the document class -CImagePrintDoc* CImagePrintAppUi::GetDocument() - { - return iDoc; - } - -TInt CImagePrintAppUi::GetAlbumCall() - { - return iAlbumCall; - } - -void CImagePrintAppUi::SetAlbumCall(TInt aAlbumCall) - { - iAlbumCall = aAlbumCall; - } - -void CImagePrintAppUi::SetValidImagesStatus( TBool aStatus ) - { - iValidImages = aStatus; - } - -void CImagePrintAppUi::ChangeViewL( TInt aView ) - { - switch( aView ) - { - case MUIModeObserver::SettingsView: - { - ActivateLocalViewL( KImageSettingsViewId ); - break; - } - } - } - -void CImagePrintAppUi::ExitApplication() - { - Exit(); - } - - -TInt CImagePrintAppUi::GetAiwState() - { - return iAiwState; - } - -TBool CImagePrintAppUi::AiwState() - { - TBool retValue = EFalse; - if( iAiwState == EAiwPrintCall ) - { - retValue = ETrue; - } - return retValue; - } - - -// Files from AIW customer -CDesCArrayFlat* CImagePrintAppUi::GetImagesFromAiwProviderL() - { - LOG("TBool CImagePrintAppUi::GetImagesFromAiwProvider() BEGIN"); - - RFs fileServer; - User::LeaveIfError(fileServer.Connect()); - CleanupClosePushL( fileServer ); - RFileReadStream readStream; - - TFileName paramFile; - CIMGPPrintUtils::GetDataFilePathL( paramFile ); - - User::LeaveIfError( readStream.Open(fileServer, paramFile, EFileRead) ); - readStream.PushL(); - CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(readStream); - - CDesCArrayFlat* imageFiles = new (ELeave) CDesCArrayFlat(5); - - TBool noOtherFileTypes( EFalse ); - TBool showFilesremovedNote ( EFalse ); - - TInt index( 0 ); - const TAiwGenericParam* param = paramList->FindFirst(index, - EGenericParamFile, - EVariantTypeDesC); - while ( index != KErrNotFound ) - { - TFileName filename( param->Value().AsDes() ); - // CheckMIMEType needs to be changed so that we can distinguish between - // a) file not found b) file was incorrect MIME-type - noOtherFileTypes = CIMGPPrintUtils::CheckMIMEType( KJpegFileType, filename ); - if ( noOtherFileTypes ) - { - // check drm protection - CContent* content = NULL; - content = CContent::NewLC( filename ); - - TInt isDrmProtected( 0 ); - TInt err = content->GetAttribute( EIsProtected, isDrmProtected ); - CleanupStack::PopAndDestroy(); // content - if ( err || isDrmProtected ) - { - LOG("CImagePrintAppUi::GetImagesFromAiwProvider(): found drm file!"); - noOtherFileTypes = EFalse; - } - } - - if ( noOtherFileTypes ) - { - imageFiles->AppendL( filename ); - } - else - { - showFilesremovedNote = ETrue; - } - - param = paramList->FindNext(index, - EGenericParamFile, - EVariantTypeDesC); - } - - if ( showFilesremovedNote ) - { - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_WRONGTYPE_NOTE ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - } - - // If only one image is selected to print and it's corrupted, exit from application. - if ( showFilesremovedNote && ( imageFiles->Count() == KErrNone )) - { - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_SELECTNEW_NOTE ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - Exit(); - } - - CleanupStack::PopAndDestroy(paramList); //paramList - - LOG("TBool CImagePrintAppUi::GetImagesFromAiwProvider() END"); - - readStream.Close(); - readStream.Pop(); - CleanupStack::PopAndDestroy( &fileServer ); - return imageFiles; - } - -TBool CImagePrintAppUi::OrientationPortrait() - { - TBool retValue = ETrue; - TSize screenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); - if( screenSize.iWidth == 416 || - screenSize.iWidth == 320 ) - { - retValue = EFalse; - } - return retValue; - } - -TBool CImagePrintAppUi::QVGAMode() - { - TBool retValue = EFalse; - TSize screenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); - if( screenSize.iWidth == 240 || - screenSize.iWidth == 320 ) - { - retValue = ETrue; - } - return retValue; - } - -// Sets NaviPane text -void CImagePrintAppUi::SetNavipaneTextL( const TInt aCopiesOfImage, HBufC* aPaperSize ) - { - // Navipane image count will be sum of all images on current print job. - // E.g. If 2 images selected and copies value is 2, navi value will be: 2 x 2 = 4. - TInt printCount = aCopiesOfImage * ( iFiles->MdcaCount() ); - - // Buffer to store image or images -string. - HBufC* naviText; - - // If only one image to print navipane text will be: Image - if ( printCount == 1 ) - { - naviText = StringLoader::LoadLC( R_PRINTJOB_IMAGE ); - } - // If more than one image to print navipane text will be: Images - else - { - naviText = StringLoader::LoadLC( R_PRINTJOB_IMAGES, printCount ); - } - - TInt strLength = naviText->Length(); - - CEikStatusPane* sp = - iEikonEnv->AppUiFactory()->StatusPane(); - CAknNavigationControlContainer* np = - static_cast( - sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - delete iNaviDecorator; - iNaviDecorator = NULL; - - // If paper size needs to be added to the NaviPane, more space is needed - if( aPaperSize ) - { - strLength += aPaperSize->Length() + KLineLength; - } - // Clear the printer name string from all formatting tabs & numbers - HBufC* stringholder = HBufC::NewLC( strLength ); - *stringholder = *naviText; - TPtr ptr = stringholder->Des(); - TInt pos = stringholder->Find( KTabChar ); - if ( pos == 1 ) // 1st possible icon formatting tab is at pos 1 - { - ptr.Delete( 0, 2 ); // delete the first icon tab and the number previous to it - pos = stringholder->Find( KTabChar ); - } - // 2nd possible iconformatting tab is 2nd last char (len - 2), don't delete it here - while ( pos != KErrNotFound && - pos != stringholder->Length() - 2 ) - { - ptr.Delete( pos, 1); // delete all middle tabs - pos = stringholder->Find( KTabChar ); - } - // 2nd possible iconformatting tab is 2nd last char - if ( pos != KErrNotFound && - pos == stringholder->Length() - 2 ) - { - // delete the 2nd icon formatting tab and the number next to it - ptr.Delete( stringholder->Length() - 2, 2 ); - } - - // Add paper size and '-', in the beginning of the text - if( aPaperSize ) - { - TPtr ptr2 = aPaperSize->Des(); - ptr.Insert(0, KLine); - ptr.Insert(0, ptr2); - } - - iNaviDecorator = np->CreateNavigationLabelL( *stringholder ); - CleanupStack::PopAndDestroy( stringholder ); - np->PushL( *iNaviDecorator ); - sp->DrawNow(); - - CleanupStack::PopAndDestroy( naviText ); - } - -TUid CImagePrintAppUi::GetSettingsViewUid() - { - return KImageSettingsViewId; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintblankcontainer.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintblankcontainer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include - -#include "cimageprintblankcontainer.h" -#include "imageprintapp.hrh" -#include "imageprintconsts.h" - -CImagePrintBlankContainer* CImagePrintBlankContainer::NewL( - TRect& aRect ) - { - CImagePrintBlankContainer* self = NewLC( aRect ); - CleanupStack::Pop( self ); - return self; - } - -CImagePrintBlankContainer* CImagePrintBlankContainer::NewLC( - TRect& aRect ) - { - CImagePrintBlankContainer* self = new ( ELeave ) CImagePrintBlankContainer(); - CleanupStack::PushL( self ); - self->ConstructL( aRect ); - return self; - } - -// Default constructor -CImagePrintBlankContainer::CImagePrintBlankContainer() - { - } - -// 2nd phase constructor -void CImagePrintBlankContainer::ConstructL( - const TRect& aRect ) - { - CreateWindowL(); - SetRect( aRect ); - - // Fetch the dimensions of the screen - TScreenInfoV01 info; - TPckgBuf buf( info ); - UserSvr::ScreenInfo( buf ); - info = buf(); - TRect screenRect( TPoint( 0, 0 ), info.iScreenSize ); - - // Create skin control context for filling the background - const TAknsItemID *id = &KAknsIIDNone; - iSkinControlContext = - CAknsListBoxBackgroundControlContext::NewL( - KAknsIIDSkinBmpMainPaneUsual, screenRect, ETrue, *id, screenRect ); - - ActivateL(); - } - -// Destructor -CImagePrintBlankContainer::~CImagePrintBlankContainer() - { - delete iSkinControlContext; - } - -// Draw method -void CImagePrintBlankContainer::Draw( - const TRect& /*aRect*/ ) const - { - CWindowGc& gc = SystemGc(); - - TRect rect = Rect(); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - if ( AknsDrawUtils::HasBitmapBackground( skin, iSkinControlContext ) ) - { - // Draw skin background - AknsDrawUtils::Background( skin, iSkinControlContext, NULL, gc, rect ); - } - else - { - gc.Clear( rect ); - } - } - -void CImagePrintBlankContainer::HandleResourceChange( TInt aType ) - { - if( aType == KEikDynamicLayoutVariantSwitch ) - { - CEikAppUi* appUi = static_cast( iEikonEnv->AppUi() ); - TRect rect = appUi->ClientRect(); - SetRect( rect ); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintdoc.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintdoc.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2004-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 "cimageprintdoc.h" -#include "cimageprintappui.h" -#include "cimageprintengine.h" -#include "ciffactory.h" - -CImagePrintDoc::CImagePrintDoc( - CEikApplication& aApp ) - : CAknDocument(aApp) - { - } - -// DESTRUCTION -CImagePrintDoc::~CImagePrintDoc() - { - delete iEngine; - } - -// default constructor -void CImagePrintDoc::InitializeEngineL() - { - iEngine = CImagePrintEngine::NewL( 0 ); - } - -// Two-phased constructor. -CImagePrintDoc* CImagePrintDoc::NewL( - CEikApplication& aApp ) - { - CImagePrintDoc* self = new (ELeave) CImagePrintDoc( aApp ); - return self; - } - -// METHODS - -//Creates AppUi class for application -CEikAppUi* CImagePrintDoc::CreateAppUiL() - { - return new (ELeave) CImagePrintAppUi; - } - -// Returns pointer to engine -CImagePrintEngine* CImagePrintDoc::Engine() - { - return iEngine; - } - -// Returns discovery interface -MDiscovery* CImagePrintDoc::Discovery() - { - return iEngine->InterfaceFactory().DiscoveryIF(); - } - -// Returns print job interface -MPrintJob* CImagePrintDoc::PrintJob() - { - return iEngine->InterfaceFactory().PrintJobIF(); - } - - -// Returns print settings interface -MPrintSettings* CImagePrintDoc::PrintSettings() - { - return iEngine->InterfaceFactory().SettingsIF(); - } - -// Set selected images to engine. -void CImagePrintDoc::SetImageArrayL( - CDesCArrayFlat* aArray ) - { - iEngine->SetImageArrayL( aArray ); - } - -// Restarts Image Print engine -void CImagePrintDoc::RestartEngine() - { - iEngine->RestartEngine(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintsettingscontainer.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintsettingscontainer.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cimageprintsettingscontainer.h" -#include "imageprintapp.hrh" -#include "cpropertiesboxmodel.h" -#include "cimageprintappui.h" -#include "imageprint.h" -#include "cimageprintdoc.h" -#include "cdiscoverydlgmanager.h" -#include "cimageprintengine.h" -#include "ciffactory.h" -#include "clog.h" -#include "printapputil.h" -#include "midleprinteventregisterif.h" -#include "cimgpprintutils.h" -#include "muimode.h" - -// CONSTRUCTION -CImagePrintSettingsContainer* CImagePrintSettingsContainer::NewL( - MPrintSettings* aSettings, - MObjectProvider* aProvider, - TRect aClientRect, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ) - { - CImagePrintSettingsContainer* self = - new ( ELeave ) CImagePrintSettingsContainer( aSettings, aAppUi, aUIMode ); - CleanupStack::PushL( self ); - self->ConstructL( aProvider, aClientRect ); - CleanupStack::Pop( self ); - - return self; - } - -// Default constructor -CImagePrintSettingsContainer::CImagePrintSettingsContainer( - MPrintSettings* aSettings, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ) : - iPrintSettings( aSettings ), - iAppUi( aAppUi ), - iUIMode( aUIMode ) - { - } - -// 2nd phase constructor -void CImagePrintSettingsContainer::ConstructL( - MObjectProvider* aProvider, - const TRect& aRect ) - { - // Create a window for this application view - SetMopParent( aProvider ); - CreateWindowL(); - CImagePrintDoc* doc = static_cast( iAppUi->Document() ); - iModel = CPropertiesBoxModel::NewL( *( doc->Engine() ), iPrintSettings, this ); - - // Initialize list box outlook - iListBox = new ( ELeave ) CAknSettingStyleListBox; - iListBox->SetContainerWindowL( *this ); - iListBox->ConstructL( this, EAknListBoxSelectionList ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iEikonEnv->EikAppUi()->AddToStackL( iListBox ); - - // Set the model & observer - iListBox->SetListBoxObserver( iModel ); - iListBox->Model()->SetItemTextArray( iModel ); - // List box won't delete model, the Controller object will take care of it - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - // Set the windows size - SetRect( aRect ); - iListBox->SetSize( iListBox->MinimumSize() ); - - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// Destructor -CImagePrintSettingsContainer::~CImagePrintSettingsContainer() - { - if ( iUSBConnectionWaitNote ) - { - delete iUSBConnectionWaitNote; - } - iEikonEnv->EikAppUi()->RemoveFromStack( iListBox ); - delete iListBox; - delete iModel; - } - - -// Return the amount of compound controls -TInt CImagePrintSettingsContainer::CountComponentControls() const - { - return 1; - } - -// Gets the specified component of a compound control. -CCoeControl* CImagePrintSettingsContainer::ComponentControl( - TInt aIndex ) const - { - CCoeControl* cntrl = 0; - - if ( aIndex == 0 ) - { - cntrl = iListBox; - } - - return cntrl; - } - -// Draws the empty view -void CImagePrintSettingsContainer::Draw( - const TRect& /*aRect*/ ) const - { - CWindowGc& gc = SystemGc(); - gc.Clear(); - } - -// Starts editing the active item -void CImagePrintSettingsContainer::EditItemL() - { - iModel->HandleListBoxEventL( iListBox, - MEikListBoxObserver::EEventEnterKeyPressed ); - - ChangeStatusPaneTextL( iModel->NumberOfCopies() ); - } - -void CImagePrintSettingsContainer::DoDiscoveryL( TInt aProtocol, TBool /*aHidden*/ ) - { - TBool ret = iUIMode->ChangeDefaultPrinterL( aProtocol ); - } - -void CImagePrintSettingsContainer::ChangeStatusPaneTextL( const TInt aCopiesOfImage ) - { - iAppUi->SetNavipaneTextL( aCopiesOfImage ); - } - -void CImagePrintSettingsContainer::UpdateListBox() - { - iListBox->SizeChanged(); - } - -void CImagePrintSettingsContainer::UpdateListSize( TRect /*aRect*/ ) - { - iListBox->SetSize( iListBox->MinimumSize() ); - } - -void CImagePrintSettingsContainer::SizeChanged() - { - iListBox->SetSize( iListBox->MinimumSize() ); - } - -void CImagePrintSettingsContainer::HandleResourceChange( TInt aType ) - { - CCoeControl::HandleResourceChange( aType ); - if( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect rect = iAppUi->ClientRect(); - SetRect( rect ); - UpdateListSize( rect ); - DrawNow(); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintsettingsview.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimageprintsettingsview.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,265 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cimageprintsettingsview.h" -#include "cimageprintsettingscontainer.h" -#include "cimageprintsettingsview.h" -#include "cimageprintappui.h" -#include "cimageprintdoc.h" -#include "cimgpprintdlgmanager.h" -#include "mprintsettings.h" -#include "mprintjob.h" -#include "imageprintapp.hrh" -#include "cimageprintengine.h" -#include "muimode.h" -#include "ciffactory.h" -#include "mdiscoveryobserver.h" - -_LIT( KImagePrintAppHelpSettings, "IMGPRNAPP_HLP_SETTINGS" ); - -// CONSTRUCTION -CImagePrintSettingsView* CImagePrintSettingsView::NewL( - MPrintSettings* aSettings, - MPrintJob* aPrintJob, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ) - { - CImagePrintSettingsView* self = CImagePrintSettingsView::NewLC( - aSettings, aPrintJob, aAppUi, aUIMode ); - CleanupStack::Pop(); // self - - return self; - } - -CImagePrintSettingsView* CImagePrintSettingsView::NewLC( - MPrintSettings* aSettings, - MPrintJob* aPrintJob, - CImagePrintAppUi* aAppUi, - MUIMode* aUIMode ) - { - CImagePrintSettingsView* self = - new ( ELeave ) CImagePrintSettingsView( aPrintJob, aAppUi, aUIMode ); - CleanupStack::PushL( self ); - self->ConstructL( aSettings); - - return self; - } - -// 2nd phase constructor -void CImagePrintSettingsView::ConstructL( - MPrintSettings* aSettings ) - { - - iSettings = aSettings; - TUint vendor = iSettings->GetCurrentPrinterVendor(); - iPrintDlgManager = CIMGPPrintDlgManager::NewL( 1, - iPrintJob, aSettings->NumOfPagesL(), - aSettings->IsMMC(), vendor ); - BaseConstructL( R_SETTINGS_VIEW ); - } - -// Default constructor -CImagePrintSettingsView::CImagePrintSettingsView( - MPrintJob* aPrintJob, CImagePrintAppUi* aAppUi, MUIMode* aUIMode ) - : CAknView(), - iPrintJob( aPrintJob ), - iAppUi( aAppUi ), - iUIMode(aUIMode) - { - } - -// Default destructor -CImagePrintSettingsView::~CImagePrintSettingsView() - { - delete iPrintDlgManager; - DestroyContainer(); - } - -// Returns IDs -TUid CImagePrintSettingsView::Id() const - { - return KImageSettingsViewId; - } - -// Handles commands coming to this viwe -void CImagePrintSettingsView::HandleCommandL( - TInt aCommand ) - { - switch ( aCommand ) - { - case ESettingsChangeItem: - { - iContainer->EditItemL(); - break; - } - - case ESettingsPrint: - { - StartPrintingL(); - break; - } - - case ESettingsExit: - { - // Exit caller also - AppUi()->HandleCommandL( EEikCmdExit ); - break; - } - - case EAknSoftkeyBack: - { - // Exit to gallery - AppUi()->HandleCommandL( EAknCmdExit ); - break; - } - - case ECmdPrintHelp: - { - iAppUi->LaunchHelpApplicationL( KImagePrintAppHelpSettings ); - break; - } - - default: - AppUi()->HandleCommandL( aCommand ); - break; - } - } - -// Activates the view, creates the control container -void CImagePrintSettingsView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - // Change the status pane text - CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); - CAknTitlePane* tp = static_cast( - sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL( iEikonEnv->AllocReadResourceLC( - R_TXT_IMAGEPRINT_TITLE_PRINTSETTINGS )->Des() ); - CleanupStack::PopAndDestroy(); // tp - sp->DrawNow(); - - if ( !iContainer ) - { - iContainer = CImagePrintSettingsContainer::NewL( - iSettings, this, AppUi()->ClientRect(), iAppUi, iUIMode ); - AppUi()->AddToStackL( *this, iContainer ); - } - } - -// Deactivates view, deletes the control -void CImagePrintSettingsView::DoDeactivate() - { - DestroyContainer(); - } - -// Destroys control container -void CImagePrintSettingsView::DestroyContainer() - { - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - } - - delete iContainer; - iContainer = 0; - } - -// Starts the printing sequence -void CImagePrintSettingsView::StartPrintingL() - { - - // First of all check that WLAN is on, in case WLAN is current printing protocol. - if ( iSettings->GetCurrentPrinterProtocol() == MDiscoveryObserver::EWLAN ) - { - HandlePossibleLinkDisconnectionL(); - } - - TUint vendor = iSettings->GetCurrentPrinterVendor(); - - // Default number of copies value = 1, so keep it, if iSettings doesn't return deviant value. - TInt copiesBuffer = 1; - iSettings->NumberOfCopies( copiesBuffer, 0 ); - - delete iPrintDlgManager; - iPrintDlgManager = 0; - iPrintDlgManager = CIMGPPrintDlgManager::NewL( copiesBuffer, - iPrintJob, iSettings->NumOfPagesL(), - iSettings->IsMMC(), vendor ); - - CIFFactory& factory = iAppUi->GetDocument()->Engine()->InterfaceFactory(); - factory.SettingsIF()->UpdateNumberOfCopiesToServer(); - - iPrintDlgManager->StartPrintingL(); - } - -void CImagePrintSettingsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - // Hide command if application is started from active idle - // and it is in landscape orientation - if( aResourceId == R_PROFILE_LIST_VIEW_MENU ) - { - // If there is no default printer selected, remove print option from menu to avoid incorrect print sequency. - TInt currentProtocol = iSettings->GetCurrentPrinterProtocol(); - if ( currentProtocol == MDiscoveryObserver::ENOPRINTER ) - { - aMenuPane->DeleteMenuItem( ESettingsPrint ); - } - } - } - -void CImagePrintSettingsView::HandleForegroundEventL( TBool aForeground ) - { - if ( aForeground ) - { - ViewScreenDeviceChangedL(); - } - } - -void CImagePrintSettingsView::HandlePossibleLinkDisconnectionL() - { - TInt wlanState; - RProperty::Get( KPSUidWlan, KPSWlanIndicator, wlanState ); - - if ( wlanState == EPSWlanIndicatorNone ) - { - // Show connection to printer lost -note and exit application. - HBufC* buf = StringLoader::LoadLC( R_NOTE_DISCONNECT_PRINT_ERROR ); - CAknErrorNote* errornote = new CAknErrorNote( ETrue ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - - AppUi()->HandleCommandL( EEikCmdExit ); - } - } - - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cimgpviewemptyview.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cimgpviewemptyview.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include - -#include "cimgpviewemptyview.h" -#include "cimageprintappui.h" -#include "cimageprintblankcontainer.h" - -// CONSTRUCTION -CIMGPViewEmptyView* CIMGPViewEmptyView::NewL() - { - CIMGPViewEmptyView* self = new (ELeave) CIMGPViewEmptyView; - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// Default constructor -CIMGPViewEmptyView::CIMGPViewEmptyView() - { - } - -// 2nd phase constructor -void CIMGPViewEmptyView::ConstructL() - { - BaseConstructL( R_EMPTY_VIEW ); - } - -// Destructor -CIMGPViewEmptyView::~CIMGPViewEmptyView() - { - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - } - } - -// Returns view's ID -TUid CIMGPViewEmptyView::Id() const - { - return KIMGPViewEmptyViewId; - } - -// Handles view commands -void CIMGPViewEmptyView::HandleCommandL( - TInt /*aCommand*/ ) - { - AppUi()->HandleCommandL( EAknCmdExit ); - } - -// Activates the view, creates the container and other UI controls -void CIMGPViewEmptyView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - TRect rect( AppUi()->ClientRect() ); - iContainer = CImagePrintBlankContainer::NewL(rect); - iContainer->SetMopParent( this ); - AppUi()->AddToStackL( *this, iContainer ); - } - -// Deactivates the view, deletes print container -void CIMGPViewEmptyView::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = 0; - } - } - - -void CIMGPViewEmptyView::SizeChanged() - { - //No Implementetion needed - } - - -void CIMGPViewEmptyView::HandleForegroundEventL( TBool aForeground ) - { - if ( aForeground ) - { - ViewScreenDeviceChangedL(); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/cpropertiesboxmodel.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/cpropertiesboxmodel.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,532 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include // rapalssession -#include -#include -#include - -#include "imageprint.h" -#include "cprintsettings.h" -#include "cbasecapability.h" -#include "cimageprintsettingscontainer.h" -#include "cimageprintengine.h" -#include "ciffactory.h" -#include "mdiscoveryobserver.h" -#include "mdiscovery.h" -#include "clog.h" -#include "clistcapability.h" -#include "imageprintvariant.h" -#include "cpropertiesboxmodel.h" - -const TInt KListItemsRequired( 2 ); -const TInt KDefaultPrinterIndex( 0 ); -const TInt KNumerOfCopiesIndex( 1 ); - -// CONSTRUCTION -CPropertiesBoxModel* CPropertiesBoxModel::NewL( - CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ) - { - CPropertiesBoxModel* self = - CPropertiesBoxModel::NewLC( aEngine, aSettings, aContainer ); - CleanupStack::Pop( self ); - return self; - } - -CPropertiesBoxModel* CPropertiesBoxModel::NewLC( - CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ) - { - CPropertiesBoxModel* self = - new ( ELeave ) CPropertiesBoxModel( aEngine, aSettings, aContainer ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// Constructor -CPropertiesBoxModel::CPropertiesBoxModel( - CImagePrintEngine& aEngine, - MPrintSettings* aSettings, - CImagePrintSettingsContainer* aContainer ) : - iEngine( aEngine ), - iSettingsIF( aSettings ), - iContainer( aContainer ) - { - } - -// Destructor -CPropertiesBoxModel::~CPropertiesBoxModel() - { - delete iPrintSettings; - delete iDefaultPrinter; - delete iNumberOfCopiesText; - delete iMMC; - delete iPictBridge; - } - -// 2nd phase constructor -void CPropertiesBoxModel::ConstructL() - { - InitSettingsL(); - iDefaultPrinter = StringLoader::LoadL( R_PRINT_SELECTED_PRINTER ); - iNumberOfCopiesText = StringLoader::LoadL( R_QTN_PRINT_SETTINGS_NOC ); - iMMC = StringLoader::LoadL( R_PRINT_MEMORY_CARD ); - iPictBridge = StringLoader::LoadL( R_QTN_PRINT_SETTINGS_DEFAULT_USB ); - iNumberOfCopiesValue = 1; - } - -void CPropertiesBoxModel::InitSettingsL() - { - delete iPrintSettings; - iPrintSettings = NULL; - iPrintSettings = iSettingsIF->PrinterSettingsL(); - iCount = iPrintSettings->iCapabilities.Count(); - TInt i( 0 ); - TInt counter = iPrintSettings->iCapabilities.Count(); - // If current protocol is MMC remove one item, because there is no layouts for mmc. - if ( MDiscoveryObserver::EMMC == iSettingsIF->GetCurrentPrinterProtocol() ) - { - iCount--; - } - - for ( i = 0; i < counter; i++ ) - { - if ( iPrintSettings->iCapabilities[i]->iTitle.CompareF( KNullDesC ) == 0 ) - { - // Remove non-title capability items as those won't be displayed - iCount--; - } - } - - // Add always first two for default printer item and for Number of copies item - iCount = iCount + KListItemsRequired; - } - -// Returns the number of listbox items -TInt CPropertiesBoxModel::MdcaCount() const - { - LOG1("CPropertiesBoxModel::MdcaCount: %d", iCount ); - return iCount; - } - -// Creates the text string for the list box item and returns it -TPtrC CPropertiesBoxModel::MdcaPoint( TInt aIndex ) const - { - LOG1("CPropertiesBoxModel::MdcaPoint START index: %d", aIndex ); - - switch ( aIndex ) - { - case KDefaultPrinterIndex: - { - SetDefaultPrinterItem(); - break; - } - case KNumerOfCopiesIndex: - { - SetNumberOfCopiesItem(); - break; - } - default: - { - SetOtherCapability( aIndex ); - break; - } - } - - LOG1("CPropertiesBoxModel::MdcaPoint END, iBuf: %S", &iBuf ); - return iBuf; - } - -void CPropertiesBoxModel::SetDefaultPrinterItem() const - { - LOG("CPropertiesBoxModel::SetDefaultPrinterItem START"); - - iBuf.Copy( KTabChar ); - iBuf.Append( *iDefaultPrinter ); - iBuf.Append( KTabChar ); - iBuf.Append( KTabChar ); - if( iSettingsIF->GetDefaultPrinterProtocol() == - MDiscoveryObserver::EMMC ) // mmc - { - iBuf.Append( *iMMC ); - } - else if( iSettingsIF->GetDefaultPrinterProtocol() == - MDiscoveryObserver::EUSB ) // pictbridge - { - iBuf.Append( *iPictBridge ); - } - else - { - // No can do if this fails. Not leaving function. - TRAP_IGNORE( - HBufC* defaultPrinterName = - iSettingsIF->GetDefaultPrinterNameLC(); - iBuf.Append( *defaultPrinterName ); - CleanupStack::PopAndDestroy( defaultPrinterName ); - ); - } - - LOG("CPropertiesBoxModel::SetDefaultPrinterItem END"); - } - -void CPropertiesBoxModel::SetNumberOfCopiesItem() const - { - LOG("CPropertiesBoxModel::SetNumberOfCopiesItem START"); - - iBuf.Copy( KTabChar ); - iBuf.Append( *iNumberOfCopiesText ); - iBuf.Append( KTabChar ); - iBuf.Append( KTabChar ); - iBuf.AppendNum( iNumberOfCopiesValue ); - - LOG("CPropertiesBoxModel::SetNumberOfCopiesItem END"); - } - -void CPropertiesBoxModel::SetOtherCapability( const TInt &aIndex ) const - { - LOG("CPropertiesBoxModel::SetOtherCapability START"); - - iBuf.Zero(); - HBufC* buf = NULL; - - // Get the text for the list box - TInt position = CapabilityArrayIndex( aIndex - KListItemsRequired ); - TRAPD( err, - buf = iPrintSettings->iCapabilities[position]->ListBoxTextL() ); - if ( !err && buf ) - { - iBuf = buf->Des(); - delete buf; - } - - LOG("CPropertiesBoxModel::SetOtherCapability END"); - } - -// Handles the list box (enter) events by launching the pop-up list -void CPropertiesBoxModel::HandleListBoxEventL( - CEikListBox* aListBox, - TListBoxEvent aEventType ) - { - LOG("CPropertiesBoxModel::HandleListBoxEventL START"); - //Change to EEventItemSingleClicked for Single click event - if ( (aEventType == EEventEnterKeyPressed || aEventType == EEventItemSingleClicked ) && - aListBox->CurrentItemIndex() != KErrNotFound ) - { - if( aListBox->CurrentItemIndex() == 0 ) - { - // launch dialog query for selecting default printer this returns - // protocol id as defined in DiscoveryObserver.h or -1 if failed. - TInt protocol = LaunchDefaultPrinterListL(); - if( protocol >= 0 ) - { - iContainer->DoDiscoveryL( protocol ); - InitSettingsL(); - iContainer->UpdateListBox(); - iContainer->DrawNow(); - } - } - - if( aListBox->CurrentItemIndex() == 1 ) - { - LaunchNumberOfCopiesDialogL(); - iContainer->UpdateListBox(); - iContainer->DrawNow(); - } - - if ( aListBox->CurrentItemIndex() > 1 ) - { - TInt selIndex = CapabilityArrayIndex( aListBox->CurrentItemIndex() - KListItemsRequired ); - TBool valueChanged = iPrintSettings->iCapabilities[selIndex]->LaunchPopupListL(); - - if( valueChanged ) - { - SaveCurrentSelectionL( *(iPrintSettings->iCapabilities[ selIndex ]), aListBox ); - InitSettingsL(); - iContainer->UpdateListBox(); - iContainer->DrawNow(); - } - } - } - - LOG("CPropertiesBoxModel::HandleListBoxEventL END"); - } - -// Saves selection to engine -void CPropertiesBoxModel::SaveCurrentSelectionL( - CBaseCapability &aCapab, - CEikListBox* aListBox ) - { - LOG("CPropertiesBoxModel::SaveCurrentSelectionL START"); - - TInt initList = iSettingsIF->SetPrinterSettingL( aCapab ); - if( initList == 0 ) - { - CPrintSettings* tempSettings = iSettingsIF->PrinterSettingsL(); - delete iPrintSettings; - iPrintSettings = tempSettings; - - // Sets the active page to be the first one, if settings have truly - // changed - iSettingsIF->SetActivePageL( 1 ); - - aListBox->HandleItemRemovalL(); - aListBox->HandleItemAdditionL(); - } - - LOG("CPropertiesBoxModel::SaveCurrentSelectionL END"); - } - -// Returns capability array index based on the list box index -TUint CPropertiesBoxModel::CapabilityArrayIndex( - TInt aListBoxIndex ) const - { - LOG("CPropertiesBoxModel::CapabilityArrayIndex START"); - - // Skip capabilities with empty title as they won't be placed to list box - TInt found( EFalse ); - TInt i( 0 ); - - while ( !found ) - { - if ( iPrintSettings->iCapabilities[i]-> - iTitle.CompareF( KNullDesC ) != 0 ) - { - aListBoxIndex--; - } - - if ( aListBoxIndex >= 0 ) - { - i++; - } - else - { - found = ETrue; - } - } - - LOG("CPropertiesBoxModel::CapabilityArrayIndex END"); - return TUint( i ); - } - - -void CPropertiesBoxModel::LaunchNumberOfCopiesDialogL() - { - LOG("CPropertiesBoxModel::LaunchNumberOfCopiesDialogL START"); - CAknNumberQueryDialog* dlg = new( ELeave ) CAknNumberQueryDialog ( iNumberOfCopiesValue ); - dlg->PrepareLC( R_NOC_QUERY); - dlg->RunLD(); - - // After selecting copies, NaviText is updated. - iContainer->ChangeStatusPaneTextL( iNumberOfCopiesValue ); - - // Set value for settings - SetNumberOfCopiesValueL(); - - LOG("CPropertiesBoxModel::LaunchNumberOfCopiesDialogL END"); - } - - -void CPropertiesBoxModel::SetNumberOfCopiesValueL() - { - RArray numberOfCopiesArray; - CleanupClosePushL( numberOfCopiesArray ); - iSettingsIF->NumberOfCopies( numberOfCopiesArray ); - - // Images selected in print job - TInt imagesCount = iEngine.FileArray().Count(); - if(0 != imagesCount) - { - // Get number of copies for current image - if( numberOfCopiesArray.Count() != imagesCount ) - { - numberOfCopiesArray.Reset(); - for( TInt i=0; i < imagesCount; ++i ) - { - numberOfCopiesArray.Append( 1 ); - } - } - - TInt oldNOC( numberOfCopiesArray[ 0 ] ); - - // if new value was entered - if (iNumberOfCopiesValue != oldNOC) - { - // Set Number of copies value for each image. - // Value is same for all images in IP 6.2 - for ( TInt i=0; iSetNumberOfCopiesL( numberOfCopiesArray ); - } - } - CleanupStack::PopAndDestroy( &numberOfCopiesArray ); - } - -TInt CPropertiesBoxModel::LaunchDefaultPrinterListL() - { - const TInt expectedNumberOfProtocols( 4 ); - - // Array for list item descriptors. - CDesCArrayFlat* protocolNameArray = - new( ELeave ) CDesCArrayFlat( expectedNumberOfProtocols ); - CleanupStack::PushL( protocolNameArray ); - - // Map from list item index to protocol. - RArray indexToProtocolMap( expectedNumberOfProtocols ); - CleanupClosePushL( indexToProtocolMap ); - - // Get supported protocols from the engine - TInt supportedProtocols = - iEngine.InterfaceFactory().DiscoveryIF()->SupportedProtocols(); - - // Read list item descriptors, append them in array and update map. - - // Bluetooth printer - if( supportedProtocols & KImagePrint_PrinterProtocol_BPP ) - { - protocolNameArray->AppendL( CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_PRINT_SETTINGS_DEFAULT_BT )->Des() ); - indexToProtocolMap.AppendL( MDiscoveryObserver::EBPP ); - CleanupStack::PopAndDestroy(); // protocolNameArray - } - - // Memory card printer - if( supportedProtocols & KImagePrint_PrinterProtocol_DPOF ) - { - RFs fs; - CleanupClosePushL( fs ); - if( fs.Connect() == KErrNone ) - { - TInt driveId (-1); - TFileName path; - User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveId ) ); - User::LeaveIfError( PathInfo::GetRootPath( path, driveId ) ); - - if ( BaflUtils::PathExists( fs, path )) - { - protocolNameArray->AppendL( CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_PRINT_MEMORY_CARD )->Des() ); - indexToProtocolMap.AppendL( MDiscoveryObserver::EMMC ); - CleanupStack::PopAndDestroy(); // protocolNameArray - } - - CleanupStack::PopAndDestroy( &fs ); - } - } - - // USB printers - if( supportedProtocols & KImagePrint_PrinterProtocol_PictBridge ) - { - protocolNameArray->AppendL( CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_PRINT_SETTINGS_DEFAULT_USB )->Des() ); - indexToProtocolMap.AppendL( MDiscoveryObserver::EUSB ); - CleanupStack::PopAndDestroy(); // protocolNameArray - } - - // WLAN printers - if ( supportedProtocols & KImagePrint_PrinterProtocol_UPnP ) - { - protocolNameArray->AppendL( CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_PRINT_SETTINGS_DEFAULT_WLAN )->Des() ); - indexToProtocolMap.AppendL( MDiscoveryObserver::EWLAN ); - CleanupStack::PopAndDestroy(); // protocolNameArray - } - - // Prepare arrays for dialog - CAknQueryValueTextArray* queryTextArray = CAknQueryValueTextArray::NewL(); - CleanupStack::PushL( queryTextArray ); - queryTextArray->SetArray( *protocolNameArray ); - - CAknQueryValueText* queryValue = CAknQueryValueText::NewL(); - CleanupStack::PushL( queryValue ); - queryValue->SetArrayL( queryTextArray ); - - // Determine which is the default protocol using settings interface. - // Here defaultProtocol is protocol id as defined in MDiscoveryObserver.h. - TInt defaultProtocol = iSettingsIF->GetDefaultPrinterProtocol(); - - // Then do lookup in indexToProtocolMap to find correct index for this - // protocol id. Note that after this defaultProtocol is an index. - defaultProtocol = indexToProtocolMap.Find( defaultProtocol ); - if ( defaultProtocol != KErrNotFound ) - { - queryValue->SetCurrentValueIndex( defaultProtocol ); - } - else - { - // Default protocol not available, get current protocol - // This is for example for the case where MMC is default, - // but removed from phone. - TInt currentProtocol = iSettingsIF->GetCurrentPrinterProtocol(); - currentProtocol = indexToProtocolMap.Find( currentProtocol ); - if ( currentProtocol != KErrNotFound ) - { - queryValue->SetCurrentValueIndex( currentProtocol ); - } - } - - CAknPopupSettingPage* page = new ( ELeave ) CAknPopupSettingPage( - iDefaultPrinter, - EAknSettingPageNoOrdinalDisplayed, - EAknCtPopupSettingList, - R_EMPTY_PROTOCOL_SETTING_LIST, - R_SETTING_GENERIC_PROTOCOL_PAGE, - *queryValue ); - - CleanupStack::PushL( page ); - page->ConstructL(); - CleanupStack::Pop( page ); - - // Execute dialog and check that it returns properly. If so get the selected - // index and use it to protocol map to get name of the selected protocol. - TInt selectedProtocolId( -1 ); - if( page->ExecuteLD() ) - { - selectedProtocolId = - indexToProtocolMap[ queryValue->CurrentValueIndex() ]; - } - - // CleanupStack contains 4 items: - // protocolNameArray, indexToProtocolMap (close), queryTextArray and - // queryArray. - const TInt numberOfItemsInCleanupStack( 4 ); - CleanupStack::PopAndDestroy( numberOfItemsInCleanupStack, protocolNameArray ); - return selectedProtocolId; - } - -TInt CPropertiesBoxModel::NumberOfCopies() - { - return iNumberOfCopiesValue; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/printapputil.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/printapputil.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "printapputil.h" -#include "printmessagecodes.h" -#include "cimageprintappui.h" -#include "clog.h" - -// Displays the error note -void PrintAppUtil::ShowErrorNoteL( - TInt aResourceId ) - { - HBufC* str = StringLoader::LoadLC( aResourceId ); - CAknErrorNote* note = new ( ELeave ) CAknErrorNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy( str ); // str - } - -// Displays the information note -void PrintAppUtil::ShowInfoNoteL( - TInt aResourceId ) - { - HBufC* str = StringLoader::LoadLC( aResourceId ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy( str); // str - } - -// Displays error message based on the error code -void PrintAppUtil::ShowErrorMsgL( - TInt aErrCode ) - { - if ( aErrCode != KErrNone ) - { - HBufC* str = PrintAppUtil::PrintErrorMsgLC( aErrCode ); - CAknErrorNote* note = new ( ELeave ) CAknErrorNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy( str ); // str - } - } - -// Loads printer application specific error message -HBufC* PrintAppUtil::PrintErrorMsgLC( - TInt aErrCode ) - { - HBufC* errStr = 0; - TInt resourceId( 0 ); - - switch ( aErrCode ) - { - case ( KHCIErrorBase - EPageTimedOut ): - resourceId = R_NOTE_CONNECT_PRINT_ERROR; - break; - case KErrIrObexRespServiceUnavail: - resourceId = R_NOTE_SEND_PRINT_ERROR; - break; - case KErrDisconnected: - resourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - case EObexGeneralError: - resourceId = R_NOTE_GENERAL_PRINT_ERROR; - break; - case EPbStatusErrorReasonInk: - resourceId = R_NOTE_IMAGEPRINT_ERROR_INK; - break; - case EPbStatusErrorReasonHardwareCoverOpen: - resourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN; - break; - case EPbStatusErrorReasonHardwarePrinterBusy: - resourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY; - break; - case EPbStatusErrorReasonHardwareNoInkCartridge: - resourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE; - break; - case EPbStatusErrorReasonNoReason: - resourceId = R_NOTE_PRINT_STATUS_ERROR; - break; - case EPbOutOfPaper: - resourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT; - break; - case EPbStatusErrorReasonInkEmpty: - resourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT; - break; - case EPrintReasonPaused: - resourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED; - break; - case EPrintReasonMarkerFailure: - resourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE; - break; - - case KErrHCILinkDisconnection: - resourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - default: - resourceId = R_NOTE_GENERAL_PRINT_ERROR; - break; - } - errStr = StringLoader::LoadLC( resourceId ); - -// Add error code to message only when debug build is created. -#ifdef _DEBUG - if ( aErrCode != 0 ) - { - // append error code to message - _LIT( KErrTmp, ": %d" ); - TBuf<32> errCodeMsg; - errCodeMsg.Format( KErrTmp, aErrCode ); - errStr = errStr->ReAllocL( errStr->Length() + 32 ); - CleanupStack::Pop(); // errStr before realloc - CleanupStack::PushL( errStr ); - TPtr p( errStr->Des() ); - p += errCodeMsg; - } -#endif // _DEBUG - - return errStr; - } - -// Adds application path -TFileName PrintAppUtil::AddApplicationPath( - const TDesC& aFileName ) - { - CEikAppUi* appUi = static_cast( CEikonEnv::Static()->AppUi() ); - TFileName fullFilePath = appUi->Application()->AppFullName(); - - TParse parse; - parse.Set( fullFilePath, NULL, NULL ); - fullFilePath = parse.DriveAndPath(); - fullFilePath.Append( aFileName ); - return fullFilePath; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintapp/src/uimodefactory.cpp --- a/ImagePrint/ImagePrintUI/imageprintapp/src/uimodefactory.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2004-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 "uimodefactory.h" -#include "cimageprintappui.h" -#include "muimode.h" -#include "caiwmode.h" -#include "cidlemode.h" -#include "ciffactory.h" - -// CONSTRUCTOR -MUIMode* UIModeFactory::CreateL( TBool aAiwMode, - MUIModeObserver* aUIModeObserver, - CIFFactory& aIFFactory ) - { - if( aAiwMode ) - { - return CAiwMode::NewL( aUIModeObserver, aIFFactory ); - } - else - { - return CIdleMode::NewL( aUIModeObserver, aIFFactory ); - } - } - - -// Destructor -UIModeFactory::~UIModeFactory() - { - - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/bwins/imageprintengineu.def --- a/ImagePrint/ImagePrintUI/imageprinteng/bwins/imageprintengineu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - ?FileArray@CImagePrintEngine@@QAEAAV?$RPointerArray@VTDesC16@@@@XZ @ 1 NONAME ; class RPointerArray & CImagePrintEngine::FileArray(void) - ?RestartEngine@CImagePrintEngine@@QAEXXZ @ 2 NONAME ; void CImagePrintEngine::RestartEngine(void) - ?NewL@CImagePrintEngine@@SAPAV1@PAVCDesC16ArrayFlat@@@Z @ 3 NONAME ; class CImagePrintEngine * CImagePrintEngine::NewL(class CDesC16ArrayFlat *) - ?NewLC@CImagePrintEngine@@SAPAV1@PAVCDesC16ArrayFlat@@@Z @ 4 NONAME ; class CImagePrintEngine * CImagePrintEngine::NewLC(class CDesC16ArrayFlat *) - ?InterfaceFactory@CImagePrintEngine@@QAEAAVCIFFactory@@XZ @ 5 NONAME ; class CIFFactory & CImagePrintEngine::InterfaceFactory(void) - ?SetImageArrayL@CImagePrintEngine@@QAEXPAVCDesC16ArrayFlat@@@Z @ 6 NONAME ; void CImagePrintEngine::SetImageArrayL(class CDesC16ArrayFlat *) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/data/10208a35.txt Binary file ImagePrint/ImagePrintUI/imageprinteng/data/10208a35.txt has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/data/bckgs.mbm Binary file ImagePrint/ImagePrintUI/imageprinteng/data/bckgs.mbm has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/data/imageprintengine.rss --- a/ImagePrint/ImagePrintUI/imageprinteng/data/imageprintengine.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +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: -* -*/ - - -// RESOURCE IDENTIFIER -NAME IGPE // 4 letter ID - -#include -#include -#include -#include - -// d:List box format string - do not localize this! -#define qtn_lbox_format "\t%0U\t\t%1U" - -// Maximum and minimum number -#define MIN_TINT_NAME -2147483646 -#define MAX_TINT_NAME 2147483647 - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf="ImagePrintEngine"; } - -/** - * Generic popup setting item - */ -RESOURCE AVKON_SETTING_PAGE r_setting_generic_page - { - //softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; // Removed due to single click - softkey_resource = R_AVKON_SOFTKEYS_CANCEL ; - type = EAknCtPopupSettingList; - editor_resource_id = r_empty_setting_list; - } - -RESOURCE POPUP_SETTING_LIST r_empty_setting_list - { - } - -RESOURCE AVKON_POPUP_SETTING_TEXTS r_setting_generic_popup_page - { - flags = 0; - setting_texts_resource = r_setting_generic_popup_array; - popped_up_texts_resource = r_setting_generic_popup_array_texts; - } - -RESOURCE ARRAY r_setting_generic_popup_array - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = 0; - text = " "; - } - }; - } - -RESOURCE ARRAY r_setting_generic_popup_array_texts - { - items = - { - LBUF - { - txt = " "; - } - }; - } - -/** - * Generic TInt setting page - */ - -RESOURCE AVKON_SETTING_PAGE r_def_integer_page - { - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; - type = EAknCtIntegerEdwin; - editor_resource_id = r_def_integer_editor; - } - -RESOURCE AVKON_INTEGER_EDWIN r_def_integer_editor - { - min = MIN_TINT_NAME; - max = MAX_TINT_NAME; - } - -/** - * Generic float query - */ -RESOURCE DIALOG r_generic_float_query_dlg - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = 10000; - control = AVKON_DATA_QUERY - { - layout = EFloatingPointLayout; - label = " "; - control = FLPTED - { - }; - }; - } - }; - } - -// Resource strings -RESOURCE TBUF R_QTN_LBOX_FORMAT { buf = qtn_lbox_format; } -RESOURCE TBUF R_EMPTY { buf = ""; } - -// Paper sizes -RESOURCE TBUF R_QTN_STR_PAPER_SIZE { buf = qtn_print_settings_paper_size; } -RESOURCE TBUF R_QTN_STR_SIZE_AUTO { buf = qtn_print_paper_size_auto; } -RESOURCE TBUF R_QTN_STR_SIZE_LETTER { buf = qtn_print_paper_size_letter; } -RESOURCE TBUF R_QTN_STR_SIZE_A4 { buf = qtn_print_paper_size_a4; } -RESOURCE TBUF R_QTN_STR_SIZE_A6 { buf = qtn_print_paper_size_a6; } -RESOURCE TBUF R_QTN_STR_SIZE_4X6 { buf = qtn_print_paper_size_4x6; } -RESOURCE TBUF R_QTN_STR_SIZE_5X7 { buf = qtn_print_paper_size_5x7; } -RESOURCE TBUF R_QTN_STR_SIZE_STICKER { buf = qtn_print_paper_size_sticker; } - -// Print quality -RESOURCE TBUF R_QTN_STR_QUALITY { buf = qtn_print_settings_print_quality; } -RESOURCE TBUF R_QTN_STR_QUAL_AUTO { buf = qtn_print_quality_auto; } -RESOURCE TBUF R_QTN_STR_QUAL_NORMAL { buf = qtn_print_quality_normal; } -RESOURCE TBUF R_QTN_STR_QUAL_DRAFT { buf = qtn_print_quality_draft; } -RESOURCE TBUF R_QTN_STR_QUAL_FINE { buf = qtn_print_quality_fine; } - -// Template -RESOURCE TBUF R_QTN_STR_TEMPLATE { buf = qtn_print_settings_template; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_BLESS { buf = qtn_print_settings_bless; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_ONE { buf = "1"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_TWO { buf = "2"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_FOUR { buf = "4"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_SIX { buf = "6"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_NINE { buf = "9"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_TWELVE { buf = "12"; } -RESOURCE TBUF R_QTN_STR_TEMPLATE_SIXTEEN { buf = "16"; } - - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/data/previewdata.dat Binary file ImagePrint/ImagePrintUI/imageprinteng/data/previewdata.dat has changed diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/eabi/imageprintengineu.def --- a/ImagePrint/ImagePrintUI/imageprinteng/eabi/imageprintengineu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -EXPORTS - _ZN17CImagePrintEngine13RestartEngineEv @ 1 NONAME - _ZN17CImagePrintEngine14SetImageArrayLEP16CDesC16ArrayFlat @ 2 NONAME - _ZN17CImagePrintEngine16InterfaceFactoryEv @ 3 NONAME - _ZN17CImagePrintEngine4NewLEP16CDesC16ArrayFlat @ 4 NONAME - _ZN17CImagePrintEngine5NewLCEP16CDesC16ArrayFlat @ 5 NONAME - _ZN17CImagePrintEngine9FileArrayEv @ 6 NONAME - _ZTI10CIFFactory @ 7 NONAME ; ## - _ZTI11CImagePrint @ 8 NONAME ; ## - _ZTI12CPreviewInfo @ 9 NONAME ; ## - _ZTI12CRealFactory @ 10 NONAME ; ## - _ZTI13CTemplateData @ 11 NONAME ; ## - _ZTI14CPrintSettings @ 12 NONAME ; ## - _ZTI15CListCapability @ 13 NONAME ; ## - _ZTI15CTIntCapability @ 14 NONAME ; ## - _ZTI16CFloatCapability @ 15 NONAME ; ## - _ZTI16CPrintJobManager @ 16 NONAME ; ## - _ZTI16CSettingsManager @ 17 NONAME ; ## - _ZTI17CDiscoveryManager @ 18 NONAME ; ## - _ZTI17CImagePrintEngine @ 19 NONAME ; ## - _ZTI17CTemplateSettings @ 20 NONAME ; ## - _ZTI18CPrintEventCatcher @ 21 NONAME ; ## - _ZTI22CIdlePrintEventCatcher @ 22 NONAME ; ## - _ZTV10CIFFactory @ 23 NONAME ; ## - _ZTV11CImagePrint @ 24 NONAME ; ## - _ZTV12CPreviewInfo @ 25 NONAME ; ## - _ZTV12CRealFactory @ 26 NONAME ; ## - _ZTV13CTemplateData @ 27 NONAME ; ## - _ZTV14CPrintSettings @ 28 NONAME ; ## - _ZTV15CListCapability @ 29 NONAME ; ## - _ZTV15CTIntCapability @ 30 NONAME ; ## - _ZTV16CFloatCapability @ 31 NONAME ; ## - _ZTV16CPrintJobManager @ 32 NONAME ; ## - _ZTV16CSettingsManager @ 33 NONAME ; ## - _ZTV17CDiscoveryManager @ 34 NONAME ; ## - _ZTV17CImagePrintEngine @ 35 NONAME ; ## - _ZTV17CTemplateSettings @ 36 NONAME ; ## - _ZTV18CPrintEventCatcher @ 37 NONAME ; ## - _ZTV22CIdlePrintEventCatcher @ 38 NONAME ; ## - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/group/bld.inf --- a/ImagePrint/ImagePrintUI/imageprinteng/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2004-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_EXPORTS -../data/10208a35.txt /epoc32/data/z/private/10202be9/10208a35.txt -../data/10208a35.txt /epoc32/release/winscw/udeb/z/private/10202be9/10208a35.txt - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES - -imageprintengine.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/group/imageprintengine.mmp --- a/ImagePrint/ImagePrintUI/imageprinteng/group/imageprintengine.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "../../inc/logdef.h" - -deffile imageprintengine.def - -TARGET imageprintengine.dll -TARGETTYPE dll - -CAPABILITY CAP_GENERAL_DLL - -UID 0x1000008D 0x101FFA85 -VENDORID VID_DEFAULT - -APP_LAYER_SYSTEMINCLUDE - -USERINCLUDE . ../inc ../src -USERINCLUDE ../../inc ../../../inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintLibrary/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintServer/inc -USERINCLUDE ../../imageprintapp/inc -USERINCLUDE ../../../clog/inc - -SOURCEPATH ../src - -SOURCE cimageprint.cpp -SOURCE cimageprintengine.cpp -SOURCE ctemplatesettings.cpp -SOURCE ctemplatedata.cpp -SOURCE cprintsettings.cpp -SOURCE ciffactory.cpp -SOURCE crealfactory.cpp -SOURCE ctintcapability.cpp -SOURCE clistcapability.cpp -SOURCE cfloatcapability.cpp -SOURCE cdiscoverymanager.cpp -SOURCE csettingsmanager.cpp -SOURCE cprintjobmanager.cpp -SOURCE cprinteventcatcher.cpp -SOURCE settingsconverter.cpp -SOURCE cpreviewinfo.cpp -SOURCE tpreviewimageinfo.cpp -SOURCE cidleprinteventcatcher.cpp - -START RESOURCE ../data/imageprintengine.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -HEADER -#ifdef RD_SECURE_BIN_RES - TARGETPATH RESOURCE_FILES_DIR -#else - TARGETPATH system/data -#endif -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY avkon.lib -LIBRARY bitgdi.lib -LIBRARY imageconversion.lib -LIBRARY bitmaptransforms.lib -LIBRARY cone.lib -LIBRARY efsrv.lib -LIBRARY eikcore.lib -LIBRARY platformenv.lib -LIBRARY featmgr.lib -LIBRARY centralrepository.lib -LIBRARY imageprintclient.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cbasecapability.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cbasecapability.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2004-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 CBASECAPABILITY_H -#define CBASECAPABILITY_H - -#include -#include - -// TYPE DEFINITIONS -typedef TBuf<64> TCapabilityTitle; - -/** - * - * Capability base class, pure virtual, needs to be derived - * - */ -class CBaseCapability - : public CBase - { - public: // New methods - - virtual ~CBaseCapability() {}; - - /** - * Creates text for the setting item list box - * - * @return Correctly formatted list box text - */ - virtual HBufC* ListBoxTextL() = 0; - - /** - * Launches pop-up window to modify the values - * - * @return Did user change the value or not - */ - virtual TBool LaunchPopupListL() = 0; - - /** - * Clones and returns copy of itself - * - * @return Cloned copy of the instance itself - */ - virtual CBaseCapability* CloneL() = 0; - - public: // Data - - // The index on the list from the top (0 = topmost) - TBool iIndexOnList; - - // Title of this capability - TCapabilityTitle iTitle; - - // UID of the capability - TInt iUid; - - // Value - TInt iValue; - }; - -#endif // CBASECAPABILITY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cdiscoverymanager.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cdiscoverymanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2004-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 CDISCOVERYMANAGER_H -#define CDISCOVERYMANAGER_H - -#include -#include -#include -#include - -#include "mdiscovery.h" -#include "mdiscoveryobserver.h" -#include "imageprint.h" - -class CRealFactory; -class CIFFactory; -class CImagePrint; - -/** - * - * Manages the device discovery part. - * - */ -class CDiscoveryManager - : public CBase, - public MDiscovery, - public MPrinterDiscoveryObserver - { - public: // Construction and destruction - - /** - * Two-phase construction - * - * @param aFactory Pointer to factory - * @return Initialized instance of the class - */ - static CDiscoveryManager* NewL( CIFFactory* aFactory ); - static CDiscoveryManager* NewLC( CIFFactory* aFactory ); - - /** - * Destructor - */ - virtual ~CDiscoveryManager(); - - private: // Construction and destruction - - /** - * Constructor - * - * @param aFactory Pointer to factory - */ - CDiscoveryManager( CIFFactory* aFactory ); - - /** - * Second-phase constructor - */ - void ConstructL(); - - private: // Methods derived from MDiscovery - - virtual void StartDeviceDiscoveryL( - MDiscoveryObserver* aNotifier, TUint aProtocol ); - virtual void CancelDeviceDiscoveryL(); - virtual TInt ChoosePrinterL( TInt aPrinterUid ); - virtual TUint SupportedProtocols(); - virtual TInt IsPictBridgeMode(); - virtual void RemoveDiscoveryObserver(); - - private: // Methods derived from MPrinterDiscoveryObserver - - virtual void FoundPrinterL( const TPrinter& aPrinterInfo ); - virtual void DiscoveryStatusL( TInt aStatus, TInt aErrorCode, - TInt aErrorStringCode ); - virtual void RemovePrinterL( const TPrinter& aPrinterInfo ); - - private: // Enumerations - - // Different states of device discovery - enum TDiscoveryState - { - EDiscovering, - EDoneDiscovery, - ECancellingDiscovery - }; - - private: // Data - - // Pointer to factory object - CIFFactory* iFactory; - - // Pointer to the observer - MDiscoveryObserver* iDiscoveryObserver; - - // Flag to indicate if the discovery or cancelling of discovery is on-going - TBool iOnGoingDiscovery; - TBool iCancelling; - - // Chosen printer UID - TInt iPrinterUid; - - // Synchronous wait system for cancellation - CActiveSchedulerWait iWait; - - // UID for MMC printer (if available) - TInt iMMCUid; - }; - -#endif // CDISCOVERYMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cfloatcapability.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cfloatcapability.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2004-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 CFLOATCAPABILITY_H -#define CFLOATCAPABILITY_H - -#include "cbasecapability.h" - -/** - * - * Capability type for float type of settings - * - */ -class CFloatCapability : - public CBaseCapability - { - public: // Constructors and destructors - - /** - * Destructor - */ - virtual ~CFloatCapability(); - - public: // Methods derived from CBaseCapability - - virtual HBufC* ListBoxTextL(); - virtual TBool LaunchPopupListL(); - virtual CBaseCapability* CloneL(); - - public: // New methods - - /** - * Sets the values for denominator, numerator and - * maximum numerator. Initializes iRealValue at the same time - * - * @param aDenom Denominator - * @param aNumerator Current numerator - * @param aMaxNumerator Maximum numerator - * @return Error code - */ - TInt SetValues( TInt aDenom, TInt aNumerator, TInt aMaxNumerator ); - - /** - * Returns numerator - * @return numerator - */ - TInt Numerator() const; - - /** - * Returns denominator - * @return denominator - */ - TInt Denominator() const; - - private: // Data - - // Denominator / Numerator pair - TInt iDenominator; - TInt iMaxNumerator; - - TReal iRealValue; - }; - -#endif // CFLOATCAPABILITY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cidleprinteventcatcher.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cidleprinteventcatcher.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2004-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 CIDLEPRINTEVENTCATCHER_H -#define CIDLEPRINTEVENTCATCHER_H - -#include -#include - -#include "imageprint.h" -#include "midleprinteventregisterif.h" - -// FORWARD DECLARATIONS -class CRealFactory; -class MIdlePrintEventObserver; -class MIdlePrintEventRegisterIF; - -// CLASS DEFINITION - -/** - * This class catches idle events from Image Print engine. - */ -class CIdlePrintEventCatcher : - public CBase, - public MIdleObserver, - public MIdlePrintEventRegisterIF - { - public: // Construction and destruction - - /** - * Two phase constructor - * - * @param aFactory The factory - * @param aIdleUIObserver Observer to notify UI about idle events - * - * @return Initialized instance of the engine - */ - static CIdlePrintEventCatcher* NewL( - CRealFactory* aFactory /*, MIdlePrintEventObserver* aIdleUIObserver*/ ); - static CIdlePrintEventCatcher* NewLC( - CRealFactory* aFactory /*, MIdlePrintEventObserver* aIdleUIObserver*/ ); - - /** - * Destructor - */ - virtual ~CIdlePrintEventCatcher(); - - private: // Construction and destruction - - /** - * Constructor - * - * @param aFactory The factory - * @param aIdleUIObserver Observer to notify UI about idle events - */ - CIdlePrintEventCatcher( CRealFactory* aFactory /*, - MIdlePrintEventObserver* aIdleUIObserver*/ ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - public: // Methods derived from MIdleObserver - - void StatusEvent(const TEvent &aEvent, TInt aError, TInt aMsgCode); - - public: // Methods derived from MIdlePrintEventRegisterIF - - void RegisterObserver( MIdlePrintEventObserver* aIdleObserver ); - void UnRegisterObserver( MIdlePrintEventObserver* aIdleObserver ); - - private: // Data - - // Interface factory - CRealFactory* iFactory; - - // Observer to notify UI about idle print events - MIdlePrintEventObserver* iIdleUIObserver; - - MIdlePrintEventObserver* iIdleUIObserver2; - - RPointerArray iObservers; - - HBufC* iBuf; - - }; - - -#endif // CIDLEPRINTEVENTCATCHER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/ciffactory.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/ciffactory.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2004-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 CIFFACTORY_H -#define CIFFACTORY_H - -#include -#include - -class CImagePrintEngine; -class CImagePrint; -class MDiscovery; -class MPrintJob; -class MPrintPreview; -class MPrintSettings; -class MIdlePrintEventRegisterIF; -class RImagePrintClient; -class MPrintEventObserver; -class MPrintEventRegisterIF; - -// CLASS DEFINITION -/** - * - * Base class for the factories that create the concrete classes - * - */ -class CIFFactory - : public CBase - { - public: // Constructors and destructors - - /** - * Destructor - */ - virtual ~CIFFactory(); - - protected: // Constructors and destructors - - /** - * Constructor - */ - CIFFactory( CImagePrintEngine* aEngine ); - - public: // New methods - - /** - * Returns discovery interface - * - * @return Device discovery interface - */ - virtual MDiscovery* DiscoveryIF() = 0; - - /** - * Returns settings interface - * - * @return Settings interface - */ - virtual MPrintSettings* SettingsIF() = 0; - - /** - * Returns print job interface - * - * @return Print job interface - */ - virtual MPrintJob* PrintJobIF() = 0; - - /** - * Restarts Engine - */ - virtual void RestartEngine() = 0; - - /** - * Returns Engine - */ - virtual CImagePrint* Engine() = 0; - - /** - * Returns Browser preview interface - */ - - /** - * Returns idle print event register interface - */ - virtual MIdlePrintEventRegisterIF* IdlePrintEventRegisterIF() = 0; - - /** - * Returns Interface to RImagePrintClient - * @return RImagePrintClient - */ - virtual RImagePrintClient ImagePrintClient() = 0; - - /** - * Returns information about application status - * @return TBool ETrue if application is already in use. - */ - virtual TBool IsApplicationAlreadyInUse() = 0; - - /** - * Returns Interface to print event catcher - * @return MPrintEventObserver - */ - virtual MPrintEventObserver* PrintEventObserverIF() = 0; - - /** - * Returns Interface to print event register interface - * @return MPrintEventRegisterIF - */ - virtual MPrintEventRegisterIF* PrintEventRegisterIF() = 0; - - protected: // Data - - CImagePrintEngine* iPrintEngine; - }; - -#endif // CIFFACTORY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cimageprint.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cimageprint.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINT_H -#define CIMAGEPRINT_H - -#include -#include - -#include "rimageprintclient.h" -#include "imageprint.h" - -class TPrintCapability; -class TPrinter; -class TEvent; -class CIdleGuard; -class CDiscoveryGuard; -class CJobGuard; - -/** - * @brief Class containing the Image Print Library Public API. - */ -class CImagePrint : public CBase, public MCoeForegroundObserver - { - // Functions - public: - CImagePrint(); - ~CImagePrint(); - void ConnectL(); - void Close(); - TVersion Version(); - TInt StartDiscoveryL(MPrinterDiscoveryObserver& aObserver, TUint aProtocols = 0); - TInt CancelDiscovery(); - TInt CreatePrintJobL(TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver); - TInt SubmitPrintJobL(); - TInt CancelPrintJob(); - TInt ContinuePrintJobL(); - TInt GetNumPrintPages(); - TInt GetJobStatus(); - TInt GetPrinterStatus(TInt aPrinterID); - TInt GetPrinterCapabilityIDsL(TInt aPrinterID, RArray& aCapabilityIDs); - TInt GetPrinterCapabilityL(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability); - TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); - TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); - TInt GetNumPreviewPages(); - TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFbsBitmapHandle); - TInt GetNumberOfCopies( RArray& aArray ); - TInt SetNumberOfCopies( const RArray& aArray ); - TInt CreatePreviewImage(TInt aPageNumber); - TInt RemoveCachedPrinterL(TInt aPrinterID); - TUint SupportedProtocols(); - void RegisterIdleObserver(MIdleObserver *aObserver); - - public: // From MCoeForegroundObserver - void HandleGainingForeground(); - void HandleLosingForeground(); - - protected: - private: - - // Data - public: - protected: - private: - - RImagePrintClient iClient; - CIdleGuard* iIdleGuard; - CDiscoveryGuard* iDiscoveryGuard; - CJobGuard* iJobGuard; - }; - -#endif // CIMAGEPRINT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cimageprintengine.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cimageprintengine.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMAGEPRINTENGINE_H -#define CIMAGEPRINTENGINE_H - -#include -#include - -class CIFFactory; -class CRepository; - -/** - * - * The main engine class, creates the factory that initializes the interface - * implementations and other instances - * - */ -class CImagePrintEngine - : public CBase - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aImageFiles The printed image files, ownership of the - * array is transferred. Can be also NULL at this - * stage - * @param aIdleObserver Observer to notify UI about idle events - * - * @return Initialized instance of CImagePrintEngine - */ - IMPORT_C static CImagePrintEngine* NewL( - CDesCArrayFlat* aImageFiles ); - IMPORT_C static CImagePrintEngine* NewLC( - CDesCArrayFlat* aImageFiles ); - - /** - * Destructor - */ - virtual ~CImagePrintEngine(); - - protected: // Constructors and destructors - - /** - * Constructor - */ - CImagePrintEngine(); - - /** - * Second phase constructor - * - * @param aImageFiles The printed image files, ownership of the - * array is transferred - * @param aIdleObserver Observer to notify UI about idle events - */ - void ConstructL( CDesCArrayFlat* aImageFiles ); - - public: // New methods - - /** - * Returns reference to the interface factory class that - * can be used to get the pointers to the concrete implementations - * of the mixin-interface classes - * - * @return Reference to the initialized interface factory - */ - IMPORT_C CIFFactory& InterfaceFactory(); - - /** - * Sets the new image array. Ownership of the array is transferred - * - * @param aArray New array - */ - IMPORT_C void SetImageArrayL( CDesCArrayFlat* aArray ); - - /** - * Returns the array of images - * @return array of images - */ - IMPORT_C RPointerArray& FileArray(); - - /** - * Restarts Image Print engine by deleting and reconstructing it. - */ - IMPORT_C void RestartEngine(); - - - protected: // New methods - - /** - * Creates new TFileName for file array - * @return pointer to new TFileName object - */ - TFileName* CreateFileNameL(); - - protected: // Data - - // Printed image files - CDesCArrayFlat* iFiles; - - // RArray variant of the files for server - RPointerArray iFileArray; - - // Factory - CIFFactory* iIFFactory; - - // A Central Repository session - CRepository* iCRSession; - }; - -#endif // CIMAGEPRINTENGINE_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/clistcapability.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/clistcapability.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2004-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 CLISTCAPABILITY_H -#define CLISTCAPABILITY_H - -#include "cbasecapability.h" - -class CRealFactory; - -/** - * - * Capability type for list type of settings - * - */ -class CListCapability : - public CBaseCapability - { - public: // Constructors and destructors - - CListCapability ( CRealFactory* aFactory ); - - /** - * Destructor - */ - virtual ~CListCapability(); - - public: // Methods derived from CBaseCapability - - virtual HBufC* ListBoxTextL(); - virtual TBool LaunchPopupListL(); - virtual CBaseCapability* CloneL(); - - public: // Data - - // Enumeration IDs and the texts associated to the ids - RArray iEnumIDs; - RPointerArray iTexts; - - CRealFactory* iFactory; //not owned - }; - -#endif // CLISTCAPABILITY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cpreviewinfo.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cpreviewinfo.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2004-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 CPREVIEWINFO_H -#define CPREVIEWINFO_H - -#include -#include - -#include "tpreviewimageinfo.h" - -/** - * - * Holds information of the preview of a single template - * - */ -class CPreviewInfo : public CBase - { - public: // Constructors and destructors - - /** - * Constructor - * - * @param aCapabilityUid Uid of the template - * @param aPaperLandscape Is paper drawn to landscape or not - */ - CPreviewInfo( TInt aCapabilityUid, TBool aPaperLandscape ); - - /** - * Destructor - */ - ~CPreviewInfo(); - - public: // data - - // Paper in landscape format or not.. - TBool iPaperLandscape; - - // Template capability UID - TInt iUid; - - // Used for sticker templates; one image per page, no matter - // how many image positions there will be per sheet - TBool iOneImagePerPage; - - // Index of a background bitmap - TInt iBckgIndex; - - // Pointers to the image information in the template - RPointerArray iImageInfo; - }; - -#endif // CPREVIEWINFO_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cprinteventcatcher.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cprinteventcatcher.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2004-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 CPRINTEVENTCATCHER_H -#define CPRINTEVENTCATCHER_H - -#include -#include - -#include "imageprint.h" -#include "mprinteventregisterif.h" - -class CIFFactory; -class CImagePrintEngine; -class MPrintPreviewObserver; -class MPrintJobStatus; - -// CLASS DEFINITION -/** - * - * Image Print Server passes the notifications via single interface, - * which is implemented by CPrintEventCatcher. It receives the events - * and forwards them to the correct instances inside ImagePrintEngine. - * - */ -class CPrintEventCatcher : - public CBase, - public MPrintEventObserver, - public MPrintEventRegisterIF - { - public: // Construction and destruction - - /** - * Two phase constructor - * - * @param aFactory The factory - * @param aEngine The image print engine - * @return Initialized instance of the engine - */ - static CPrintEventCatcher* NewL( - CIFFactory* aFactory, CImagePrintEngine* aEngine ); - static CPrintEventCatcher* NewLC( - CIFFactory* aFactory, CImagePrintEngine* aEngine ); - - /** - * Destructor - */ - virtual ~CPrintEventCatcher(); - - private: // Construction and destruction - - /** - * Constructor - * - * @param aFactory The factory - * @param aEngine The image print engine - */ - CPrintEventCatcher( CIFFactory* aFactory, CImagePrintEngine* aEngine ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - public: // Methods derived from MPrintEventObserver - - void PrintJobProgressEvent( TInt aStatus, TInt aPercentCompletion, - TInt aJobStateCode ); - void PrintJobErrorEvent( TInt aError, TInt aErrorStringCode ); - void PrinterStatusEvent( TInt aError, TInt aErrorStringCode ); - void PreviewImageEvent( TInt aFsBitmapHandle ); - void ShowMessageL( TInt aMsgLine1Code, TInt aMsgLine2Code ); - TBool AskYesNoQuestionL( TInt aMsgLine1Code, TInt aMsgLine2Code ); - const TDesC& AskForInputL( TInt aMsgLine1Code, TInt aMsgLine2Code ); - - public: // from MPrintEventRegisterIF - - void RegisterObserver( MPrintJobStatus* aObserver ); - void UnRegisterObserver( MPrintJobStatus* aObserver ); - - public: // New methods - - /** - * Sets the new preview observer, which will receive the - * print preview rendering events - * - * @param aObserver Print preview observer - */ - void SetPreviewObserver( MPrintPreviewObserver* aObserver ); - - private: // Data - - CIFFactory* iFactory; - CImagePrintEngine* iEngine; - - // Preview observer - MPrintPreviewObserver* iPreviewObserver; - - // Print job observer - RPointerArray iObservers; - }; - - -#endif // CPRINTEVENTCATCHER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cprintjobmanager.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cprintjobmanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2004-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 CPRINTJOBMANAGER_H -#define CPRINTJOBMANAGER_H - -#include -#include - -#include "mprintjob.h" -#include "mprintjobstatus.h" - -class MPrintJobObserver; -class CImagePrint; -class CImagePrintEngine; -class CRealFactory; - -/** - * - * Print job manager - handels the creation of print jobs and the - * printing process - * - */ -class CPrintJobManager - : public CBase, - public MPrintJob, - public MPrintJobStatus - { - public: // Construction and destruction - - /** - * Two phase constructor - * - * @param aFactory Factory class - * @param aDLLEngine DLL engine - * - * @return Initialized instance - */ - static CPrintJobManager* NewL( CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ); - static CPrintJobManager* NewLC( CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ); - - /** - * Destructor - */ - virtual ~CPrintJobManager(); - - private: // Construction and destruction - - /** - * Constuctor - * - * @param aFactory Factory class - * @param aDLLEngine DLL engine - */ - CPrintJobManager( CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - public: // Methods derived from MPrintJob - - void PrintL( MPrintJobObserver* aObserver ); - void CancelL(); - void GetPrintJobL( RPointerArray& aImages ); - - public: // Methods derived from MPrintJobStatus - - void PrintJobProgress( TInt aStatus, TInt aPercentCompletion, - TInt aJobStateCode ); - void PrintJobError( TInt aError, TInt aErrorStringCode ); - void PrinterStatus( TInt aError, TInt aErrorStringCode ); - - public: // New methods - - /** - * Creates the print job but does not submit it - * - * @param aPrinterId The ID of the printer which will be used - */ - TInt CreatePrintJobL( TInt aPrinterId ); - - /** - * Returns if the printing has been activated - * - * @return state of printing - */ - TBool IsPrinting() const; - - private: // Enumeration - - // Print progress status - enum TPrintProgressStatus - { - EActive, - ECompleted - }; - - private: // Data - - // Instance of the factory class - CRealFactory* iFactory; - - // Main class of this DLL - CImagePrintEngine* iDLLEngine; - - // Print job observer - MPrintJobObserver* iObserver; - - // Synchronous wait system for cancellation - CActiveSchedulerWait iWait; - - // Status flags - TBool iPrintingOnGoing; - TBool iCancelling; - - // Chosen printer - TInt iPrinterUid; - - // Images from current job - RPointerArray iImages; - }; - -#endif // CPRINTJOBMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/cprintsettings.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/cprintsettings.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2004-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 CPRINTSETTINGS_H -#define CPRINTSETTINGS_H - -#include -#include - -class CBaseCapability; - -/** - * - * Interface to use the device discovery functionality of Image Print Engine - * - */ -class CPrintSettings - : public CBase - { - public: // Constructors and destructors - - /** - * Constructor - */ - CPrintSettings(); - - /** - * Destructor - */ - virtual ~CPrintSettings(); - - public: // New methods - - CPrintSettings* CloneL(); - - public: // Data - - // Capability list - RPointerArray iCapabilities; - }; - -#endif // CPRINTSETTINGS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/crealfactory.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/crealfactory.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2004-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 CREALFACTORY_H -#define CREALFACTORY_H - -#include - -#include "ciffactory.h" -#include "rimageprintclient.h" - -class CImagePrint; -class CDiscoveryManager; -class CPrintEventCatcher; -class CPrintJobManager; -class CSettingsManager; -class MIdlePrintEventObserver; -class CIdlePrintEventCatcher; - -// CLASS DEFINITION -/** - * - * Factory class for creating concrete interface classes for the UI - * - */ -class CRealFactory - : public CIFFactory - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aEngine Pointer to Image Printing Engine class instanace - * - * @return Initialized instance of this factory - */ - static CRealFactory* NewL( CImagePrintEngine* aEngine ); - - /** - * Destructor - */ - virtual ~CRealFactory(); - - protected: // Constructors and destructors - - /** - * Constructor - */ - CRealFactory( CImagePrintEngine* aEngine ); - - /** - * 2nd phase constructor - */ - void ConstructL( ); - - public: // Methods derived from CIFFactory - - // The factory methods that return each of the interfaces - virtual MDiscovery* DiscoveryIF(); - virtual MPrintSettings* SettingsIF(); - virtual MPrintJob* PrintJobIF(); - virtual MIdlePrintEventRegisterIF* IdlePrintEventRegisterIF(); - virtual RImagePrintClient ImagePrintClient(); - virtual TBool IsApplicationAlreadyInUse(); - virtual MPrintEventObserver* PrintEventObserverIF(); - virtual MPrintEventRegisterIF* PrintEventRegisterIF(); - // Method for restarting Image Print Engine - virtual void RestartEngine(); - - public: // New methods - - /** - * Returns Engine - * - * @return Engine - */ - CImagePrint* Engine(); - - /** - * Returns if the printing has been activated - * - * @return state of printing - */ - TBool IsPrinting() const; - - protected: // Data - - // The actual printin engine - CImagePrint* iImageServer; - - // Discovery manager - CDiscoveryManager* iDiscoveryMgr; - - // Print job manager - CPrintJobManager* iPrintJobMgr; - - // Settings manager - CSettingsManager* iSettingsMgr; - - // Print event catcher - listens to events coming from the server - CPrintEventCatcher* iEventCatcher; - - // Idle event catcher for idle events - CIdlePrintEventCatcher* iIdleEventCatcher; - - RImagePrintClient iImagePrintClient; - }; - -#endif // CREALFACTORY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/csettingsmanager.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/csettingsmanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2004-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 CSETTINGSMANAGER_H -#define CSETTINGSMANAGER_H - -#include -#include - -#include "mprintsettings.h" - -class CImagePrint; -class CRealFactory; -class CRepository; - -/** - * - * Settings manager handles and modifies the capabilities - * - */ -class CSettingsManager - : public CBase, - public MPrintSettings - { - public: // Construction and destruction - - /** - * Two-phase constructor - * - * @param aFactory Pointer to factory - * @return Initialized instance of the class - */ - static CSettingsManager* NewL( - CRealFactory* aFactory ); - static CSettingsManager* NewLC( - CRealFactory* aFactory ); - - /** - * Destructor - */ - ~CSettingsManager(); - - private: // Construction and destruction - - /** - * Constructor - * - * @param aFactory Pointer to factory - */ - CSettingsManager( CRealFactory* aFactory ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - public: // Methods derived from MPrintSettings - - CTemplateSettings* TemplateSettingsL(); - void SetActiveTemplateL( TUint aUid ); - TUint NumOfPagesL(); - TInt NumberOfCopies( RArray& aArray ); - TInt NumberOfCopies( TInt& aNumberOfCopies, TInt aIndex ); - TInt SetNumberOfCopiesL( const RArray& aArray ); - TInt UpdateNumberOfCopiesToServer(); - TBool IsMMC(); - void SetActivePageL( TUint aActivePage ); - TUint CurActivePageL(); - CPrintSettings* PrinterSettingsL(); - void SetPrinterSettingsL( CPrintSettings& aSettings ); - TInt SetPrinterSettingL( CBaseCapability& aCapab ); - TInt TemplateUid(); - TBool UpdatePageNumberL( TInt aCurrentImage ); - TInt PrinterUid(); - void SetUsbState( TBool aConnected ); - TBool GetUsbState(); - TInt GetDefaultPrinterProtocol(); - TInt SetDefaultPrinterProtocol( TInt aProtocol ); - TInt GetCurrentPrinterProtocol(); - void SetCurrentPrinterProtocol( TInt aProtocol ); - TUint GetCurrentPrinterVendor(); - void SetCurrentPrinterVendor( TUint aVendor ); - TInt GetDefaultPrintID(); - TInt SetDefaultPrinterID( TInt aId ); - HBufC* GetDefaultPrinterNameLC(); - TInt SetDefaultPrinterNameL( const TDesC& aPrinterName ); - HBufC* GetCurrentPrinterName(); - TInt SetCurrentPrinterName( const TDesC& aPrinterName ); - HBufC* GetCurrentPaperSizeTextL(); - - public: // New methods - - /** - * Initializes settings after successfully creating a print job - * - * @param aPrinterUid Printer UID for the capability fetching - * @param aMMCUid MMC printer UID if available - */ - void InitSettingsL( TInt aPrinterUid, TInt aMMCUid ); - - /** - * Fetches the correct capability, leaves if cannot find the capapbility - * - * @param aUid Uid of the fetched capability - * @return The capability - */ - CBaseCapability* FetchCapabilityL( TInt aUid ); - - private: // New methods - - /** - * Initializes capabilities - * - * @param aPrinterUid Printer UID for the capability fetching - */ - void InitCapabilitiesL( TInt aPrinterUid ); - - /** - * Initializes template settings - */ - void InitTemplateSettingsL(); - - private: // Data - - // Pointer to factory and Image Print Server - CRealFactory* iFactory; - - // Printer and template settings - CTemplateSettings* iTemplateSettings; - CPrintSettings* iPrintSettings; - - // Active printer Uid from from Print Server - TInt iPrinterUid; - - // Current active page - TUint iActivePage; - - // MMC Uid - TInt iMMCUid; - - // Images on page is dependent on the current template - TInt iImagesOnPage; - - // USB connection state - TBool iUsbConnected; - - // A Central Repository session - CRepository* iCRSession; - - // printer brand - TUint iVendor; - - // Current printer protocol - TInt iCurrentPrinterProtocol; - - // Current printet name - HBufC* iCurrentPrinterName; - - // Number of copies array - RArray iNumberOfCopiesArray; - RArray iNumberOfCopiesCumulativeArray; - - }; - -#endif // CSETTINGSMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/ctemplatedata.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/ctemplatedata.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2004-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 CTEMPLATEDATA_H -#define CTEMPLATEDATA_H - -#include -#include - -/** - * - * Encapsulates the data of a single template - * - */ -class CTemplateData - : public CBase - { - public: // Constructors and destructors - - /** - * Standard two-phase constructor - */ - static CTemplateData* NewLC(); - - /** - * Standard two-phase constructor - */ - static CTemplateData* NewL(); - - /** - * Destructor - */ - virtual ~CTemplateData(); - - protected: // Constructors and destructors - - /** - * Constructor - */ - CTemplateData(); - - public: // New methods - - /** - * Clones the template data and returns it - * - * @return cloned instance of the template data class instance - */ - CTemplateData* CloneL(); - - public: // Data - - // Uid for the template, passed to the - // engine, when the template is activated on - // print preview - TInt iUid; - }; - -#endif // CTEMPLATEDATA_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/ctemplatesettings.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/ctemplatesettings.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2004-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 CTEMPLATESETTINGS_H -#define CTEMPLATESETTINGS_H - -#include -#include - -class CTemplateData; -class CRealFactory; - -/** - * - * Encapsulates the complete set of templates - * - */ -class CTemplateSettings - : public CBase - { - public: // Constuctors and destructors - - /** - * Two-phase constructor - * - * @return Initialized instance of itself - */ - static CTemplateSettings* NewL( CRealFactory* afactory ); - static CTemplateSettings* NewLC( CRealFactory* afactory ); - - /** - * Destructor - */ - virtual ~CTemplateSettings(); - - protected: // Constuctors and destructors - - /** - * Constructor - */ - CTemplateSettings( CRealFactory* afactory ); - - public: // New methods - - /** - * Clones current template settings - * - * @return cloned instance - */ - CTemplateSettings* CloneL(); - - /** - * Sets new active template, leaves on error - * - * @param aUid Uid of the new active template - */ - void SetActiveTemplateL( TInt aUid ); - - public: // Data - - // Set of templates - RPointerArray iTemplates; - - // Currently active template - TUint iActiveTemplateUid; - - //Pointer to interface factory - CRealFactory* iFactory; - }; - -#endif // CTEMPLATESETTINGS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/ctintcapability.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/ctintcapability.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-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 CTINTCAPABILITY_H -#define CTINTCAPABILITY_H - -#include "cbasecapability.h" - -/** - * - * Capability type for TInt type of settings - * - */ -class CTIntCapability : - public CBaseCapability - { - public: // Constructors and destructors - - /** - * Destructor - */ - virtual ~CTIntCapability(); - - public: // Methods derived from CBaseCapability - - virtual HBufC* ListBoxTextL(); - virtual TBool LaunchPopupListL(); - virtual CBaseCapability* CloneL(); - - public: // Data - - // Minimum and maximum value - TInt iMin; - TInt iMax; - }; - -#endif // CTINTCAPABILITY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/imageprintprivatecrkeys.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/imageprintprivatecrkeys.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2004-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 IMAGEPRINTPRIVATECRKEYS_H -#define IMAGEPRINTPRIVATECRKEYS_H - -// ============================================================================= -// ImagePrint API -// ============================================================================= -const TUid KCRUidImagePrint = { 0x10208A35 }; - -/** - * Default Printer Protocol - */ -const TUint32 KDefaultPrinterProtocol = 0x00000001; - -/** - * Current Printer Protocol - */ -const TUint32 KCurrentPrinterProtocol = 0x00000002; - -/** - * Default Printer ID - */ -const TUint32 KDefaultPrinterID = 0x00000003; - -/** - * Default Printer Name - */ -const TUint32 KDefaultPrinterName = 0x00000004; - -#endif // IMAGEPRINTPRIVATECRKEYS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mbrowserpreviewobserver.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mbrowserpreviewobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-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 MBROWSERPREVIEWOBSERVER_H -#define MBROWSERPREVIEWOBSERVER_H - -#include - -/** - * - * Observer class that will get notification message when the print preview - * is ready - * - */ -class MBrowserPreviewObserver - { - public: - - /** - * Gets called when the print server has finished the generation - * of preview bitmap - * - * @param aHandle Handle to the FBS bitmap - */ - virtual void PreviewBitmapReady( TInt aHandle ) = 0; - - virtual TPoint DefaultThumbnailPosition() = 0; - - virtual TSize ThumbnailSize() = 0; - - virtual TInt CursorStep() = 0; - - virtual TSize BrowserPaneSize() = 0; - - }; - -#endif // MBROWSERPREVIEWOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mdiscovery.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mdiscovery.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2004-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 MDISCOVERY_H -#define MDISCOVERY_H - -#include - -class MDiscoveryObserver; - -/** - * - * Interface to use the device discovery functionality of Image Print Engine - * - */ -class MDiscovery - { - public: // Abstract methods - - /** - * Initializes and starts the device discovery. Engine notifies - * about the found devices through device observer interface. - * Asynchronous service. - * - * @param aNotifier an object that implements the observer IF - * @param aProtocol Which protocol should be used in discovery, - * zero if all of them - */ - virtual void StartDeviceDiscoveryL( - MDiscoveryObserver* aNotifier, TUint aProtocol ) = 0; - - /** - * Returns supported protocols - * - * @return supported protocols - */ - virtual TUint SupportedProtocols() = 0; - - /** - * Cancels the device discovery process. The discovery is cancelled - * and the observer receives error code KErrCancel. - * Asynchronous service. - */ - virtual void CancelDeviceDiscoveryL() = 0; - - /** - * Chooses the printer based on its UID and locks it for the - * application. - * Synchronous service. - * - * @param aPrinterUid Uid of the chosen printer - * @return Boolean value. If ETrue, the search will continue (user - * has selected 'Wireless Printers' or such) - */ - virtual TInt ChoosePrinterL( TInt aPrinterUid ) = 0; - - /** - * PictBridge USB mode checker - * @return TInt value more than 0, if PictBridge USB mode is on; - * 0 if off; negative value if error. - */ - virtual TInt IsPictBridgeMode() = 0; - - /** - * Removes the current discover observer. - * Used for special cases where the observer object - * is destroyed while still being the current observer. - */ - virtual void RemoveDiscoveryObserver() = 0; - }; - -#endif // MDISCOVERY_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mdiscoveryobserver.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mdiscoveryobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2004-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 MDISCOVERYOBSERVER_H -#define MDISCOVERYOBSERVER_H - -#include -#include - -/** - * - * Interface used to notify UI about the found devices and error - * - */ -class MDiscoveryObserver - { - public: // Enumerations - - enum TPrinterType - { - EBPP, - EMMC, - EUSB, - EOPP, - EWLAN, - ENOPRINTER - }; - - public: // Abstract methods - - /** - * Notification of new print device - * - * @param aText Textual description of the new print device. - * Ownership is not transferred - * @param aUid Uid that is associated with the print device - * @param aCached Is the printer cached or not? - * @param aType Type of the printer - * @param aVendor Printer vendor - */ - virtual void NotifyNewPrintDeviceL( HBufC* aText, TInt aUid, - TBool aCached, TPrinterType aType, - TUint aVendor ) = 0; - - /** - * Notification of error / cancellation of the sequence. - * Device discovery process is cancelled - * - * @param aErrCode Error code - */ - virtual void DiscoveryError( TInt aErrCode ) = 0; - - /** - * Notifies completion of the device discovery. - */ - virtual void DeviceDiscoveryCompleted() = 0; - - /** - * Removes cached printer as it is not found - * - * @param aUid Uid that is associated with the print device - */ - virtual void RemoveCachedPrinterL( TInt aUid ) = 0; - }; - -#endif // MDISCOVERYOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/midleprinteventobserver.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/midleprinteventobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2004-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 MIDLEPRINTEVENTOBSERVER_H -#define MIDLEPRINTEVENTOBSERVER_H - -#include -#include - -enum TImgPrintUSBState - { - EUSBUndefined = 0, - EUSBConnected, - ENOUSBEvent - }; - -// CLASS DEFINITION -/** - * - * Interface to notify UI about idle state events - * - */ -class MIdlePrintEventObserver - { - public: // Abstract methods - - /** - * Called when usb printer is disconnected - */ - virtual void UsbPrinterDisconnected() = 0; - - /** - * Called when usb printer is connected - */ - virtual void UsbPrinterConnected() = 0; - - /** - * Notifies about USB state changes. Method is also used for other events - * @param aState information about usb state - */ - virtual void UsbStateChanged( TImgPrintUSBState aState, TInt aError ) = 0; - - virtual void ReadyToContinue() = 0; - - /** - * Notifies that there's happened an asynchronous leave in server process, - * which in practice means that any ongoing printing should be cancelled - * - * @param aError leave code - */ - virtual void AsynchronousServerLeave( TInt aError ) = 0; - }; - -#endif // MIDLEPRINTEVENTOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/midleprinteventregisterif.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/midleprinteventregisterif.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2004-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 MIDLEPRINTEVENTREGISTERIF_H -#define MIDLEPRINTEVENTREGISTERIF_H - -#include - -class MIdlePrintEventObserver; - -/** - * - * Interface to use the idle print event functionality of Image Print Engine - * - */ -class MIdlePrintEventRegisterIF - { - public: // Abstract methods - - - /** - * Registers class to IdlePrintEventObserver. After registration - * the class receives idle events - * - * @param aIdleObserver class that wants to register - * - */ - virtual void RegisterObserver( MIdlePrintEventObserver* aIdleObserver ) = 0; - - /** - * Unregisters class from IdlePrintEventObserver. After unregistration - * the class stops receiving idle events. Class is also deleted from observer - * array. - * - * @param aIdleObserver class that wants to unregister - * - */ - virtual void UnRegisterObserver( MIdlePrintEventObserver* aIdleObserver ) = 0; - }; - -#endif // MIDLEPRINTEVENTREGISTERIF_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprinteventregisterif.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprinteventregisterif.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTEVENTREGISTERIF_H -#define MPRINTEVENTREGISTERIF_H - -#include - -class MIdlePrintEventObserver; -class MPrintJobStatus; - -/** - * - * Interface to use the print event functionality of Image Print Engine - * - */ -class MPrintEventRegisterIF - { - public: // Abstract methods - - - /** - * Registers class to PrintEventObserver. After registration - * the class receives events - * - * @param aObserver class that wants to register - * - */ - virtual void RegisterObserver( MPrintJobStatus* aObserver ) = 0; - - /** - * Unregisters class from PrintEventObserver. After unregistration - * the class stops receiving events. Class is also deleted from observer - * array. - * - * @param aIdleObserver class that wants to unregister - * - */ - virtual void UnRegisterObserver( MPrintJobStatus* aObserver ) = 0; - }; - -#endif // MPRINTEVENTREGISTERIF_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjob.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjob.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTJOB_H -#define MPRINTJOB_H - -#include -#include - -class MPrintJobObserver; - -/** - * - * Interface to manage the printing - * - */ -class MPrintJob - { - public: // Abstract methods - - /** - * Starts printing images with selected settings, template and printer. - * If this method does not leave, the printing has started. Further messages - * about printing progress are passed through MPrintJobObserver - * Asynchronous - * - * @param aObserver Pointer to the observer class that handles the - */ - virtual void PrintL( MPrintJobObserver* aObserver ) = 0; - - /** - * Cancels the active print job. The cancellation is finished, when - * MPrintJobObserver receives error event with error code KErrCancel - * Asynchronous - */ - virtual void CancelL() = 0; - - /** - * Get all the images from current print job. - * - * @param aImages An array, in which the printed images are added. - */ - virtual void GetPrintJobL( RPointerArray& aImages ) = 0; - - }; - -#endif // MPRINTJOB_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjobobserver.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjobobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTJOBOBSERVER_H -#define MPRINTJOBOBSERVER_H - -#include - -/** - * - * Interface used to notify UI about the print progress - * - */ -class MPrintJobObserver - { - public: // Abstract methods - - /** - * Notificiation of the printed page - * - * @param aPercentageComplete The percentage completed - */ - virtual void PrintProgress( TUint aPercentageComplete ) = 0; - - /** - * Printing finished - */ - virtual void JobFinished() = 0; - - /** - * Error during printing - the current job is cancelled - * - * @param aErrorCode The error code - * @param aErrorStringCode The more detailed error string - */ - virtual void JobError( TInt aErrorCode, TInt aErrorStringCode ) = 0; - - /** - * Minor error during printing, print process is NOT cancelled - * - * @param aErrorCode The error code - * @param aErrorStringCode The more detailed error string - */ - virtual void JobStatusEvent( TInt aErrorCode, TInt aErrorStringCode ) = 0; - }; - -#endif // MPRINTJOBOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjobstatus.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprintjobstatus.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTJOBSTATUS_H -#define MPRINTJOBSTATUS_H - -#include - -/** - * - * Internal mixin-class for CPrintEventCatcher to notify the status - * of the print job - * - */ -class MPrintJobStatus - { - public: - - /** - * Used to notify the status of the print job - * - * @param aStatus Possible TInt codes can mean (active, done) - * @param aPercentCompletion 0%-100% of the print job completed - * @param aJobStateCode Enumeration code for the Job State String - */ - virtual void PrintJobProgress( TInt aStatus, TInt aPercentCompletion, - TInt aJobStateCode ) = 0; - - /** - * Used to notify occured error during the job - * - * @param aError The error code - * @param aErrorStringCode More detailed error string - */ - virtual void PrintJobError( TInt aError, TInt aErrorStringCode ) = 0; - - /** - * Printer status is obtained through this interface, usually the - * suspend errors are notified using this method - * - * @param aError The error code - * @param aErrorStringCode Error string code - */ - virtual void PrinterStatus( TInt aError, TInt aErrorStringCode ) = 0; - }; - -#endif // MPRINTJOBSTATUS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprintpreviewobserver.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprintpreviewobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTPREVIEWOBSERVER_H -#define MPRINTPREVIEWOBSERVER_H - -#include - -/** - * - * Observer class that will get notification message when the print preview - * is ready - * - */ -class MPrintPreviewObserver - { - public: - - /** - * Gets called when the print server has finished the generation - * of preview bitmap - * - * @param aHandle Handle to the FBS bitmap - */ - virtual void PreviewBitmapReady( TInt aHandle, - TBool aPaperLandscape ) = 0; - - virtual TSize PaperSizeLandscape() = 0; - - virtual TSize PaperSizePortrait() = 0; - - virtual TPoint PaperPositionLanscape() = 0; - - virtual TPoint PaperPositionPortrait() = 0; - - }; - -#endif // MPRINTPREVIEWOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/mprintsettings.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/mprintsettings.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +0,0 @@ -/* -* Copyright (c) 2004-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 MPRINTSETTINGS_H -#define MPRINTSETTINGS_H - -#include -#include - -class CTemplateSettings; -class CPrintSettings; -class CBaseCapability; - -/** - * - * Interface to use the device discovery functionality of Image Print Engine - * - */ -class MPrintSettings - { - public: // Abstract methods - - /** - * Fetches the available template icons and UIDs associated to - * the selected. Leaves on error. - * Synchonours - * - * @return The current settings, ownership is transferred - */ - virtual CTemplateSettings* TemplateSettingsL() = 0; - - /** - * Sets the active UID. If this succeeds, the preview bitmap - * needs to be updated on UI. Also the amount of pages need - * to be queried again. - * Synchronous - * - * @param aUid Uid of the activated template - */ - virtual void SetActiveTemplateL( TUint aUid ) = 0; - - /** - * Returns the number of pages with the current template/image - * selection. - * Synchronous - * - * @return Number of pages - */ - virtual TUint NumOfPagesL() = 0; - - /** - * Returns the number of copies value - * Synchronous - * - * @return Number of Copies - */ - virtual TInt NumberOfCopies( RArray& aArray ) = 0; - - /** - * Returns the number of copies value - * Synchronous - * - * @return Number of Copies - */ - virtual TInt NumberOfCopies( TInt& aNumberOfCopies, TInt aIndex ) = 0; - - /** - * Sets the number of copies value for each image - * Synchronous - */ - virtual TInt SetNumberOfCopiesL( const RArray& aArray ) = 0; - - virtual TInt UpdateNumberOfCopiesToServer() = 0; - - /** - * Checks if the user has selected MMC printing - * Synchronous - * - * @return Boolean value to match - */ - virtual TBool IsMMC() = 0; - - /** - * Sets the active preview page on display. If this succeeds, the - * preview bitmap needs to be updated on UI, - * Synchronous - * - * @param aActivePage New active page - */ - virtual void SetActivePageL( TUint aActivePage ) = 0; - - /** - * Returns current active page - * Synchronous - * - * @return Current active page - */ - virtual TUint CurActivePageL() = 0; - - /** - * Fetch printer capabilities and current settings - * Synchronous - * - * @return Printer's capabilities, ownership changes - */ - virtual CPrintSettings* PrinterSettingsL() = 0; - - /** - * Sets new settings for the print job - * Synchronous - * - * @param aSettings New set of settings - */ - virtual void SetPrinterSettingsL( CPrintSettings& aSettings ) = 0; - - /** - * Sets a single setting for the print job - * Synchronous - * - * @param aCapab Capability to be changed - * @return If return value == 0 then new settings should be - * fetched using PrinterSettingsL() and the UI must - * be updated - */ - virtual TInt SetPrinterSettingL( CBaseCapability& aCapab ) = 0; - - /** - * Returns the UID of the currently selected template - * - * @return Tint UID - */ - virtual TInt TemplateUid() = 0; - - // Called when template OR current image is changed - virtual TBool UpdatePageNumberL( TInt aCurrentImage ) = 0; - virtual TInt PrinterUid() = 0; - - /** - * Sets the current usb connection state - * - * @param aConnected Connection state - */ - virtual void SetUsbState( TBool aConnected ) = 0; - - /** - * Gets the current usb connection state - * - * @return Connection state - */ - virtual TBool GetUsbState() = 0; - - /** - * Default printer protocol getter - * @return protocol number or KErrNotFound - */ - virtual TInt GetDefaultPrinterProtocol() = 0; - - /** - * Default printer protocol setter - * @param aProtocol protocol number - * @return error code, KErrNone if OK - */ - virtual TInt SetDefaultPrinterProtocol( TInt aProtocol ) = 0; - - /** - * Current printer protocol getter - * @return protocol number or KErrNotFound - */ - virtual TInt GetCurrentPrinterProtocol() = 0; - - /** - * Current printer protocol setter - * @param aProtocol protocol number - * @return error code, KErrNone if OK - */ - virtual void SetCurrentPrinterProtocol( TInt aProtocol ) = 0; - - /** - * Current printer brand getter - * @return current printer brand id - */ - virtual TUint GetCurrentPrinterVendor() = 0; - - /** - * Current printer brand setter - * @param aVendor printer brand - */ - virtual void SetCurrentPrinterVendor( TUint aVendor ) = 0; - - /** - * Default printer id getter - * @return printer id or KErrNotFound - */ - virtual TInt GetDefaultPrintID() = 0; - - /** - * Default printer protocol setter - * @param aId printer id - * @return error code, KErrNone if OK - */ - virtual TInt SetDefaultPrinterID( TInt aId ) = 0; - - /** - * Default printer name getter - * @return printer name - */ - virtual HBufC* GetDefaultPrinterNameLC() = 0; - - /** - * Default printer name setter - * @param aPrinterName printer name - * @return error code, KErrNone if OK - */ - virtual TInt SetDefaultPrinterNameL( const TDesC& aPrinterName ) = 0; - - /** - * Current printer name getter - * @return printer name - */ - virtual HBufC* GetCurrentPrinterName() = 0; - - /** - * Current printer name setter - * @param aPrinterName printer name - * @return error code, KErrNone if OK - */ - virtual TInt SetCurrentPrinterName( const TDesC& aPrinterName ) = 0; - - /** - * Current paper size text getter - * @Return paper size text - */ - virtual HBufC* GetCurrentPaperSizeTextL() = 0; - - }; - -#endif // MPRINTSETTINGS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/settingsconverter.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/settingsconverter.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2004-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 SETTINGSCONVERTER_H -#define SETTINGSCONVERTER_H - -#include - -class CTIntCapability; -class CListCapability; -class CFloatCapability; -class TPrintCapability; -class CRealFactory; - -/** - * - * Utility class for converting capabilities to correct format - * - */ -class SettingsConverter - { - public: - - /** - * Converts TCapability to CTIntCapability - * - * @param aCapability Capability coming from the engine - * @param aIndexOnList Capability's index on the list box - * @param aCapabUid Capability's UID - * @return Initialized CTIntCapability instance - */ - static CTIntCapability* AddTIntCapabilityLC( - TPrintCapability& aCapability, TInt aIndexOnList, TInt aCapabUid ); - - /** - * Converts TCapability to CListCapability - * - * @param aCapability Capability coming from the engine - * @param aIndexOnList Capability's index on the list box - * @param aCapabUid Capability's UID - * @return Initialized CListCapability instance - */ - static CListCapability* AddListCapabilityLC( - TPrintCapability& aCapability, TInt aIndexOnList, TInt aCapabUid, - CRealFactory* aFactory ); - - /** - * Converts TCapability to CFloatCapability - * - * @param aCapability Capability coming from the engine - * @param aIndexOnList Capability's index on the list box - * @param aCapabUid Capability's UID - * @return Initialized CFloatCapability instance - */ - static CFloatCapability* AddFloatCapabilityLC( - TPrintCapability& aCapability, TInt aIndexOnList, TInt aCapabUid ); - - private: - - /** - * Creates text string from the enumeration ID - * - * @param aId Enumeration Id - * @return buffer containing the string - */ - static HBufC* TextStringLC( TInt aId ); - }; - -#endif // SETTINGSCONVERTER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/stringids.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/stringids.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2004-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 STRINGIDS_H -#define STRINGIDS_H - -#include - -#include "printcapabilitycodes.h" -#include "printmessagecodes.h" -#include "imageprintvariant.h" - -const TInt KEmptyString( 0 ); - -// This table combines the capability IDs with strings so that they -// can be fetched from the resources - -#ifdef IMG_PRINT_DYNAMIC_PRINT_SETTINGS -const TInt KConverterTableCount( 28 ); -const TInt KConverterTableIndexCount( 2 ); -const TInt KIDConverterTable[KConverterTableCount][KConverterTableIndexCount] = - { - { EPrintCapabLayout, R_QTN_STR_TEMPLATE } , - { EPrintCapabPaperSize, R_QTN_STR_PAPER_SIZE }, - { EPrintCapabPaperSizeAuto, R_QTN_STR_SIZE_AUTO }, - { EPrintCapabPaperSizeLetter, R_QTN_STR_SIZE_LETTER }, - { EPrintCapabPaperSizeA4, R_QTN_STR_SIZE_A4 }, - { EPrintCapabPaperSizeA6, R_QTN_STR_SIZE_A6 }, - { EPrintCapabPaperSize4x6, R_QTN_STR_SIZE_4X6 }, - { EPrintCapabPaperSize5x7, R_QTN_STR_SIZE_5X7 }, - { EPrintCapabPaperSizeSticker, R_QTN_STR_SIZE_STICKER }, - { EPrintCapabQuality, R_QTN_STR_QUALITY }, - { EPrintCapabQualityDefault, R_QTN_STR_QUAL_AUTO }, - { EPrintCapabQualityNormal, R_QTN_STR_QUAL_NORMAL }, - { EPrintCapabQualityDraft, R_QTN_STR_QUAL_DRAFT }, - { EPrintCapabQualityFine, R_QTN_STR_QUAL_FINE }, - { EPrintCapabLayout1UpBorderless, R_QTN_STR_TEMPLATE_BLESS }, - { EPrintCapabLayout1UpMedium, R_QTN_STR_TEMPLATE_BLESS }, - { EPrintCapabLayout1UpBorder, R_QTN_STR_TEMPLATE_ONE }, - { EPrintCapabLayout1Up, R_QTN_STR_TEMPLATE_ONE }, - { EPrintCapabLayout1UpStick, R_QTN_STR_TEMPLATE_ONE }, - { EPrintCapabLayout2Up, R_QTN_STR_TEMPLATE_TWO }, - { EPrintCapabLayout4Up, R_QTN_STR_TEMPLATE_FOUR }, - { EPrintCapabLayout4UpStick, R_QTN_STR_TEMPLATE_FOUR }, - { EPrintCapabLayout6Up, R_QTN_STR_TEMPLATE_SIX }, - { EPrintCapabLayout9Up, R_QTN_STR_TEMPLATE_NINE }, - { EPrintCapabLayout12Up, R_QTN_STR_TEMPLATE_TWELVE }, - { EPrintCapabLayout16UpStick, R_QTN_STR_TEMPLATE_SIXTEEN }, - { EPrintCapabLayout16Up, R_QTN_STR_TEMPLATE_SIXTEEN }, - { KEmptyString, R_EMPTY } - }; -#else -const TInt KConverterTableCount( 15 ); -const TInt KConverterTableIndexCount( 2 ); -const TInt KIDConverterTable[KConverterTableCount][KConverterTableIndexCount] = - { - { EPrintCapabLayout, R_EMPTY } , - { EPrintCapabPaperSize, R_QTN_STR_PAPER_SIZE }, - { EPrintCapabPaperSizeAuto, R_QTN_STR_SIZE_AUTO }, - { EPrintCapabPaperSizeLetter, R_QTN_STR_SIZE_LETTER }, - { EPrintCapabPaperSizeA4, R_QTN_STR_SIZE_A4 }, - { EPrintCapabPaperSizeA6, R_QTN_STR_SIZE_A6 }, - { EPrintCapabPaperSize4x6, R_QTN_STR_SIZE_4X6 }, - { EPrintCapabPaperSize5x7, R_QTN_STR_SIZE_5X7 }, - { EPrintCapabPaperSizeSticker, R_QTN_STR_SIZE_STICKER }, - { EPrintCapabQuality, R_QTN_STR_QUALITY }, - { EPrintCapabQualityDefault, R_QTN_STR_QUAL_AUTO }, - { EPrintCapabQualityNormal, R_QTN_STR_QUAL_NORMAL }, - { EPrintCapabQualityDraft, R_QTN_STR_QUAL_DRAFT }, - { EPrintCapabQualityFine, R_QTN_STR_QUAL_FINE }, - { KEmptyString, R_EMPTY } - }; -#endif -#endif // STRINGIDS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/inc/tpreviewimageinfo.h --- a/ImagePrint/ImagePrintUI/imageprinteng/inc/tpreviewimageinfo.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2004-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 TPREVIEWIMAGEINFO_H -#define TPREVIEWIMAGEINFO_H - -#include -#include -#include - -/** - * - * Data structure that presents a single image on the preview bitmap - * - */ -class TPreviewImageInfo - { - public: // Constructors and destructors - - /** - * Constructor - */ - TPreviewImageInfo(); - - public: // data - - // Position of the image on preview bitmap - TPoint iPos; - - // Size of the image on previwe bitmap - TSize iSize; - - // Rotation status & orientation of the image - TBool iRotated; - - // Orientation of the image - CBitmapRotator::TRotationAngle iOrientation; - }; - -#endif // TPREVIEWIMAGEINFO_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cdiscoverymanager.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cdiscoverymanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "tprinter.h" -#include "cdiscoverymanager.h" -#include "ciffactory.h" -#include "cprintjobmanager.h" -#include "csettingsmanager.h" -#include "imageprint.h" -#include "cimageprint.h" -#include "clog.h" - -const TInt KMMCID( 1 ); - -// CONSTRUCTION -CDiscoveryManager* CDiscoveryManager::NewL( - CIFFactory* aFactory ) - { - CDiscoveryManager* self = CDiscoveryManager::NewLC( aFactory ); - CleanupStack::Pop(); // self - - return self; - } - -CDiscoveryManager* CDiscoveryManager::NewLC( - CIFFactory* aFactory ) - { - CDiscoveryManager* self = - new ( ELeave ) CDiscoveryManager( aFactory ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// Constructor -CDiscoveryManager::CDiscoveryManager( - CIFFactory* aFactory ) : - iFactory( aFactory ) - { - } - -// Destruction -CDiscoveryManager::~CDiscoveryManager() - { - } - -// 2nd phase constructor -void CDiscoveryManager::ConstructL() - { - } - -// Returns supported protocols -TUint CDiscoveryManager::SupportedProtocols() - { - return iFactory->Engine()->SupportedProtocols(); - } - -// Initiates device discovery -void CDiscoveryManager::StartDeviceDiscoveryL( - MDiscoveryObserver* aNotifier, - TUint aProtocol ) - { - TInt discoveryError( KErrNone ); - LOG("CDiscoveryManager::StartDeviceDiscoveryL BEGIN"); - iMMCUid = -1; - iCancelling = EFalse; - iOnGoingDiscovery = ETrue; - iDiscoveryObserver = aNotifier; - TRAP_IGNORE( discoveryError = iFactory->Engine()->StartDiscoveryL( *this, aProtocol ) ); - LOG1("CDiscoveryManager::StartDeviceDiscoveryL END, error = %d", discoveryError); - User::LeaveIfError( discoveryError ); - } - -// Cancels the discovery notification -void CDiscoveryManager::CancelDeviceDiscoveryL() - { - if ( iOnGoingDiscovery ) - { - User::LeaveIfError( iFactory->Engine()->CancelDiscovery() ); - iCancelling = ETrue; - iOnGoingDiscovery = EFalse; - } - } - -// Chooses the printer -TInt CDiscoveryManager::ChoosePrinterL( - TInt aPrinterUid ) - { - LOG("CDiscoveryManager::ChoosePrinterL BEGIN"); - TInt err = 0; - - // Create print job - CPrintJobManager* printJobManager = - static_cast( iFactory->PrintJobIF() ); - iOnGoingDiscovery = EFalse; - - err = printJobManager->CreatePrintJobL( aPrinterUid ); - LOG2("CDiscoveryManager::ChoosePrinterL printjob ret: %d with printer uid: %d", err, aPrinterUid ); - if ( err == KErrNone ) - { - if( aPrinterUid == KMMCID ) - { - iMMCUid = KMMCID; - } - - // Do initialization of the settings manager once print job is - // created and the settings can be fetched - CSettingsManager* settings = - static_cast( iFactory->SettingsIF() ); - settings->InitSettingsL( aPrinterUid, iMMCUid ); - - iPrinterUid = aPrinterUid; - } - - LOG("CDiscoveryManager::ChoosePrinterL END"); - return err; - } - -// Called when the server finds the printer -void CDiscoveryManager::FoundPrinterL( - const TPrinter& aPrinterInfo ) - { - HBufC* name = HBufC::NewLC( aPrinterInfo.iDisplayName.Length() ); - name->Des().Copy( aPrinterInfo.iDisplayName ); - - MDiscoveryObserver::TPrinterType type; - switch ( aPrinterInfo.iProtocol ) - { - case KImagePrint_PrinterProtocol_BPP: - type = MDiscoveryObserver::EBPP; - break; - case KImagePrint_PrinterProtocol_DPOF: - type = MDiscoveryObserver::EMMC; - iMMCUid = aPrinterInfo.iPrinterID; - break; - case KImagePrint_PrinterProtocol_PictBridge: - type = MDiscoveryObserver::EUSB; - break; - - case KImagePrint_PrinterProtocol_OPP_Printer: //fallthrough - case KImagePrint_PrinterProtocol_OPP_PC: - type = MDiscoveryObserver::EOPP; - break; - case KImagePrint_PrinterProtocol_UPnP: - type = MDiscoveryObserver::EWLAN; - break; - default: - type = MDiscoveryObserver::EBPP; - break; - } - - if( iOnGoingDiscovery != EFalse ) - { - iDiscoveryObserver->NotifyNewPrintDeviceL( - name, aPrinterInfo.iPrinterID, - aPrinterInfo.iProperties & TPrinter::Cached, - type, aPrinterInfo.iVendor ); - } - CleanupStack::PopAndDestroy(); // name - } - -// Called to inform the status -void CDiscoveryManager::DiscoveryStatusL( - TInt aStatus, - TInt aErrorCode, - TInt /*aErrorStringCode*/ ) - { - // When Bluetooth discovery is finished, but Bluetooth is not enabled pass error code to UI. - if ( aErrorCode == ENoConnection ) - { - if (iDiscoveryObserver) - { - iDiscoveryObserver->DiscoveryError( aErrorCode ); - } - } - if ( iCancelling ) - { - // Exection continues in CancelDiscoveryL() - if ( iDiscoveryObserver ) - { - iDiscoveryObserver->DeviceDiscoveryCompleted(); - } - } - else - { - if ( iOnGoingDiscovery ) - { - if ( aStatus == EDiscovering ) - { - iOnGoingDiscovery = EFalse; - if ( iDiscoveryObserver ) - { - iDiscoveryObserver->DeviceDiscoveryCompleted(); - } - } - else if ( aStatus == EDoneDiscovery ) - { - iOnGoingDiscovery = EFalse; - if ( iDiscoveryObserver ) - { - iDiscoveryObserver->DeviceDiscoveryCompleted(); - } - } - else if ( aStatus == ECancellingDiscovery ) - { - if ( iDiscoveryObserver ) - { - iDiscoveryObserver->DiscoveryError( aErrorCode ); - } - } - else - { - User::Leave( KErrUnknown ); - } - } - } - } - -// Removes cached printer from the list -void CDiscoveryManager::RemovePrinterL( const TPrinter& aPrinterInfo ) - { - if( iOnGoingDiscovery != EFalse ) - { - iDiscoveryObserver->RemoveCachedPrinterL( aPrinterInfo.iPrinterID ); - } - } - -TInt CDiscoveryManager::IsPictBridgeMode() - { - LOG("CDiscoveryManager::IsPictBridgeMode() START"); - TInt retValue = -999; - retValue = iFactory->ImagePrintClient().IsPictBridgeMode(); - LOG1("IsPictBridgeMode() returned: %d", retValue); - LOG("CDiscoveryManager::IsPictBridgeMode() END"); - return retValue; - } - -void CDiscoveryManager::RemoveDiscoveryObserver() - { - iOnGoingDiscovery = EFalse; - iDiscoveryObserver = 0; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cfloatcapability.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cfloatcapability.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "cfloatcapability.h" - -const TInt KMaxTRealCharNum( 30 ); -const TInt KDecimals( 2 ); - -// Destructor -CFloatCapability::~CFloatCapability() - { - } - -// Creates text string for the settings list box -HBufC* CFloatCapability::ListBoxTextL() - { - const TInt KGranularity( 4 ); - TRealFormat format( KMaxTRealCharNum, KDecimals ); - TBuf numStr; - - numStr.Zero(); - numStr.AppendNum( iRealValue, format ); - - CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KGranularity ); - CleanupStack::PushL( strings ); - strings->AppendL( iTitle ); - strings->AppendL( numStr ); - - HBufC* buf = StringLoader::LoadL( R_QTN_LBOX_FORMAT, *strings ); - CleanupStack::PopAndDestroy(); // strings - - return buf; - } - -// Displays pop-up list for changing the active TInt value -TBool CFloatCapability::LaunchPopupListL() - { - TReal aMin = 0; - TReal aMax = TReal( iMaxNumerator )/TReal( iDenominator ); - - CAknFloatingPointQueryDialog* dlg = - CAknFloatingPointQueryDialog::NewL( iRealValue ); - CleanupStack::PushL( dlg ); - dlg->SetPromptL( iTitle ); - dlg->PrepareLC( R_GENERIC_FLOAT_QUERY_DLG ); - CleanupStack::Pop( dlg ); - dlg->SetMinimumAndMaximum( aMin, aMax ); - TBool valueChanged = dlg->RunLD(); - - if ( valueChanged ) - { - iValue = TInt( TReal ( iRealValue / TReal ( iDenominator ) ) ); - } - - return valueChanged; - } - -// Clones itself -CBaseCapability* CFloatCapability::CloneL() - { - CFloatCapability* clone = new ( ELeave ) CFloatCapability; - - clone->iDenominator = iDenominator; - clone->iIndexOnList = iIndexOnList; - clone->iMaxNumerator = iMaxNumerator; - clone->iValue = iValue; - clone->iTitle = iTitle; - clone->iUid = iUid; - clone->iRealValue = iRealValue; - - return clone; - } - -// Sets the new values and checks the boundaries -TInt CFloatCapability::SetValues( - TInt aDenom, - TInt aNumerator, - TInt aMaxNumerator ) - { - TInt err( KErrNone ); - - if ( aNumerator > aMaxNumerator ) - { - err = KErrArgument; - } - else - { - iDenominator = aDenom; - iValue = aNumerator; - iMaxNumerator = aMaxNumerator; - if( iDenominator != 0 ) - { - iRealValue = TReal( iValue )/TReal( iDenominator ); - } - } - - return err; - } - -// Numerator -TInt CFloatCapability::Numerator() const - { - return iValue; - } - -// Denominator -TInt CFloatCapability::Denominator() const - { - return iDenominator; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cidleprinteventcatcher.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cidleprinteventcatcher.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "tidleevent.h" -#include "cidleprinteventcatcher.h" -#include "crealfactory.h" -#include "midleprinteventobserver.h" -#include "cprinteventcatcher.h" -#include "mprintsettings.h" -#include "clog.h" -#include "mdiscoveryobserver.h" -#include "midleprinteventregisterif.h" -#include "mdiscoveryobserver.h" - -CIdlePrintEventCatcher* CIdlePrintEventCatcher::NewL( - CRealFactory* aFactory /*, - MIdlePrintEventObserver* aIdleUIObserver*/ ) - { - CIdlePrintEventCatcher* self = CIdlePrintEventCatcher::NewLC( aFactory/*, aIdleUIObserver*/ ); - CleanupStack::Pop(); // self - return self; - } - -CIdlePrintEventCatcher* CIdlePrintEventCatcher::NewLC( - CRealFactory* aFactory/*, - MIdlePrintEventObserver* aIdleUIObserver*/ ) - { - CIdlePrintEventCatcher* self = - new ( ELeave ) CIdlePrintEventCatcher( aFactory/*, aIdleUIObserver*/ ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// Constructor -CIdlePrintEventCatcher::CIdlePrintEventCatcher( - CRealFactory* aFactory/*, - MIdlePrintEventObserver* aIdleUIObserver*/ ) : - iFactory( aFactory )/*, - iIdleUIObserver( aIdleUIObserver )*/ - { - } - -// Destructor -CIdlePrintEventCatcher::~CIdlePrintEventCatcher() - { - iObservers.Reset();//)AndDestroy(); - } - -// 2nd phase constructor -void CIdlePrintEventCatcher::ConstructL() - { - } - -void CIdlePrintEventCatcher::StatusEvent( const TEvent &aEvent, - TInt aError, - TInt aMsgCode ) - { - LOG1("CIdlePrintEventCatcher::StatusEvent, aEventType: %d", aEvent.iEventType); - LOG2("CIdlePrintEventCatcher::StatusEvent, aError: %d, aMsgCode: %d", aError, aMsgCode ); - TInt obsCount = iObservers.Count(); - switch ( aEvent.iEventType ) - { - ///The protocol has made a connection to the printer, device or transport - case EConnect: - { - LOG( "CIdlePrintEventCatcher::StatusEvent CONNECT " ); - if ( (TUint)aEvent.iProtocol == KImagePrint_PrinterProtocol_PictBridge ) - { - for( TInt i=0; iUsbPrinterConnected(); - } - iFactory->SettingsIF()->SetUsbState( ETrue ); - } - break; - } - ///The protocol has been disconnected from the printer, device or transport - case EDisconnect: - { - if ( (TUint)aEvent.iProtocol == KImagePrint_PrinterProtocol_PictBridge ) - { - // If idle print event is called while usb printing is still ongoing, - // printing is cancelled. - if ( iFactory->IsPrinting() && - ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == - MDiscoveryObserver::EUSB ) && aError != KErrDisconnected) - { - LOG2("printing pictbridge, aError = %d, aMsgCode = %d", aError, aMsgCode ); - iFactory->PrintEventObserverIF()->PrintJobErrorEvent( KErrDisconnected, KErrNone ); - iFactory->SettingsIF()->SetUsbState( EFalse ); - } - else - { - LOG2("not printing or not pictbridge, aError = %d, aMsgCode = %d", aError, aMsgCode ); - if ( ( aError == KErrDisconnected) && - ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == - MDiscoveryObserver::EUSB ) ) - { - LOG( "CIdlePrintEventCatcher::StatusEvent 'Connection to printer lost' " ); - - TInt error ( KErrNone ); - TRAP( error, iBuf = StringLoader::LoadL( R_NOTE_DISCONNECT_PRINT_ERROR )); - CAknErrorNote* errornote = new CAknErrorNote( ETrue ); - TInt err ( KErrNone ); - TRAP( err, errornote->ExecuteLD( *iBuf )); - - } - for( TInt i=0; iUsbPrinterDisconnected(); - } - if ( iBuf ) - { - delete iBuf; - iBuf = NULL; - } - - } - } - break; - } - - ///The event is notifying a change in the device status, - ///or is reporting an error sent from the device - case EPrinterStatus: - { - if ( EWarning==aEvent.iSeverity || EFatal==aEvent.iSeverity ) - { - for( TInt i=0; iUsbStateChanged( ENOUSBEvent, aMsgCode ); - } - } - break; - } - - ///The event is notifying that an asynchronous leave has occurred - ///in server and user should be notified in some way - case EAsynchronousLeave: - { - LOG( "CIdlePrintEventCatcher::StatusEvent EAsynchronousLeave!"); - LOG2( "CIdlePrintEventCatcher::StatusEvent protocol: %d, error: %d", - aEvent.iProtocol, aError ); - for( TInt i=0; iAsynchronousServerLeave( aError ); - } - CCoeEnv::Static()->HandleError( aError ); - break; - } - default: - { - // Should not be never called - break; - } - } - LOG("CIdlePrintEventCatcher::StatusEvent END"); - } - -void CIdlePrintEventCatcher::RegisterObserver( MIdlePrintEventObserver* aIdleObserver ) - { - iObservers.Append( aIdleObserver ); - } - -void CIdlePrintEventCatcher::UnRegisterObserver( MIdlePrintEventObserver* aIdleObserver ) - { - TInt observerPosition = iObservers.Find( aIdleObserver ); - if( observerPosition != KErrNotFound ) - { - iObservers.Remove( observerPosition ); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/ciffactory.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/ciffactory.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2004-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 "ciffactory.h" -#include "cimageprintengine.h" -#include "mdiscovery.h" -#include "mprintjob.h" -#include "mprintsettings.h" - -// Default constructor -CIFFactory::CIFFactory( - CImagePrintEngine* aEngine ) - : iPrintEngine ( aEngine ) - { - } - -// Destructor -CIFFactory::~CIFFactory() - { - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cimageprint.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cimageprint.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -/* -* Copyright (c) 2004-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 "cimageprint.h" -#include "cidleguard.h" -#include "cdiscoveryguard.h" -#include "cjobguard.h" -#include "clog.h" - -const static TInt KImagePrintVersionMajor = 0; -const static TInt KImagePrintVersionMinor = 0; -const static TInt KImagePrintVersionBuild = 231; - -/********************** -Public member functions -**********************/ - -CImagePrint::CImagePrint () - { - } - -/// Destructor. -CImagePrint::~CImagePrint () - { - LOG("CImagePrint::~CImagePrint BEGIN"); - delete iDiscoveryGuard; - delete iIdleGuard; - delete iJobGuard; - CCoeEnv::Static()->RemoveForegroundObserver( *this ); - iClient.Close(); - LOG("CImagePrint::~CImagePrint END"); - } - -/** - * @brief Initialize the server. - */ -void CImagePrint::ConnectL() - { - if( iClient.Handle() == KNullHandle ) - { - User::LeaveIfError( iClient.ConnectL() ); - iIdleGuard = CIdleGuard::NewL( iClient ); - iDiscoveryGuard = CDiscoveryGuard::NewL( iClient ); - iJobGuard = CJobGuard::NewL( iClient ); - User::LeaveIfError( iClient.ReserveEngine() ); - iClient.SetForeground( ETrue ); //For aiw cases - CCoeEnv::Static()->AddForegroundObserverL( *this ); - } - } - -/** - * @brief Shutdown the server. - */ -void CImagePrint::Close() - { - iClient.ReleaseEngine(); - } - -/** - * @brief Returns the current version of the Image Print Server - * @return The current version of the Image Print Server - */ -TVersion CImagePrint::Version() - { - return TVersion(KImagePrintVersionMajor, KImagePrintVersionMinor, KImagePrintVersionBuild); // Julian Day, August 18. - } - -/** - * @brief Starts the discovery process. - * - * Starts printer discovery on specified printer plug-ins. This is an asynchronous call that will use the - * supplied MPrinterDiscoveryObserver to signal the client when Printers are found and upon error or successful completion. - * - * @param aObserver The discovery observer. - * @param aProtocols Used to indicate what protocols to search for. 0 = all, 1 = BPP, 2 = BIP, 4 = OPP_Printer, 8 = DPOF, 16 = PB, 32 = OPP_PC - * @return Any standard Symbian error code. - * @sa KImagePrint_PrinterProtocol_BPP @sa KImagePrint_PrinterProtocol_BIP @sa KImagePrint_PrinterProtocol_OPP_Printer - * @sa KImagePrint_PrinterProtocol_DPOF @sa KImagePrint_PrinterProtocol_PictBridge @sa KImagePrint_PrinterProtocol_OPP_PC - */ -TInt CImagePrint::StartDiscoveryL(MPrinterDiscoveryObserver& aObserver, TUint aProtocols) - { - return iDiscoveryGuard->Guard( aObserver, aProtocols ); - } - -/** - * Cancels printer discovery on all printer plug-ins. This is an asynchronous call - * that will use the MPrinterDiscoveryObserver previously supplied by - * CImagePrint::StartDiscoveryL to signal the client upon error or successful completion. - * @brief Cancels the discovery process. - * @return \c KErrNone if cancel was successfully submitted, otherwise another of the system-wide error codes. - */ -TInt CImagePrint::CancelDiscovery() - { - return iClient.CancelDiscovery(); - } - -/** - * Creates a print job using the default settings and template. All job information beyond the images and Printer are set to the defaults of the printer. - * If the Printer Discovery process is ongoing when \c CreatePrintJobL is received, Printer Discovery is terminated, without sending a notification event to the Client. - * @brief Creates a print job in the specified printer. - * @param[in] aPrinterID The exposed ID of the printer where the client wishes to create the print job. - * @param aImages Array containing the full names of the files to print. - * @param aObserver The print event observer. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - * @note Only one print job can be active at a time. The Print Job must be created before any - * print job related functions are called. These functions include changing settings, preview, job submission, canceling, or getting status. - */ -TInt CImagePrint::CreatePrintJobL(TInt aPrinterID, RPointerArray& aImages, MPrintEventObserver& aObserver) - { - return iJobGuard->Guard(aPrinterID, aImages, aObserver); - } - -/** - * @brief Submits a print job already created. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - * @note The actual job execution is asynchronous so this function returns immediately. If successful, notification of job status and job completion is received by the client through the MPrintEventObserver. - */ -TInt CImagePrint::SubmitPrintJobL() - { - return iClient.SubmitPrintJob(); - } - -/** - * @brief Cancels the print job. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - * @note This is an asynchronous command. MPrintEventObserver::PrintJobProgressEvent will be called with the status of TPrintJobProgressEventStatus::EDone when the cancellation is completed. - * @note The notification can potentially be received by the client before this command returns to the client. - */ -TInt CImagePrint::CancelPrintJob() - { - LOG("CImagePrint::CancelPrintJob"); - return iClient.CancelPrintJob(); - } - -/** - * @brief Continues printing and / or submitting a print job. Implementation may vary from protocol to protocol. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::ContinuePrintJobL() - { - return iClient.ContinuePrintJob(); - } - -/** - * @brief Gets the number of pages to be printed. - * @return Number of pages to print. - */ -TInt CImagePrint::GetNumPrintPages() - { - return iClient.GetNumPrintPages(); - } - -/** - * @brief Gets the status of the printing job created. - * @return Printing job status. - */ -TInt CImagePrint::GetJobStatus() - { - return iClient.GetJobStatus(); - } - -/** - * @brief Gets the status of the printer. - * @param[in] aPrinterID The exposed ID of the printer the client wants to know about. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetPrinterStatus( TInt aPrinterID ) - { - return iClient.GetPrinterStatus( aPrinterID ); - } - -/** - * @brief Gets the IDs of the capabilities supported by the printer specified. - * @param[in] aPrinterID The exposed ID of the printer the client wants to know about. - * @param[out] aCapabilityIDs Array containing the ID's of the capabilities of the specified printer. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetPrinterCapabilityIDsL(TInt aPrinterID, RArray& aCapabilityIDs) - { - return iClient.GetPrinterCapabilityIDs(aPrinterID, aCapabilityIDs); - } - -/** - * @brief Gets the detail of a certain capability of a certain printer. - * @param[in] aPrinterID The exposed ID of the printer the client wants to know about. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[out] aCapability Capability information. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetPrinterCapabilityL(TInt aPrinterID, TInt aCapabilityID, TPrintCapability& aCapability) - { - return iClient.GetPrinterCapability(aPrinterID, aCapabilityID, aCapability); - } - -/** - * @brief Gets a setting configured for the created print job. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[out] aValue Capability value. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetJobSetting(TInt aCapabilityID, TInt& aValue) - { - return iClient.GetJobSetting(aCapabilityID, aValue); - } - -/** - * @brief Sets a print job setting. - * @param[in] aCapabilityID ID of the capability of interest. - * @param[in] aValue New capability value. - * @param[out] aAffectedCapability ID of any affected capability. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability) - { - return iClient.SetJobSetting(aCapabilityID, aValue, aAffectedCapability); - } - -/** - * @brief Gets the number of pages in the preview. - * @return Number of pages in the preview. - */ -TInt CImagePrint::GetNumPreviewPages() - { - return iClient.GetNumPreviewPages(); - } - -/** - * @brief Gets the icon representing a given layout or template. - * @param[in] aTemplateID ID of the template / layout of interest. - * @param[out] aFbsBitmapHandle Handle to the appropriate bitmap. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetJobTemplateIconL(TInt /*aTemplateID*/, TInt& /*aFbsBitmapHandle*/) - { - return KErrNotSupported; - } - -/** - * @brief Gets number of copies for each image. - * @param[out] aArray contains number of copies for each image. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::GetNumberOfCopies( RArray& /*aArray*/ ) - { - return KErrNotSupported; - } - -/** - * @brief Sets number of copies for each image. - * @param[in] aArray contains number of copies for each image. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::SetNumberOfCopies( const RArray& aArray ) - { - return iClient.SetNumberOfCopies( aArray ); - } - -/** - * @brief Creates a preview image. - * @param[in] aPageNumber Page number to create preview image of. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData. - */ -TInt CImagePrint::CreatePreviewImage(TInt /*aPageNumber*/) - { - return KErrNotSupported; - } - -/** - * @brief Removes a specified cached printer. - * @param[in] aPrinterID The exposed ID of the printer the client wants to remove. - * @return Any standard Symbian error code or KErrInvalidSequence / KErrInvalidData.k - */ -TInt CImagePrint::RemoveCachedPrinterL(TInt aPrinterID) - { - return iClient.RemoveCachedPrinter( aPrinterID ); - } - -/** - * @brief Returns the Protocols supported by the DLL. It can be any of the KImagePrint_PrinterProtocol* constants. - * @return An OR'ed value with the supported protocols information. - * @sa KImagePrint_PrinterProtocol_BPP @sa KImagePrint_PrinterProtocol_BIP @sa KImagePrint_PrinterProtocol_OPP - * @sa KImagePrint_PrinterProtocol_DPOF @sa KImagePrint_PrinterProtocol_PictBridge - */ -TUint CImagePrint::SupportedProtocols() - { - return iClient.SupportedProtocols(); - } - -/** - * @brief Registers the IdleObserver to send idle event notifications - * @param A pointer to an object implementing MIdleObserver interface that will be notified of events - * @note In order to stop sending notifications, send NULL as the parameter. - */ -void CImagePrint::RegisterIdleObserver(MIdleObserver *aObserver) - { - iIdleGuard->Guard( aObserver ); - } - -void CImagePrint::HandleGainingForeground() - { - iClient.SetForeground( ETrue ); - } - -void CImagePrint::HandleLosingForeground() - { - iClient.SetForeground( EFalse ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cimageprintengine.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cimageprintengine.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "imageprintprivatecrkeys.h" -#include "cimageprintengine.h" -#include "ciffactory.h" -#include "crealfactory.h" -#include "clog.h" -#include "mprintsettings.h" - -// CONSTRUCTION -EXPORT_C CImagePrintEngine* CImagePrintEngine::NewL( - CDesCArrayFlat* aImageFiles ) - { - CImagePrintEngine* self = CImagePrintEngine::NewLC( aImageFiles ); - CleanupStack::Pop(); // self - - return self; - } - -EXPORT_C CImagePrintEngine* CImagePrintEngine::NewLC( - CDesCArrayFlat* aImageFiles ) - { - CImagePrintEngine* self = new ( ELeave ) CImagePrintEngine; - CleanupStack::PushL( self ); - self->ConstructL( aImageFiles ); - return self; - } - -// Destructor (virtual by CBase) -CImagePrintEngine::~CImagePrintEngine() - { - delete iIFFactory; - delete iFiles; - iFileArray.ResetAndDestroy(); - iFileArray.Close(); - delete iCRSession; - } - -// Default constructor -CImagePrintEngine::CImagePrintEngine() - { - } - -// Second phase construct -void CImagePrintEngine::ConstructL( - CDesCArrayFlat* aImageFiles ) - { - CleanupStack::PushL( aImageFiles ); - iIFFactory = CRealFactory::NewL( this ); - CleanupStack::Pop( aImageFiles ); - SetImageArrayL( aImageFiles ); - - iCRSession = CRepository::NewL( KCRUidImagePrint ); - } - -// Returns the reference to interface factory -EXPORT_C CIFFactory& CImagePrintEngine::InterfaceFactory() - { - return *iIFFactory; - } - -// Initializes the image array -EXPORT_C void CImagePrintEngine::SetImageArrayL( - CDesCArrayFlat* aArray ) - { - delete iFiles; - iFiles = aArray; - - if ( iFiles ) - { - iFileArray.ResetAndDestroy(); - TInt i( 0 ); - TInt num( iFiles->Count() ); - for ( i = 0; i < num; i++ ) - { - TFileName* tf = CreateFileNameL(); - CleanupStack::PushL( tf ); - *tf = iFiles->MdcaPoint( i ); - User::LeaveIfError( iFileArray.Append( tf ) ); - CleanupStack::Pop( tf ); - } - - MPrintSettings* settings = - static_cast( iIFFactory )->SettingsIF(); - RArray numberOfCopiesArray; - CleanupClosePushL( numberOfCopiesArray ); - for( TInt i=0; i < iFiles->Count(); ++i ) - { - numberOfCopiesArray.Append( 1 ); - } - if( settings ) - { - settings->SetNumberOfCopiesL( numberOfCopiesArray ); - } - CleanupStack::PopAndDestroy(); // numberOfCopiesArray - } - } - -// Returns file array to be passed to server -EXPORT_C RPointerArray& CImagePrintEngine::FileArray() - { - return iFileArray; - } - -// Creates new TFileName for file array -TFileName* CImagePrintEngine::CreateFileNameL() - { - TFileName* fileName = 0; - fileName = new (ELeave) TFileName; - User::LeaveIfNull( fileName ); - return fileName; - } - -// Restarts Image Print engine -EXPORT_C void CImagePrintEngine::RestartEngine() - { - iIFFactory->RestartEngine(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/clistcapability.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/clistcapability.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include - -#include "clistcapability.h" -#include "crealfactory.h" -#include "mprintsettings.h" -#include "tprinter.h" -#include "mdiscoveryobserver.h" -#include "printcapabilitycodes.h" - -const TInt KArrayGranularity( 4 ); -const TInt KTwoPaperSizeAvailable( 2 ); -const TInt KTemplateSize = 16; -const TInt KTemplates[] = {1554,1552,1565,1555,1501,1553,1551,1558,1502,1504,1564,1506,1509,1512,1513,1516}; - -CListCapability::CListCapability( CRealFactory* aFactory ) : - iFactory( aFactory ) - { - } - -// Destructor -CListCapability::~CListCapability() - { - iEnumIDs.Close(); - iTexts.ResetAndDestroy(); - } - -// Creates text string for the settings list box -HBufC* CListCapability::ListBoxTextL() - { - CDesCArrayFlat* strings = - new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - CleanupStack::PushL( strings ); - strings->AppendL( iTitle ); - - TInt i( 0 ); - TInt num( iEnumIDs.Count() ); - TBool found( EFalse ); - // Find the matching text based on the enumeration value - for ( i = 0; i < num && !found; i++ ) - { - if ( iEnumIDs[i] == iValue ) - { - strings->AppendL( iTexts[i]->Des() ); - found = ETrue; - } - } - - if ( !found ) - { - User::Leave( KErrNotFound ); - } - - HBufC* buf = StringLoader::LoadL( R_QTN_LBOX_FORMAT, *strings ); - CleanupStack::PopAndDestroy(); // strings - - return buf; - } - -// Displays pop-up list for changing the active TInt value -TBool CListCapability::LaunchPopupListL() - { - // Create value array and sets it up - CAknQueryValueTextArray* queryTextArray = CAknQueryValueTextArray::NewL(); - CleanupStack::PushL( queryTextArray ); - - CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - CleanupStack::PushL( array ); - TInt i( 0 ); - TInt num( iTexts.Count() ); - for ( i = 0; i < num; i++ ) - { - array->AppendL( iTexts[i]->Des() ); - } - queryTextArray->SetArray( *array ); - - CAknQueryValueText* queryValue = CAknQueryValueText::NewL(); - CleanupStack::PushL( queryValue ); - queryValue->SetArrayL( queryTextArray ); - - TInt found( KErrNotFound ); - num = iEnumIDs.Count(); - for ( i = 0; i < num && found == KErrNotFound; i++ ) - { - if ( iEnumIDs[i] == iValue ) - { - found = KErrNone; - } - } - i--; - User::LeaveIfError( found ); - queryValue->SetCurrentValueIndex( i ); - - TBool changed = EFalse; - if( array->MdcaCount() > KTwoPaperSizeAvailable ) - { - // Create popup setting page and show it - CAknPopupSettingPage* page = new ( ELeave ) CAknPopupSettingPage( - &iTitle, EAknSettingPageNoOrdinalDisplayed, EAknCtPopupSettingList, - R_EMPTY_SETTING_LIST, R_SETTING_GENERIC_PAGE, *queryValue ); - CleanupStack::PushL( page ); - page->ConstructL(); - CleanupStack::Pop(); // page - - changed = page->ExecuteLD(); - // Save new value if needed - if ( changed ) - { - iValue = iEnumIDs[queryValue->CurrentValueIndex()]; - } - } - // If there are only two paper sizes available, another one is automaticly changed - else if( array->MdcaCount() == KTwoPaperSizeAvailable ) - { - if ( i == 0 ) - { - iValue = iEnumIDs[1]; - } - else - { - iValue = iEnumIDs[0]; - } - changed = ETrue; - } - // Do nothing - else - { - } - - CleanupStack::PopAndDestroy( 3 ); // queryTextArray, array, queryArray - return changed; - } - -// Clones itself -CBaseCapability* CListCapability::CloneL() - { - CListCapability* clone = new ( ELeave ) CListCapability( iFactory ); - CleanupStack::PushL( clone ); - - clone->iValue = iValue; - clone->iIndexOnList = iIndexOnList; - clone->iTitle = iTitle; - clone->iUid = iUid; - - TInt num( iEnumIDs.Count() ); - if ( iUid != EPrintCapabLayout ) - { - for ( TInt j = 0; j < num; j++ ) - { - User::LeaveIfError( clone->iEnumIDs.Append( iEnumIDs[j] ) ); - User::LeaveIfError( clone->iTexts.Append( iTexts[j]->AllocLC() ) ); - CleanupStack::Pop(); // clone->iTexts - } - } - else - { - // - // has to be done here, i.e. remove not-supported templates - TBool dropTemplates = EFalse; - if ( iFactory ) - { - if( ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EWLAN ) || - ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EBPP ) || - ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EUSB ) || - ( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EMMC ) ) - { - dropTemplates = ETrue; - } - } - // Also sort the print layout templates to "standard" order - for ( TInt i = 0; i < KTemplateSize; i++ ) - { - for ( TInt j = 0; j < num; j++ ) - { - if ( KTemplates[i] == iEnumIDs[j] ) - { - if ( (dropTemplates && (iEnumIDs[j] == EPrintCapabLayout1UpBorderless || iEnumIDs[j] == EPrintCapabLayout1UpBorder || iEnumIDs[j] == EPrintCapabLayout1Up) ) || !dropTemplates ) - { - User::LeaveIfError( clone->iEnumIDs.Append( iEnumIDs[j] ) ); - User::LeaveIfError( clone->iTexts.Append( iTexts[j]->AllocLC() ) ); - CleanupStack::Pop(); // clone->iTexts - } - } - } - } - } - - CleanupStack::Pop(); // clone - return clone; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cpreviewinfo.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cpreviewinfo.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2004-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 "cpreviewinfo.h" - -// Default constructor -CPreviewInfo::CPreviewInfo( - TInt aCapabilityUid, - TBool aPaperLandscape ) - { - iUid = aCapabilityUid; - iPaperLandscape = aPaperLandscape; - - // No, sticker templates are not used by default - iOneImagePerPage = EFalse; - } - -// Default destructor -CPreviewInfo::~CPreviewInfo() - { - iImageInfo.ResetAndDestroy(); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cprinteventcatcher.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cprinteventcatcher.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2004-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 "cprinteventcatcher.h" -#include "crealfactory.h" -#include "mprintpreviewobserver.h" -#include "mprintjobstatus.h" -#include "cprintjobmanager.h" -#include "clog.h" - -// CONSTRUCTION -CPrintEventCatcher* CPrintEventCatcher::NewL( - CIFFactory* aFactory, - CImagePrintEngine* aEngine ) - { - CPrintEventCatcher* self = CPrintEventCatcher::NewLC( aFactory, aEngine ); - CleanupStack::Pop(); // self - - return self; - } - -CPrintEventCatcher* CPrintEventCatcher::NewLC( - CIFFactory* aFactory, - CImagePrintEngine* aEngine ) - { - CPrintEventCatcher* self = - new ( ELeave ) CPrintEventCatcher( aFactory, aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// Constructor -CPrintEventCatcher::CPrintEventCatcher( - CIFFactory* aFactory, - CImagePrintEngine* aEngine ) : - iFactory( aFactory ), - iEngine( aEngine ) - { - } - -// Destructor -CPrintEventCatcher::~CPrintEventCatcher() - { - iObservers.Reset(); - } - -// 2nd phase constructor -void CPrintEventCatcher::ConstructL() - { - } - -// Print progress event -void CPrintEventCatcher::PrintJobProgressEvent( - TInt aStatus, - TInt aPercentCompletion, - TInt aJobStateCode ) - { - TInt obsCount = iObservers.Count(); - for( TInt i=0; iPrintJobProgress( aStatus, aPercentCompletion, - aJobStateCode ); - } - } - -// Print job error event -void CPrintEventCatcher::PrintJobErrorEvent( - TInt aError, - TInt aErrorStringCode ) - { - LOG2("CPrintEventCatcher::PrintJobErrorEvent: aError: %d, aErrorStringCode: %d ", - aError, aErrorStringCode ); - TInt obsCount = iObservers.Count(); - for( TInt i=0; iPrintJobError( aError, aErrorStringCode ); - } - } - -// Print job status event ("minor" error) -void CPrintEventCatcher::PrinterStatusEvent( - TInt aError, - TInt aErrorStringCode ) - { - LOG2("CPrintEventCatcher::PrinterStatusEvent: aError: %d, aErrorStringCode: %d ", - aError, aErrorStringCode ); - TInt obsCount = iObservers.Count(); - for( TInt i=0; iPrinterStatus( aError, aErrorStringCode ); - } - } - -// Receives preview events from the image print server -void CPrintEventCatcher::PreviewImageEvent( - TInt /*aFsBitmapHandle*/ ) - { - // Should not be called from engine anymore - } - -// Set preview observer -void CPrintEventCatcher::SetPreviewObserver( - MPrintPreviewObserver* aObserver ) - { - iPreviewObserver = aObserver; - } - -void CPrintEventCatcher::RegisterObserver( MPrintJobStatus* aObserver ) - { - iObservers.Append( aObserver ); - } - -void CPrintEventCatcher::UnRegisterObserver( MPrintJobStatus* aObserver ) - { - TInt observerPosition = iObservers.Find( aObserver ); - if( observerPosition != KErrNotFound ) - { - iObservers.Remove( observerPosition ); - } - } - - -// GOING TO GET REMOVED -void CPrintEventCatcher::ShowMessageL( - TInt /*aMsgLine1Code*/, - TInt /*aMsgLine2Code*/ ) - { - } - -// GOING TO GET REMOVED -TBool CPrintEventCatcher::AskYesNoQuestionL( - TInt /*aMsgLine1Code*/, - TInt /*aMsgLine2Code*/ ) - { - return EFalse; - } - -// GOING TO GET REMOVED -const TDesC& CPrintEventCatcher::AskForInputL( - TInt /*aMsgLine1Code*/, - TInt /*aMsgLine2Code*/ ) - { - return KNullDesC; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cprintjobmanager.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cprintjobmanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "cprintjobmanager.h" -#include "cprinteventcatcher.h" -#include "csettingsmanager.h" -#include "mprintjobobserver.h" -#include "imageprint.h" -#include "cimageprintengine.h" -#include "crealfactory.h" -#include "clog.h" -#include "printcapabilitycodes.h" -#include "printmessagecodes.h" -#include "mprintsettings.h" -#include "cimageprint.h" -#include "mdiscoveryobserver.h" - -const TInt KCancelRetries( 2 ); -// CONSTRUCTION -CPrintJobManager* CPrintJobManager::NewL( - CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ) - { - CPrintJobManager* self = CPrintJobManager::NewLC( - aFactory, aDLLEngine ); - CleanupStack::Pop(); // self - - return self; - } - -CPrintJobManager* CPrintJobManager::NewLC( - CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ) - { - CPrintJobManager* self = new ( ELeave ) CPrintJobManager( - aFactory, aDLLEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// Constructor -CPrintJobManager::CPrintJobManager( - CRealFactory* aFactory, - CImagePrintEngine* aDLLEngine ) : - iFactory( aFactory ), - iDLLEngine( aDLLEngine ) - { - } - -// Destructor -CPrintJobManager::~CPrintJobManager() - { - LOG("CPrintJobManager::~CPrintJobManager BEGIN"); - - iImages.ResetAndDestroy(); - iImages.Close(); - - // Cancel current print job at exit - if(IsPrinting()) - { - TRAP_IGNORE( CancelL() ); - } - - LOG("CPrintJobManager::~CPrintJobManager END"); - } - -// Second phase constructor -void CPrintJobManager::ConstructL() - { - } - -// Creates a new print job -TInt CPrintJobManager::CreatePrintJobL( - TInt aPrinterId ) - { - LOG("CPrintJobManager::CreatePrintJobL BEGIN"); - iPrintingOnGoing = EFalse; - // Creates a print job - MPrintEventObserver* notifier = iFactory->PrintEventObserverIF(); - iPrinterUid = aPrinterId; - - TInt printJobError = iFactory->Engine()->CreatePrintJobL( - aPrinterId, iDLLEngine->FileArray(), *notifier ); - - iImages.ResetAndDestroy(); - - for ( TInt i(0) ; i < iDLLEngine->FileArray().Count() ; i++ ) - { - HBufC* image = iDLLEngine->FileArray()[i]->AllocLC(); - iImages.AppendL( image ); - CleanupStack::Pop( image ); - } - - LOG1( "CPrintJobManager::CreatePrintJobL END, err: %d", printJobError ); - return printJobError; - } - -// Submits the created print job -void CPrintJobManager::PrintL( - MPrintJobObserver* aObserver ) - { - LOG("CPrintJobManager::PrintL BEGIN"); - TInt getSettings; - iPrintingOnGoing = ETrue; - - //Get current template UID from settings manager - TInt uid = iFactory->SettingsIF()->TemplateUid(); - - LOG1("Print done with id: %d", uid); - - //Set the UID to Image Print Engine. - TInt err = iFactory->Engine()->SetJobSettingL( - EPrintCapabLayout, uid, getSettings ); - LOG1("CPrintJobManager::PrintL SetJobSettingL err: %d", err); - - if ( err == KErrNotFound ) - { - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_NOT_FOUND_ERROR ); - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - CleanupStack::PushL( errornote ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( errornote ); - CleanupStack::PopAndDestroy( buf ); - } - if ( err != KErrNone ) - { - iPrintingOnGoing = EFalse; - User::Leave( err ); - } - err = iFactory->Engine()->SubmitPrintJobL(); - LOG1("CPrintJobManager::PrintL SubmitPrintJobL err: %d", err); - if ( err == KErrNotFound ) - { - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_NOT_FOUND_ERROR ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - } - if ( err != KErrNone ) - { - iPrintingOnGoing = EFalse; - User::Leave( err ); - } - iObserver = aObserver; - LOG("CPrintJobManager::PrintL END"); - } - -// Cancels printing -void CPrintJobManager::CancelL() - { - LOG("CPrintJobManager::CancelL BEGIN"); - if ( IsPrinting() ) - { - iCancelling = ETrue; - TInt err = iFactory->Engine()->CancelPrintJob(); - if ( err ) - { - LOG1("CPrintJobManager::CancelL failed err: %d", err); - if ( err == EPbStatusErrorReasonHardwarePrinterUnavailable ) - { - //Printer was not ready, retry after a while a couple of times - for( TInt i=0; iEngine()->CancelPrintJob(); - if ( err == KErrNone ) - { - break; - } - else - { - LOG1("CPrintJobManager::CancelL failed err: %d", err); - } - } - } - else - { - iCancelling = EFalse; - User::LeaveIfError( err ); - } - } - // Cancellation is returned to UI after PrintJobProgress returns completion status - iPrintingOnGoing = EFalse; - } - else - { - if(iObserver) - { - iObserver->JobFinished(); - } - } - - LOG("CPrintJobManager::CancelL END"); - } - -// Returns the images from current print job. -void CPrintJobManager::GetPrintJobL( RPointerArray& aImages ) - { - for ( TInt i(0); i < iImages.Count(); i++ ) - { - aImages.AppendL( iImages[i] ); - } - } - -// Returns the status of the printing -TBool CPrintJobManager::IsPrinting() const - { - return iPrintingOnGoing; - } - -// Called by engine for progress notifications -void CPrintJobManager::PrintJobProgress( - TInt aStatus, - TInt aPercentCompletion, - TInt aJobStateCode ) - { - if ( aStatus == EActive ) - { - iPrintingOnGoing = ETrue; - iObserver->PrintProgress( aPercentCompletion ); - } - else - { - if ( aJobStateCode == ECancelling && aStatus == EDone ) - { - iCancelling = EFalse; - iPrintingOnGoing = EFalse; - iObserver->JobError( aJobStateCode, KErrNone ); - } - else if ( iCancelling && aStatus == EDone) - { - iCancelling = EFalse; - iObserver->JobFinished(); - } - else if ( aJobStateCode == ECancellingNoMessage && aStatus == EDone ) - { - iObserver->JobError( aJobStateCode, KErrNone ); - } - else - { - iObserver->JobFinished(); - iPrintingOnGoing = EFalse; - } - } - } - -// Called by engine to notify print errors -void CPrintJobManager::PrintJobError( - TInt aError, TInt aErrorStringCode ) - { - LOG2("[CPrintJobManager::PrintJobError] PrintJobError: %d, errorstring: %d", aError, aErrorStringCode); - if( iPrintingOnGoing ) - { - if ( iObserver ) - { - LOG("CPrintJobManager::PrintJobError Printing is going, send error to UI."); - iObserver->JobError( aError, aErrorStringCode ); - } - } - // ERKZ-7JDFZ8 - Canceling Job hangs for ever - // If WLAN printer is turned off while printing UI receives KErrHostUnreach. - // If error is not handled, printing continues. - if ( aError == KErrHostUnreach ) - { - if ( iObserver ) - { - LOG("CPrintJobManager::PrintJobError KErrHostUnreach"); - iObserver->JobError( KErrHostUnreach, aErrorStringCode ); - } - } - iPrintingOnGoing = EFalse; - // show Pictbridge fatal errors and warnings always - if ( iFactory ) - { - if( iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EUSB ) - { - if ( iObserver ) - { - LOG("CPrintJobManager::PrintJobError sending PictBridge error to UI..."); - iObserver->JobError( aError, aErrorStringCode ); - } - } - } - } - -// Called by engine to notify printer status (errors) -void CPrintJobManager::PrinterStatus( - TInt aError, - TInt aErrorStringCode ) - { - iObserver->JobStatusEvent( aError, aErrorStringCode ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/cprintsettings.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/cprintsettings.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2004-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 "cprintsettings.h" -#include "cbasecapability.h" - -// CONSTRUCTION -CPrintSettings::CPrintSettings() - { - } - -// Default destructor -CPrintSettings::~CPrintSettings() - { - iCapabilities.ResetAndDestroy(); - } - -// Clone this instance and return it -CPrintSettings* CPrintSettings::CloneL() - { - CPrintSettings* clone = new ( ELeave ) CPrintSettings; - CleanupStack::PushL( clone ); - - TInt i( 0 ); - TInt num( iCapabilities.Count() ); - for ( i = 0; i < num; i++ ) - { - User::LeaveIfError( - clone->iCapabilities.Append( iCapabilities[i]->CloneL() ) ); - } - - CleanupStack::Pop(); // clone - - return clone; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/crealfactory.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/crealfactory.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2004-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 "crealfactory.h" -#include "cimageprintengine.h" -#include "cdiscoverymanager.h" -#include "cprintjobmanager.h" -#include "cprinteventcatcher.h" -#include "cidleprinteventcatcher.h" -#include "csettingsmanager.h" -#include "imageprint.h" -#include "cimageprint.h" -#include "clog.h" - -const TInt KMaxServerConnections( 3 ); - -// CONSTRUCTION -CRealFactory* CRealFactory::NewL( - CImagePrintEngine* aEngine ) - { - CRealFactory* self = new ( ELeave ) CRealFactory( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// Default constructor -CRealFactory::CRealFactory( CImagePrintEngine* aEngine ) - : CIFFactory( aEngine ) - { - } - -// Destructor -CRealFactory::~CRealFactory() - { - LOG("CRealFactory::~CRealFactory BEGIN"); - if ( iEventCatcher ) - { - iEventCatcher->UnRegisterObserver( iPrintJobMgr ); - } - delete iPrintJobMgr; - delete iDiscoveryMgr; - delete iSettingsMgr; - delete iEventCatcher; - delete iIdleEventCatcher; - - if ( iImageServer ) - { - iImageServer->Close(); - delete iImageServer; - } - - iImagePrintClient.Close(); - LOG("CRealFactory::~CRealFactory END"); - } - -// 2nd phase constructor -void CRealFactory::ConstructL() - { - iImageServer = new ( ELeave ) CImagePrint; - iImageServer->ConnectL(); - - iEventCatcher = CPrintEventCatcher::NewL( this, iPrintEngine ); - iIdleEventCatcher = CIdlePrintEventCatcher::NewL( this /*aIdleObserver*/ ); - iDiscoveryMgr = CDiscoveryManager::NewL( this ); - iPrintJobMgr = CPrintJobManager::NewL( this, iPrintEngine ); - iSettingsMgr = CSettingsManager::NewL( this ); - - iEventCatcher->RegisterObserver( iPrintJobMgr ); - iImageServer->RegisterIdleObserver( iIdleEventCatcher ); - - User::LeaveIfError( iImagePrintClient.ConnectL() ); - } - -// Discovery interface -MDiscovery* CRealFactory::DiscoveryIF() - { - return iDiscoveryMgr; - } - -// Settings interface -MPrintSettings* CRealFactory::SettingsIF() - { - return iSettingsMgr; - } - -// Print job interface -MPrintJob* CRealFactory::PrintJobIF() - { - return iPrintJobMgr; - } - -// Returns event catcher -MPrintEventObserver* CRealFactory::PrintEventObserverIF() - { - return iEventCatcher; - } - -MPrintEventRegisterIF* CRealFactory::PrintEventRegisterIF() - { - return iEventCatcher; - } - -// Restarts Engine -void CRealFactory::RestartEngine() - { - // No implementation - } - -// Returns Engine -CImagePrint* CRealFactory::Engine() - { - return iImageServer; - } - -TBool CRealFactory::IsPrinting() const - { - return iPrintJobMgr->IsPrinting(); - } - - -MIdlePrintEventRegisterIF* CRealFactory::IdlePrintEventRegisterIF() - { - return iIdleEventCatcher; - } - -RImagePrintClient CRealFactory::ImagePrintClient() - { - return iImagePrintClient; - } - -TBool CRealFactory::IsApplicationAlreadyInUse() - { - TBool retValue = EFalse; - TInt serverConnections = 0; - TInt err = iImagePrintClient.CountConnections( serverConnections ); - if( err != KErrNone ) - { - return EFalse; - } - - // if server has already two connections - if( serverConnections == KMaxServerConnections ) - { - //if another connection IS NOT pictbridge - TInt mode = iImagePrintClient.IsPictBridgeMode(); - if( mode < 0 ) - { - retValue = EFalse; - } - } - // too many connection - if( serverConnections > KMaxServerConnections ) - { - retValue = EFalse; - } - return retValue; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/csettingsmanager.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/csettingsmanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,691 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "tprintcapability.h" -#include "csettingsmanager.h" -#include "ctemplatesettings.h" -#include "cprintsettings.h" -#include "ctintcapability.h" -#include "clistcapability.h" -#include "cfloatcapability.h" -#include "ctemplatedata.h" -#include "printcapabilitycodes.h" -#include "settingsconverter.h" -#include "crealfactory.h" -#include "imageprint.h" -#include "cimageprint.h" -#include "imageprintvariant.h" -#include -#include "imageprintprivatecrkeys.h" -#include "mdiscovery.h" -#include "clog.h" - -namespace - { - const TInt KDefaultPrinterNameMaxLength = 100; - const TInt KTemplateSize = 16; - const TInt KTemplates[] = {1554,1552,1565,1555,1501,1553,1551,1558,1502,1504,1564,1506,1509,1512,1513,1516}; - } - -#include "clog.h" - -// CONSTRUCTION -CSettingsManager* CSettingsManager::NewL( - CRealFactory* aFactory ) - { - CSettingsManager* self = CSettingsManager::NewLC( - aFactory ); - CleanupStack::Pop(); // self - - return self; - } - -CSettingsManager* CSettingsManager::NewLC( - CRealFactory* aFactory ) - { - CSettingsManager* self = - new ( ELeave ) CSettingsManager( aFactory ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// Constrcutor -CSettingsManager::CSettingsManager( - CRealFactory* aFactory ) : - iFactory( aFactory ), - iActivePage( 1 ) - { - } - -// Destructor -CSettingsManager::~CSettingsManager() - { - delete iPrintSettings; - delete iTemplateSettings; - delete iCurrentPrinterName; - delete iCRSession; - iNumberOfCopiesArray.Close(); - iNumberOfCopiesCumulativeArray.Close(); - } - -// 2nd phase constructor -void CSettingsManager::ConstructL() - { - iPrintSettings = new ( ELeave ) CPrintSettings; - iTemplateSettings = CTemplateSettings::NewL( iFactory ); - - iCRSession = CRepository::NewL( KCRUidImagePrint ); - } - -// Clones the current template settings -CTemplateSettings* CSettingsManager::TemplateSettingsL() - { - return iTemplateSettings->CloneL(); - } - -// Changes active template to a new one -void CSettingsManager::SetActiveTemplateL( - TUint aUid ) - { - LOG1( "CSettingsManager::SetActiveTemplateL START || aUid = %d", aUid ); - // Set active template to preview manager, if one available - iTemplateSettings->iActiveTemplateUid = aUid; - - CListCapability* capab = static_cast( - FetchCapabilityL( EPrintCapabLayout ) ); - capab->iValue = aUid; - LOG1( "CSettingsManager::SetActiveTemplateL || iImagesOnPage = %d", iImagesOnPage ); - } - -// Returns the number of pages -TUint CSettingsManager::NumOfPagesL() - { - // Always 1, fix this for the release 2 - // return iFactory->Engine()->GetNumPrintPages(); - - TInt num( 1 ); - return num; - } - -// Returns the number of copies -TInt CSettingsManager::NumberOfCopies( RArray& aArray ) - { - TInt err( KErrNone ); - aArray.Reset(); - for( TInt i=0; i& aArray ) - { - TInt err( KErrNone ); - TInt numberOfCopiesCumulative( 1 ); - iNumberOfCopiesArray.Close(); - iNumberOfCopiesCumulativeArray.Close(); - for( TInt i=0; iEngine()->SetNumberOfCopies( iNumberOfCopiesArray ); - } - -// Returns -TBool CSettingsManager::IsMMC() - { - TBool retVal = EFalse; - TInt supportedProtocols = iFactory->DiscoveryIF()->SupportedProtocols(); - - if( (supportedProtocols & KImagePrint_PrinterProtocol_DPOF) && - ( iPrinterUid == iMMCUid )) - { - retVal = ETrue; - } - LOG1( "CSettingsManager::IsMMC: %d ", retVal ); - return retVal; - } - -// Changes active page for drawing a new preview -void CSettingsManager::SetActivePageL( - TUint aActivePage ) - { - } - -// Returns current active page -TUint CSettingsManager::CurActivePageL() - { - TUint num( 1 ); - return num; - } - -// Clones current print settings -CPrintSettings* CSettingsManager::PrinterSettingsL() - { - return iPrintSettings->CloneL(); - } - -// Sets all settings, not supported at the moment -void CSettingsManager::SetPrinterSettingsL( - CPrintSettings& /*aSettings*/ ) - { - User::Leave( KErrNotSupported ); - } - -// Sets a single setting -TInt CSettingsManager::SetPrinterSettingL( - CBaseCapability& aCapab ) - { - LOG( "CSettingsManager::SetPrinterSettingL START" ); - TInt getSettings( 0 ); - TInt err = iFactory->Engine()->SetJobSettingL( - aCapab.iUid, aCapab.iValue, getSettings ); - getSettings = 0; - User::LeaveIfError( err ); - - CBaseCapability* capab = FetchCapabilityL( aCapab.iUid ); - capab->iValue = aCapab.iValue; - -#ifdef IMG_PRINT_DYNAMIC_PRINT_SETTINGS - // Do not initialize if only template was changed - if( aCapab.iUid != 500 ) - { - LOG( "CSettingsManager::SetPrinterSettingL || aCapab.iUid != 500" ); - InitCapabilitiesL( iPrinterUid ); - InitTemplateSettingsL(); - } - else - { - LOG( "CSettingsManager::SetPrinterSettingL || aCapab.iUid == 500" ); - SetActiveTemplateL( aCapab.iValue ); - } -#else - InitCapabilitiesL( iPrinterUid ); - InitTemplateSettingsL(); -#endif - - LOG1( "CSettingsManager::SetPrinterSettingL getSettings = %d", getSettings ); - return getSettings; - } - -// Initializes the printer settings -void CSettingsManager::InitSettingsL( - TInt aPrinterUid, - TInt aMMCUid ) - { - LOG1( "CSettingsManager::InitSettingsL aPrinterUid = %d", aPrinterUid ); - LOG1( "CSettingsManager::InitSettingsL aMMCUid = %d", aMMCUid ); - - iMMCUid = aMMCUid; - InitCapabilitiesL( aPrinterUid ); - InitTemplateSettingsL(); - iPrinterUid = aPrinterUid; - } - -// Inititalizes the capabilities -void CSettingsManager::InitCapabilitiesL( - TInt aPrinterUid ) - { - LOG1("CSettingsManager::InitCapabilitiesL Begin: %d", aPrinterUid); - RArray capabIDs; - CleanupClosePushL( capabIDs ); - - // Get list of IDs - iFactory->Engine()->GetPrinterCapabilityIDsL( aPrinterUid, capabIDs ); - CPrintSettings* printSettings = new ( ELeave ) CPrintSettings; - CleanupStack::PushL( printSettings ); - - TInt i( 0 ); - TInt num( capabIDs.Count() ); - LOG1("CSettingsManager::InitCapabilitiesL number of capabs: %d", num); - for ( i = 0; i < num; i++ ) - { - TPrintCapability capab; - iFactory->Engine()->GetPrinterCapabilityL( aPrinterUid, capabIDs[i], capab ); - capab.iType = TPrintCapability::Enum; - - CBaseCapability* capability = 0; - - // Create capability - switch ( capab.iType ) - { - case TPrintCapability::Int: - capability = SettingsConverter::AddTIntCapabilityLC( - capab, i, capabIDs[i] ); - break; - - case TPrintCapability::Enum: - capability = SettingsConverter::AddListCapabilityLC( - capab, i, capabIDs[i], iFactory ); - break; - - case TPrintCapability::Float: - capability = SettingsConverter::AddFloatCapabilityLC( - capab, i, capabIDs[i] ); - break; - - default: - User::Leave( KErrUnknown ); - break; - } - iFactory->Engine()->GetJobSetting( capabIDs[i], capability->iValue ); - - // Add the capability to the list - User::LeaveIfError( - printSettings->iCapabilities.Append( capability ) ); - CleanupStack::Pop(); // capability - } - - delete iPrintSettings; - iPrintSettings = printSettings; - - CleanupStack::Pop(); // printSettings - CleanupStack::PopAndDestroy(); // capabIDs - LOG("CSettingsManager::InitCapabilitiesL End"); - } - -// Initializes the templates -void CSettingsManager::InitTemplateSettingsL() - { - LOG("CSettingsManager::InitTemplateSettingsL Begin"); - CTemplateSettings* settings = CTemplateSettings::NewL( iFactory ); - CleanupStack::PushL( settings ); - TInt templateBuffer = iFactory->SettingsIF()->TemplateUid(); - - TInt i( 0 ); - TInt num( iPrintSettings->iCapabilities.Count() ); - for ( i = 0; i < num; i++ ) - { - if ( iPrintSettings->iCapabilities[i]->iUid == EPrintCapabLayout ) - { - TInt j( 0 ); - CListCapability* layouts = - static_cast - ( iPrintSettings->iCapabilities[i] ); - for ( j = 0; j < layouts->iEnumIDs.Count(); j++ ) - { - // Create new template data with the icon and Uid value - CTemplateData* data = CTemplateData::NewL(); - data->iUid = layouts->iEnumIDs[j]; - CleanupStack::PushL( data ); - LOG1( "CSettingsManager::InitTemplateSettingsL, UID: %d", data->iUid ); - User::LeaveIfError( settings->iTemplates.Append( data ) ); - CleanupStack::Pop( data ); - } - } - } - - // Sort the templates to "standard" order - CTemplateSettings* sortsettings = CTemplateSettings::NewL( iFactory ); - CleanupStack::PushL( sortsettings ); - for ( TInt i = 0; i < KTemplateSize; i++ ) - { - for ( TInt j = 0; j < settings->iTemplates.Count(); j++ ) - { - if ( KTemplates[i] == settings->iTemplates[j]->iUid ) - { - CTemplateData* data = CTemplateData::NewL(); - data->iUid = settings->iTemplates[j]->iUid; - CleanupStack::PushL( data ); - LOG1( "CSettingsManager::InitTemplateSettingsL, UID: %d", data->iUid ); - User::LeaveIfError( sortsettings->iTemplates.Append( data ) ); - CleanupStack::Pop( data ); - break; - } - } - } - - CleanupStack::Pop( sortsettings ); - CleanupStack::PopAndDestroy( settings ); - delete iTemplateSettings; - iTemplateSettings = sortsettings; - - TBool templateFound = EFalse; - if ( iTemplateSettings->iTemplates.Count() > 0 ) - { - for (TInt g = 0; g < iTemplateSettings->iTemplates.Count(); g++) - { - if (iTemplateSettings->iTemplates[g]->iUid == templateBuffer) - { - iTemplateSettings->iActiveTemplateUid = templateBuffer; - templateFound = ETrue; - } - } - if (!templateFound){ - iTemplateSettings->iActiveTemplateUid = - iTemplateSettings->iTemplates[0]->iUid; - } - - SetActiveTemplateL( iTemplateSettings->iActiveTemplateUid ); - } - // If there are no templates available, draw the preview using - // 1/page template - else - { - LOG("CSettingsManager::InitTemplateSettingsL || No templates available!"); - SetActiveTemplateL( EPrintCapabLayout1UpMedium ); - } - LOG("CSettingsManager::InitTemplateSettingsL End"); - } - -// Fetches capability from the list and returns it -CBaseCapability* CSettingsManager::FetchCapabilityL( - TInt aUid ) - { - LOG1("CSettingsManager::FetchCapabilityL Begin: %d", aUid); - CBaseCapability* capab = NULL; - TInt found( KErrNotFound ); - - TInt i( 0 ); - TInt num( iPrintSettings->iCapabilities.Count() ); - for ( i = 0; i < num && found != KErrNone; i++ ) - { - if ( iPrintSettings->iCapabilities[i]->iUid == aUid ) - { - capab = iPrintSettings->iCapabilities[i]; - found = KErrNone; - } - } - - User::LeaveIfError( found ); - LOG("CSettingsManager::FetchCapabilityL End"); - return capab; - } - -TInt CSettingsManager::TemplateUid() - { - LOG1( "CSettingsManager::TemplateUid || iActiveTemplateUid = %d", iTemplateSettings->iActiveTemplateUid ); - return iTemplateSettings->iActiveTemplateUid; - } - -TBool CSettingsManager::UpdatePageNumberL( TInt aCurrentImage ) - { - TBool retValue = EFalse; - TUint pageNumber; - - if( iNumberOfCopiesCumulativeArray.Count() > aCurrentImage-1 ) - { - aCurrentImage = iNumberOfCopiesCumulativeArray[aCurrentImage-1]; - } - - pageNumber = aCurrentImage / iImagesOnPage; - if ( ( aCurrentImage % iImagesOnPage ) != 0 ) - { - pageNumber++; - } - - if ( iActivePage != pageNumber ) - { - iActivePage = pageNumber; - retValue = ETrue; - } - return retValue; - } - -TInt CSettingsManager::PrinterUid() - { - return iPrinterUid; - } - - -TBool CSettingsManager::GetUsbState() - { - return iUsbConnected; - } - -void CSettingsManager::SetUsbState( TBool aConnected ) - { - iUsbConnected = aConnected; - } - -TInt CSettingsManager::GetDefaultPrinterProtocol() - { - TInt retValue; - TInt err = iCRSession->Get( KDefaultPrinterProtocol, retValue ); - - LOG2("CSettingsManager::GetDefaultPrinterProtocol: %d, err: %d", retValue, err); - return ( err ) ? err : retValue; - } - - -TInt CSettingsManager::SetDefaultPrinterProtocol( TInt aProtocol ) - { - TInt err = iCRSession->Set( KDefaultPrinterProtocol, aProtocol ); - LOG2("CSettingsManager::SetDefaultPrinterProtocol: %d, err: %d", aProtocol, err); - return err; - } - -TInt CSettingsManager::GetCurrentPrinterProtocol() - { - LOG1("CSettingsManager::GetCurrentPrinterProtocol: %d", iCurrentPrinterProtocol ); - return iCurrentPrinterProtocol; - } - -void CSettingsManager::SetCurrentPrinterProtocol( TInt aProtocol ) - { - LOG1("CSettingsManager::SetCurrentPrinterProtocol: %d", aProtocol ); - iCurrentPrinterProtocol = aProtocol; - } - -TUint CSettingsManager::GetCurrentPrinterVendor() - { - LOG1("CSettingsManager::GetCurrentPrinterVendor() vendor: %d",iVendor); - return iVendor; - } - -void CSettingsManager::SetCurrentPrinterVendor( TUint aVendor ) - { - LOG1("CSettingsManager::SetCurrentPrinterVendor() vendor: %d",aVendor); - iVendor = aVendor; - } - -TInt CSettingsManager::GetDefaultPrintID() - { - TInt retValue; - TInt err = iCRSession->Get( KDefaultPrinterID, retValue ); - LOG2("CSettingsManager::GetDefaultPrintID: get: %d, err: %d", retValue, err); - return ( err ) ? err : retValue; - } - -TInt CSettingsManager::SetDefaultPrinterID( TInt aId ) - { - TInt err = iCRSession->Set( KDefaultPrinterID, aId ); - LOG2("CSettingsManager::SetDefaultPrinterID: set: %d, err: %d", aId, err); - return err; - } - -HBufC* CSettingsManager::GetDefaultPrinterNameLC() - { - HBufC* name = HBufC::NewLC( KDefaultPrinterNameMaxLength ); - TPtr ptr( name->Des() ); - TInt err = iCRSession->Get( KDefaultPrinterName, ptr ); - LOG2("CSettingsManager::GetDefaultPrinterNameLC: name: %S, err: %d", &ptr, err); - return name; - } - -TInt CSettingsManager::SetDefaultPrinterNameL( const TDesC& aPrinterName ) - { - TInt err = KErrNone; - HBufC* stringholder = HBufC::NewLC( aPrinterName.Length() ); - *stringholder = aPrinterName; - - // Clear the printer name string from all formatting tabs & numbers - TPtr ptr = stringholder->Des(); - TInt pos = stringholder->Find( KTabChar ); - if ( pos == 1 ) // 1st possible icon formatting tab is at pos 1 - { - ptr.Delete( 0, 2 ); // delete the first icon tab and the number previous to it - pos = stringholder->Find( KTabChar ); - } - while ( pos != KErrNotFound && - pos != stringholder->Length() - 2 ) - { - ptr.Delete( pos, 1); // delete all middle tabs - pos = stringholder->Find( KTabChar ); - } - // 2nd possible iconformatting tab is 2nd last char - if ( pos != KErrNotFound && - pos == stringholder->Length() - 2 ) - { - // delete the 2nd icon formatting tab and the number next to it - ptr.Delete( stringholder->Length() - 2, 2 ); - } - - err = iCRSession->Set( KDefaultPrinterName, *stringholder ); - LOG2("CSettingsManager::SetDefaultPrinterNameL: name: %S err: %d", &ptr, err); - CleanupStack::PopAndDestroy( stringholder ); - return err; - } - -HBufC* CSettingsManager::GetCurrentPrinterName() - { - TPtr ptr = iCurrentPrinterName->Des(); - LOG1("CSettingsManager::GetCurrentPrinterName: name: %S", &ptr ); - return iCurrentPrinterName; - } - -TInt CSettingsManager::SetCurrentPrinterName( const TDesC& aPrinterName ) - { - if( iCurrentPrinterName ) - { - delete iCurrentPrinterName; - iCurrentPrinterName = NULL; - } - - TInt err; - HBufC* tmpBuf = aPrinterName.Alloc(); - if( !tmpBuf ) - { - return KErrGeneral; - } - else - { - err = KErrNone; - iCurrentPrinterName = tmpBuf; - } - - // Clear the printer name string from all formatting tabs & numbers - TPtr ptr = iCurrentPrinterName->Des(); - TInt pos = iCurrentPrinterName->Find( KTabChar ); - if ( pos == 1 ) // 1st possible icon formatting tab is at pos 1 - { - ptr.Delete( 0, 2 ); // delete the first icon tab and the number previous to it - pos = iCurrentPrinterName->Find( KTabChar ); - } - while ( pos != KErrNotFound && - pos != iCurrentPrinterName->Length() - 2 ) - { - ptr.Delete( pos, 1); // delete all middle tabs - pos = iCurrentPrinterName->Find( KTabChar ); - } - // 2nd possible iconformatting tab is 2nd last char - if ( pos != KErrNotFound && - pos == iCurrentPrinterName->Length() - 2 ) - { - // delete the 2nd icon formatting tab and the number next to it - ptr.Delete( iCurrentPrinterName->Length() - 2, 2 ); - } - - LOG1("CSettingsManager::SetCurrentPrinterName: name: %S", &ptr ); - return err; - } - -HBufC* CSettingsManager::GetCurrentPaperSizeTextL() - { - HBufC* retValue = NULL; - CListCapability* paperSizeCapab = NULL; - // Searches the paper size capability from the capability list - // Search the UID for paper size (= 4) - TInt counter = iPrintSettings->iCapabilities.Count(); - for( TInt i = 0 ; i < counter ; i++ ) - { - - //Use the searched ListCapability - if( iPrintSettings->iCapabilities[ i ]->iUid == EPrintCapabPaperSize ) - { - paperSizeCapab = static_cast< CListCapability* > - ( iPrintSettings->iCapabilities[ i ] ); - } - } - - - TBool found( EFalse ); - - if ( paperSizeCapab ) - { - const TInt expectedNumberOfStrings( 2 ); - CDesCArrayFlat* strings = - new ( ELeave ) CDesCArrayFlat( expectedNumberOfStrings ); - CleanupStack::PushL( strings ); - - TInt i( 0 ); - TInt counter = paperSizeCapab->iEnumIDs.Count(); - for ( i = 0; i < counter && !found; i++ ) - { - if ( paperSizeCapab->iEnumIDs[i] == - paperSizeCapab->iValue ) - { - retValue = paperSizeCapab->iTexts[i]; - } - } - CleanupStack::PopAndDestroy(); // strings - } - return retValue; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/ctemplatedata.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/ctemplatedata.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2004-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 "ctemplatedata.h" - -// CONSTRUCTION -CTemplateData* CTemplateData::NewL() - { - CTemplateData* self = CTemplateData::NewLC(); - CleanupStack::Pop(); // self - return self; - } - -CTemplateData* CTemplateData::NewLC() - { - CTemplateData* self = new ( ELeave ) CTemplateData; - CleanupStack::PushL( self ); - return self; - } - -// Default constructor -CTemplateData::CTemplateData() - { - } - -// Destructor -CTemplateData::~CTemplateData() - { - } - -// Clones single template data instance -CTemplateData* CTemplateData::CloneL() - { - CTemplateData* self = CTemplateData::NewL(); - self->iUid = iUid; - return self; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/ctemplatesettings.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/ctemplatesettings.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2004-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 "ctemplatesettings.h" - -#include "ctemplatedata.h" -#include "tprinter.h" -#include "mdiscoveryobserver.h" -#include "crealfactory.h" -#include "mprintsettings.h" -#include "clog.h" - -// BT Template ID's -const TInt KOneUpBorderless( 1554 ); -const TInt KOneUpBorder( 1555 ); -const TInt KOneUpStick( 1565 ); -const TInt KFourUpStick( 1564 ); -const TInt KSixteenUpStick( 1516 ); -const TInt KOneUp( 1501 ); - - -// CONSTRUCTION -CTemplateSettings* CTemplateSettings::NewL( CRealFactory* aFactory ) - { - CTemplateSettings* self = CTemplateSettings::NewLC( aFactory ); - CleanupStack::Pop(); // self - return self; - } - -CTemplateSettings* CTemplateSettings::NewLC( CRealFactory* aFactory ) - { - CTemplateSettings* self = new ( ELeave ) CTemplateSettings( aFactory ); - CleanupStack::PushL( self ); - return self; - } - -// Default constructor -CTemplateSettings::CTemplateSettings( CRealFactory* aFactory ) - { - iActiveTemplateUid = KMaxTUint32; - iFactory = aFactory; - } - -// Destructor -CTemplateSettings::~CTemplateSettings() - { - iTemplates.ResetAndDestroy(); - } - -// Clones current template settings -CTemplateSettings* CTemplateSettings::CloneL() - { - TBool dropTemplates = EFalse; - CTemplateSettings* self = CTemplateSettings::NewLC( iFactory ); - - self->iActiveTemplateUid = iActiveTemplateUid; - TInt num( iTemplates.Count() ); - TInt templateID; - - if( (iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EWLAN) || - (iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EBPP) || - (iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EMMC) || - (iFactory->SettingsIF()->GetCurrentPrinterProtocol() == MDiscoveryObserver::EUSB) ) - { - LOG("[CTemplateSettings] Templates dropped"); - dropTemplates = ETrue; - } - - LOG1("CTemplateSettings: Number of templates received from engine: %d",num); - - for ( TInt i( 0 ); i < num; i++ ) - { - templateID = iTemplates[i]->iUid; - - - if( (dropTemplates && (templateID == KOneUpBorderless || templateID == KOneUpBorder || templateID == KOneUpStick || templateID == KFourUpStick || templateID == KSixteenUpStick || templateID == KOneUp )) || !dropTemplates) - { - LOG1("CTemplateSettings: Template ID: %d ADDED", templateID); - User::LeaveIfError( self->iTemplates.Append( iTemplates[i]->CloneL() ) ); - } - else - { - LOG1("CTemplateSettings: Template ID: %d SKIPPED",templateID); - } - } - - CleanupStack::Pop(); // self - return self; - } - -// Sets the new active template -void CTemplateSettings::SetActiveTemplateL( - TInt aUid ) - { - LOG1( "CTemplateSettings:SetActiveTemplateL || aUid = %d", aUid ); - TInt err( KErrNotFound ); - - TInt num( iTemplates.Count() ); - for ( TInt i( 0 ); i < num && err != KErrNone; i++ ) - { - if ( aUid == iTemplates[i]->iUid ) - { - iActiveTemplateUid = aUid; - err = KErrNone; - } - } - LOG2( "CTemplateSettings:SetActiveTemplateL uid: %d, err: %d", aUid, err ); - // Leave when not found - User::LeaveIfError( err ); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/ctintcapability.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/ctintcapability.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "ctintcapability.h" - -const TInt KMaxTIntCharNum( 11 ); - -// Destructor -CTIntCapability::~CTIntCapability() - { - } - -// Creates text string for the settings list box -HBufC* CTIntCapability::ListBoxTextL() - { - const TInt KGranularity( 4 ); - TBuf numStr; - numStr.Zero(); - numStr.AppendNum( iValue ); - - CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KGranularity ); - CleanupStack::PushL( strings ); - strings->AppendL( iTitle ); - strings->AppendL( numStr ); - - HBufC* buf = StringLoader::LoadL( R_QTN_LBOX_FORMAT, *strings ); - CleanupStack::PopAndDestroy(); // strings - - return buf; - } - -// Displays pop-up list for changing the active TInt value -TBool CTIntCapability::LaunchPopupListL() - { - CAknIntegerSettingPage* page = - new ( ELeave ) CAknIntegerSettingPage( - &iTitle, EAknSettingPageNoOrdinalDisplayed, EAknCtIntegerEdwin, - R_DEF_INTEGER_EDITOR, 0, iValue ); - CleanupStack::PushL( page ); - page->ConstructL(); - CleanupStack::Pop(); // page - page->IntegerEditorControl()->SetMinimumIntegerValue( iMin ); - page->IntegerEditorControl()->SetMaximumIntegerValue( iMax ); - TBool changed = page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); - - return changed; - } - -// Clones itself -CBaseCapability* CTIntCapability::CloneL() - { - CTIntCapability* clone = new ( ELeave ) CTIntCapability; - - clone->iIndexOnList = iIndexOnList; - clone->iMax = iMax; - clone->iMin = iMin; - clone->iTitle = iTitle; - clone->iUid = iUid; - clone->iValue = iValue; - - return clone; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/settingsconverter.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/settingsconverter.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,220 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "settingsconverter.h" -#include "ctintcapability.h" -#include "clistcapability.h" -#include "cfloatcapability.h" -#include "stringids.h" -#include "tprintcapability.h" -#include "imageprintvariant.h" -#include "clog.h" -#include "crealfactory.h" - -const TInt KEngineLimitValue( -1 ); -const TInt KMenuItemsRequired( 2 ); - -// Converts TCapability to CTIntCapability -CTIntCapability* SettingsConverter::AddTIntCapabilityLC( - TPrintCapability& aCapability, - TInt aIndexOnList, - TInt aCapabUid ) - { - LOG("SettingsConverter::AddTIntCapabilityLC Begin"); - CTIntCapability* intC = new ( ELeave ) CTIntCapability; - CleanupStack::PushL( intC ); - - // If engine returns KEngineLimitValue as low/high limit then it means - // that there is no minimum or maximum limit - if ( aCapability.iLow == KEngineLimitValue ) - { - intC->iMax = KMinTInt32; - } - else - { - intC->iMin = aCapability.iLow; - } - - if ( aCapability.iHigh == KEngineLimitValue ) - { - intC->iMax = KMaxTInt32; - } - else - { - intC->iMax = aCapability.iHigh; - } - - // Initialize TInt capability and return it - intC->iTitle = SettingsConverter::TextStringLC( aCapabUid )->Des(); - CleanupStack::PopAndDestroy(); // SettingsConverter text string - intC->iIndexOnList = aIndexOnList; - intC->iUid = aCapabUid; - intC->iValue = aCapability.iDefaultValue; - - LOG("SettingsConverter::AddTIntCapabilityLC End"); - return intC; - } - -// Converts TCapability to CListCapability -CListCapability* SettingsConverter::AddListCapabilityLC( - TPrintCapability& aCapability, - TInt aIndexOnList, - TInt aCapabUid, - CRealFactory* aFactory ) - { - LOG("SettingsConverter::AddListCapabilityLC Begin"); - CListCapability* listC = new ( ELeave ) CListCapability( aFactory ); - CleanupStack::PushL( listC ); - listC->iIndexOnList = aIndexOnList; - listC->iUid = aCapabUid; - - /* There's a problem with some usb printers: - They offer "normal" print quality twice and nothing else. - This has to be handled so that user is not shown the option - as he cannot change it anyway in this case */ - TBool qualityDuplicates = EFalse; - if ( aCapabUid == EPrintCapabQuality && - aCapability.iEnumCount == KMenuItemsRequired ) - { - if ( aCapability.iEnumCodes[0] == aCapability.iEnumCodes[1] ) - { - LOG("SettingsConverter::AddListCapabilityLC duplicate quality detected!"); - qualityDuplicates = ETrue; - } - } - - // If there is only one value for certain capability, empty - // title is added so the capability is not visible on the - // settings menu. - if( aCapability.iEnumCount < KMenuItemsRequired || qualityDuplicates ) - { - listC->iTitle = SettingsConverter::TextStringLC( 0 )->Des(); - } - else - { - listC->iTitle = SettingsConverter::TextStringLC( aCapabUid )->Des(); - } - - CleanupStack::PopAndDestroy(); // SettingsConverter text string - listC->iValue = aCapability.iDefaultValue; - - TBool enumLabels = listC->iTitle.CompareF( KNullDesC() ) != 0; - TInt i( 0 ); - TInt num( aCapability.iEnumCount ); - for ( i = 0; i < num; i++ ) - { - User::LeaveIfError( - listC->iEnumIDs.Append( aCapability.iEnumCodes[i] ) ); - - // Find matching text for the enumeration if the capability is - // visible on the settings view -#ifdef IMG_PRINT_DYNAMIC_PRINT_SETTINGS - if ( enumLabels || aCapability.iEnumCount < KMenuItemsRequired ) -#else - // Not for layout if no dynamic print settings - if (( enumLabels || aCapability.iEnumCount < KMenuItemsRequired ) && - aCapabUid != EPrintCapabLayout ) -#endif - { - LOG("SettingsConverter::AddListCapabilityLC Adding real value"); - User::LeaveIfError( listC->iTexts.Append( - SettingsConverter::TextStringLC( aCapability.iEnumCodes[i] ))); - CleanupStack::Pop(); // SettingsConverter text string - } - else - { - LOG("SettingsConverter::AddListCapabilityLC Adding EMPTY value"); - User::LeaveIfError( listC->iTexts.Append( - StringLoader::LoadLC( R_EMPTY ) ) ); - CleanupStack::Pop(); // SettingsConverter text string - } - } - - if ( aCapability.iEnumCount > 0 ) - { - i = 0; - // Check that current active capability code is found from the - // list of codes and activate first one if not found - TInt num( aCapability.iEnumCount ); - while ( i < num && - listC->iValue != aCapability.iEnumCodes[i] ) - { - i++; - } - if ( i >= aCapability.iEnumCount ) - { - listC->iValue = aCapability.iEnumCodes[0]; - } - } - - LOG("SettingsConverter::AddListCapabilityLC End"); - return listC; - } - -// Converts TCapability to CFloatCapability -CFloatCapability* SettingsConverter::AddFloatCapabilityLC( - TPrintCapability& aCapability, - TInt aIndexOnList, - TInt aCapabUid ) - { - LOG("SettingsConverter::AddFloatCapabilityLC Begin"); - CFloatCapability* floatC = new ( ELeave ) CFloatCapability; - CleanupStack::PushL( floatC ); - - floatC->iIndexOnList = aIndexOnList; - floatC->iUid = aCapabUid; - floatC->iTitle = SettingsConverter::TextStringLC( aCapabUid )->Des(); - CleanupStack::PopAndDestroy(); // SettingsConverter text string - - floatC->SetValues( aCapability.iLow, - aCapability.iDefaultValue, aCapability.iHigh ); - - LOG("SettingsConverter::AddFloatCapabilityLC End"); - return floatC; - } - -// Fetches text string based on the enumeration ID -HBufC* SettingsConverter::TextStringLC( - TInt aId ) - { - LOG1("SettingsConverter::TextStringLC Begin: %d", aId ); - HBufC* buf = 0; - TBool found( EFalse ); - - TInt i( 0 ); - for ( i = 0; i < KConverterTableCount && !found; i++ ) - { - if ( aId == KIDConverterTable[i][0] ) - { - buf = StringLoader::LoadLC( KIDConverterTable[i][1] ); - found = ETrue; - } - } - - if ( !found ) - { - User::Leave( KErrNotFound ); - } - - LOG("SettingsConverter::TextStringLC End"); - return buf; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprinteng/src/tpreviewimageinfo.cpp --- a/ImagePrint/ImagePrintUI/imageprinteng/src/tpreviewimageinfo.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004-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 "tpreviewimageinfo.h" - -// Default constructor -TPreviewImageInfo::TPreviewImageInfo() - { - // Means that the image won't get rotated by default - iRotated = EFalse; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/group/aiwprintingprovider.mmp --- a/ImagePrint/ImagePrintUI/imageprintprovider/group/aiwprintingprovider.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "aiwprintingprovideruid.h" - -TARGET aiwprintingprovider.dll - -#ifndef S60_2_6_BASE -TARGETTYPE PLUGIN -#else -TARGETTYPE ECOMIIC -#endif -CAPABILITY CAP_ECOM_PLUGIN -UID 0x10009D8D KAiwPrintingProviderDllUid -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE dllmain.cpp -SOURCE caiwprintpreviewprovider.cpp -SOURCE caiwimageprintif.cpp - -USERINCLUDE ../../../clog/inc -USERINCLUDE . ../inc ../../inc -USERINCLUDE ../rss -USERINCLUDE ../../imageprinteng/inc -USERINCLUDE ../../imgpprintdll/inc -USERINCLUDE ../../imageprintapp/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintServer/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintLibrary/inc - -APP_LAYER_SYSTEMINCLUDE - -START RESOURCE ../rss/101ffaa2.rss -TARGET aiwprintingprovider.rsc -END - -START RESOURCE ../rss/aiwprintingprovider.rss -#ifdef __S60_50__ - LANGUAGE_IDS -#else - LANG SC -#endif -HEADER -TARGET aiwprintingprovider.rsc -TARGETPATH resource -END - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY cone.lib -LIBRARY ecom.lib -LIBRARY servicehandler.lib -LIBRARY estor.lib -LIBRARY apgrfx.lib -LIBRARY apparc.lib -LIBRARY ws32.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY avkon.lib -LIBRARY imgpprintdll.lib -LIBRARY caf.lib -LIBRARY imageconversion.lib -LIBRARY platformenv.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/group/aiwprintingprovideruid.h --- a/ImagePrint/ImagePrintUI/imageprintprovider/group/aiwprintingprovideruid.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004-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 AIFPRINTINGPROVIDERUID_H -#define AIFPRINTINGPROVIDERUID_H - -#define KAiwPrintingProviderDllUid 0x101FFAA2 -#define KAiwPrintingProviderImplUid 0x101FFAA3 -#define KAiwPrintPreviewProviderImplUid 0x101FFAA4 - -#endif // AIFPRINTINGPROVIDERUID_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/group/bld.inf --- a/ImagePrint/ImagePrintUI/imageprintprovider/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2004-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 - -PRJ_EXPORTS - -PRJ_MMPFILES - -aiwprintingprovider.mmp - -PRJ_TESTMMPFILES - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/inc/caiwimageprintif.h --- a/ImagePrint/ImagePrintUI/imageprintprovider/inc/caiwimageprintif.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2004-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 CAIWIMAGEPRINTIF_H -#define CAIWIMAGEPRINTIF_H - -#include -#include -#include - -class CAiwImagePrintIf : public CAiwServiceIfMenu -{ - public: - - ~CAiwImagePrintIf(); - - public: - - CDesCArrayFlat* GetImageArrayL( const CAiwGenericParamList& aInParamList ); - - protected: - - CAiwImagePrintIf(); - - protected: // From CAiwServiceIfMenu - - TBool IsPrintingSupportedL( const CAiwGenericParamList& aInParamList ); - - TBool IsPrintingSupportedL( const TDesC& aFileName ); - - TBool IsProtectedL( const TDesC& aFileName ); - - TBool CheckMIMETypeL( const TDesC8& aMimeType, const TDesC& aFileName ); - - protected: // Implementation - void ConstructL(); - - protected: // data - - CEikonEnv& iEikEnv; //Allow CAiwPrintingProvider and CAiwPreviewProvider - //to use Eikon Environment without CEikonEnv::Static() - - private: //data - - TInt iResourceOffset; - -}; - -#endif // CAIWIMAGEPRINTIF_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/inc/caiwprintpreviewprovider.h --- a/ImagePrint/ImagePrintUI/imageprintprovider/inc/caiwprintpreviewprovider.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2004-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 CAIWPRINTPREVIEWPROVIDER_H -#define CAIWPRINTPREVIEWPROVIDER_H - -#include -#include -#include - -#include "caiwimageprintif.h" - -const TUid KPrintPropertyCat = {0x10012345}; -enum TPrintPropertyKeys - { - EPrintProperty, - }; - -enum - { - ENotAiwCall, - EAiwPrintCall, - EAiwQuickPrintCall - }; - -class CAiwPrintPreviewProvider : - public CAiwImagePrintIf, - public MAknServerAppExitObserver - - { - public: //Constructors and destructors - static CAiwPrintPreviewProvider* NewL(); - - ~CAiwPrintPreviewProvider(); - - public: // from MAknServerAppExitObserver - void HandleServerAppExit( TInt aReason ); - - private: // Implementation - void LaunchImagePrintApplicationL(); - - private: // From CAiwImagePrintIf - void InitialiseL(MAiwNotifyCallback& aFrameworkCallback, - const RCriteriaArray& aInterest); - - - void HandleServiceCmdL( const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt aCascadeId, - const CAiwGenericParamList& aInParamList); - - void HandleMenuCmdL( TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - void HandleLaunchRequestL( const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - const MAiwNotifyCallback* aCallback = NULL); - - private: // Data - CAknLaunchAppService* iService; - - const CAiwGenericParamList *iConsumerInParamList; - CAiwGenericParamList *iConsumerOutParamList; - const MAiwNotifyCallback *iConsumerCallback; - }; - -#endif // CAIWPRINTPREVIEWPROVIDER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/rss/101ffaa2.rss --- a/ImagePrint/ImagePrintUI/imageprintprovider/rss/101ffaa2.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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 -#include - -#include "aiwprintingprovideruid.h" - -RESOURCE REGISTRY_INFO theInfo - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = KAiwPrintingProviderDllUid; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KAiwClassMenu; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KAiwPrintingProviderImplUid; - version_no = 1; - display_name = "Image Print"; - default_data = "image/jpeg"; - opaque_data = KAiwCmdPrintStr; - } - }; - }, - INTERFACE_INFO - { - interface_uid = KAiwClassBase; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KAiwPrintingProviderImplUid; - version_no = 1; - display_name = "Image Print"; - default_data = "image/jpeg"; - opaque_data = KAiwCmdPrintStr; - } - }; - } - }; - } diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/rss/aiwprintingprovider.hrh --- a/ImagePrint/ImagePrintUI/imageprintprovider/rss/aiwprintingprovider.hrh Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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 - -enum TPrintingCommands - { - ECmdPrint = 0x101F8725,//KAiwCmdSynchronize + 1, - ECmdQuickPrint - }; diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/rss/aiwprintingprovider.rss --- a/ImagePrint/ImagePrintUI/imageprintprovider/rss/aiwprintingprovider.rss Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -* -*/ - - -NAME AAAA // AIW Printing Provider - -#include -#include -#include -#include -#include - -/** - * Standard resource signature - */ -RESOURCE RSS_SIGNATURE { } - -RESOURCE MENU_PANE r_aiw_preview_printing_provider_menu - { - items= - { - MENU_ITEM - { - command = KAiwCmdPrint; - txt = qtn_aiw_command_print; - } - }; - } - -// End of File - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/src/caiwimageprintif.cpp --- a/ImagePrint/ImagePrintUI/imageprintprovider/src/caiwimageprintif.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include - -#include "caiwimageprintif.h" -#include "cimgpprintutils.h" - -using namespace ContentAccess; - -#ifndef __WINS__ -_LIT( KResourceFile, "aiwprintingprovider.rsc" ); -_LIT(KResourceFilePath, "z:\\resource\\"); -#else -_LIT(KResourceFile, "z:\\resource\\aiwprintingprovider.rsc"); -#endif - -_LIT8( KJpegFileType, "image/jpeg" ); -_LIT( KJpegFileType16, "image/jpeg" ); - -CAiwImagePrintIf::~CAiwImagePrintIf() - { - iEikEnv.DeleteResourceFile( iResourceOffset ); - } - -CAiwImagePrintIf::CAiwImagePrintIf():iEikEnv( *CEikonEnv::Static() ) - { - } - -void CAiwImagePrintIf::ConstructL() - { -#ifndef __WINS__ - TFileName file; - TParse parse; - parse.Set( file, NULL, NULL ); - file.Append(KResourceFilePath); - file.Append( KResourceFile ); -#else - TFileName file( KResourceFile ); -#endif - BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), file ); - iResourceOffset = iEikEnv.AddResourceFileL( file ); - } - -// Get image array -CDesCArrayFlat* CAiwImagePrintIf::GetImageArrayL( const CAiwGenericParamList& aInParamList ) - { - CDesCArrayFlat* imageFiles = new (ELeave) CDesCArrayFlat(5); //image list for the application - CleanupStack::PushL( imageFiles ); - TInt index = 0; - const TAiwGenericParam* param = aInParamList.FindFirst(index, - EGenericParamFile, - EVariantTypeDesC); - TFileName filename; - - while ( index != KErrNotFound ) - { - filename.Copy( param->Value().AsDes() ); - - if ( IsPrintingSupportedL( filename ) ) - { - imageFiles->AppendL( filename ); - } - param = aInParamList.FindNext(index, - EGenericParamFile, - EVariantTypeDesC); - } - - CleanupStack::Pop( imageFiles ); - return imageFiles; - } - -TBool CAiwImagePrintIf::IsPrintingSupportedL( const CAiwGenericParamList& aInParamList ) - { - TInt index(0); - const TAiwGenericParam* param = aInParamList.FindFirst( index, EGenericParamMIMEType ); - TBool printable( EFalse ); - - // Currently Media Gallery does not offer MIME-parameter in aInParamList (Fix exists). - // Because of that there is checked directly from files if printing is supported - // This is slow and because of this should be deleted when MG offers MIMEs as parameter. - if ( index == KErrNotFound ) - { - index = 0; - const TAiwGenericParam* param = aInParamList.FindFirst(index, EGenericParamFile, EVariantTypeDesC); - - //Check if there is any printable images available. At least image must be - //JPEG and it also must be unprotected to be printable. - while ( index != KErrNotFound && !printable) - { - TRAP_IGNORE( printable = IsPrintingSupportedL( param->Value().AsDes() )); - param = aInParamList.FindNext(index, EGenericParamFile, EVariantTypeDesC); - } - return printable; - } - //End of "To be removed" section - - while ( index != KErrNotFound && !printable ) - { - if ( param->Value().TypeId() == EVariantTypeDesC && - param->Value().AsDes() == KJpegFileType16 ) - { - // MIME-type parameter follows filename parameter in parameter list. - // Because of that previous item in list is used. - if (index > 0) - { - printable = !IsProtectedL( aInParamList[index-1].Value().AsDes() ); - } - } - - if ( !printable ) - { - param = aInParamList.FindNext(index, EGenericParamMIMEType); - } - } - - return printable; - } - -TBool CAiwImagePrintIf::IsPrintingSupportedL( const TDesC& aFileName ) - { - //1. check: Mimetype should be correct (JPEG) - TBool printable = CheckMIMETypeL( KJpegFileType, aFileName ); - - if (printable) - { - //2. check: file should not be protected - printable = !IsProtectedL( aFileName ); - } - - return printable; - } - -TBool CAiwImagePrintIf::IsProtectedL( const TDesC& aFileName ) - { - CContent* content = NULL; - content = CContent::NewLC( aFileName ); - TInt isDrmProtected( 0 ); - TInt err = content->GetAttribute( EIsProtected, isDrmProtected ); - CleanupStack::PopAndDestroy(); // content - return err ? ETrue : isDrmProtected; - } - - -TBool CAiwImagePrintIf::CheckMIMETypeL( const TDesC8& aMimeType, - const TDesC& aFileName ) - { - TBuf8<128> mimeType(0); - CImageDecoder::GetMimeTypeFileL(iEikEnv.FsSession(), aFileName, mimeType); - - // Check that MIME-type matches (compare returns 0), otherwise return EFalse - return mimeType.CompareF( aMimeType ) ? EFalse : ETrue; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/src/caiwprintpreviewprovider.cpp --- a/ImagePrint/ImagePrintUI/imageprintprovider/src/caiwprintpreviewprovider.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "clog.h" -#include "caiwprintpreviewprovider.h" -#include "aiwprintingprovider.hrh" -#include "caiwimageprintif.h" -#include "imageprint.h" -#include "cimgpprintutils.h" - -CAiwPrintPreviewProvider* CAiwPrintPreviewProvider::NewL() - { - - CAiwPrintPreviewProvider* self = new( ELeave ) CAiwPrintPreviewProvider; - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -CAiwPrintPreviewProvider::~CAiwPrintPreviewProvider() - { - delete iService; - } - -void CAiwPrintPreviewProvider::InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) - { - } - - -void CAiwPrintPreviewProvider::HandleServiceCmdL(const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback) - - { - if ( aCmdId == KAiwCmdPrintPreview || aCmdId == KAiwCmdPrint ) - { - HandleLaunchRequestL( aInParamList, aOutParamList, aCallback ); - LaunchImagePrintApplicationL(); - } - } - - - -void CAiwPrintPreviewProvider::InitializeMenuPaneL - ( CAiwMenuPane& aMenuPane, TInt aIndex, - TInt /*aCascadeId*/, const CAiwGenericParamList& aInParamList ) - { - - if ( IsPrintingSupportedL( aInParamList ) ) - { - LOG("CAiwPrintPreviewProvider::InitializeMenuPaneL 1"); - TResourceReader reader; - iEikEnv.CreateResourceReaderLC - ( reader, R_AIW_PREVIEW_PRINTING_PROVIDER_MENU ); - aMenuPane.AddMenuItemsL( reader, KAiwCmdPrint, aIndex ); - CleanupStack::PopAndDestroy(); // reader - LOG("CAiwPrintPreviewProvider::InitializeMenuPaneL 2"); - } - - } - -void CAiwPrintPreviewProvider::HandleMenuCmdL - ( TInt aMenuCmdId, const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback) - { - if ( aMenuCmdId == KAiwCmdPrintPreview || aMenuCmdId == KAiwCmdPrint ) - { - HandleLaunchRequestL( aInParamList, aOutParamList, aCallback ); - LaunchImagePrintApplicationL(); - } - } - -void CAiwPrintPreviewProvider::HandleLaunchRequestL - (const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - const MAiwNotifyCallback* aCallback) - { - iConsumerInParamList = &aInParamList; - iConsumerOutParamList = &aOutParamList; - iConsumerCallback = aCallback; - - TFileName paramFile; - CIMGPPrintUtils::GetDataFilePathL( paramFile ); - - RFileWriteStream writeStream; - User::LeaveIfError( writeStream.Replace( iEikEnv.FsSession(), paramFile, EFileWrite) ); - writeStream.PushL(); - aInParamList.ExternalizeL( writeStream ); - writeStream.CommitL(); - CleanupStack::PopAndDestroy( &writeStream ); - - TInt err = RProperty::Define( KPrintPropertyCat, EPrintProperty, RProperty::EInt ); - - if ( err != KErrAlreadyExists ) - { - User::LeaveIfError( err ); - } - RProperty::Set( KPrintPropertyCat,EPrintProperty,EAiwPrintCall ); - } - -void CAiwPrintPreviewProvider::LaunchImagePrintApplicationL() - { - TUid appuid; - appuid.iUid = 0x101FFA84; - TRAPD( err, iService = CAknLaunchAppService::NewL( appuid, this, NULL ) ); - if ( err != KErrNone ) - { - LOG1("CAiwPrintPreviewProvider::LaunchImagePrintApplicationL failed with: %d", err); - } - } - -void CAiwPrintPreviewProvider::HandleServerAppExit( TInt aReason ) - { - delete iService; - iService = NULL; - - LOG1("CAiwPrintPreviewProvider::HandleServerAppExit: %d", aReason); - - // In the case that we want to exit also the parent application, - // ImagePrint is exited with User::Exit() which is seen here as - // KErrServerTerminated (-15). - if( iConsumerInParamList && iConsumerOutParamList && iConsumerCallback && iConsumerCallback ) - { - // Const cast is used to fix weirdness in AIW header files. MWaiNotifyCallback - // does not define any const function but CAiwServiceIfMenu interface provides - // const callback object. - TRAP_IGNORE( const_cast(iConsumerCallback)->HandleNotifyL( - KAiwCmdPrintPreview, KAiwEventCompleted, - *iConsumerOutParamList, *iConsumerInParamList )); - iConsumerInParamList = NULL; - iConsumerOutParamList = NULL; - iConsumerCallback = NULL; - } - if ( aReason == KErrServerTerminated ) - { - User::Exit( 0 ); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imageprintprovider/src/dllmain.cpp --- a/ImagePrint/ImagePrintUI/imageprintprovider/src/dllmain.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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: -* -*/ - - -#include -#include - -#include "aiwprintingprovideruid.h" -#include "caiwprintpreviewprovider.h" - -// Define the interface UIDs -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KAiwPrintingProviderImplUid, - CAiwPrintPreviewProvider::NewL) - - }; - -// The one and only exported function that is the ECom entry point -EXPORT_C const TImplementationProxy* ImplementationGroupProxy - (TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/bwins/imgpprintdllu.def --- a/ImagePrint/ImagePrintUI/imgpprintdll/bwins/imgpprintdllu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ?StartPrintingL@CIMGPPrintUtils@@QAEXPAVCDesC16ArrayFlat@@@Z @ 1 NONAME ; void CIMGPPrintUtils::StartPrintingL(class CDesC16ArrayFlat *) - ?SearchDefaultPrinterL@CUIProtocolController@@QAEHXZ @ 2 NONAME ; int CUIProtocolController::SearchDefaultPrinterL(void) - ?CheckMIMEType@CIMGPPrintUtils@@SAHABVTDesC8@@ABV?$TBuf@$0BAA@@@@Z @ 3 NONAME ; int CIMGPPrintUtils::CheckMIMEType(class TDesC8 const &, class TBuf<256> const &) - ?NewL@CUIProtocolController@@SAPAV1@PAVMProtocolObserver@@AAVCIFFactory@@@Z @ 4 NONAME ; class CUIProtocolController * CUIProtocolController::NewL(class MProtocolObserver *, class CIFFactory &) - ?NewL@CIMGPPrintUtils@@SAPAV1@PAVMAiwObserver@@@Z @ 5 NONAME ; class CIMGPPrintUtils * CIMGPPrintUtils::NewL(class MAiwObserver *) - ?ChangeDefaultPrinterL@CUIProtocolController@@QAEHH@Z @ 6 NONAME ; int CUIProtocolController::ChangeDefaultPrinterL(int) - ?StartPrintingL@CIMGPPrintDlgManager@@QAEXXZ @ 7 NONAME ; void CIMGPPrintDlgManager::StartPrintingL(void) - ?NewL@CIMGPPrintDlgManager@@SAPAV1@HPAVMPrintJob@@IHIPAVCIMGPPrintUtils@@PAVMPrintingObserver@@@Z @ 8 NONAME ; class CIMGPPrintDlgManager * CIMGPPrintDlgManager::NewL(int, class MPrintJob *, unsigned int, int, unsigned int, class CIMGPPrintUtils *, class MPrintingObserver *) - ?GetDataFilePathL@CIMGPPrintUtils@@SAXAAV?$TBuf@$0BAA@@@@Z @ 9 NONAME ; void CIMGPPrintUtils::GetDataFilePathL(class TBuf<256> &) - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/eabi/imgpprintdllu.def --- a/ImagePrint/ImagePrintUI/imgpprintdll/eabi/imgpprintdllu.def Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - _ZN15CIMGPPrintUtils13CheckMIMETypeERK6TDesC8RK4TBufILi256EE @ 1 NONAME - _ZN15CIMGPPrintUtils14StartPrintingLEP16CDesC16ArrayFlat @ 2 NONAME - _ZN15CIMGPPrintUtils4NewLEP12MAiwObserver @ 3 NONAME - _ZN20CIMGPPrintDlgManager14StartPrintingLEv @ 4 NONAME - _ZN20CIMGPPrintDlgManager4NewLEiP9MPrintJobjijP15CIMGPPrintUtilsP17MPrintingObserver @ 5 NONAME - _ZN21CUIProtocolController21ChangeDefaultPrinterLEi @ 6 NONAME - _ZN21CUIProtocolController21SearchDefaultPrinterLEv @ 7 NONAME - _ZN21CUIProtocolController4NewLEP17MProtocolObserverR10CIFFactory @ 8 NONAME - _ZTI15CIMGPPrintUtils @ 9 NONAME ; ## - _ZTI17CCustomNoteDialog @ 10 NONAME ; ## - _ZTI20CDiscoveryDlgManager @ 11 NONAME ; ## - _ZTI20CIMGPPrintDlgManager @ 12 NONAME ; ## - _ZTI21CIMGPPrintProgressDlg @ 13 NONAME ; ## - _ZTI21CUIProtocolController @ 14 NONAME ; ## - _ZTV15CIMGPPrintUtils @ 15 NONAME ; ## - _ZTV17CCustomNoteDialog @ 16 NONAME ; ## - _ZTV20CDiscoveryDlgManager @ 17 NONAME ; ## - _ZTV20CIMGPPrintDlgManager @ 18 NONAME ; ## - _ZTV21CIMGPPrintProgressDlg @ 19 NONAME ; ## - _ZTV21CUIProtocolController @ 20 NONAME ; ## - _ZN15CIMGPPrintUtils16GetDataFilePathLER4TBufILi256EE @ 21 NONAME - diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/group/bld.inf --- a/ImagePrint/ImagePrintUI/imgpprintdll/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2004-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 - -PRJ_EXPORTS - -PRJ_MMPFILES - -imgpprintdll.mmp - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/group/imgpprintdll.mmp --- a/ImagePrint/ImagePrintUI/imgpprintdll/group/imgpprintdll.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include - -#include "../../inc/logdef.h" - -deffile imgpprintdll.def - -TARGET imgpprintdll.dll -TARGETTYPE dll - -CAPABILITY CAP_GENERAL_DLL -UID 0x1000008d 0x101FFAA1 -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE cimgpprintdlgmanager.cpp -SOURCE imgpprintapputil.cpp -SOURCE cimgpprintprogressdlg.cpp -SOURCE cimgpprintutils.cpp -SOURCE cdiscoverydlgmanager.cpp -SOURCE cuiprotocolcontroller.cpp -SOURCE ccustomnotedialog.cpp - -USERINCLUDE . ../inc ../../inc -USERINCLUDE ../../imageprintapp/inc -USERINCLUDE ../../imageprintprovider/inc -USERINCLUDE ../../imageprinteng/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintServer/inc -USERINCLUDE ../../../ImagePrintEngine/ImagePrintLibrary/inc -USERINCLUDE ../../../clog/inc - -APP_LAYER_SYSTEMINCLUDE - -STATICLIBRARY clog.lib -DEBUGLIBRARY flogger.lib - -LIBRARY euser.lib -LIBRARY avkon.lib -LIBRARY eikcore.lib -LIBRARY cone.lib -LIBRARY eikcoctl.lib -LIBRARY commonengine.lib -LIBRARY fbscli.lib -LIBRARY aknskins.lib -LIBRARY efsrv.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY bafl.lib -LIBRARY imageprintengine.lib -LIBRARY usbman.lib -LIBRARY aknicon.lib -LIBRARY egul.lib -LIBRARY imageconversion.lib -LIBRARY imageprintclient.lib -LIBRARY aknnotify.lib // CAknGlobalMsgQuery -LIBRARY eiksrv.lib // CAknGlobalMsgQuery -LIBRARY apgrfx.lib // RApaLsSession -LIBRARY platformenv.lib -LIBRARY apparc.lib - -LIBRARY centralrepository.lib // Repository -LIBRARY ecom.lib // WLAN wizard -LIBRARY upnpapplicationengine.lib -LIBRARY upnpcommand.lib - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/ccustomnotedialog.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/ccustomnotedialog.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: -* -*/ - - -#ifndef CCUSTOMNOTEDIALOG_H -#define CCUSTOMNOTEDIALOG_H - -#include -#include // mprogressdialogcallback - -class CCustomNoteDialog : public CAknNoteDialog - { - public: - static CCustomNoteDialog* NewL( CEikDialog** aSelfPtr ); - static CCustomNoteDialog* NewLC( CEikDialog** aSelfPtr ); - ~CCustomNoteDialog(); - - CCustomNoteDialog( CEikDialog** aSelfPtr ); - - public: // Methods derived from MProgressDialogCallback - void SetCallback( MProgressDialogCallback* aCallback ); - - private: - void ConstructL(); - - private: - MProgressDialogCallback* iCallback; - - }; - -#endif // CCUSTOMNOTEDIALOG_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/cdiscoverydlgmanager.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/cdiscoverydlgmanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2004-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 CDISCOVERYDLGMANAGER_H -#define CDISCOVERYDLGMANAGER_H - -#include -#include -#include -#include -#include - -#include "mdiscoveryobserver.h" -#include "mdiscovery.h" - -class CAknWaitDialog; -class CImagePrintAppUi; -class MPrintSettings; -class CIFFactory; - -// CONSTANTS -const TInt KMaxPrinterNameLength( 84 ); - -// CLASS DEFINITION -/** - * - * CDiscoveryDlgManager is a class that is responsible of displaying the pop-up - * list at the beginning containing the available medias/devices to print to. - * - */ -class CDiscoveryDlgManager - : public CBase, - public MDiscoveryObserver, - public MProgressDialogCallback - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aDiscovery Discovery IF - * - * @return Initialized instance of the class - */ - static CDiscoveryDlgManager* NewL( CIFFactory& aIFFactory ); - static CDiscoveryDlgManager* NewLC( CIFFactory& aIFFactory); - - /** - * Destructor - */ - virtual ~CDiscoveryDlgManager(); - - protected: // Constructors and destructors - - /** - * Default constructor - * @param aDiscovery Discovery IF - */ - CDiscoveryDlgManager(); - - /** - * 2nd phase constructor - */ - void ConstructL( CIFFactory& aIFFactory ); - - public: // Methods derived from MDiscoveryObserver - - void NotifyNewPrintDeviceL( HBufC* aText, TInt aUid, TBool aCached, - TPrinterType aType, TUint aVendor ); - void DiscoveryError( TInt aErrCode ); - void DeviceDiscoveryCompleted(); - void RemoveCachedPrinterL( TInt aUid ) ; - - public: // from MProgressDialogCallback - - void DialogDismissedL( TInt aButtonId ); - - public: // New methods - - /** - * Starts the dialog manager, displays pop-up window where - * the found printers are placed - * - * @param aProtocol Specific protocol to searh for. ( all - * available as default ) - * - * @param aHidden True will not launch popup list. This will also - * select the found printer to be the printer in use. - * ( EFalse as default ). Note that this can only be used - * with specific protocol and with BT first found printer - * will be selected. - * - * - * @return ETrue = printer has been selected succesfully - * EFalse = not - */ - TBool StartDlgManagerL( TInt aProtocol = 0, TBool aHidden = EFalse); - - TInt PrinterUid() const; - /** - * Returns the chosen printer's name - */ - const TDesC& PrinterName() const; - /* - * Was the selected printer USB printer - */ - TBool USBPrinterSelected() const; - - /* - * Canceling discovery and close device popuplist. - */ - void CancelDiscovery(); - - private: // New methods - - /** - * Creates the pop-up list around the instance's list box - * - * @return Initialized instance of the pop-up list - */ - CAknPopupList* CreatePopupListL(); - - /** - * Adds new device to list, updates popup list - * - * @param aText Textual description of the new print device - * @param aUid Uid that is associated with the print device - * @param aCached Is printer cached or not? - * @param aType Printer type - * @param aVendor Printer brand - */ - void AddNewDeviceToListL( HBufC* aText, TInt aUid, TBool aCached, - TPrinterType aType, TUint aVendor ); - - /** - * Show "restart discovery" query and start the discovery again - * if it is so desired - */ - void RestartDiscoveryL(); - - /** - * Removes cached icons from the list - */ - void RemoveCachedIconsL(); - - /** - * Adds "search again" text to pop-up list - */ - void AddSearchAgainTextL(); - - /** - * Pop up a wait note during cancellation operation - */ - void ShowCancelWaitNoteL(); - - TBool StartNormalDiscoveryL(); - - TBool StartHiddenDiscoveryL(); - - /* - * @function AccessPointExistsL - * @description Checks if access point is defined - * @return TBool - */ - TBool WlanAccessPointExistsL(); - - /* - * @function TryWlanDiscoveryL - * @description Try WLAN discovery - * Checks if AP is defined - if not, launches WLAN wizard - * @return TBool - */ - TBool TryDeviceDiscoveryL( TUint aProtocols, TBool aSingleDiscovery ); - - private: // Data - - // Listbox for popup list - CAknSingleGraphicPopupMenuStyleListBox* iListBox; - - // The popup list - CAknPopupList* iPopupList; - - // Array for profile names - CDesCArrayFlat* iListOfDeviceNames; - - // Pointer to engine discovery interface - MDiscovery* iDiscovery; - - // True if popup window is active - TBool iActivePopup; - - // Array of printer UIDs - CArrayFixFlat* iUidArray; - - // Array of printer Protocols - CArrayFixFlat* iProtocolArray; - - // Array of printer brands - CArrayFixFlat* iBrandArray; - - // Selected printer's name - HBufC* iPrinterName; - - // Supported protocols - TUint iSupportedProtocols; - - // Cancellation wait dialog - CAknWaitDialog* iCancellingDialog; - - // Cancelling state - TBool iCancelling; - - // Discovery status - TBool iDiscoveryCompleted; - - // USB printer id - TInt iUsbPrinterID; - - TBool iUSBPrinterSelected; - - // Hidden discovery flag - TBool iHiddenDiscovery; - - // Printer found flag - TBool iPrinterFound; - - // Searching cancelled flag - TBool iSearchingCancelled; - - // Wait dialog shown while doing hidden discovery - CAknWaitDialog* iHiddenDiscoveryDialog; - - // Array to store printer names - CDesCArray* iNameArray; - - // Indicates whether discovery searches multiple devices (bt/wlan cases) or not - TBool iMultiDiscovery; - - TInt iCurrentPrinterUid; - - // Interface for settings - MPrintSettings* iSettings; - - //Contais "Searching" title text for popup dialog - HBufC* iSearchingText; - - //Contais "Select device" title text for popup dialog - HBufC* iSelectDeviceText; - - //Pointer to active title text - TPtrC iActiveTitleText; - - }; - -#endif // CDISCOVERYDLGMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintdlgmanager.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintdlgmanager.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMGPPRINTDLGMANAGER_H -#define CIMGPPRINTDLGMANAGER_H - -#include -#include -#include - -#include "mprintjobobserver.h" -#include "mprintjob.h" - -class CAknProgressDialog; -class CAknWaitDialog; -class CIMGPPrintUtils; -class MPrintingObserver; - -/** - * - * Print progress dialog manager - handles the user interface of the printing - * - */ -class CIMGPPrintDlgManager - : public CBase, - public MPrintJobObserver, - public MProgressDialogCallback - - { - public: // Constructors and destructors - - /** - * Two-phase constructor - * - * @param aPrintJob Pointer to print job interface - * @param aNumOfPages Number of printed pages - * @param aMMCPrinting Flag to índicate if "printing" to MMC - * @param aVendor printer brand - * @param aPrintUtils pointer to CIMGPPrintUtils class - * @param aPrintingObserver pointer to MPrintingObserver interface - * - * @return Initialized instance of print dialog manager - */ - IMPORT_C static CIMGPPrintDlgManager* NewL( - TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils = NULL, - MPrintingObserver* aPrintingObserver = NULL ); - - /** - * Two-phase constructor - * - * @param aPrintJob Pointer to print job interface - * @param aNumOfPages Number of printed pages - * @param aMMCPrinting Flag to índicate if "printing" to MMC - * @param aVendor printer brand - * @param aPrintUtils pointer to CIMGPPrintUtils class - * @param aPrintingObserver pointer to MPrintingObserver interface - * - * @return Initialized instance of print dialog manager - */ - static CIMGPPrintDlgManager* NewLC( - TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils = NULL, - MPrintingObserver* aPrintingObserver = NULL ); - - /** - * Destructor - */ - virtual ~CIMGPPrintDlgManager(); - - protected: // Constructors and destructors - - /** - * Default constructor - * - * @param aPrintJob Pointer to print job interface - * @param aNumOfPages Number of printed pages - * @param aMMCPrinting Flag to índicate if "printing" to MMC - * @param aVendor printer brand - * @param aPrintUtils pointer to CIMGPPrintUtils class - * @param aPrintingObserver pointer to MPrintingObserver interface - * - */ - CIMGPPrintDlgManager( TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils = NULL, - MPrintingObserver* aPrintingObserver = NULL ); - - private: // Constructor - void ConstructL(); - - - protected: // Methods derived from MPrintJobObserver - - void PrintProgress( TUint aComplete ); - void PrintProgressL( TUint aComplete ); - void JobFinished(); - void JobError( TInt aErrCode, TInt aErrorStringCode ); - void JobStatusEvent ( TInt aErrCode, TInt aErrorStringCode ); - - protected: // Methods derived from MProgressDialogCallback - - void DialogDismissedL( TInt aButtonId ); - - public: // New methods - - /** - * Executes the printing, displays print progress dialog - */ - IMPORT_C void StartPrintingL(); - - protected: // New methods - - /** - * Shows the MMC printing completed dialog - */ - void ShowMMCPrintingCompletedDlgL(); - - /** - * Pop up cancellation wait note - */ - void ShowCancelWaitNoteL(); - - /** - * prepares the progress dialog for showing - */ - void PrepareProgressDialogL(); - - private: - - protected: // Data - - // Pointer to the print job instance - MPrintJob* iPrintJob; - - // Progress dialog - CAknProgressDialog* iDialog; - - // Cancelling dialog - CAknWaitDialog* iCancellingDialog; - - // Cancelling status - TBool iCancelling; - - // Printing cancelled - TBool iPrintingCancelled; - - // Number of pages - TUint iNumOfPages; - - // Is printing from MMC or not (different text displayed) - TBool iMMCPrinting; - - // printer brand - TUint iVendor; - - // Flag to tell if print was cancelled - TBool iCancelled; - - // Used in aiw printing - CIMGPPrintUtils* iPrintUtils; - - // Used in preview printing - MPrintingObserver* iPrintingObserver; // not owned - - // Used to observe is this first time job done note is displayed / 1 job. - TBool iFirstNote; - - // Number of copies to MMC print job done note. - TInt iNoc; - - }; - -#endif // CIMGPPRINTDLGMANAGER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintprogressdlg.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintprogressdlg.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMGPPRINTPROGRESSDLG_H -#define CIMGPPRINTPROGRESSDLG_H - -#include -#include - -/** - * - * Modified print progress dialog to enable "branding bitmap" to appear to - * the bottom of the progress dialog - * - */ -class CIMGPPrintProgressDlg - : public CAknProgressDialog - { - - public: // Constructor and destructor - - /** - * Constructor - * - * @param aSelfPtr Pointer to itself. The pointer needs to be - * valid when the dialog is dismissed and must not - * be on the stack. - * @param aVisibilityDelayOff Cut off the delay at the beginning - */ - CIMGPPrintProgressDlg( CEikDialog** aSelfPtr, TBool aVisibilityDelayOff ); - - /** - * Destructor - */ - virtual ~CIMGPPrintProgressDlg(); - - public: // Methods derived from CAknProgressDialog - - TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, TEventCode aType ); - - void PostLayoutDynInitL(); - - CEikCaptionedControl* GetFirstLineOnFirstPageOrNull(); - - void HandleResourceChange( TInt aType ); - - private: - - /** - * Handles commands coming to the viwe - * @param aCommand The command ID - */ - - }; - -#endif // CIMGPPRINTPROGRESSDLG_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintutils.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/cimgpprintutils.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -/* -* Copyright (c) 2004-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 CIMGPPRINTUTILS_H -#define CIMGPPRINTUTILS_H - -#include -#include -#include -#include - -#include "midleprinteventobserver.h" -#include "rimageprintclient.h" -#include "maiwobserver.h" -#include "mprotocolobserver.h" -#include "mprintjobstatus.h" - -class CAknNavigationDecorator; -class CImagePrintDoc; -class CIMGPPrintDlgManager; -class MPrintSettings; -class CImagePrintEngine; -class MIdlePrintEventObserver; -class CUIProtocolController; - -/** - * - * AppUi class - * - */ -class CIMGPPrintUtils - : public CBase, - public MProtocolObserver, - public MPrintJobStatus - { - - public: // Constructors and destructors - - - /** - * Second phase constructor - */ - IMPORT_C static CIMGPPrintUtils* NewL( MAiwObserver* aAiwObserver ); - static CIMGPPrintUtils* NewLC( MAiwObserver* aAiwObserver ); - void ConstructL( MAiwObserver* aAiwObserver ); - virtual ~CIMGPPrintUtils(); - - void DialogDismissedL(TInt /*aButtonId*/); - -public: // from MPrintJobStatus - void PrintJobProgress( TInt aStatus, - TInt aPercentCompletion, - TInt aJobStateCode ); - void PrintJobError( TInt aError, TInt aErrorStringCode ); - void PrinterStatus( TInt aError, TInt aErrorStringCode ); - - public: // New methods - - - /** - * Starts printing process - */ - IMPORT_C void StartPrintingL( CDesCArrayFlat* aImages ); - - /** - * Starts the BrowserEngine for selecting images - */ - void StartBrowser(); - - /** - * Method is used to forward the selected images to engine. - * - * @param aFileArray, array that contains the selected images. - */ - void SetImageArrayL( CDesCArrayFlat* aFileArray ); - - /** - * Method is used to set the printer UID value in the UI side. - * - * @param aPrinterUID printer uid. - */ - void SetPrinterUID( TInt aPrinterUID ); - - /** - * Method is used to get the printer UID value in the UI side. - * - * @return printer uid. - */ - TInt GetPrinterUID(); - - CImagePrintEngine& Engine() const; - - /** - * Called in aiw printing when printing is completed - */ - void JobFinished(); - - /** - * Called when initial printing didn't succeed because default - * printer was not available. Does printing after full discovery - */ - void RestartPrintingL(); - - public: // static helpers - IMPORT_C static TBool CheckMIMEType( const TDesC8& aMimeType, - const TFileName& aFileName ); - - IMPORT_C static void GetDataFilePathL( TFileName& aFileName ); - - public: // Methods derived from MProtocolObserver - void UsbCableDisconnected(); - - private: // New methods - - /** - * Print - */ - void PrintL(); - - static TInt IdleCallbackL( TAny* aObj ); - - private: // Data - - CIMGPPrintDlgManager* iPrintDlgManager; // use - - // UID of the selected printer - TInt iPrinterUID; - // Application engine - CImagePrintEngine* iEngine; - - TInt iResourceOffset; - TInt iResourceOffset2; - - // Used in aiw printing - MAiwObserver* iAiwObserver; - // Interface for settings - MPrintSettings* iSettings; - // Protocol controller - CUIProtocolController* iProtocolController; - - CIdle* iIdle; - }; - -#endif // CIMGPPRINTUTILS_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/cuiprotocolcontroller.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/cuiprotocolcontroller.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +0,0 @@ -/* -* Copyright (c) 2004-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 CUIPROTOCOLCONTROLLER_H -#define CUIPROTOCOLCONTROLLER_H - -#include -#include -#include -#include - -#include "cdiscoverydlgmanager.h" -#include "mprotocolobserver.h" -#include "midleprinteventobserver.h" -#include "imageprint.h" - -class CIFFactory; -class MIdlePrintEventRegisterIF; -class MDiscovery; -class MPrintSettings; -class CCustomNoteDialog; - -const TUint KAllBTProtocols = KImagePrint_PrinterProtocol_BPP | - KImagePrint_PrinterProtocol_BIP | - KImagePrint_PrinterProtocol_OPP_Printer | - KImagePrint_PrinterProtocol_OPP_PC; - -// CLASS DEFINITION -/** - * - * Class searches printers(protocols) and creates print job for - * selected printer. Class also works as an idle observer. - * - */ -class CUIProtocolController: - public CBase, - public MIdlePrintEventObserver, - public MProgressDialogCallback - { - public: // Constructors and destructors - - /** - * Standard two-phase constructors - * - * @param aProtocolObserver Protocol observer - * @param aIFFactory Interface factory class - * - * @return Initialized instance of the class - */ - IMPORT_C static CUIProtocolController* NewL( MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ); - static CUIProtocolController* NewLC( MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ); - /** - * Destructor. - */ - virtual ~CUIProtocolController(); - - private: - - /** - * Default constructor. - * @param aProtocolObserver Protocol observer - * @param aIFFactory Interface factory class - */ - CUIProtocolController( MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ); - - /** - * Second phase constructor - * - * @param aIFFactory Interface factory class - */ - void ConstructL( CIFFactory& aIFFactory ); - - public: // Methods derived from MIdlePrintEventObserver - void UsbPrinterDisconnected(); - void UsbPrinterConnected(); - void UsbStateChanged( TImgPrintUSBState aState, TInt aError ); - void ReadyToContinue(); - void AsynchronousServerLeave( TInt aError ); - - public: // Methods derived from MProgressDialogCallback - void DialogDismissedL(TInt /*aButtonId*/ ); - - public: // New methods - - /** - * Searches default printer and takes it into use. If default - * printer is not found full searcg is performed. - * - * @return ETrue if printer is succesfully taken into use - * EFalse in all other cases. - */ - IMPORT_C TBool SearchDefaultPrinterL(); - - /** - * Searches printer with a given protocol, takes it into use - * and sets the given protocol as a default one. - * - * @param aProtocol Protocol to be searched for. - * @return ETrue if printer is succesfully taken into use - * EFalse in all other cases. - */ - IMPORT_C TBool ChangeDefaultPrinterL( TInt aProtocol ); - - /** - * Searches for all available printers. - * PrintJob is created after discovery with the selected - * printer. - * - * @return ETrue if printer has been taken into use. - * EFalse in all other cases. - */ - TBool FullSearchL(); - - private: // New methods - - TBool SetDefaultPrinterL( TInt aDefaultProtocol ); - - /** - * Searches the usb printer. Method is synchronous. - * PrintJob is created after discovery has been done. - * - * @return ETrue if PictBridge printer has been taken into use. - * EFalse in all other cases. - */ - TBool SearchUSBPrinterL(); - - /** - * Takes the default BT printer into use. - * PrintJob is created without discovery. - * - * @return ETrue if default BT printer has been taken into use. - * EFalse in all other cases. - */ - TBool SearchDefaultBTPrinterL(); - - /** - * Searches for all available BT printers. - * PrintJob is created after discovery with the selected - * printer. - * - * @return ETrue if BT printer has been taken into use. - * EFalse in all other cases. - */ - TBool SearchBTPrinterL(); - - /** - * Searches for all available UPnP(WLAN) printers. - * PrintJob is created after discovery with the selected - * printer. - * - * @return ETrue if UPnP printer has been taken into use. - * EFalse in all other cases. - */ - TBool SearchUPnPPrinterL(); - - /** - * Takes the default UPnP(WLAN) printer into use - * via hidden discovery - * - * @return ETrue if default UPnP(WLAN) printer has been taken into use. - * EFalse in all other cases. - */ - TBool SearchDefaultUPnPPrinterL(); - - /** - * Takes the MMC into use. - * PrintJob is created without discovery. - * - * @return ETrue if MMC has been taken into use. - * EFalse in all other cases. - */ - TBool SearchMMCPrinterL(); - - /** - * Is Usb cable connected AND in PictBridge mode - * @return ETrue if usb connected and in right mode, EFalse if not. - */ - TBool IsUsbCableConnected(); - - /** - * Displays Connect USB cable -note. - */ - void ShowConnectUsbCableNoteL(); - - private: // Enumerations - - // Different states of device discovery - enum TClassState - { - ENormalState, - EDiscoveryOngoing, - EUSBDisconnectedDuringDiscovery - }; - - private: // Data - - // Observer - MProtocolObserver* iProtocolObserver; - - // Interface for registering idle observer - MIdlePrintEventRegisterIF* iIdleEventRegister; - - // Interface for device discovery - MDiscovery* iDiscovery; - - // Interface for settings - MPrintSettings* iSettings; - - // Interface factory - CIFFactory* iIFFactory; - - // USB connect note - CCustomNoteDialog* iUSBConnectionWaitNote; - - // Usb manager - RUsb iUsbManager; - - // Device state - TUsbDeviceState iDeviceState; - - // Class state related to usb and discovery - TInt iClassState; - - // Discovery dialog manager in case when search all protocols - CDiscoveryDlgManager* iDiscoveryDlgManager; - - // tells that usb is connect during all protocols search. - TBool iStartUsb; - - // indicates that usb connection has terminated at least once - TBool iWasUsbDisconnected; - }; - -#endif // CUIPROTOCOLCONTROLLER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/imgpprintapputil.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/imgpprintapputil.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2004-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 IMGPPRINTAPPUTIL_H -#define IMGPPRINTAPPUTIL_H - -#include - -/** - * - * Utility class that contains small static helper methods to group - * the common functionality - * - */ -class IMGPPrintAppUtil - { - public: - - /** - * Displays error note using given resource id as the text - * - * @param aResourceId Resource ID for the given error text - */ - static void ShowErrorNoteL( TInt aResourceId ); - - /** - * Displays information note using given resource id as the text - * - * @param aResourceId Resource ID for the given error text - */ - static void ShowInfoNoteL( TInt aResourceId ); - - /** - * Displays error note using given error code as the source - * for the text - * - * @param aErrCode Error code - */ - static void ShowErrorMsgL( TInt aErrCode, TInt aErrorStringCode = 0 ); - - /** - * Loads error message specifically created for printer application - * - * @param aErrCode Error code - */ - static HBufC* PrintErrorMsgLC( TInt aErrCode, TInt aErrorStringCode = 0 ); - - /** - * Returns filename with the application path - * - * @param aFileName The filename - * @return filename added to the application path - */ - static TFileName AddApplicationPath( const TDesC& aFileName ); - - private: - static void HandleByStringCodeL( TInt aErrCode, TInt aErrorStringCode, TInt& aResourceId ); - static void StringCodeInkL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ); - static void StringCodeHwL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ); - static void StringCodePaperL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ); - - static void HandleByErrorCodeL( TInt& aResourceId, TInt& aFinalErrCode, TInt aErrCode ); - static void ErrorCodeInkL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ); - static void ErrorCodeHwL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ); - static void ErrorCodePaperL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ); - - }; - -#endif // IMGPPRINTAPPUTIL_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/maiwobserver.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/maiwobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2004-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 MAIWOBSERVER_H -#define MAIWOBSERVER_H - -#include -#include - -/** - * - * Interface to notify AIW Provider about print progress - * - */ -class MAiwObserver - { - public: // Abstract methods - - /** - * Called when Print job is finished. CImgPrintUtils will be - * deleted after this call. - */ - virtual void JobFinished() = 0; - - }; - -#endif // MAIWOBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/inc/mprotocolobserver.h --- a/ImagePrint/ImagePrintUI/imgpprintdll/inc/mprotocolobserver.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2004-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 MPROTOCOLBSERVER_H -#define MPROTOCOLBSERVER_H - -#include - -/** - * - * Observer class that will get notification message when the print preview - * is ready - * - */ -class MProtocolObserver - { - public: - - /** - * Called by CUIProtocol when usb cable is disconnected and application - * need to closed or view changed. This method is only called when USB - * printer is in use - */ - virtual void UsbCableDisconnected() = 0; - }; - -#endif // MPROTOCOLBSERVER_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/ccustomnotedialog.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/ccustomnotedialog.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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: -* -*/ - - -#include "ccustomnotedialog.h" - -// CONSTRUCTION -CCustomNoteDialog* CCustomNoteDialog::NewL( CEikDialog** aSelfPtr ) - { - CCustomNoteDialog* self = CCustomNoteDialog::NewLC( aSelfPtr ); - CleanupStack::Pop( self ); - return self; - } - -// CONSTRUCTION -CCustomNoteDialog* CCustomNoteDialog::NewLC( CEikDialog** aSelfPtr ) - { - CCustomNoteDialog* self = new (ELeave) CCustomNoteDialog( aSelfPtr ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// Destructor -CCustomNoteDialog::~CCustomNoteDialog() - { - if ( iCallback ) - { - // no need to handle error here - TRAP_IGNORE( iCallback->DialogDismissedL( EAknSoftkeyCancel ) ); - } - } - -// Constructor -CCustomNoteDialog::CCustomNoteDialog( CEikDialog** aSelfPtr ) -: CAknNoteDialog( aSelfPtr ) - { - // no implementation - } - -// 2nd phase constructor -void CCustomNoteDialog::ConstructL() - { - // no implementation - } - -void CCustomNoteDialog::SetCallback( MProgressDialogCallback* aCallback ) - { - iCallback = aCallback; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/cdiscoverydlgmanager.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/cdiscoverydlgmanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1082 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // global message query -#include // rapalssession -#include // repository -#include -#include -#include -#include -#include -#include - -#include "cdiscoverydlgmanager.h" -#include "imageprint.h" -#include "mdiscovery.h" -#include "mprintsettings.h" -#include "ciffactory.h" -#include "mprintsettings.h" -#include "imgpprintapputil.h" -#include "cimageprintappui.h" -#include "imageprintconsts.h" -#include "cimageprintdoc.h" -#include "cimageprintengine.h" -#include "tprinter.h" -#include "clog.h" - -const TInt KArrayGranularity( 5 ); -const TInt KSearchAgainUID ( -1 ); - -_LIT( KEmptyIconIndex, "0" ); -_LIT( KCachedIconIndex, "1" ); -_LIT( KBTIconIndex, "2" ); -_LIT( KKioskIconIndex, "3" ); -_LIT( KMMCIconIndex, "4" ); -_LIT( KUSBIconIndex, "5" ); -_LIT( KIconFile, "z:\\resource\\apps\\imgprintbitmaps.mif" ); - -const TUint KSpaceForSingleIcon( 2 ); // icon index + tab = 2 chars -const TUint KSpaceForBothIcons( 4 ); // icon index + tab + cache index + tab = 4 chars - -const TInt KNumberOfIcons( 7 ); -_LIT( KWLANIconIndex, "6" ); - -void CleanUpResetAndDestroy(TAny* aArray) - { - if(aArray) - { - CArrayPtrFlat* array=(CArrayPtrFlat*)aArray; - array->ResetAndDestroy(); - delete array; - } - } -// CONSTRUCTION -CDiscoveryDlgManager* CDiscoveryDlgManager::NewL( - CIFFactory& aIFFactory ) - { - CDiscoveryDlgManager* self = NewLC( aIFFactory ); - CleanupStack::Pop(self); - return self; - } - -CDiscoveryDlgManager* CDiscoveryDlgManager::NewLC( - CIFFactory& aIFFactory ) - { - CDiscoveryDlgManager* self = - new (ELeave) CDiscoveryDlgManager (); - CleanupStack::PushL(self); - self->ConstructL( aIFFactory ); - return self; - } - -// Constructor -CDiscoveryDlgManager::CDiscoveryDlgManager() - { - } - -// 2nd phase constructor -void CDiscoveryDlgManager::ConstructL( CIFFactory& aIFFactory ) - { - iUidArray = new ( ELeave ) CArrayFixFlat( KArrayGranularity ); - iBrandArray = new ( ELeave ) CArrayFixFlat( KArrayGranularity ); - iProtocolArray = new ( ELeave ) CArrayFixFlat( KArrayGranularity ); - iListOfDeviceNames = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - iActivePopup = EFalse; // Popuplist is not activated - iNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); - iDiscovery = aIFFactory.DiscoveryIF(); - iSettings = aIFFactory.SettingsIF(); - iSelectDeviceText = StringLoader::LoadL( R_QTN_POPUP_LIST_TITLE ); - iSearchingText = StringLoader::LoadL( R_QTN_POPUP_LIST_TITLE2 ); - iActiveTitleText.Set( iSearchingText->Des() ); - } - -// Destructor -CDiscoveryDlgManager::~CDiscoveryDlgManager() - { - if ( iDiscovery ) - { - iDiscovery->RemoveDiscoveryObserver(); - } - if ( iActivePopup ) - { - if ( iPopupList ) - { - iPopupList->CancelPopup(); - } - } - delete iListBox; - delete iUidArray; - delete iBrandArray; - delete iProtocolArray; - delete iListOfDeviceNames; - if ( iNameArray ) - { - iNameArray->Reset(); - } - delete iNameArray; - delete iPrinterName; - delete iSearchingText; - delete iSelectDeviceText; - } - -// Called when new device is found -void CDiscoveryDlgManager::NotifyNewPrintDeviceL( - HBufC* aText, - TInt aUid, - TBool aCached, - TPrinterType aType, - TUint aVendor ) - { - LOG("CDiscoveryDlgManager::NotifyNewPrintDevice BEGIN"); - if( iHiddenDiscovery ) - { - // multi-device hidden discovery (bt/wlan) handled differently - if ( iMultiDiscovery ) - { - LOG("CDiscoveryDlgManager::NotifyNewPrintDevice doing hidden multi-discovery"); - TInt uid = iSettings->GetDefaultPrintID(); - LOG2("CDiscoveryDlgManager::NotifyNewPrintDevice found: %d default: %d", aUid, uid); - if ( uid == aUid ) - { - if( iHiddenDiscoveryDialog ) - { - TRAP_IGNORE( iHiddenDiscoveryDialog->ProcessFinishedL() ); - iHiddenDiscoveryDialog = NULL; - } - - TInt printerErrorCode(0); - printerErrorCode = iDiscovery->ChoosePrinterL( aUid ); - iSettings->SetCurrentPrinterProtocol( aType ); - iSettings->SetCurrentPrinterVendor( aVendor ); - iSettings->SetCurrentPrinterName( *aText ); - if( printerErrorCode == 0 ) - { - iPrinterFound = ETrue; - iDiscoveryCompleted = ETrue; - delete iPrinterName; - iPrinterName = NULL; - // Cancel the discovery when device is found printjob is done. - iDiscovery->CancelDeviceDiscoveryL(); - iPrinterName = aText->AllocL(); - } - else - { - iPrinterFound = EFalse; - } - } - } - // USB and MMC hidden discovery only find one printer or not a printer at all - else - { - if( iHiddenDiscoveryDialog ) - { - iHiddenDiscoveryDialog->ProcessFinishedL(); - iHiddenDiscoveryDialog = NULL; - } - - TInt printerErrorCode(0); - printerErrorCode = iDiscovery->ChoosePrinterL( aUid ); - iSettings->SetCurrentPrinterProtocol( aType ); - iSettings->SetCurrentPrinterVendor( aVendor ); - if( printerErrorCode == 0 ) - { - iPrinterFound = ETrue; - iDiscoveryCompleted = ETrue; - delete iPrinterName; - iPrinterName = 0; - if( aType == MDiscoveryObserver::EMMC ) - { - HBufC* memoryCard = 0; - memoryCard = StringLoader::LoadLC - ( R_QTN_PRINT_MEMORY_CARD ); - - iSettings->SetCurrentPrinterName( *memoryCard ); - iPrinterName = memoryCard->AllocL(); - CleanupStack::PopAndDestroy( memoryCard ); - } - else - { - iSettings->SetCurrentPrinterName( *aText ); - iPrinterName = aText->AllocL(); - } - } - else - { - iPrinterFound = EFalse; - } - } - } - else - { - if ( aType == MDiscoveryObserver::EUSB ) - { - iUsbPrinterID = aUid; - } - - TRAPD( err, AddNewDeviceToListL( aText, aUid, aCached, aType, aVendor ) ); - if ( err ) - { - LOG1("CDiscoveryDlgManager::NotifyNewPrintDevice device adding leaved with: %d", err ); - // Nothing to do with the error code coming from ShowErrorMsgL - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( err ) ); - } - } - LOG("CDiscoveryDlgManager::NotifyNewPrintDevice END"); - } - -// Called when error is found -void CDiscoveryDlgManager::DiscoveryError( - TInt aErrCode ) - { - if ( aErrCode == ENoConnection ) - { - CancelDiscovery(); - } - } - -// Called when process completed -void CDiscoveryDlgManager::DeviceDiscoveryCompleted() - { - // // Added this to avoid multiple "Search Again" texts, because server sends DeviceDiscoveryCompleted() more than once - if( iDiscoveryCompleted ) - { - return; - } - - LOG1("[CDiscoveryDlgManager::DeviceDiscoveryCompleted]\t Before dissmissing the process/wait dialog, iDiscoveryCompleted has value of %d", iDiscoveryCompleted); - - // Searching over, flag is essential - iSearchingCancelled = ETrue; - - iActiveTitleText.Set( iSelectDeviceText->Des() ); - // Set the title of the pop-up list - if ( iPopupList ) - { - TRAP_IGNORE( iPopupList->SetTitleL( iActiveTitleText ) ); - } - LOG("CDiscoveryDlgManager::DeviceDiscoveryCompleted BEGIN"); - if( iHiddenDiscoveryDialog ) - { - TRAP_IGNORE( iHiddenDiscoveryDialog->ProcessFinishedL() ); - iHiddenDiscoveryDialog = NULL; - } - - iDiscoveryCompleted = ETrue; - if ((iActivePopup) && (iPopupList)) - { - iPopupList->Heading()->CancelAnimation(); - - TRAP_IGNORE( RemoveCachedIconsL() ); - TRAP_IGNORE( AddSearchAgainTextL() ); - - if ( iPopupList ) - { - TRAP_IGNORE( iPopupList->ButtonGroupContainer()->SetCommandSetL( - R_AVKON_SOFTKEYS_SELECT_CANCEL ); - iPopupList->ButtonGroupContainer()->DrawNow() ); - } - } - if ( iCancelling ) - { - iCancelling = EFalse; - TRAP_IGNORE( iCancellingDialog->ProcessFinishedL() ); - iCancellingDialog = NULL; - } - LOG("CDiscoveryDlgManager::DeviceDiscoveryCompleted END"); - } - -// Displays the printer devices -TBool CDiscoveryDlgManager::StartDlgManagerL( TInt aProtocol, TBool aHidden ) - { - LOG2("CDiscoveryDlgManager::StartDlgManagerL BEGIN: protocol %d, hidden: %d", aProtocol, aHidden); - iDiscoveryCompleted = EFalse; - TBool okToContinue( ETrue ); - iHiddenDiscovery = aHidden; - - // Start the device discovery with all the supported protocols - if( aProtocol == 0 ) - { - iSupportedProtocols = iDiscovery->SupportedProtocols(); - - // If discovering WLAN, AP must be defined before continuing - if ( iSupportedProtocols & KImagePrint_PrinterProtocol_UPnP ) - { - LOG("CDiscoveryDlgManager::StartDlgManagerL: TryWlanDiscoveryL"); - TryDeviceDiscoveryL( iSupportedProtocols, EFalse ); - } - // Discovery without WLAN - else - { - LOG("CDiscoveryDlgManager::StartDlgManagerL: StartDeviceDiscoveryL"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - } - else - { - iSupportedProtocols = aProtocol; - - // If discovering WLAN - if ( iSupportedProtocols & KImagePrint_PrinterProtocol_UPnP ) - { - LOG("CDiscoveryDlgManager::StartDlgManagerL - discovering WLAN"); - if ( !TryDeviceDiscoveryL( aProtocol, ETrue ) ) - { - LOG("CDiscoveryDlgManager::StartDlgManagerL - discovering WLAN failed"); - // If discovering failed, do not continue - okToContinue = EFalse; - return okToContinue; - } - } - else - { - LOG("iDiscovery->StartDeviceDiscoveryL START"); - iDiscovery->StartDeviceDiscoveryL( this, aProtocol ); - } - - LOG("iDiscovery->StartDeviceDiscoveryL END"); - } - - // BT & WLAN cases can find multiple devices which has to be handled - if ( aProtocol & KImagePrint_PrinterProtocol_BPP || - aProtocol & KImagePrint_PrinterProtocol_BIP || - aProtocol & KImagePrint_PrinterProtocol_OPP_Printer || - aProtocol & KImagePrint_PrinterProtocol_OPP_PC || - aProtocol & KImagePrint_PrinterProtocol_UPnP ) - { - iMultiDiscovery = ETrue; - } - - if( iHiddenDiscovery ) - { - okToContinue = StartHiddenDiscoveryL(); - } - else - { - okToContinue = StartNormalDiscoveryL(); - } - - LOG1("CDiscoveryDlgManager::StartDlgManagerL END return: %d", okToContinue); - return okToContinue; - } - -TBool CDiscoveryDlgManager::StartNormalDiscoveryL() - { - iActiveTitleText.Set( iSearchingText->Des() ); - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL BEGIN"); - TInt printerErrorCode = 0; - TBool continueSearch( ETrue ); - TBool okToContinue( ETrue ); - iSearchingCancelled = EFalse; // ADDED - TInt uid; // Printer uid - // Loop until printer is selected or user decides to exit - while ( continueSearch ) - { - // Create pop-up list - if ( !iPopupList ) - { - iPopupList = CreatePopupListL(); - } - - // Show the pop-up list - if ( iListOfDeviceNames->Count() > 0 ) - { - iPopupList->ButtonGroupContainer()->SetCommandSetL( - R_AVKON_SOFTKEYS_STOP - ); - } - - // Launch the pop-up list for found devices - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL before launch popuplist"); - TBool selected = iPopupList->ExecuteLD(); - LOG1("CDiscoveryDlgManager::StartNormalDiscoveryL after popupList, selected: %d", selected); - iPopupList = NULL; - iActivePopup = EFalse; - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL returned from popup"); - TInt index = iListBox->CurrentItemIndex(); - - // Search again was selected - if ( selected && iUidArray->At( index ) == KSearchAgainUID ) - { - RestartDiscoveryL(); - } - // Device was selected - else if ( selected ) - { - uid = iUidArray->At( index ); - if ( uid == iUsbPrinterID ) - { - iUSBPrinterSelected = ETrue ; - } - else - { - iUSBPrinterSelected = EFalse; - } - - iCurrentPrinterUid = uid; - printerErrorCode = iDiscovery->ChoosePrinterL( uid ); - if ( printerErrorCode != KErrNone ) - { - IMGPPrintAppUtil::ShowErrorMsgL( printerErrorCode ); - User::Leave( printerErrorCode ); - } - else - { - if ( iUidArray->At( 0 ) == KSearchAgainUID ) - { - iSettings->SetCurrentPrinterProtocol( iProtocolArray->At( index - 1 ) ); - iSettings->SetCurrentPrinterVendor( iBrandArray->At( index - 1 ) ); - iSettings->SetCurrentPrinterName( (*iNameArray)[index-1] ); - } - else - { - iSettings->SetCurrentPrinterProtocol( iProtocolArray->At( index ) ); - iSettings->SetCurrentPrinterVendor( iBrandArray->At( index )); - iSettings->SetCurrentPrinterName( (*iNameArray)[index] ); - } - - continueSearch = EFalse; - // If there wasn't default protocol then set selected printer and protocol as default - if ( iSettings->GetDefaultPrinterProtocol() == KErrNotFound ) - { - LOG1("CDiscoveryDlgManager::StartNormalDiscoveryL default protocol wasn't set, setting uid: %d", uid ); - iSettings->SetDefaultPrinterID( uid ); - // Discovery has completed and 'Search again' was added as a first item - // access protocol array with index-1 - if ( iUidArray->At( 0 ) == KSearchAgainUID ) - { - iSettings->SetDefaultPrinterProtocol( iProtocolArray->At( index-1 ) ); - iSettings->SetDefaultPrinterNameL( (*iNameArray)[index-1] ); - } - else - { - iSettings->SetDefaultPrinterProtocol( iProtocolArray->At( index ) ); - iSettings->SetDefaultPrinterNameL( (*iNameArray)[index] ); - } - } - else - { - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL default protocol was already set" ); - } - } - - TPtrC name = iListOfDeviceNames->MdcaPoint( index ); - delete iPrinterName; - iPrinterName = NULL; - iPrinterName = name.AllocL(); - } - // Stop/Cancel was selected - else - { - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL Stop/Cancel was selected" ); - // Searching cancelled by user, cancel device discovery - if ( !iSearchingCancelled ) - { - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL iSearchingCancelled EFalse" ); - iSearchingCancelled = ETrue; - iDiscovery->CancelDeviceDiscoveryL(); - } - - // User cancelled the whole discovery dialog - else - { - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL iSearchingCancelled ETrue" ); - continueSearch = EFalse; - okToContinue = EFalse; - iCancelling = ETrue; - - // User cancelled the discovery dialog before all the printers were found - if ( !iDiscoveryCompleted ) - { - //ShowCancelWaitNoteL(); - } - } - } - } - LOG("CDiscoveryDlgManager::StartNormalDiscoveryL END"); - return okToContinue; - } - -TBool CDiscoveryDlgManager::StartHiddenDiscoveryL() - { - LOG("CDiscoveryDlgManager::StartHiddenDiscoveryL BEGIN"); - iHiddenDiscoveryDialog = - new (ELeave)CAknWaitDialog( - (REINTERPRET_CAST(CEikDialog**,&iHiddenDiscoveryDialog))); - LOG("iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ) BEGIN"); - iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ); - LOG("iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ) END"); - LOG1("iPrinterFound = %d", iPrinterFound); - LOG("CDiscoveryDlgManager::StartHiddenDiscoveryL END"); - return iPrinterFound; - } - -void CDiscoveryDlgManager::DialogDismissedL( TInt /*aButtonId*/ ) - { - LOG("CDiscoveryDlgManager::DialogDismissedL BEGIN"); - // This is called only if hidden discovery is cancelled - // start cancelling operation and put cancelling note on. - iPrinterFound = EFalse; - iCancelling = ETrue; - iDiscovery->CancelDeviceDiscoveryL(); - // User cancelled the discovery dialog before all the printers were found - if ( !iDiscoveryCompleted ) - { - ShowCancelWaitNoteL(); - } - LOG("CDiscoveryDlgManager::DialogDismissedL END"); - } - -void CDiscoveryDlgManager::ShowCancelWaitNoteL() - { - iCancellingDialog = - new ( ELeave ) CAknWaitDialog( - (REINTERPRET_CAST(CEikDialog**,&iCancellingDialog))); - iCancellingDialog->PrepareLC(R_CANCEL_PRINTING_DIALOG); - HBufC* text = StringLoader::LoadLC( R_QTN_PRINT_PROGRESS_PROMPT_CANCEL ); - iCancellingDialog->SetTextL( *text ); - CleanupStack::PopAndDestroy(text); - - iCancellingDialog->SetTone( CAknNoteDialog::ENoTone ); - iCancellingDialog->RunLD(); - } - -// Creates and initializees the popup list -CAknPopupList* CDiscoveryDlgManager::CreatePopupListL() - { - LOG("CDiscoveryDlgManager::CreatePopupListL BEGIN"); - if ( iListBox ) - { - delete iListBox; - iListBox = 0; - } - // Creates list box for the pop-up list - iListBox = new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox;//CAknSingleGraphicPopupMenuStyleListBox; - - // Create and initialize the popup list - iPopupList = CAknPopupList::NewL( - iListBox, - /*R_AVKON_SOFTKEYS_CANCEL,*/ - R_AVKON_SOFTKEYS_STOP, - AknPopupLayouts::EDynMenuWindow ); - - // Set the title of the pop-up list - iPopupList->SetTitleL( iActiveTitleText ); - - // Initialize list box - iListBox->ConstructL( iPopupList, - EAknListBoxSelectionList ); // EAknListBoxMenuList - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - HBufC* text = StringLoader::LoadLC( R_QTN_PRINT_NO_PRINTERS ); - iListBox->View()->SetListEmptyTextL( *text ); - CleanupStack::PopAndDestroy( text ); - - //Array of icons to show in the pop-up list - CArrayPtrFlat< CGulIcon >* icons = - new( ELeave ) CArrayPtrFlat< CGulIcon >( KNumberOfIcons ); - - //Push to ClenupStack. Array and all of items added to it - //are deleted if leave occurs - CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy, icons)); - icons->SetReserveL( KNumberOfIcons ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - bitmap = new( ELeave ) CFbsBitmap(); - User::LeaveIfError( bitmap->Create( TSize(0,0), EColor256 ) ); - CleanupStack::PushL( bitmap ); - CGulIcon* icon = CGulIcon::NewL( bitmap ); - CleanupStack::Pop( bitmap ); - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_indi_print_cached, - EMbmImgprintbitmapsQgn_indi_print_cached_mask ); - icon = CGulIcon::NewL(bitmap,mask); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_prop_print_bt, - EMbmImgprintbitmapsQgn_prop_print_bt_mask ); - icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_prop_print_kiosk, - EMbmImgprintbitmapsQgn_prop_print_kiosk_mask ); - icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_prop_print_mmc, - EMbmImgprintbitmapsQgn_prop_print_mmc_mask ); - icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_prop_print_usb, - EMbmImgprintbitmapsQgn_prop_print_usb_mask ); - icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, - EMbmImgprintbitmapsQgn_prop_print_wlan, - EMbmImgprintbitmapsQgn_prop_print_wlan_mask ); - icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2 ); // bitmap, mask - CleanupStack::PushL( icon ); - icons->AppendL( icon ); - CleanupStack::Pop( icon ); - - CleanupStack::Pop( icons ); - iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons ); - iListBox->Model()->SetItemTextArray( iListOfDeviceNames ); - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - // Set the animation - iPopupList->Heading()->SetHeaderAnimationL( R_IMAGEPRINT_ANIMATION ); - iActivePopup = ETrue; - - LOG("CDiscoveryDlgManager::CreatePopupListL END"); - return iPopupList; - } - -// Adds new device to list, updates popup list -void CDiscoveryDlgManager::AddNewDeviceToListL( - HBufC* aText, - TInt aUid, - TBool aCached, - TPrinterType aType, - TUint aVendor ) - { - LOG("CDiscoveryDlgManager::AddNewDeviceToListL BEGIN"); - HBufC* buf; - - // if the device is memory card - if( aType == MDiscoveryObserver::EMMC ) - { - HBufC* stringholdercopy = StringLoader::LoadLC - ( R_QTN_PRINT_MEMORY_CARD ); - buf = HBufC::NewLC( stringholdercopy->Size() + KSpaceForSingleIcon ); - TPtr ptr = buf->Des(); - ptr.Append( KMMCIconIndex ); - ptr.Append( KTabChar ); - ptr.Append( stringholdercopy->Des() ); - - // Add new device into array - iListOfDeviceNames->InsertL( 0, *buf ); - iNameArray->InsertL( 0, *stringholdercopy ); - CleanupStack::PopAndDestroy( 2, stringholdercopy ); //buf, stringholdercopy - } - else // any other device - { - if ( aCached ) - { - buf = HBufC::NewLC( aText->Size() + KSpaceForBothIcons ); - } - else - { - buf = HBufC::NewLC( aText->Size() + KSpaceForSingleIcon ); - } - TPtr ptr = buf->Des(); - if( aType == MDiscoveryObserver::EBPP ) - { - ptr.Append( KBTIconIndex ); - } - else if( aType == MDiscoveryObserver::EOPP ) - { - ptr.Append( KKioskIconIndex ); - } - else if( aType == MDiscoveryObserver::EUSB ) - { - ptr.Append( KUSBIconIndex ); - } - else if( aType == MDiscoveryObserver::EWLAN ) - { - ptr.Append( KWLANIconIndex ); - } - else - { - ptr.Append( KEmptyIconIndex ); - } - ptr.Append( KTabChar ); - ptr.Append( aText->Des() ); - - if ( aCached ) - { - ptr.Append( KTabChar ); - ptr.Append( KCachedIconIndex ); - } - - // Add new device into array - iListOfDeviceNames->InsertL( 0, *buf ); - CleanupStack::PopAndDestroy( buf ); - } - - // Add Uid of the device into array - iUidArray->InsertL( 0, aUid ); - - aVendor = TPrinter::EVendorNone; - - iBrandArray->InsertL( 0, aVendor ); - iProtocolArray->InsertL( 0, aType ); - if( aType != MDiscoveryObserver::EMMC ) - { - iNameArray->InsertL( 0, *aText ); - } - - if ( iActivePopup ) - { - LOG("CDiscoveryDlgManager::AddNewDeviceToListL popup update"); - iListBox->HandleItemAdditionL(); - iPopupList->DrawNow(); - - if ( iListOfDeviceNames->MdcaCount() == 1 ) - { - // First item to appear, change CBA - iPopupList->ButtonGroupContainer()->SetCommandSetL( - R_AVKON_SOFTKEYS_STOP - ); - iPopupList->ButtonGroupContainer()->DrawNow(); - } - } - LOG("CDiscoveryDlgManager::AddNewDeviceToListL END"); - } - -// Returns the name of the chosen printer -TInt CDiscoveryDlgManager::PrinterUid() const - { - return iCurrentPrinterUid; - } - -// Returns the name of the chosen printer -const TDesC& CDiscoveryDlgManager::PrinterName() const - { - LOG("CDiscoveryDlgManager::PrinterName() BEGIN"); - if ( !iPrinterName ) - { - return KNullDesC(); - } - else - { - return *iPrinterName; - } - } - - TBool CDiscoveryDlgManager::USBPrinterSelected() const - { - return iUSBPrinterSelected; - } - -// Resets the popup list and starts the device discovery again -void CDiscoveryDlgManager::RestartDiscoveryL() - { - iSearchingCancelled = EFalse; - - iListOfDeviceNames->Reset(); - iUidArray->Reset(); - iBrandArray->Reset(); - iProtocolArray->Reset(); - iActiveTitleText.Set( iSearchingText->Des() ); - iPopupList = CreatePopupListL(); - iDiscoveryCompleted = EFalse; - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - -// Removes cached printer from the list -void CDiscoveryDlgManager::RemoveCachedPrinterL( - TInt aUid ) - { - TInt i( 0 ); - TBool found( EFalse ); - for ( i = 0; i < iUidArray->Count() && !found; i++ ) - { - if ( aUid == iUidArray->At( i ) ) - { - TInt curIndex = iListBox->CurrentItemIndex(); - if ( curIndex >= i && - iListOfDeviceNames->MdcaCount() > 1 && curIndex > 0 ) - { - iListBox->SetCurrentItemIndexAndDraw( curIndex - 1 ); - } - - iUidArray->Delete( i ); - iBrandArray->Delete( i ); - iProtocolArray->Delete( i ); - iNameArray->Delete( i ); - iListOfDeviceNames->Delete( i ); - iListBox->HandleItemRemovalL(); - iPopupList->DrawNow(); - - if ( iListOfDeviceNames->MdcaCount() == 0 ) - { - // Zero items, change softkeys - if ( iActivePopup ) - { - iPopupList->ButtonGroupContainer()->SetCommandSetL( - R_AVKON_SOFTKEYS_CANCEL ); - iPopupList->ButtonGroupContainer()->DrawNow(); - } - } - found = ETrue; - } - } - } - -// Removes cached printer icons from the list -void CDiscoveryDlgManager::RemoveCachedIconsL() - { - TInt counter = iListOfDeviceNames->MdcaCount(); - TChar KTabChar( 0x0009 ); - for ( TInt i = 0 ; i < counter; i++ ) - { - TPtrC tmp( iListOfDeviceNames->MdcaPoint( i ) ); - //locate the rightmost tab - TInt tabPosition = tmp.LocateReverse( KTabChar ); - if ( tabPosition != KErrNotFound && - tabPosition > 1 ) //don't remove the pre-text tab - { - iListOfDeviceNames->InsertL( i, tmp.Left( tabPosition ) ); - iListOfDeviceNames->Delete( i + 1 ); - } - } - iListBox->HandleItemAdditionL(); - iPopupList->DrawNow(); - } - -// Adds serarch again text to list -void CDiscoveryDlgManager::AddSearchAgainTextL() - { - HBufC* str = StringLoader::LoadLC - ( R_QTN_SEARCH_AGAIN ); - HBufC* buf = HBufC::NewLC( str->Size() + KSpaceForSingleIcon ); - TPtr ptr = buf->Des(); - ptr.Append( KEmptyIconIndex ); - ptr.Append( KTabChar ); - ptr.Append( str->Des() ); - - iListOfDeviceNames->InsertL( 0, *buf ); - - CleanupStack::PopAndDestroy( 2, str ); //buf, str - - iUidArray->InsertL( 0, KSearchAgainUID ); - iListBox->HandleItemAdditionL(); - iPopupList->DrawNow(); - } - -//-------------------------------------------------------------------------------------------- -// -// CDiscoveryDlgManager::WlanAccessPointExists -// -//-------------------------------------------------------------------------------------------- -TBool CDiscoveryDlgManager::WlanAccessPointExistsL() - { - LOG("[CDiscoveryDlgManager::WlanAccessPointExists] BEGIN"); - TBool accessPointExists( EFalse ); - CUpnpShowCommand* upnpShowCommand = NULL; - TRAPD ( error, upnpShowCommand = CUpnpShowCommand::NewL() ); - if ( error != KErrNone ) - { - LOG1("[CDiscoveryDlgManager::WlanAccessPointExists] CUpnpShowCommand::NewL leaves, with: %d", error); - return accessPointExists; - } - CleanupStack::PushL( upnpShowCommand ); - accessPointExists = upnpShowCommand->IsAvailableL(); - CleanupStack::PopAndDestroy(); // upnpShowCommand - LOG1("[CDiscoveryDlgManager::WlanAccessPointExists]\t END, AccessPointExists: %d", accessPointExists); - return accessPointExists; - } - -//-------------------------------------------------------------------------------------------- -// -// CDiscoveryDlgManager::TryDeviceDiscoveryL() -// -//-------------------------------------------------------------------------------------------- -TBool CDiscoveryDlgManager::TryDeviceDiscoveryL( TUint aProtocols, TBool aSingleDiscovery ) - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL"); - - // WLAN access point not defined - if ( !WlanAccessPointExistsL() ) - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP not defined, launch WLAN wizard query"); - - // Launch WLAN wizard query - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - CAknMessageQueryDialog"); - CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog; - - // User pressed OK - if ( dlg->ExecuteLD( R_LAUNCH_WLAN_WIZARD_QUERY ) ) - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard"); - - // Launch WLAN wizard - CUpnpRunSetupCommand* runSetupCommand = CUpnpRunSetupCommand::NewL(); - CleanupStack::PushL(runSetupCommand); - runSetupCommand->RunSetupL(); - CleanupStack::PopAndDestroy(runSetupCommand); - - - // If access point defined by the WLAN wizard - if ( WlanAccessPointExistsL() ) - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP defined in WLAN wizard"); - - if ( aSingleDiscovery ) - { - // Start discovery - // Continues to StartDeviceDiscoveryL - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with single protocol"); - iDiscovery->StartDeviceDiscoveryL( this, aProtocols ); - } - else - { - // Start discovery - // Continues to StartDeviceDiscoveryL - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with all prots"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - } - - // Access point not defined by the WLAN wizard - else - { - // Thus, WLAN discovery not supported - iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; - - if ( aSingleDiscovery ) - { - // Do nothing - // WLAN not supported - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard canceled"); - return EFalse; - } - else - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - - iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - } - - // User pressed cancel - else - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - User pressed cancel"); - - // WLAN discovery not supported - iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; - - if ( aSingleDiscovery ) - { - // Do nothing - // WLAN not supported - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard canceled"); - return EFalse; - } - else - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - } - - return ETrue; - } - - // If WLAN access point is defined - else - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP is defined"); - - // Start discovery - // Continues to StartDeviceDiscoveryL - - if ( aSingleDiscovery ) - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start WLAN discovery"); - iDiscovery->StartDeviceDiscoveryL( this, aProtocols ); - } - else - { - LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with all prots"); - iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); - } - - return ETrue; - } - } - -//-------------------------------------------------------------------------------------------- -// -// CDiscoveryDlgManager::CancelDiscovery() -// -//-------------------------------------------------------------------------------------------- -void CDiscoveryDlgManager::CancelDiscovery() - { - LOG("CDiscoveryDlgManager::CancelDiscovery begin"); - if(iPopupList) - { - LOG("CDiscoveryDlgManager::CancelDiscovery canceling popup device list."); - iSearchingCancelled = ETrue; - - TInt error ( KErrNone ); - TRAP( error, iDiscovery->CancelDeviceDiscoveryL()); - - - iPopupList->CancelPopup(); - } - LOG("CDiscoveryDlgManager::CancelDiscovery end"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintdlgmanager.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintdlgmanager.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,463 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cimgpprintdlgmanager.h" -#include "imgpprintapputil.h" -#include "cimgpprintprogressdlg.h" -#include "clog.h" -#include "cimgpprintutils.h" -#include "mprintingobserver.h" -#include "tprinter.h" -#include "printmessagecodes.h" -#include "imageprintconsts.h" - -_LIT(KPlain, "%S"); - -const TUint KProgressFinalValue = 100; - -// Timeout for MMC InformationNote ( timeout = 5 000 000 ms -> 5 s ) -const TInt KTimeOut = 5000000; - - -// CONSTRUCTION -EXPORT_C CIMGPPrintDlgManager* CIMGPPrintDlgManager::NewL( - TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils, - MPrintingObserver* aPrintingObserver ) - { - CIMGPPrintDlgManager* self = - CIMGPPrintDlgManager::NewLC( aNoc, - aPrintJob, - aNumOfPages, - aMMCPrinting, - aVendor, - aPrintUtils, - aPrintingObserver ); - CleanupStack::Pop( self ); - return self; - } - -CIMGPPrintDlgManager* CIMGPPrintDlgManager::NewLC( - TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils, - MPrintingObserver* aPrintingObserver ) - { - CIMGPPrintDlgManager* self = - new ( ELeave ) CIMGPPrintDlgManager( aNoc, - aPrintJob, - aNumOfPages, - aMMCPrinting, - aVendor, - aPrintUtils, - aPrintingObserver ); - self->ConstructL(); - CleanupStack::PushL( self ); - - return self; - } - - -// Second class constructor -void CIMGPPrintDlgManager::ConstructL() - { - - } - -// Default constructor -CIMGPPrintDlgManager::CIMGPPrintDlgManager( - TInt aNoc, - MPrintJob* aPrintJob, - TUint aNumOfPages, - TBool aMMCPrinting, - TUint aVendor, - CIMGPPrintUtils* aPrintUtils, - MPrintingObserver* aPrintingObserver ) : - iPrintJob( aPrintJob ), - iNumOfPages( aNumOfPages ), - iMMCPrinting( aMMCPrinting ), - iVendor( aVendor ) - { - iCancellingDialog = 0; - // Used only in aiw printing - if( aPrintUtils ) - { - iPrintUtils = aPrintUtils; - } - if( aPrintingObserver ) - { - iPrintingObserver = aPrintingObserver; - } - iNoc = aNoc; - } - -// Destructor -CIMGPPrintDlgManager::~CIMGPPrintDlgManager() - { - LOG("CIMGPPrintDlgManager::~CIMGPPrintDlgManager BEGIN"); - if ( iDialog ) - { - delete iDialog; - iDialog = 0; - } - LOG("CIMGPPrintDlgManager::~CIMGPPrintDlgManager END"); - } - -// Starts the print job -EXPORT_C void CIMGPPrintDlgManager::StartPrintingL() - { - LOG("CIMGPPrintDlgManager::StartPrintingL BEGIN"); - - iFirstNote = ETrue; - - TRAPD( err, iPrintJob->PrintL( this )); - if ( err == KErrNone ) - { - LOG("CIMGPPrintDlgManager::StartPrintingL printing..."); - PrepareProgressDialogL(); - iCancelling = EFalse; - iPrintingCancelled = EFalse; - iDialog->RunLD(); - } - else - { - LOG("CIMGPPrintDlgManager::StartPrintingL failed"); - if ( iDialog ) - { - delete iDialog; - iDialog = 0; - } - if( iPrintUtils ) - { - iPrintUtils->JobFinished(); - } - if( iPrintingObserver ) - { - TRAP_IGNORE( iPrintingObserver->PrintingCompletedL( EFalse )); - } - // Don't leave for KErrNotFound, as there's another note for it - if ( err != KErrNotFound ) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( err )); - } - } - LOG("CIMGPPrintDlgManager::StartPrintingL END"); - } - -void CIMGPPrintDlgManager::PrepareProgressDialogL() - { - LOG("CIMGPPrintDlgManager::PrepareProgressDialogL START"); - HBufC* txt; - if ( !iMMCPrinting ) - { - txt = StringLoader::LoadLC( - R_QTN_PRINT_PROGRESS_NOTE_TITLE ); - } - else - { - txt = StringLoader::LoadLC( - R_QTN_COPY_PROGRESS_NOTE_TITLE); - } - - TBuf<128> buf; - buf.Format( KPlain, txt ); - CleanupStack::PopAndDestroy( txt ); - - iDialog = new ( ELeave ) CAknProgressDialog( - (REINTERPRET_CAST( CEikDialog**, &iDialog )), EFalse ); - iDialog->PrepareLC( R_PRINT_PROGRESS_PLAIN_PROG_NOTE ); - - CEikProgressInfo* info = iDialog->GetProgressInfoL(); - info->SetFinalValue( KProgressFinalValue ); - iDialog->SetTextL( buf ); - iDialog->SetCallback( this ); - LOG("CIMGPPrintDlgManager::PrepareProgressDialogL END"); - } - - -// Called to update the print progress -void CIMGPPrintDlgManager::PrintProgress( - TUint aComplete ) - { - TInt err = KErrNone; - TRAP( err, PrintProgressL( aComplete ) ); - if ( err != KErrNone ) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( err ) ); - } - } - -// Called to update the print progress -void CIMGPPrintDlgManager::PrintProgressL( - TUint aComplete ) - { - LOG1( "CIMGPPrintDlgManager::PrintProgressL START with: %d", aComplete ); - if( !iCancelling ) - { - if ( !iDialog ) - { - LOG("CIMGPPrintDlgManager::PrintProgressL: creating dialog again"); - PrepareProgressDialogL(); - iDialog->RunLD(); - } - CEikProgressInfo* info = iDialog->GetProgressInfoL(); - info->SetAndDraw( aComplete ); - } - LOG("CIMGPPrintDlgManager::PrintProgressL END"); - } - -// Called when the print job is finished -void CIMGPPrintDlgManager::JobFinished() - { - - LOG("CIMGPPrintDlgManager::JobFinished BEGIN"); - if ( iDialog ) - { - delete iDialog; - iDialog = 0; - } - if ( iMMCPrinting && !iCancelling ) - { - LOG("CIMGPPrintDlgManager::JobFinished mmc note"); - TRAP_IGNORE( ShowMMCPrintingCompletedDlgL() ); - LOG("CIMGPPrintDlgManager::JobFinished mmc note done"); - } - if ( iCancelling ) - { - if(iCancellingDialog) - { - TRAP_IGNORE( iCancellingDialog->ProcessFinishedL() ); - iCancellingDialog = 0; - iCancelling = EFalse; - } - } - else - { - if( iPrintUtils ) - { - LOG("CIMGPPrintDlgManager::JobFinished iPrintUtils"); - iPrintUtils->JobFinished(); - LOG("CIMGPPrintDlgManager::JobFinished iPrintUtils done"); - } - if( iPrintingObserver ) - { - TRAP_IGNORE( iPrintingObserver->PrintingCompletedL( EFalse )); - } - } - LOG("CIMGPPrintDlgManager::JobFinished END"); - } - -// Manages print job errors -void CIMGPPrintDlgManager::JobError( - TInt aErrCode, TInt aErrorStringCode ) - { - LOG2("CIMGPPrintDlgManager::JobError BEGIN, error = %d, stringcode = %d", aErrCode, aErrorStringCode ); - - if( iMMCPrinting && aErrCode == ECancellingNoMessage ) - { - if ( iDialog ) - { - delete iDialog; - iDialog = 0; - } - return; - } - - if ( iMMCPrinting && !iCancelling ) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorNoteL( R_NOTE_IMAGEPRINT_MMCCOPYFAIL ) ); - // Nothing to do if the displaying of error note fails - // Just need to make sure that this method never leaves - } - if ( iCancelling ) - { - LOG( "CIMGPPrintDlgManager::JobError ---> iCancellingDialog->ProcessFinishedL()" ); - TRAP_IGNORE( iCancellingDialog->ProcessFinishedL() ); - iCancellingDialog = 0; - iCancelling = EFalse; - } - else - { - // Delete dialog - if ( iDialog ) - { - delete iDialog; - iDialog = 0; - } - if( iPrintUtils && - aErrCode != KHCIErrorBase-EPageTimedOut && - aErrorStringCode != EObexConnectError ) - { - iPrintUtils->JobFinished(); - } - if( iPrintingObserver ) - { - TRAP_IGNORE( iPrintingObserver->PrintingCompletedL( EFalse )); - } - } - - /* Error note is shown to user in normal cases, but not when - * printing is done to MMC, canceled, done via quickprint, or - * BT timeout happens, as these cases are handled in other parts - * of code - */ - if ( !iMMCPrinting && - aErrCode != ECancelling && - ( !iPrintUtils || - ( aErrCode != KHCIErrorBase-EPageTimedOut && - aErrorStringCode != EObexConnectError ))) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( aErrCode, aErrorStringCode )); - // Nothing to do to handle err - } - LOG("CIMGPPrintDlgManager::JobError END"); - } - -// Manages print job status events -void CIMGPPrintDlgManager::JobStatusEvent( TInt aErrCode, TInt aErrorStringCode ) - { - LOG2("CIMGPPrintDlgManager::JobStatusEvent = %d, stringcode = %d", aErrCode, aErrorStringCode ); - // If printer is disconnected cancel printing else - // just show the error message - if ( aErrCode == KErrDisconnected ) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( KErrDisconnected, aErrorStringCode )); - if ( iDialog ) - { - // This ends the printing - delete iDialog; - iDialog = 0; - } - } - else - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( aErrCode, aErrorStringCode )); - } - LOG("CIMGPPrintDlgManager::JobStatusEvent END"); - } - -// Shows printing completed dlg -void CIMGPPrintDlgManager::ShowMMCPrintingCompletedDlgL() - { - LOG("CIMGPPrintDlgManager::ShowMMCPrintingCompletedDlgL BEGIN"); - - RPointerArray allImages; - CleanupClosePushL( allImages ); - iPrintJob->GetPrintJobL( allImages ); - TInt imagesCount = allImages.Count(); - CleanupStack::PopAndDestroy( &allImages ); - HBufC* buf = NULL; - - // Blocks possibility to show note when exiting image print. - if (iFirstNote) - { - if ( iNoc == 1 && imagesCount == 1 ) - { - buf = StringLoader::LoadLC( R_SETTINGS_IMAGEPRINT_MMC_PRINT_NOTE_ONE_PICTURE ); //r_settings_imageprint_mmc_print_note_one_picture - } - else - { - buf = StringLoader::LoadLC( R_SETTINGS_IMAGEPRINT_MMC_PRINT_NOTE ); - } - - CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue ); - dlg->SetTimeout( (CAknNoteDialog::TTimeout) KTimeOut ); - dlg->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - - iFirstNote = EFalse; - - } - - LOG("CIMGPPrintDlgManager::ShowMMCPrintingCompletedDlgL END"); - } - -// Called when dialog gets dismissed -void CIMGPPrintDlgManager::DialogDismissedL( - TInt aButtonId ) - { - LOG("CIMGPPrintDlgManager::DialogDismissedL BEGIN"); - // If user pressed cancel, cancel printing - LOG1( "CIMGPPrintDlgManager::DialogDismissedL iPrintingCancelled: %d", iPrintingCancelled ); - if ( ( aButtonId == EAknSoftkeyCancel ) && ( iPrintingCancelled == EFalse ) ) - { - LOG("CIMGPPrintDlgManager::DialogDismissedL aButtonId == EAknSoftkeyCancel"); - iDialog = 0; - iCancelling = ETrue; - - // Printing cancelled - iPrintingCancelled = ETrue; - - TRAPD( err, iPrintJob->CancelL() ); - if( err == KErrNone ) - { - ShowCancelWaitNoteL(); - } - else - { - iCancelling = EFalse; - } - } - - LOG("CIMGPPrintDlgManager::DialogDismissedL END"); - } - -// Displays the cancel wait note -void CIMGPPrintDlgManager::ShowCancelWaitNoteL() - { - iCancellingDialog = - new ( ELeave ) CAknWaitDialog( - (REINTERPRET_CAST(CEikDialog**,&iCancellingDialog))); - iCancellingDialog->PrepareLC(R_CANCEL_PRINTING_DIALOG); - HBufC* text = StringLoader::LoadLC( R_QTN_PRINT_PROGRESS_PROMPT_CANCEL ); - iCancellingDialog->SetTextL( *text ); - CleanupStack::PopAndDestroy(text); - - iCancellingDialog->SetTone( CAknNoteDialog::ENoTone ); - iCancellingDialog->RunLD(); - - if( iPrintUtils ) - { - iPrintUtils->JobFinished(); - } - if( iPrintingObserver ) - { - iPrintingObserver->PrintingCompletedL( ETrue ); - } - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintprogressdlg.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintprogressdlg.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include - -#include "cimgpprintprogressdlg.h" -#include "imageprintapp.hrh" -#include "imageprintconsts.h" -#include "clog.h" - -const TInt KBrandingBitmapPosPortY ( 50 ); -const TInt KBrandingBitmapPosLandY ( 50 ); - -// CONSTRUCTION -CIMGPPrintProgressDlg::CIMGPPrintProgressDlg( - CEikDialog** aSelfPtr, - TBool aVisibilityDelayOff ) - : CAknProgressDialog( aSelfPtr, aVisibilityDelayOff ) - { - } - -// Destructor -CIMGPPrintProgressDlg::~CIMGPPrintProgressDlg() - { - } - -// Positions the UI controls correctly -void CIMGPPrintProgressDlg::PostLayoutDynInitL() - { - LOG("CIMGPPrintProgressDlg::PostLayoutDynInitL"); - TSize screenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); - TInt bitmapPosY; - if( screenSize.iWidth == KScreenWidthPortrait ) - { - bitmapPosY = KBrandingBitmapPosPortY; - } - else - { - bitmapPosY = KBrandingBitmapPosLandY; - } - CAknProgressDialog::PostLayoutDynInitL(); - CEikCaptionedControl* capControl = GetFirstLineOnFirstPageOrNull(); - if( capControl ) - { - capControl->SetPosition( TPoint( 0, 0 ) ) ; - } - Line( EBrandingBitmap )->SetPosition( TPoint( 70, 20 ) ); - Control( EBrandingBitmap )->SetPosition( TPoint( 0, bitmapPosY ) ); - Line( EBrandingBitmap )->SetRect( TRect( TPoint( 70, bitmapPosY ), TPoint( 180, bitmapPosY+40 ) ) ); - } - -// Overloaded method to enable the bitmap to appear to dialog -CEikCaptionedControl* CIMGPPrintProgressDlg::GetFirstLineOnFirstPageOrNull() - { - return Line( EPrintWaitNote ); - } - -void CIMGPPrintProgressDlg::HandleResourceChange( TInt aType ) - { - LOG1("CIMGPPrintProgressDlg::HandleResourceChange: %d", aType); - //if (aType == KEikDynamicLayoutVariantSwitch) - // { - CAknNoteDialog::HandleResourceChange( aType ); - TRAP_IGNORE ( PostLayoutDynInitL() ); - // } - } - -TKeyResponse CIMGPPrintProgressDlg::OfferKeyEventL( const TKeyEvent &/*aKeyEvent*/, TEventCode /*aType*/ ) - { - return EKeyWasConsumed; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintutils.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/cimgpprintutils.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cimgpprintutils.h" -#include "imageprint.h" -#include "cimageprintsettingsview.h" -#include "mdiscoveryobserver.h" -#include "cimageprintdoc.h" -#include "imgpprintapputil.h" -#include "imageprintapp.hrh" -#include "mprintsettings.h" -#include "cimgpprintdlgmanager.h" -#include "clog.h" -#include "cimageprintengine.h" -#include "ciffactory.h" -#include "cuiprotocolcontroller.h" -#include "imageprintconsts.h" -#include "printmessagecodes.h" -#include "mprinteventregisterif.h" - -#ifndef __WINS__ -_LIT( KEngineRsc, "imageprintengine.rsc" ); -_LIT( KImagePrintAppRsc, "imageprintapp.rsc" ); -#else -_LIT( KEngineRsc, "imageprintengine.rsc" ); -_LIT( KImagePrintAppRsc, "imageprintapp.rsc" ); -#endif - -EXPORT_C CIMGPPrintUtils* CIMGPPrintUtils::NewL( MAiwObserver* aAiwObserver ) - { - CIMGPPrintUtils* self = NewLC( aAiwObserver ); - CleanupStack::Pop(self); - return self; - } - -CIMGPPrintUtils* CIMGPPrintUtils::NewLC( MAiwObserver* aAiwObserver ) - { - CIMGPPrintUtils* self = - new (ELeave) CIMGPPrintUtils; - CleanupStack::PushL(self); - self->ConstructL( aAiwObserver ); - return self; - } -// Second class constructor -void CIMGPPrintUtils::ConstructL( MAiwObserver* aAiwObserver ) - { - iAiwObserver = aAiwObserver; - -#ifndef __WINS__ - TFileName file; - TParse parse; - parse.Set( file, NULL, NULL ); - file.Append( KDC_APP_RESOURCE_DIR ); - file.Append( KImagePrintAppRsc ); - TFileName file2; - parse.Set( file2, NULL, NULL ); - file2.Append( KDC_RESOURCE_FILES_DIR ); - file2.Append( KEngineRsc ); -#else - TFileName file; - file.Append( KDC_APP_RESOURCE_DIR ); - file.Append( KImagePrintAppRsc); - TFileName file2; - file2.Append( KDC_RESOURCE_FILES_DIR ); - file2.Append( KEngineRsc ); -#endif - // get the best matching resource for the current locale - BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), file ); - iResourceOffset = CCoeEnv::Static()->AddResourceFileL( file ); - - // get the best matching resource for the current locale - BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), file2 ); - iResourceOffset2 = CCoeEnv::Static()->AddResourceFileL( file2 ); - - TRAPD( err, iEngine = CImagePrintEngine::NewL( 0 )); - if ( err == KErrInUse ) - { - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_CONCURRENT_NOTE ); - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - User::Leave( KErrInUse ); - } - else - { - User::LeaveIfError( err ); - } - - iSettings = iEngine->InterfaceFactory().SettingsIF(); - - if ( iEngine->InterfaceFactory().IsApplicationAlreadyInUse() ) - { - HBufC* buf = StringLoader::LoadLC( R_QTN_PRINT_CONCURRENT_NOTE ); - CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue ); - errornote->ExecuteLD( *buf ); - CleanupStack::PopAndDestroy( buf ); - User::Leave( KErrInUse ); - } - - // Default value for printer UID before printer is selected. - iPrinterUID = -1; - - iIdle = CIdle::NewL( CActive::EPriorityIdle ); - } - -// Destructor -CIMGPPrintUtils::~CIMGPPrintUtils() - { - CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); - CCoeEnv::Static()->DeleteResourceFile( iResourceOffset2 ); - - if ( iEngine ) - { - iEngine->InterfaceFactory().PrintEventRegisterIF()->UnRegisterObserver( this ); - } - - if (iPrintDlgManager) - { - delete iPrintDlgManager; - } - delete iProtocolController; - delete iEngine; - delete iIdle; - } - -// Set the printer uid in the UI side -void CIMGPPrintUtils::SetPrinterUID( TInt aPrinterUID ) - { - iPrinterUID = aPrinterUID; - } - -// Get the printer uid in the UI side -TInt CIMGPPrintUtils::GetPrinterUID() - { - return iPrinterUID; - } - -CImagePrintEngine& CIMGPPrintUtils::Engine() const - { - return *iEngine; - } - -EXPORT_C TBool CIMGPPrintUtils::CheckMIMEType( const TDesC8& aMimeType, - const TFileName& aFileName ) - { - TBool retVal(ETrue); - TBuf8<128> mimeType; - mimeType.Zero(); - - RFs fServer; - TInt res = fServer.Connect(); - if ( res != KErrNone ) - { - return EFalse; - } - - TRAPD( err, CImageDecoder::GetMimeTypeFileL(fServer, aFileName, mimeType) ); - fServer.Close(); - if ( err != KErrNone ) - { - retVal = EFalse; - } - else if ( aMimeType.Length() > 0 ) - { - // Check that MIME-type matches, otherwise don't use the image - if ( mimeType.CompareF( aMimeType ) != 0 ) - { - retVal = EFalse; - } - } - return retVal; - } - - -// Print -EXPORT_C void CIMGPPrintUtils::StartPrintingL( CDesCArrayFlat* aImages ) - { - iEngine->InterfaceFactory().PrintEventRegisterIF()->RegisterObserver( this ); - iEngine->SetImageArrayL(aImages); - iProtocolController = CUIProtocolController::NewL( this, iEngine->InterfaceFactory() ); - TBool printerFound = iProtocolController->SearchDefaultPrinterL(); - iSettings->UpdateNumberOfCopiesToServer(); - if( printerFound ) - { - LOG( "CIMGPPrintUtils::StartPrintingL default printer found, printing" ); - PrintL(); - } - else - { - LOG( "CIMGPPrintUtils::StartPrintingL default printer NOT found, leaving" ); - User::Leave( KErrCancel ); - } - } - -void CIMGPPrintUtils::PrintL() - { - LOG( "CIMGPPrintUtils::PrintL Start" ); - TInt prot = iSettings->GetCurrentPrinterProtocol(); - TUint vendor = iSettings->GetCurrentPrinterVendor(); - TBool mmc = EFalse; - if( prot == MDiscoveryObserver::EMMC ) - { - mmc = ETrue; - } - else - { - mmc = EFalse; - } - - delete iPrintDlgManager; - iPrintDlgManager = 0; - iPrintDlgManager = CIMGPPrintDlgManager::NewL( 1, - iEngine->InterfaceFactory().PrintJobIF(), 1, mmc, vendor, this ); - iPrintDlgManager->StartPrintingL(); - LOG( "CIMGPPrintUtils::PrintL End" ); - } - -void CIMGPPrintUtils::JobFinished() - { - iAiwObserver->JobFinished(); - } - -void CIMGPPrintUtils::UsbCableDisconnected() - { - iAiwObserver->JobFinished(); - } - -void CIMGPPrintUtils::RestartPrintingL() - { - TBool printerFound = iProtocolController->FullSearchL(); - if( printerFound ) - { - LOG( "CIMGPPrintUtils::RestartPrinting: printer selected, printing" ); - iSettings->UpdateNumberOfCopiesToServer(); - PrintL(); - } - else - { - LOG( "CIMGPPrintUtils::RestartPrinting: printer not selected, leaving" ); - iAiwObserver->JobFinished(); - } - } - -void CIMGPPrintUtils::PrintJobProgress( TInt /*aStatus*/, - TInt /*aPercentCompletion*/, - TInt /*aJobStateCode*/ ) - { - // No implementation - } - -void CIMGPPrintUtils::PrintJobError( TInt aError, TInt aErrorStringCode ) - { - if ( aError == KHCIErrorBase-EPageTimedOut && - aErrorStringCode == EObexConnectError ) - { - //If full discovery is not wanted, uncomment next two lines for error msg & quit - //TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( aError, aErrorStringCode )); - iIdle->Cancel(); - iIdle->Start( TCallBack( IdleCallbackL, this )); - } - } - -TInt CIMGPPrintUtils::IdleCallbackL( TAny* aObj ) - { - CIMGPPrintUtils* obj = static_cast( aObj ); - obj->RestartPrintingL(); - return EFalse; - } - -void CIMGPPrintUtils::PrinterStatus( TInt /*aError*/, TInt /*aErrorStringCode*/ ) - { - // No implementation - } - -EXPORT_C void CIMGPPrintUtils::GetDataFilePathL( TFileName& aFileName ) - { - TInt phoneMemoryNumber( 0 ); - User::LeaveIfError( DriveInfo::GetDefaultDrive( - DriveInfo::EDefaultPhoneMemory, phoneMemoryNumber ) ); - - TDriveUnit unit( phoneMemoryNumber ); - - aFileName.Append( unit.Name() ); - aFileName.Append( KParamFile ); - } - - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/cuiprotocolcontroller.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/cuiprotocolcontroller.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,558 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include - -#include "cuiprotocolcontroller.h" -#include "muimodeobserver.h" -#include "ciffactory.h" -#include "midleprinteventregisterif.h" -#include "mdiscovery.h" -#include "mprintjob.h" -#include "mprintsettings.h" -#include "mdiscoveryobserver.h" -#include "tprinter.h" -#include "imgpprintapputil.h" -#include "ccustomnotedialog.h" -#include "clog.h" - -const TInt KMMCID( 1 ); - -// CONSTRUCTOR -EXPORT_C CUIProtocolController* CUIProtocolController::NewL( - MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ) - { - CUIProtocolController* self = NewLC( aProtocolObserver, - aIFFactory ); - CleanupStack::Pop( self ); - return self; - } - -CUIProtocolController* CUIProtocolController::NewLC( - MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ) - { - CUIProtocolController* self = new ( ELeave ) CUIProtocolController( - aProtocolObserver, - aIFFactory ); - CleanupStack::PushL( self ); - self->ConstructL( aIFFactory ); - return self; - } - -// Default constructor -CUIProtocolController::CUIProtocolController( - MProtocolObserver* aProtocolObserver, - CIFFactory& aIFFactory ) : - iProtocolObserver(aProtocolObserver) - { - iIFFactory = &aIFFactory; - iClassState = ENormalState; - iDiscoveryDlgManager = NULL; - iStartUsb = EFalse; - iWasUsbDisconnected = EFalse; - } - -// 2nd phase constructor -void CUIProtocolController::ConstructL( CIFFactory& aIFFactory ) - { - iIdleEventRegister = aIFFactory.IdlePrintEventRegisterIF(); - - // Register to receive idle event from engine - iIdleEventRegister->RegisterObserver( this ); - - iSettings = aIFFactory.SettingsIF(); - iDiscovery = aIFFactory.DiscoveryIF(); - } - -// Destructor -CUIProtocolController::~CUIProtocolController() - { - if(iUSBConnectionWaitNote) - { - delete iUSBConnectionWaitNote; - iUSBConnectionWaitNote = NULL; - } - - // Unregister from engine - if ( iIdleEventRegister ) - { - iIdleEventRegister->UnRegisterObserver( this ); - } - } - - -EXPORT_C TBool CUIProtocolController::SearchDefaultPrinterL() - { - LOG("CUIProtocolController::SearchDefaultPrinterL START"); - TBool retValue = EFalse; - TInt defaultProtocol = -1; - TBool usbOnlyMode = EFalse; - - // Get supported protocols from the engine - TInt supportedProtocols = iIFFactory->DiscoveryIF()->SupportedProtocols(); - - // If PictBridge is only supported protocol, set it as default - if( !(supportedProtocols & KImagePrint_PrinterProtocol_BPP) && - !(supportedProtocols & KImagePrint_PrinterProtocol_DPOF) && - !(supportedProtocols & KImagePrint_PrinterProtocol_UPnP) && - (supportedProtocols & KImagePrint_PrinterProtocol_PictBridge) ) - { - LOG("CUIProtocolController::SearchDefaultPrinterL: USB only mode detected"); - defaultProtocol = MDiscoveryObserver::EUSB; - usbOnlyMode = ETrue; - } - // If usb is connected and PictBridge selected it will be used - else if( iDiscovery->IsPictBridgeMode() > 0 ) - { - defaultProtocol = MDiscoveryObserver::EUSB; - } - else // check default printer. - { - LOG("iSettings->GetDefaultPrinterProtocol()"); - defaultProtocol = iSettings->GetDefaultPrinterProtocol(); - LOG1("defaultProtocol = %d",defaultProtocol); - } - - retValue = SetDefaultPrinterL( defaultProtocol ); - - // If there is no default printer or default printer not available - // start settings view with no printer information (but not in usb only mode) - if( retValue == EFalse && usbOnlyMode == EFalse ) - { - retValue = ETrue; - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::ENOPRINTER ); - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::ENOPRINTER ); - HBufC* noPrinterText = StringLoader::LoadLC( R_PRINT_NO_PRINTER ); - iSettings->SetCurrentPrinterName( *noPrinterText ); - iSettings->SetDefaultPrinterNameL( *noPrinterText ); - CleanupStack::PopAndDestroy ( noPrinterText ); //noPrinterText - } - - if( iStartUsb ) - { - iStartUsb = EFalse; - defaultProtocol = MDiscoveryObserver::EUSB; - retValue = SearchUSBPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EUSB ); - - // In USB case it also must be checked whether default printer is - // set at this point, and if not, set USB as default. This is because - // in normal cases usb overrides the default protocol without - // changing itself to default. - TInt realDefault = iSettings->GetDefaultPrinterProtocol(); - if ( realDefault == KErrNotFound ) - { - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EUSB ); - iSettings->SetDefaultPrinterNameL( *iSettings->GetCurrentPrinterName() ); - } - } - } - - LOG("CUIProtocolController::SearchDefaultPrinterL END"); - return retValue; - } - -TBool CUIProtocolController::SetDefaultPrinterL( TInt aDefaultProtocol ) - { - TBool retValue = EFalse; - switch( aDefaultProtocol ) - { - case MDiscoveryObserver::EUSB: - { - retValue = SearchUSBPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EUSB ); - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EUSB ); - iSettings->SetDefaultPrinterNameL( *iSettings->GetCurrentPrinterName() ); - } - return retValue; - } - case MDiscoveryObserver::EBPP: - { - retValue = SearchDefaultBTPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EBPP ); - } - return retValue; - } - case MDiscoveryObserver::EOPP: - { - retValue = SearchDefaultBTPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EOPP ); - } - return retValue; - } - case MDiscoveryObserver::EMMC: - { - retValue = SearchMMCPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EMMC ); - } - return retValue; - } - case MDiscoveryObserver::EWLAN: - { - retValue = SearchDefaultUPnPPrinterL(); - if( retValue ) - { - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EWLAN ); - } - return retValue; - } - - default: - { - return retValue; - } - } - } - -// Changes default printer -EXPORT_C TBool CUIProtocolController::ChangeDefaultPrinterL( TInt aProtocol ) - { - LOG("CUIProtocolController::ChangeDefaultPrinterL START"); - TBool retValue; - TInt previousDefaultProtocol = iSettings->GetDefaultPrinterProtocol(); - iSettings->SetDefaultPrinterProtocol( KErrNotFound ); - iClassState = EDiscoveryOngoing; - - switch( aProtocol ) - { - case MDiscoveryObserver::EUSB: - { - retValue = SearchUSBPrinterL(); - if( retValue ) - { - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EUSB ); - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EUSB ); - iSettings->SetDefaultPrinterNameL( *iSettings->GetCurrentPrinterName() ); - } - break; - } - - case MDiscoveryObserver::EBPP: - { - retValue = SearchBTPrinterL(); - if( retValue ) - { - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EBPP ); - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EBPP ); - } - break; - } - - case MDiscoveryObserver::EMMC: - { - retValue = SearchMMCPrinterL(); - if( retValue ) - { - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EMMC ); - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EMMC ); - } - break; - } - - case MDiscoveryObserver::EWLAN: - { - retValue = SearchUPnPPrinterL(); - if( retValue ) - { - iSettings->SetDefaultPrinterProtocol( MDiscoveryObserver::EWLAN ); - iSettings->SetCurrentPrinterProtocol( MDiscoveryObserver::EWLAN ); - } - - break; - } - - default: - { - // protocol not supported - retValue = EFalse; - break; - } - } - - if ( retValue == EFalse ) - { - iSettings->SetDefaultPrinterProtocol( previousDefaultProtocol ); - LOG1("CUIProtocolController::ChangeDefaultPrinterL iClassState == %d", iClassState); - if ( iClassState == EUSBDisconnectedDuringDiscovery ) - { - iClassState = ENormalState; - UsbPrinterDisconnected(); - } - else if( MDiscoveryObserver::EUSB == previousDefaultProtocol && iWasUsbDisconnected ) - { - LOG("CUIProtocolController::ChangeDefaultPrinterL nothing selected, but usb previously disconnected, discoverying"); - SearchDefaultPrinterL(); - } - } - iClassState = ENormalState; - LOG("CUIProtocolController::ChangeDefaultPrinterL END"); - return retValue; - } - -TBool CUIProtocolController::SearchUSBPrinterL() - { - LOG("CUIProtocolController::SearchUSBPrinterL START"); - TBool retValue = EFalse; - - // if the cable is not physically connected, show connect usb cable note - if( !IsUsbCableConnected() ) - { - ShowConnectUsbCableNoteL(); - - // Active scheduler is used here to make this method synchronous - CActiveScheduler::Start(); - } - // If usb cable is connected and pictbridge mode - if( iDiscovery->IsPictBridgeMode() > 0 ) - { - CDiscoveryDlgManager* discoveryDlgManager = - CDiscoveryDlgManager::NewLC( *iIFFactory ); - retValue = discoveryDlgManager->StartDlgManagerL( - KImagePrint_PrinterProtocol_PictBridge, ETrue ); - CleanupStack::PopAndDestroy( discoveryDlgManager ); - discoveryDlgManager = NULL; - } - LOG("CUIProtocolController::SearchUSBPrinterL END"); - return retValue; - } - -// Takes BT printer in use -TBool CUIProtocolController::SearchDefaultBTPrinterL() - { - LOG("CUIProtocolController::SearchDefaultBTPrinterL START"); - TBool retValue = EFalse; - - CDiscoveryDlgManager* discoveryDlgManager = - CDiscoveryDlgManager::NewLC( *iIFFactory ); - retValue = discoveryDlgManager->StartDlgManagerL( KAllBTProtocols, ETrue ); - CleanupStack::PopAndDestroy( discoveryDlgManager ); - discoveryDlgManager = NULL; - LOG("CUIProtocolController::SearchDefaultBTPrinterL END"); - return retValue; - } - -// Takes mmc in use -TBool CUIProtocolController::SearchMMCPrinterL() - { - LOG("CUIProtocolController::SearchMMCPrinterL START"); - TBool retValue = EFalse; - - TInt err = iDiscovery->ChoosePrinterL( KMMCID ); - if( err == KErrNone) - { - LOG("Print job done succesfully with MMC DEFAULT PRINTER"); - // Set current printer name to be mmc - HBufC* mmcText = StringLoader::LoadLC - ( R_QTN_PRINT_MEMORY_CARD ); - iSettings->SetCurrentPrinterName( *mmcText ); - // Set vendor to none - iSettings->SetCurrentPrinterVendor( TPrinter::EVendorNone ); - - CleanupStack::PopAndDestroy(); //mmmcText - retValue = ETrue; - } - LOG("CUIProtocolController::SearchMMCPrinterL END"); - return retValue; - } - -// Searches WLAN printers -TBool CUIProtocolController::SearchUPnPPrinterL() - { - LOG("CUIProtocolController::SearchUPnPPrinterL START"); - TBool retValue = EFalse; - CDiscoveryDlgManager* discoveryDlgManager = - CDiscoveryDlgManager::NewLC( *iIFFactory ); - retValue = discoveryDlgManager->StartDlgManagerL( KImagePrint_PrinterProtocol_UPnP ); - CleanupStack::PopAndDestroy( discoveryDlgManager ); - discoveryDlgManager = NULL; - LOG("CUIProtocolController::SearchUPnPPrinterL END"); - return retValue; - } - -// Takes WLAN printer in use -TBool CUIProtocolController::SearchDefaultUPnPPrinterL() - { - LOG("CUIProtocolController::SearchDefaultUPnPPrinterL START"); - TBool retValue = EFalse; - - CDiscoveryDlgManager* discoveryDlgManager = - CDiscoveryDlgManager::NewLC( *iIFFactory ); - retValue = discoveryDlgManager->StartDlgManagerL( KImagePrint_PrinterProtocol_UPnP, ETrue ); - CleanupStack::PopAndDestroy( discoveryDlgManager ); - discoveryDlgManager = NULL; - LOG("CUIProtocolController::SearchDefaultUPnPPrinterL END"); - return retValue; - } - -TBool CUIProtocolController::SearchBTPrinterL() - { - LOG("CUIProtocolController::SearchBTPrinterL START"); - TBool retValue = EFalse; - CDiscoveryDlgManager* discoveryDlgManager = - CDiscoveryDlgManager::NewLC( *iIFFactory ); - retValue = discoveryDlgManager->StartDlgManagerL( KAllBTProtocols ); - CleanupStack::PopAndDestroy( discoveryDlgManager ); - discoveryDlgManager = NULL; - LOG("CUIProtocolController::SearchBTPrinterL END"); - return retValue; - } - -// Searches all supported protocols -TBool CUIProtocolController::FullSearchL() - { - LOG("CUIProtocolController::FullSearchL START"); - TBool retValue = EFalse; - iDiscoveryDlgManager = CDiscoveryDlgManager::NewL( *iIFFactory ); - LOG("CUIProtocolController::FullSearchL before Fullsearch"); - retValue = iDiscoveryDlgManager->StartDlgManagerL(); - LOG("CUIProtocolController::FullSearchL after FullSearch"); - delete iDiscoveryDlgManager; - iDiscoveryDlgManager = NULL; - LOG("CUIProtocolController::FullSearchL END"); - return retValue; - } - -// Is the usb cable connected to phone or not -TBool CUIProtocolController::IsUsbCableConnected() - { - LOG("CUIProtocolController::IsUsbCableConnected START"); - TInt err = iUsbManager.Connect(); - if ( err == KErrNone ) - { - iUsbManager.GetDeviceState( iDeviceState ); - iUsbManager.Close(); - } - else - { - LOG("CUIProtocolController::IsUsbCableConnected iUsbManager.Connect() FAIL"); - } - LOG("CUIProtocolController::IsUsbCableConnected END"); - return ( iDeviceState != EUsbDeviceStateUndefined ); - } - -void CUIProtocolController::ShowConnectUsbCableNoteL() - { - LOG("CUIProtocolController::ShowConnectUsbCableNote START"); - iUSBConnectionWaitNote = new (ELeave) CCustomNoteDialog( - reinterpret_cast< CEikDialog** > (&iUSBConnectionWaitNote) ); - iUSBConnectionWaitNote->SetCallback( this ); - iUSBConnectionWaitNote->ExecuteLD(R_CONNECT_USB); - LOG("CUIProtocolController::ShowConnectUsbCableNote END"); - } - -// MProgressDialogCallback method -void CUIProtocolController::DialogDismissedL(TInt /*aButtonId*/ ) - { - LOG("CUIProtocolController::DialogDismissedL START"); - CActiveScheduler::Stop(); - LOG("CUIProtocolController::DialogDismissedL END"); - } - -//Idle observer method -void CUIProtocolController::UsbPrinterDisconnected() - { - LOG("CUIProtocolController::UsbPrinterDisconnected START"); - if( iSettings->GetCurrentPrinterProtocol() == MDiscoveryObserver::EUSB ) - { - LOG1("CUIProtocolController::UsbPrinterConnected iClassState is %d", iClassState); - if ( iClassState == EDiscoveryOngoing || iClassState == EUSBDisconnectedDuringDiscovery ) - { - iClassState = EUSBDisconnectedDuringDiscovery; - iWasUsbDisconnected = ETrue; - LOG("CUIProtocolController::UsbPrinterConnected iClassState is now EUSBDisconnectedDuringDiscovery"); - } - else - { - iProtocolObserver->UsbCableDisconnected(); - } - } - LOG("CUIProtocolController::UsbPrinterDisconnected END"); - } - -//Idle observer method -void CUIProtocolController::UsbPrinterConnected() - { - LOG("CUIProtocolController::UsbPrinterConnected START"); - if( EUSBDisconnectedDuringDiscovery == iClassState ) - { - iClassState = EDiscoveryOngoing; - LOG("CUIProtocolController::UsbPrinterConnected iClassState is now EDiscoveryOngoing"); - } - - if( iUSBConnectionWaitNote ) // Remove wait note and start discovery - { - delete iUSBConnectionWaitNote; - iUSBConnectionWaitNote = NULL; - } - else - { - if(iDiscoveryDlgManager) - { - iStartUsb = ETrue; - iDiscoveryDlgManager->CancelDiscovery(); - } - } - LOG("CUIProtocolController::UsbPrinterConnected END"); - } - -//Idle observer method -void CUIProtocolController::UsbStateChanged( TImgPrintUSBState aState, TInt aError ) - { - LOG("CUIProtocolController::UsbStateChanged START"); - if ( aState == ENOUSBEvent ) - { - TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( aError ) ); - } - LOG("CUIProtocolController::UsbStateChanged END"); - } - -//Idle observer method -void CUIProtocolController::ReadyToContinue() - { - LOG("CUIProtocolController::ReadyToContinue START"); - LOG("CUIProtocolController::ReadyToContinue END"); - } - -void CUIProtocolController::AsynchronousServerLeave( TInt /*aError*/ ) - { - LOG("CUIProtocolController::AsynchronousServerLeave START"); - - // Cancel discovery in case of server leave. No can do if Cancel leaves. - LOG("CUIProtocolController::AsynchronousServerLeave CancelDeviceDiscoveryL()"); - TRAP_IGNORE( iIFFactory->DiscoveryIF()->CancelDeviceDiscoveryL() ); - - // Cancel printing in case of server leave. No can do if Cancel leaves. - TRAP_IGNORE( iIFFactory->PrintJobIF()->CancelL() ); - LOG("CUIProtocolController::AsynchronousServerLeave END"); - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/imgpprintdll/src/imgpprintapputil.cpp --- a/ImagePrint/ImagePrintUI/imgpprintdll/src/imgpprintapputil.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,558 +0,0 @@ -/* -* Copyright (c) 2004-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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "clog.h" -#include "imgpprintapputil.h" -#include "printmessagecodes.h" -#include "cimgpprintutils.h" - -const TInt KClientErrorForbidden = 1025; - -// Displays the error note -void IMGPPrintAppUtil::ShowErrorNoteL( - TInt aResourceId ) - { - HBufC* str = StringLoader::LoadLC( aResourceId ); - CAknErrorNote* note = new ( ELeave ) CAknErrorNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy(); // str - } - -// Displays the information note -void IMGPPrintAppUtil::ShowInfoNoteL( - TInt aResourceId ) - { - HBufC* str = StringLoader::LoadLC( aResourceId ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy(); // str - } - -// Displays error message based on the error code -void IMGPPrintAppUtil::ShowErrorMsgL( - TInt aErrCode, TInt aErrorStringCode ) - { - if ( aErrCode == KErrNoMemory ) - { - CCoeEnv::Static()->HandleError( aErrCode ); - } - else if ( aErrCode != KErrNone ) - { - HBufC* str = IMGPPrintAppUtil::PrintErrorMsgLC( aErrCode, aErrorStringCode ); - CAknErrorNote* note = new ( ELeave ) CAknErrorNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy(); // str - } - } - -// Loads printer application specific error message -HBufC* IMGPPrintAppUtil::PrintErrorMsgLC( - TInt aErrCode, TInt aErrorStringCode ) - { - HBufC* errStr = 0; - TInt resourceId( 0 ); - TInt finalErrCode( 0 ); - - if ( aErrorStringCode ) - { - HandleByStringCodeL( aErrCode, aErrorStringCode, resourceId ); - } - - if ( resourceId == 0 ) - { - HandleByErrorCodeL( resourceId, finalErrCode, aErrCode ); - } - else - { - finalErrCode = aErrorStringCode; - } - - errStr = StringLoader::LoadLC( resourceId ); - -// Add error code to message only when debug build is created. -#ifdef _DEBUG - if ( finalErrCode != 0 ) - { - // append error code to message - _LIT( KErrTmp, ": %d" ); - TBuf<32> errCodeMsg; - errCodeMsg.Format( KErrTmp, finalErrCode ); - errStr = errStr->ReAllocL( errStr->Length() + 32 ); - CleanupStack::Pop(); // errStr before realloc - CleanupStack::PushL( errStr ); - TPtr p( errStr->Des() ); - p += errCodeMsg; - } -#endif // _DEBUG - return errStr; - } - -void IMGPPrintAppUtil::HandleByStringCodeL( TInt aErrCode, TInt aErrorStringCode, TInt& aResourceId ) - { - TBool matchOne = ETrue; - TBool matchTwo = ETrue; - TBool matchThree = ETrue; - StringCodeInkL( aErrorStringCode, aResourceId, matchOne ); - StringCodeHwL( aErrorStringCode, aResourceId, matchTwo ); - StringCodePaperL( aErrorStringCode, aResourceId, matchThree ); - - if ( !matchOne && !matchTwo && !matchThree) - { - switch ( aErrorStringCode ) - { - case EObexConnectError: //-3000 - { - if ( aErrCode == KHCIErrorBase-EPageTimedOut ) //-6004 - { - aResourceId = R_NOTE_CONNECT_PRINT_ERROR; - } - else if ( aErrCode == KHCIErrorBase-EHostResourceRejection ) //-6013 - { - aResourceId = R_NOTE_SEND_PRINT_ERROR; - } - else - { - aResourceId = R_NOTE_CONNECT_PRINT_ERROR; - } - } - break; - - case KErrL2CAPRequestTimeout: - aResourceId = R_NOTE_SEND_PRINT_ERROR; - break; - - case KErrDisconnected: - // If aError check is needed, it is in one case -6305. - aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - case EObexGeneralError: - aResourceId = R_NOTE_GENERAL_PRINT_ERROR; - break; - - case EPbStatusErrorReasonFileFileDecode: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE; - break; - - case EPbStatusErrorReasonFile: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE; - break; - - case EPbStatusErrorReasonWarning: - aResourceId = R_NOTE_PRINT_STATUS_ERROR; - break; - - case EPbStatusErrorReasonNoReason: - aResourceId = R_NOTE_PRINT_STATUS_ERROR; - break; - - case EPbOutOfPaper: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT; - break; - - case EPrintReasonPaused: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED; - break; - - case EPrintReasonOutputAreaAlmostFull: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL; - break; - - case EPrintReasonOutputAreaFull: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL; - break; - - case EPrintReasonMarkerFailure: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE; - break; - - default: - break; - } - } - } -void IMGPPrintAppUtil::StringCodeInkL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ) - { - switch ( aErrorStringCode ) - { - case EPbStatusErrorReasonInkLow: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW; - break; - - case EPbStatusErrorReasonInkWaste: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE; - break; - - case EPbStatusErrorReasonInk: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK; - break; - - case EPbStatusErrorReasonInkEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT; - break; - - case EPrintReasonMarkerSupplyLow: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW; - break; - - case EPrintReasonMarkerSupplyEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY; - break; - - default: - aMatch = EFalse; - break; - } - } - -void IMGPPrintAppUtil::StringCodeHwL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ) - { - switch ( aErrorStringCode ) - { - case EPbStatusErrorReasonHardwareCoverOpen: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN; - break; - - case EPbStatusErrorReasonHardwareFatal: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL; - break; - - case EPbStatusErrorReasonHardwareServiceCall: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL; - break; - - case EPbStatusErrorReasonHardwarePrinterUnavailable: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE; - break; - - case EPbStatusErrorReasonHardwarePrinterBusy: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY; - break; - - case EPbStatusErrorReasonHardwareLever: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER; - break; - - case EPbStatusErrorReasonHardwareNoMarkingAgent: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT; - break; - - case EPbStatusErrorReasonHardwareInkCoverOpen: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN; - break; - - case EPbStatusErrorReasonHardwareNoInkCartridge: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE; - break; - - case EPbStatusErrorReasonHardware: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE; - break; - - default: - aMatch = EFalse; - break; - } - } - -void IMGPPrintAppUtil::StringCodePaperL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch ) - { - switch ( aErrorStringCode ) - { - case EPbStatusErrorReasonPaperLoad: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD; - break; - - case EPbStatusErrorReasonPaperEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT; - break; - - case EPbStatusErrorReasonPaperEject: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT; - break; - - case EPbStatusErrorReasonPaperJam: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM; - break; - - case EPbStatusErrorReasonPaperMedia: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA; - break; - - case EPbStatusErrorReasonPaperNearlyEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW; - break; - - case EPbStatusErrorReasonPaperCombination: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION; - break; - - case EPbStatusErrorReasonPaper: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER; - break; - - default: - aMatch = EFalse; - break; - } - } - -void IMGPPrintAppUtil::HandleByErrorCodeL( TInt& aResourceId, TInt& aFinalErrCode, TInt aErrCode ) - { - aFinalErrCode = aErrCode; - - TBool matchOne = ETrue; - TBool matchTwo = ETrue; - TBool matchThree = ETrue; - ErrorCodeInkL( aResourceId, aErrCode, matchOne ); - ErrorCodeHwL( aResourceId, aErrCode, matchTwo ); - ErrorCodePaperL( aResourceId, aErrCode,matchThree ); - - if ( !matchOne && !matchTwo && !matchThree) - { - switch ( aErrCode ) - { - case KClientErrorForbidden: - aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - case KErrDisconnected: - aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - case EObexGeneralError: - aResourceId = R_NOTE_GENERAL_PRINT_ERROR; - break; - - case EPbStatusErrorReasonFileFileDecode: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE; - break; - - case EPbStatusErrorReasonFile: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE; - break; - - case EPbStatusErrorReasonNoReason: - aResourceId = R_NOTE_PRINT_STATUS_ERROR; - break; - - case KErrCorrupt: // Only corrupted images selected: - aResourceId = R_QTN_PRINT_SELECTNEW_NOTE; - break; - - case EPrintReasonPaused: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED; - break; - - case EPrintReasonOutputAreaAlmostFull: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL; - break; - - case EPrintReasonOutputAreaFull: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL; - break; - - case EPrintReasonMarkerFailure: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE; - break; - - case KErrHostUnreach: - aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - case ( KHCIErrorBase-EHostResourceRejection ): - aResourceId = R_NOTE_SEND_PRINT_ERROR; - break; - - case ( KHCIErrorBase-ERemoteHostTimeout ): - aResourceId = R_NOTE_SEND_PRINT_ERROR; - break; - - case ( KHCIErrorBase-EPageTimedOut ): - aResourceId = R_NOTE_CONNECT_PRINT_ERROR; - break; - - case KErrHCILinkDisconnection: - aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR; - break; - - default: - aResourceId = R_NOTE_GENERAL_PRINT_ERROR; - break; - } - } - } - -void IMGPPrintAppUtil::ErrorCodeInkL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ) - { - switch ( aErrCode ) - { - case EPbStatusErrorReasonInkLow: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW; - break; - - case EPbStatusErrorReasonInkWaste: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE; - break; - - case EPbStatusErrorReasonInk: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK; - break; - - case EPrintReasonMarkerSupplyLow: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW; - break; - - case EPrintReasonMarkerSupplyEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY; - break; - - case EPbStatusErrorReasonInkEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT; - break; - - default: - aMatch = EFalse; - break; - } - } - -void IMGPPrintAppUtil::ErrorCodeHwL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ) - { - switch ( aErrCode ) - { - case EPbStatusErrorReasonHardwareCoverOpen: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN; - break; - - case EPbStatusErrorReasonHardwareFatal: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL; - break; - - case EPbStatusErrorReasonHardwareServiceCall: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL; - break; - - case EPbStatusErrorReasonHardwarePrinterUnavailable: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE; - break; - - case EPbStatusErrorReasonHardwarePrinterBusy: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY; - break; - - case EPbStatusErrorReasonHardwareLever: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER; - break; - - case EPbStatusErrorReasonHardwareNoMarkingAgent: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT; - break; - - case EPbStatusErrorReasonHardwareInkCoverOpen: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN; - break; - - case EPbStatusErrorReasonHardwareNoInkCartridge: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE; - break; - - case EPbStatusErrorReasonHardware: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE; - break; - - default: - aMatch = EFalse; - break; - } - } - -void IMGPPrintAppUtil::ErrorCodePaperL( TInt& aResourceId, TInt aErrCode, TBool& aMatch ) - { - switch ( aErrCode ) - { - case EPbStatusErrorReasonPaperLoad: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD; - break; - - case EPbStatusErrorReasonPaperEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT; - break; - - case EPbStatusErrorReasonPaperEject: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT; - break; - - case EPbStatusErrorReasonPaperJam: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM; - break; - - case EPbStatusErrorReasonPaperMedia: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA; - break; - - case EPbStatusErrorReasonPaperNearlyEmpty: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW; - break; - - case EPbStatusErrorReasonPaperCombination: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION; - break; - - case EPbStatusErrorReasonPaper: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER; - break; - - case EPbOutOfPaper: - aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT; - break; - - default: - aMatch = EFalse; - break; - } - } - -// Adds application path -TFileName IMGPPrintAppUtil::AddApplicationPath( - const TDesC& aFileName ) - { - CEikonEnv* eikonEnv = CEikonEnv::Static(); - CEikAppUi* appUi = static_cast( eikonEnv->AppUi() ); - TFileName fullFilePath = appUi->Application()->AppFullName(); - delete eikonEnv; eikonEnv = NULL; - - TParse parse; - parse.Set( fullFilePath, NULL, NULL ); - fullFilePath = parse.DriveAndPath(); - fullFilePath.Append( aFileName ); - return fullFilePath; - } - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/inc/logdef.h --- a/ImagePrint/ImagePrintUI/inc/logdef.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2002-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: -* -*/ - - -#ifndef LOGDEF_H -#define LOGDEF_H - -///////////////////////////////////////////////////////////////////////////// -// #Defines that control printing of additional information to debug stream. -///////////////////////////////////////////////////////////////////////////// - -#ifdef _DEBUG -// logging is always enabled in debug builds -#define ENABLE_LOGGING -#else -// manually enable in release builds -//#define ENABLE_LOGGING -#endif // _DEBUG - -//#define LOG_TO_FILE - -#endif // LOGDEF_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/rom/desw_imageprintui.iby --- a/ImagePrint/ImagePrintUI/rom/desw_imageprintui.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2004-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: Image Print UI components. -* -*/ - - -#ifndef DESW_IMAGEPRINTUI_IBY -#define DESW_IMAGEPRINTUI_IBY - -#include - -// Image Print application information file - -data=DATAZ_\APP_BITMAP_DIR\imageprintapp_aif.mif APP_BITMAP_DIR\imageprintapp_aif.mif - -// Non-localisable application registration file -data=DATAZ_\Private\10003A3F\Apps\imageprintapp_reg.rsc Private\10003A3F\Apps\imageprintapp_reg.rsc - -// Image Print UI Binaries -FILE=ABI_DIR\IP_DIR\imageprintengine.dll SHARED_LIB_DIR\imageprintengine.dll - -IP_APP(imageprintapp) - -// UI Resources / Bitmaps -SCALABLE_IMAGE( APP_BITMAP_DIR,APP_BITMAP_DIR, imgprintbitmaps ) - -// View Dll for release 3 purposes. -FILE=ABI_DIR\IP_DIR\imgpprintdll.dll SHARED_LIB_DIR\imgpprintdll.dll - -// Aiw plugin -IP_PLUGIN(aiwprintingprovider.dll,101ffaa2.rsc) - -// Image Print Engine centrep ini file -DATA=DATAZ_\private\10202be9\10208a35.txt Private\10202be9\10208a35.txt - -#endif // DESWIMAGEPRINTUI_IBY diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/ImagePrintUI/rom/imageprintresources.iby --- a/ImagePrint/ImagePrintUI/rom/imageprintresources.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2004-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: Image Print resources. -* -*/ - - -#ifndef IMAGEPRINTRESOURCES_IBY -#define IMAGEPRINTRESOURCES_IBY - -S60_APP_RESOURCE( imageprintapp ) -S60_APP_CAPTION( imageprintapp ) - -DATA=DATAZ_\RESOURCE_FILES_DIR\imageprintengine.rsc RESOURCE_FILES_DIR\imageprintengine.rsc -DATA=DATAZ_\RESOURCE_FILES_DIR\aiwprintingprovider.rsc RESOURCE_FILES_DIR\aiwprintingprovider.rsc - -data=DATAZ_\resource\imageprintdata\protocols\dpof.rsc resource\imageprintdata\protocols\dpof.rsc - -#endif //__IMAGEPRINTRESOURCES_IBY__ diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/clog/group/bld.inf --- a/ImagePrint/clog/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2004-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_MMPFILES -clog.mmp diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/clog/group/clog.mmp --- a/ImagePrint/clog/group/clog.mmp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004-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: -* -*/ - - -TARGET clog.lib -TARGETTYPE lib -UID 0 - -USERINCLUDE ../../ImagePrintEngine/inc -USERINCLUDE ../inc -APP_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src -SOURCE clog.cpp - -#ifdef ENABLE_ABIV2_MODE -DEBUGGABLE_UDEBONLY -#endif diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/clog/inc/clog.h --- a/ImagePrint/clog/inc/clog.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2004-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 __CLOG_H__ -#define __CLOG_H__ - -#include -#include - -#include "logdef.h" - -#ifdef ENABLE_LOGGING -#define LOG(s) Log::DoLog(_L(s)) -#define LOG1(s, v) Log::DoLog( _L(s), v ) -#define LOG2(s, v1, v2) Log::DoLog( _L(s), v1, v2 ) - -#define LOG8(s) Log::DoLog8(_L8(s)) -#define LOG81(s, v) Log::DoLog8( _L8(s), v ) -#define LOG82(s, v1, v2) Log::DoLog8( _L8(s), v1, v2 ) - -#else -#define LOG(s) -#define LOG1(s, v) -#define LOG2(s, v1, v2) -#define LOG8(s) -#define LOG81(s, v) -#define LOG82(s, v1, v2) -#endif // ENABLE_LOGGING - -class Log - { - - public: - - static void DoLog( TRefByValue aText, ... ); - - static void DoLog8( TRefByValue aText, ... ); - }; - -#endif // __CLOG_H__ - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/clog/src/clog.cpp --- a/ImagePrint/clog/src/clog.cpp Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "clog.h" - -#ifdef ENABLE_LOGGING - -#ifdef LOG_TO_FILE - -#include -/// Folder where the log resides -_LIT( KLogFolder, "ip_log" ); -/// The name of the log file -_LIT( KLogFileName, "imageprintlog.txt" ); -/// The format in which the time is formatted in log -_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); -_LIT8( KLogTimeFormat8, "%02d.%02d:%02d:%06d "); -/// The length of the string produced by KLogTimeFormat -const TInt KLogTimeFormatLength = 16; - -#endif // LOG_TO_FILE - -/// How many characters a log line can contain -const TInt KLogLineLength = 256; - -#endif // ENABLE_LOGGING - -#ifdef ENABLE_LOGGING - -void Log::DoLog( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf buf; - buf.FormatList( aText, args ); - -#ifdef LOG_TO_FILE - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); - TBuf timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); -#else - RDebug::Print( buf ); -#endif // LOG_TO_FILE - VA_END( args ); - } - -void Log::DoLog8( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf8 buf; - buf.FormatList( aText, args ); -#ifdef LOG_TO_FILE - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); - TBuf8 timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat8, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); -#else - TBuf buf16; - buf16.Copy(buf); - RDebug::Print( buf16 ); -#endif // LOG_TO_FILE - VA_END( args ); - } - -#endif // ENABLE_LOGGING -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/group/bld.inf --- a/ImagePrint/group/bld.inf Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2004-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 - -#include "../clog/group/bld.inf" -#include "../ImagePrintEngine/group/bld.inf" -#include "../ImagePrintUI/group/bld.inf" -// Help exports -#include "../help/group/bld.inf" - -PRJ_PLATFORMS -WINSCW ARMV5 -PRJ_EXPORTS - -../rom/imageprint.iby CORE_APP_LAYER_IBY_EXPORT_PATH( imageprint.iby ) -../rom/imageprintdef.iby CORE_APP_LAYER_IBY_EXPORT_PATH( imageprintdef.iby ) - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/inc/imageprintvariant.h --- a/ImagePrint/inc/imageprintvariant.h Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2002-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: -* -*/ - - -#ifndef IMAGEPRINTVARIANT_H -#define IMAGEPRINTVARIANT_H - -// Defines dynamic settings to be in use -#define IMG_PRINT_DYNAMIC_PRINT_SETTINGS - -#endif // IMAGEPRINTVARIANT_H - -// End of File diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/rom/imageprint.iby --- a/ImagePrint/rom/imageprint.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2004-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: All Image Print components except resources. -* -*/ - - -#ifndef IMAGEPRINT_IBY -#define IMAGEPRINT_IBY - -#include -#include - -#endif // IMAGEPRINT_IBY \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 ImagePrint/rom/imageprintdef.iby --- a/ImagePrint/rom/imageprintdef.iby Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2004-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: Image Print rom build definition header -* -*/ - -#ifndef IMAGEPRINTDEF_IBY -#define IMAGEPRINTDEF_IBY - -// If __IP_DEBUG__ is defined pull in debug versions of the -// ImagePrint and PrintingDevice DLLs and Plugins regardless of the ROM type - -//#define __IP_DEBUG__ - -#ifdef __IP_DEBUG__ -define IP_DIR UDEB -#define IP_PLUGIN ECOM_PLUGIN_UDEB -#define IP_APP S60_APP_EXE_UDEB -#else -define IP_DIR BUILD_DIR -#define IP_PLUGIN ECOM_PLUGIN -#define IP_APP S60_APP_EXE -#endif - -#endif// IMAGEPRINTDEF_IBY \ No newline at end of file diff -r 08cc4cc059d4 -r 59ea2209bb67 group/bld.inf --- a/group/bld.inf Fri Jun 11 16:24:10 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: Build information file for project printingapps -* -*/ - - - -PRJ_PLATFORMS -DEFAULT -#include "../ImagePrint/group/bld.inf" - -PRJ_EXPORTS - -PRJ_MMPFILES - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS diff -r 08cc4cc059d4 -r 59ea2209bb67 layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - -]> - - - - - - - - - - - diff -r 08cc4cc059d4 -r 59ea2209bb67 sysdef_1_4_0.dtd --- a/sysdef_1_4_0.dtd Fri Jun 11 16:24:10 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -