|
1 /* |
|
2 * Copyright (c) 2010 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 Bluetooth device inquiry helper class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ADVANCEBTDEVDISCOVERER_H |
|
19 #define ADVANCEBTDEVDISCOVERER_H |
|
20 |
|
21 #include <btdevice.h> |
|
22 #include <bt_sock.h> |
|
23 #include <btservices/devdiscoveryobserver.h> |
|
24 #include <btservices/btdevrepository.h> |
|
25 |
|
26 class CAdvanceDevDiscovererImpl; |
|
27 |
|
28 /** |
|
29 * APIs from this class offer functionalities that are common in mw and app |
|
30 * components of Bluetooth packages. They do not serve as domain APIs. |
|
31 * |
|
32 * Using these from external components is risky, due to possible source |
|
33 * and binary breaks in future. |
|
34 * |
|
35 */ |
|
36 |
|
37 /** |
|
38 * The interface of discovering in-range Bluetooth devices via Host Resolver. |
|
39 * This class offers some options to search certain devices by CoD and other |
|
40 * filters e.g., bonded and blocked. |
|
41 * |
|
42 * It requires the client to supply a CBtDevRepository instance for filtering |
|
43 * devices. |
|
44 */ |
|
45 NONSHARABLE_CLASS( CAdvanceDevDiscoverer ) : public CBase |
|
46 { |
|
47 |
|
48 public: // Constructor and destructor |
|
49 |
|
50 /** |
|
51 * Options for clients to specify criteria on discovered devices. |
|
52 */ |
|
53 enum TDevDiscoveryFilter |
|
54 { |
|
55 // do not filter in-range devices |
|
56 ENoFilter = 0, |
|
57 |
|
58 // Excludes an in-range device if its device name is not available |
|
59 ExcludeIfNoDevName = 0x01, |
|
60 |
|
61 // Excludes an in-range device if it is user-aware bonded with phone. |
|
62 ExcludeUserAwareBonded = 0x02, |
|
63 |
|
64 // Excludes an in-range device if it is banned by phone. |
|
65 ExcludeBanned = 0x04, |
|
66 }; |
|
67 |
|
68 IMPORT_C static CAdvanceDevDiscoverer* NewL( |
|
69 CBtDevRepository& aDevRep, |
|
70 MDevDiscoveryObserver& aObserver ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 IMPORT_C virtual ~CAdvanceDevDiscoverer(); |
|
76 |
|
77 /** |
|
78 * sets the discovery result receiver. |
|
79 * |
|
80 * @param aObserver the new observer to receive inquiry results |
|
81 */ |
|
82 IMPORT_C void SetObserver( MDevDiscoveryObserver& aObserver ); |
|
83 |
|
84 /** |
|
85 * Discover currently in-range devices that matches the given major |
|
86 * device class type. |
|
87 |
|
88 * Found devices will be informed by |
|
89 * MBtDevDiscoveryObserver::HandleNextDiscoveryResult(). |
|
90 * |
|
91 * When no more device can be found, |
|
92 * MBtDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued. |
|
93 * |
|
94 * @param aFilter the filter that shall be applied when a device |
|
95 * is discovered. If this is specified, only a device passing |
|
96 * the filter will be informed to client. |
|
97 * By default, no filter is applied. |
|
98 * |
|
99 * @param aDeviceClass the major device class which a found device |
|
100 * must match. |
|
101 * By default, it includes any device types. |
|
102 */ |
|
103 IMPORT_C void DiscoverDeviceL( |
|
104 TDevDiscoveryFilter aFilter = CAdvanceDevDiscoverer::ENoFilter, |
|
105 TBTMajorDeviceClass aDeviceClass = EMajorDeviceMisc ); |
|
106 |
|
107 /** |
|
108 * Cancels any outstanding discovery request. |
|
109 */ |
|
110 IMPORT_C void CancelDiscovery(); |
|
111 |
|
112 private: |
|
113 |
|
114 /** |
|
115 * C++ default constructor. |
|
116 */ |
|
117 CAdvanceDevDiscoverer(); |
|
118 |
|
119 /** |
|
120 * The 2nd phase constructor |
|
121 */ |
|
122 void ConstructL( CBtDevRepository& aDevRep, MDevDiscoveryObserver& aObserver ); |
|
123 |
|
124 private: // Data |
|
125 |
|
126 CAdvanceDevDiscovererImpl* iImpl; |
|
127 }; |
|
128 |
|
129 #endif |
|
130 |
|
131 // End of File |