--- /dev/null
+/** @file\r
+ EFI Bluetooth Attribute Protocol as defined in UEFI 2.7.\r
+ This protocol provides service for Bluetooth ATT (Attribute Protocol) and GATT (Generic\r
+ Attribute Profile) based protocol interfaces.\r
+\r
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are licensed and made available under\r
+ the terms and conditions of the BSD License that accompanies this distribution.\r
+ The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ @par Revision Reference:\r
+ This Protocol is introduced in UEFI Specification 2.7\r
+\r
+**/\r
+\r
+#ifndef __EFI_BLUETOOTH_ATTRIBUTE_H__\r
+#define __EFI_BLUETOOTH_ATTRIBUTE_H__\r
+\r
+#define EFI_BLUETOOTH_ATTRIBUTE_SERVICE_BINDING_PROTOCOL_GUID \\r
+ { \\r
+ 0x5639867a, 0x8c8e, 0x408d, { 0xac, 0x2f, 0x4b, 0x61, 0xbd, 0xc0, 0xbb, 0xbb } \\r
+ }\r
+\r
+#define EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL_GUID \\r
+ { \\r
+ 0x898890e9, 0x84b2, 0x4f3a, { 0x8c, 0x58, 0xd8, 0x57, 0x78, 0x13, 0xe0, 0xac } \\r
+ }\r
+\r
+typedef struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL;\r
+\r
+#pragma pack(1)\r
+\r
+//\r
+// Bluetooth UUID\r
+//\r
+typedef struct {\r
+ UINT8 Length;\r
+ union {\r
+ UINT16 Uuid16;\r
+ UINT32 Uuid32;\r
+ UINT8 Uuid128[16];\r
+ } Data;\r
+} EFI_BLUETOOTH_UUID;\r
+\r
+\r
+#define UUID_16BIT_TYPE_LEN 2\r
+#define UUID_32BIT_TYPE_LEN 4\r
+#define UUID_128BIT_TYPE_LEN 16\r
+\r
+#define BLUETOOTH_IS_ATTRIBUTE_OF_TYPE(a,t) ((a)->Type.Length == UUID_16BIT_TYPE_LEN && (a)->Type.Data.Uuid16 == (t))\r
+\r
+//\r
+// Bluetooth Attribute Permission\r
+//\r
+typedef union {\r
+ struct {\r
+ UINT16 Readable : 1;\r
+ UINT16 ReadEncryption : 1;\r
+ UINT16 ReadAuthentication : 1;\r
+ UINT16 ReadAuthorization : 1;\r
+ UINT16 ReadKeySize : 5;\r
+ UINT16 Reserved1 : 7;\r
+ UINT16 Writeable : 1;\r
+ UINT16 WriteEncryption : 1;\r
+ UINT16 WriteAuthentication : 1;\r
+ UINT16 WriteAuthorization : 1;\r
+ UINT16 WriteKeySize : 5;\r
+ UINT16 Reserved2 : 7;\r
+ } Permission;\r
+ UINT32 Data32;\r
+} EFI_BLUETOOTH_ATTRIBUTE_PERMISSION;\r
+\r
+typedef struct {\r
+ EFI_BLUETOOTH_UUID Type;\r
+ UINT16 Length;\r
+ UINT16 AttributeHandle;\r
+ EFI_BLUETOOTH_ATTRIBUTE_PERMISSION AttributePermission;\r
+} EFI_BLUETOOTH_ATTRIBUTE_HEADER;\r
+\r
+typedef struct {\r
+ EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
+ UINT16 EndGroupHandle;\r
+ EFI_BLUETOOTH_UUID ServiceUuid;\r
+} EFI_BLUETOOTH_GATT_PRIMARY_SERVICE_INFO;\r
+\r
+typedef struct {\r
+ EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
+ UINT16 StartGroupHandle;\r
+ UINT16 EndGroupHandle;\r
+ EFI_BLUETOOTH_UUID ServiceUuid;\r
+} EFI_BLUETOOTH_GATT_INCLUDE_SERVICE_INFO;\r
+\r
+typedef struct {\r
+ EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
+ UINT8 CharacteristicProperties;\r
+ UINT16 CharacteristicValueHandle;\r
+ EFI_BLUETOOTH_UUID CharacteristicUuid;\r
+} EFI_BLUETOOTH_GATT_CHARACTERISTIC_INFO;\r
+\r
+typedef struct {\r
+ EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
+ EFI_BLUETOOTH_UUID CharacteristicDescriptorUuid;\r
+} EFI_BLUETOOTH_GATT_CHARACTERISTIC_DESCRIPTOR_INFO;\r
+\r
+#pragma pack()\r
+\r
+typedef struct {\r
+ UINT16 AttributeHandle;\r
+} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION;\r
+\r
+typedef struct {\r
+ UINT16 AttributeHandle;\r
+} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION;\r
+\r
+typedef struct {\r
+ UINT32 Version;\r
+ UINT8 AttributeOpCode;\r
+ union {\r
+ EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION Notification;\r
+ EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION Indication;\r
+ } Parameter;\r
+} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER;\r
+\r
+typedef struct {\r
+ UINT32 Version;\r
+ BLUETOOTH_LE_ADDRESS BD_ADDR;\r
+ BLUETOOTH_LE_ADDRESS DirectAddress;\r
+ UINT8 RSSI;\r
+ UINTN AdvertisementDataSize;\r
+ VOID *AdvertisementData;\r
+} EFI_BLUETOOTH_LE_DEVICE_INFO;\r
+\r
+/**\r
+ The callback function to send request.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
+ @param[in] Data Data received. The first byte is the attribute opcode, followed by opcode specific\r
+ fields. See Bluetooth specification, Vol 3, Part F, Attribute Protocol. It might be a\r
+ normal RESPONSE message, or ERROR RESPONSE messag\r
+ @param[in] DataLength The length of Data in bytes.\r
+ @param[in] Context The context passed from the callback registration request.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION) (\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Send a "REQUEST" or "COMMAND" message to remote server and receive a "RESPONSE" message\r
+ for "REQUEST" from remote server according to Bluetooth attribute protocol data unit(PDU).\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
+ @param[in] Data Data of a REQUEST or COMMAND message. The first byte is the attribute PDU\r
+ related opcode, followed by opcode specific fields. See Bluetooth specification,\r
+ Vol 3, Part F, Attribute Protocol.\r
+ @param[in] DataLength The length of Data in bytes.\r
+ @param[in] Callback Callback function to notify the RESPONSE is received to the caller, with the\r
+ response buffer. Caller must check the response buffer content to know if the\r
+ request action is success or fail. It may be NULL if the data is a COMMAND.\r
+ @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The request is sent successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid due to following conditions:\r
+ - The Buffer is NULL.\r
+ - The BufferLength is 0.\r
+ - The opcode in Buffer is not a valid OPCODE according to Bluetooth specification.\r
+ - The Callback is NULL.\r
+ @retval EFI_DEVICE_ERROR Sending the request failed due to the host controller or the device error.\r
+ @retval EFI_NOT_READY A GATT operation is already underway for this device.\r
+ @retval EFI_UNSUPPORTED The attribute does not support the corresponding operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST) (\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength,\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Register or unregister a server initiated message, such as NOTIFICATION or INDICATION, on a\r
+ characteristic value on remote server.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
+ @param[in] CallbackParameter The parameter of the callback.\r
+ @param[in] Callback Callback function for server initiated attribute protocol. NULL callback\r
+ function means unregister the server initiated callback.\r
+ @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The callback function is registered or unregistered successfully\r
+ @retval EFI_INVALID_PARAMETER The attribute opcode is not server initiated message opcode. See\r
+ Bluetooth specification, Vol 3, Part F, Attribute Protocol.\r
+ @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
+ opcode and attribute handle, when the Callback is not NULL.\r
+ @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
+ and attribute handle, when the Callback is NULL.\r
+ @retval EFI_NOT_READY A GATT operation is already underway for this device.\r
+ @retval EFI_UNSUPPORTED The attribute does not support notification.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION)(\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER *CallbackParameter,\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Get Bluetooth discovered service information.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
+ @param[out] ServiceInfoSize A pointer to the size, in bytes, of the ServiceInfo buffer.\r
+ @param[out] ServiceInfo A pointer to a callee allocated buffer that returns Bluetooth\r
+ discovered service information. Callee allocates this buffer by\r
+ using EFI Boot Service AllocatePool().\r
+\r
+ @retval EFI_SUCCESS The Bluetooth discovered service information is returned successfully.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth discovered\r
+ service information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO)(\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
+ OUT UINTN *ServiceInfoSize,\r
+ OUT VOID **ServiceInfo\r
+ );\r
+\r
+/**\r
+ Get Bluetooth device information.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
+ @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.\r
+ @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth\r
+ device information. Callee allocates this buffer by using EFI Boot\r
+ Service AllocatePool(). If this device is Bluetooth classic\r
+ device, EFI_BLUETOOTH_DEVICE_INFO should be used. If\r
+ this device is Bluetooth LE device, EFI_BLUETOOTH_LE_DEVICE_INFO\r
+ should be used.\r
+\r
+ @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device\r
+ information\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO)(\r
+ IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
+ OUT UINTN *DeviceInfoSize,\r
+ OUT VOID **DeviceInfo\r
+ );\r
+\r
+struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL {\r
+ EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST SendRequest;\r
+ EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION RegisterForServerNotification;\r
+ EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO GetServiceInfo;\r
+ EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO GetDeviceInfo;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiBluetoothAttributeProtocolGuid;\r
+extern EFI_GUID gEfiBluetoothAttributeServiceBindingProtocolGuid;\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ EFI Bluetooth LE Config Protocol as defined in UEFI 2.7.\r
+ This protocol abstracts user interface configuration for BluetoothLe device.\r
+\r
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are licensed and made available under\r
+ the terms and conditions of the BSD License that accompanies this distribution.\r
+ The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ @par Revision Reference:\r
+ This Protocol is introduced in UEFI Specification 2.7\r
+\r
+**/\r
+\r
+#ifndef __EFI_BLUETOOTH_LE_CONFIG_H__\r
+#define __EFI_BLUETOOTH_LE_CONFIG_H__\r
+\r
+#include <Protocol/BluetoothConfig.h>\r
+#include <Protocol/BluetoothAttribute.h>\r
+\r
+#define EFI_BLUETOOTH_LE_CONFIG_PROTOCOL_GUID \\r
+ { \\r
+ 0x8f76da58, 0x1f99, 0x4275, { 0xa4, 0xec, 0x47, 0x56, 0x51, 0x5b, 0x1c, 0xe8 } \\r
+ }\r
+\r
+typedef struct _EFI_BLUETOOTH_LE_CONFIG_PROTOCOL EFI_BLUETOOTH_LE_CONFIG_PROTOCOL;\r
+\r
+/**\r
+ Initialize BluetoothLE host controller and local device.\r
+\r
+ The Init() function initializes BluetoothLE host controller and local device.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The BluetoothLE host controller and local device is initialized successfully.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to initialize the BluetoothLE host controller\r
+ and local device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_INIT)(\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This\r
+ );\r
+\r
+typedef struct {\r
+ ///\r
+ /// The version of the structure. A value of zero represents the EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER\r
+ /// structure as defined here. Future version of this specification may extend this data structure in a\r
+ /// backward compatible way and increase the value of Version.\r
+ ///\r
+ UINT32 Version;\r
+ ///\r
+ /// Passive scanning or active scanning. See Bluetooth specification.\r
+ ///\r
+ UINT8 ScanType;\r
+ ///\r
+ /// Recommended scan interval to be used while performing scan.\r
+ ///\r
+ UINT16 ScanInterval;\r
+ ///\r
+ /// Recommended scan window to be used while performing a scan.\r
+ ///\r
+ UINT16 ScanWindow;\r
+ ///\r
+ /// Recommended scanning filter policy to be used while performing a scan.\r
+ ///\r
+ UINT8 ScanningFilterPolicy;\r
+ ///\r
+ /// This is one byte flag to serve as a filter to remove unneeded scan\r
+ /// result. For example, set BIT0 means scan in LE Limited Discoverable\r
+ /// Mode. Set BIT1 means scan in LE General Discoverable Mode.\r
+ ///\r
+ UINT8 AdvertisementFlagFilter;\r
+} EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER;\r
+\r
+typedef struct{\r
+ BLUETOOTH_LE_ADDRESS BDAddr;\r
+ BLUETOOTH_LE_ADDRESS DirectAddress;\r
+ UINT8 RemoteDeviceState;\r
+ INT8 RSSI;\r
+ UINTN AdvertisementDataSize;\r
+ VOID *AdvertisementData;\r
+} EFI_BLUETOOTH_LE_SCAN_CALLBACK_INFORMATION;\r
+\r
+/**\r
+ Callback function, it is called if a BluetoothLE device is found during scan process.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Context Context passed from scan request.\r
+ @param[in] CallbackInfo Data related to scan result. NULL CallbackInfo means scan complete.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SCAN_CALLBACK_FUNCTION) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN EFI_BLUETOOTH_LE_SCAN_CALLBACK_INFORMATION *CallbackInfo\r
+ );\r
+\r
+/**\r
+ Scan BluetoothLE device.\r
+\r
+ The Scan() function scans BluetoothLE device. When this function is returned, it just means scan\r
+ request is submitted. It does not mean scan process is started or finished. Whenever there is a\r
+ BluetoothLE device is found, the Callback function will be called. Callback function might be\r
+ called before this function returns or after this function returns\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] ReScan If TRUE, a new scan request is submitted no matter there is scan result before.\r
+ If FALSE and there is scan result, the previous scan result is returned and no scan request\r
+ is submitted.\r
+ @param[in] Timeout Duration in milliseconds for which to scan.\r
+ @param[in] ScanParameter If it is not NULL, the ScanParameter is used to perform a scan by the BluetoothLE bus driver.\r
+ If it is NULL, the default parameter is used.\r
+ @param[in] Callback The callback function. This function is called if a BluetoothLE device is found during\r
+ scan process.\r
+ @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The Bluetooth scan request is submitted.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to scan the BluetoothLE device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SCAN)(\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN BOOLEAN ReScan,\r
+ IN UINT32 Timeout,\r
+ IN EFI_BLUETOOTH_LE_CONFIG_SCAN_PARAMETER *ScanParameter, OPTIONAL\r
+ IN EFI_BLUETOOTH_LE_CONFIG_SCAN_CALLBACK_FUNCTION Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+typedef struct {\r
+ ///\r
+ /// The version of the structure. A value of zero represents the\r
+ /// EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER\r
+ /// structure as defined here. Future version of this specification may\r
+ /// extend this data structure in a backward compatible way and\r
+ /// increase the value of Version.\r
+ ///\r
+ UINT32 Version;\r
+ ///\r
+ /// Recommended scan interval to be used while performing scan before connect.\r
+ ///\r
+ UINT16 ScanInterval;\r
+ ///\r
+ /// Recommended scan window to be used while performing a connection\r
+ ///\r
+ UINT16 ScanWindow;\r
+ ///\r
+ /// Minimum allowed connection interval. Shall be less than or equal to ConnIntervalMax.\r
+ ///\r
+ UINT16 ConnIntervalMin;\r
+ ///\r
+ /// Maximum allowed connection interval. Shall be greater than or equal to ConnIntervalMin.\r
+ ///\r
+ UINT16 ConnIntervalMax;\r
+ ///\r
+ /// Slave latency for the connection in number of connection events.\r
+ ///\r
+ UINT16 ConnLatency;\r
+ ///\r
+ /// Link supervision timeout for the connection.\r
+ ///\r
+ UINT16 SupervisionTimeout;\r
+} EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER;\r
+\r
+/**\r
+ Connect a BluetoothLE device.\r
+\r
+ The Connect() function connects a Bluetooth device. When this function is returned successfully,\r
+ a new EFI_BLUETOOTH_IO_PROTOCOL is created.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] AutoReconnect If TRUE, the BluetoothLE host controller needs to do an auto\r
+ reconnect. If FALSE, the BluetoothLE host controller does not do\r
+ an auto reconnect.\r
+ @param[in] DoBonding If TRUE, the BluetoothLE host controller needs to do a bonding.\r
+ If FALSE, the BluetoothLE host controller does not do a bonding.\r
+ @param[in] ConnectParameter If it is not NULL, the ConnectParameter is used to perform a\r
+ scan by the BluetoothLE bus driver. If it is NULL, the default\r
+ parameter is used.\r
+ @param[in] BD_ADDR The address of the BluetoothLE device to be connected.\r
+\r
+ @retval EFI_SUCCESS The BluetoothLE device is connected successfully.\r
+ @retval EFI_ALREADY_STARTED The BluetoothLE device is already connected.\r
+ @retval EFI_NOT_FOUND The BluetoothLE device is not found.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to connect the BluetoothLE device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_CONNECT)(\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN BOOLEAN AutoReconnect,\r
+ IN BOOLEAN DoBonding,\r
+ IN EFI_BLUETOOTH_LE_CONFIG_CONNECT_PARAMETER *ConnectParameter, OPTIONAL\r
+ IN BLUETOOTH_LE_ADDRESS *BD_ADDR\r
+ );\r
+\r
+/**\r
+ Disconnect a BluetoothLE device.\r
+\r
+ The Disconnect() function disconnects a BluetoothLE device. When this function is returned\r
+ successfully, the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL associated with this device is\r
+ destroyed and all services associated are stopped.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] BD_ADDR The address of BluetoothLE device to be connected.\r
+ @param[in] Reason Bluetooth disconnect reason. See Bluetooth specification for detail.\r
+\r
+ @retval EFI_SUCCESS The BluetoothLE device is disconnected successfully.\r
+ @retval EFI_NOT_STARTED The BluetoothLE device is not connected.\r
+ @retval EFI_NOT_FOUND The BluetoothLE device is not found.\r
+ @retval EFI_DEVICE_ERROR A hardware error occurred trying to disconnect the BluetoothLE device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_DISCONNECT)(\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN BLUETOOTH_LE_ADDRESS *BD_ADDR,\r
+ IN UINT8 Reason\r
+ );\r
+\r
+/**\r
+ Get BluetoothLE configuration data.\r
+\r
+ The GetData() function returns BluetoothLE configuration data. For remote BluetoothLE device\r
+ configuration data, please use GetRemoteData() function with valid BD_ADDR.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] DataType Configuration data type.\r
+ @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.\r
+ On output, indicates the amount of data actually returned.\r
+ @param[in, out] Data A pointer to the buffer of data that will be returned.\r
+\r
+ @retval EFI_SUCCESS The BluetoothLE configuration data is returned successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - DataSize is NULL.\r
+ - *DataSize is 0.\r
+ - Data is NULL.\r
+ @retval EFI_UNSUPPORTED The DataType is unsupported.\r
+ @retval EFI_NOT_FOUND The DataType is not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_GET_DATA) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,\r
+ IN OUT UINTN *DataSize,\r
+ IN OUT VOID *Data OPTIONAL\r
+ );\r
+\r
+/**\r
+ Set BluetoothLE configuration data.\r
+\r
+ The SetData() function sets local BluetoothLE device configuration data. Not all DataType can be\r
+ set.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] DataType Configuration data type.\r
+ @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.\r
+ @param[in] Data A pointer to the buffer of data that will be set.\r
+\r
+ @retval EFI_SUCCESS The BluetoothLE configuration data is set successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - DataSize is 0.\r
+ - Data is NULL.\r
+ @retval EFI_UNSUPPORTED The DataType is unsupported.\r
+ @retval EFI_WRITE_PROTECTED Cannot set configuration data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_SET_DATA) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ );\r
+\r
+/**\r
+ Get remove BluetoothLE device configuration data.\r
+\r
+ The GetRemoteData() function returns remote BluetoothLE device configuration data.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] DataType Configuration data type.\r
+ @param[in] BDAddr Remote BluetoothLE device address.\r
+ @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified by Data.\r
+ On output, indicates the amount of data actually returned.\r
+ @param[in, out] Data A pointer to the buffer of data that will be returned.\r
+\r
+ @retval EFI_SUCCESS The remote BluetoothLE device configuration data is returned successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ - DataSize is NULL.\r
+ - *DataSize is 0.\r
+ - Data is NULL.\r
+ @retval EFI_UNSUPPORTED The DataType is unsupported.\r
+ @retval EFI_NOT_FOUND The DataType is not found.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_GET_REMOTE_DATA) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_CONFIG_DATA_TYPE DataType,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN OUT UINTN *DataSize,\r
+ IN OUT VOID *Data\r
+ );\r
+\r
+typedef enum {\r
+ ///\r
+ /// It indicates an authorization request. No data is associated with the callback\r
+ /// input. In the output data, the application should return the authorization value.\r
+ /// The data structure is BOOLEAN. TRUE means YES. FALSE means NO.\r
+ ///\r
+ EfiBluetoothSmpAuthorizationRequestEvent,\r
+ ///\r
+ /// It indicates that a passkey has been generated locally by the driver, and the same\r
+ /// passkey should be entered at the remote device. The callback input data is the\r
+ /// passkey of type UINT32, to be displayed by the application. No output data\r
+ /// should be returned.\r
+ ///\r
+ EfiBluetoothSmpPasskeyReadyEvent,\r
+ ///\r
+ /// It indicates that the driver is requesting for the passkey has been generated at\r
+ /// the remote device. No data is associated with the callback input. The output data\r
+ /// is the passkey of type UINT32, to be entered by the user.\r
+ ///\r
+ EfiBluetoothSmpPasskeyRequestEvent,\r
+ ///\r
+ /// It indicates that the driver is requesting for the passkey that has been pre-shared\r
+ /// out-of-band with the remote device. No data is associated with the callback\r
+ /// input. The output data is the stored OOB data of type UINT8[16].\r
+ ///\r
+ EfiBluetoothSmpOOBDataRequestEvent,\r
+ ///\r
+ /// In indicates that a number have been generated locally by the bus driver, and\r
+ /// also at the remote device, and the bus driver wants to know if the two numbers\r
+ /// match. The callback input data is the number of type UINT32. The output data\r
+ /// is confirmation value of type BOOLEAN. TRUE means comparison pass. FALSE\r
+ /// means comparison fail.\r
+ ///\r
+ EfiBluetoothSmpNumericComparisonEvent,\r
+} EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE;\r
+\r
+/**\r
+ The callback function for SMP.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Context Data passed into callback function. This is optional parameter\r
+ and may be NULL.\r
+ @param[in] BDAddr Remote BluetoothLE device address.\r
+ @param[in] EventDataType Event data type in EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE.\r
+ @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.\r
+ @param[in] Data A pointer to the buffer of data.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_SMP_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE EventDataType,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ );\r
+\r
+/**\r
+ Register Security Manager Protocol callback function for user authentication/authorization.\r
+\r
+ The RegisterSmpAuthCallback() function register Security Manager Protocol callback\r
+ function for user authentication/authorization.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Callback Callback function for user authentication/authorization.\r
+ @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The SMP callback function is registered successfully.\r
+ @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
+ opcode and attribute handle, when the Callback is not NULL.\r
+ @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
+ and attribute handle, when the Callback is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_REGISTER_SMP_AUTH_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_LE_SMP_CALLBACK Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ Send user authentication/authorization to remote device.\r
+\r
+ The SendSmpAuthData() function sends user authentication/authorization to remote device. It\r
+ should be used to send these information after the caller gets the request data from the callback\r
+ function by RegisterSmpAuthCallback().\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] BDAddr Remote BluetoothLE device address.\r
+ @param[in] EventDataType Event data type in EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE.\r
+ @param[in] DataSize The size of Data in bytes, of the data buffer specified by Data.\r
+ @param[in] Data A pointer to the buffer of data that will be sent. The data format\r
+ depends on the type of SMP event data being responded to.\r
+\r
+ @retval EFI_SUCCESS The SMP authorization data is sent successfully.\r
+ @retval EFI_NOT_READY SMP is not in the correct state to receive the auth data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_SEND_SMP_AUTH_DATA) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN EFI_BLUETOOTH_LE_SMP_EVENT_DATA_TYPE EventDataType,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ );\r
+\r
+typedef enum {\r
+ // For local device only\r
+ EfiBluetoothSmpLocalIR, /* If Key hierarchy is supported */\r
+ EfiBluetoothSmpLocalER, /* If Key hierarchy is supported */\r
+ EfiBluetoothSmpLocalDHK, /* If Key hierarchy is supported. OPTIONAL */\r
+ // For peer specific\r
+ EfiBluetoothSmpKeysDistributed = 0x1000,\r
+ EfiBluetoothSmpKeySize,\r
+ EfiBluetoothSmpKeyType,\r
+ EfiBluetoothSmpPeerLTK,\r
+ EfiBluetoothSmpPeerIRK,\r
+ EfiBluetoothSmpPeerCSRK,\r
+ EfiBluetoothSmpPeerRand,\r
+ EfiBluetoothSmpPeerEDIV,\r
+ EfiBluetoothSmpPeerSignCounter,\r
+ EfiBluetoothSmpLocalLTK, /* If Key hierarchy not supported */\r
+ EfiBluetoothSmpLocalIRK, /* If Key hierarchy not supported */\r
+ EfiBluetoothSmpLocalCSRK, /* If Key hierarchy not supported */\r
+ EfiBluetoothSmpLocalSignCounter,\r
+ EfiBluetoothSmpLocalDIV,\r
+} EFI_BLUETOOTH_LE_SMP_DATA_TYPE;\r
+\r
+/**\r
+ The callback function to get SMP data.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Context Data passed into callback function. This is optional parameter\r
+ and may be NULL.\r
+ @param[in] BDAddr Remote BluetoothLE device address. For Local device setting, it\r
+ should be NULL.\r
+ @param[in] DataType Data type in EFI_BLUETOOTH_LE_SMP_DATA_TYPE.\r
+ @param[in, out] DataSize On input, indicates the size, in bytes, of the data buffer specified\r
+ by Data. On output, indicates the amount of data actually returned.\r
+ @param[out] Data A pointer to the buffer of data that will be returned.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_BLUETOOTH_LE_CONFIG_SMP_GET_DATA_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN EFI_BLUETOOTH_LE_SMP_DATA_TYPE DataType,\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Data\r
+ );\r
+\r
+/**\r
+ Register a callback function to get SMP related data.\r
+\r
+ The RegisterSmpGetDataCallback() function registers a callback function to get SMP related data.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Callback Callback function for SMP get data.\r
+ @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The SMP get data callback function is registered successfully.\r
+ @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
+ opcode and attribute handle, when the Callback is not NULL.\r
+ @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
+ and attribute handle, when the Callback is NULL\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_GET_DATA_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_LE_CONFIG_SMP_GET_DATA_CALLBACK Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ The callback function to set SMP data.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Context Data passed into callback function. This is optional parameter\r
+ and may be NULL.\r
+ @param[in] BDAddr Remote BluetoothLE device address.\r
+ @param[in] DataType Data type in EFI_BLUETOOTH_LE_SMP_DATA_TYPE.\r
+ @param[in] DataSize Indicates the size, in bytes, of the data buffer specified by Data.\r
+ @param[in] Data A pointer to the buffer of data.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_BLUETOOTH_LE_CONFIG_SMP_SET_DATA_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN EFI_BLUETOOTH_LE_SMP_DATA_TYPE Type,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ );\r
+\r
+/**\r
+ Register a callback function to set SMP related data.\r
+\r
+ The RegisterSmpSetDataCallback() function registers a callback function to set SMP related data.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Callback Callback function for SMP set data.\r
+ @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The SMP set data callback function is registered successfully.\r
+ @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
+ opcode and attribute handle, when the Callback is not NULL.\r
+ @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
+ and attribute handle, when the Callback is NULL\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_SET_DATA_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_LE_CONFIG_SMP_SET_DATA_CALLBACK Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+/**\r
+ The callback function to hook connect complete event.\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Context Data passed into callback function. This is optional parameter\r
+ and may be NULL.\r
+ @param[in] CallbackType The value defined in EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE.\r
+ @param[in] BDAddr Remote BluetoothLE device address.\r
+ @param[in] InputBuffer A pointer to the buffer of data that is input from callback caller.\r
+ @param[in] InputBufferSize Indicates the size, in bytes, of the data buffer specified by InputBuffer.\r
+\r
+ @retval EFI_SUCCESS The callback function complete successfully.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_CONNECT_COMPLETE_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN VOID *Context,\r
+ IN EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE CallbackType,\r
+ IN BLUETOOTH_LE_ADDRESS *BDAddr,\r
+ IN VOID *InputBuffer,\r
+ IN UINTN InputBufferSize\r
+ );\r
+\r
+/**\r
+ Register link connect complete callback function.\r
+\r
+ The RegisterLinkConnectCompleteCallback() function registers Bluetooth link connect\r
+ complete callback function. The Bluetooth Configuration driver may call\r
+ RegisterLinkConnectCompleteCallback() to register a callback function. During pairing,\r
+ Bluetooth bus driver must trigger this callback function to report device state, if it is registered.\r
+ Then Bluetooth Configuration driver will get information on device connection, according to\r
+ CallbackType defined by EFI_BLUETOOTH_CONNECT_COMPLETE_CALLBACK_TYPE\r
+\r
+ @param[in] This Pointer to the EFI_BLUETOOTH_LE_CONFIG_PROTOCOL instance.\r
+ @param[in] Callback The callback function. NULL means unregister.\r
+ @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The link connect complete callback function is registered successfully.\r
+ @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
+ opcode and attribute handle, when the Callback is not NULL.\r
+ @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
+ and attribute handle, when the Callback is NULL\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLUETOOTH_LE_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK) (\r
+ IN EFI_BLUETOOTH_LE_CONFIG_PROTOCOL *This,\r
+ IN EFI_BLUETOOTH_LE_CONFIG_CONNECT_COMPLETE_CALLBACK Callback,\r
+ IN VOID *Context\r
+ );\r
+\r
+///\r
+/// This protocol abstracts user interface configuration for BluetoothLe device.\r
+///\r
+struct _EFI_BLUETOOTH_LE_CONFIG_PROTOCOL {\r
+ EFI_BLUETOOTH_LE_CONFIG_INIT Init;\r
+ EFI_BLUETOOTH_LE_CONFIG_SCAN Scan;\r
+ EFI_BLUETOOTH_LE_CONFIG_CONNECT Connect;\r
+ EFI_BLUETOOTH_LE_CONFIG_DISCONNECT Disconnect;\r
+ EFI_BLUETOOTH_LE_CONFIG_GET_DATA GetData;\r
+ EFI_BLUETOOTH_LE_CONFIG_SET_DATA SetData;\r
+ EFI_BLUETOOTH_LE_CONFIG_GET_REMOTE_DATA GetRemoteData;\r
+ EFI_BLUETOOTH_LE_REGISTER_SMP_AUTH_CALLBACK RegisterSmpAuthCallback;\r
+ EFI_BLUETOOTH_LE_SEND_SMP_AUTH_DATA SendSmpAuthData;\r
+ EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_GET_DATA_CALLBACK RegisterSmpGetDataCallback;\r
+ EFI_BLUETOOTH_LE_CONFIG_REGISTER_SMP_SET_DATA_CALLBACK RegisterSmpSetDataCallback;\r
+ EFI_BLUETOOTH_LE_CONFIG_REGISTER_CONNECT_COMPLETE_CALLBACK RegisterLinkConnectCompleteCallback;\r
+};\r
+\r
+extern EFI_GUID gEfiBluetoothLeConfigProtocolGuid;\r
+\r
+#endif\r
+\r