删除ECG,情绪冗余代码 1889/1
authorxue <2144439972@qq.com>
Wed, 25 Jun 2025 09:00:37 +0000 (17:00 +0800)
committerxue <2144439972@qq.com>
Wed, 25 Jun 2025 09:00:37 +0000 (17:00 +0800)
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPModel.h
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPModel.cpp
code/sdk/application/wearable/fd230app/nativeui/ecg/include/EcgModel.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/ecg/src/EcgModel.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/ecg/src/EcgPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/emotion/include/EmoModel.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/emotion/include/EmoPresenter.h
code/sdk/application/wearable/fd230app/nativeui/emotion/src/EmoModel.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/emotion/src/EmoPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp

index 9d7b92e..1c6084c 100644 (file)
@@ -249,7 +249,6 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectFailView.cpp 
 
     # ECG
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgModel.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgPresenter.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/ecg/src/EcgStartTestView.cpp 
@@ -265,7 +264,6 @@ set(SOURCES
     # emotion
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoView.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoTestView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoTestAnalysisView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/emotion/src/EmoTestResultView.cpp
index 84f44b9..5b400b0 100644 (file)
@@ -27,6 +27,8 @@ namespace OHOS
     STRESS_MEASURE,
     // 疲劳度测量中
     FATIGUE_MEASURE,
+    // ECG提示中
+    ECG_REMIND,
     // ECG测量中
     ECG_MEASURE,
     // 情绪测量中
@@ -37,6 +39,8 @@ namespace OHOS
     FATIGUE_ANALYSIS,
     // ECG分析中
     ECG_ANALYSIS,
+    // ECG结果中
+    ECG_RESULT,
     // 情绪分析中
     EMO_ANALYSIS,
     // 普通状态
@@ -66,6 +70,7 @@ namespace OHOS
 
 #define BP_CHECK_TIME_MAX 30 //测量所需时间
 #define BP_ANLYSISI_TIME_MAX 5 //分析所需时间
+#define BP_REMIND_TIME_MAX 5 //提醒所需时间
   class BPModel
   {
   public:
index f0e6f5f..6b5f314 100644 (file)
 #include "stress/include/StressAnalysisView.h"
 #include "fatiguelevel/include/FatigueMainView.h"
 #include "fatiguelevel/include/FatigueAnalysisView.h"
+#include "emotion/include/EmoView.h"
+#include "emotion/include/EmoPresenter.h"
+#include "ecg/include/EcgView.h"
+#include "ecg/include/EcgPresenter.h"
+#include "ecg/include/EcgTestingView.h"
 
 #include "wearable_log.h"
 #include <cmsis_os.h>
@@ -155,6 +160,16 @@ namespace OHOS
         Time = BP_ANLYSISI_TIME_MAX; // 重置时间
       break;
     }
+    case BPState::ECG_REMIND:
+    case BPState::ECG_RESULT:
+    {
+      BP_StartTimer();
+      ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 后期 周期被动状态 需要做区别
+
+      if (Time != BP_REMIND_TIME_MAX)
+        Time = BP_REMIND_TIME_MAX; // 重置时间
+      break;
+    }
 
     default:
       /*未知状态,全部状态重置*/
@@ -274,6 +289,32 @@ namespace OHOS
         BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
         FatigueAnalysisView::GetInstance()->startorstopAnalysisAni(false);
       }
