mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-24 19:53:08 +00:00
4bf29827f8
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
88 lines
2.2 KiB
C
88 lines
2.2 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <update_util/update_manifest.h>
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define UPDATE_DELAY_OPERATION_OK 10
|
|
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
|
|
|
|
typedef enum {
|
|
UpdateTaskStageProgress = 0,
|
|
|
|
UpdateTaskStageReadManifest,
|
|
UpdateTaskStageLfsBackup,
|
|
|
|
UpdateTaskStageRadioImageValidate,
|
|
UpdateTaskStageRadioErase,
|
|
UpdateTaskStageRadioWrite,
|
|
UpdateTaskStageRadioInstall,
|
|
UpdateTaskStageRadioBusy,
|
|
|
|
UpdateTaskStageOBValidation,
|
|
|
|
UpdateTaskStageValidateDFUImage,
|
|
UpdateTaskStageFlashWrite,
|
|
UpdateTaskStageFlashValidate,
|
|
|
|
UpdateTaskStageLfsRestore,
|
|
UpdateTaskStageResourcesUpdate,
|
|
UpdateTaskStageSplashscreenInstall,
|
|
|
|
UpdateTaskStageCompleted,
|
|
UpdateTaskStageError,
|
|
UpdateTaskStageOBError,
|
|
UpdateTaskStageMAX
|
|
} UpdateTaskStage;
|
|
|
|
inline bool update_stage_is_error(const UpdateTaskStage stage) {
|
|
return stage >= UpdateTaskStageError;
|
|
}
|
|
|
|
typedef enum {
|
|
UpdateTaskStageGroupMisc = 0,
|
|
UpdateTaskStageGroupPreUpdate = 1 << 1,
|
|
UpdateTaskStageGroupFirmware = 1 << 2,
|
|
UpdateTaskStageGroupOptionBytes = 1 << 3,
|
|
UpdateTaskStageGroupRadio = 1 << 4,
|
|
UpdateTaskStageGroupPostUpdate = 1 << 5,
|
|
UpdateTaskStageGroupResources = 1 << 6,
|
|
UpdateTaskStageGroupSplashscreen = 1 << 7,
|
|
} UpdateTaskStageGroup;
|
|
|
|
typedef struct {
|
|
UpdateTaskStage stage;
|
|
uint8_t overall_progress, stage_progress;
|
|
FuriString* status;
|
|
UpdateTaskStageGroup groups;
|
|
uint32_t total_progress_points;
|
|
uint32_t completed_stages_points;
|
|
} UpdateTaskState;
|
|
|
|
typedef struct UpdateTask UpdateTask;
|
|
|
|
typedef void (
|
|
*updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state);
|
|
|
|
UpdateTask* update_task_alloc();
|
|
|
|
void update_task_free(UpdateTask* update_task);
|
|
|
|
void update_task_set_progress_cb(UpdateTask* update_task, updateProgressCb cb, void* state);
|
|
|
|
void update_task_start(UpdateTask* update_task);
|
|
|
|
bool update_task_is_running(UpdateTask* update_task);
|
|
|
|
UpdateTaskState const* update_task_get_state(UpdateTask* update_task);
|
|
|
|
UpdateManifest const* update_task_get_manifest(UpdateTask* update_task);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|