1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declares CUPPrintingJob class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CUPPRINTINGJOB_H |
|
20 #define CUPPRINTINGJOB_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <upnpitem.h> |
|
24 #include <upnpmediaserverclient.h> |
|
25 |
|
26 #include "upconsts.h" |
|
27 #include "tprintcapability.h" |
|
28 #include "cupprintfactory.h" |
|
29 #include "cupjobstate.h" |
|
30 |
|
31 class CUPPrinter; |
|
32 class CUPFileSharingActive; |
|
33 |
|
34 enum TUpnpContainerType |
|
35 { |
|
36 EImageAndVideo = 0 |
|
37 }; |
|
38 |
|
39 |
|
40 #define KMaxIdLength 10 |
|
41 |
|
42 /* |
|
43 * @class CUPPrintingJob |
|
44 * @description This class contains the necessary printing |
|
45 * job information between UPnPStack and MProtPrintingDevice |
|
46 */ |
|
47 NONSHARABLE_CLASS(CUPPrintingJob) : public CBase |
|
48 { |
|
49 public: |
|
50 /* |
|
51 * @function NewL |
|
52 * @description Constructs the CUPPrintingJob object. |
|
53 * NOTE: The ownership of aFileFactory does not change here! |
|
54 * @param aPrinter Selected printer for the job |
|
55 * @param aImages Array of images to be printed |
|
56 * @param aFileFactory Pointer to XHTML-print file factory |
|
57 * @param aUserName User name got from central repository |
|
58 */ |
|
59 static CUPPrintingJob* NewL(CUPPrinter* aPrinter, RArray<TFileName>& aImages, CUPPrintFactory* aFileFactory, const TDesC8& aUserName); |
|
60 |
|
61 /* |
|
62 * @function Destructor |
|
63 * @description Destroys the object and frees the memory allocated by this object |
|
64 */ |
|
65 ~CUPPrintingJob(); |
|
66 |
|
67 /* |
|
68 * @function SetSessionId |
|
69 * @description Initializes the session id used for printer communication with this job |
|
70 * @param TInt aId |
|
71 */ |
|
72 void SetSessionId(TInt aId); |
|
73 |
|
74 /* |
|
75 * @function SessionId |
|
76 * @description Returns the session id |
|
77 * @return TInt |
|
78 */ |
|
79 TInt SessionId(); |
|
80 |
|
81 /* |
|
82 * @function SetJobId |
|
83 * @description Initializes the job id |
|
84 * @param TDesC& aId |
|
85 */ |
|
86 void SetJobId(const TDesC8& aId); |
|
87 |
|
88 /* |
|
89 * @function GetJobId |
|
90 * @description Returns the job id as const TDes8& |
|
91 * @param const TDes8& |
|
92 */ |
|
93 void GetJobId(TDes8& aId); |
|
94 |
|
95 /* |
|
96 * @function GetJobName |
|
97 * @description Returns the file path |
|
98 * @param TDes8& |
|
99 */ |
|
100 void GetJobName(TDes8& aJobName); |
|
101 |
|
102 /* |
|
103 * @function ImageCount |
|
104 * @description Returns the number of images in job. |
|
105 * @return TInt |
|
106 */ |
|
107 TInt ImageCount(); |
|
108 |
|
109 /* |
|
110 * @function Images |
|
111 * @description Returns job's images as CImageInfo |
|
112 * @param RArray<CImageInfo> Output parameter |
|
113 */ |
|
114 void Images(RArray<CImageInfo>& aImages); |
|
115 |
|
116 /* |
|
117 * @function PrinterId |
|
118 * @description Returns the printer id |
|
119 * @param TInt |
|
120 */ |
|
121 TInt PrinterId(); |
|
122 |
|
123 /* |
|
124 * @function ShareFileL |
|
125 * @description Shares the images via UPnP Media Server and destroys object CUPnPItem. |
|
126 * @param CUPnPItem* UPnP Item to share |
|
127 */ |
|
128 void ShareFileL(CUpnpItem* aItemToShare); |
|
129 |
|
130 /* |
|
131 * @function ShareImagesL |
|
132 * @description Shares the images via UPnP Media Server |
|
133 */ |
|
134 void ShareImagesL(); |
|
135 |
|
136 /* |
|
137 * @function UnShareImages |
|
138 * @description Removes the sharing of all images from UPnP Media Server |
|
139 * @return TInt System wide error code |
|
140 */ |
|
141 TInt UnShareImages(); |
|
142 |
|
143 /* |
|
144 * @function UnShareImages |
|
145 * @description Removes the sharing of file from UPnP Media Server |
|
146 * @param TInt UPnP item ID |
|
147 * @return TInt System wide error code |
|
148 */ |
|
149 TInt UnShareFile(TInt aItemId); |
|
150 |
|
151 /* |
|
152 * @function GetUserName |
|
153 * @description Returns the user name |
|
154 * @param TPtrC8& |
|
155 */ |
|
156 void GetUserName(TPtrC8& aDocFormat); |
|
157 |
|
158 /* |
|
159 * @function SetNumsOfCopies |
|
160 * @description Sets the number of copies for certain image. |
|
161 * @param TInt aCapabilityId |
|
162 * @param TInt aValue |
|
163 * @return TInt System wide error code |
|
164 */ |
|
165 TInt SetNumsOfCopies( const RArray<TInt>& aNumsOfCopies); |
|
166 |
|
167 /* |
|
168 * @function XhtmlPrintFile |
|
169 * @description Returns the file path of generated XHTML-Print file |
|
170 * @param TDes8& |
|
171 */ |
|
172 void GetPrintFileL(TDes8& aPrintFile); |
|
173 |
|
174 /* |
|
175 * @function Sheets |
|
176 * @description Returns the total number of sheets the job requires |
|
177 * @return TInt |
|
178 */ |
|
179 TInt Sheets(); |
|
180 |
|
181 /* |
|
182 * @function Progress |
|
183 * @description Returns the progress percentage of the job |
|
184 * @return TInt |
|
185 */ |
|
186 TInt Progress(); |
|
187 |
|
188 /* |
|
189 * @function JobState |
|
190 * @description Returns the pointer to the job state maintainer |
|
191 * @return CUPJobState |
|
192 */ |
|
193 CUPJobState* JobState(); |
|
194 |
|
195 /* |
|
196 * @function JobStateReason |
|
197 * @description Returns the reason for the job's state |
|
198 * @return TInt |
|
199 */ |
|
200 TInt JobStateReason(); |
|
201 |
|
202 /** |
|
203 * StateUpdatedResponse callback function DEPRECATED |
|
204 * @since Series60 3.1 |
|
205 * @param TDesC8& New printer state |
|
206 * @param TDesC8& Reason for the printer state |
|
207 * @param TDesC8& List of job ids pending at the printer queue |
|
208 * @param TDesC8& Current job ID |
|
209 * @param TDesC8& Number of the printed sheets |
|
210 */ |
|
211 TUPnPState UpdateJobState(const TDesC8& aPrinterState, |
|
212 const TDesC8& aReason, |
|
213 const TDesC8& aJobList, |
|
214 const TDesC8& aJobId, |
|
215 const TDesC8& aJobMediaSheetsCompleted); |
|
216 |
|
217 /* |
|
218 * @function PrinterStateUpdated |
|
219 * @description Returns the state of the job after printer state updated |
|
220 * @param TDesC8& New printer state |
|
221 * @return TUPnPState |
|
222 */ |
|
223 TUPnPState PrinterStateUpdated( const TDesC8& aEvent ); |
|
224 |
|
225 /* |
|
226 * @function PrinterStateReasonsUpdated |
|
227 * @description Returns the state of the job after printer state reason updated |
|
228 * @param TDesC8& Reason for the printer state |
|
229 * @return TUPnPState |
|
230 */ |
|
231 TUPnPState PrinterStateReasonsUpdated( const TDesC8& aEvent ); |
|
232 |
|
233 /* |
|
234 * @function JobIdListUpdated |
|
235 * @description Returns the state of the job after job ID list updated |
|
236 * @param TDesC8& List of job ids pending at the printer queue |
|
237 * @return TUPnPState |
|
238 */ |
|
239 TUPnPState JobIdListUpdated( const TDesC8& aEvent ); |
|
240 |
|
241 /* |
|
242 * @function JobEndStateUpdatedL |
|
243 * @description Returns the state of the job after job end state updated |
|
244 * @param TDesC8& The end state of last printed job. Format: |
|
245 * <id>,<name>,<originator>,<completed sheets>,<state> |
|
246 * @return TUPnPState |
|
247 */ |
|
248 TUPnPState JobEndStateUpdatedL( const TDesC8& aEvent ); |
|
249 |
|
250 /* |
|
251 * @function JobMediaSheetsCompletedUpdated |
|
252 * @description Returns the state of the job after media sheets completed list updated |
|
253 * @param TDesC8& Number of the printed sheets |
|
254 * @return TUPnPState |
|
255 */ |
|
256 TUPnPState JobMediaSheetsCompletedUpdated( const TDesC8& aEvent ); |
|
257 |
|
258 /* |
|
259 * @function JobMediaSheetsCompletedUpdated |
|
260 * @description Returns the state of the job after media sheets completed list updated |
|
261 * @param TDesC8& ID of the current job |
|
262 * @param TDesC8& Number of the printed sheets |
|
263 * @return TUPnPState |
|
264 */ |
|
265 TUPnPState JobMediaSheetsCompletedUpdated(const TDesC8& aId, const TDesC8& aEvent ); |
|
266 |
|
267 /* |
|
268 * @function JobAbortStateUpdatedL |
|
269 * @description Returns the state of the job after job abort state updated |
|
270 * @param TDesC8& The abort state of last aborted job. Format: |
|
271 * <id>,<name>,<originator>,<completed sheets>,aborted,<reason> |
|
272 * @return TUPnPState |
|
273 */ |
|
274 TUPnPState JobAbortStateUpdatedL( const TDesC8& aEvent ); |
|
275 |
|
276 /* |
|
277 * @function ContentCompleteListUpdated |
|
278 * @description Returns the state of the job after content completed list updated |
|
279 * @param TDesC8& Number of the sheets completedly received in printer |
|
280 * @return TUPnPState |
|
281 */ |
|
282 TUPnPState ContentCompleteListUpdated( const TDesC8& aEvent ); |
|
283 |
|
284 |
|
285 |
|
286 protected: |
|
287 /* |
|
288 * @function ConstructL |
|
289 * @description Construction's second phase |
|
290 * @param aPriner Selected printer for the job |
|
291 * @param aImages Array of images to be printed |
|
292 */ |
|
293 void ConstructL(CUPPrinter* aPrinter, RArray<TFileName>& aImages, const TDesC8& aUserName); |
|
294 |
|
295 private: |
|
296 |
|
297 /* |
|
298 * @function CUPPrintingJob |
|
299 * @description C++ constructor |
|
300 * @param aPrinterId Id of the printer to be used for this job. |
|
301 * |
|
302 */ |
|
303 CUPPrintingJob(CUPPrintFactory* aFileFactory); |
|
304 |
|
305 /* |
|
306 * @function UPnPItemLC |
|
307 * @description Returns the image's UPnP item for file sharing |
|
308 * @param TInt Index of the image, which UPnP item is requested |
|
309 * @param TDesC8& Name of the file used as base for UPnPItem |
|
310 * @param TInt On return contains the UPnP item ID |
|
311 * @return CUPnPItem* |
|
312 */ |
|
313 CUpnpItem* UPnPItemLC(TInt aItemId, const TDesC8& aFileName, const TDesC8& aObjectType, const TDesC8& aMimeType); |
|
314 |
|
315 private: |
|
316 |
|
317 //@var iSessionId Session id used in sending this job to printer |
|
318 TInt iSessionId; |
|
319 |
|
320 //@var iJobId Id for printing job received from printer control point |
|
321 TBuf8<KMaxIdLength> iJobId; |
|
322 |
|
323 //@var iPrinterId Defines the printer to be used. Has to be a valid index of CUAPrinterContainer. |
|
324 TInt iPrinterId; |
|
325 |
|
326 //@var iUserName Name of the user (phone model) |
|
327 TPtrC8 iUserName; |
|
328 |
|
329 //@var iImages Job's images |
|
330 RArray<CImageInfo> iImages; |
|
331 |
|
332 //@var iPrintFactory Object for creating XHTML-Print file |
|
333 CUPPrintFactory* iPrintFactory; |
|
334 |
|
335 //@var iJobState Object to maintain job's state |
|
336 CUPJobState* iJobState; |
|
337 |
|
338 //@var iSheets Number of sheets to print |
|
339 TInt iSheets; |
|
340 |
|
341 //@var iXhtmlFileShareId ID for sharing xhtml file |
|
342 TInt iXhtmlFileShareId; |
|
343 |
|
344 //@var iFileSharing File sharing resource |
|
345 CUPFileSharingActive* iFileSharing; |
|
346 |
|
347 //@var iMediaServerClient Media server to map the file sharing resource |
|
348 RUpnpMediaServerClient iMediaServerClient; |
|
349 |
|
350 //@var iiMediaServerAddress media server's ip and port address. |
|
351 TFileName8 iMediaServerAddress; |
|
352 |
|
353 //@var iOrgMediaServerStatus mediaserver's running status before we use it. |
|
354 TInt iOrgMediaServerStatus; |
|
355 }; |
|
356 |
|
357 #endif // CUPPRINTINGJOB_H |
|
358 |
|
359 // End of File |
|