From 1d5aed38c4043f343b5b54b63979d426c87cc40b Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 24 Sep 2024 11:54:10 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89?= =?utf8?q?=E8=A1=A8=E7=9B=98ID=E4=B8=8D=E8=83=BD=E5=AF=B9=E5=BA=94?= =?utf8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/set_dial/src/SetDialModel.cpp | 21 ++++++++++++++++++- .../service/ble_service/blemoder/bletest.cpp | 4 ---- 2 files changed, 20 insertions(+), 5 deletions(-) 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; -- 2.17.1