+      else if (EmoView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::STRESS_ANALYSIS) // 情绪检测完
+      {
+        EmoPresenter::GetInstance()->ChangeViewOperator(EMOTIONTESTVIEW, EMOTIONTESTANALYSISVIEW);
+      }
+      else if (EmoView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::STRESS_ANALYSIS) // 情绪分析完
+      {
+        EmoPresenter::GetInstance()->ChangeViewOperator(EMOTIONTESTANALYSISVIEW, EMOTIONTESTRESULTVIEW);
+        BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
+      }
+      else if (EcgView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::ECG_REMIND) // ECG提示完
+      {
+        EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTREMINDERVIEW, ECGTESTINGVIEW);
+      }
+      else if (EcgView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::ECG_MEASURE) // ECG测量完
+      {
+        EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTINGVIEW, ECGTESTANALYSISVIEW);
+      }
+      else if (EcgView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::ECG_ANALYSIS) // ECG分析完
+      {
+         EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTANALYSISVIEW, ECGTESTRESULTVIEW);
+      }
+      else if (EcgView::GetInstance() && BPModel::GetInstance()->GetCurrentState() == BPState::ECG_RESULT) // ECG结果显示完
+      {
+        EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTRESULTVIEW, ECGRESETTESTOFSUCCVIEW);
+        BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
+      }
       return;
     }
 
@@ -314,15 +355,21 @@ namespace OHOS
       }
       break;
     }
+    case BPState::ECG_MEASURE:
+    {
+      EcgTestingView::GetInstance()->UpdateTimeLabel(Time);
+    }
+
     case BPState::STRESS_MEASURE:
     case BPState::FATIGUE_MEASURE:
-    case BPState::ECG_MEASURE:
     case BPState::EMO_MEASURE:
     case BPState::STRESS_ANALYSIS:
     case BPState::FATIGUE_ANALYSIS:
     case BPState::ECG_ANALYSIS:
     case BPState::EMO_ANALYSIS:
     case BPState::BP_CALIBRATING_ANGLYSIS:
+    case BPState::ECG_REMIND:
+    case BPState::ECG_RESULT:
     {
       break;
     }
