]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/BluetoothConfig.h
MdePkg: Add Bluetooth related definition.
[mirror_edk2.git] / MdePkg / Include / Protocol / BluetoothConfig.h
1 /** @file
2 EFI Bluetooth Configuration Protocol as defined in UEFI 2.5.
3 This protocol abstracts user interface configuration for Bluetooth device.
4
5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 @par Revision Reference:
15 This Protocol is introduced in UEFI Specification 2.5
16
17 **/
18
19 #ifndef __EFI_BLUETOOTH_CONFIG_PROTOCOL_H__
20 #define __EFI_BLUETOOTH_CONFIG_PROTOCOL_H__
21
22 #include <IndustryStandard/Bluetooth.h>
23
24 #define EFI_BLUETOOTH_CONFIG_PROTOCOL_GUID \
25 { \
26 0x62960cf3, 0x40ff, 0x4263, { 0xa7, 0x7c, 0xdf, 0xde, 0xbd, 0x19, 0x1b, 0x4b } \
27 }
28
29 typedef struct _EFI_BLUETOOTH_CONFIG_PROTOCOL EFI_BLUETOOTH_CONFIG_PROTOCOL;
30
31 typedef UINT32 EFI_BLUETOOTH_CONFIG_REMOTE_DEVICE_STATE_TYPE;
32 #define EFI_BLUETOOTH_CONFIG_REMOTE_DEVICE_STATE_CONNECTED 0x1
33 #define EFI_BLUETOOTH_CONFIG_REMOTE_DEVICE_STATE_PAIRED 0x2
34
35 ///
36 /// EFI_BLUETOOTH_SCAN_CALLBACK_INFORMATION
37 ///
38 typedef struct {
39 ///
40 /// 48bit Bluetooth device address.
41 ///
42 BLUETOOTH_ADDRESS BDAddr;
43 ///
44 /// State of the remote deive
45 ///
46 UINT8 RemoteDeviceState;
47 ///
48 /// Bluetooth ClassOfDevice. See Bluetooth specification for detail.
49 ///
50 BLUETOOTH_CLASS_OF_DEVICE ClassOfDevice;
51 ///
52 /// Remote device name
53 ///
54 UINT8 RemoteDeviceName[BLUETOOTH_HCI_COMMAND_LOCAL_READABLE_NAME_MAX_SIZE];
55 } EFI_BLUETOOTH_SCAN_CALLBACK_INFORMATION;
56
57 ///
58 /// EFI_BLUETOOTH_CONFIG_DATA_TYPE
59 ///
60 typedef enum {
61 ///
62 /// Local/Remote Bluetooth device name. Data structure is zero terminated CHAR8[].
63 ///
64 EfiBluetoothConfigDataTypeDeviceName,
65 ///
66 /// Local/Remote Bluetooth device ClassOfDevice. Data structure is BLUETOOTH_CLASS_OF_DEVICE.
67 ///
68 EfiBluetoothConfigDataTypeClassOfDevice,
69 ///
70 /// Remote Bluetooth device state. Data structure is EFI_BLUETOOTH_CONFIG_REMOTE_DEVICE_STATE_TYPE.
71 ///
72 EfiBluetoothConfigDataTypeRemoteDeviceState,
73 ///
74 /// Local/Remote Bluetooth device SDP information. Data structure is UINT8[].
75 ///
76 EfiBluetoothConfigDataTypeSdpInfo,
77 ///
78 /// Local Bluetooth device address. Data structure is BLUETOOTH_ADDRESS.
79 ///
80 EfiBluetoothConfigDataTypeBDADDR,
81 ///
82 /// Local Bluetooth discoverable state. Data structure is UINT8. (Page scan and/or Inquiry scan)
83 ///
84 EfiBluetoothConfigDataTypeDiscoverable,
85 ///
86 /// Local Bluetooth controller stored paired device list. Data structure is BLUETOOTH_ADDRESS[].
87 ///
88 EfiBluetoothConfigDataTypeControllerStoredPairedDeviceList,
89 ///
90 /// Local available device list. Data structure is BLUETOOTH_ADDRESS[].
91 ///
92 EfiBluetoothConfigDataTypeAvailableDeviceList,
93 EfiBluetoothConfigDataTypeMax,
94 } EFI_BLUETOOTH_CONFIG_DATA_TYPE;
95
96 ///
97 /// EFI_BLUETOOTH_PIN_CALLBACK_TYPE.
98 ///
99 typedef enum {
100 ///
101 /// For SSP - passkey entry. Input buffer is Passkey (4 bytes). No output buffer.
102 /// See Bluetooth HCI command for detail.
103 ///
104 EfiBluetoothCallbackTypeUserPasskeyNotification,
105 ///
106 /// For SSP - just work and numeric comparison. Input buffer is numeric value (4 bytes).
107 /// Output buffer is BOOLEAN (1 byte). See Bluetooth HCI command for detail.
108 ///
109 EfiBluetoothCallbackTypeUserConfirmationRequest,
110 ///
111 /// For SSP - OOB. See Bluetooth HCI command for detail.
112 ///
113 EfiBluetoothCallbackTypeOOBDataRequest,
114 ///
115 /// For legacy paring. No input buffer. Output buffer is PIN code( <= 16 bytes).
116 /// See Bluetooth HCI command for detail.
117 ///
118 EfiBluetoothCallbackTypePinCodeRequest,
119 EfiBluetoothCallbackTypeMax
120 } EFI_BLUETOOTH_PIN_CALLBACK_TYPE;
121
122 ///
123 /// EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE.
124 ///
125 typedef enum {
126 ///
127 /// This callback is called when Bluetooth receive Disconnection_Complete event. Input buffer is Event
128 /// Parameters of Disconnection_Complete Event defined in Bluetooth specification.
129 ///
130 EfiBluetoothConnCallbackTypeDisconnected,
131 ///
132 /// This callback is called when Bluetooth receive Connection_Complete event. Input buffer is Event
133 /// Parameters of Connection_Complete Event defined in Bluetooth specification.
134 ///
135 EfiBluetoothConnCallbackTypeConnected,
136 ///
137 /// This callback is called when Bluetooth receive Authentication_Complete event. Input buffer is Event
138 /// Parameters of Authentication_Complete Event defined in Bluetooth specification.
139 ///
140 EfiBluetoothConnCallbackTypeAuthenticated,
141 ///
142 /// This callback is called when Bluetooth receive Encryption_Change event. Input buffer is Event
143 /// Parameters of Encryption_Change Event defined in Bluetooth specification.
144 ///
145 EfiBluetoothConnCallbackTypeEncrypted
146 } EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE;
147
148
149 /**
150 Initialize Bluetooth host controller and local device.
151
152 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
153
154 @retval EFI_SUCCESS The Bluetooth host controller and local device is initialized successfully.
155 @retval EFI_DEVICE_ERROR A hardware error occurred trying to initialize the Bluetooth host controller
156 and local device.
157
158 **/
159 typedef
160 EFI_STATUS
161 (EFIAPI *EFI_BLUETOOTH_CONFIG_INIT)(
162 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This
163 );
164
165 /**
166 Callback function, it is called if a Bluetooth device is found during scan process.
167
168 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
169 @param Context Context passed from scan request.
170 @param CallbackInfo Data related to scan result. NULL CallbackInfo means scan complete.
171
172 @retval EFI_SUCCESS The callback function complete successfully.
173
174 **/
175 typedef
176 EFI_STATUS
177 (EFIAPI *EFI_BLUETOOTH_CONFIG_SCAN_CALLBACK_FUNCTION) (
178 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
179 IN VOID *Context,
180 IN EFI_BLUETOOTH_SCAN_CALLBACK_INFORMATION *CallbackInfo
181 );
182
183 /**
184 Scan Bluetooth device.
185
186 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
187 @param ReScan If TRUE, a new scan request is submitted no matter there is scan result before.
188 If FALSE and there is scan result, the previous scan result is returned and no scan request
189 is submitted.
190 @param ScanType Bluetooth scan type, Inquiry and/or Page. See Bluetooth specification for detail.
191 @param Callback The callback function. This function is called if a Bluetooth device is found during scan
192 process.
193 @param Context Data passed into Callback function. This is optional parameter and may be NULL.
194
195 @retval EFI_SUCCESS The Bluetooth scan request is submitted.
196 @retval EFI_DEVICE_ERROR A hardware error occurred trying to scan the Bluetooth device.
197
198 **/
199 typedef
200 EFI_STATUS
201 (EFIAPI *EFI_BLUETOOTH_CONFIG_SCAN)(
202 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
203 IN BOOLEAN ReScan,
204 IN UINT8 ScanType,
205 IN EFI_BLUETOOTH_CONFIG_SCAN_CALLBACK_FUNCTION Callback,
206 IN VOID *Context
207 );
208
209 /**
210 Connect a Bluetooth device.
211
212 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
213 @param BD_ADDR The address of Bluetooth device to be connected.
214
215 @retval EFI_SUCCESS The Bluetooth device is connected successfully.
216 @retval EFI_ALREADY_STARTED The Bluetooth device is already connected.
217 @retval EFI_NOT_FOUND The Bluetooth device is not found.
218 @retval EFI_DEVICE_ERROR A hardware error occurred trying to connect the Bluetooth device.
219
220 **/
221 typedef
222 EFI_STATUS
223 (EFIAPI *EFI_BLUETOOTH_CONFIG_CONNECT)(
224 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
225 IN BLUETOOTH_ADDRESS *BD_ADDR
226 );
227
228 /**
229 Disconnect a Bluetooth device.
230
231 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
232 @param BD_ADDR The address of Bluetooth device to be connected.
233 @param Reason Bluetooth disconnect reason. See Bluetooth specification for detail.
234
235 @retval EFI_SUCCESS The Bluetooth device is disconnected successfully.
236 @retval EFI_NOT_STARTED The Bluetooth device is not connected.
237 @retval EFI_NOT_FOUND The Bluetooth device is not found.
238 @retval EFI_DEVICE_ERROR A hardware error occurred trying to disconnect the Bluetooth device.
239
240 **/
241 typedef
242 EFI_STATUS
243 (EFIAPI *EFI_BLUETOOTH_CONFIG_DISCONNECT)(
244 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
245 IN BLUETOOTH_ADDRESS *BD_ADDR,
246 IN UINT8 Reason
247 );
248
249 /**
250 Get Bluetooth configuration data.
251
252 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
253 @param DataType Configuration data type.
254 @param DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.
255 On output, indicates the amount of data actually returned.
256 @param Data A pointer to the buffer of data that will be returned.
257
258 @retval EFI_SUCCESS The Bluetooth configuration data is returned successfully.
259 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
260 - DataSize is NULL.
261 - *DataSize is 0.
262 - Data is NULL.
263 @retval EFI_UNSUPPORTED The DataType is unsupported.
264 @retval EFI_NOT_FOUND The DataType is not found.
265 @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.
266
267 **/
268 typedef
269 EFI_STATUS
270 (EFIAPI *EFI_BLUETOOTH_CONFIG_GET_DATA)(
271 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
272 IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
273 IN OUT UINTN *DataSize,
274 IN OUT VOID *Data
275 );
276
277 /**
278 Set Bluetooth configuration data.
279
280 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
281 @param DataType Configuration data type.
282 @param DataSize Indicates the size, in bytes, of the data buffer specified by Data.
283 @param Data A pointer to the buffer of data that will be set.
284
285 @retval EFI_SUCCESS The Bluetooth configuration data is set successfully.
286 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
287 - DataSize is 0.
288 - Data is NULL.
289 @retval EFI_UNSUPPORTED The DataType is unsupported.
290 @retval EFI_BUFFER_TOO_SMALL Cannot set configuration data.
291
292 **/
293 typedef
294 EFI_STATUS
295 (EFIAPI *EFI_BLUETOOTH_CONFIG_SET_DATA)(
296 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
297 IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
298 IN UINTN DataSize,
299 IN VOID *Data
300 );
301
302 /**
303 Get remove Bluetooth device configuration data.
304
305 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
306 @param DataType Configuration data type.
307 @param BDAddr Remote Bluetooth device address.
308 @param DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.
309 On output, indicates the amount of data actually returned.
310 @param Data A pointer to the buffer of data that will be returned.
311
312 @retval EFI_SUCCESS The remote Bluetooth device configuration data is returned successfully.
313 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
314 - DataSize is NULL.
315 - *DataSize is 0.
316 - Data is NULL.
317 @retval EFI_UNSUPPORTED The DataType is unsupported.
318 @retval EFI_NOT_FOUND The DataType is not found.
319 @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.
320
321 **/
322 typedef
323 EFI_STATUS
324 (EFIAPI *EFI_BLUETOOTH_CONFIG_GET_REMOTE_DATA)(
325 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
326 IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,
327 IN BLUETOOTH_ADDRESS BDAddr,
328 IN OUT UINTN *DataSize,
329 IN OUT VOID *Data
330 );
331
332 /**
333 The callback function for PIN code.
334
335 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
336 @param Context Context passed from registration.
337 @param CallbackType Callback type in EFI_BLUETOOTH_PIN_CALLBACK_TYPE.
338 @param InputBuffer A pointer to the buffer of data that is input from callback caller.
339 @param InputBufferSize Indicates the size, in bytes, of the data buffer specified by InputBuffer.
340 @param OutputBuffer A pointer to the buffer of data that will be output from callback callee.
341 Callee allocates this buffer by using EFI Boot Service AllocatePool().
342 @param OutputBufferSize Indicates the size, in bytes, of the data buffer specified by OutputBuffer.
343
344 @retval EFI_SUCCESS The callback function complete successfully.
345
346 **/
347 typedef
348 EFI_STATUS
349 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_PIN_CALLBACK_FUNCTION)(
350 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
351 IN VOID *Context,
352 IN EFI_BLUETOOTH_PIN_CALLBACK_TYPE CallbackType,
353 IN VOID *InputBuffer,
354 IN UINTN InputBufferSize,
355 OUT VOID **OutputBuffer,
356 OUT UINTN *OutputBufferSize
357 );
358
359 /**
360 Register PIN callback function.
361
362 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
363 @param Callback The callback function. NULL means unregister.
364 @param Context Data passed into Callback function. This is optional parameter and may be NULL.
365
366 @retval EFI_SUCCESS The PIN callback function is registered successfully.
367
368 **/
369 typedef
370 EFI_STATUS
371 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_PIN_CALLBACK)(
372 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
373 IN EFI_BLUETOOTH_CONFIG_REGISTER_PIN_CALLBACK_FUNCTION Callback,
374 IN VOID *Context
375 );
376
377 /**
378 The callback function to get link key.
379
380 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
381 @param Context Context passed from registration.
382 @param BDAddr A pointer to Bluetooth device address.
383 @param LinkKey A pointer to the buffer of link key.
384
385 @retval EFI_SUCCESS The callback function complete successfully.
386
387 **/
388 typedef
389 EFI_STATUS
390 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_GET_LINK_KEY_CALLBACK_FUNCTION)(
391 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
392 IN VOID *Context,
393 IN BLUETOOTH_ADDRESS *BDAddr,
394 OUT UINT8 LinkKey[BLUETOOTH_HCI_LINK_KEY_SIZE]
395 );
396
397 /**
398 Register get link key callback function.
399
400 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
401 @param Callback The callback function. NULL means unregister.
402 @param Context Data passed into Callback function. This is optional parameter and may be NULL.
403
404 @retval EFI_SUCCESS The link key callback function is registered successfully.
405
406 **/
407 typedef
408 EFI_STATUS
409 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_GET_LINK_KEY_CALLBACK)(
410 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
411 IN EFI_BLUETOOTH_CONFIG_REGISTER_GET_LINK_KEY_CALLBACK_FUNCTION Callback,
412 IN VOID *Context
413 );
414
415 /**
416 The callback function to set link key.
417
418 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
419 @param Context Context passed from registration.
420 @param BDAddr A pointer to Bluetooth device address.
421 @param LinkKey A pointer to the buffer of link key.
422
423 @retval EFI_SUCCESS The callback function complete successfully.
424
425 **/
426 typedef
427 EFI_STATUS
428 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_SET_LINK_KEY_CALLBACK_FUNCTION)(
429 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
430 IN VOID *Context,
431 IN BLUETOOTH_ADDRESS *BDAddr,
432 IN UINT8 LinkKey[BLUETOOTH_HCI_LINK_KEY_SIZE]
433 );
434
435 /**
436 Register set link key callback function.
437
438 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
439 @param Callback The callback function. NULL means unregister.
440 @param Context Data passed into Callback function. This is optional parameter and may be NULL.
441
442 @retval EFI_SUCCESS The link key callback function is registered successfully.
443
444 **/
445 typedef
446 EFI_STATUS
447 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_SET_LINK_KEY_CALLBACK)(
448 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
449 IN EFI_BLUETOOTH_CONFIG_REGISTER_SET_LINK_KEY_CALLBACK_FUNCTION Callback,
450 IN VOID *Context
451 );
452
453 /**
454 The callback function. It is called after connect completed.
455
456 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
457 @param Context Context passed from registration.
458 @param CallbackType Callback type in EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE.
459 @param BDAddr A pointer to Bluetooth device address.
460 @param InputBuffer A pointer to the buffer of data that is input from callback caller.
461 @param InputBufferSize Indicates the size, in bytes, of the data buffer specified by InputBuffer.
462
463 @retval EFI_SUCCESS The callback function complete successfully.
464
465 **/
466 typedef
467 EFI_STATUS
468 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK_FUNCTION)(
469 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
470 IN VOID *Context,
471 IN EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE CallbackType,
472 IN BLUETOOTH_ADDRESS *BDAddr,
473 IN VOID *InputBuffer,
474 IN UINTN InputBufferSize
475 );
476
477 /**
478 Register link connect complete callback function.
479
480 @param This Pointer to the EFI_BLUETOOTH_CONFIG_PROTOCOL instance.
481 @param Callback The callback function. NULL means unregister.
482 @param Context Data passed into Callback function. This is optional parameter and may be NULL.
483
484 @retval EFI_SUCCESS The link connect complete callback function is registered successfully.
485
486 **/
487 typedef
488 EFI_STATUS
489 (EFIAPI *EFI_BLUETOOTH_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK)(
490 IN EFI_BLUETOOTH_CONFIG_PROTOCOL *This,
491 IN EFI_BLUETOOTH_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK_FUNCTION Callback,
492 IN VOID *Context
493 );
494
495 ///
496 /// This protocol abstracts user interface configuration for Bluetooth device.
497 ///
498 struct _EFI_BLUETOOTH_CONFIG_PROTOCOL {
499 EFI_BLUETOOTH_CONFIG_INIT Init;
500 EFI_BLUETOOTH_CONFIG_SCAN Scan;
501 EFI_BLUETOOTH_CONFIG_CONNECT Connect;
502 EFI_BLUETOOTH_CONFIG_DISCONNECT Disconnect;
503 EFI_BLUETOOTH_CONFIG_GET_DATA GetData;
504 EFI_BLUETOOTH_CONFIG_SET_DATA SetData;
505 EFI_BLUETOOTH_CONFIG_GET_REMOTE_DATA GetRemoteData;
506 EFI_BLUETOOTH_CONFIG_REGISTER_PIN_CALLBACK RegisterPinCallback;
507 EFI_BLUETOOTH_CONFIG_REGISTER_GET_LINK_KEY_CALLBACK RegisterGetLinkKeyCallback;
508 EFI_BLUETOOTH_CONFIG_REGISTER_SET_LINK_KEY_CALLBACK RegisterSetLinkKeyCallback;
509 EFI_BLUETOOTH_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK RegisterLinkConnectCompleteCallback;
510 };
511
512 extern EFI_GUID gEfiBluetoothConfigProtocolGuid;
513
514 #endif