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
;
43 #define UUID_16BIT_TYPE_LEN 2
44 #define UUID_32BIT_TYPE_LEN 4
45 #define UUID_128BIT_TYPE_LEN 16
47 #define BLUETOOTH_IS_ATTRIBUTE_OF_TYPE(a, t) ((a)->Type.Length == UUID_16BIT_TYPE_LEN && (a)->Type.Data.Uuid16 == (t))
50 // Bluetooth Attribute Permission
55 UINT16 ReadEncryption
: 1;
56 UINT16 ReadAuthentication
: 1;
57 UINT16 ReadAuthorization
: 1;
58 UINT16 ReadKeySize
: 5;
61 UINT16 WriteEncryption
: 1;
62 UINT16 WriteAuthentication
: 1;
63 UINT16 WriteAuthorization
: 1;
64 UINT16 WriteKeySize
: 5;
68 } EFI_BLUETOOTH_ATTRIBUTE_PERMISSION
;
71 EFI_BLUETOOTH_UUID Type
;
73 UINT16 AttributeHandle
;
74 EFI_BLUETOOTH_ATTRIBUTE_PERMISSION AttributePermission
;
75 } EFI_BLUETOOTH_ATTRIBUTE_HEADER
;
78 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
79 UINT16 EndGroupHandle
;
80 EFI_BLUETOOTH_UUID ServiceUuid
;
81 } EFI_BLUETOOTH_GATT_PRIMARY_SERVICE_INFO
;
84 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
85 UINT16 StartGroupHandle
;
86 UINT16 EndGroupHandle
;
87 EFI_BLUETOOTH_UUID ServiceUuid
;
88 } EFI_BLUETOOTH_GATT_INCLUDE_SERVICE_INFO
;
91 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
92 UINT8 CharacteristicProperties
;
93 UINT16 CharacteristicValueHandle
;
94 EFI_BLUETOOTH_UUID CharacteristicUuid
;
95 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_INFO
;
98 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
99 EFI_BLUETOOTH_UUID CharacteristicDescriptorUuid
;
100 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_DESCRIPTOR_INFO
;
105 UINT16 AttributeHandle
;
106 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION
;
109 UINT16 AttributeHandle
;
110 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION
;
114 UINT8 AttributeOpCode
;
116 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION Notification
;
117 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION Indication
;
119 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
;
123 BLUETOOTH_LE_ADDRESS BD_ADDR
;
124 BLUETOOTH_LE_ADDRESS DirectAddress
;
126 UINTN AdvertisementDataSize
;
127 VOID
*AdvertisementData
;
128 } EFI_BLUETOOTH_LE_DEVICE_INFO
;
131 The callback function to send request.
133 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
134 @param[in] Data Data received. The first byte is the attribute opcode, followed by opcode specific
135 fields. See Bluetooth specification, Vol 3, Part F, Attribute Protocol. It might be a
136 normal RESPONSE message, or ERROR RESPONSE messag
137 @param[in] DataLength The length of Data in bytes.
138 @param[in] Context The context passed from the callback registration request.
140 @retval EFI_SUCCESS The callback function complete successfully.
145 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION
)(
146 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
153 Send a "REQUEST" or "COMMAND" message to remote server and receive a "RESPONSE" message
154 for "REQUEST" from remote server according to Bluetooth attribute protocol data unit(PDU).
156 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
157 @param[in] Data Data of a REQUEST or COMMAND message. The first byte is the attribute PDU
158 related opcode, followed by opcode specific fields. See Bluetooth specification,
159 Vol 3, Part F, Attribute Protocol.
160 @param[in] DataLength The length of Data in bytes.
161 @param[in] Callback Callback function to notify the RESPONSE is received to the caller, with the
162 response buffer. Caller must check the response buffer content to know if the
163 request action is success or fail. It may be NULL if the data is a COMMAND.
164 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
166 @retval EFI_SUCCESS The request is sent successfully.
167 @retval EFI_INVALID_PARAMETER One or more parameters are invalid due to following conditions:
168 - The Buffer is NULL.
169 - The BufferLength is 0.
170 - The opcode in Buffer is not a valid OPCODE according to Bluetooth specification.
171 - The Callback is NULL.
172 @retval EFI_DEVICE_ERROR Sending the request failed due to the host controller or the device error.
173 @retval EFI_NOT_READY A GATT operation is already underway for this device.
174 @retval EFI_UNSUPPORTED The attribute does not support the corresponding operation.
179 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST
)(
180 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
183 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
188 Register or unregister a server initiated message, such as NOTIFICATION or INDICATION, on a
189 characteristic value on remote server.
191 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
192 @param[in] CallbackParameter The parameter of the callback.
193 @param[in] Callback Callback function for server initiated attribute protocol. NULL callback
194 function means unregister the server initiated callback.
195 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
197 @retval EFI_SUCCESS The callback function is registered or unregistered successfully
198 @retval EFI_INVALID_PARAMETER The attribute opcode is not server initiated message opcode. See
199 Bluetooth specification, Vol 3, Part F, Attribute Protocol.
200 @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
201 opcode and attribute handle, when the Callback is not NULL.
202 @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
203 and attribute handle, when the Callback is NULL.
204 @retval EFI_NOT_READY A GATT operation is already underway for this device.
205 @retval EFI_UNSUPPORTED The attribute does not support notification.
210 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION
)(
211 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
212 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
*CallbackParameter
,
213 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
218 Get Bluetooth discovered service information.
220 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
221 @param[out] ServiceInfoSize A pointer to the size, in bytes, of the ServiceInfo buffer.
222 @param[out] ServiceInfo A pointer to a callee allocated buffer that returns Bluetooth
223 discovered service information. Callee allocates this buffer by
224 using EFI Boot Service AllocatePool().
226 @retval EFI_SUCCESS The Bluetooth discovered service information is returned successfully.
227 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth discovered
233 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO
)(
234 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
235 OUT UINTN
*ServiceInfoSize
,
236 OUT VOID
**ServiceInfo
240 Get Bluetooth device information.
242 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
243 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.
244 @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth
245 device information. Callee allocates this buffer by using EFI Boot
246 Service AllocatePool(). If this device is Bluetooth classic
247 device, EFI_BLUETOOTH_DEVICE_INFO should be used. If
248 this device is Bluetooth LE device, EFI_BLUETOOTH_LE_DEVICE_INFO
251 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.
252 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device
258 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO
)(
259 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
260 OUT UINTN
*DeviceInfoSize
,
261 OUT VOID
**DeviceInfo
264 struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
{
265 EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST SendRequest
;
266 EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION RegisterForServerNotification
;
267 EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO GetServiceInfo
;
268 EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO GetDeviceInfo
;
271 extern EFI_GUID gEfiBluetoothAttributeProtocolGuid
;
272 extern EFI_GUID gEfiBluetoothAttributeServiceBindingProtocolGuid
;