Hacker News new | ask | show | jobs
by IshKebab 984 days ago
I use Nordic's app nRF Connect for this - last I used it it was fantastic. Nice to have alternative options though.

I agree WebBluetooth is easily the sanest way to access BLE devices. The iOS API is not too bad either but then you have to deal with Apple. The Android API is terrible, and the Android Bluetooth stack is unreliable and buggy.

3 comments

>and the Android Bluetooth stack is unreliable and buggy.

It is truly the worst. Up until API level 33 (Android 13 from 2022!!!), all characteristic read/writes were memory unsafe. Now readCharacteristic is async for memory safety, but you're still expected to send a value synchronously with BluetoothGattServer#sendResponse when onCharacteristicWrite gets hit, so sending a value that's derived from any characteristic values is impossible before you fall out of scope. And notifying/indicating is just never reliable -- it just fails to work consistently device to device. And the high level API for the CCCD often doesn't work and requires you to set the 0x2902 descriptor manually.

CoreBluetooth handles BLE so elegantly and Android just botches it. Sad.

Nordic is easily the best way for BLE/ANT+, however now even they are bolting on WiFi (for non-power-limited cases). For standard profiles there's generally an example in the SDKs.
nrfconnect exposes the services, but if they arent registered with the bluetooth SIG then you won't have much more detail than the ids of characteristics and services and their data types. You won't know what the purpose of each service and characteristic is.
You can actually name them, but yeah you can't implement custom encoding/decoding logic. I don't think this thing lets you do that either though.