1 | /** @file
|
---|
2 | EFI Bluetooth LE Config Protocol as defined in UEFI 2.7.
|
---|
3 | This protocol abstracts user interface configuration for BluetoothLe device.
|
---|
4 |
|
---|
5 | Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | @par Revision Reference:
|
---|
9 | This Protocol is introduced in UEFI Specification 2.7
|
---|
10 |
|
---|
11 | **/
|
---|
12 |
|
---|
13 | #ifndef __EFI_BLUETOOTH_LE_CONFIG_H__
|
---|
14 | #define __EFI_BLUETOOTH_LE_CONFIG_H__
|
---|
15 |
|
---|
16 | #include <Protocol/BluetoothConfig.h>
|
---|
17 | #include <Protocol/BluetoothAttribute.h>
|
---|
18 |
|
---|
19 | #define EFI_BLUETOOTH_LE_CONFIG_PROTOCOL_GUID \
|
---|
20 | { \
|
---|
21 | 0x8f76da58, 0x1f99, 0x4275, { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } \
|
---|
22 | }
|
---|
23 |
|
---|
24 | typedef struct _EFI_BLUETOOTH_LE_CONFIG_PROTOCOL EFI_BLUETOOTH_LE_CONFIG_PROTOCOL;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | Initialize BluetoothLE host controller and local device.
|
---|
28 |
|
---|
29 | The Init() function initializes BluetoothLE host controller and local device.
|
---|
30 |
|
---|
31 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
32 |
|
---|
33 | @retval EFI_SUCCESS The BluetoothLE host controller and local device is initialized successfully.
|
---|
34 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to initialize the BluetoothLE host controller
|
---|
35 | and local device.
|
---|
36 |
|
---|
37 | **/
|
---|
38 | typedef
|
---|
39 | EFI_STATUS
|
---|
40 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_INIT)(
|
---|
41 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This
|
---|
42 | );
|
---|
43 |
|
---|
44 | typedef struct {
|
---|
45 | ///
|
---|
46 | /// The version of the structure. A value of zero represents the EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER
|
---|
47 | /// structure as defined here. Future version of this specification may extend this data structure in a
|
---|
48 | /// backward compatible way and increase the value of Version.
|
---|
49 | ///
|
---|
50 | UINT32 Version;
|
---|
51 | ///
|
---|
52 | /// Passive scanning or active scanning. See Bluetooth specification.
|
---|
53 | ///
|
---|
54 | UINT8 ScanType;
|
---|
55 | ///
|
---|
56 | /// Recommended scan interval to be used while performing scan.
|
---|
57 | ///
|
---|
58 | UINT16 ScanInterval;
|
---|
59 | ///
|
---|
60 | /// Recommended scan window to be used while performing a scan.
|
---|
61 | ///
|
---|
62 | UINT16 ScanWindow;
|
---|
63 | ///
|
---|
64 | /// Recommended scanning filter policy to be used while performing a scan.
|
---|
65 | ///
|
---|
66 | UINT8 ScanningFilterPolicy;
|
---|
67 | ///
|
---|
68 | /// This is one byte flag to serve as a filter to remove unneeded scan
|
---|
69 | /// result. For example, set BIT0 means scan in LE Limited Discoverable
|
---|
70 | /// Mode. Set BIT1 means scan in LE General Discoverable Mode.
|
---|
71 | ///
|
---|
72 | UINT8 AdvertisementFlagFilter;
|
---|
73 | } EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER;
|
---|
74 |
|
---|
75 | typedef struct {
|
---|
76 | BLUETOOTH_LE_ADDRESS BDAddr;
|
---|
77 | BLUETOOTH_LE_ADDRESS DirectAddress;
|
---|
78 | UINT8 RemoteDeviceState;
|
---|
79 | INT8 RSSI;
|
---|
80 | UINTN AdvertisementDataSize;
|
---|
81 | VOID *AdvertisementData;
|
---|
82 | } EFI_BLUETOOTH_LE_SCAN_CALLBACK_INFORMATION;
|
---|
83 |
|
---|
84 | /**
|
---|
85 | Callback function, it is called if a BluetoothLE device is found during scan process.
|
---|
86 |
|
---|
87 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
88 | @param[in] Context Context passed from scan request.
|
---|
89 | @param[in] CallbackInfo Data related to scan result. NULL CallbackInfo means scan complete.
|
---|
90 |
|
---|
91 | @retval EFI_SUCCESS The callback function complete successfully.
|
---|
92 |
|
---|
93 | **/
|
---|
94 | typedef
|
---|
95 | EFI_STATUS
|
---|
96 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SCAN_CALLBACK_FUNCTION)(
|
---|
97 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
98 | IN VOID *Context,
|
---|
99 | IN EFI_BLUETOOTH_LE_SCAN_CALLBACK_INFORMATION *CallbackInfo
|
---|
100 | );
|
---|
101 |
|
---|
102 | /**
|
---|
103 | Scan BluetoothLE device.
|
---|
104 |
|
---|
105 | The Scan() function scans BluetoothLE device. When this function is returned, it just means scan
|
---|
106 | request is submitted. It does not mean scan process is started or finished. Whenever there is a
|
---|
107 | BluetoothLE device is found, the Callback function will be called. Callback function might be
|
---|
108 | called before this function returns or after this function returns
|
---|
109 |
|
---|
110 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
111 | @param[in] ReScan If TRUE, a new scan request is submitted no matter there is scan result before.
|
---|
112 | If FALSE and there is scan result, the previous scan result is returned and no scan request
|
---|
113 | is submitted.
|
---|
114 | @param[in] Timeout Duration in milliseconds for which to scan.
|
---|
115 | @param[in] ScanParameter If it is not NULL, the ScanParameter is used to perform a scan by the BluetoothLE bus driver.
|
---|
116 | If it is NULL, the default parameter is used.
|
---|
117 | @param[in] Callback The callback function. This function is called if a BluetoothLE device is found during
|
---|
118 | scan process.
|
---|
119 | @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
|
---|
120 |
|
---|
121 | @retval EFI_SUCCESS The Bluetooth scan request is submitted.
|
---|
122 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to scan the BluetoothLE device.
|
---|
123 |
|
---|
124 | **/
|
---|
125 | typedef
|
---|
126 | EFI_STATUS
|
---|
127 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SCAN)(
|
---|
128 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
129 | IN BOOLEAN ReScan,
|
---|
130 | IN UINT32 Timeout,
|
---|
131 | IN EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER *ScanParameter OPTIONAL,
|
---|
132 | IN EFI_BLUETOOTH_LE_CONFIG_SCAN_CALLBACK_FUNCTION Callback,
|
---|
133 | IN VOID *Context
|
---|
134 | );
|
---|
135 |
|
---|
136 | typedef struct {
|
---|
137 | ///
|
---|
138 | /// The version of the structure. A value of zero represents the
|
---|
139 | /// EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER
|
---|
140 | /// structure as defined here. Future version of this specification may
|
---|
141 | /// extend this data structure in a backward compatible way and
|
---|
142 | /// increase the value of Version.
|
---|
143 | ///
|
---|
144 | UINT32 Version;
|
---|
145 | ///
|
---|
146 | /// Recommended scan interval to be used while performing scan before connect.
|
---|
147 | ///
|
---|
148 | UINT16 ScanInterval;
|
---|
149 | ///
|
---|
150 | /// Recommended scan window to be used while performing a connection
|
---|
151 | ///
|
---|
152 | UINT16 ScanWindow;
|
---|
153 | ///
|
---|
154 | /// Minimum allowed connection interval. Shall be less than or equal to ConnIntervalMax.
|
---|
155 | ///
|
---|
156 | UINT16 ConnIntervalMin;
|
---|
157 | ///
|
---|
158 | /// Maximum allowed connection interval. Shall be greater than or equal to ConnIntervalMin.
|
---|
159 | ///
|
---|
160 | UINT16 ConnIntervalMax;
|
---|
161 | ///
|
---|
162 | /// Slave latency for the connection in number of connection events.
|
---|
163 | ///
|
---|
164 | UINT16 ConnLatency;
|
---|
165 | ///
|
---|
166 | /// Link supervision timeout for the connection.
|
---|
167 | ///
|
---|
168 | UINT16 SupervisionTimeout;
|
---|
169 | } EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER;
|
---|
170 |
|
---|
171 | /**
|
---|
172 | Connect a BluetoothLE device.
|
---|
173 |
|
---|
174 | The Connect() function connects a Bluetooth device. When this function is returned successfully,
|
---|
175 | a new EFI_BLUETOOTH_IO_PROTOCOL is created.
|
---|
176 |
|
---|
177 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
178 | @param[in] AutoReconnect If TRUE, the BluetoothLE host controller needs to do an auto
|
---|
179 | reconnect. If FALSE, the BluetoothLE host controller does not do
|
---|
180 | an auto reconnect.
|
---|
181 | @param[in] DoBonding If TRUE, the BluetoothLE host controller needs to do a bonding.
|
---|
182 | If FALSE, the BluetoothLE host controller does not do a bonding.
|
---|
183 | @param[in] ConnectParameter If it is not NULL, the ConnectParameter is used to perform a
|
---|
184 | scan by the BluetoothLE bus driver. If it is NULL, the default
|
---|
185 | parameter is used.
|
---|
186 | @param[in] BD_ADDR The address of the BluetoothLE device to be connected.
|
---|
187 |
|
---|
188 | @retval EFI_SUCCESS The BluetoothLE device is connected successfully.
|
---|
189 | @retval EFI_ALREADY_STARTED The BluetoothLE device is already connected.
|
---|
190 | @retval EFI_NOT_FOUND The BluetoothLE device is not found.
|
---|
191 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to connect the BluetoothLE device.
|
---|
192 |
|
---|
193 | **/
|
---|
194 | typedef
|
---|
195 | EFI_STATUS
|
---|
196 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_CONNECT)(
|
---|
197 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
198 | IN BOOLEAN AutoReconnect,
|
---|
199 | IN BOOLEAN DoBonding,
|
---|
200 | IN EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER *ConnectParameter OPTIONAL,
|
---|
201 | IN BLUETOOTH_LE_ADDRESS *BD_ADDR
|
---|
202 | );
|
---|
203 |
|
---|
204 | /**
|
---|
205 | Disconnect a BluetoothLE device.
|
---|
206 |
|
---|
207 | The Disconnect() function disconnects a BluetoothLE device. When this function is returned
|
---|
208 | successfully, the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL associated with this device is
|
---|
209 | destroyed and all services associated are stopped.
|
---|
210 |
|
---|
211 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
212 | @param[in] BD_ADDR The address of BluetoothLE device to be connected.
|
---|
213 | @param[in] Reason Bluetooth disconnect reason. See Bluetooth specification for detail.
|
---|
214 |
|
---|
215 | @retval EFI_SUCCESS The BluetoothLE device is disconnected successfully.
|
---|
216 | @retval EFI_NOT_STARTED The BluetoothLE device is not connected.
|
---|
217 | @retval EFI_NOT_FOUND The BluetoothLE device is not found.
|
---|
218 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to disconnect the BluetoothLE device.
|
---|
219 |
|
---|
220 | **/
|
---|
221 | typedef
|
---|
222 | EFI_STATUS
|
---|
223 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_DISCONNECT)(
|
---|
224 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
225 | IN BLUETOOTH_LE_ADDRESS *BD_ADDR,
|
---|
226 | IN UINT8 Reason
|
---|
227 | );
|
---|
228 |
|
---|
229 | /**
|
---|
230 | Get BluetoothLE configuration data.
|
---|
231 |
|
---|
232 | The GetData() function returns BluetoothLE configuration data. For remote BluetoothLE device
|
---|
233 | configuration data, please use GetRemoteData() function with valid BD_ADDR.
|
---|
234 |
|
---|
235 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
236 | @param[in] DataType Configuration data type.
|
---|
237 | @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.
|
---|
238 | On output, indicates the amount of data actually returned.
|
---|
239 | @param[in, out] Data A pointer to the buffer of data that will be returned.
|
---|
240 |
|
---|
241 | @retval EFI_SUCCESS The BluetoothLE configuration data is returned successfully.
|
---|
242 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
243 | - DataSize is NULL.
|
---|
244 | - *DataSize is 0.
|
---|
245 | - Data is NULL.
|
---|
246 | @retval EFI_UNSUPPORTED The DataType is unsupported.
|
---|
247 | @retval EFI_NOT_FOUND The DataType is not found.
|
---|
248 | @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.
|
---|
249 |
|
---|
250 | **/
|
---|
251 | typedef
|
---|
252 | EFI_STATUS
|
---|
253 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_GET_DATA)(
|
---|
254 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
255 | IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
|
---|
256 | IN OUT UINTN *DataSize,
|
---|
257 | IN OUT VOID *Data OPTIONAL
|
---|
258 | );
|
---|
259 |
|
---|
260 | /**
|
---|
261 | Set BluetoothLE configuration data.
|
---|
262 |
|
---|
263 | The SetData() function sets local BluetoothLE device configuration data. Not all DataType can be
|
---|
264 | set.
|
---|
265 |
|
---|
266 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
267 | @param[in] DataType Configuration data type.
|
---|
268 | @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.
|
---|
269 | @param[in] Data A pointer to the buffer of data that will be set.
|
---|
270 |
|
---|
271 | @retval EFI_SUCCESS The BluetoothLE configuration data is set successfully.
|
---|
272 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
273 | - DataSize is 0.
|
---|
274 | - Data is NULL.
|
---|
275 | @retval EFI_UNSUPPORTED The DataType is unsupported.
|
---|
276 | @retval EFI_WRITE_PROTECTED Cannot set configuration data.
|
---|
277 |
|
---|
278 | **/
|
---|
279 | typedef
|
---|
280 | EFI_STATUS
|
---|
281 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SET_DATA)(
|
---|
282 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
283 | IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
|
---|
284 | IN UINTN DataSize,
|
---|
285 | IN VOID *Data
|
---|
286 | );
|
---|
287 |
|
---|
288 | /**
|
---|
289 | Get remove BluetoothLE device configuration data.
|
---|
290 |
|
---|
291 | The GetRemoteData() function returns remote BluetoothLE device configuration data.
|
---|
292 |
|
---|
293 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
294 | @param[in] DataType Configuration data type.
|
---|
295 | @param[in] BDAddr Remote BluetoothLE device address.
|
---|
296 | @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.
|
---|
297 | On output, indicates the amount of data actually returned.
|
---|
298 | @param[in, out] Data A pointer to the buffer of data that will be returned.
|
---|
299 |
|
---|
300 | @retval EFI_SUCCESS The remote BluetoothLE device configuration data is returned successfully.
|
---|
301 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
---|
302 | - DataSize is NULL.
|
---|
303 | - *DataSize is 0.
|
---|
304 | - Data is NULL.
|
---|
305 | @retval EFI_UNSUPPORTED The DataType is unsupported.
|
---|
306 | @retval EFI_NOT_FOUND The DataType is not found.
|
---|
307 | @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.
|
---|
308 |
|
---|
309 | **/
|
---|
310 | typedef
|
---|
311 | EFI_STATUS
|
---|
312 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_GET_REMOTE_DATA)(
|
---|
313 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
314 | IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
|
---|
315 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
316 | IN OUT UINTN *DataSize,
|
---|
317 | IN OUT VOID *Data
|
---|
318 | );
|
---|
319 |
|
---|
320 | typedef enum {
|
---|
321 | ///
|
---|
322 | /// It indicates an authorization request. No data is associated with the callback
|
---|
323 | /// input. In the output data, the application should return the authorization value.
|
---|
324 | /// The data structure is BOOLEAN. TRUE means YES. FALSE means NO.
|
---|
325 | ///
|
---|
326 | EfiBluetoothSmpAuthorizationRequestEvent,
|
---|
327 | ///
|
---|
328 | /// It indicates that a passkey has been generated locally by the driver, and the same
|
---|
329 | /// passkey should be entered at the remote device. The callback input data is the
|
---|
330 | /// passkey of type UINT32, to be displayed by the application. No output data
|
---|
331 | /// should be returned.
|
---|
332 | ///
|
---|
333 | EfiBluetoothSmpPasskeyReadyEvent,
|
---|
334 | ///
|
---|
335 | /// It indicates that the driver is requesting for the passkey has been generated at
|
---|
336 | /// the remote device. No data is associated with the callback input. The output data
|
---|
337 | /// is the passkey of type UINT32, to be entered by the user.
|
---|
338 | ///
|
---|
339 | EfiBluetoothSmpPasskeyRequestEvent,
|
---|
340 | ///
|
---|
341 | /// It indicates that the driver is requesting for the passkey that has been pre-shared
|
---|
342 | /// out-of-band with the remote device. No data is associated with the callback
|
---|
343 | /// input. The output data is the stored OOB data of type UINT8[16].
|
---|
344 | ///
|
---|
345 | EfiBluetoothSmpOOBDataRequestEvent,
|
---|
346 | ///
|
---|
347 | /// In indicates that a number have been generated locally by the bus driver, and
|
---|
348 | /// also at the remote device, and the bus driver wants to know if the two numbers
|
---|
349 | /// match. The callback input data is the number of type UINT32. The output data
|
---|
350 | /// is confirmation value of type BOOLEAN. TRUE means comparison pass. FALSE
|
---|
351 | /// means comparison fail.
|
---|
352 | ///
|
---|
353 | EfiBluetoothSmpNumericComparisonEvent,
|
---|
354 | } EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE;
|
---|
355 |
|
---|
356 | /**
|
---|
357 | The callback function for SMP.
|
---|
358 |
|
---|
359 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
360 | @param[in] Context Data passed into callback function. This is optional parameter
|
---|
361 | and may be NULL.
|
---|
362 | @param[in] BDAddr Remote BluetoothLE device address.
|
---|
363 | @param[in] EventDataType Event data type in EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE.
|
---|
364 | @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.
|
---|
365 | @param[in] Data A pointer to the buffer of data.
|
---|
366 |
|
---|
367 | @retval EFI_SUCCESS The callback function complete successfully.
|
---|
368 |
|
---|
369 | **/
|
---|
370 | typedef
|
---|
371 | EFI_STATUS
|
---|
372 | (EFIAPI *EFI_BLUETOOTH_LE_SMP_CALLBACK)(
|
---|
373 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
374 | IN VOID *Context,
|
---|
375 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
376 | IN EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE EventDataType,
|
---|
377 | IN UINTN DataSize,
|
---|
378 | IN VOID *Data
|
---|
379 | );
|
---|
380 |
|
---|
381 | /**
|
---|
382 | Register Security Manager Protocol callback function for user authentication/authorization.
|
---|
383 |
|
---|
384 | The RegisterSmpAuthCallback() function register Security Manager Protocol callback
|
---|
385 | function for user authentication/authorization.
|
---|
386 |
|
---|
387 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
388 | @param[in] Callback Callback function for user authentication/authorization.
|
---|
389 | @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
|
---|
390 |
|
---|
391 | @retval EFI_SUCCESS The SMP callback function is registered successfully.
|
---|
392 | @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
|
---|
393 | opcode and attribute handle, when the Callback is not NULL.
|
---|
394 | @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
|
---|
395 | and attribute handle, when the Callback is NULL.
|
---|
396 |
|
---|
397 | **/
|
---|
398 | typedef
|
---|
399 | EFI_STATUS
|
---|
400 | (EFIAPI *EFI_BLUETOOTH_LE_REGISTER_SMP_AUTH_CALLBACK)(
|
---|
401 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
402 | IN EFI_BLUETOOTH_LE_SMP_CALLBACK Callback,
|
---|
403 | IN VOID *Context
|
---|
404 | );
|
---|
405 |
|
---|
406 | /**
|
---|
407 | Send user authentication/authorization to remote device.
|
---|
408 |
|
---|
409 | The SendSmpAuthData() function sends user authentication/authorization to remote device. It
|
---|
410 | should be used to send these information after the caller gets the request data from the callback
|
---|
411 | function by RegisterSmpAuthCallback().
|
---|
412 |
|
---|
413 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
414 | @param[in] BDAddr Remote BluetoothLE device address.
|
---|
415 | @param[in] EventDataType Event data type in EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE.
|
---|
416 | @param[in] DataSize The size of Data in bytes, of the data buffer specified by Data.
|
---|
417 | @param[in] Data A pointer to the buffer of data that will be sent. The data format
|
---|
418 | depends on the type of SMP event data being responded to.
|
---|
419 |
|
---|
420 | @retval EFI_SUCCESS The SMP authorization data is sent successfully.
|
---|
421 | @retval EFI_NOT_READY SMP is not in the correct state to receive the auth data.
|
---|
422 |
|
---|
423 | **/
|
---|
424 | typedef
|
---|
425 | EFI_STATUS
|
---|
426 | (EFIAPI *EFI_BLUETOOTH_LE_SEND_SMP_AUTH_DATA)(
|
---|
427 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
428 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
429 | IN EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE EventDataType,
|
---|
430 | IN UINTN DataSize,
|
---|
431 | IN VOID *Data
|
---|
432 | );
|
---|
433 |
|
---|
434 | typedef enum {
|
---|
435 | // For local device only
|
---|
436 | EfiBluetoothSmpLocalIR, /* If Key hierarchy is supported */
|
---|
437 | EfiBluetoothSmpLocalER, /* If Key hierarchy is supported */
|
---|
438 | EfiBluetoothSmpLocalDHK, /* If Key hierarchy is supported. OPTIONAL */
|
---|
439 | // For peer specific
|
---|
440 | EfiBluetoothSmpKeysDistributed = 0x1000,
|
---|
441 | EfiBluetoothSmpKeySize,
|
---|
442 | EfiBluetoothSmpKeyType,
|
---|
443 | EfiBluetoothSmpPeerLTK,
|
---|
444 | EfiBluetoothSmpPeerIRK,
|
---|
445 | EfiBluetoothSmpPeerCSRK,
|
---|
446 | EfiBluetoothSmpPeerRand,
|
---|
447 | EfiBluetoothSmpPeerEDIV,
|
---|
448 | EfiBluetoothSmpPeerSignCounter,
|
---|
449 | EfiBluetoothSmpLocalLTK, /* If Key hierarchy not supported */
|
---|
450 | EfiBluetoothSmpLocalIRK, /* If Key hierarchy not supported */
|
---|
451 | EfiBluetoothSmpLocalCSRK, /* If Key hierarchy not supported */
|
---|
452 | EfiBluetoothSmpLocalSignCounter,
|
---|
453 | EfiBluetoothSmpLocalDIV,
|
---|
454 | EfiBluetoothSmpPeerAddressList,
|
---|
455 | EfiBluetoothSmpMax,
|
---|
456 | } EFI_BLUETOOTH_LE_SMP_DATA_TYPE;
|
---|
457 |
|
---|
458 | /**
|
---|
459 | The callback function to get SMP data.
|
---|
460 |
|
---|
461 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
462 | @param[in] Context Data passed into callback function. This is optional parameter
|
---|
463 | and may be NULL.
|
---|
464 | @param[in] BDAddr Remote BluetoothLE device address. For Local device setting, it
|
---|
465 | should be NULL.
|
---|
466 | @param[in] DataType Data type in EFI_BLUETOOTH_LE_SMP_DATA_TYPE.
|
---|
467 | @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified
|
---|
468 | by Data. On output, indicates the amount of data actually returned.
|
---|
469 | @param[out] Data A pointer to the buffer of data that will be returned.
|
---|
470 |
|
---|
471 | @retval EFI_SUCCESS The callback function complete successfully.
|
---|
472 |
|
---|
473 | **/
|
---|
474 | typedef
|
---|
475 | EFI_STATUS
|
---|
476 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SMP_GET_DATA_CALLBACK)(
|
---|
477 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
478 | IN VOID *Context,
|
---|
479 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
480 | IN EFI_BLUETOOTH_LE_SMP_DATA_TYPE DataType,
|
---|
481 | IN OUT UINTN *DataSize,
|
---|
482 | OUT VOID *Data
|
---|
483 | );
|
---|
484 |
|
---|
485 | /**
|
---|
486 | Register a callback function to get SMP related data.
|
---|
487 |
|
---|
488 | The RegisterSmpGetDataCallback() function registers a callback function to get SMP related data.
|
---|
489 |
|
---|
490 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
491 | @param[in] Callback Callback function for SMP get data.
|
---|
492 | @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
|
---|
493 |
|
---|
494 | @retval EFI_SUCCESS The SMP get data callback function is registered successfully.
|
---|
495 | @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
|
---|
496 | opcode and attribute handle, when the Callback is not NULL.
|
---|
497 | @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
|
---|
498 | and attribute handle, when the Callback is NULL
|
---|
499 | **/
|
---|
500 | typedef
|
---|
501 | EFI_STATUS
|
---|
502 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_GET_DATA_CALLBACK)(
|
---|
503 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
504 | IN EFI_BLUETOOTH_LE_CONFIG_SMP_GET_DATA_CALLBACK Callback,
|
---|
505 | IN VOID *Context
|
---|
506 | );
|
---|
507 |
|
---|
508 | /**
|
---|
509 | The callback function to set SMP data.
|
---|
510 |
|
---|
511 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
512 | @param[in] Context Data passed into callback function. This is optional parameter
|
---|
513 | and may be NULL.
|
---|
514 | @param[in] BDAddr Remote BluetoothLE device address.
|
---|
515 | @param[in] DataType Data type in EFI_BLUETOOTH_LE_SMP_DATA_TYPE.
|
---|
516 | @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.
|
---|
517 | @param[in] Data A pointer to the buffer of data.
|
---|
518 |
|
---|
519 | @retval EFI_SUCCESS The callback function complete successfully.
|
---|
520 |
|
---|
521 | **/
|
---|
522 | typedef
|
---|
523 | EFI_STATUS
|
---|
524 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SMP_SET_DATA_CALLBACK)(
|
---|
525 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
526 | IN VOID *Context,
|
---|
527 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
528 | IN EFI_BLUETOOTH_LE_SMP_DATA_TYPE Type,
|
---|
529 | IN UINTN DataSize,
|
---|
530 | IN VOID *Data
|
---|
531 | );
|
---|
532 |
|
---|
533 | /**
|
---|
534 | Register a callback function to set SMP related data.
|
---|
535 |
|
---|
536 | The RegisterSmpSetDataCallback() function registers a callback function to set SMP related data.
|
---|
537 |
|
---|
538 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
539 | @param[in] Callback Callback function for SMP set data.
|
---|
540 | @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
|
---|
541 |
|
---|
542 | @retval EFI_SUCCESS The SMP set data callback function is registered successfully.
|
---|
543 | @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
|
---|
544 | opcode and attribute handle, when the Callback is not NULL.
|
---|
545 | @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
|
---|
546 | and attribute handle, when the Callback is NULL
|
---|
547 | **/
|
---|
548 | typedef
|
---|
549 | EFI_STATUS
|
---|
550 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_SET_DATA_CALLBACK)(
|
---|
551 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
552 | IN EFI_BLUETOOTH_LE_CONFIG_SMP_SET_DATA_CALLBACK Callback,
|
---|
553 | IN VOID *Context
|
---|
554 | );
|
---|
555 |
|
---|
556 | /**
|
---|
557 | The callback function to hook connect complete event.
|
---|
558 |
|
---|
559 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
560 | @param[in] Context Data passed into callback function. This is optional parameter
|
---|
561 | and may be NULL.
|
---|
562 | @param[in] CallbackType The value defined in EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE.
|
---|
563 | @param[in] BDAddr Remote BluetoothLE device address.
|
---|
564 | @param[in] InputBuffer A pointer to the buffer of data that is input from callback caller.
|
---|
565 | @param[in] InputBufferSize Indicates the size, in bytes, of the data buffer specified by InputBuffer.
|
---|
566 |
|
---|
567 | @retval EFI_SUCCESS The callback function complete successfully.
|
---|
568 |
|
---|
569 | **/
|
---|
570 | typedef
|
---|
571 | EFI_STATUS
|
---|
572 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_CONNECT_COMPLETE_CALLBACK)(
|
---|
573 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
574 | IN VOID *Context,
|
---|
575 | IN EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE CallbackType,
|
---|
576 | IN BLUETOOTH_LE_ADDRESS *BDAddr,
|
---|
577 | IN VOID *InputBuffer,
|
---|
578 | IN UINTN InputBufferSize
|
---|
579 | );
|
---|
580 |
|
---|
581 | /**
|
---|
582 | Register link connect complete callback function.
|
---|
583 |
|
---|
584 | The RegisterLinkConnectCompleteCallback() function registers Bluetooth link connect
|
---|
585 | complete callback function. The Bluetooth Configuration driver may call
|
---|
586 | RegisterLinkConnectCompleteCallback() to register a callback function. During pairing,
|
---|
587 | Bluetooth bus driver must trigger this callback function to report device state, if it is registered.
|
---|
588 | Then Bluetooth Configuration driver will get information on device connection, according to
|
---|
589 | CallbackType defined by EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE
|
---|
590 |
|
---|
591 | @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.
|
---|
592 | @param[in] Callback The callback function. NULL means unregister.
|
---|
593 | @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
|
---|
594 |
|
---|
595 | @retval EFI_SUCCESS The link connect complete callback function is registered successfully.
|
---|
596 | @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
|
---|
597 | opcode and attribute handle, when the Callback is not NULL.
|
---|
598 | @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
|
---|
599 | and attribute handle, when the Callback is NULL
|
---|
600 | **/
|
---|
601 | typedef
|
---|
602 | EFI_STATUS
|
---|
603 | (EFIAPI *EFI_BLUETOOTH_LE_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK)(
|
---|
604 | IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,
|
---|
605 | IN EFI_BLUETOOTH_LE_CONFIG_CONNECT_COMPLETE_CALLBACK Callback,
|
---|
606 | IN VOID *Context
|
---|
607 | );
|
---|
608 |
|
---|
609 | ///
|
---|
610 | /// This protocol abstracts user interface configuration for BluetoothLe device.
|
---|
611 | ///
|
---|
612 | struct _EFI_BLUETOOTH_LE_CONFIG_PROTOCOL {
|
---|
613 | EFI_BLUETOOTH_LE_CONFIG_INIT Init;
|
---|
614 | EFI_BLUETOOTH_LE_CONFIG_SCAN Scan;
|
---|
615 | EFI_BLUETOOTH_LE_CONFIG_CONNECT Connect;
|
---|
616 | EFI_BLUETOOTH_LE_CONFIG_DISCONNECT Disconnect;
|
---|
617 | EFI_BLUETOOTH_LE_CONFIG_GET_DATA GetData;
|
---|
618 | EFI_BLUETOOTH_LE_CONFIG_SET_DATA SetData;
|
---|
619 | EFI_BLUETOOTH_LE_CONFIG_GET_REMOTE_DATA GetRemoteData;
|
---|
620 | EFI_BLUETOOTH_LE_REGISTER_SMP_AUTH_CALLBACK RegisterSmpAuthCallback;
|
---|
621 | EFI_BLUETOOTH_LE_SEND_SMP_AUTH_DATA SendSmpAuthData;
|
---|
622 | EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_GET_DATA_CALLBACK RegisterSmpGetDataCallback;
|
---|
623 | EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_SET_DATA_CALLBACK RegisterSmpSetDataCallback;
|
---|
624 | EFI_BLUETOOTH_LE_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK RegisterLinkConnectCompleteCallback;
|
---|
625 | };
|
---|
626 |
|
---|
627 | extern EFI_GUID gEfiBluetoothLeConfigProtocolGuid;
|
---|
628 |
|
---|
629 | #endif
|
---|