2 EFI Bluetooth Attribute Protocol as defined in UEFI 2.7.
3 This protocol provides service for Bluetooth ATT (Attribute Protocol) and GATT (Generic
4 Attribute Profile) based protocol interfaces.
6 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
9 @par Revision Reference:
10 This Protocol is introduced in UEFI Specification 2.7
14 #ifndef __EFI_BLUETOOTH_ATTRIBUTE_H__
15 #define __EFI_BLUETOOTH_ATTRIBUTE_H__
17 #define EFI_BLUETOOTH_ATTRIBUTE_SERVICE_BINDING_PROTOCOL_GUID \
19 0x5639867a, 0x8c8e, 0x408d, { 0xac, 0x2f, 0x4b, 0x61, 0xbd, 0xc0, 0xbb, 0xbb } \
22 #define EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL_GUID \
24 0x898890e9, 0x84b2, 0x4f3a, { 0x8c, 0x58, 0xd8, 0x57, 0x78, 0x13, 0xe0, 0xac } \
27 typedef struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
;
44 #define UUID_16BIT_TYPE_LEN 2
45 #define UUID_32BIT_TYPE_LEN 4
46 #define UUID_128BIT_TYPE_LEN 16
48 #define BLUETOOTH_IS_ATTRIBUTE_OF_TYPE(a,t) ((a)->Type.Length == UUID_16BIT_TYPE_LEN && (a)->Type.Data.Uuid16 == (t))
51 // Bluetooth Attribute Permission
56 UINT16 ReadEncryption
: 1;
57 UINT16 ReadAuthentication
: 1;
58 UINT16 ReadAuthorization
: 1;
59 UINT16 ReadKeySize
: 5;
62 UINT16 WriteEncryption
: 1;
63 UINT16 WriteAuthentication
: 1;
64 UINT16 WriteAuthorization
: 1;
65 UINT16 WriteKeySize
: 5;
69 } EFI_BLUETOOTH_ATTRIBUTE_PERMISSION
;
72 EFI_BLUETOOTH_UUID Type
;
74 UINT16 AttributeHandle
;
75 EFI_BLUETOOTH_ATTRIBUTE_PERMISSION AttributePermission
;
76 } EFI_BLUETOOTH_ATTRIBUTE_HEADER
;
79 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
80 UINT16 EndGroupHandle
;
81 EFI_BLUETOOTH_UUID ServiceUuid
;
82 } EFI_BLUETOOTH_GATT_PRIMARY_SERVICE_INFO
;
85 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
86 UINT16 StartGroupHandle
;
87 UINT16 EndGroupHandle
;
88 EFI_BLUETOOTH_UUID ServiceUuid
;
89 } EFI_BLUETOOTH_GATT_INCLUDE_SERVICE_INFO
;
92 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
93 UINT8 CharacteristicProperties
;
94 UINT16 CharacteristicValueHandle
;
95 EFI_BLUETOOTH_UUID CharacteristicUuid
;
96 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_INFO
;
99 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
100 EFI_BLUETOOTH_UUID CharacteristicDescriptorUuid
;
101 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_DESCRIPTOR_INFO
;
106 UINT16 AttributeHandle
;
107 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION
;
110 UINT16 AttributeHandle
;
111 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION
;
115 UINT8 AttributeOpCode
;
117 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION Notification
;
118 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION Indication
;
120 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
;
124 BLUETOOTH_LE_ADDRESS BD_ADDR
;
125 BLUETOOTH_LE_ADDRESS DirectAddress
;
127 UINTN AdvertisementDataSize
;
128 VOID
*AdvertisementData
;
129 } EFI_BLUETOOTH_LE_DEVICE_INFO
;
132 The callback function to send request.
134 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
135 @param[in] Data Data received. The first byte is the attribute opcode, followed by opcode specific
136 fields. See Bluetooth specification, Vol 3, Part F, Attribute Protocol. It might be a
137 normal RESPONSE message, or ERROR RESPONSE messag
138 @param[in] DataLength The length of Data in bytes.
139 @param[in] Context The context passed from the callback registration request.
141 @retval EFI_SUCCESS The callback function complete successfully.
146 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION
) (
147 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
154 Send a "REQUEST" or "COMMAND" message to remote server and receive a "RESPONSE" message
155 for "REQUEST" from remote server according to Bluetooth attribute protocol data unit(PDU).
157 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
158 @param[in] Data Data of a REQUEST or COMMAND message. The first byte is the attribute PDU
159 related opcode, followed by opcode specific fields. See Bluetooth specification,
160 Vol 3, Part F, Attribute Protocol.
161 @param[in] DataLength The length of Data in bytes.
162 @param[in] Callback Callback function to notify the RESPONSE is received to the caller, with the
163 response buffer. Caller must check the response buffer content to know if the
164 request action is success or fail. It may be NULL if the data is a COMMAND.
165 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
167 @retval EFI_SUCCESS The request is sent successfully.
168 @retval EFI_INVALID_PARAMETER One or more parameters are invalid due to following conditions:
169 - The Buffer is NULL.
170 - The BufferLength is 0.
171 - The opcode in Buffer is not a valid OPCODE according to Bluetooth specification.
172 - The Callback is NULL.
173 @retval EFI_DEVICE_ERROR Sending the request failed due to the host controller or the device error.
174 @retval EFI_NOT_READY A GATT operation is already underway for this device.
175 @retval EFI_UNSUPPORTED The attribute does not support the corresponding operation.
180 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST
) (
181 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
184 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
189 Register or unregister a server initiated message, such as NOTIFICATION or INDICATION, on a
190 characteristic value on remote server.
192 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
193 @param[in] CallbackParameter The parameter of the callback.
194 @param[in] Callback Callback function for server initiated attribute protocol. NULL callback
195 function means unregister the server initiated callback.
196 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
198 @retval EFI_SUCCESS The callback function is registered or unregistered successfully
199 @retval EFI_INVALID_PARAMETER The attribute opcode is not server initiated message opcode. See
200 Bluetooth specification, Vol 3, Part F, Attribute Protocol.
201 @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
202 opcode and attribute handle, when the Callback is not NULL.
203 @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
204 and attribute handle, when the Callback is NULL.
205 @retval EFI_NOT_READY A GATT operation is already underway for this device.
206 @retval EFI_UNSUPPORTED The attribute does not support notification.
211 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION
)(
212 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
213 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
*CallbackParameter
,
214 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
219 Get Bluetooth discovered service information.
221 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
222 @param[out] ServiceInfoSize A pointer to the size, in bytes, of the ServiceInfo buffer.
223 @param[out] ServiceInfo A pointer to a callee allocated buffer that returns Bluetooth
224 discovered service information. Callee allocates this buffer by
225 using EFI Boot Service AllocatePool().
227 @retval EFI_SUCCESS The Bluetooth discovered service information is returned successfully.
228 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth discovered
234 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO
)(
235 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
236 OUT UINTN
*ServiceInfoSize
,
237 OUT VOID
**ServiceInfo
241 Get Bluetooth device information.
243 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
244 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.
245 @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth
246 device information. Callee allocates this buffer by using EFI Boot
247 Service AllocatePool(). If this device is Bluetooth classic
248 device, EFI_BLUETOOTH_DEVICE_INFO should be used. If
249 this device is Bluetooth LE device, EFI_BLUETOOTH_LE_DEVICE_INFO
252 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.
253 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device
259 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO
)(
260 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
261 OUT UINTN
*DeviceInfoSize
,
262 OUT VOID
**DeviceInfo
265 struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
{
266 EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST SendRequest
;
267 EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION RegisterForServerNotification
;
268 EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO GetServiceInfo
;
269 EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO GetDeviceInfo
;
273 extern EFI_GUID gEfiBluetoothAttributeProtocolGuid
;
274 extern EFI_GUID gEfiBluetoothAttributeServiceBindingProtocolGuid
;