From 1ec23d7e3b175ac77db9543c92c51a21098679ee Mon Sep 17 00:00:00 2001 From: Caisking Date: Fri, 6 Jun 2025 12:16:18 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D650=E8=A1=A8=E7=9B=98=E6=AD=BB?= =?utf8?q?=E6=9C=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../main/include/dial/DialBoxProgressModel.h | 42 +++++++ .../main/include/dial/DialBoxProgressView.h | 36 ++---- .../main/src/dial/DialBoxProgressModel.cpp | 88 +++++++++++++++ .../main/src/dial/DialBoxProgressView.cpp | 106 ++++-------------- .../main/src/dial/DialModelKcalgoal.cpp | 11 +- .../main/src/dial/DialModelPowerStandby.cpp | 18 ++- .../main/src/dial/DialModelStepgoal.cpp | 18 ++- .../fd230/service/msg_center/CMakeLists.txt | 6 +- .../msg_center/src/msg_center_customer.cpp | 18 +-- 9 files changed, 211 insertions(+), 132 deletions(-) create mode 100644 code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressModel.h create mode 100644 code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressModel.cpp diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressModel.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressModel.h new file mode 100644 index 000000000..51d8c6625 --- /dev/null +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressModel.h @@ -0,0 +1,42 @@ +#ifndef DIAL_BOX_PROGRESS_MODEL_H +#define DIAL_BOX_PROGRESS_MODEL_H + +#include +#include "View.h" + +enum DialBoxDataType { + // 剩余电量百分比 + BATTERY_LEVEL = 1, + // 步数目标 + STEP_TARGET = 2, + // 卡路里 + CALORIE_TARGET = 3, +}; + +namespace OHOS { +class DialBoxProgressModel { +public: + DialBoxProgressModel(); + ~DialBoxProgressModel(); + static DialBoxProgressModel *GetInstance() { + static DialBoxProgressModel instance; + return &instance; + } + + void UpdateBatteryColor( float value_); + void SetViewColor(int64_t color); + int64_t GetViewColor(); + + + uint32_t DialBoxDataTypeToBitPattern(DialBoxDataType type); + uint32_t ConvertToRequiredFormat(DialBoxDataType type, float data); + DialBoxDataType ExtractDataType(uint32_t rawData); + uint32_t ExtractValue(uint32_t rawData); + +private: + int32_t value_ = -1; + int64_t color_ = Color::White().full; + DialBoxDataType datatype_ = BATTERY_LEVEL; +}; +} // namespace OHOS +#endif diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h index 25bfeebe0..cc45b4d91 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h @@ -1,3 +1,6 @@ +/* + * Copyright (c) @CompanyNameMagicTag. 2023. All rights reserved. + */ #ifndef DIAL_BOX_PROGRESS_VIEW_H #define DIAL_BOX_PROGRESS_VIEW_H @@ -5,37 +8,14 @@ #include "DialView.h" #include "components/ui_box_progress.h" -enum DialBoxDataType { - // 剩余电量百分比 - BATTERY_LEVEL = 1, - // 步数目标 - STEP_TARGET = 2, - // 卡路里 - CALORIE_TARGET = 3, -}; namespace OHOS { class DialBoxProgressView : public UIBoxProgress, public DialView { public: - DialBoxProgressView(); - ~DialBoxProgressView() override; - static DialBoxProgressView *GetInstance() { - static DialBoxProgressView instance; - return &instance; - } - void HandleFloatData(float data) override; - void UpdataChargColor(); - void UpdateBatteryColor(); - void SetViewColor(int64_t color); - - uint32_t DialBoxDataTypeToBitPattern(DialBoxDataType type); - uint32_t ConvertToRequiredFormat(DialBoxDataType type, float data); - DialBoxDataType ExtractDataType(uint32_t rawData); - uint32_t ExtractValue(uint32_t rawData); - + DialBoxProgressView(); + ~DialBoxProgressView() override; + void HandleFloatData(float data) override; private: - int32_t value_ = -1; - int64_t color_ = Color::White().full; - DialBoxDataType datatype_ = BATTERY_LEVEL; + int32_t value_ = -1; }; -} // namespace OHOS +} #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressModel.cpp new file mode 100644 index 000000000..6b818c086 --- /dev/null +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressModel.cpp @@ -0,0 +1,88 @@ +#include "DialBoxProgressModel.h" +#include "DialBoxProgressView.h" +#include "wearable_log.h" + +#include "battery_hal.h" +extern uint8_t battery_get_voltage(float *voltage); + +// 定义电量宏 +#define BATTERY_LOW_THRESHOLD 10 +#define BATTERY_MEDIUM_THRESHOLD 20 + +// 从转换后的uint32_t数据中提取数据类型 +namespace OHOS { +DialBoxProgressModel::DialBoxProgressModel(void) + : value_(0), color_(Color::White().full) // 初始化 color_ +{} + +DialBoxProgressModel::~DialBoxProgressModel(void) {} + +/* --------------------------------- 编码解码函数 + * --------------------------------- */ + +// 定义用于位操作的掩码和位移值,可根据实际需求调整 +constexpr uint32_t TYPE_MASK = 0xFF000000; +constexpr uint32_t TYPE_SHIFT = 24; +constexpr uint32_t VALUE_MASK = 0x00FFFFFF; + +uint32_t +DialBoxProgressModel::DialBoxDataTypeToBitPattern(DialBoxDataType type) { + return static_cast(type) << TYPE_SHIFT; +} +//增加box不同值颜色绘制 +uint32_t DialBoxProgressModel::ConvertToRequiredFormat(DialBoxDataType type, + float data) { + + uint32_t typeBitPattern = DialBoxDataTypeToBitPattern(type); + uint32_t dataAsInt = static_cast(data); + + return (typeBitPattern | dataAsInt); +} + +DialBoxDataType DialBoxProgressModel::ExtractDataType(uint32_t rawData) { + + uint32_t typeValue = (rawData & TYPE_MASK) >> TYPE_SHIFT; + return static_cast(typeValue); +} + +uint32_t DialBoxProgressModel::ExtractValue(uint32_t rawData) { + + return rawData & VALUE_MASK; +} + + +void DialBoxProgressModel::UpdateBatteryColor( float value_) { + bool isCharging = get_charge_stat(); // 获取充电状态 + + if (isCharging) { + SetViewColor(Color::Green().full); // 充电状态为绿色 + return; + } + + // 根据值设置电池颜色 + if (value_ > BATTERY_MEDIUM_THRESHOLD) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor White: %d", + value_); + SetViewColor(Color::White().full); + } else if (value_ <= BATTERY_MEDIUM_THRESHOLD && + value_ > BATTERY_LOW_THRESHOLD) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor Yellow: %d", + value_); + SetViewColor(Color::Yellow().full); + } else if (value_ <= BATTERY_LOW_THRESHOLD && value_ > 0) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor Red: %d", + value_); + SetViewColor(Color::Red().full); + } +} + +void DialBoxProgressModel::SetViewColor(int64_t color) { + // 仅在颜色变化时设置 + if (color != color_) { + color_ = color; + } +} + +//增加返回颜色 +int64_t DialBoxProgressModel::GetViewColor() { return color_; } +} // namespace OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressView.cpp index f1846ecbd..5457370bf 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialBoxProgressView.cpp @@ -1,66 +1,38 @@ #include "DialBoxProgressView.h" +#include "DialBoxProgressModel.h" #include "wearable_log.h" -#include "battery_hal.h" -extern uint8_t battery_get_voltage(float *voltage); - -// 定义电量宏 -#define BATTERY_LOW_THRESHOLD 10 -#define BATTERY_MEDIUM_THRESHOLD 20 - // 从转换后的uint32_t数据中提取数据类型 namespace OHOS { -DialBoxProgressView::DialBoxProgressView(void) - : value_(0), color_(Color::White().full) // 初始化 color_ -{} +DialBoxProgressView::DialBoxProgressView(void) {} DialBoxProgressView::~DialBoxProgressView(void) {} -/* --------------------------------- 编码解码函数 - * --------------------------------- */ - -// 定义用于位操作的掩码和位移值,可根据实际需求调整 -constexpr uint32_t TYPE_MASK = 0xFF000000; -constexpr uint32_t TYPE_SHIFT = 24; -constexpr uint32_t VALUE_MASK = 0x00FFFFFF; - -uint32_t -DialBoxProgressView::DialBoxDataTypeToBitPattern(DialBoxDataType type) { - return static_cast(type) << TYPE_SHIFT; -} -//增加box不同值颜色绘制 -uint32_t DialBoxProgressView::ConvertToRequiredFormat(DialBoxDataType type, - float data) { - - uint32_t typeBitPattern = DialBoxDataTypeToBitPattern(type); - uint32_t dataAsInt = static_cast(data); - - return (typeBitPattern | dataAsInt); -} - -DialBoxDataType DialBoxProgressView::ExtractDataType(uint32_t rawData) { - - uint32_t typeValue = (rawData & TYPE_MASK) >> TYPE_SHIFT; - return static_cast(typeValue); -} - -uint32_t DialBoxProgressView::ExtractValue(uint32_t rawData) { - - return rawData & VALUE_MASK; -} - /* -------------------------------------------------------------------------- */ void DialBoxProgressView::HandleFloatData(float data) { // 获取数据类型 - datatype_ = ExtractDataType(data); //类型为前4位 - float value = ExtractValue(data); //数值为后28位 - WEARABLE_LOGE("DialBoxProgressView", "HandleFloatData: %d %f", datatype_, + DialBoxDataType datatype_ = + DialBoxProgressModel::GetInstance()->ExtractDataType(data); //类型为前4位 + float value = + DialBoxProgressModel::GetInstance()->ExtractValue(data); //数值为后28位 + WEARABLE_LOGD("DialBoxProgressView", "HandleFloatData: %d %f", datatype_, value); - - if (datatype_ == BATTERY_LEVEL) { - UpdateBatteryColor(); // 在值变化或充电状态变化时更新颜色 - } else if (datatype_ == STEP_TARGET) { - SetViewColor(0xFFf0c440); + int64_t color; + switch (datatype_) { + //电池颜色 + case BATTERY_LEVEL: + DialBoxProgressModel::GetInstance()->UpdateBatteryColor(value); + color = DialBoxProgressModel::GetInstance()->GetViewColor(); + SetForegroundStyle(STYLE_BACKGROUND_COLOR, color); + break; + //步数目标 + case STEP_TARGET: + color = 0xFFf0c440; //黄色 + SetForegroundStyle(STYLE_BACKGROUND_COLOR, color); + break; + default: + WEARABLE_LOGE("DialBoxProgressView", "HandleFloatData: datatype error"); + break; } if (value != value_) { value_ = value; @@ -68,36 +40,4 @@ void DialBoxProgressView::HandleFloatData(float data) { } } -void DialBoxProgressView::UpdateBatteryColor() { - bool isCharging = get_charge_stat(); // 获取充电状态 - - if (isCharging) { - SetViewColor(Color::Green().full); // 充电状态为绿色 - return; - } - - // 根据值设置电池颜色 - if (value_ > BATTERY_MEDIUM_THRESHOLD) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor White: %d", - value_); - SetViewColor(Color::White().full); - } else if (value_ <= BATTERY_MEDIUM_THRESHOLD && - value_ > BATTERY_LOW_THRESHOLD) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor Yellow: %d", - value_); - SetViewColor(Color::Yellow().full); - } else if (value_ <= BATTERY_LOW_THRESHOLD && value_ > 0) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateBatteryColor Red: %d", - value_); - SetViewColor(Color::Red().full); - } -} - -void DialBoxProgressView::SetViewColor(int64_t color) { - // 仅在颜色变化时设置 - if (color != color_) { - color_ = color; - SetForegroundStyle(STYLE_BACKGROUND_COLOR, color_); - } -} } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelKcalgoal.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelKcalgoal.cpp index 795e3fe61..2f66e6e06 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelKcalgoal.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelKcalgoal.cpp @@ -7,6 +7,7 @@ #include "DialModelKcalgoal.h" #include "DialBoxProgressView.h" +#include "DialBoxProgressModel.h" #include "RegisterDialModel.h" #include "goal/include/goalmodel.h" @@ -16,6 +17,7 @@ REGIST_DIAL_MODULE(OHOS::DialDataType::CALORIE_GOAL_BOXPROGRESS, namespace OHOS { bool DialModelKcalgoal::GetDialFloatData(DialDataType &type, float &out) { (void)type; +#if 1 uint32_t goal = GoalModel::GetInstance().getKcalgoaldata(); uint32_t Kcal_ = GoalModel::GetInstance().show_data_calories_refresh(); @@ -23,7 +25,7 @@ bool DialModelKcalgoal::GetDialFloatData(DialDataType &type, float &out) { Kcalgoal_ = (static_cast(Kcal_) / goal) * 100; if (Kcalgoal_ > 100) Kcalgoal_ = 100; - Kcalgoal_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + Kcalgoal_ = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::CALORIE_TARGET, Kcalgoal_); } else { Kcalgoal_ = 0; @@ -32,12 +34,16 @@ bool DialModelKcalgoal::GetDialFloatData(DialDataType &type, float &out) { onChangeListener_->OnDialFloatDataUpdate( OHOS::DialDataType::CALORIE_GOAL_BOXPROGRESS, Kcalgoal_); } - out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + out = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::CALORIE_TARGET, Kcalgoal_); +#else + out = 0; +#endif return true; } void DialModelKcalgoal::UpdateKcalgoal(uint32_t Kcals) { +#if 0 uint32_t Kcal_ = static_cast(Kcals); uint32_t goal = GoalModel::GetInstance().getKcalgoaldata(); if (goal > 0) { @@ -51,5 +57,6 @@ void DialModelKcalgoal::UpdateKcalgoal(uint32_t Kcals) { onChangeListener_->OnDialFloatDataUpdate( OHOS::DialDataType::CALORIE_GOAL_BOXPROGRESS, Kcalgoal_); } +#endif } } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelPowerStandby.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelPowerStandby.cpp index c9393200b..ca5313932 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelPowerStandby.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelPowerStandby.cpp @@ -2,6 +2,8 @@ #include "DialModelPowerStandby.h" #include "DialBoxProgressView.h" +#include "DialBoxProgressModel.h" + #include "RegisterDialModel.h" #include "wearable_log.h" #include @@ -15,12 +17,12 @@ REGIST_DIAL_MODULE(OHOS::DialDataType::POWER_STANDBY, namespace OHOS { bool DialModelPowerStanby::GetDialFloatData(DialDataType &type, float &out) { +#if 1 (void)type; - float voltage = 0.0F; PowerStanby_ = battery_get_voltage(&voltage); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Battery voltage obtained: %.2f", + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Battery voltage obtained: %.2f", voltage); // 计算映射值 @@ -33,7 +35,7 @@ bool DialModelPowerStanby::GetDialFloatData(DialDataType &type, float &out) { } else { mappedValue = (PowerStanby_ == maxPower) ? 1.0f : 0.0f; // 边界处理 } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Raw power value: %d, Mapped value: %.2f", PowerStanby_, mappedValue); // 如果需要在 0 到 1 范围映射 @@ -41,11 +43,17 @@ bool DialModelPowerStanby::GetDialFloatData(DialDataType &type, float &out) { // 需要前4个为类型 // 后28位为数据 - out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + out = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::BATTERY_LEVEL, PowerStanby_); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Mapped value sent to caller: %.2f", + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Mapped value sent to caller: %.2f", out); +#else + (void)type; + float voltage = 0.0F; + power_ = battery_get_voltage(&voltage); + out = static_cast(power_); +#endif return true; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelStepgoal.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelStepgoal.cpp index ec7434e1a..a87214d6e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelStepgoal.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialModelStepgoal.cpp @@ -7,6 +7,7 @@ #include "DialModelStepgoal.h" #include "DialBoxProgressView.h" +#include "DialBoxProgressModel.h" #include "RegisterDialModel.h" #include "goal/include/goalmodel.h" @@ -16,36 +17,41 @@ REGIST_DIAL_MODULE(OHOS::DialDataType::STEPS_GOAL_BOXPROGRESS, namespace OHOS { bool DialModelStepgoal::GetDialFloatData(DialDataType &type, float &out) { (void)type; - +#if 1 uint32_t step_ = GoalModel::GetInstance().show_data_step_refresh(); uint32_t goal = GoalModel::GetInstance().getstepgoaldata(); if (goal > 0) { stepgoal_ = (static_cast(step_) / goal) * 100; if (stepgoal_ > 100) stepgoal_ = 100; - stepgoal_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + stepgoal_ = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::STEP_TARGET, stepgoal_); } else { stepgoal_ = 0; } - out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + out = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::STEP_TARGET, stepgoal_); +#else + out = 0; +#endif return true; } void DialModelStepgoal::UpdateStepgoal(uint32_t steps) { +#if 1 uint32_t step_ = static_cast(steps); uint32_t goal = GoalModel::GetInstance().getstepgoaldata(); if (goal > 0) { stepgoal_ = (static_cast(step_) / goal) * 100; if (stepgoal_ > 100) stepgoal_ = 100; - stepgoal_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + stepgoal_ = DialBoxProgressModel::GetInstance()->ConvertToRequiredFormat( DialBoxDataType::STEP_TARGET, stepgoal_); } if (onChangeListener_ != nullptr) { - onChangeListener_->OnDialFloatDataUpdate(OHOS::DialDataType::STEPS_GOAL_BOXPROGRESS, - stepgoal_); + onChangeListener_->OnDialFloatDataUpdate( + OHOS::DialDataType::STEPS_GOAL_BOXPROGRESS, stepgoal_); } +#endif } } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt index 36a4d55e6..f39a85c22 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt @@ -99,6 +99,8 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/key/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include/dial + ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/saveele/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits @@ -107,7 +109,8 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks - ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/components + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_player/interfaces/kits ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiomanager ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiocommon @@ -134,6 +137,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/application/wearable/nativeapp/nativeui/player/include ${ROOT_DIR}/application/wearable/nativeapp/nativeui/applist/include ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits + ${ROOT_DIR}/application/wearable/fd230/nativeapp/nativeui/ ) diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index 405baf35c..11e206f5c 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -34,6 +34,11 @@ #include "VolumeSettingPresenter.h" #include "VolumeSettingView.h" #include "pairing_notification.h" +// #include "saveele/include/SaveEleModel.h" +// #include "DialModelCharge.h" + +#define DIALDATASET 1 + #ifdef SUPPORT_BLE_SERVICE #include "bleInstruct.h" #endif @@ -395,12 +400,12 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } - #if 0 #if DIALDATASET DialModelCharge::GetInstance()->UpdatechargeStatus(1); #endif SaveEleModel::GetInstance()->SetChargeStatus(true); + if (uapi_dev_runtime_get_train_status()) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug ! but train status is true"); @@ -420,8 +425,7 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true); } } - #endif - + #endif } /*充电器已拔掉*/ @@ -437,13 +441,13 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::PullUpDownView::UpdateBatteryProcess, OHOS::PullUpDownView::GetInstance() )); } - - #if 0 +#if 0 #if DIALDATASET DialModelCharge::GetInstance()->UpdatechargeStatus(0); #endif SaveEleModel::GetInstance()->SetChargeStatus(false); - + + testCHANINGView *t = testCHANINGView::GetInstance(); if(t != nullptr) { @@ -456,7 +460,7 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) NotificationManager::GetInstance()->StopNotify(); } } - #endif + #endif } /*低电量提醒*/ -- 2.17.1