lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #ifndef __FOTA_COMMON_H__ |
| 2 | #define __FOTA_COMMON_H__ |
| 3 | |
| 4 | #define ZTE_FOTA_UPDATEFLAG_LEN 32 |
| 5 | #define ZTE_FOTA_NETDOG_FLAG_LEN 256 |
| 6 | #define ZTE_FOTA_FLAG_LEN ZTE_FOTA_NETDOG_FLAG_LEN+ZTE_FOTA_UPDATEFLAG_LEN+4 |
| 7 | |
| 8 | #define ZTE_FOTA_PARTITION_STR_LEN 32 |
| 9 | |
| 10 | typedef struct { |
| 11 | char update_flag[ZTE_FOTA_UPDATEFLAG_LEN]; |
| 12 | int state_flag; |
| 13 | char netdog_flag[ZTE_FOTA_NETDOG_FLAG_LEN]; |
| 14 | void* reserve; |
| 15 | |
| 16 | } fotaflag_t; |
| 17 | |
| 18 | typedef enum { |
| 19 | STATEFLAG_NULL = 0, |
| 20 | RECOVERY, |
| 21 | RECOVERY_KERNEL, |
| 22 | CPUM0, |
| 23 | CPUZSP, |
| 24 | CPUR7, |
| 25 | CPUAP, |
| 26 | CPFS, |
| 27 | USERDATA, |
| 28 | SECUREFS |
| 29 | } stateflag_t; |
| 30 | |
| 31 | typedef struct { |
| 32 | stateflag_t stateflag; |
| 33 | char name[ZTE_FOTA_PARTITION_STR_LEN]; |
| 34 | } stateflag_print_t; |
| 35 | |
| 36 | typedef enum { |
| 37 | SNTP_FAILED = 0, |
| 38 | MEMORY_ALLOC_FAILED, |
| 39 | NETWORK_NOT_AVAILABLE, |
| 40 | DMSESSION_ABORTED_HIGH, |
| 41 | DMSESSION_ABORTED_LOW, |
| 42 | DLSESSION_ABORTED_HIGH, |
| 43 | DLSESSION_ABORTED_LOW, |
| 44 | IMEI_INVALID, |
| 45 | CR_INNER_VERSION_INVALID, |
| 46 | } netdogflag_error_t; |
| 47 | |
| 48 | #define NET_DOG_INIT_FLAG 0xFF |
| 49 | #define NET_DOG_EXCEPTION_FLAG 1 |
| 50 | |
| 51 | //UPDATE_STATE |
| 52 | #define IDLE "idle" |
| 53 | #define CHECKING "checking" |
| 54 | #define CHECK_COMPLETE "check_complete" |
| 55 | #define WAIT_CONFIRM "wait_confirm" |
| 56 | #define DOWNLOADING "downloading" |
| 57 | #define DOWNLOAD_SUCCESS "download_success" |
| 58 | #define DOWNLOAD_FAILED "download_failed" |
| 59 | #define LOW_BATTERY "low_battery" |
| 60 | #define PREPARE_INSTALL "prepare_install" |
| 61 | #define NONE "none" |
| 62 | |
| 63 | //new version state has state below |
| 64 | |
| 65 | //#define IDLE "idle" |
| 66 | #define CHECK_FAILED "check_failed" |
| 67 | #define ROAMING "roaming" |
| 68 | #define BAD_NETWORK "bad_network" |
| 69 | #define NO_NEW_VERSION "no_new_version" |
| 70 | #define HAS_OPTIONAL "has_optional" |
| 71 | #define HAS_CRITICAL "has_critical" |
| 72 | #define PKG_TOO_BIG "pkg_too_big" |
| 73 | #define ALREADY_HAS_PKG "already_has_pkg" |
| 74 | |
| 75 | |
| 76 | |
| 77 | // nv Ïà¹Ø |
| 78 | |
| 79 | |
| 80 | #define NV_FOTA_PKG_TOTAL_SIZE "fota_pkg_total_size" |
| 81 | #define NV_FOTA_PKG_DL_SIZE "fota_dl_pkg_size" |
| 82 | #define NV_FOTA_DM_VENDOR "fota_dm_vendor" |
| 83 | |
| 84 | /*polling Ïà¹Ø*/ |
| 85 | /*¸ø²âÊÔÈËÔ±¶ÁȡʹÓÃ*/ |
| 86 | #define NV_DM_NEXTPOLLINGTIME "dm_nextpollingtime" |
| 87 | /*unit in second, ʵ¼ÊʹÓÃÕâ¸ö*/ |
| 88 | #define NV_FOTA_POLLING_NEXT_TIME "polling_nexttime" |
| 89 | |
| 90 | #define NV_DM_FOTA_ALLOW_ROAMING "fota_allowRoamingUpdate" //"dm_fota_allow_roaming" |
| 91 | #define NV_DM_POLLINGCYCLE "fota_updateIntervalDay" //"dm_pollingcycle" |
| 92 | #define NV_DM_POLLINGSWITCH "fota_updateMode" //"dm_pollingswitch" |
| 93 | #define NV_FOTA_TESTMODE_SWITCH "fota_test_mode" //fota test mode switch |
| 94 | |
| 95 | |
| 96 | /*¸ÃnvÊÇÔÚrcÆô¶¯½Å±¾ÖÐʹÓÃ*/ |
| 97 | #define NV_UPDATE_TYPE "update_type" |
| 98 | |
| 99 | |
| 100 | |
| 101 | #define NV_FOTA_NEW_VERSION_STATE "fota_new_version_state" |
| 102 | #define NV_FOTA_CURR_UPGRADE_STATE "fota_current_upgrade_state" |
| 103 | #define NV_FOTA_UPGRADE_SELECTOR "fota_upgrade_selector" |
| 104 | #define NV_FOTA_NEED_USER_CONFIRM_DOWNLOAD "fota_need_user_confirm_download" |
| 105 | #define NV_FOTA_NEED_USER_CONFIRM_UPDATE "fota_need_user_confirm_update" |
| 106 | |
| 107 | /* |
| 108 | 1. when poweron, it will be init according to the delta.package file |
| 109 | 2. when downloaded, it will be set |
| 110 | 3. it does not exist in the default_parameter_user file, it means when restart, it must be reinit |
| 111 | */ |
| 112 | #define NV_FOTA_PKG_EXIST "fota_package_already_download" |
| 113 | #define NV_FOTA_PACKAGE_ALREADY_DOWNLOAD "fota_package_already_download" |
| 114 | |
| 115 | |
| 116 | /*ÓÐÈý¸ö¸üнá¹û£¬ÐèÒªÓÅ»¯*/ |
| 117 | #define NV_FOTA_UPGRADE_RESULT "fota_upgrade_result" |
| 118 | #define NV_FOTA_UPGRADE_RESULT_MMI "fota_upgrade_result_mmi" |
| 119 | |
| 120 | |
| 121 | /*goadhead ÈÔÈ»ÔÚʹÓÃ*/ |
| 122 | #define NV_FOTA_DM_LAST_CHECK_TIME "dm_last_check_time" |
| 123 | |
| 124 | #define NV_FOTA_VERSION_NAME "fota_version_name" |
| 125 | #define NV_FOTA_VERSION_DELTA_ID "fota_version_delta_id" |
| 126 | #define NV_FOTA_VERSION_DELTA_URL "fota_version_delta_url" |
| 127 | #define NV_FOTA_VERSION_MD5SUM "fota_version_md5sum" |
| 128 | |
| 129 | #define NV_FOTA_OEM "fota_oem" |
| 130 | #define NV_FOTA_TOKEN "fota_token" |
| 131 | #define NV_FOTA_DEVICE_TYPE "fota_device_type" |
| 132 | #define NV_FOTA_PLATFORM "fota_platform" |
| 133 | #define NV_FOTA_MODELS "fota_models" |
| 134 | |
| 135 | // add by new libdmgr |
| 136 | #define NV_FOTA_PRODUCTID "fota_product_id" |
| 137 | #define NV_FOTA_PRODUCTSECRET "fota_product_secret" |
| 138 | #define NV_FOTA_APPVERSION "fota_app_version" |
| 139 | #define NV_FOTA_NETWORKTYPE "fota_network_type" |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | #define NV_FOTA_DL_URL "fota_dl_url" |
| 145 | #define NV_FOTA_CHK_URL "fota_chk_url" |
| 146 | #define NV_FOTA_REG_URL "fota_reg_url" |
| 147 | #define NV_FOTA_REPORT_DLR_URL "fota_report_dlr_url" |
| 148 | #define NV_FOTA_REPORT_UPGR_URL "fota_report_upgr_url" |
| 149 | #define NV_FOTA_REPORT_SALES_URL "fota_report_sales_url" |
| 150 | |
| 151 | /* |
| 152 | SNTP ¸üÐÂģʽ£¬¿ÉÒÔȡֵ |
| 153 | manual |
| 154 | auto |
| 155 | */ |
| 156 | //#define NV_SYSTIME_MODE "systime_mode" |
| 157 | #define NV_SNTP_MANUAL_MODE "manual" |
| 158 | #define NV_SNTP_AUTO_MODE "auto" |
| 159 | #define NV_SNTP_PROCESS_RESULT "sntp_process_result" |
| 160 | /* |
| 161 | ÍøÂç״̬ |
| 162 | International:::Internal:::Home*/ |
| 163 | #define NV_SIMCARD_ROAM "simcard_roam" |
| 164 | #define NV_MODEM_MAIN_STATE "modem_main_state" |
| 165 | |
| 166 | /*wa_inner_mod = ZTE_MF910S MF910W MF922*/ |
| 167 | #define NV_WA_INNER_MOD "wa_inner_mod" |
| 168 | #define NV_IMEI "imei" |
| 169 | #define NV_CR_INNER_VERSION "cr_inner_version" |
| 170 | #define NV_HARDWARE_VERSION "hardware_version" |
| 171 | |
| 172 | #define UPGRADE_STATE_ACCEPT "accept" |
| 173 | #define UPGRADE_STATE_CANCEL "cancel" |
| 174 | |
| 175 | #define UPGRADE_SELECTOR_NONE "none" |
| 176 | #define UPGRADE_SELECTOR_ACCEPT "accept" |
| 177 | #define UPGRADE_SELECTOR_CANCEL "cancel" |
| 178 | |
| 179 | #define UPDATE_SUCCESS "success" |
| 180 | #define UPDATE_FAIL "fail" |
| 181 | |
| 182 | #define SUCCESS_STRING "success" |
| 183 | /***********************************************/ |
| 184 | |
| 185 | /*****************NV_SIMCARD_ROAM***************/ |
| 186 | typedef enum NetworkStatus_tag { |
| 187 | NETWORK_IDLE, |
| 188 | ROAMING_HOME, |
| 189 | ROAMING_INTERNATIONAL, |
| 190 | ROAMING_INTERNAL, |
| 191 | ROAMING_NA, |
| 192 | HAS_USER_DATA, |
| 193 | CHANGE_APN_FAIL, |
| 194 | NO_SIMCARD_INSERTED, |
| 195 | NETWORK_AVAILABLE |
| 196 | } NetworkStatus; |
| 197 | |
| 198 | #define ROAM_INTERNATIONAL "International" |
| 199 | #define ROAM_INTERNAL "Internal" |
| 200 | #define ROAM_HOME "Home" |
| 201 | |
| 202 | /***********************************************/ |
| 203 | |
| 204 | /****************NV_MODEM_MAIN_STATE*************/ |
| 205 | #define MODEM_MAIN_STATE_MODEM_SIM_UNDETECTED "modem_sim_undetected" |
| 206 | /***********************************************/ |
| 207 | |
| 208 | /****************NV_FOTA_STATE*******************/ |
| 209 | #define FOTA_SEARCH_FAILED "fota_search_failed" |
| 210 | /***********************************************/ |
| 211 | |
| 212 | /***********NV_FOTA_PKG_DL_CHECK_RESUL************/ |
| 213 | #define FOTA_PKG_DL_FAILED "fota_pkg_dl_failed" |
| 214 | /***********************************************/ |
| 215 | |
| 216 | |
| 217 | #define ZTE_FOTA_MAIN_PATH "/cache/zte_fota/" |
| 218 | #define FOTAUPI ZTE_FOTA_MAIN_PATH"upi.log" |
| 219 | #define FOTARB ZTE_FOTA_MAIN_PATH"lib.log" |
| 220 | #define FOTADM ZTE_FOTA_MAIN_PATH"dm.log" |
| 221 | #define FOTA_UPDATE_STATUS_FILE ZTE_FOTA_MAIN_PATH"update_status" |
| 222 | #define FOTA_UPDATE_STATUS_FILE_OLD ZTE_FOTA_MAIN_PATH"/dua/update_status" |
| 223 | |
| 224 | |
| 225 | |
| 226 | #define FOTA_PACKAGE_FILE ZTE_FOTA_MAIN_PATH"delta.package" |
| 227 | #define FOTA_PACKAGE_FILE_FAILED ZTE_FOTA_MAIN_PATH"delta.package.failed" |
| 228 | #define CHARGER_VOLTAGE_FILE "/sys/class/power_supply/battery/voltage_now" |
| 229 | #define FOTA_DM_UPGRADE_TEMP ZTE_FOTA_MAIN_PATH"upgrade_temp" |
| 230 | #define FOTA_DM_META_FILE ZTE_FOTA_MAIN_PATH"meta_data" |
| 231 | |
| 232 | |
| 233 | #define DL_TMP_FILENAME ZTE_FOTA_MAIN_PATH"process_delta.package" //¹ãÉý¶ÏµçÐø´«ÏÂÔØ¹ý³ÌÖÐÁÙʱÎļþ |
| 234 | |
| 235 | #define DELTA_VERIFY_FAILED ZTE_FOTA_MAIN_PATH"delta.package.verifyFailed" |
| 236 | #define DELTA_RECO_FAILED ZTE_FOTA_MAIN_PATH"delta.package.recoFailed" |
| 237 | #define DELTA_SYS_FAILED ZTE_FOTA_MAIN_PATH"delta.package.systemFailed" |
| 238 | |
| 239 | #define FOTA_DLSVR_DOMAIN "mg.adups.cn" |
| 240 | |
| 241 | |
| 242 | #endif |