Change device discovery based on the service GUiD
App should discover the devices based on the service guid, not on name.
@francip thanks for highlighting this. The code in question lives here, where we only connect to devices by name "Friend" or "Super." Interestingly enough, we do check the UUID when actually receiving data from the device. Other than avoiding potential conflicts with other devices of the same name, what do you think is the advantage or discovery by guid?
It is mostly to avoid conflicts with other devices. But that's relevant in several scenarios.
Discovery with multiple devices of same manufacturer: It allows the device to generate unique name when started for first time (usually including part of the serial number), so that it is easy to figure out which device to pair with, if there are multiple active at the same time.
Ownership: It also allows the user to rename the device later.
Support for heterogeneous devices: And it allows the app to support any device that implements the BLE protocol, no matter who the manufacturer is. For example, I would like my Arduino RP2040 implementation to have a different name from my ESP Friend device. But even from BasedHardware point of view, the app could discover both Friend and OpenGlass based on the service and then examine the characteristics to determine if it streams audio only or audio and pictures.
An additional advantage is that BLE supports scan for devices with specific service only, allowing the code to easily bypass all the other devices and speeding up the pairing process a little bit. Not a big time saving, but it will simplify the code.
Fixed by https://github.com/BasedHardware/Friend/pull/216
Thanks @ebariaux