Skip to main content

Module sys

Module sys 

Source
Expand description

The Bluetooth socket family.

Both Linux transports here are AF_BLUETOOTH sockets, so the address layout, the address parsing and the libc externs live once rather than once per transport.

Structs§

SockAddrL2
struct sockaddr_l2 from bluetooth/l2cap.h.
SockAddrRc
struct sockaddr_rc from bluetooth/rfcomm.h.

Enums§

Ready
Whether a descriptor became ready, timed out, or failed.

Constants§

AF_BLUETOOTH
BDADDR_ANY
BDADDR_ANY — let the kernel pick the adapter.
BDADDR_LE_PUBLIC
BDADDR_LE_RANDOM
BTPROTO_HCI
BTPROTO_L2CAP
BTPROTO_RFCOMM
BT_SECURITY
BT_SECURITY_FIPS
BT_SECURITY_HIGH
BT_SECURITY_LOW
BT_SECURITY_MEDIUM
BT_SECURITY_SDP
Only meaningful on the SDP channel; see [set_classic_security].
EBUSY
Something else already holds the resource — see gatt::connect_error.
ECONNRESET
How Linux reports the peer closing an RFCOMM channel with a DISC frame.
EINTR
EINTR — a syscall interrupted by a signal, which is a retry not a failure.
POLLIN
POLLOUT
SHUT_RDWR
SOCK_RAW
SOCK_SEQPACKET
SOCK_STREAM
SOL_BLUETOOTH

Functions§

accept⚠
address_type
The address type byte for an LE peer.
bind⚠
Takes a *const c_void because both socket families here bind with their own sockaddr shape, and one extern declaration has to serve both — two declarations of the same symbol with different pointer types do not compile.
bind_le_source
Bind an L2CAP socket to the local side of an LE link before connecting.
bluetooth_setsockopt⚠
setsockopt, under a name that says which options this crate sets with it. *const c_void because the option value differs per level — a bt_security here, an hci_filter in crate::hci — and two extern declarations of one symbol with two signatures is a hard error.
close⚠
connect⚠
errno
The current errno.
format_address
Format a wire-order address as it is written.
getsockname⚠
listen⚠
parse_address
Parse AA:BB:CC:DD:EE:FF into wire order.
read⚠
read(2) into a byte buffer.
shutdown⚠
socket⚠
wait_ready
Wait for fd to be ready, for at most timeout_ms.
write⚠
write(2) from a byte buffer.