I tried to implement this function myself, and failed. here is my findings;
In order to start the updated process you need three libraries; first of course the Update library provided by esp32 core, second; an http client library to perform the GET request from the provided OverTheAirUrl and to pass a stream object to the Update library that stream shall contain the body of http response and the body length in Bytes should be known in advance and also been passed to the update library, the third is a communication client to be used by the http client and to handle the network layer.
First issue; the HttpClient library used at edgent example is provided by esp32 core library and only uses by default wifi as the communication client, that’s why we don’t see any communication client declared in the example, also the library does not accept any communication client in its constructor, the wifi client is declared by the library itself inside the constructor.
So; we need an http client that accepts a communication client within its constructor, I found those two libraries and tested them with no success.
-
ArduinoHttpClient library.
this library is also used in TyniGsm example
-
HttpClient library.
Both of two libraries failed to get a success response code from Blynk server, the first one always return -1 from its .get(path)
function, the second also returns -1 from its .get(hostName, path)
function.
Second issue; both of this two libraries returns the response body as a String not Stream object which is required by the Update.writeStream()
function, I would tried to solve this if I’ve got a success response code on GET request at first.
-
Arduino-SIM800L-driver library.
this third library interfaces directly with SIM800L, I didn’t test it. instead I tried working with SIM800 AT commands as follows:
based on this guide, I managed to get a success response code (200) from Postman echo service, also managed to return the response body as a stream object directly from the SIM800 serial connection, But failed to replicate that with the OverTheAirUrl, the AT+HTTPACTION=0 command always return this: +HTTPACTION: 0,602,0 which means I performed your http action 0 (= GET) and got an http response code # 602 with size 0, some times i get 601 or 603. all this are not a standard http response codes, my best guess is that SIM800 didn’t receive any response at all, on the other hand with Postman echo URL I get +HTTPACTION: 0,200,xx where xx is the response size and the followed command (AT+HTTPREAD) returns the response body.
hope that helps someone…
Ibrahim.