phyphox/phyphox-android

Cant connect to BLE peripheral after saving experiment (BLE Input and BLE Output)

Closed this issue · 4 comments

I have made a BLE experiment that uses inputs and outputs but when the experiment is saved and loaded again it cant connect to the device.

What Ive noticed is that the App tries to connect twice. Once to the BLE Name described in the Input xml subelement and one in the output xml subelement. However, both bluetooth input and output have the same name. I think the app should know that if it already connected to a BLE device with the same name for input and output it shouldnt ask again to connect to the device. Since its already connected it wont find the device and thus this problem occurs.

As I tested this with another android device, I think this is a bug in the app. I also tested this with the phone of a colleague (IOS) and it doesnt work either.

I would gladly meet to check this in more detail because I think its better that someone from the phyphox team could have an insight and help check where the problem might be. My email is chavez-bermudez@fh-aachen.de for any further contact.

BR
Victor

If I understood the problem correctly, you just found a known ugly design flaw of our XML format. The Bluetooth support has grown historically and was first implemented as an "input" only like regular sensors. Since it has to be defined twice as input and output and since experiments could be done that actually require two different devices with the same service and/or name, the workaround is to tell phyphox that it is the same device using the attribute "id".

Simply adding id="something" to both bluetooth blocks (with the same "something") should tell phyphox to only ask for the device once. (See also https://phyphox.org/wiki/index.php/Bluetooth_Low_Energy#BLE_device_matching)

If that's not the solution we should meet, indeed :)

Ok Ill give it a try and will check how it goes. If I still have problems I will report back.

Just an update. Using the same id worked.

Great. At some point we should probably rework this into a single Bluetooth block. Supporting the current format as legacy should be trivial and splitting a single device into input and output is just confusing.