Flipper Zero Firmware
Loading...
Searching...
No Matches
update_task.h
1#pragma once
2
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <update_util/update_manifest.h>
8
9#include <stdint.h>
10#include <stdbool.h>
11
12#define UPDATE_DELAY_OPERATION_OK 10
13#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
14
15typedef enum {
16 UpdateTaskStageProgress = 0,
17
18 UpdateTaskStageReadManifest,
19 UpdateTaskStageLfsBackup,
20
21 UpdateTaskStageRadioImageValidate,
22 UpdateTaskStageRadioErase,
23 UpdateTaskStageRadioWrite,
24 UpdateTaskStageRadioInstall,
25 UpdateTaskStageRadioBusy,
26
27 UpdateTaskStageOBValidation,
28
29 UpdateTaskStageValidateDFUImage,
30 UpdateTaskStageFlashWrite,
31 UpdateTaskStageFlashValidate,
32
33 UpdateTaskStageLfsRestore,
34 UpdateTaskStageResourcesFileCleanup,
35 UpdateTaskStageResourcesDirCleanup,
36 UpdateTaskStageResourcesFileUnpack,
37 UpdateTaskStageSplashscreenInstall,
38
39 UpdateTaskStageCompleted,
40 UpdateTaskStageError,
41 UpdateTaskStageOBError,
42 UpdateTaskStageMAX
43} UpdateTaskStage;
44
45inline bool update_stage_is_error(const UpdateTaskStage stage) {
46 return stage >= UpdateTaskStageError;
47}
48
49typedef enum {
50 UpdateTaskStageGroupMisc = 0,
51 UpdateTaskStageGroupPreUpdate = 1 << 1,
52 UpdateTaskStageGroupFirmware = 1 << 2,
53 UpdateTaskStageGroupOptionBytes = 1 << 3,
54 UpdateTaskStageGroupRadio = 1 << 4,
55 UpdateTaskStageGroupPostUpdate = 1 << 5,
56 UpdateTaskStageGroupResources = 1 << 6,
57 UpdateTaskStageGroupSplashscreen = 1 << 7,
58} UpdateTaskStageGroup;
59
60typedef struct {
61 UpdateTaskStage stage;
62 uint8_t overall_progress, stage_progress;
63 FuriString* status;
64 UpdateTaskStageGroup groups;
65 uint32_t total_progress_points;
66 uint32_t completed_stages_points;
68
69typedef struct UpdateTask UpdateTask;
70
71typedef void (
72 *updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state);
73
74UpdateTask* update_task_alloc(void);
75
76void update_task_free(UpdateTask* update_task);
77
78void update_task_set_progress_cb(UpdateTask* update_task, updateProgressCb cb, void* state);
79
80void update_task_start(UpdateTask* update_task);
81
82bool update_task_is_running(UpdateTask* update_task);
83
84UpdateTaskState const* update_task_get_state(UpdateTask* update_task);
85
86UpdateManifest const* update_task_get_manifest(UpdateTask* update_task);
87
88#ifdef __cplusplus
89}
90#endif
Definition string.c:4
Definition update_manifest.h:29
Definition update_task_i.h:9
Definition update_task.h:60