切换表盘修改
authorhcj <1224667075@qq.com>
Wed, 30 Oct 2024 08:35:53 +0000 (16:35 +0800)
committerhcj <1224667075@qq.com>
Wed, 30 Oct 2024 08:35:53 +0000 (16:35 +0800)
code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h

index d863b85..7916642 100644 (file)
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unordered_set>
-
+#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);
   }
index ace7633..e50e059 100644 (file)
@@ -3847,6 +3847,21 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui
     }\r
 }\r
 \r
+void reply_app_send_switchDialCmd(bool flag)\r
+{\r
+    uint8_t data;\r
+    if(flag)\r
+    {\r
+        data=1;\r
+        ble_reply_cmdarr(0x0102,&data,1);\r
+    }\r
+    else\r
+    {\r
+        data=3;\r
+        ble_reply_cmdarr(0x0102,&data,1);\r
+    }\r
+}\r
+\r
 //切换表盘\r
 static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue)\r
 {\r
@@ -3870,17 +3885,17 @@ static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total
 \r
         ble_set_dial_by_id(daila_type);\r
 \r
-        if(ble_get_dial_id()==daila_type)\r
-        {\r
-            value[17] = 1;//切换成功\r
-        }\r
-        else\r
-        {\r
-            value[17] = 3;//切换失败\r
-        }\r
+        // if(ble_get_dial_id()==daila_type)\r
+        // {\r
+        //     value[17] = 1;//切换成功\r
+        // }\r
+        // else\r
+        // {\r
+        //     value[17] = 3;//切换失败\r
+        // }\r
         \r
-        value[18] = Calculate_CRC(value,18);\r
-        sendBleData(value,19);\r
+        // value[18] = Calculate_CRC(value,18);\r
+        // sendBleData(value,19);\r
     }else\r
     {\r
         value[17] = 0;//校验失败\r
@@ -5780,7 +5795,7 @@ void type2AE3Data(ble_read_data *buffer_handle,uint8_t *cmd_buf ,uint8_t *data,u
      #ifdef BLE_LOG\r
     \r
     #endif\r
-      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"typeHexOneData:0x%04X\r\n",cmd);\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"typeHexOneData:0x%04X\r\n",cmd);\r
     // uint8_t typeID = cmd_buf[2];\r
     switch (cmd)\r
     {\r
index c271094..9f607d4 100644 (file)
@@ -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);