BSB Developer Docs
Loading...
Searching...
No Matches
updater_i.h
1#pragma once
2
3#include "updater.h"
4#include "update_checker/update_checker.h"
5
6#include <storage/storage.h>
7#include <power/power_service/power.h>
8
10#include <toolbox/api_lock.h>
11
12#define TAG "Updater"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef enum {
19 MessageTypeSessionStart,
20 MessageTypeSessionStop,
21 MessageTypeDownload,
22 MessageTypeVerifyBundleSha,
23 MessageTypeUnpack,
24 MessageTypeInstallationPrepare,
25 MessageTypeInstallationApply,
26 MessageTypeCheckForUpdate,
27 MessageTypeSetSettings,
28
29 MessageTypesCount
30} MessageType;
31
32typedef struct {
33 union {
34 struct {
35 FuriString* url;
36 FuriString* path;
37 } as_download;
38
39 struct {
40 FuriString* tar_path;
41 FuriString* sha;
42 } as_verify_bundle_sha;
43
44 struct {
45 FuriString* tar_path;
46 FuriString* staging_path;
47 FuriString* manifest_path;
48 } as_unpack;
49
50 struct {
51 FuriString* manifest_path;
52 } as_installation_prepare;
53
54 struct {
55 UpdateCheckInfo* info;
56 } as_get_check_info;
57
58 struct {
59 const UpdaterSettings* set_settings;
60 } as_set_settings;
61 };
62
63 FuriApiLock api_lock;
64 UpdaterStatus* result_status;
65 MessageType type;
67
68struct Updater {
69 Storage* storage;
70 Power* power;
71
72 FuriEventLoop* event_loop;
73 FuriMessageQueue* message_queue;
74 UpdaterSettings settings;
75 FuriState* settings_state;
76
77 FuriSemaphore* update_lock;
78 FuriState* update_state;
79
80#ifndef FW_CFG_recovery
81 FetchLoader* download_loader;
82 FuriMessageQueue* download_queue;
83
84 UpdateChecker* update_checker;
85 FuriState* check_state;
86 FuriEventLoopTimer* check_timer;
87 FuriMutex* check_info_mutex;
88 FuriString* check_version;
89 FuriString* check_url;
90 FuriString* check_id;
91 FuriString* check_sha256;
92 FuriString* check_changelog;
93
94 FuriString* install_url;
95 FuriString* install_sha256;
96 bool install_is_autoupdate;
97
98#ifdef SRV_TIME
99 FuriEventLoopTimer* autoupdate_timer;
100 FuriSemaphore* autoupdate_semaphore;
101#endif /* SRV_TIME */
102#endif /* FW_CFG_recovery */
103};
104
105UpdaterStatus updater_internal_invoke_async(Updater* instance, UpdaterMessage* message);
106UpdaterStatus updater_internal_invoke_sync(Updater* instance, UpdaterMessage* message);
107
108UpdaterStatus updater_internal_do_check_for_update(Updater* instance, UpdaterMessage* message);
109UpdaterStatus updater_internal_do_download(Updater* instance, UpdaterMessage* message);
110UpdaterStatus updater_internal_do_verify_bundle_sha(Updater* instance, UpdaterMessage* message);
111UpdaterStatus updater_internal_do_unpack(Updater* instance, UpdaterMessage* message);
112
113void updater_internal_settings_change_build_specific(
114 Updater* instance,
115 const UpdaterSettings* settings);
116
117void updater_internal_setup_build_specific(Updater* instance);
118
119#ifdef __cplusplus
120}
121#endif
Simple file downloader library.
APIs for working with storages, directories and files.
Definition fetch_loader.c:14
Definition power_i.h:112
Definition storage_i.h:20
Definition updater.h:114
Definition update_checker.c:17
Definition updater_i.h:68
Definition updater_i.h:32
Definition system/updater/settings/interface_v2.h:50
Firmware update system interface.
UpdaterStatus
Definition updater.h:23