|
1 /* |
|
2 * Copyright (c) 2002 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 * Contains Bluetooth MTM Ui part. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CBTMTMUI_H |
|
22 #define CBTMTMUI_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <btdevice.h> |
|
26 #include <mtmuibas.h> |
|
27 #include <btengdiscovery.h> |
|
28 |
|
29 #include <obexutilsuilayer.h> |
|
30 |
|
31 const TUint KBTSdpObjectPush = 0x1105; |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CClientMtmRegistry; |
|
35 |
|
36 /** |
|
37 * CBtMtmUi |
|
38 * Bluetooth messaging UI Module. |
|
39 */ |
|
40 class CBtMtmUi : public CBaseMtmUi, public MBTEngSdpResultReceiver |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CBtMtmUi* NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CBtMtmUi(); |
|
52 |
|
53 |
|
54 public: // Functions from base classes |
|
55 |
|
56 /** |
|
57 * From CBaseMtmUi Entry Creation. |
|
58 * @param aEntry reference to entry |
|
59 * @param aParent parent entry |
|
60 * @return CMsvOperation pointer to Msg operation. |
|
61 */ |
|
62 virtual CMsvOperation* CreateL( |
|
63 const TMsvEntry& aEntry, |
|
64 CMsvEntry& aParent, |
|
65 TRequestStatus& aStatus ); |
|
66 |
|
67 /** |
|
68 * From CBaseMtmUi Open entry. |
|
69 * @param aStatus Status for operation. |
|
70 * @return CMsvOperation pointer to Msg operation. |
|
71 */ |
|
72 virtual CMsvOperation* OpenL( TRequestStatus& aStatus ); |
|
73 |
|
74 /** |
|
75 * From CBaseMtmUi Close entry. |
|
76 * @param aStatus Status for operation. |
|
77 * @return CMsvOperation pointer to Msg operation. |
|
78 */ |
|
79 virtual CMsvOperation* CloseL( TRequestStatus& aStatus ); |
|
80 |
|
81 /** |
|
82 * From CBaseMtmUi Launches editor/settings dialog as appropriate. |
|
83 * @param aStatus Status for operation. |
|
84 * @return CMsvOperation pointer to Msg operation. |
|
85 */ |
|
86 virtual CMsvOperation* EditL( TRequestStatus& aStatus ); |
|
87 |
|
88 /** |
|
89 * From CBaseMtmUi Launches viewer/settings dialog as appropriate |
|
90 * @param aStatus Status for operation. |
|
91 * @return CMsvOperation pointer to Msg operation. |
|
92 */ |
|
93 virtual CMsvOperation* ViewL( TRequestStatus& aStatus ); |
|
94 |
|
95 /** |
|
96 * From CBaseMtmUi Deletes selection from current context |
|
97 * Deletes entries from the current context, |
|
98 * which must be a folder or service of the relevant MTM |
|
99 * @param aSelection reference to entry. |
|
100 * @param aStatus Status for operation. |
|
101 * @return CMsvOperation pointer to Msg operation. |
|
102 */ |
|
103 virtual CMsvOperation* DeleteFromL( |
|
104 const CMsvEntrySelection& aSelection, |
|
105 TRequestStatus& aStatus ); |
|
106 |
|
107 /** |
|
108 * From CBaseMtmUi Deletes service, which need not |
|
109 * be the current context. |
|
110 * @param aService reference to entry. |
|
111 * @param aStatus Status for operation. |
|
112 * @return CMsvOperation pointer to Msg operation. |
|
113 */ |
|
114 virtual CMsvOperation* DeleteServiceL( |
|
115 const TMsvEntry& aService, |
|
116 TRequestStatus& aStatus ); |
|
117 |
|
118 /** |
|
119 * From CBaseMtmUi Remove remaining message of deleted service. |
|
120 * @param aChildren reference to entry selection. |
|
121 * @return None. |
|
122 */ |
|
123 void DeleteRecursivelyL( CMsvEntrySelection& aChildren ); |
|
124 |
|
125 // |
|
126 // --- Message responding --- |
|
127 // --- Default implementation calls CBaseMtm::ReplyL() or ForwardL(), |
|
128 // followed by EditL() --- |
|
129 // --- Takes ownership of the passed entry |
|
130 // (which the context is switched to) --- |
|
131 |
|
132 /** |
|
133 * From CBaseMtmUi Reply entry |
|
134 * @param aDestination id for msv. |
|
135 * @param aPartlist partlist id. |
|
136 * @param aCompletionStatus status for operation. |
|
137 * @return CMsvOperation pointer to Msg operation. |
|
138 */ |
|
139 virtual CMsvOperation* ReplyL( |
|
140 TMsvId aDestination, |
|
141 TMsvPartList aPartlist, |
|
142 TRequestStatus& aCompletionStatus ); |
|
143 |
|
144 |
|
145 /** |
|
146 * From CBaseMtmUi forward entry |
|
147 * @param aDestination id for msv. |
|
148 * @param aPartlist partlist id. |
|
149 * @param aCompletionStatus status for operation. |
|
150 * @return CMsvOperation pointer to Msg operation. |
|
151 */ |
|
152 virtual CMsvOperation* ForwardL( |
|
153 TMsvId aDestination, |
|
154 TMsvPartList aPartList, |
|
155 TRequestStatus& aCompletionStatus ); |
|
156 |
|
157 // |
|
158 // Actions upon message selections --- |
|
159 // Selections must be in same folder and all of the correct MTM type |
|
160 // Context may change after calling these functions |
|
161 |
|
162 /** |
|
163 * From CBaseMtmUi Open entry |
|
164 * @param aStatus status for operation. |
|
165 * @return CMsvOperation pointer to Msg operation. |
|
166 */ |
|
167 virtual CMsvOperation* OpenL( |
|
168 TRequestStatus& aStatus, |
|
169 const CMsvEntrySelection& aSelection ); |
|
170 |
|
171 /** |
|
172 * From CBaseMtmUi Close entry |
|
173 * @param aStatus status for operation. |
|
174 * @return CMsvOperation pointer to Msg operation. |
|
175 */ |
|
176 virtual CMsvOperation* CloseL( |
|
177 TRequestStatus& aStatus, |
|
178 const CMsvEntrySelection& aSelection ); |
|
179 |
|
180 /** |
|
181 * From CBaseMtmUi Handles sending. |
|
182 * @param aStatus status for operation. |
|
183 * @return CMsvOperation pointer to Msg operation. |
|
184 */ |
|
185 virtual CMsvOperation* EditL( |
|
186 TRequestStatus& aStatus, |
|
187 const CMsvEntrySelection& aSelection ); |
|
188 |
|
189 /** |
|
190 * From CBaseMtmUi Launches viewer/settings dialog as appropriate |
|
191 * @param aStatus status for operation. |
|
192 * @return CMsvOperation pointer to Msg operation. |
|
193 */ |
|
194 virtual CMsvOperation* ViewL( |
|
195 TRequestStatus& aStatus, |
|
196 const CMsvEntrySelection& aSelection ); |
|
197 |
|
198 // |
|
199 // Copy and move functions: |
|
200 // Context should be set to folder or entry of this MTM |
|
201 // Default implementations imply call the relevant CMsvEntry functions |
|
202 |
|
203 /** |
|
204 * From CBaseMtmUi Context should be MTM folder/service to copy to |
|
205 * @param aStatus status for operation. |
|
206 * @return CMsvOperation pointer to Msg operation. |
|
207 */ |
|
208 virtual CMsvOperation* CopyToL( |
|
209 const CMsvEntrySelection& aSelection, |
|
210 TRequestStatus& aStatus ); |
|
211 |
|
212 /** |
|
213 * From CBaseMtmUi Context should be MTM folder/service to Move to |
|
214 * @param aStatus status for operation. |
|
215 * @return CMsvOperation pointer to Msg operation. |
|
216 */ |
|
217 virtual CMsvOperation* MoveToL( |
|
218 const CMsvEntrySelection& aSelection, |
|
219 TRequestStatus& aStatus ); |
|
220 |
|
221 /** |
|
222 * From CBaseMtmUi Context should be MTM folder/service to copy from |
|
223 * @param aStatus status for operation. |
|
224 * @return CMsvOperation pointer to Msg operation. |
|
225 */ |
|
226 virtual CMsvOperation* CopyFromL( |
|
227 const CMsvEntrySelection& aSelection, |
|
228 TMsvId aTargetId, |
|
229 TRequestStatus& aStatus ); |
|
230 |
|
231 /** |
|
232 * From CBaseMtmUi Context should be MTM folder/service to move from |
|
233 * @param aStatus status for operation. |
|
234 * @return CMsvOperation pointer to Msg operation. |
|
235 */ |
|
236 virtual CMsvOperation* MoveFromL( |
|
237 const CMsvEntrySelection& aSelection, |
|
238 TMsvId aTargetId, |
|
239 TRequestStatus& aStatus ); |
|
240 |
|
241 // Interpret transfer progress |
|
242 |
|
243 /** |
|
244 * From CBaseMtmUi Display progress summary. |
|
245 * @param aProgress reference to summary text. |
|
246 * @return TInt error code. |
|
247 */ |
|
248 TInt DisplayProgressSummary( const TDesC8& aProgress ) const; |
|
249 |
|
250 /** |
|
251 * From CBaseMtmUi return progress status. |
|
252 * @param aProgress reference to progress packet. |
|
253 * @param aReturnString returned progress text. |
|
254 * @param aTotalEntryCount entry count. |
|
255 * @param aEntriesDone completed entries. |
|
256 * @param aCurrentEntrySize size of the entry. |
|
257 * @param aCurrentBytesTrans transferred bytes. |
|
258 * @return TInt error code. |
|
259 */ |
|
260 virtual TInt GetProgress( |
|
261 const TDesC8& aProgress, |
|
262 TBuf<EProgressStringMaxLen>& aReturnString, |
|
263 TInt& aTotalEntryCount, |
|
264 TInt& aEntriesDone, |
|
265 TInt& aCurrentEntrySize, |
|
266 TInt& aCurrentBytesTrans ) const; |
|
267 |
|
268 // |
|
269 // --- RTTI functions --- |
|
270 |
|
271 /** |
|
272 * From CBaseMtmUi Return capability. |
|
273 * @param aCapability UID for capability. |
|
274 * @return TInt error code. |
|
275 */ |
|
276 virtual TInt QueryCapability( TUid aCapability, TInt& aResponse ); |
|
277 |
|
278 /** |
|
279 * From CBaseMtmUi Synchronous MTM function operation. |
|
280 * @param aFunctionId Function ID. |
|
281 * @param CMsvEntrySelection entry reference. |
|
282 * @param aParam parameter for function. |
|
283 * @return None. |
|
284 */ |
|
285 virtual void InvokeSyncFunctionL( |
|
286 TInt aFunctionId, |
|
287 const CMsvEntrySelection& aSelection, |
|
288 TDes8& aParameter ); |
|
289 |
|
290 /** |
|
291 * From CBaseMtmUi Cancel sending. |
|
292 * @param aStatus Async status for operation. |
|
293 * @param CMsvEntrySelection entry reference. |
|
294 * @return CMsvOperation pointer to Msg operation. |
|
295 */ |
|
296 virtual CMsvOperation* CancelL( |
|
297 TRequestStatus& aStatus, |
|
298 const CMsvEntrySelection& aSelection ); |
|
299 |
|
300 |
|
301 /** |
|
302 * Provides notification of the result of a service search that matches |
|
303 * the requested UUID (through CBTEngDiscovery::RemoteSdpQuery). |
|
304 * This method indicates that the search has completed, and returns |
|
305 * all the results to the caller at once. |
|
306 * |
|
307 * @since S60 v3.2 |
|
308 * @param aResult Array of record handles that match the requested UUID. |
|
309 * Note: the array will not be available anymore after |
|
310 * this method returns. |
|
311 * @param aTotalRecordsCount The total number of records returned. |
|
312 * @param aErr Error code of the service search operation; KErrNone if |
|
313 * sucessful, KErrEof if no record matched the requested UUID, |
|
314 * KErrCouldNotConnect and KErrCouldDisconnected in case of |
|
315 * Bluetooth connection errors; otherwise one of the |
|
316 * system-wide error codes. |
|
317 */ |
|
318 void ServiceSearchComplete( const RSdpRecHandleArray& aResult, |
|
319 TUint aTotalRecordsCount, TInt aErr ); |
|
320 |
|
321 /** |
|
322 * Provides notification of the result of an attribute search that matches |
|
323 * the requested attribute (through CBTEngDiscovery::RemoteSdpQuery). |
|
324 * This method indicates that the search has completed, and returns |
|
325 * all the results to the caller at once. |
|
326 * |
|
327 * @since S60 v3.2 |
|
328 * @param aHandle Record handle of the service record containing the result. |
|
329 * @param aAttr Array containing the attribute that matches the |
|
330 * requested attribute. |
|
331 * Note: the array will not be available anymore after |
|
332 * this method returns. |
|
333 * @param aErr Error code of the service search operation; KErrNone if |
|
334 * sucessful, KErrEof if the requested attribute was not |
|
335 * contained in the specified service record, |
|
336 * KErrCouldNotConnect and KErrCouldDisconnected in case of |
|
337 * Bluetooth connection errors; otherwise one of the |
|
338 * system-wide error codes. |
|
339 */ |
|
340 void AttributeSearchComplete( TSdpServRecordHandle aHandle, |
|
341 const RSdpResultArray& aAttr, |
|
342 TInt aErr ); |
|
343 |
|
344 /** |
|
345 * Provides notification of the result of an combination of a service |
|
346 * and attribute search (through CBTEngDiscovery::RemoteSdpQuery). |
|
347 * This method is called for each service and attribute combination for |
|
348 * which a match was found. The last result (which could be empty if no |
|
349 * match was found) contain error code KErrEof to indicate that the |
|
350 * search has completed. |
|
351 * |
|
352 * @since S60 v3.2 |
|
353 * @param aHandle Record handle of the service record containing the result. |
|
354 * @param aAttr Array containing the attribute that matches the |
|
355 * requested attribute. |
|
356 * Note: the array will not be available anymore after |
|
357 * this method returns. |
|
358 * @param aErr Error code of the service search operation; KErrNone if |
|
359 * sucessful and more results follow, KErrEof indicates that |
|
360 * this is the last result (which could be empty if no match |
|
361 * was found), KErrCouldNotConnect and KErrCouldDisconnected |
|
362 * in case of Bluetooth connection errors; otherwise one of |
|
363 * the system-wide error codes. |
|
364 */ |
|
365 void ServiceAttributeSearchComplete( TSdpServRecordHandle aHandle, |
|
366 const RSdpResultArray& aAttr, |
|
367 TInt aErr ); |
|
368 |
|
369 /** |
|
370 * Provides notification of the result of the discovery of nearby |
|
371 * Bluetooth devices. |
|
372 * |
|
373 * @since S60 v3.2 |
|
374 * @param aDevice The data structure encapsulates all information |
|
375 * about the selected device. Ownership of the data |
|
376 * structure has not been transfered and is still with |
|
377 * the API client. |
|
378 * @param aErr Error code of the device search operation; KErrNone if |
|
379 * sucessful, KErrCancel if the user cancelled the |
|
380 * dialog, KErrAbort if CBTEngDiscovery::CancelSearchRemoteDevice |
|
381 * was called; otherwise one of the system-wide error codes. |
|
382 */ |
|
383 void DeviceSearchComplete( CBTDevice* aDevice, TInt aErr ); |
|
384 |
|
385 protected: |
|
386 |
|
387 /** |
|
388 * C++ default constructor. |
|
389 */ |
|
390 CBtMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); |
|
391 |
|
392 /** |
|
393 * By default Symbian OS constructor is private. |
|
394 */ |
|
395 void ConstructL(); |
|
396 |
|
397 protected: // Functions from base classes |
|
398 |
|
399 /** |
|
400 * From CBaseMtmUi return resource filename. |
|
401 * @param aProgress reference to summary text. |
|
402 * @return TInt error code. |
|
403 */ |
|
404 void GetResourceFileName( TFileName& aFileName ) const; |
|
405 |
|
406 /** |
|
407 * From CBaseMtmUi Launch viewer for received message. |
|
408 * @param aStatus Async status for operation. |
|
409 * @param aSession session reference. |
|
410 * @return CMsvOperation pointer to Msg operation. |
|
411 */ |
|
412 CMsvOperation* LaunchEditorApplicationL( |
|
413 TRequestStatus& aStatus, |
|
414 CMsvSession& aSession ); |
|
415 |
|
416 protected: // New functions |
|
417 |
|
418 /** |
|
419 * Register MTM. |
|
420 * @param aMtmType MTM UID. |
|
421 * @return CBaseMtm pointer. |
|
422 */ |
|
423 CBaseMtm* GetClientMtmLC( TUid aMtmType ); |
|
424 |
|
425 /** |
|
426 * Display progress summary. |
|
427 * @param aProgress reference to summary text. |
|
428 * @return TInt error code. |
|
429 */ |
|
430 TInt DisplayProgressSummaryL( const TDesC8& aProgress ) const; |
|
431 |
|
432 protected: // data |
|
433 |
|
434 CClientMtmRegistry* iClientRegistry; // pointer to registration. |
|
435 |
|
436 private: |
|
437 TBTDeviceName iBTDeviceName; // Bluetooth device name. |
|
438 CBTDevice* iDevice; |
|
439 CBTEngDiscovery* iDiscovery; |
|
440 CActiveSchedulerWait iWaiter; |
|
441 TInt iClientChannel; |
|
442 TInt iState; |
|
443 |
|
444 }; |
|
445 |
|
446 #endif // CBTMTMUI_H |
|
447 |
|
448 // End of File |