Open SaNFeeDep opened 1 week ago
I found a link to GitHub in the application I use - https://github.com/kai-morich/SimpleBluetoothTerminal Link on GooglePlay - https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal
Try to increase the MTU and use the maxByteSize parameter to send all the data in a single write.
@marcosinigaglia I tried increasing the MTU size and sending the response in maxByteSize, but it didn't work :( My device does not support MTU greater than 23. I tried lowering the MTU size but it did not help.
I checked the packets using WireShark. The result is very strange. Data is sent from your phone to your device almost instantly. The device also responds to these packets almost instantly. They come back to the phone and that's it...
They'll get stuck somewhere for 10 seconds.
The problem is that when sending commands to the device, the response time from the device is 10 seconds. I use Expo for assembly. I thought that when assembling the “product” version this time would become shorter, but it remained the same. Below is an example of a request and response. Please pay attention to the time.
LOG BLEManager: Send command = "pass 0|who|fuel|bat|temp|time" on device C5:8B:00:78:C8:FD. Time: 13:37:38
LOG BLEManager: Writed...
LOG BLEManager: Received => PASS=OK|WHO=FW:0.0.1,SN:12340000|FUEL=0|BAT=3.1|TEMP=25|TIME=0,6345. Time: 13:37:48.
It takes 10 seconds to respond to this command -_- When using a third party application for BLE, response time to commands is less than 200 ms from the same device
Below is the class I use to work with BleManager.
Import from logger.ts it just console.log:
Other info: 1) Android: 12 SKQ1.211202.001 2) Expo: 51.0.28 3) BleManager: 11.5.6 4) React-Native: 0.74.5 5) Buffer: 6.0.3