Loading...
Searching...
No Matches
update_operation.h
1#pragma once
2
3#include <stdbool.h>
4#include <storage/storage.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC 0
11#define UPDATE_OPERATION_MAX_MANIFEST_PATH_LEN 255u
12#define UPDATE_OPERATION_MIN_MANIFEST_VERSION 2
13
14/*
15 * Checks if supplied full manifest path is valid
16 * @param full_path Full path to manifest file. Must be named UPDATE_MANIFEST_DEFAULT_NAME
17 * @param out_manifest_dir Directory to apply update from, if supplied path is valid.
18 * May be empty if update is in root update directory
19 * @return bool if supplied path is valid and out_manifest_dir contains dir to apply
20 */
21bool update_operation_get_package_dir_name(const char* full_path, FuriString* out_manifest_dir);
22
23/* When updating this enum, also update assets/protobuf/system.proto */
24typedef enum {
25 UpdatePrepareResultOK,
26 UpdatePrepareResultManifestPathInvalid,
27 UpdatePrepareResultManifestFolderNotFound,
28 UpdatePrepareResultManifestInvalid,
29 UpdatePrepareResultStageMissing,
30 UpdatePrepareResultStageIntegrityError,
31 UpdatePrepareResultManifestPointerCreateError,
32 UpdatePrepareResultManifestPointerCheckError,
33 UpdatePrepareResultTargetMismatch,
34 UpdatePrepareResultOutdatedManifestVersion,
35 UpdatePrepareResultIntFull,
36 UpdatePrepareResultUnspecifiedError,
37} UpdatePrepareResult;
38
39const char* update_operation_describe_preparation_result(const UpdatePrepareResult value);
40
41/*
42 * Validates next stage and sets up registers to apply update after restart
43 * @param manifest_dir_path Full path to manifest for update to apply
44 * @return UpdatePrepareResult validation & arm result
45 */
46UpdatePrepareResult update_operation_prepare(const char* manifest_file_path);
47
48/*
49 * Gets filesystem path for current update package
50 * @param storage Storage API
51 * @param out_path Path to manifest. Must be initialized
52 * @return true if path was restored successfully
53 */
54bool update_operation_get_current_package_manifest_path(Storage* storage, FuriString* out_path);
55
56/*
57 * Checks if an update operation step is pending after reset
58 */
59bool update_operation_is_armed(void);
60
61/*
62 * Cancels pending update operation
63 */
64void update_operation_disarm(void);
65
66#ifdef __cplusplus
67}
68#endif
APIs for working with storages, directories and files.
Definition string.c:4
Definition storage_i.h:23