]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/BluetoothIo.h
MdePkg/BluetoothIo: Formalize function header comments.
[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 - 2017, 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
76 @param[out] DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.
77 @param[out] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
95 @param[out] SdpInfoSize A pointer to the size, in bytes, of the SdpInfo buffer.
96 @param[out] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
114 @param[in, out] 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[in] Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.
117 @param[in] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
143 @param[in] 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[out] Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.
146 @param[in] 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[in] ChannelID Bluetooth L2CAP message channel ID.
172 @param[in] Data Data received via asynchronous transfer.
173 @param[in] DataLength The length of Data in bytes, received via asynchronous transfer.
174 @param[in] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
192 @param[in] IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the request is deleted.
193 @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be executed.
194 @param[in] DataLength Specifies the length, in bytes, of the data to be received.
195 @param[in] Callback The callback function. This function is called if the asynchronous transfer is
196 completed.
197 @param[in] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
220 @param[in] Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to send.
221 @param[in, out] 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[in] Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.
224 @param[in] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
252 @param[in] Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to receive.
253 @param[out] BufferSize Indicates the size, in bytes, of the data buffer specified by Buffer.
254 @param[out] Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.
255 @param[in] 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[in] Data Data received via asynchronous transfer.
283 @param[in] DataLength The length of Data in bytes, received via asynchronous transfer.
284 @param[in] 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[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
301 @param[in] Handel A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel
302 to receive.
303 @param[in] Callback The callback function. This function is called if the asynchronous transfer is
304 completed.
305 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
306
307 @retval EFI_SUCCESS The L2CAP asynchronous receive request is submitted successfully.
308 @retval EFI_NOT_FOUND Handle is invalid or not found.
309 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
310 - DataLength is 0.
311 - If an asynchronous receive request already exists on same Handle.
312
313 **/
314 typedef
315 EFI_STATUS
316 (EFIAPI *EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE)(
317 IN EFI_BLUETOOTH_IO_PROTOCOL *This,
318 IN EFI_HANDLE Handle,
319 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,
320 IN VOID* Context
321 );
322
323 /**
324 Do L2CAP connection.
325
326 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
327 @param[out] Handel A handle to indicate this L2CAP connection.
328 @param[in] Psm Bluetooth PSM. See Bluetooth specification for detail.
329 @param[in] Mtu Bluetooth MTU. See Bluetooth specification for detail.
330 @param[in] Callback The callback function. This function is called whenever there is message received
331 in this channel.
332 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
333
334 @retval EFI_SUCCESS The Bluetooth L2CAP layer connection is created successfully.
335 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
336 - Handle is NULL.
337 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP connection.
338
339 **/
340 typedef
341 EFI_STATUS
342 (EFIAPI *EFI_BLUETOOTH_IO_L2CAP_CONNECT)(
343 IN EFI_BLUETOOTH_IO_PROTOCOL *This,
344 OUT EFI_HANDLE *Handle,
345 IN UINT16 Psm,
346 IN UINT16 Mtu,
347 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,
348 IN VOID *Context
349 );
350
351 /**
352 Do L2CAP disconnection.
353
354 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
355 @param[in] Handel A handle to indicate this L2CAP connection.
356
357 @retval EFI_SUCCESS The Bluetooth L2CAP layer is disconnected successfully.
358 @retval EFI_NOT_FOUND Handle is invalid or not found.
359 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP disconnection.
360
361 **/
362 typedef
363 EFI_STATUS
364 (EFIAPI *EFI_BLUETOOTH_IO_L2CAP_DISCONNECT)(
365 IN EFI_BLUETOOTH_IO_PROTOCOL *This,
366 IN EFI_HANDLE Handle
367 );
368
369 /**
370 Register L2CAP callback function for special channel.
371
372 @param[in] This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.
373 @param[out] Handel A handle to indicate this L2CAP connection.
374 @param[in] Psm Bluetooth PSM. See Bluetooth specification for detail.
375 @param[in] Mtu Bluetooth MTU. See Bluetooth specification for detail.
376 @param[in] Callback The callback function. This function is called whenever there is message received
377 in this channel. NULL means unregister.
378 @param[in] Context Data passed into Callback function. This is optional parameter and may be NULL.
379
380 @retval EFI_SUCCESS The Bluetooth L2CAP callback function is registered successfully.
381 @retval EFI_ALREADY_STARTED The callback function already exists when register.
382 @retval EFI_NOT_FOUND The callback function does not exist when unregister.
383
384 **/
385 typedef
386 EFI_STATUS
387 (EFIAPI *EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE)(
388 IN EFI_BLUETOOTH_IO_PROTOCOL *This,
389 OUT EFI_HANDLE *Handle,
390 IN UINT16 Psm,
391 IN UINT16 Mtu,
392 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,
393 IN VOID *Context
394 );
395
396 ///
397 /// This protocol provides service for Bluetooth L2CAP (Logical Link Control and Adaptation Protocol)
398 /// and SDP (Service Discovery Protocol).
399 ///
400 struct _EFI_BLUETOOTH_IO_PROTOCOL {
401 EFI_BLUETOOTH_IO_GET_DEVICE_INFO GetDeviceInfo;
402 EFI_BLUETOOTH_IO_GET_SDP_INFO GetSdpInfo;
403 EFI_BLUETOOTH_IO_L2CAP_RAW_SEND L2CapRawSend;
404 EFI_BLUETOOTH_IO_L2CAP_RAW_RECEIVE L2CapRawReceive;
405 EFI_BLUETOOTH_IO_L2CAP_RAW_ASYNC_RECEIVE L2CapRawAsyncReceive;
406 EFI_BLUETOOTH_IO_L2CAP_SEND L2CapSend;
407 EFI_BLUETOOTH_IO_L2CAP_RECEIVE L2CapReceive;
408 EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE L2CapAsyncReceive;
409 EFI_BLUETOOTH_IO_L2CAP_CONNECT L2CapConnect;
410 EFI_BLUETOOTH_IO_L2CAP_DISCONNECT L2CapDisconnect;
411 EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE L2CapRegisterService;
412 };
413
414 extern EFI_GUID gEfiBluetoothIoServiceBindingProtocolGuid;
415 extern EFI_GUID gEfiBluetoothIoProtocolGuid;
416
417 #endif