diff --git a/code/sdk/application/wearable/fd230app/nativeui/ecg/include/EcgModel.h b/code/sdk/application/wearable/fd230app/nativeui/ecg/include/EcgModel.h
deleted file mode 100644 (file)
index 66897c0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ECG_MODEL_H
-#define ECG_MODEL_H
-#include "stdint.h"
-namespace OHOS
-{
-    class EcgModel
-    {
-    public:
-        static EcgModel &GetInstance(void);
-        void start_ecgtest_timer(int type,uint32_t interval = 1000);
-        void stop_ecgtest_timer(void);
-
-    private:
-        EcgModel();
-        ~EcgModel();
-        EcgModel(const EcgModel &) = delete;
-        EcgModel &operator=(const EcgModel &) = delete;
-    };
-}
-#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/ecg/src/EcgModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/ecg/src/EcgModel.cpp
deleted file mode 100644 (file)
index b793691..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-07-08 09:39:58
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-08 09:43:15
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aimodels/src/EcgModel.cpp
- */
-
-#include "ecg/include/EcgModel.h"
-#include "wearable_log.h"
-#include "cmsis_os2.h"
-#include "cmsis_os.h"
-#include <service/graphic_service.h>
-#include "iostream"
-#include "ecg/include/EcgView.h"
-#include "ecg/include/EcgTestingView.h"
-#include "ecg/include/EcgPresenter.h"
-namespace OHOS
-{
-    EcgModel::EcgModel() {}
-    EcgModel::~EcgModel() {}
-    EcgModel &EcgModel::GetInstance()
-    {
-        static EcgModel instance;
-        return instance;
-    }
-
-    static osTimerId_t g_EcgTestReminderDelayExitHandle = nullptr;
-    static int16_t delayExitTime = 3;
-    static int16_t ecgTestingTime = 30;
-    static int16_t ecgTestAnalysisTime = 30;
-    static int16_t ecgTestResultTime = 3;
-
-    static void EcgTestCallbackProc(int type)
-    {
-        if (type == ECGTESTREMINDERVIEW)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "delayExitTime:%d", delayExitTime);
-            delayExitTime--;
-            if (delayExitTime < 0)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeView(ECGTESTREMINDERVIEW, ECGSTARTTESTVIEW)");
-                EcgModel::GetInstance().stop_ecgtest_timer();
-                if (EcgPresenter::GetInstance())
-                {
-                    EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTREMINDERVIEW, ECGTESTINGVIEW);
-                }
-            }
-        }
-        else if (type == ECGTESTINGVIEW) // 心电测量中
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ecgTestingTime:%d", ecgTestingTime);
-            ecgTestingTime--;
-            if (ecgTestingTime < 0)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeView(ECGTESTINGVIEW, ECGSTARTTESTVIEW)");
-                EcgModel::GetInstance().stop_ecgtest_timer();
-                if (EcgPresenter::GetInstance())
-                {
-                    EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTINGVIEW, ECGTESTANALYSISVIEW);
-                }
-            }
-            else
-            {
-                if (EcgTestingView::GetInstance())
-                {
-                    EcgTestingView::GetInstance()->UpdateTimeLabel(ecgTestingTime);
-                }
-            }
-        }
-        else if (type == ECGTESTANALYSISVIEW)
-        {
-            ecgTestAnalysisTime--;
-            if (ecgTestAnalysisTime < 0)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeView(ECGTESTINGVIEW, ECGTESTANALYSISVIEW)");
-                EcgModel::GetInstance().stop_ecgtest_timer();
-                if (EcgPresenter::GetInstance())
-                {
-                    // EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTINGVIEW, ECGTESTANALYSISVIEW);
-                }
-            }
-            if (1)
-            {
-                EcgModel::GetInstance().stop_ecgtest_timer();
-                if (EcgPresenter::GetInstance())
-                {
-                    EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTANALYSISVIEW, ECGTESTRESULTVIEW);
-                }
-            }
-        }
-        else if (type == ECGTESTRESULTVIEW)
-        {
-            ecgTestResultTime--;
-            if (ecgTestResultTime < 0)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeView(ECGTESTRESULTVIEW, ECGTESTINGVIEW)");
-                EcgModel::GetInstance().stop_ecgtest_timer();
-                if (EcgPresenter::GetInstance())
-                {
-                    EcgPresenter::GetInstance()->ChangeViewOperator(ECGTESTRESULTVIEW, ECGRESETTESTOFSUCCVIEW);
-                }
-            }
-        }
-    }
-    static void EcgTestCallback(int type)
-    {
-        GraphicService::GetInstance()->PostGraphicEvent(std::bind(EcgTestCallbackProc, type));
-    }
-
-    // 开启一个ECG测量定时器
-    void EcgModel::start_ecgtest_timer(int type, uint32_t interval)
-    {
-        /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */
-        if (g_EcgTestReminderDelayExitHandle != nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
-            return;
-        }
-        /* --------------------------------- 2.创建定时器 -------------------------------- */
-        g_EcgTestReminderDelayExitHandle = osTimerNew((osTimerFunc_t)EcgTestCallback, osTimerPeriodic, (void *)type, nullptr);
-        // 检查定时器创建是否成功
-        if (g_EcgTestReminderDelayExitHandle == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
-            return;
-        }
-        /* ----------------------------- 3.将毫秒转换为系统时钟节拍数 ---------------------------- */
-        int tick = osMs2Tick(interval);
-        /* --------------------------------- 4.启动定时器 -------------------------------- */
-        osStatus_t ret = osTimerStart(g_EcgTestReminderDelayExitHandle, tick);
-        /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 nullptr -------------------- */
-        if (ret != osOK)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-            if (g_EcgTestReminderDelayExitHandle != nullptr)
-            {
-                ret = osTimerDelete(g_EcgTestReminderDelayExitHandle);
-                if (ret != osOK)
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-                    return;
-                }
-            }
-            g_EcgTestReminderDelayExitHandle = nullptr;
-            return;
-        }
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Timer start success!!");
-    }
-    void EcgModel::stop_ecgtest_timer(void)
-    {
-        if (g_EcgTestReminderDelayExitHandle != nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stop_ecgtest_timer");
-            osTimerStop(g_EcgTestReminderDelayExitHandle);
-            osStatus_t ret = osTimerDelete(g_EcgTestReminderDelayExitHandle);
-            if (ret != osOK)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-            }
-            g_EcgTestReminderDelayExitHandle = nullptr;
-            delayExitTime = 5;
-            ecgTestingTime = 30;
-            ecgTestAnalysisTime = 30;
-            ecgTestResultTime = 3;
-        }
-    }
-}
index 03ad1d3..95829a3 100644 (file)
@@ -5,7 +5,7 @@
 #include "UiConfig.h"
 #include "ecg/include/EcgPresenter.h"
 #include "ecg/include/EcgView.h"
