1190978c3Sopenharmony_ci/*
2190978c3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3190978c3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4190978c3Sopenharmony_ci * you may not use this file except in compliance with the License.
5190978c3Sopenharmony_ci * You may obtain a copy of the License at
6190978c3Sopenharmony_ci *
7190978c3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8190978c3Sopenharmony_ci *
9190978c3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10190978c3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11190978c3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12190978c3Sopenharmony_ci * See the License for the specific language governing permissions and
13190978c3Sopenharmony_ci * limitations under the License.
14190978c3Sopenharmony_ci */
15190978c3Sopenharmony_ci
16190978c3Sopenharmony_ci#ifndef FIRMWARE_CONSTANT_H
17190978c3Sopenharmony_ci#define FIRMWARE_CONSTANT_H
18190978c3Sopenharmony_ci
19190978c3Sopenharmony_ci#include <vector>
20190978c3Sopenharmony_ci
21190978c3Sopenharmony_ci#include "constant.h"
22190978c3Sopenharmony_ci
23190978c3Sopenharmony_cinamespace OHOS {
24190978c3Sopenharmony_cinamespace UpdateEngine {
25190978c3Sopenharmony_cinamespace Firmware {
26190978c3Sopenharmony_ciconstexpr double HALF_PROGRESS = 0.5;
27190978c3Sopenharmony_ciconstexpr int32_t NIGHT_UPGRADE_START_HOUR = 2;
28190978c3Sopenharmony_ciconstexpr int32_t NIGHT_UPGRADE_END_HOUR = 4;
29190978c3Sopenharmony_ciconstexpr int32_t VER_CARRY_DEVICE_ID = 2;
30190978c3Sopenharmony_ci
31190978c3Sopenharmony_cistatic const std::string HOTA_CURRENT_COMPONENT_ID = "hota_current_component_id";
32190978c3Sopenharmony_ci
33190978c3Sopenharmony_cistatic const std::string UPDATE_ACTION = "update_action"; // recovery upgrade
34190978c3Sopenharmony_ci
35190978c3Sopenharmony_cistatic const std::string PACKAGE_ROOT_PATH = Constant::DUPDATE_ENGINE_PACKAGE_ROOT_PATH + "/firmware";
36190978c3Sopenharmony_cistatic const std::string PACKAGE_PATH = PACKAGE_ROOT_PATH + "/versions";
37190978c3Sopenharmony_ci
38190978c3Sopenharmony_cistatic const std::string ENCRYPTED_ROOT_PATH = Constant::FILES_ROOT_PATH + "/firmware";
39190978c3Sopenharmony_cistatic const std::string CHANGELOG_PATH = ENCRYPTED_ROOT_PATH + "/changelogs";
40190978c3Sopenharmony_ci
41190978c3Sopenharmony_cistatic const std::string AUTO_DOWNLOAD_SWITCH = "auto_download_switch"; // 自动下载开关
42190978c3Sopenharmony_ci
43190978c3Sopenharmony_ciconstexpr float COMPRESSION_RATIO = 0.2;
44190978c3Sopenharmony_ci
45190978c3Sopenharmony_ciconstexpr int32_t ONE_HUNDRED = 100;
46190978c3Sopenharmony_ci
47190978c3Sopenharmony_ciconst std::string BOOTSLOTS_DEFAULT_VALUE = "0";
48190978c3Sopenharmony_ciconst std::string BOOTSLOTS_AB_UPDATE_VALUE = "2";
49190978c3Sopenharmony_ciconstexpr int32_t SLEEP_TIME_BEFORE_REBOOT = 2;
50190978c3Sopenharmony_ci
51190978c3Sopenharmony_ci} // namespace Firmware
52190978c3Sopenharmony_ci
53190978c3Sopenharmony_cistatic const std::vector<DirInfo> FIRMWARE_DIR_INFOS {
54190978c3Sopenharmony_ci    {Firmware::ENCRYPTED_ROOT_PATH, 0700, true},
55190978c3Sopenharmony_ci    {Firmware::CHANGELOG_PATH, 0700, true},
56190978c3Sopenharmony_ci    {Firmware::PACKAGE_ROOT_PATH, 0770, true},
57190978c3Sopenharmony_ci    {Firmware::PACKAGE_PATH, 0770, true}
58190978c3Sopenharmony_ci};
59190978c3Sopenharmony_ci} // namespace UpdateEngine
60190978c3Sopenharmony_ci} // namespace OHOS
61190978c3Sopenharmony_ci#endif // FIRMWARE_CONSTANT_H
62