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