-#include "ecg/include/EcgModel.h"
+#include "bloodpressure/include/BPModel.h"
 
 namespace OHOS
 {
@@ -15,7 +15,6 @@ namespace OHOS
 
     EcgPresenter::EcgPresenter()
     {
-        model = &EcgModel::GetInstance();
         g_pEcgPresenter = this;
     }
 
@@ -59,7 +58,8 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "EcgPresenter::OnStop");
         Presenter<EcgView>::OnStop();
-        model->stop_ecgtest_timer();
+        BPModel::GetInstance()->BP_Control(BPState::BP_NORMAL);
+        BPModel::GetInstance()->BP_StopTimer();
     }
 
     void EcgPresenter::ChangeViewOperator(int16_t hideView, int16_t showView)
@@ -69,7 +69,7 @@ namespace OHOS
         {
         case ECGTESTREMINDERVIEW:
         {
-            model->start_ecgtest_timer(ECGTESTREMINDERVIEW);
+            BPModel::GetInstance()->BP_Control(BPState::ECG_REMIND);
         }
         break;
         case ECGTESTINGVIEW:
@@ -78,12 +78,12 @@ namespace OHOS
             {
                 EcgTestingView::GetInstance()->UpdateTimeLabel(30);
             }
-            EcgModel::GetInstance().start_ecgtest_timer(ECGTESTINGVIEW);
+            BPModel::GetInstance()->BP_Control(BPState::ECG_MEASURE);
         }
         break;
         case ECGTESTANALYSISVIEW:
         {
-            model->start_ecgtest_timer(ECGTESTANALYSISVIEW);
+           BPModel::GetInstance()->BP_Control(BPState::ECG_ANALYSIS);
             if (EcgTestAnalysisView::GetInstance())
             {
                 EcgTestAnalysisView::GetInstance()->startorstopAnalysisAni(true);
@@ -92,7 +92,7 @@ namespace OHOS
         break;
         case ECGTESTRESULTVIEW:
         {
-            model->start_ecgtest_timer(ECGTESTRESULTVIEW);
+           BPModel::GetInstance()->BP_Control(BPState::ECG_RESULT);
         }
         break;
         default:
@@ -106,9 +106,9 @@ namespace OHOS
                 EcgTestAnalysisView::GetInstance()->startorstopAnalysisAni(false);
             }
         }
-        else if(hideView == ECGTESTRESULTVIEW)
+        else if (hideView == ECGTESTRESULTVIEW)
         {
-            model->stop_ecgtest_timer();
+          BPModel::GetInstance()->BP_StopTimer();
         }
     }
 
