From d3d89369ccb68d28eb33bfbd74b8f9b88936549e Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Wed, 30 Oct 2024 16:35:53 +0800 Subject: [PATCH] =?utf8?q?=E5=88=87=E6=8D=A2=E8=A1=A8=E7=9B=98=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/set_dial/src/SetDialModel.cpp | 5 ++- .../service/ble_service/bleservice/bleEvent.c | 37 +++++++++++++------ .../service/ble_service/bleservice/bleEvent.h | 2 + 3 files changed, 32 insertions(+), 12 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 d863b8587..7916642dd 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 @@ -23,7 +23,7 @@ #include #include #include - +#include "bleEvent.h" extern "C" { void check_dial_space() { OHOS::SetDialModel::GetInstance().CheckDialSpace(); } } @@ -414,6 +414,7 @@ void SetDialModel::UpdateDialSetting(uint16_t ID) { if (currentDialID == ID && ID >= 5) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateDialSetting: Current dial cannot be updated"); + reply_app_send_switchDialCmd(true); return; } @@ -436,10 +437,12 @@ void SetDialModel::UpdateDialSetting(uint16_t ID) { WEARABLE_LOG_MODULE_APP, "SetDialModel UpdateDialSetting: Cannot find dial with name %s", dialname.c_str()); + reply_app_send_switchDialCmd(true); return; // 更新成功后直接返回 } } } else { + reply_app_send_switchDialCmd(false); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateDialSetting: dial ID %d is offline dial", ID); } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index ace76337c..e50e05978 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -3847,6 +3847,21 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui } } +void reply_app_send_switchDialCmd(bool flag) +{ + uint8_t data; + if(flag) + { + data=1; + ble_reply_cmdarr(0x0102,&data,1); + } + else + { + data=3; + ble_reply_cmdarr(0x0102,&data,1); + } +} + //切换表盘 static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue) { @@ -3870,17 +3885,17 @@ static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total ble_set_dial_by_id(daila_type); - if(ble_get_dial_id()==daila_type) - { - value[17] = 1;//切换成功 - } - else - { - value[17] = 3;//切换失败 - } + // if(ble_get_dial_id()==daila_type) + // { + // value[17] = 1;//切换成功 + // } + // else + // { + // value[17] = 3;//切换失败 + // } - value[18] = Calculate_CRC(value,18); - sendBleData(value,19); + // value[18] = Calculate_CRC(value,18); + // sendBleData(value,19); }else { value[17] = 0;//校验失败 @@ -5780,7 +5795,7 @@ void type2AE3Data(ble_read_data *buffer_handle,uint8_t *cmd_buf ,uint8_t *data,u #ifdef BLE_LOG #endif - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"typeHexOneData:0x%04X\r\n",cmd); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"typeHexOneData:0x%04X\r\n",cmd); // uint8_t typeID = cmd_buf[2]; switch (cmd) { diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index c271094bd..9f607d4b3 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -839,6 +839,8 @@ void reply_APP_SportPasueResetCmd(uint16_t time); void reply_APP_SportStopModeCmd(uint16_t time); +void reply_app_send_switchDialCmd(bool flag); + void watch_clean_pairs(void); void reply_APP_OpenSportModeCmd(bool falg); -- 2.17.1