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: Defines the CBtPrinterController class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CBTPRINTERCONTROLLER_H |
|
20 #define CBTPRINTERCONTROLLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <e32math.h> |
|
25 |
|
26 #include "crsbtdiscoverengine.h" |
|
27 #include "tprintcapability.h" |
|
28 #include "mbtpcobserver.h" |
|
29 #include "cbtobjectserver.h" |
|
30 #include "cprintjob.h" |
|
31 #include "cbtonquery.h" |
|
32 #include "mbtonnotify.h" |
|
33 |
|
34 class CBtStatusChannel; |
|
35 class CBtJobChannel; |
|
36 class CBtSoapCodec; |
|
37 class CObexBufObject; |
|
38 class CObexClient; |
|
39 class CObexFileObject; |
|
40 |
|
41 NONSHARABLE_CLASS( CBtPrinterController ) : public CBase, |
|
42 public MBtDiscoveryObserver, |
|
43 public MBtObjectServerObserver, |
|
44 public MBTOnNotify |
|
45 { |
|
46 public: |
|
47 |
|
48 /** NewL |
|
49 * @brief Creates a new instance of XHTML file composer. |
|
50 * @return Pointer to the instance. |
|
51 */ |
|
52 static CBtPrinterController* NewL(MBtPCObserver& aObs); |
|
53 |
|
54 /** NewLC |
|
55 * @brief Creates a new instance of XHTML file composer and leaves it in the cleanup stack. |
|
56 * @return Pointer to the instance. |
|
57 */ |
|
58 static CBtPrinterController* NewLC(MBtPCObserver& aObs); |
|
59 |
|
60 void DeviceDiscovered(); |
|
61 void DeviceDisappeared(); |
|
62 |
|
63 /** ~CBtPrinterController |
|
64 * @brief Destructor. |
|
65 */ |
|
66 IMPORT_C ~CBtPrinterController(); |
|
67 |
|
68 TInt GetPercentSent(); |
|
69 void CancelDiscovery(); |
|
70 void Stop(); |
|
71 TBool IsConnected(); |
|
72 |
|
73 /** GetCapabilitiesL |
|
74 * @brief Method to get printer capabilities. |
|
75 * |
|
76 * Actually this method gets printer attributes, but this is synchronous |
|
77 * method to get only capabilities, not all capabilities. |
|
78 */ |
|
79 void GetCapabilitiesL(CRsBtDevice& aDevice); |
|
80 |
|
81 /** GetPrinterStateL |
|
82 * @brief |
|
83 */ |
|
84 void GetPrinterStateL(CRsBtDevice& aDevice); |
|
85 |
|
86 /** CreateJob |
|
87 * @brief |
|
88 */ |
|
89 void CreateJobL(CRsBtDevice& aDevice, CPrintJob& aJob); |
|
90 |
|
91 /** GetJobAttributes |
|
92 * @brief |
|
93 */ |
|
94 void GetJobAttributesL(CRsBtDevice& aDevice, TInt aJobId); |
|
95 |
|
96 /** |
|
97 * Cancel a specified print job. Leaves if printer is invalid. |
|
98 * @since Series60 3.0 |
|
99 * @param aPrinter Printer to be used. |
|
100 * @param aJobId Print job ID of cancelled job. |
|
101 */ |
|
102 void CancelJobL( CRsBtDevice& aDevice, TInt aJobId ); |
|
103 |
|
104 /** GetEventL |
|
105 * @brief |
|
106 */ |
|
107 void GetEventL(TInt aJobId); |
|
108 |
|
109 /** StartDiscoveryL |
|
110 * @brief Starts discovering devices |
|
111 */ |
|
112 void StartDiscoveryL(TUint aProtocol); |
|
113 |
|
114 /** FinishPrinting |
|
115 * @brief Finish all printing operations started |
|
116 */ |
|
117 void FinishPrinting(); |
|
118 |
|
119 public: // From MRsBtDiscoverEngineObserver |
|
120 |
|
121 /** |
|
122 * @brief Get asynchronous notifications of Bluetooth device discovery or Service Discovery Protocol events. |
|
123 * |
|
124 * Possible values for aEvent are of type MRsBtDiscoverEngineObserver::TEvent: |
|
125 * enum TEvent |
|
126 * { |
|
127 * EFoundBtPrinter, |
|
128 * ERemoveBtPrinter, |
|
129 * EDoneFindingPrinters, |
|
130 * EErrorDuringDiscover, |
|
131 * EErrorFindingDevice, |
|
132 * EErrorVerifyingBt |
|
133 * }; |
|
134 * |
|
135 * @param aEvent Event that occurred, of type MRsBtDiscoverEngineObserver::TEvent. |
|
136 * @param aErrorCode If the event is an error, error code is sent here. |
|
137 */ |
|
138 void HandleDiscoveryEvent(TInt aEvent, TInt aErrorCode); |
|
139 |
|
140 public: // MBtObexServerObserver |
|
141 |
|
142 void HandleObjectServerEvent(TInt aStatus, TInt aInfo = 0); |
|
143 |
|
144 public: // MBTOnNotify |
|
145 |
|
146 void BTOnCompleteL( TBool aResult ); |
|
147 |
|
148 protected: |
|
149 |
|
150 /** ConstructL |
|
151 * @brief Symbian second phase constructor. |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 private: |
|
156 |
|
157 /** CBtPrinterController |
|
158 * @brief C++ constructor |
|
159 */ |
|
160 CBtPrinterController(MBtPCObserver& aObs); |
|
161 |
|
162 void InitJobVariables(); |
|
163 |
|
164 /** ConnectedL |
|
165 * @brief Creates obex connection to the aBtDevice in the iClient |
|
166 */ |
|
167 void ClearConnections(); |
|
168 void EstablishObjectChannelL( CRsBtDevice& aDevice ); |
|
169 |
|
170 private: |
|
171 |
|
172 // @var iFinish |
|
173 TBool iFinish; |
|
174 |
|
175 RArray<CImageInfo> iImageList; |
|
176 TInt iJobId; |
|
177 |
|
178 MBtPCObserver& iObs; |
|
179 |
|
180 CBtJobChannel* iJobChannel; |
|
181 CBtObjectServer* iObjectChannel; |
|
182 |
|
183 CRsBtDiscoverEngine* iBtDiscoverEngine; |
|
184 |
|
185 CRsBtDevice* iDevice; |
|
186 |
|
187 TInt iPercents; |
|
188 TInt iImageCount; |
|
189 TInt iSentImages; |
|
190 TInt iServerError; |
|
191 |
|
192 CBtOnQuery* iQuery; |
|
193 TUint iProtocol; |
|
194 |
|
195 |
|
196 }; |
|
197 |
|
198 #endif // CBTPRINTERCONTROLLER_H |
|
199 |
|
200 // End of File |
|
201 |
|