diff --git a/code/sdk/application/wearable/fd230app/nativeui/emotion/include/EmoModel.h b/code/sdk/application/wearable/fd230app/nativeui/emotion/include/EmoModel.h
deleted file mode 100644 (file)
index 3ddf08d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef EMOTION_MODEL_H
-#define EMOTION_MODEL_H
-#include "stdint.h"
-namespace OHOS
-{
-    class EmoModel
-    {
-    public:
-        static EmoModel &GetInstance(void);
-        void start_emotest_timer(int type, uint32_t interval = 1000);
-        void stop_emotest_timer(void);
-
-    private:
-        EmoModel();
-        ~EmoModel();
-        EmoModel(const EmoModel &) = delete;
-        EmoModel &operator=(const EmoModel &) = delete;
-    };
-}
-
-#endif
\ No newline at end of file
index 80f0b6d..05cb191 100644 (file)
@@ -7,7 +7,6 @@
 namespace OHOS
 {
     class EmoView;
-    class EmoModel;
     class EmoPresenter : public Presenter<EmoView>,
                              public UIView::OnClickListener,
                              public UIView::OnDragListener,
@@ -30,8 +29,6 @@ namespace OHOS
         bool OnDrag(UIView &view, const DragEvent &event) override;
         bool OnDragEnd(UIView &view, const DragEvent &event) override;
         bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
-
-        EmoModel *model;
         bool X_DRAG_FLAG{false};
     };
 }
diff --git a/code/sdk/application/wearable/fd230app/nativeui/emotion/src/EmoModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/emotion/src/EmoModel.cpp
deleted file mode 100644 (file)
index 7fab950..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "emotion/include/EmoModel.h"
-#include "wearable_log.h"
-#include "cmsis_os2.h"
-#include "cmsis_os.h"
-#include <service/graphic_service.h>
-#include "emotion/include/EmoView.h"
-#include "emotion/include/EmoPresenter.h"
-namespace OHOS
-{
-    EmoModel::EmoModel() {}
-
-    EmoModel::~EmoModel() {}
-
-    EmoModel &EmoModel::GetInstance()
-    {
-        static EmoModel instance;
-        return instance;
-    }
-
-    static osTimerId_t g_EmoTestHandle = nullptr;
-    static int16_t emoTestingTime = 3;
-    static int16_t emoTestAnalysisTime = 5;
-    static int16_t emoTestResultTime = 3;
-
-    static void EmoTestCallbackProc(int type)
-    {
-        switch (type)
-        {
-        case EMOTIONTESTVIEW:
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "emoTestingTime:%d", emoTestingTime);
-            emoTestingTime--;
-            if (emoTestingTime <= 0)
-            {
-                EmoModel::GetInstance().stop_emotest_timer();
-                if (EmoPresenter::GetInstance())
-                {
-                    EmoPresenter::GetInstance()->ChangeViewOperator(EMOTIONTESTVIEW, EMOTIONTESTANALYSISVIEW);
-                }
-            }
-        }
-        break;
-        case EMOTIONTESTANALYSISVIEW:
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "emoTestAnalysisTime:%d", emoTestAnalysisTime);
-            emoTestAnalysisTime--;
-            if (emoTestAnalysisTime <= 0)
-            {
-                EmoModel::GetInstance().stop_emotest_timer();
-                if (EmoPresenter::GetInstance())
-                {
-                    EmoPresenter::GetInstance()->ChangeViewOperator(EMOTIONTESTANALYSISVIEW, EMOTIONTESTRESULTVIEW);
-                }
-            }
-        }
-        break;
-        default:
-            break;
-        }
-    }
-
-    static void EmoTestCallback(int type)
-    {
-        GraphicService::GetInstance()->PostGraphicEvent(std::bind(&EmoTestCallbackProc, type));
-    }
-
-    void EmoModel::start_emotest_timer(int type, uint32_t interval)
-    {
-        /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */
-        if (g_EmoTestHandle != nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
-            return;
-        }
-        /* --------------------------------- 2.创建定时器 -------------------------------- */
-        g_EmoTestHandle = osTimerNew((osTimerFunc_t)EmoTestCallback, osTimerPeriodic, (void *)type, nullptr);
-        // 检查定时器创建是否成功
-        if (g_EmoTestHandle == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
-            return;
-        }
-        /* ----------------------------- 3.将毫秒转换为系统时钟节拍数 ---------------------------- */
-        int tick = osMs2Tick(interval);
-        /* --------------------------------- 4.启动定时器 -------------------------------- */
-        osStatus_t ret = osTimerStart(g_EmoTestHandle, tick);
-        /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 nullptr -------------------- */
-        if (ret != osOK)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-            if (g_EmoTestHandle != nullptr)
-            {
-                ret = osTimerDelete(g_EmoTestHandle);
-                if (ret != osOK)
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-                    return;
-                }
-            }
-            g_EmoTestHandle = nullptr;
-            return;
-        }
-    }
-    void EmoModel::stop_emotest_timer(void)
-    {
-        if (g_EmoTestHandle != nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stop_emotest_timer");
-            osTimerStop(g_EmoTestHandle);
-            osStatus_t ret = osTimerDelete(g_EmoTestHandle);
-            if (ret != osOK)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
-            }
-            g_EmoTestHandle = nullptr;
-            emoTestingTime = 3;
-            emoTestAnalysisTime = 5;
-        }
-    }
-}
index c104dd5..63acc73 100644 (file)
@@ -5,7 +5,7 @@
 #include "UiConfig.h"
 #include "emotion/include/EmoPresenter.h"
 #include "emotion/include/EmoView.h"
