Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230...
authorCaisking <3449750381@qq.com>
Sat, 13 Apr 2024 08:48:49 +0000 (16:48 +0800)
committerCaisking <3449750381@qq.com>
Sat, 13 Apr 2024 08:48:49 +0000 (16:48 +0800)
1  2 
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp

@@@ -89,6 -86,6 +89,7 @@@ extern "C
          cywee_activity_result_t *cyweeInfo = nullptr; // 在switch语句外部定义变量
          int rets;
          PRINT("request %d\r\n", request->msgId);
++#if 0
          switch (request->msgId)
          {
          case TOPIC_EVENT_TREADMILL_UPDATE:
              // 处理未知msgId的情况
              break;
          }
++#endif
          delete cyweeInfo; // 释放内存
      }
  #ifdef __cplusplus
@@@ -194,12 -191,12 +196,14 @@@ namespace OHO
      TraingModel ::~TraingModel()
      {
          WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::~TraingModel()");
++#if 0
          // 取消订阅
          TraingUnsubscribeTopic(TOPIC_EVENT_TREADMILL_UPDATE);
          TraingUnsubscribeTopic(TOPIC_EVENT_OUTDOOR_RUNNING_UPDATE);
          TraingUnsubscribeTopic(TOPIC_EVENT_INDOOR_RUNNING_UPDATE);
          TraingUnsubscribeTopic(TOPIC_EVENT_FITNESS_PEDOMETERR_UPDATE);
          TraingUnsubscribeTopic(TOPIC_EVENT_FREE_TRAINING_UPDATE);
++#endif
      }
      TraingModel *TraingModel::GetInstance(void)
      {
  
      void TraingModel ::Init()
      {
++#if 0
          // 进行消息订阅
          TraingSubscribeTopic(TOPIC_EVENT_TREADMILL_UPDATE);
          TraingSubscribeTopic(TOPIC_EVENT_OUTDOOR_RUNNING_UPDATE);
          TraingSubscribeTopic(TOPIC_EVENT_INDOOR_RUNNING_UPDATE);
          TraingSubscribeTopic(TOPIC_EVENT_FITNESS_PEDOMETERR_UPDATE);
          TraingSubscribeTopic(TOPIC_EVENT_FREE_TRAINING_UPDATE);
++#endif
      }
  
      /* -------------------------------------------------------------------------- */
@@@ -230,49 -225,11 +225,49 @@@ namespace OHO
                  return true;\r
              }\r
          }\r
-         // 点击结束按键,弹窗显示\r
+         // 点击结束按键\r
          if (strcmp(view.GetViewId(), BUTTONEND) == 0)\r
          {\r
 -            ControlSensor(ExerciseState::End);\r
 +            ControlSensor(ExerciseState::Pause);\r
              // 弹窗显示是否结束\r
 +            TraingCardView::GetInstance()->SetEndViewStatus(true);\r
 +            TraingCardView::GetInstance()->RefreshEndView();\r
 +        }\r
 +        // 退出按键\r
 +        if (strcmp(view.GetViewId(), BUTTONEXIT) == 0)\r
 +        {\r
 +            TraingModel::GetInstance()->SetSportState(ExerciseState::End);\r
 +            ControlSensor(ExerciseState::End);\r
 +            if (TraingCardView::GetInstance()->RefreshEndView())\r
 +            {\r
 +                NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGWIN);\r
 +            }\r
 +            else\r
 +            {\r
 +                NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE);\r
 +            }\r
 +#if 0\r
 +            // 在点击事件中打印 SportData 对象之前,确保结束时间戳已经被设置\r
 +            if (TraingModel::GetInstance()->GetSportdata()->endtime == 0 && TraingModel::GetInstance()->GetSportState() == ExerciseState::End)\r
 +            {\r
 +                PRINT("RESET ENDTIMESTAMP\r\n");\r
 +                TraingModel::GetInstance()->SetTimestamp(); // 如果结束时间戳为0且当前为结束状态,再次调用 SetTimestamp 设置结束时间戳\r
 +            }\r
 +            // 打印 SportData 中的数据\r
 +            SportData *sportData = TraingModel::GetInstance()->GetSportdata();\r
 +\r
 +            std::string formattedStartTime = TraingModel::GetInstance()->AnalysisTimestamp(sportData->starttime);\r
 +            std::string formattedEndTime = TraingModel::GetInstance()->AnalysisTimestamp(sportData->endtime);\r
 +            std::string formattedTimeRange = formattedStartTime + "-" + formattedEndTime;\r
 +\r
 +            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "【SportData - StartTime: [%lu], EndTime: [%lu]  %s】", sportData->starttime, sportData->endtime, formattedTimeRange.c_str());\r
 +#endif\r
 +        }\r
 +        // 返回按键\r
 +        if (strcmp(view.GetViewId(), BUTTONBACK) == 0)\r
 +        {\r
 +            ControlSensor(ExerciseState::Continue);\r
 +            TraingCardView::GetInstance()->SetEndViewStatus(false);\r
          }\r
          return true;\r
      }\r