]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/BluetoothIo.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / BluetoothIo.h
CommitLineData
362c355c
QS
1/** @file\r
2 EFI Bluetooth IO Service Binding Protocol as defined in UEFI 2.5.\r
3 EFI Bluetooth IO Protocol as defined in UEFI 2.5.\r
1e454766 4 The EFI Bluetooth IO Service Binding Protocol is used to locate EFI Bluetooth IO Protocol drivers to\r
362c355c
QS
5 create and destroy child of the driver to communicate with other Bluetooth device by using Bluetooth IO protocol.\r
6\r
1e454766
RN
7 Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials are licensed and made available under\r
9 the terms and conditions of the BSD License that accompanies this distribution.\r
362c355c 10 The full text of the license may be found at\r
1e454766
RN
11 http://opensource.org/licenses/bsd-license.php.\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
362c355c
QS
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
1e454766 16 @par Revision Reference:\r
362c355c
QS
17 This Protocol is introduced in UEFI Specification 2.5\r
18\r
19**/\r
20\r
21#ifndef __EFI_BLUETOOTH_IO_PROTOCOL_H__\r
22#define __EFI_BLUETOOTH_IO_PROTOCOL_H__\r
23\r
24#include <IndustryStandard/Bluetooth.h>\r
25\r
26#define EFI_BLUETOOTH_IO_SERVICE_BINDING_PROTOCOL_GUID \\r
27 { \\r
1e454766 28 0x388278d3, 0x7b85, 0x42f0, { 0xab, 0xa9, 0xfb, 0x4b, 0xfd, 0x69, 0xf5, 0xab } \\r
362c355c 29 }\r
1e454766 30\r
362c355c
QS
31#define EFI_BLUETOOTH_IO_PROTOCOL_GUID \\r
32 { \\r
1e454766 33 0x467313de, 0x4e30, 0x43f1, { 0x94, 0x3e, 0x32, 0x3f, 0x89, 0x84, 0x5d, 0xb5 } \\r
362c355c 34 }\r
1e454766 35\r
362c355c
QS
36typedef struct _EFI_BLUETOOTH_IO_PROTOCOL EFI_BLUETOOTH_IO_PROTOCOL;\r
37\r
38///\r
39/// EFI_BLUETOOTH_DEVICE_INFO\r
40///\r
41typedef struct {\r
42 ///\r
43 /// The version of the structure\r
44 ///\r
45 UINT32 Version;\r
46 ///\r
47 /// 48bit Bluetooth device address.\r
48 ///\r
49 BLUETOOTH_ADDRESS BD_ADDR;\r
50 ///\r
51 /// Bluetooth PageScanRepetitionMode. See Bluetooth specification for detail.\r
52 ///\r
53 UINT8 PageScanRepetitionMode;\r
54 ///\r
55 /// Bluetooth ClassOfDevice. See Bluetooth specification for detail.\r
56 ///\r
57 BLUETOOTH_CLASS_OF_DEVICE ClassOfDevice;\r
58 ///\r
59 /// Bluetooth CloseOffset. See Bluetooth specification for detail.\r
60 ///\r
61 UINT16 ClockOffset;\r
62 ///\r
63 /// Bluetooth RSSI. See Bluetooth specification for detail.\r
64 ///\r
65 UINT8 RSSI;\r
66 ///\r
67 /// Bluetooth ExtendedInquiryResponse. See Bluetooth specification for detail.\r
68 ///\r
69 UINT8 ExtendedInquiryResponse[240];\r
70} EFI_BLUETOOTH_DEVICE_INFO;\r
71\r
72/**\r
73 Get Bluetooth device information.\r
74\r
1e454766
RN
75 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
76 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.\r
77 @param[out] DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth device information.\r
362c355c 78\r
1e454766
RN
79 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
80 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device information.\r
362c355c
QS
81\r
82**/\r
1e454766 83typedef\r
362c355c
QS
84EFI_STATUS\r
85(EFIAPI *EFI_BLUETOOTH_IO_GET_DEVICE_INFO)(\r
1e454766
RN
86 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
87 OUT UINTN *DeviceInfoSize,\r
88 OUT VOID **DeviceInfo\r
362c355c 89 );\r
1e454766 90\r
362c355c
QS
91/**\r
92 Get Bluetooth SDP information.\r
93\r
1e454766
RN
94 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
95 @param[out] SdpInfoSize A pointer to the size, in bytes, of the SdpInfo buffer.\r
96 @param[out] SdpInfo A pointer to a callee allocated buffer that returns Bluetooth SDP information.\r
362c355c 97\r
1e454766
RN
98 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
99 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth SDP information.\r
362c355c
QS
100\r
101**/\r
1e454766 102typedef\r
362c355c
QS
103EFI_STATUS\r
104(EFIAPI *EFI_BLUETOOTH_IO_GET_SDP_INFO)(\r
1e454766
RN
105 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
106 OUT UINTN *SdpInfoSize,\r
107 OUT VOID **SdpInfo\r
362c355c 108 );\r
1e454766 109\r
362c355c
QS
110/**\r
111 Send L2CAP message (including L2CAP header).\r
112\r
1e454766
RN
113 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
114 @param[in, out] BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer.\r
115 On output, indicates the amount of data actually transferred.\r
116 @param[in] Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.\r
117 @param[in] Timeout Indicating the transfer should be completed within this time frame. The units are in\r
118 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed\r
119 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
362c355c
QS
120\r
121 @retval EFI_SUCCESS The L2CAP message is sent successfully.\r
122 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
123 - BufferSize is NULL.\r
124 - *BufferSize is 0.\r
125 - Buffer is NULL.\r
126 @retval EFI_TIMEOUT Sending L2CAP message fail due to timeout.\r
127 @retval EFI_DEVICE_ERROR Sending L2CAP message fail due to host controller or device error.\r
128\r
129**/\r
1e454766 130typedef\r
362c355c
QS
131EFI_STATUS\r
132(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_SEND)(\r
1e454766
RN
133 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
134 IN OUT UINTN *BufferSize,\r
135 IN VOID *Buffer,\r
136 IN UINTN Timeout\r
362c355c 137 );\r
1e454766 138\r
362c355c
QS
139/**\r
140 Receive L2CAP message (including L2CAP header).\r
141\r
1e454766
RN
142 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
143 @param[in] BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer.\r
144 On output, indicates the amount of data actually transferred.\r
145 @param[out] Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.\r
146 @param[in] Timeout Indicating the transfer should be completed within this time frame. The units are in\r
147 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed\r
148 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
362c355c
QS
149\r
150 @retval EFI_SUCCESS The L2CAP message is received successfully.\r
151 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
152 - BufferSize is NULL.\r
153 - *BufferSize is 0.\r
154 - Buffer is NULL.\r
155 @retval EFI_TIMEOUT Receiving L2CAP message fail due to timeout.\r
156 @retval EFI_DEVICE_ERROR Receiving L2CAP message fail due to host controller or device error.\r
157\r
158**/\r
1e454766 159typedef\r
362c355c
QS
160EFI_STATUS\r
161(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_RECEIVE)(\r
162 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
163 IN OUT UINTN *BufferSize,\r
164 OUT VOID *Buffer,\r
165 IN UINTN Timeout\r
166 );\r
1e454766 167\r
362c355c
QS
168/**\r
169 Callback function, it is called when asynchronous transfer is completed.\r
170\r
1e454766
RN
171 @param[in] ChannelID Bluetooth L2CAP message channel ID.\r
172 @param[in] Data Data received via asynchronous transfer.\r
173 @param[in] DataLength The length of Data in bytes, received via asynchronous transfer.\r
174 @param[in] Context Context passed from asynchronous transfer request.\r
362c355c 175\r
1e454766 176 @retval EFI_SUCCESS The callback function complete successfully.\r
362c355c
QS
177\r
178**/\r
179typedef\r
180EFI_STATUS\r
181(EFIAPI *EFI_BLUETOOTH_IO_ASYNC_FUNC_CALLBACK) (\r
182 IN UINT16 ChannelID,\r
183 IN VOID *Data,\r
184 IN UINTN DataLength,\r
185 IN VOID *Context\r
186 );\r
1e454766 187\r
362c355c
QS
188/**\r
189 Receive L2CAP message (including L2CAP header) in non-blocking way.\r
190\r
1e454766
RN
191 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
192 @param[in] IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the request is deleted.\r
193 @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be executed.\r
194 @param[in] DataLength Specifies the length, in bytes, of the data to be received.\r
195 @param[in] Callback The callback function. This function is called if the asynchronous transfer is\r
196 completed.\r
197 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
198\r
362c355c
QS
199 @retval EFI_SUCCESS The L2CAP asynchronous receive request is submitted successfully.\r
200 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
201 - DataLength is 0.\r
202 - If IsNewTransfer is TRUE, and an asynchronous receive request already exists.\r
203\r
204**/\r
1e454766 205typedef\r
362c355c
QS
206EFI_STATUS\r
207(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_ASYNC_RECEIVE)(\r
208 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
209 IN BOOLEAN IsNewTransfer,\r
210 IN UINTN PollingInterval,\r
211 IN UINTN DataLength,\r
212 IN EFI_BLUETOOTH_IO_ASYNC_FUNC_CALLBACK Callback,\r
213 IN VOID *Context\r
214 );\r
215\r
216/**\r
217 Send L2CAP message (excluding L2CAP header) to a specific channel.\r
218\r
1e454766
RN
219 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
220 @param[in] Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to send.\r
221 @param[in, out] BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer.\r
222 On output, indicates the amount of data actually transferred.\r
223 @param[in] Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.\r
224 @param[in] Timeout Indicating the transfer should be completed within this time frame. The units are in\r
225 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed\r
226 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
362c355c
QS
227\r
228 @retval EFI_SUCCESS The L2CAP message is sent successfully.\r
229 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
230 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
231 - BufferSize is NULL.\r
232 - *BufferSize is 0.\r
233 - Buffer is NULL.\r
234 @retval EFI_TIMEOUT Sending L2CAP message fail due to timeout.\r
235 @retval EFI_DEVICE_ERROR Sending L2CAP message fail due to host controller or device error.\r
236\r
237**/\r
1e454766 238typedef\r
362c355c
QS
239EFI_STATUS\r
240(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_SEND)(\r
1e454766
RN
241 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
242 IN EFI_HANDLE Handle,\r
243 IN OUT UINTN *BufferSize,\r
244 IN VOID *Buffer,\r
245 IN UINTN Timeout\r
362c355c 246 );\r
1e454766 247\r
362c355c
QS
248/**\r
249 Receive L2CAP message (excluding L2CAP header) from a specific channel.\r
250\r
1e454766
RN
251 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
252 @param[in] Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to receive.\r
253 @param[out] BufferSize Indicates the size, in bytes, of the data buffer specified by Buffer.\r
254 @param[out] Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.\r
255 @param[in] Timeout Indicating the transfer should be completed within this time frame. The units are in\r
256 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed\r
257 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
362c355c
QS
258\r
259 @retval EFI_SUCCESS The L2CAP message is received successfully.\r
260 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
261 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
262 - BufferSize is NULL.\r
263 - *BufferSize is 0.\r
264 - Buffer is NULL.\r
265 @retval EFI_TIMEOUT Receiving L2CAP message fail due to timeout.\r
266 @retval EFI_DEVICE_ERROR Receiving L2CAP message fail due to host controller or device error.\r
267\r
268**/\r
1e454766 269typedef\r
362c355c
QS
270EFI_STATUS\r
271(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RECEIVE)(\r
1e454766
RN
272 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
273 IN EFI_HANDLE Handle,\r
274 OUT UINTN *BufferSize,\r
275 OUT VOID **Buffer,\r
276 IN UINTN Timeout\r
362c355c 277 );\r
1e454766 278\r
362c355c
QS
279/**\r
280 Callback function, it is called when asynchronous transfer is completed.\r
281\r
1e454766
RN
282 @param[in] Data Data received via asynchronous transfer.\r
283 @param[in] DataLength The length of Data in bytes, received via asynchronous transfer.\r
284 @param[in] Context Context passed from asynchronous transfer request.\r
362c355c
QS
285\r
286 @retval EFI_SUCCESS The callback function complete successfully.\r
287\r
288**/\r
289typedef\r
290EFI_STATUS\r
291(EFIAPI *EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK) (\r
1e454766
RN
292 IN VOID *Data,\r
293 IN UINTN DataLength,\r
294 IN VOID *Context\r
362c355c 295 );\r
1e454766 296\r
362c355c
QS
297/**\r
298 Receive L2CAP message (excluding L2CAP header) in non-blocking way from a specific channel.\r
299\r
1e454766
RN
300 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
301 @param[in] Handel A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel\r
302 to receive.\r
303 @param[in] Callback The callback function. This function is called if the asynchronous transfer is\r
304 completed.\r
305 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
306\r
362c355c
QS
307 @retval EFI_SUCCESS The L2CAP asynchronous receive request is submitted successfully.\r
308 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
309 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
310 - DataLength is 0.\r
311 - If an asynchronous receive request already exists on same Handle.\r
312\r
313**/\r
1e454766 314typedef\r
362c355c
QS
315EFI_STATUS\r
316(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE)(\r
1e454766
RN
317 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
318 IN EFI_HANDLE Handle,\r
319 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
320 IN VOID* Context\r
362c355c 321 );\r
1e454766 322\r
362c355c
QS
323/**\r
324 Do L2CAP connection.\r
325\r
1e454766
RN
326 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
327 @param[out] Handel A handle to indicate this L2CAP connection.\r
328 @param[in] Psm Bluetooth PSM. See Bluetooth specification for detail.\r
329 @param[in] Mtu Bluetooth MTU. See Bluetooth specification for detail.\r
330 @param[in] Callback The callback function. This function is called whenever there is message received\r
331 in this channel.\r
332 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
333\r
362c355c
QS
334 @retval EFI_SUCCESS The Bluetooth L2CAP layer connection is created successfully.\r
335 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
336 - Handle is NULL.\r
337 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP connection.\r
338\r
339**/\r
1e454766 340typedef\r
362c355c
QS
341EFI_STATUS\r
342(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_CONNECT)(\r
343 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
344 OUT EFI_HANDLE *Handle,\r
345 IN UINT16 Psm,\r
346 IN UINT16 Mtu,\r
347 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
348 IN VOID *Context\r
349 );\r
1e454766 350\r
362c355c
QS
351/**\r
352 Do L2CAP disconnection.\r
353\r
1e454766
RN
354 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
355 @param[in] Handel A handle to indicate this L2CAP connection.\r
356\r
362c355c
QS
357 @retval EFI_SUCCESS The Bluetooth L2CAP layer is disconnected successfully.\r
358 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
359 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP disconnection.\r
360\r
361**/\r
1e454766 362typedef\r
362c355c
QS
363EFI_STATUS\r
364(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_DISCONNECT)(\r
365 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
366 IN EFI_HANDLE Handle\r
367 );\r
1e454766 368\r
362c355c
QS
369/**\r
370 Register L2CAP callback function for special channel.\r
371\r
1e454766
RN
372 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
373 @param[out] Handel A handle to indicate this L2CAP connection.\r
374 @param[in] Psm Bluetooth PSM. See Bluetooth specification for detail.\r
375 @param[in] Mtu Bluetooth MTU. See Bluetooth specification for detail.\r
376 @param[in] Callback The callback function. This function is called whenever there is message received\r
377 in this channel. NULL means unregister.\r
378 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.\r
379\r
362c355c
QS
380 @retval EFI_SUCCESS The Bluetooth L2CAP callback function is registered successfully.\r
381 @retval EFI_ALREADY_STARTED The callback function already exists when register.\r
382 @retval EFI_NOT_FOUND The callback function does not exist when unregister.\r
383\r
384**/\r
1e454766 385typedef\r
362c355c
QS
386EFI_STATUS\r
387(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE)(\r
388 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
389 OUT EFI_HANDLE *Handle,\r
390 IN UINT16 Psm,\r
391 IN UINT16 Mtu,\r
392 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
393 IN VOID *Context\r
394 );\r
1e454766 395\r
362c355c 396///\r
1e454766 397/// This protocol provides service for Bluetooth L2CAP (Logical Link Control and Adaptation Protocol)\r
362c355c
QS
398/// and SDP (Service Discovery Protocol).\r
399///\r
400struct _EFI_BLUETOOTH_IO_PROTOCOL {\r
401 EFI_BLUETOOTH_IO_GET_DEVICE_INFO GetDeviceInfo;\r
402 EFI_BLUETOOTH_IO_GET_SDP_INFO GetSdpInfo;\r
403 EFI_BLUETOOTH_IO_L2CAP_RAW_SEND L2CapRawSend;\r
404 EFI_BLUETOOTH_IO_L2CAP_RAW_RECEIVE L2CapRawReceive;\r
405 EFI_BLUETOOTH_IO_L2CAP_RAW_ASYNC_RECEIVE L2CapRawAsyncReceive;\r
406 EFI_BLUETOOTH_IO_L2CAP_SEND L2CapSend;\r
407 EFI_BLUETOOTH_IO_L2CAP_RECEIVE L2CapReceive;\r
408 EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE L2CapAsyncReceive;\r
409 EFI_BLUETOOTH_IO_L2CAP_CONNECT L2CapConnect;\r
410 EFI_BLUETOOTH_IO_L2CAP_DISCONNECT L2CapDisconnect;\r
411 EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE L2CapRegisterService;\r
412};\r
413\r
414extern EFI_GUID gEfiBluetoothIoServiceBindingProtocolGuid;\r
415extern EFI_GUID gEfiBluetoothIoProtocolGuid;\r
416\r
417#endif\r