bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
603 stars 284 forks source link

OnBluetoothDisconnected event in radio module #675

Open niutech opened 4 years ago

niutech commented 4 years ago

MakeCode for Micro:bit supports the OnBluetoothDisconnected event. Can the same be supported in Radio module, e.g. radio.on_disconnected(callback)? Thanks!

kopp commented 4 years ago

as far as I understand, the radio module does not have the concept of connected or disconnected, but just of on and off.

As far as I understand from the code and the discussion in the pull request introducing the feature MakeCode and MicroPython use different software layers to get Radio working (MakeCode uses the DAL while MicroPython does not), so I would expect different features to be available in those two...

2bndy5 commented 3 years ago

The radio module doesn't use a pairing/bonding mechanism like Bluetooth does. Additionally, I don't see the underlying implementation using an auto-ACK feature, so there is no way to know if there is a connection at all. If there was an auto-ACK feature, it would negate using the term "group", since 1 transmission could be acknowledged by only 1 receiver.

Simply put, this request cannot be satisfied in any way.