From 5c7c140001cb3494850467d0a6375c067babfca6 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 3 Oct 2024 13:34:32 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E5=BC=80=E5=8F=91=E8=B0=83?= =?utf8?q?=E8=AF=95=E4=B8=93=E7=94=A8=E7=AA=97=E5=8F=A3=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../debug_output_notification.h | 3 +- .../debug_output_notification.cpp | 82 +++++++++++++------ 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h index 808192346..b8d622ed4 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-10-02 14:12:12 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-03 11:08:44 + * @LastEditTime: 2024-10-03 13:29:50 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification.h */ #ifndef DEBUG_OUTPUT_NOTIFICATION_H @@ -27,6 +27,7 @@ namespace OHOS bool ClickFunc(int16_t interface); bool CheckViewParam(int16_t hideView, int16_t showView); void ChangeView(int16_t hideView, int16_t showView); + void DestroyTempView(int16_t hideView); void SetCurViewIndex(int16_t viewNum); int GetCurViewIndex(void); void InitDebugOutputItem(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp index 5456611ed..14ed910fa 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp @@ -101,9 +101,37 @@ namespace OHOS return result; } - std::string DebugOutputViewEventListener::get_runtime_status_t(void) + std::string DebugOutputViewEventListener::get_runtime_status_t() { - std::string result; + std::string result = "enter_safemode:" + std::to_string(uapi_dev_runtime_get_safemode_flag()) + " "; + result += "in_silent_mode: "; + result += "in_lowpower_mode: "; + result += "stepcount: "; + result += "vibmod:" + std::to_string(uapi_dev_runtime_get_vibmod()) + " "; + result += "current_dial_name:" + std::string(uapi_dev_runtime_get_dialname()) + " "; + result += "time_hour_show_model:" + std::to_string(uapi_dev_runtime_get_time_hour_show_model()) + " "; + result += "sleep_monitoring_status:" + std::to_string(uapi_dev_runtime_get_sleep_monitoring_status()) + " "; + result += "sleep_status:" + std::to_string(uapi_dev_runtime_get_sleep_status()) + " "; + result += "nap_status:" + std::to_string(uapi_dev_runtime_get_nap_status()) + " "; + result += "nap_monitoring_status:" + std::to_string(uapi_dev_runtime_get_nap_monitoring_status()) + " "; + result += "sedentary_status:" + std::to_string(uapi_dev_runtime_get_sedentary_status()) + " "; + result += "drinkremind_status:" + std::to_string(uapi_dev_runtime_get_drinkremind_status()) + " "; + result += "train_status:" + std::to_string(uapi_dev_runtime_get_train_status()) + " "; + result += "saveele_status:" + std::to_string(uapi_dev_runtime_get_saveele_status()) + " "; + result += "lock_status:" + std::to_string(uapi_dev_runtime_get_lock_status()) + " "; + result += "motion_recognition_status:" + std::to_string(uapi_dev_runtime_get_motion_recognition_status()) + " "; + result += "sleep_mode_flag:" + std::to_string(uapi_sleep_mode_flag_get()) + " "; + result += "absolute_static_state:" + std::to_string(uapi_dev_runtime_get_absolute_static_status()) + " "; + result += "checkres_status:" + std::to_string(uapi_dev_runtime_get_checkres_status()) + " "; + result += "repair_download_status:" + std::to_string(uapi_dev_runtime_get_repair_download_status()) + " "; + result += "hrs_passivity_status:" + std::to_string(uapi_dev_runtime_get_hrs_passivity_flag()) + " "; + result += "mmc_status:" + std::to_string(uapi_dev_runtime_get_mmc_status_flag()) + " "; + result += "rwlock_status:" + std::to_string(uapi_dev_runtime_get_rwlock_status()) + " "; + result += "lock_flag_training:" + std::to_string(uapi_dev_runtime_get_train_storage_status()) + " "; + result += "lock_flag_heartrate:" + std::to_string(uapi_dev_runtime_get_heartrate_storage_status()) + " "; + result += "lock_flag_blood:" + std::to_string(uapi_dev_runtime_get_bloodoxygen_storage_status()) + " "; + result += "lock_flag_sleep:" + std::to_string(uapi_dev_runtime_get_sleep_storage_status()); + return result; } @@ -117,16 +145,16 @@ namespace OHOS else { DebugOutputItemView *debugOutputItemView = static_cast(&view); - int viewIndex = debugOutputItemView->GetViewIndex(); + viewIndex = debugOutputItemView->GetViewIndex(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewIndex:%d", viewIndex); ChangeView(0, 1); - if (debugOutputLabel == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is nullptr"); - return false; - } SetCurViewIndex(viewIndex); } + if (debugOutputLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is nullptr"); + return false; + } std::string str; switch (viewIndex) { @@ -146,10 +174,9 @@ namespace OHOS default: break; } - if (debugOutputLabelButton) { - debugOutputLabelButton->SetHeight(debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20); + debugOutputLabelButton->SetY(debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20); debugOutputLabelButton->Invalidate(); } debugOutputLabel->Invalidate(); @@ -228,6 +255,27 @@ namespace OHOS return true; } + void DebugOutputViewEventListener::DestroyTempView(int16_t hideView) + { + if (hideView == 1) + { + DebugGroupView->Remove(DebugScrollView[hideView]); + if (DebugScrollView[hideView] != nullptr) + { + DebugScrollView[hideView]->RemoveAll(); + + delete debugOutputLabel; + debugOutputLabel = nullptr; + + delete debugOutputLabelButton; + debugOutputLabelButton = nullptr; + + delete DebugScrollView[1]; + DebugScrollView[1] = nullptr; + } + } + } + void DebugOutputViewEventListener::ChangeView(int16_t hideView, int16_t showView) { if (!CheckViewParam(hideView, showView)) @@ -238,6 +286,7 @@ namespace OHOS DebugScrollView[hideView]->SetVisible(false); ClickFunc(showView); DebugScrollView[showView]->SetVisible(true); + DestroyTempView(hideView); RootView::GetInstance()->Invalidate(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hideView:%d -> showView:%d success!!", hideView, showView); } @@ -454,19 +503,6 @@ namespace OHOS delete DebugScrollView[0]; DebugScrollView[0] = nullptr; } - if (DebugScrollView[1] != nullptr) - { - DebugScrollView[1]->RemoveAll(); - - delete debugOutputLabel; - debugOutputLabel = nullptr; - - delete debugOutputLabelButton; - debugOutputLabelButton = nullptr; - - delete DebugScrollView[1]; - DebugScrollView[1] = nullptr; - } RootView::GetInstance()->Remove(DebugGroupView); delete DebugGroupView; DebugGroupView = nullptr; -- 2.17.1