Status of bluetooth connection on later macos version
- OS: MacOs 15.5 (24F74)
- Python version: 3
- NXT-Python version: latest
- Connection method: USB? Bluetooth? Bluetooth
Hello,
I just wanted to try out the library to use an old nxt via bluetooth with my son. The nxt has a broken display, so python and bluetooth could be the alternative. As there is no windows computer in the house. But what's the status here? I followed the steps on the installation page, nxt is connected via bluetooth, but no brick is found. Via usb cable the script is working.
nxt.locator.BrickNotFoundError: no brick found
Anyone else is able to use bluetooth?
Did you install PyBlueZ?
Problem is that pybluez is no longer supported, and this is complicated to install it on macos.
See here: https://ni.srht.site/nxt-python/latest/installation.html#installation-using-pip
Another option would be to use a bluetooth socket, but nobody tried it on MacOS yet: https://github.com/schodet/nxt-python/issues/199#issuecomment-2558238693
If you want to try, please test the btsocket branch and report the result.
Also documentation could be improved by providing a test-matrix of which OS works with which setup, this could also be used by nxt-python to select the best option according to the OS.
but nobody tried it on MacOS
I actually looked at this a while back. Bluetooth socket doesn't work on macOS - it isn't implemented in Python and isn't really possible to do so. The Apple IOBluetooth APIs for RFCOMM don't have socket support and only run on the main thread with a NSRunLoop running, so it makes it difficult to integrate into an arbitrary Python program.
I have some idea to make something that launches a separate process that runs the Bluetooth stuff in a NSRunLoop and has a socket that is somewhat compatible with Bluetooth RFCOMM sockets so it can be an almost drop in replacement, but never got around to actually implementing it.
Thanks @dlech (and sorry if you did mention it earlier but I forgot).
So only option today for MacOS is to manage to build pybluez from source.