50enum { SOTA_LOG_NONE, SOTA_LOG_ERROR, SOTA_LOG_WARN, SOTA_LOG_INFO, SOTA_LOG_DEBUG };
56 __attribute__((format(printf, 2, 3)))
63#define SOTA_LOG_LEVEL SOTA_LOG_DEBUG
67#define SOTA_LOG_AT(level, ...) \
68 do { if (SOTA_LOG_LEVEL >= (level)) sota_app_log((level), __VA_ARGS__); } while (0)
69#define SOTA_LOGE(...) SOTA_LOG_AT(SOTA_LOG_ERROR, __VA_ARGS__)
70#define SOTA_LOGW(...) SOTA_LOG_AT(SOTA_LOG_WARN, __VA_ARGS__)
71#define SOTA_LOGI(...) SOTA_LOG_AT(SOTA_LOG_INFO, __VA_ARGS__)
72#define SOTA_LOGD(...) SOTA_LOG_AT(SOTA_LOG_DEBUG, __VA_ARGS__)
void sota_app_wake(void *user)
The confirm timeout fired, possibly in a timer task: arrange for sota_engine_service() to run soon on...
void sota_app_event(void *user, const sota_event_t *event)
Deliver an event to the application, on the task doing the work.
void sota_app_log(int level, const char *fmt,...)
Write one log line at level, printf-style, without a trailing newline.
sota_event_id_t
In the order of simpleota_event_id_t, so the API layer can pass them through.
Definition sota_app.h:20
@ SOTA_EVENT_BEFORE_REBOOT
Flashed and verified; it runs from the next reboot.
Definition sota_app.h:25
@ SOTA_EVENT_ROLLING_BACK
The trial failed; the previous image starts next.
Definition sota_app.h:28
@ SOTA_EVENT_DOWNLOAD_PROGRESS
done / total advanced.
Definition sota_app.h:23
@ SOTA_EVENT_CONFIRMED
The trial image's confirmed report was delivered.
Definition sota_app.h:27
@ SOTA_EVENT_CHECK_DONE
A check completed; no update offered.
Definition sota_app.h:21
@ SOTA_EVENT_UPDATE_AVAILABLE
An update was offered.
Definition sota_app.h:22
@ SOTA_EVENT_UPDATE_FAILED
The update was dropped; reason says why.
Definition sota_app.h:24
@ SOTA_EVENT_TRIAL_BOOT
Running an image that is not confirmed yet.
Definition sota_app.h:26
One event, valid only during the sota_app_event() call.
Definition sota_app.h:32
size_t done
DOWNLOAD_PROGRESS: bytes written.
Definition sota_app.h:36
uint32_t build
The build the event is about, 0 when none.
Definition sota_app.h:35
size_t total
DOWNLOAD_PROGRESS: bytes expected, 0 when unknown.
Definition sota_app.h:37
const char * reason
A reason token or server status, or NULL.
Definition sota_app.h:34
sota_event_id_t id
What happened.
Definition sota_app.h:33