|
1 /* |
|
2 * Copyright (c) 2006 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: Helper class declaration for performing device discovery. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef BTENGDEVICESEARCH_H |
|
21 #define BTENGDEVICESEARCH_H |
|
22 |
|
23 |
|
24 #include <btnotif.h> |
|
25 #include <bt_sock.h> |
|
26 #include "btengactive.h" |
|
27 |
|
28 class MBTEngSdpResultReceiver; |
|
29 |
|
30 /** |
|
31 * Class CBTEngDeviceSearch |
|
32 * |
|
33 * ?more_complete_description |
|
34 * |
|
35 * @lib ?library |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CBTEngDeviceSearch ) : public CBase, |
|
39 public MBTEngActiveObserver |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two-phase constructor |
|
46 */ |
|
47 static CBTEngDeviceSearch* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 virtual ~CBTEngDeviceSearch(); |
|
53 |
|
54 /** |
|
55 * ?description |
|
56 * |
|
57 * @since S60 v3.2 |
|
58 * @param ?arg1 ?description |
|
59 * @param ?arg2 ?description |
|
60 * @return ?description |
|
61 */ |
|
62 TInt StartSearch( CBTDevice* aDevice, |
|
63 TNameEntry* aNameEntry, |
|
64 const TBTDeviceClass& aDeviceClass, |
|
65 MBTEngSdpResultReceiver* aNotifier ); |
|
66 |
|
67 /** |
|
68 * ?description |
|
69 * |
|
70 * @since S60 v3.2 |
|
71 * @param ?arg1 ?description |
|
72 * @param ?arg2 ?description |
|
73 * @return ?description |
|
74 */ |
|
75 void CancelSearch(); |
|
76 |
|
77 TInt GetEirServiceUUIDs( const TBTDevAddr& aAddr, |
|
78 TNameEntry* aNameEntry, |
|
79 MBTEngSdpResultReceiver* aNotifier); |
|
80 |
|
81 void CancelGetEirServiceUUIDs(); |
|
82 |
|
83 // from base class MBTEngActiveObserver |
|
84 |
|
85 /** |
|
86 * From MBTEngActiveObserver. |
|
87 * Callback to notify that an outstanding request has completed. |
|
88 * |
|
89 * @since S60 v3.2 |
|
90 * @param ?arg1 ?description |
|
91 */ |
|
92 virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, |
|
93 TInt aStatus ); |
|
94 |
|
95 /** |
|
96 * Callback to notify that an error has occurred in RunL. |
|
97 * |
|
98 * @since S60 v3.2 |
|
99 * @param ?arg1 ?description |
|
100 */ |
|
101 virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * C++ default constructor |
|
107 */ |
|
108 CBTEngDeviceSearch(); |
|
109 |
|
110 /** |
|
111 * Symbian 2nd-phase constructor |
|
112 */ |
|
113 void ConstructL(); |
|
114 |
|
115 TInt DoGetDeviceEir(const TBTDevAddr& aAddr ); |
|
116 |
|
117 void HandleDeviceSelectionResultL(TInt aErr); |
|
118 |
|
119 void HandleDeviceEirDataResult(TInt aErr); |
|
120 |
|
121 /** |
|
122 * Notifies the caller of the search result. |
|
123 */ |
|
124 void NotifyClient(TInt aErr); |
|
125 |
|
126 private: |
|
127 enum TClientRequest |
|
128 { |
|
129 EDeviceSearch, |
|
130 EGetDeviceEir |
|
131 }; |
|
132 |
|
133 private: // data |
|
134 |
|
135 /** |
|
136 * Hanlde to the search notifier. |
|
137 */ |
|
138 RNotifier iNotifier; |
|
139 |
|
140 /** |
|
141 * Selection parameters package buffer. |
|
142 */ |
|
143 TBTDeviceSelectionParamsPckg iSelectionPckg; |
|
144 |
|
145 /** |
|
146 * Response parameters package buffer. |
|
147 */ |
|
148 TBTDeviceResponseParamsPckg iResponsePckg; |
|
149 |
|
150 /** |
|
151 * Our actual active object. |
|
152 * Own. |
|
153 */ |
|
154 CBTEngActive* iActive; |
|
155 |
|
156 /** |
|
157 * Socket server for Host Resolver. |
|
158 * Own. |
|
159 */ |
|
160 RSocketServ iSocketServer; |
|
161 |
|
162 /** |
|
163 * Hose Resolver to get cached EIR. |
|
164 * Own. |
|
165 */ |
|
166 RHostResolver iHostResolver; |
|
167 |
|
168 /** |
|
169 * used for getting cached EIR. |
|
170 */ |
|
171 TInquirySockAddr iInquirySockAddr; |
|
172 |
|
173 /** |
|
174 * Client's object to store the results. |
|
175 * Not own. |
|
176 */ |
|
177 CBTDevice* iDevice; |
|
178 |
|
179 /** |
|
180 * Client's object to store EIR data. |
|
181 * Not own. |
|
182 */ |
|
183 TNameEntry* iNameEntry; |
|
184 |
|
185 /** |
|
186 * Reference to receiver of results. |
|
187 * Not own. |
|
188 */ |
|
189 MBTEngSdpResultReceiver* iResultNotifier; |
|
190 |
|
191 TClientRequest iClientReq; |
|
192 |
|
193 }; |
|
194 |
|
195 |
|
196 #endif // BTENGDEVICESEARCH |