调整训练结束状态发送顺序 218/1 218/head
authorCaisking <3449750381@qq.com>
Mon, 3 Jun 2024 13:03:34 +0000 (21:03 +0800)
committerCaisking <3449750381@qq.com>
Mon, 3 Jun 2024 13:03:34 +0000 (21:03 +0800)
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp

index 053e2e5..20ad4b6 100644 (file)
@@ -281,17 +281,19 @@ namespace OHOS
         if (state != ExerciseState::General)
         {
             /*运动开始并且是app发起的运动*/
-            if (Openingway == true)
+            if (Openingway == true && state != ExerciseState::End)
             {
                 sendtraningstatedata(static_cast<uint8_t>(state), sportdata->duration);
             }
             else
             {
+#if 0
                 /*手表发起并且是结束状态*/
                 if (state == ExerciseState::End)
                 {
                     sendtraningstateend();
                 }
+#endif
             }
         }
         sportState_ = state;
@@ -467,6 +469,16 @@ namespace OHOS
             Startstate = false;
             Endstate = true;
 
+            /*保存数据之后再发送结束消息*/
+            if (Openingway == true)
+            {
+                sendtraningstatedata(static_cast<uint8_t>(ExerciseState::End), sportdata->duration);
+            }
+            else
+            {
+                sendtraningstateend();
+            }
+
             printf("结束运动\r\n");
         }
     }