bluetooth.3 (181698) | bluetooth.3 (189462) |
---|---|
1.\" Copyright (c) 2003 Maksim Yevmenkin | 1.\" Copyright (c) 2003-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com> |
2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright --- 8 unchanged lines hidden (view full) --- 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: bluetooth.3,v 1.5 2003/05/20 23:04:30 max Exp $ | 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright --- 8 unchanged lines hidden (view full) --- 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: bluetooth.3,v 1.5 2003/05/20 23:04:30 max Exp $ |
26.\" $FreeBSD: head/lib/libbluetooth/bluetooth.3 181698 2008-08-13 19:35:31Z emax $ | 26.\" $FreeBSD: head/lib/libbluetooth/bluetooth.3 189462 2009-03-06 23:30:07Z emax $ |
27.\" | 27.\" |
28.Dd August 13, 2008 | 28.Dd February 13, 2009 |
29.Dt BLUETOOTH 3 30.Os 31.Sh NAME 32.Nm bt_gethostbyname , 33.Nm bt_gethostbyaddr , 34.Nm bt_gethostent , 35.Nm bt_sethostent , 36.Nm bt_endhostent , --- 32 unchanged lines hidden (view full) --- 69.Fn bt_setprotoent "int stayopen" 70.Ft void 71.Fn bt_endprotoent void 72.Ft int 73.Fn bt_aton "const char *str" "bdaddr_t *ba" 74.Ft const char * 75.Fn bt_ntoa "const bdaddr_t *ba" "char *str" 76.Ft int | 29.Dt BLUETOOTH 3 30.Os 31.Sh NAME 32.Nm bt_gethostbyname , 33.Nm bt_gethostbyaddr , 34.Nm bt_gethostent , 35.Nm bt_sethostent , 36.Nm bt_endhostent , --- 32 unchanged lines hidden (view full) --- 69.Fn bt_setprotoent "int stayopen" 70.Ft void 71.Fn bt_endprotoent void 72.Ft int 73.Fn bt_aton "const char *str" "bdaddr_t *ba" 74.Ft const char * 75.Fn bt_ntoa "const bdaddr_t *ba" "char *str" 76.Ft int |
77.Fn bt_devaddr "const char *devname" "bdaddr_t *addr" 78.Ft int 79.Fn bt_devname "char *devname" "const bdaddr_t *addr" 80.Ft int 81.Fn (bt_devenum_cb_t) "int s" "struct bt_devinfo const *di" "void *arg" 82.Ft int 83.Fn bt_devinfo "struct bt_devinfo *di" 84.Ft int 85.Fn bt_devenum "bt_devenum_cb_t *cb" "void *arg" 86.Ft int |
|
77.Fn bdaddr_same "const bdaddr_t *a" "const bdaddr_t *b" 78.Ft int 79.Fn bdaddr_any "const bdaddr_t *a" 80.Ft int 81.Fn bdaddr_copy "const bdaddr_t *dst" "const bdaddr_t *src" 82.Sh DESCRIPTION 83The 84.Fn bt_gethostent , --- 107 unchanged lines hidden (view full) --- 192.Fn bt_ntoa 193takes a Bluetooth address and places an 194.Tn ASCII 195string representing the address into the buffer provided. 196It is up to the caller to ensure that provided buffer has enough space. 197If no buffer was provided then internal static buffer will be used. 198.Pp 199The | 87.Fn bdaddr_same "const bdaddr_t *a" "const bdaddr_t *b" 88.Ft int 89.Fn bdaddr_any "const bdaddr_t *a" 90.Ft int 91.Fn bdaddr_copy "const bdaddr_t *dst" "const bdaddr_t *src" 92.Sh DESCRIPTION 93The 94.Fn bt_gethostent , --- 107 unchanged lines hidden (view full) --- 202.Fn bt_ntoa 203takes a Bluetooth address and places an 204.Tn ASCII 205string representing the address into the buffer provided. 206It is up to the caller to ensure that provided buffer has enough space. 207If no buffer was provided then internal static buffer will be used. 208.Pp 209The |
210.Fn bt_devaddr 211function interprets the specified 212.Fa devname 213string as the address or device name of a Bluetooth device on the local system, 214and places the device address in the provided 215.Fa bdaddr , 216if any. 217The function returns 1 if the string was successfully interpreted, 218or 0 if the string did not match any local device. 219The 220.Fn bt_devname 221function takes a Bluetooth device address and copies the local device 222name associated with that address into the buffer provided, 223if any. 224Caller must ensure that provided buffer is at least 225.Dv HCI_DEVNAME_SIZE 226characters in size. 227The function returns 1 when the device was found, 228otherwise 0. 229.Pp 230The 231.Fn bt_devinfo 232function populates prodivded 233.Vt bt_devinfo 234structure with the information about given Bluetooth device. 235The caller is expected to pass Bluetooth device name in the 236.Fa devname 237field of the passed 238.Vt bt_devinfo 239structure. 240The function returns 0 when successful, 241otherwise -1. 242The 243.Vt bt_devinfo 244structure is defined as follows 245.Bd -literal -offset indent 246struct bt_devinfo 247{ 248 char devname[HCI_DEVNAME_SIZE]; 249 250 uint32_t state; 251 252 bdaddr_t bdaddr; 253 uint16_t _reserved0; 254 255 uint8_t features[HCI_DEVFEATURES_SIZE]; 256 257 /* buffer info */ 258 uint16_t _reserved1; 259 uint16_t cmd_free; 260 uint16_t sco_size; 261 uint16_t sco_pkts; 262 uint16_t sco_free; 263 uint16_t acl_size; 264 uint16_t acl_pkts; 265 uint16_t acl_free; 266 267 /* stats */ 268 uint32_t cmd_sent; 269 uint32_t evnt_recv; 270 uint32_t acl_recv; 271 uint32_t acl_sent; 272 uint32_t sco_recv; 273 uint32_t sco_sent; 274 uint32_t bytes_recv; 275 uint32_t bytes_sent; 276 277 /* misc/specific */ 278 uint16_t link_policy_info; 279 uint16_t packet_type_info; 280 uint16_t role_switch_info; 281 uint16_t debug; 282 283 uint8_t _padding[20]; 284}; 285.Ed 286.Pp 287The 288.Fn bt_devenum 289function enumerates Bluetooth devices present in the system. 290For every device found, 291the function will call provided 292.Fa cb 293callback function which should be of 294.Vt bt_devenum_cb_t 295type. 296The callback function is passed a 297.Dv HCI 298socket 299.Fa s , 300fully populated 301.Vt bt_devinfo 302structure 303.Fa di 304and 305.Fa arg 306argument provided to the 307.Fn bt_devenum . 308The callback function can stop enumeration by returning a value 309that is greater than zero. 310The function returns number of successfully enumerated devices, 311or -1 if an error occurred. 312.Pp 313The |
|
200.Fn bdaddr_same , 201.Fn bdaddr_any 202and 203.Fn bdaddr_copy 204are handy shorthand Bluetooth address utility functions. 205The 206.Fn bdaddr_same 207function will test if two provided BD_ADDRs are the same. --- 74 unchanged lines hidden (view full) --- 282on EOF or error. 283.Sh SEE ALSO 284.Xr gethostbyaddr 3 , 285.Xr gethostbyname 3 , 286.Xr getprotobyname 3 , 287.Xr getprotobynumber 3 , 288.Xr herror 3 , 289.Xr inet_aton 3 , | 314.Fn bdaddr_same , 315.Fn bdaddr_any 316and 317.Fn bdaddr_copy 318are handy shorthand Bluetooth address utility functions. 319The 320.Fn bdaddr_same 321function will test if two provided BD_ADDRs are the same. --- 74 unchanged lines hidden (view full) --- 396on EOF or error. 397.Sh SEE ALSO 398.Xr gethostbyaddr 3 , 399.Xr gethostbyname 3 , 400.Xr getprotobyname 3 , 401.Xr getprotobynumber 3 , 402.Xr herror 3 , 403.Xr inet_aton 3 , |
290.Xr inet_ntoa 3 | 404.Xr inet_ntoa 3 , 405.Xr ng_hci 4 |
291.Sh CAVEAT 292The 293.Fn bt_gethostent 294function reads the next line of 295.Pa /etc/bluetooth/hosts , 296opening the file if necessary. 297.Pp 298The --- 8 unchanged lines hidden (view full) --- 307.Pa /etc/bluetooth/protocols , 308opening the file if necessary. 309.Pp 310The 311.Fn bt_setprotoent 312function opens and/or rewinds the 313.Pa /etc/bluetooth/protocols 314file. | 406.Sh CAVEAT 407The 408.Fn bt_gethostent 409function reads the next line of 410.Pa /etc/bluetooth/hosts , 411opening the file if necessary. 412.Pp 413The --- 8 unchanged lines hidden (view full) --- 422.Pa /etc/bluetooth/protocols , 423opening the file if necessary. 424.Pp 425The 426.Fn bt_setprotoent 427function opens and/or rewinds the 428.Pa /etc/bluetooth/protocols 429file. |
430.Pp 431The 432.Fn bt_devenum 433function enumerates up to 434.Dv HCI_DEVMAX 435Bluetooth devices. 436During enumeration the 437.Fn bt_devenum 438function uses the same 439.Dv HCI 440socket. 441The function guarantees that the socket, 442passed to the callback function, 443will be bound and connected to the Bluetooth device being enumerated. |
|
315.Sh AUTHORS 316.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com 317.Sh BUGS 318These functions use static data storage; 319if the data is needed for future use, it should be 320copied before any subsequent calls overwrite it. | 444.Sh AUTHORS 445.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com 446.Sh BUGS 447These functions use static data storage; 448if the data is needed for future use, it should be 449copied before any subsequent calls overwrite it. |