3 ms·
>My real problem with BT is how unreliable it is. I'd like to find someone who never had an issue pairing some earphones or headphones and had it working flawle
by Jugurtha 6y ago
>My real problem with BT is how unreliable it is. I'd like to find someone who never had an issue pairing some earphones or headphones and had it working flawlessly every time.
The first project I worked on was for elderly care[0], with a fitness tracker we would connect with over Bluetooth Low Energy (BLE). The first things I had done was to request the manufacturer's communication protocol for that device and then abstract that away in a nice library so we could control the tracker with Python functions `tracker.start_ecg()`, etc.
The second part was dealing with all the weird connectivity problems, troubleshoot, and add helpful exception messages for others. Here's an example:
message = """
We were unable to connect to the device {}{}{}...
Bluetooth devices are tricky and even when you do everything
right, you can still get this exception. Here are a few things
to consider:
- Simply retry to connect.
- Check `rfkill list`: it will tell you whether your device
is blocked or not. If it is indeed blocked, you can run:
`\x1b[33mrfkill unblock bluetooth\x1b[0m` to unblock it.
- Check `hciconfig`: it will tell you whether your device is
down or up. If it is down, you can raise your device:
`\x1b[33msudo hciconfig [hci0|hci1] up\x1b[0m`.
- You can also restart the bluetooth service:
`\x1b[33msudo service bluetooth restart\x1b[0m`.
- Calling Bluetooth.connect with the wrong hci_device param
can result in this exception, too. Check which device is
active and call the method with that one.
- Take a deep breath, you'll probably get this often.
"""
[0]: https://twitter.com/jugurthahadjar/status/1303496923308085256 https://twitter.com/jugurthahadjar/status/130349692330808525...
- maxerickson 6y agoWhat's the target market for a product that exposes the whole Linux device stack to an end user?
- Jugurtha 6y agoI don't understand your comment. Are you referring to the error message? If yes, that is targeted to the developers using the library that controls the device. i.e: us. The library helps us talk to a device by abstracting away low level details.