Reputation: 19
I have a question to the flutter plugin "reactive Bleibt 5.0.3". I'm trying to execute a OTA Update of the firmware and with the Android Devices everthing is working fine, but when I'm trying to do it with any iOS device, the App runs into a timeout.
What I'm trying to do:
First I'm writing a control bit(0), which says the device OTA will start.
await appContext.flutterReactiveBle.writeCharacteristicWithResponse(characteristicControl, value: [0]);
sleep(Duration(milliseconds: 200));
Then I'm starting a loop, which writes the file (280kb) in smaller (244bytes).
try {
appContext.flutterReactiveBle.writeCharacteristicWithoutResponse(characteristicData, value: tmpList);
} catch (e) {
NotificationUtils.showErrorMsg('FW Update failed.');
developer.log('catch() ' + e.toString());
}
after each step I'm starting a short sleep (75-150ms).
sleep(Duration(milliseconds: appContext.settings.fwWriteStepsPause));
when the complete file is written, I'm waiting a full second and write the control bit (3) to give the device the information that the transmission was done.
sleep(Duration(milliseconds: 1000));
///4. Write Control Bit to 3 = Start OTA
await appContext.flutterReactiveBle.writeCharacteristicWithResponse(characteristicControl, value: [3]);
sleep(Duration(milliseconds: 200));
Now to my question. When I'm writing the first control bit, I receive a response after 100ms or less. The transmission is done with our response.
BUT when I'm writing the control bit at the end again, I receive either no response or after almost 7 minutes and the device says the transmission was failed. Which means the OTA was failed. Again, on Android devices it works.
I also already tried to manage the MTU size, but this seems not very helpful.
Does any have the same experience with this iOS behavior and does anybody know a solution or workaround?
Many thanks in advance. Thomas
Upvotes: 0
Views: 319
Reputation: 1
You can go for a simple solution flutter_ota pacakage for ota update it works for both android and ios . It handles all the backend functionality you just need to send the type of firmware update and ble characteristics on which need to perform the ota update. Link: https://pub.dev/packages/flutter_ota and for more clearance im attachin the article link : https://medium.com/@sparkleotech/a-guide-to-achieving-seamless-ota-updates-for-esp32-with-the-flutter-ota-package-eb48f4a66870
Upvotes: 0