-#include "emotion/include/EmoModel.h"
+#include "bloodpressure/include/BPModel.h"
 
 namespace OHOS
 {
@@ -15,7 +15,6 @@ namespace OHOS
 
     EmoPresenter::EmoPresenter()
     {
-        model = &EmoModel::GetInstance();
         g_pEmoPresenter = this;
     }
 
@@ -59,7 +58,8 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "EmoPresenter::OnStop");
         Presenter<EmoView>::OnStop();
-        model->stop_emotest_timer();
+        BPModel::GetInstance()->BP_Control(BPState::BP_NORMAL);
+        BPModel::GetInstance()->BP_StopTimer();
     }
 
     void EmoPresenter::ChangeViewOperator(int16_t hideView, int16_t showView)
@@ -73,7 +73,7 @@ namespace OHOS
             {
                 EmoTestAnalysisView::GetInstance()->startorstopAnalysisAni(true);
             }
-            model->start_emotest_timer(EMOTIONTESTANALYSISVIEW);
+           BPModel::GetInstance()->BP_Control(BPState::EMO_ANALYSIS);
         }
         break;
         default:
@@ -123,7 +123,7 @@ namespace OHOS
                     {
                         startEmotionTestButton->SetText("测量中");
                         startEmotionTestButton->SetTouchable(false);
-                        model->start_emotest_timer(EMOTIONTESTVIEW);
+                        BPModel::GetInstance()->BP_Control(BPState::EMO_MEASURE);
                         EmoTestView::GetInstance()->SetTestButtonState(true);
                     }
                     else if (str == "测量中")
@@ -135,11 +135,11 @@ namespace OHOS
                 }
             }
         }
-        else if(viewId == EMORESETTESTBTN)
+        else if (viewId == EMORESETTESTBTN)
         {
             ChangeViewOperator(EMOTIONTESTFAILNOWEARING, EMOTIONTESTVIEW);
         }
-        else if(viewId == EMO_RESET_TEST_BTN)
+        else if (viewId == EMO_RESET_TEST_BTN)
         {
             ChangeViewOperator(EMOTIONTESTFAILNOVALUE, EMOTIONTESTVIEW);
         }
index 772c376..0ff95f0 100644 (file)
@@ -35,7 +35,7 @@ namespace OHOS
     {
         int index = 0;
         settings[index++] = {VIEW_SETTING, nullptr, STR_SETTINGS, false};//标题:设置
-        #if defined(BOARD_W9)||1
+        #if defined(BOARD_W9)
         settings[index++] = {VIEW_BLOOD_PRESSURE_CALIBRATION, PNG_APPLIST_BP_IMAGE, STR_BP_CALIBRATE, true};//血压检测
         #endif
         settings[index++] = {VIEW_DISPLAY_BRIGHTNESS, PNG_SETTINGS_DISPLAY_BRIGHTNESS, STR_SCREEN_AND_BRIGHTNESS, true};