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