Skip to content

Add ISO socket support#62

Merged
colemancda merged 8 commits into
masterfrom
feature/iso
Jul 18, 2026
Merged

Add ISO socket support#62
colemancda merged 8 commits into
masterfrom
feature/iso

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

Adds isochronous channel (LE Audio) socket support, the last kernel Bluetooth protocol missing from the package:

  • BluetoothSocketProtocol.iso — the protocol was absent from the enum entirely (BTPROTO_ISO, sequenced packet).
  • ISOSocket — bind, client connect (non-blocking with poll and timeout), server listen/accept, seqpacket send/receive, and get/set of the stream quality of service. The client constructor applies QoS before connecting, as the kernel requires.
  • ISOSocketAddress — address plus LE address type over a new sockaddr_iso interop struct.
  • BluetoothSocketOption.ISOQualityOfService — the BT_ISO_QOS option modeling unicast stream parameters: CIG/CIS identifiers (defaulting to unset), sleep clock accuracy, packing, framing, and input/output parameters (SDU interval, latency, SDU size, PHY, retransmission number) with layout matching the kernel struct.

Scope note: this covers unicast (connected isochronous streams). Broadcast isochronous streams (BIG/BIS, the extended QoS variant, and the broadcast address extension) are a follow-up. Requires kernel 6.0+; on older kernels the ISO socket is gated behind an experimental feature toggled via the management interface (#55).

Test plan

  • 4 new unit tests covering protocol and option identifiers, quality of service struct layout asserted against the kernel ABI (including field offsets), and byte-level QoS encoding round-trips; the socket address encoding test is Linux-gated (Bluetooth address family is unavailable on Darwin) and runs in CI
  • Full test suite passes
  • swift build succeeds with no new warnings
  • Live isochronous streams require Linux 6.0+ and LE Audio capable controllers

@colemancda
colemancda merged commit d339675 into master Jul 18, 2026
1 check passed
@colemancda
colemancda deleted the feature/iso branch July 18, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant