|
SimpleOTA client v1.0.0
Shared core of the SimpleOTA Arduino and ESP-IDF clients
|
Delivery and polling policy for deferred status reports. More...
Go to the source code of this file.
Data Structures | |
| struct | sota_report_t |
| One status report waiting to be sent. More... | |
| struct | sota_outbox_t |
| The outbox, oldest report first. More... | |
Functions | |
| static bool | sota_report_delivered (int http_status) |
| A report is delivered once the server returns any HTTP response. | |
| static uint32_t | sota_poll_interval_s (bool connected, bool in_trial, bool report_pending, uint32_t report_failures, uint32_t quick_s, uint32_t check_interval_s) |
| Seconds until the next check. | |
| static bool | sota_copy_field (char *dst, size_t cap, const char *src) |
| Copy src into a fixed field. | |
| static void | sota_outbox_init (sota_outbox_t *box) |
| Empty the outbox. | |
| static bool | sota_field_terminated (const char *field, size_t cap) |
| True when field has a NUL within cap bytes. | |
| static bool | sota_outbox_valid (const sota_outbox_t *box) |
| True when a loaded blob has this layout, a count it can hold, and only reports that sota_outbox_push() could have added. | |
| static bool | sota_outbox_push (sota_outbox_t *box, const char *event, const char *reason, const char *deployment, uint32_t build) |
| Add a report at the back. | |
| static void | sota_outbox_pop (sota_outbox_t *box) |
| Remove the report at the front. | |
Delivery and polling policy for deferred status reports.
"confirmed" and "rolled_back" are telemetry. What the server says about them never changes what the device does. A report is delivered once the server returns any HTTP response. Without a response it stays pending and is sent again on later checks: a few quick retries, then at the normal check interval.
No platform types, so the host tests can include this header.
|
inlinestatic |
Seconds until the next check.
connected: is_connected() allowed the check that just ran. While it does not, it is polled every SOTA_CONNECT_POLL_S, so the check runs as soon as the network is up instead of a whole check interval later. in_trial: a trial is running, so checks come every quick_s until it is confirmed or rolled back. report_pending: a confirmed or rolled_back report is waiting to be sent. report_failures: sends of that report that got no response this boot.
|
inlinestatic |
Copy src into a fixed field.
Returns false when it does not fit.
|
inlinestatic |
Empty the outbox.
< Layout of the stored outbox blob.
|
inlinestatic |
True when a loaded blob has this layout, a count it can hold, and only reports that sota_outbox_push() could have added.
< Layout of the stored outbox blob.
< Reports the outbox holds.
|
inlinestatic |
Add a report at the back.
One without an event, deployment or build, or whose fields do not fit, is not added; returns false then.
< Reports the outbox holds.
< Reports the outbox holds.
|
inlinestatic |
Remove the report at the front.
< Reports the outbox holds.