kai-morich / SimpleBluetoothTerminal

Android terminal app for Bluetooth classic devices using SPP profile
MIT License
447 stars 166 forks source link

Feature request: Add support for write-no-response #25

Closed TheoGoudout closed 2 years ago

TheoGoudout commented 2 years ago

The Nordic nRF Toolbox app supports "write-no-response" for the RX characteristic. I believe it could (slightly) improve transfer performances.

kai-morich commented 2 years ago

To my understanding the app cannot choose the transfer mode, but the device tells, what it supports: https://github.com/kai-morich/SimpleBluetoothLeTerminal/blob/8c0ac02012a9e05b0c0bea3ce81107cd25a87aea/app/src/main/java/de/kai_morich/simple_bluetooth_le_terminal/SerialSocket.java#L273

If having a real serial port attached to the bluetooth device, the bluetooth transfer speed isn't the limiting factor. If really using "write-no-response" one also would have to use some synchronization mechanism to avoid serial send buffer overflow, e.g. like Telit device credit handling.

TheoGoudout commented 2 years ago

What I meant was: If the remote device is offering a "write-no-response" characteristic instead of the classic "write" one, your app could support it.

kai-morich commented 2 years ago

got your point. writeCharacteristic.getProperties() tells that the device supports write-no-response, but only for Telit devices it's currently set with writeCharacteristic.setWriteType. According to my notes also HM10,TI uart use write-no-response. I have to check my hardware pool and test if it really works and makes a performance difference. But maybe the BLE stack internally already considers the property.

kai-morich commented 2 years ago

write_no_response is automatically set, see https://android.googlesource.com/platform/frameworks/base.git/+/refs/heads/android10-mainline-release/core/java/android/bluetooth/BluetoothGattCharacteristic.java#282