From: hcj <1224667075@qq.com> Date: Tue, 24 Sep 2024 03:54:10 +0000 (+0800) Subject: 修复自定义表盘ID不能对应问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1005%2F5;p=mirrors%2FFD230.git 修复自定义表盘ID不能对应问题 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp index 0f9c7301d..365c179e1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp @@ -178,7 +178,12 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentDialID is %d,name is %s", currentDialID, registeredDials[currentDialID].c_str()); } - return currentDialID; + uint16_t id=currentDialID; + if(currentDialID<=5) + { + id--; + } + return id; } /* 获取所有表盘Id 每个表盘Id 2个字节 拼接为字符串 */ int SetDialModel::GetAllDialIDs(char *allidStr) @@ -202,6 +207,11 @@ namespace OHOS /* 判断表盘是否存在*/ bool SetDialModel::IsDialInstalled(uint16_t ID) { + if(ID<=4) + { + ID++; + } + if (registeredDials.find(ID) != registeredDials.end()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dial %d is install!", ID); @@ -216,6 +226,10 @@ namespace OHOS /* 删除表盘 */ bool SetDialModel::UninstallDial(uint16_t ID) { + if(ID<=4) + { + ID++; + } if (registeredDials.find(ID) != registeredDials.end()) { // 默认表盘不删除[日志提醒] @@ -255,6 +269,11 @@ namespace OHOS /*更新表盘*/ void SetDialModel::UpdateDialSetting(uint16_t ID) { + if(ID<=4) + { + ID++; + } + if (registeredDials.find(ID) != registeredDials.end()) { std::string dialname = registeredDials[ID]; // 根据ID找到对应的表盘名称 diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 2e3086efa..7fe6914b1 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -872,10 +872,6 @@ uint16_t ble_get_dial_id(void) uint16_t id= OHOS::SetDialModel::GetInstance().GetCurrentDialID(); - if(id<=5) - { - id--; - } return id; #else return 0;