我想通过BLE (https://github.com/xabre/xamarin-bluetooth-le)从我的Xamarin Forms (C#) iOS应用程序发送一个文件(bin)到我的ESP32 (Arduino)。该文件将是用于更新的bin文件。我已经找到了一个关于如何更新ESP32 out of spiffs (arduino-esp32 do OTA via BLE)的解决方案,但是有人知道我如何用ESP32接收文件并将其保存到spiffs中吗?
( esp32的BLE连接应用已经完全正常工作了,我可以发送文本,但我不知道如何发送文件)
最好的问候nflug
发布于 2021-02-14 12:30:07
您必须将文件内容作为单独的字节发送,并将其保存到SPIFFS
您可以使用下面的函数创建和写入二进制文件(Arduino代码)
void writeBinary(fs::FS &fs, const char * path, uint8_t *dat, int len) {
//Serial.printf("Write binary file %s\r\n", path);
File file = fs.open(path, FILE_APPEND);
if (!file) {
Serial.println("- failed to open file for writing");
return;
}
file.write(dat, len);
file.close();
}
在这里查看ESP32_BLE_OTA_Arduino的用法。
我还创建了一个安卓应用程序来上传文件ESP32_BLE_OTA_Android
https://stackoverflow.com/questions/63999285
复制相似问题