Skip to content

Add SCO socket support#59

Merged
colemancda merged 6 commits into
masterfrom
feature/sco
Jul 18, 2026
Merged

Add SCO socket support#59
colemancda merged 6 commits into
masterfrom
feature/sco

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

Implements the SCO socket (previously an empty stub), enabling synchronous voice links with classic (BR/EDR) devices:

  • SCOSocket — bind, client connect (non-blocking with poll and timeout), server listen/accept, seqpacket send/receive, and typed accessors for socket options (MTU), connection information (handle and device class), and the voice setting.
  • SCOSocketAddress — public address type over the existing sockaddr_sco interop struct, with little-endian conversion matching the L2CAP convention.
  • BluetoothSocketOption.Voice — implements the previously declared but unimplemented BT_VOICE option with CVSD (0x0060) and transparent (0x0003) air coding settings; transparent is required for wideband speech codecs such as mSBC. The client constructor applies the voice setting before connecting, since the kernel requires that ordering.

Test plan

  • 5 new unit tests covering option level and identifiers, voice setting values and byte-level encoding round-trips, and option struct layouts; 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 audio links require Linux, an existing ACL connection, and a headset-class device

@colemancda
colemancda merged commit 2a38853 into master Jul 18, 2026
1 check passed
@colemancda
colemancda deleted the feature/sco branch July 18, 2026 06:09
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