|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <ota_service.h>
Public Types | |
| enum class | UpdateState : uint8_t { Idle , Checking , UpToDate , Available , Installing , Failed } |
Public Member Functions | |
| void | begin () |
| void | tick () |
| bool | checkForUpdate () |
| bool | installUpdate () |
| void | resumeAfterCheck () |
| UpdateState | updateState () const |
| Return the current update state. | |
| const char * | updateVersion () const |
| Return the version being checked or installed. | |
| const char * | updateMessage () const |
| Return a concise status or failure message for the current update. | |
| const char * | runningSlot () const |
| Return the active application slot name. | |
| const char * | runningImageState () const |
| Return the bootloader state of the active image. | |
| const char * | runningVersion () const |
| Return the firmware version embedded in the active image. | |
| const char * | otherSlot () const |
| Return the alternate application slot name. | |
| const char * | otherImageState () const |
| Return the bootloader state of the alternate image. | |
| bool | otherSlotBootable () const |
| Return whether the alternate image passes bootability validation. | |
| bool | selectOtherSlot () |
Static Public Member Functions | |
| static OtaService & | instance () |
| Return the installed process-wide OTA service. | |
Private Member Functions | |
| void | runUpdate (bool install) |
Static Private Member Functions | |
| static void | updateTask (void *context) |
Private Attributes | |
| bool | pendingConfirmation_ {false} |
| uint32_t | confirmationStartedMs_ {0} |
| std::atomic< UpdateState > | updateState_ {UpdateState::Idle} |
| std::atomic< bool > | updateTaskActive_ {false} |
| std::atomic< bool > | resumeComponentsRequested_ {false} |
| char | updateVersion_ [32] {} |
Coordinates release checks, inactive-slot image installation, and rollback safety.
Network download runs outside the UI tick. The bootloader records whether an image is pending validation; this service confirms it only after firmware startup checks pass. Keeping slot selection and confirmation here prevents app code from writing arbitrary flash addresses or bypassing rollback.
|
strong |
| void ersa::services::OtaService::begin | ( | ) |
Inspect boot metadata and begin the pending-image validation window.
| bool ersa::services::OtaService::checkForUpdate | ( | ) |
Start a bounded background manifest check; inspect updateState() for result.
| bool ersa::services::OtaService::installUpdate | ( | ) |
Start image download and validation into the inactive OTA slot. The active image remains selected until bootloader metadata is updated.
|
static |
Return the installed process-wide OTA service.
| const char * ersa::services::OtaService::otherImageState | ( | ) | const |
Return the bootloader state of the alternate image.
| const char * ersa::services::OtaService::otherSlot | ( | ) | const |
Return the alternate application slot name.
| bool ersa::services::OtaService::otherSlotBootable | ( | ) | const |
Return whether the alternate image passes bootability validation.
| void ersa::services::OtaService::resumeAfterCheck | ( | ) |
Resume suspended providers after check/install work releases resources.
| const char * ersa::services::OtaService::runningImageState | ( | ) | const |
Return the bootloader state of the active image.
| const char * ersa::services::OtaService::runningSlot | ( | ) | const |
Return the active application slot name.
| const char * ersa::services::OtaService::runningVersion | ( | ) | const |
Return the firmware version embedded in the active image.
|
private |
| bool ersa::services::OtaService::selectOtherSlot | ( | ) |
Select the alternate slot only after verifying its image state is bootable.
| void ersa::services::OtaService::tick | ( | ) |
Confirm a healthy boot or apply worker completion without blocking UI.
| const char * ersa::services::OtaService::updateMessage | ( | ) | const |
Return a concise status or failure message for the current update.
|
inline |
Return the current update state.
|
staticprivate |
|
inline |
Return the version being checked or installed.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |