Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongoose-os-libs/ota-http-client
https://github.com/mongoose-os-libs/ota-http-client
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mongoose-os-libs/ota-http-client
- Owner: mongoose-os-libs
- License: other
- Created: 2017-06-14T14:08:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-15T00:18:07.000Z (about 3 years ago)
- Last Synced: 2024-07-31T21:52:07.741Z (6 months ago)
- Language: C
- Size: 597 KB
- Stars: 0
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mongoose-os - ota-http-client
README
# Implementation of Mongoose OS OTA HTTP client
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.## Configuration section
The library adds the following object to the device configuration:
```javascript
"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
}
```## Request Headers
The library includes the following additional headers with the request:
* `X-MGOS-Device-ID: ID MAC`
* `ID` is the value of the `device.id` configuration variable, if set, otherwise `-`.
* `MAC` is device's primary MAC address (as returned by `device_get_mac_address()`.
* `User-Agent: APP/APP_VERSION (MongooseOS/MGOS_VERSION; PLATFORM)`
* `APP` is the name of the application.
* `APP_VERSION` is the version of the application (from mos.yml)
* `MGOS_VERSION` is the version of Mongoose OS
* `PLATFORM` is the target platform
* `X-MGOS-FW-Version: PLATFORM APP_VERSION APP_BUILD_ID`
* `PLATFORM` is the target platform
* `APP_VERSION` is the version of the application (from mos.yml)
* `APP_BUILD_ID` is the build identification string (generated at build time)## Response Codes
Client code supports redirects (301 or 302 response code + `Location` header).
Client interprets `304 Not Modified` as "no update at this time".
## Server Side Code
Example of a server that serves uodates depending on the current version of the firmware can be found [here](https://github.com/cesanta/mongoose-os/blob/master/tools/updateredirector/updateredirector.go).