|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CBTJOBCHANNEL_H |
|
20 #define CBTJOBCHANNEL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <e32math.h> |
|
25 |
|
26 #include "tprintcapability.h" |
|
27 #include "cbtchannelbase.h" |
|
28 #include "cprintjob.h" |
|
29 |
|
30 class CBtStatusChannel; |
|
31 class CObexFileObject; |
|
32 |
|
33 const TInt KProgressUpdateInterval = 1000000; |
|
34 |
|
35 /** |
|
36 * @class CBtJobChannel |
|
37 * @brief |
|
38 * |
|
39 */ |
|
40 NONSHARABLE_CLASS(CBtJobChannel) : public CBtChannelBase, public MBtTimerObserver |
|
41 { |
|
42 public: |
|
43 |
|
44 /** NewL |
|
45 * @brief Creates a new instance of XHTML file composer. |
|
46 * @return Pointer to the instance. |
|
47 */ |
|
48 static CBtJobChannel* NewL(MBtPCObserver& aObs); |
|
49 |
|
50 /** NewLC |
|
51 * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. |
|
52 * @return Pointer to the instance. |
|
53 */ |
|
54 static CBtJobChannel* NewLC(MBtPCObserver& aObs); |
|
55 |
|
56 /** ~CBtJobChannel |
|
57 * @brief Destructor. |
|
58 */ |
|
59 IMPORT_C ~CBtJobChannel(); |
|
60 |
|
61 /** GetCapabilitiesL |
|
62 * @brief Method to get printer capabilities. |
|
63 * |
|
64 * Actually this method gets printer attributes, but this is synchronous |
|
65 * method to get only capabilities, not all capabilities. |
|
66 */ |
|
67 void GetCapabilitiesL(CRsBtDevice& aDevice); |
|
68 |
|
69 /** CreateJob |
|
70 * @brief |
|
71 */ |
|
72 void CreateJobL(CPrintJob& aJob); |
|
73 |
|
74 TInt GetPercentSent(); |
|
75 |
|
76 /** GetJobAttributes |
|
77 * @brief |
|
78 */ |
|
79 void GetPrinterStateL(); |
|
80 |
|
81 /** GetJobAttributes |
|
82 * @brief |
|
83 */ |
|
84 void GetJobAttributesL(TInt aJobId); |
|
85 |
|
86 /** |
|
87 * Cancel a specified print job. Leaves if printer is invalid. |
|
88 * @since Series60 3.0 |
|
89 * @param aPrinter Printer to be used. |
|
90 * @param aJobId Print job ID of cancelled job. |
|
91 */ |
|
92 void CancelJobL(TInt aJobId ); |
|
93 |
|
94 /** |
|
95 * Cancel a specified print job. Leaves if printer is invalid. |
|
96 * @since Series60 3.0 |
|
97 * @param aPrinter Printer to be used. |
|
98 * @param aJobId Print job ID of cancelled job. |
|
99 */ |
|
100 void GetEventL(TInt aJobId); |
|
101 |
|
102 /** FinishPrinting |
|
103 * @brief Finish all printing operations started |
|
104 */ |
|
105 |
|
106 public: // from MBtTimerObserver |
|
107 void HandleTimeoutL(); |
|
108 |
|
109 protected: |
|
110 |
|
111 /** ConstructL |
|
112 * @brief Symbian second phase constructor. |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 virtual void RunL(); |
|
117 virtual void DoCancel(); |
|
118 virtual TInt RunError(TInt aError); |
|
119 |
|
120 private: |
|
121 |
|
122 /** CBtJobChannel |
|
123 * @brief C++ constructor |
|
124 */ |
|
125 CBtJobChannel(MBtPCObserver& aObs); |
|
126 |
|
127 void ConnectL(); |
|
128 void ClearConnection(); |
|
129 void CleanXhtmlDirL(); |
|
130 |
|
131 TInt CreateJobResponseL(); |
|
132 TInt GetPrinterStateResponseL(); |
|
133 TInt GetPrinterCapabilitiesResponseL(); |
|
134 TInt GetJobAttributesResponseL(); |
|
135 TInt CancelJobResponseL(); |
|
136 TInt GetEventResponseL(); |
|
137 |
|
138 void SendOPPL(); |
|
139 void SendXhtmlDocumentL(); |
|
140 |
|
141 void DoLeaveL(TInt aError); |
|
142 |
|
143 /* |
|
144 * Removes timeout from OBEX commands. |
|
145 * */ |
|
146 void RemoveObexCmdTimeOut(); |
|
147 |
|
148 /* |
|
149 * Callback function of CPeriodic. |
|
150 * */ |
|
151 static TInt CheckProgress( TAny *aObj ); |
|
152 |
|
153 /* |
|
154 * Calculates and returns size of current print job. |
|
155 * */ |
|
156 TInt CBtJobChannel::CalculateJobSizeL(); |
|
157 |
|
158 /* |
|
159 * Updates progress bar. |
|
160 * */ |
|
161 void UpdateProgress(); |
|
162 |
|
163 |
|
164 private: |
|
165 |
|
166 TFileName8 iJobFile; |
|
167 TInt iJobFileNum; |
|
168 RArray<CImageInfo> iImageList; |
|
169 TInt iImageCount; |
|
170 TInt iFileObjectSize; |
|
171 |
|
172 CObexFileObject* iObexFileObject; |
|
173 |
|
174 TInt iPercents; |
|
175 |
|
176 CBtTimer* iTimer; |
|
177 CBtStatusChannel* iStatusChannel; |
|
178 |
|
179 // Periodic timer to update image sending progress. |
|
180 CPeriodic *iUpdateProgress; |
|
181 |
|
182 TInt iJobSize; // Size of printing job. |
|
183 TInt iProgressOfFullImages; // Size of full images this far. |
|
184 }; |
|
185 |
|
186 #endif // CBTJOBCHANNEL_H |
|
187 |
|
188 // End of File |
|
189 |