add MacOS support - #24
Open
alabalag1 wants to merge 3 commits into
Open
Conversation
Add tests and update README update gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pybmapnow talks BMAP over native IOBluetooth RFCOMM (via PyObjC) instead of LinuxAF_BLUETOOTHsockets, and discovers paired devices throughIOBluetoothDevice.pairedDevices()instead ofbluetoothctl.Changes
Python (
python/pybmap/) — the real functional change.transport.py: split intoLinuxRfcommTransport(the existing socket code, moved verbatim) and a newMacOsRfcommTransport.RfcommTransportis bound to one of them onsys.platform, so all callers are untouched. The macOS path does an SDP query, opens the baseband connection, opens RFCOMM channel 2, and pumpsNSRunLoopwhile a delegate collects inbound data on a queue — this is what IOBluetooth requires instead of a blocking socket. Samesend_recv(packet, drain=)contract, sameBmapConnectionError/BmapTimeoutError.discovery.py: same split. macOS enumerates paired devices and matches product IDs against the existing catalog; connected devices are still preferred over paired-but-disconnected, same as Linux.Rust / C++ — build-fix only, no macOS transport.
cpp/transport.cppandcpp/discovery.cppget__APPLE__branches: the transport constructor throws with a message pointing at the Python CLI, discovery returnsnullopt.CMakeLists.txtskips linkinglibbluetoothon Apple.cpp/tests/test_transport.cpp, plus#[cfg(target_os = "macos")]tests inrust/src/{transport,discovery}.rs), so the stubs can't silently rot into something that looks supported.Tooling
macOS_install.sh: installs PyObjC and symlinksbosectlinto/usr/local/bin.Makefile:make testinstalls PyObjC into the venv on Darwin only, so the suite runs out of the box on both platforms.bosectl:realpathinstead ofabspathso the launcher resolvespython/correctly when invoked through the symlink the installer creates.Device Impact
Transport-layer change only — no protocol or per-device logic was touched, so this is device-agnostic in principle. It does need real hardware on macOS to confirm the IOBluetooth path, since none of that is exercisable in unit tests.
Linux users are unaffected; the Linux socket code is byte-identical, just relocated into a class.
Checklist
make test) — on macOS 15 (Darwin 25.5): 121 Python passed / 18 skipped (integration tests needing--integration), 63 Rust, 54 C++. Not re-run on Linux — worth a CI check, since the Linux paths were relocated even though not edited.docs/architecture.mdstill describes the transport layer as Linux/BlueZ only. Tell me if you want that in this PR or as a follow-up.