1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef UPDATER_FLASHING_H 17 #define UPDATER_FLASHING_H 18 19 #include <string> 20 21 namespace Flashd { 22 enum { 23 FLASHING_SYSTEM_ERROR = 100, 24 FLASHING_ARG_INVALID, 25 FLASHING_IMAGE_INVALID, 26 FLASHING_PART_NOEXIST, 27 FLASHING_NOPERMISSION, 28 FLASHING_PART_WRITE_ERROR, 29 FLASHING_PACKAGE_INVALID, 30 FLASHING_SPACE_NOTENOUGH, 31 FLASHING_INVALID_SPACE, 32 FLASHING_FSTYPE_NOT_SUPPORT, 33 FLASHING_OPEN_PART_ERROR, 34 }; 35 36 enum class CmdType : uint8_t { 37 UPDATE = 0, 38 FLASH, 39 ERASE, 40 FORMAT, 41 UNKNOWN 42 }; 43 44 static constexpr uint8_t PERCENT_FINISH = 100; 45 static constexpr uint8_t PERCENT_CLEAR = UINT8_MAX; 46 47 #ifndef UPDATER_UT 48 constexpr const char *FLASHD_FILE_PATH = "/data/updater/"; 49 constexpr const char *FLASHD_HDC_LOG_PATH = "/tmp/flashd_hdc.log"; 50 #else 51 constexpr const char *FLASHD_FILE_PATH = "/data/updater/updater/"; 52 constexpr const char *FLASHD_HDC_LOG_PATH = "/data/updater/flashd_hdc.log"; 53 #endif 54 } // namespace Flashd 55 #endif /* UPDATER_FLASHING_H */ 56