|
1 /* |
|
2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * {Description of the file} |
|
16 * |
|
17 */ |
|
18 |
|
19 // Protection against nested includes |
|
20 #ifndef __DIRECTPRINTBEARERMGR_H__ |
|
21 #define __DIRECTPRINTBEARERMGR_H__ |
|
22 |
|
23 // System includes |
|
24 #include <e32base.h> |
|
25 |
|
26 // User includes |
|
27 #include "directprintbearermngobserver.h" |
|
28 #include "directprintclient.h" |
|
29 #include "directprintjobguarddata.h" |
|
30 |
|
31 // Forward declarations |
|
32 class CDirectPrintModel; |
|
33 class CDirectPrintPrintSettings; |
|
34 |
|
35 // Class declaration |
|
36 /** |
|
37 * Bearer manager class |
|
38 * more_complete_description |
|
39 */ |
|
40 class CDirectPrintBearerMgr : public CActive |
|
41 { |
|
42 public: |
|
43 /** Status of bearer manager */ |
|
44 enum TBearerMngStatus |
|
45 { |
|
46 EBearerMngNotConnected = 0, // (0) |
|
47 EBearerMngConnected, // (1) |
|
48 EBearerMngCreatingJob, // (2) |
|
49 EBearerMngPrinting, // (3) |
|
50 EBearerMngClosing, // (4) |
|
51 EBearerMngCanceling, // (5) |
|
52 }; |
|
53 |
|
54 public: |
|
55 /** Constructors */ |
|
56 static CDirectPrintBearerMgr* NewL(MDirectPrintBearerMngObserver* aObserver, |
|
57 CDirectPrintModel& aModel); |
|
58 static CDirectPrintBearerMgr* NewLC(MDirectPrintBearerMngObserver* aObserver, |
|
59 CDirectPrintModel& aModel); |
|
60 /** Destructor */ |
|
61 ~CDirectPrintBearerMgr(); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * Create print job. |
|
66 */ |
|
67 void CreateJobL(); |
|
68 /** |
|
69 * Submit print job. |
|
70 */ |
|
71 void SubmitPrintJobL(); |
|
72 /** |
|
73 * Close session. |
|
74 */ |
|
75 void CloseSession(); |
|
76 |
|
77 /** |
|
78 * Get status of bearer manager. |
|
79 * |
|
80 * @return Status of bearer manager |
|
81 */ |
|
82 TBearerMngStatus BearerStatus(); |
|
83 |
|
84 TInt SupportedProtocols(); |
|
85 |
|
86 TInt GetProtocolNames(RSelectItemArray& aNames); |
|
87 |
|
88 void InitCapabilitiesL(TInt aIndex); |
|
89 |
|
90 TInt GetJobSetting(TInt aCapabilityID, TInt& aValue); |
|
91 |
|
92 TInt SetJobSetting(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability); |
|
93 |
|
94 void SetJobSettings(); |
|
95 |
|
96 CDirectPrintPrintSettings* PrinterSettingsL(); |
|
97 |
|
98 protected: |
|
99 CDirectPrintBearerMgr(MDirectPrintBearerMngObserver* aObserver, |
|
100 CDirectPrintModel& aModel); |
|
101 void ConstructL(); |
|
102 |
|
103 private: // from CActive |
|
104 |
|
105 void RunL(); |
|
106 void DoCancel(); |
|
107 |
|
108 private: |
|
109 void SetBearerStatus(TBearerMngStatus aStatus); |
|
110 |
|
111 TInt CreatePrinterUid(TInt aIndex); |
|
112 |
|
113 private: |
|
114 /** Pointer to bearer manager observer. */ |
|
115 MDirectPrintBearerMngObserver* iObserver; |
|
116 /** Bearer object. */ |
|
117 RDirectPrintClient iBearer; |
|
118 /** Job guard data. */ |
|
119 TDirectPrintJobGuardData iJobGuardData; |
|
120 /** Reference to model class. */ |
|
121 CDirectPrintModel& iModel; |
|
122 |
|
123 /** Status of bearer manager. */ |
|
124 TBearerMngStatus iBearerStatus; |
|
125 |
|
126 /** Printer settings. */ |
|
127 CDirectPrintPrintSettings* iPrintSettings; |
|
128 }; |
|
129 |
|
130 #endif // __DIRECTPRINTBEARERMGR_H__ |