if (OtaSuccessView::GetInstance()) {
OtaSuccessView::GetInstance()->UpdateDownloadSuccess("模组升级成功");
}
+#ifdef SUPPORT_CAT1_SERVICE
+ /* 以 g_ln_last_package_url_new2/new1(getTask 写入)中的 PY_SRV_Vxx 为准 */
+ if (status == 4 && ln_cat1_last_package_urls_target_py() == 34) {
+ (void)UtilsSetValue("cat1_py34_upgrade_done", "1");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "CheckOtaResult: Cat1 success, URL target py=34, KV cat1_py34_upgrade_done=1");
+ }
+#endif
}
SetOtaStatus(OTA_UI_STATUS_NOT_START);
ThunderBirdModel::GetInstance()->ResetOtaStatus();
namespace {
-/** 当前手表软件版本是否为 1.0.47(仅用 uapi_get_fw_version,避免链接 build_version 的 get_version_string) */
+/** KV:Cat1 已成功升到 py34,开机不再直进 1.0.47 升级中(离线读 py 不准,以 KV 为准) */
+static constexpr const char *kKvCat1Py34UpgradeDone = "cat1_py34_upgrade_done";
+
+/** 是否满足「1.0.47 开机可直进 Cat1」的软件条件(KV 已标记 py34 升级成功则视为 false) */
static bool IsSoftwareVersion_1_0_47(void)
{
+ char mark[8] = {0};
+ (void)UtilsGetValue(kKvCat1Py34UpgradeDone, mark, sizeof(mark));
+ if (strcmp(mark, "1") == 0) {
+ return false;
+ }
uint8_t major = 0;
uint8_t mid = 0;
uint8_t minor = 0;
- uint8_t py = uapi_get_py_ver();
- return uapi_get_fw_version(&major, &mid, &minor) == ERRCODE_SUCC && major == 1 && mid == 0 && minor == 47 && py!=34;
+ return uapi_get_fw_version(&major, &mid, &minor) == ERRCODE_SUCC && major == 1 && mid == 0 && minor == 47;
}
} // namespace
#include <osal_msgqueue.h>
#include <soc_osal.h>
#include "stdio.h"
+#include <stdlib.h>
+#include <string.h>
#include "custom_utils.h"
#include "ai_media.h"
/* for DNS resolution */
char g_ln_last_package_url_new1[256] = {0};
char g_ln_last_package_url_new2[256] = {0};
+static int ln_cat1_parse_py_srv_v_from_url(const char *url)
+{
+ if (url == NULL || url[0] == '\0') {
+ return -1;
+ }
+ const char *p = strstr(url, "PY_SRV_V");
+ if (p == NULL) {
+ return -1;
+ }
+ char *end = NULL;
+ long v = strtol(p + 8, &end, 10);
+ if (end == p + 8 || v <= 0L || v > 255L) {
+ return -1;
+ }
+ return (int)v;
+}
+
+int ln_cat1_last_package_urls_target_py(void)
+{
+ int v = ln_cat1_parse_py_srv_v_from_url(g_ln_last_package_url_new2);
+ if (v < 0) {
+ v = ln_cat1_parse_py_srv_v_from_url(g_ln_last_package_url_new1);
+ }
+ return v;
+}
+
/* 简单的字符串读写(以.bin形式读写原始字节,末尾补'\0')*/
static int ln_read_string_file(const char *file_path, char **out_str)
{
/* -------------------------------------------------------------------------- */
extern char g_ln_last_package_url_new1[256];
extern char g_ln_last_package_url_new2[256];
+/** 从最近一次 Cat1 双包 URL 解析目标 py(路径中含 PY_SRV_Vxx,优先 new2)。失败返回 -1 */
+int ln_cat1_last_package_urls_target_py(void);
#define LN_HTTP_SERVICE_CMD_OTA_GET_TASK_NEW 0x1018
#define LN_HTTP_SERVICE_CMD_OTA_GET_TASK_CAT1_RUN 0x1019
uint32_t ln_ota_get_task_http_CAT1(const char *device_id,