This library adds a device configuration section called update, where
a device could be configured to poll a specified HTTP URL for a new
app firmware.
Also, this library adds a C API to fetch a new firmware from the given URL and update programmatically.
The library adds the following object to the device configuration:
"update": {
"commit_timeout": 0, // OTA commit timeout
"url": "", // HTTP URL to poll
"interval": 0, // Polling interval
"extra_http_headers": "", // Extra HTTP request headers
"ssl_ca_file": "ca.pem", // TLS CA cert file
"ssl_client_cert_file": "", // TLS cert file
"ssl_server_name": "", // TLS server name
"enable_post": true
}The library includes the following additional headers with the request:
X-MGOS-Device-ID: ID MACIDis the value of thedevice.idconfiguration variable, if set, otherwise-.MACis device's primary MAC address (as returned bydevice_get_mac_address().
User-Agent: APP/APP_VERSION (MongooseOS/MGOS_VERSION; PLATFORM)APPis the name of the application.APP_VERSIONis the version of the application (from mos.yml)MGOS_VERSIONis the version of Mongoose OSPLATFORMis the target platform
X-MGOS-FW-Version: PLATFORM APP_VERSION APP_BUILD_IDPLATFORMis the target platformAPP_VERSIONis the version of the application (from mos.yml)APP_BUILD_IDis the build identification string (generated at build time)
Client code supports redirects (301 or 302 response code + Location header).
Client interprets 304 Not Modified as "no update at this time".
Example of a server that serves uodates depending on the current version of the firmware can be found here.