]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/BluetoothAttribute.h
MdePkg/Library/Smm: Fix various typos
[mirror_edk2.git] / MdePkg / Include / Protocol / BluetoothAttribute.h
CommitLineData
9c94cc2c
RN
1/** @file\r
2 EFI Bluetooth Attribute Protocol as defined in UEFI 2.7.\r
3 This protocol provides service for Bluetooth ATT (Attribute Protocol) and GATT (Generic\r
4 Attribute Profile) based protocol interfaces.\r
5\r
6 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
9344f092 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9c94cc2c
RN
8\r
9 @par Revision Reference:\r
10 This Protocol is introduced in UEFI Specification 2.7\r
11\r
12**/\r
13\r
14#ifndef __EFI_BLUETOOTH_ATTRIBUTE_H__\r
15#define __EFI_BLUETOOTH_ATTRIBUTE_H__\r
16\r
17#define EFI_BLUETOOTH_ATTRIBUTE_SERVICE_BINDING_PROTOCOL_GUID \\r
18 { \\r
19 0x5639867a, 0x8c8e, 0x408d, { 0xac, 0x2f, 0x4b, 0x61, 0xbd, 0xc0, 0xbb, 0xbb } \\r
20 }\r
21\r
22#define EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL_GUID \\r
23 { \\r
24 0x898890e9, 0x84b2, 0x4f3a, { 0x8c, 0x58, 0xd8, 0x57, 0x78, 0x13, 0xe0, 0xac } \\r
25 }\r
26\r
27typedef struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL;\r
28\r
29#pragma pack(1)\r
30\r
31//\r
32// Bluetooth UUID\r
33//\r
34typedef struct {\r
35 UINT8 Length;\r
36 union {\r
37 UINT16 Uuid16;\r
38 UINT32 Uuid32;\r
39 UINT8 Uuid128[16];\r
40 } Data;\r
41} EFI_BLUETOOTH_UUID;\r
42\r
43\r
44#define UUID_16BIT_TYPE_LEN 2\r
45#define UUID_32BIT_TYPE_LEN 4\r
46#define UUID_128BIT_TYPE_LEN 16\r
47\r
48#define BLUETOOTH_IS_ATTRIBUTE_OF_TYPE(a,t) ((a)->Type.Length == UUID_16BIT_TYPE_LEN && (a)->Type.Data.Uuid16 == (t))\r
49\r
50//\r
51// Bluetooth Attribute Permission\r
52//\r
53typedef union {\r
54 struct {\r
55 UINT16 Readable : 1;\r
56 UINT16 ReadEncryption : 1;\r
57 UINT16 ReadAuthentication : 1;\r
58 UINT16 ReadAuthorization : 1;\r
59 UINT16 ReadKeySize : 5;\r
60 UINT16 Reserved1 : 7;\r
61 UINT16 Writeable : 1;\r
62 UINT16 WriteEncryption : 1;\r
63 UINT16 WriteAuthentication : 1;\r
64 UINT16 WriteAuthorization : 1;\r
65 UINT16 WriteKeySize : 5;\r
66 UINT16 Reserved2 : 7;\r
67 } Permission;\r
68 UINT32 Data32;\r
69} EFI_BLUETOOTH_ATTRIBUTE_PERMISSION;\r
70\r
71typedef struct {\r
72 EFI_BLUETOOTH_UUID Type;\r
73 UINT16 Length;\r
74 UINT16 AttributeHandle;\r
75 EFI_BLUETOOTH_ATTRIBUTE_PERMISSION AttributePermission;\r
76} EFI_BLUETOOTH_ATTRIBUTE_HEADER;\r
77\r
78typedef struct {\r
79 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
80 UINT16 EndGroupHandle;\r
81 EFI_BLUETOOTH_UUID ServiceUuid;\r
82} EFI_BLUETOOTH_GATT_PRIMARY_SERVICE_INFO;\r
83\r
84typedef struct {\r
85 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
86 UINT16 StartGroupHandle;\r
87 UINT16 EndGroupHandle;\r
88 EFI_BLUETOOTH_UUID ServiceUuid;\r
89} EFI_BLUETOOTH_GATT_INCLUDE_SERVICE_INFO;\r
90\r
91typedef struct {\r
92 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
93 UINT8 CharacteristicProperties;\r
94 UINT16 CharacteristicValueHandle;\r
95 EFI_BLUETOOTH_UUID CharacteristicUuid;\r
96} EFI_BLUETOOTH_GATT_CHARACTERISTIC_INFO;\r
97\r
98typedef struct {\r
99 EFI_BLUETOOTH_ATTRIBUTE_HEADER Header;\r
100 EFI_BLUETOOTH_UUID CharacteristicDescriptorUuid;\r
101} EFI_BLUETOOTH_GATT_CHARACTERISTIC_DESCRIPTOR_INFO;\r
102\r
103#pragma pack()\r
104\r
105typedef struct {\r
106 UINT16 AttributeHandle;\r
107} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION;\r
108\r
109typedef struct {\r
110 UINT16 AttributeHandle;\r
111} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION;\r
112\r
113typedef struct {\r
114 UINT32 Version;\r
115 UINT8 AttributeOpCode;\r
116 union {\r
117 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_NOTIFICATION Notification;\r
118 EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER_INDICATION Indication;\r
119 } Parameter;\r
120} EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER;\r
121\r
122typedef struct {\r
123 UINT32 Version;\r
124 BLUETOOTH_LE_ADDRESS BD_ADDR;\r
125 BLUETOOTH_LE_ADDRESS DirectAddress;\r
126 UINT8 RSSI;\r
127 UINTN AdvertisementDataSize;\r
128 VOID *AdvertisementData;\r
129} EFI_BLUETOOTH_LE_DEVICE_INFO;\r
130\r
131/**\r
132 The callback function to send request.\r
133\r
134 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
135 @param[in] Data Data received. The first byte is the attribute opcode, followed by opcode specific\r
136 fields. See Bluetooth specification, Vol 3, Part F, Attribute Protocol. It might be a\r
137 normal RESPONSE message, or ERROR RESPONSE messag\r
138 @param[in] DataLength The length of Data in bytes.\r
139 @param[in] Context The context passed from the callback registration request.\r
140\r
141 @retval EFI_SUCCESS The callback function complete successfully.\r
142\r
143**/\r
144typedef\r
145EFI_STATUS\r
146(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION) (\r
147 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
148 IN VOID *Data,\r
149 IN UINTN DataLength,\r
150 IN VOID *Context\r
151 );\r
152\r
153/**\r
154 Send a "REQUEST" or "COMMAND" message to remote server and receive a "RESPONSE" message\r
155 for "REQUEST" from remote server according to Bluetooth attribute protocol data unit(PDU).\r
156\r
157 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
158 @param[in] Data Data of a REQUEST or COMMAND message. The first byte is the attribute PDU\r
159 related opcode, followed by opcode specific fields. See Bluetooth specification,\r
160 Vol 3, Part F, Attribute Protocol.\r
161 @param[in] DataLength The length of Data in bytes.\r
162 @param[in] Callback Callback function to notify the RESPONSE is received to the caller, with the\r
163 response buffer. Caller must check the response buffer content to know if the\r
164 request action is success or fail. It may be NULL if the data is a COMMAND.\r
165 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.\r
166\r
167 @retval EFI_SUCCESS The request is sent successfully.\r
168 @retval EFI_INVALID_PARAMETER One or more parameters are invalid due to following conditions:\r
169 - The Buffer is NULL.\r
170 - The BufferLength is 0.\r
171 - The opcode in Buffer is not a valid OPCODE according to Bluetooth specification.\r
172 - The Callback is NULL.\r
173 @retval EFI_DEVICE_ERROR Sending the request failed due to the host controller or the device error.\r
174 @retval EFI_NOT_READY A GATT operation is already underway for this device.\r
175 @retval EFI_UNSUPPORTED The attribute does not support the corresponding operation.\r
176\r
177**/\r
178typedef\r
179EFI_STATUS\r
180(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST) (\r
181 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
182 IN VOID *Data,\r
183 IN UINTN DataLength,\r
184 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback,\r
185 IN VOID *Context\r
186 );\r
187\r
188/**\r
189 Register or unregister a server initiated message, such as NOTIFICATION or INDICATION, on a\r
190 characteristic value on remote server.\r
191\r
192 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
193 @param[in] CallbackParameter The parameter of the callback.\r
194 @param[in] Callback Callback function for server initiated attribute protocol. NULL callback\r
195 function means unregister the server initiated callback.\r
196 @param[in] Context Data passed into Callback function. It is optional parameter and may be NULL.\r
197\r
198 @retval EFI_SUCCESS The callback function is registered or unregistered successfully\r
199 @retval EFI_INVALID_PARAMETER The attribute opcode is not server initiated message opcode. See\r
200 Bluetooth specification, Vol 3, Part F, Attribute Protocol.\r
201 @retval EFI_ALREADY_STARTED A callback function is already registered on the same attribute\r
202 opcode and attribute handle, when the Callback is not NULL.\r
203 @retval EFI_NOT_STARTED A callback function is not registered on the same attribute opcode\r
204 and attribute handle, when the Callback is NULL.\r
205 @retval EFI_NOT_READY A GATT operation is already underway for this device.\r
206 @retval EFI_UNSUPPORTED The attribute does not support notification.\r
207\r
208**/\r
209typedef\r
210EFI_STATUS\r
211(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION)(\r
212 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
213 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_PARAMETER *CallbackParameter,\r
214 IN EFI_BLUETOOTH_ATTRIBUTE_CALLBACK_FUNCTION Callback,\r
215 IN VOID *Context\r
216 );\r
217\r
218/**\r
219 Get Bluetooth discovered service information.\r
220\r
221 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
222 @param[out] ServiceInfoSize A pointer to the size, in bytes, of the ServiceInfo buffer.\r
223 @param[out] ServiceInfo A pointer to a callee allocated buffer that returns Bluetooth\r
224 discovered service information. Callee allocates this buffer by\r
225 using EFI Boot Service AllocatePool().\r
226\r
227 @retval EFI_SUCCESS The Bluetooth discovered service information is returned successfully.\r
228 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth discovered\r
229 service information.\r
230\r
231**/\r
232typedef\r
233EFI_STATUS\r
234(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO)(\r
235 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
236 OUT UINTN *ServiceInfoSize,\r
237 OUT VOID **ServiceInfo\r
238 );\r
239\r
240/**\r
241 Get Bluetooth device information.\r
242\r
243 @param[in] This Pointer to the EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL instance.\r
244 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.\r
245 @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth\r
246 device information. Callee allocates this buffer by using EFI Boot\r
247 Service AllocatePool(). If this device is Bluetooth classic\r
248 device, EFI_BLUETOOTH_DEVICE_INFO should be used. If\r
249 this device is Bluetooth LE device, EFI_BLUETOOTH_LE_DEVICE_INFO\r
250 should be used.\r
251\r
252 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
253 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device\r
254 information\r
255\r
256**/\r
257typedef\r
258EFI_STATUS\r
259(EFIAPI *EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO)(\r
260 IN EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL *This,\r
261 OUT UINTN *DeviceInfoSize,\r
262 OUT VOID **DeviceInfo\r
263 );\r
264\r
265struct _EFI_BLUETOOTH_ATTRIBUTE_PROTOCOL {\r
266 EFI_BLUETOOTH_ATTRIBUTE_SEND_REQUEST SendRequest;\r
267 EFI_BLUETOOTH_ATTRIBUTE_REGISTER_FOR_SERVER_NOTIFICATION RegisterForServerNotification;\r
268 EFI_BLUETOOTH_ATTRIBUTE_GET_SERVICE_INFO GetServiceInfo;\r
269 EFI_BLUETOOTH_ATTRIBUTE_GET_DEVICE_INFO GetDeviceInfo;\r
270};\r
271\r
272\r
273extern EFI_GUID gEfiBluetoothAttributeProtocolGuid;\r
274extern EFI_GUID gEfiBluetoothAttributeServiceBindingProtocolGuid;\r
275\r
276#endif\r
277\r