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 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 @par Revision Reference:
16 This Protocol is introduced in UEFI Specification 2.7
20 #ifndef __EFI_BLUETOOTH_ATTRIBUTE_H__
21 #define __EFI_BLUETOOTH_ATTRIBUTE_H__
23 #define EFI_BLUETOOTH_ATTRIBUTE_SERVICE_BINDING_PROTOCOL_GUID \
25 0x5639867a, 0x8c8e, 0x408d, { 0xac, 0x2f, 0x4b, 0x61, 0xbd, 0xc0, 0xbb, 0xbb } \
28 #define EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL_GUID \
30 0x898890e9, 0x84b2, 0x4f3a, { 0x8c, 0x58, 0xd8, 0x57, 0x78, 0x13, 0xe0, 0xac } \
33 typedef struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
;
50 #define UUID_16BIT_TYPE_LEN 2
51 #define UUID_32BIT_TYPE_LEN 4
52 #define UUID_128BIT_TYPE_LEN 16
54 #define BLUETOOTH_IS_ATTRIBUTE_OF_TYPE(a,t) ((a)->Type.Length == UUID_16BIT_TYPE_LEN && (a)->Type.Data.Uuid16 == (t))
57 // Bluetooth Attribute Permission
62 UINT16 ReadEncryption
: 1;
63 UINT16 ReadAuthentication
: 1;
64 UINT16 ReadAuthorization
: 1;
65 UINT16 ReadKeySize
: 5;
68 UINT16 WriteEncryption
: 1;
69 UINT16 WriteAuthentication
: 1;
70 UINT16 WriteAuthorization
: 1;
71 UINT16 WriteKeySize
: 5;
75 } EFI_BLUETOOTH_ATTRIBUTE_PERMISSION
;
78 EFI_BLUETOOTH_UUID Type
;
80 UINT16 AttributeHandle
;
81 EFI_BLUETOOTH_ATTRIBUTE_PERMISSION AttributePermission
;
82 } EFI_BLUETOOTH_ATTRIBUTE_HEADER
;
85 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
86 UINT16 EndGroupHandle
;
87 EFI_BLUETOOTH_UUID ServiceUuid
;
88 } EFI_BLUETOOTH_GATT_PRIMARY_SERVICE_INFO
;
91 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
92 UINT16 StartGroupHandle
;
93 UINT16 EndGroupHandle
;
94 EFI_BLUETOOTH_UUID ServiceUuid
;
95 } EFI_BLUETOOTH_GATT_INCLUDE_SERVICE_INFO
;
98 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
99 UINT8 CharacteristicProperties
;
100 UINT16 CharacteristicValueHandle
;
101 EFI_BLUETOOTH_UUID CharacteristicUuid
;
102 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_INFO
;
105 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header
;
106 EFI_BLUETOOTH_UUID CharacteristicDescriptorUuid
;
107 } EFI_BLUETOOTH_GATT_CHARACTERISTIC_DESCRIPTOR_INFO
;
112 UINT16 AttributeHandle
;
113 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION
;
116 UINT16 AttributeHandle
;
117 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION
;
121 UINT8 AttributeOpCode
;
123 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION Notification
;
124 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION Indication
;
126 } EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
;
130 BLUETOOTH_LE_ADDRESS BD_ADDR
;
131 BLUETOOTH_LE_ADDRESS DirectAddress
;
133 UINTN AdvertisementDataSize
;
134 VOID
*AdvertisementData
;
135 } EFI_BLUETOOTH_LE_DEVICE_INFO
;
138 The callback function to send request.
140 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
141 @param[in] Data Data received. The first byte is the attribute opcode, followed by opcode specific
142 fields. See Bluetooth specification, Vol 3, Part F, Attribute Protocol. It might be a
143 normal RESPONSE message, or ERROR RESPONSE messag
144 @param[in] DataLength The length of Data in bytes.
145 @param[in] Context The context passed from the callback registration request.
147 @retval EFI_SUCCESS The callback function complete successfully.
152 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION
) (
153 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
160 Send a "REQUEST" or "COMMAND" message to remote server and receive a "RESPONSE" message
161 for "REQUEST" from remote server according to Bluetooth attribute protocol data unit(PDU).
163 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
164 @param[in] Data Data of a REQUEST or COMMAND message. The first byte is the attribute PDU
165 related opcode, followed by opcode specific fields. See Bluetooth specification,
166 Vol 3, Part F, Attribute Protocol.
167 @param[in] DataLength The length of Data in bytes.
168 @param[in] Callback Callback function to notify the RESPONSE is received to the caller, with the
169 response buffer. Caller must check the response buffer content to know if the
170 request action is success or fail. It may be NULL if the data is a COMMAND.
171 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
173 @retval EFI_SUCCESS The request is sent successfully.
174 @retval EFI_INVALID_PARAMETER One or more parameters are invalid due to following conditions:
175 - The Buffer is NULL.
176 - The BufferLength is 0.
177 - The opcode in Buffer is not a valid OPCODE according to Bluetooth specification.
178 - The Callback is NULL.
179 @retval EFI_DEVICE_ERROR Sending the request failed due to the host controller or the device error.
180 @retval EFI_NOT_READY A GATT operation is already underway for this device.
181 @retval EFI_UNSUPPORTED The attribute does not support the corresponding operation.
186 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST
) (
187 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
190 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
195 Register or unregister a server initiated message, such as NOTIFICATION or INDICATION, on a
196 characteristic value on remote server.
198 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
199 @param[in] CallbackParameter The parameter of the callback.
200 @param[in] Callback Callback function for server initiated attribute protocol. NULL callback
201 function means unregister the server initiated callback.
202 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.
204 @retval EFI_SUCCESS The callback function is registered or unregistered successfully
205 @retval EFI_INVALID_PARAMETER The attribute opcode is not server initiated message opcode. See
206 Bluetooth specification, Vol 3, Part F, Attribute Protocol.
207 @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute
208 opcode and attribute handle, when the Callback is not NULL.
209 @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode
210 and attribute handle, when the Callback is NULL.
211 @retval EFI_NOT_READY A GATT operation is already underway for this device.
212 @retval EFI_UNSUPPORTED The attribute does not support notification.
217 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION
)(
218 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
219 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER
*CallbackParameter
,
220 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback
,
225 Get Bluetooth discovered service information.
227 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
228 @param[out] ServiceInfoSize A pointer to the size, in bytes, of the ServiceInfo buffer.
229 @param[out] ServiceInfo A pointer to a callee allocated buffer that returns Bluetooth
230 discovered service information. Callee allocates this buffer by
231 using EFI Boot Service AllocatePool().
233 @retval EFI_SUCCESS The Bluetooth discovered service information is returned successfully.
234 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth discovered
240 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO
)(
241 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
242 OUT UINTN
*ServiceInfoSize
,
243 OUT VOID
**ServiceInfo
247 Get Bluetooth device information.
249 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.
250 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.
251 @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth
252 device information. Callee allocates this buffer by using EFI Boot
253 Service AllocatePool(). If this device is Bluetooth classic
254 device, EFI_BLUETOOTH_DEVICE_INFO should be used. If
255 this device is Bluetooth LE device, EFI_BLUETOOTH_LE_DEVICE_INFO
258 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.
259 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device
265 (EFIAPI
*EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO
)(
266 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
*This
,
267 OUT UINTN
*DeviceInfoSize
,
268 OUT VOID
**DeviceInfo
271 struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL
{
272 EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST SendRequest
;
273 EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION RegisterForServerNotification
;
274 EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO GetServiceInfo
;
275 EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO GetDeviceInfo
;
279 extern EFI_GUID gEfiBluetoothAttributeProtocolGuid
;
280 extern EFI_GUID gEfiBluetoothAttributeServiceBindingProtocolGuid
;