DirectPrint/DirectPrintApp/inc/directprintbearermgr.h
changeset 19 2275db202402
parent 11 613a5ff70823
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DirectPrint/DirectPrintApp/inc/directprintbearermgr.h	Tue May 11 14:10:02 2010 +0800
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Kanrikogaku Kenkyusho, Ltd. - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* {Description of the file}
+*
+*/
+
+// Protection against nested includes
+#ifndef __DIRECTPRINTBEARERMGR_H__
+#define __DIRECTPRINTBEARERMGR_H__
+
+// System includes
+#include <e32base.h>
+ 
+// User includes
+#include "directprintbearermngobserver.h"
+#include "directprintclient.h"
+#include "directprintjobguarddata.h"
+
+// Forward declarations
+class CDirectPrintModel;
+class CDirectPrintPrintSettings;
+
+// Class declaration
+/**
+ *  Bearer manager class
+ *  more_complete_description
+ */
+class CDirectPrintBearerMgr : public CActive
+	{
+public:
+	/** Status of bearer manager */
+	enum TBearerMngStatus
+		{
+		EBearerMngNotConnected = 0,	// (0)
+		EBearerMngConnected,		// (1)
+		EBearerMngCreatingJob,		// (2)
+		EBearerMngPrinting,			// (3)
+		EBearerMngClosing,			// (4)
+		EBearerMngCanceling,		// (5)
+		};
+
+public:
+	/** Constructors */
+	static CDirectPrintBearerMgr* NewL(MDirectPrintBearerMngObserver* aObserver,
+										CDirectPrintModel& aModel);
+	static CDirectPrintBearerMgr* NewLC(MDirectPrintBearerMngObserver* aObserver,
+										CDirectPrintModel& aModel);
+	/** Destructor */
+	~CDirectPrintBearerMgr();
+
+public:
+	/**
+	 * Create print job.
+	 */
+	void CreateJobL();
+	/**
+	 * Submit print job.
+	 */
+	void SubmitPrintJobL();
+	/**
+	 * Close session.
+	 */
+	void CloseSession();
+
+	/**
+	 * Get status of bearer manager.
+	 *
+	 * @return Status of bearer manager
+	 */
+	TBearerMngStatus BearerStatus();
+
+	TInt SupportedProtocols();
+
+	TInt GetProtocolNames(RSelectItemArray& aNames);
+
+	void InitCapabilitiesL(TInt aIndex);
+
+	TInt GetJobSetting(TInt aCapabilityID, TInt& aValue);
+
+	TInt SetJobSetting(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability);
+
+	void SetJobSettings();
+
+	CDirectPrintPrintSettings* PrinterSettingsL();
+
+protected:
+	CDirectPrintBearerMgr(MDirectPrintBearerMngObserver* aObserver,
+							CDirectPrintModel& aModel);
+	void ConstructL();
+
+private: // from CActive
+
+	void RunL();
+	void DoCancel();
+
+private:
+	void SetBearerStatus(TBearerMngStatus aStatus);
+
+	TInt CreatePrinterUid(TInt aIndex);
+
+private:
+	/** Pointer to bearer manager observer. */
+	MDirectPrintBearerMngObserver* iObserver;
+	/** Bearer object. */
+	RDirectPrintClient iBearer;
+	/** Job guard data. */
+	TDirectPrintJobGuardData iJobGuardData;
+	/** Reference to model class. */
+	CDirectPrintModel& iModel;
+
+	/** Status of bearer manager. */
+	TBearerMngStatus iBearerStatus;
+
+	/** Printer settings. */
+	CDirectPrintPrintSettings* iPrintSettings;
+	};
+
+#endif // __DIRECTPRINTBEARERMGR_H__