From: Caisking <3449750381@qq.com> Date: Wed, 28 Feb 2024 12:18:27 +0000 (+0800) Subject: 1.取消测试时候的按键事件;2.保持血氧测试常亮 X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~50^2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=c95475ff2eb5a2b69191e81bb3f783cb5d869090;p=mirrors%2FFD230.git 1.取消测试时候的按键事件;2.保持血氧测试常亮 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h index 0164c1a4e..ecdfc36ab 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h @@ -14,35 +14,39 @@ #include "ohos_types.h" #include "KeyInputListener.h" #include "common/key_code.h" +#include "power_display_service.h" +namespace OHOS +{ + class BloodOxygenView; + class BloodOxygenPresenter : public Presenter, + public UIView::OnClickListener, + public RootView::OnKeyActListener, + public ModelListenerSample, + public UIView::OnDragListener + { + public: + BloodOxygenPresenter(); + virtual ~BloodOxygenPresenter(); -namespace OHOS { -class BloodOxygenView; -class BloodOxygenPresenter : public Presenter, - public UIView::OnClickListener, - public RootView::OnKeyActListener, - public ModelListenerSample, - public UIView::OnDragListener { -public: - BloodOxygenPresenter(); - virtual ~BloodOxygenPresenter(); + void OnStart() override; + void OnPause() override; + void OnResume() override; + void OnStop() override; + virtual void Notify() override; + static BloodOxygenPresenter *GetInstance(void); + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - virtual void Notify() override; - static BloodOxygenPresenter *GetInstance(void); - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; - bool OnKeyAct(UIView& view, const KeyEvent& event) override;//增加按键事件 - -private: - bool CheckPointersValue(void); - void ReturnInterface(void); - void ProgressNotify(void); - int count; - KeyInputListener *keyActListenr{nullptr}; -}; + private: + bool CheckPointersValue(void); + void ReturnInterface(void); + void ProgressNotify(void); + int count; + KeyInputListener *keyActListenr{nullptr}; + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + int display_time; + }; } #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp index 89007d2de..787c6fe20 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp @@ -27,7 +27,8 @@ #include #include #include "ppg_service.h" - +#include "displaybrightness/include/DisplayBrightnessModel.h" +#include "power_display_service.h" namespace OHOS { static BloodOxygenPresenter *g_pMainView = nullptr; @@ -41,11 +42,6 @@ namespace OHOS g_pMainView = this; } - BloodOxygenPresenter::~BloodOxygenPresenter() - { - g_pMainView = nullptr; - } - BloodOxygenPresenter::~BloodOxygenPresenter() { if (keyActListenr != nullptr) @@ -55,12 +51,16 @@ namespace OHOS } g_pMainView = nullptr; } + BloodOxygenPresenter *BloodOxygenPresenter::GetInstance() + { + return g_pMainView; + } void BloodOxygenPresenter::OnStart() { Presenter::OnStart(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::On Start "); - +#if 0 if (keyActListenr == nullptr) { keyActListenr = new KeyInputListener(); @@ -73,6 +73,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::OnStart: new KeyInputListener fail"); } } +#endif } void BloodOxygenPresenter::OnPause(void) {} @@ -114,6 +115,8 @@ namespace OHOS bool BloodOxygenPresenter::OnClick(UIView &view, const ClickEvent &event) { + display_time = DisplayBrightnessModel::GetInstance()->GetScreenDurationTime(); + display_api->set_screen_auto_off_timeout(30 * 1000); UNUSED(view); UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::OnClick"); @@ -143,6 +146,7 @@ namespace OHOS // 增加按键事件 bool BloodOxygenPresenter::OnKeyAct(UIView &view, const KeyEvent &event) { +#if 0 WEARABLE_LOGD("", "into the view is: %s\n", typeid(view).name()); uint16 keyID = event.GetKeyId(); WEARABLE_LOGD("", "into key! keyID %u\n", keyID); @@ -152,6 +156,7 @@ namespace OHOS // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); } +#endif return true; } void BloodOxygenPresenter::ProgressNotify(void) @@ -191,6 +196,7 @@ namespace OHOS uint32_t md = PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST; send_ppg_cmd_msg(md); #endif + display_api->set_screen_auto_off_timeout(display_time); // 复原 } } }