From cda7d8359cfac093820b02f83e1d5b428cf87dda Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=A2=81=E6=B8=85=E6=A2=A6?= <3449750381@qq.com> Date: Mon, 19 Aug 2024 02:21:49 +0000 Subject: [PATCH] Merge #715 into sdk602patch0626 from refs/changes/715/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 增加运动识别开启运动接口 * refs/changes/715/head: (5 commits squashed) - 增加运动识别开启运动接口 - 修复同状态下更改睡眠配置不更新的bug - 修改错误的充电状态拼写 - 修复睡眠闹钟后面响铃时间越来越少的bug - 修改省电模式表盘UI Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/715 --- .../nativelauncher/src/NativeLauncher.cpp | 2 +- .../main/include/dial/DialModelCharge.h | 4 +- .../main/src/dial/DialModelCharge.cpp | 10 +- .../saveele/include/SaveBatPresenter.h | 11 +- .../nativeui/saveele/include/SaveBatView.h | 23 ++-- .../nativeui/saveele/include/SaveEleModel.h | 58 ++++++---- .../nativeui/saveele/src/SaveBatPresenter.cpp | 36 ++++-- .../nativeui/saveele/src/SaveBatView.cpp | 105 +++++++++++++++++- .../nativeui/saveele/src/SaveEleModel.cpp | 14 ++- .../nativeui/sleep/src/SleepModel.cpp | 4 + .../include/TraingCardPresenter.h | 4 + .../training_card/src/TraingCardPresenter.cpp | 20 ++++ .../msg_center/src/msg_center_customer.cpp | 12 +- .../src/notify/sleep_notification.cpp | 3 +- 14 files changed, 246 insertions(+), 60 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index cd93d058c..08a4e9015 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -491,7 +491,7 @@ namespace OHOS if (get_charge_stat()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Power is Charging!"); - DialModelCharge::GetInstance()->UpdateChargeStuaut(1); + DialModelCharge::GetInstance()->UpdatechargeStatus(1); } /*开机读取天气历史数据*/ read_jsonHistory_weather(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelCharge.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelCharge.h index 0588a5d38..373ed7ed2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelCharge.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialModelCharge.h @@ -23,10 +23,10 @@ namespace OHOS return &instance; } bool GetDialFloatData(DialDataType &type, float &out) override; - void UpdateChargeStuaut(int16_t ChargeStuaut); + void UpdatechargeStatus(int16_t chargeStatus); private: - int16_t ChargeStuaut_ = 0; // 默认没有充电 测试为充电 + int16_t chargeStatus_ = 0; // 默认没有充电 测试为充电 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelCharge.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelCharge.cpp index e4c08c545..a78dd613b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelCharge.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelCharge.cpp @@ -15,17 +15,17 @@ namespace OHOS bool DialModelCharge::GetDialFloatData(DialDataType &type, float &out) { (void)type; - out = ChargeStuaut_; - //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialModelCharge %d", ChargeStuaut_); + out = chargeStatus_; + //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialModelCharge %d", chargeStatus_); return true; } - void DialModelCharge::UpdateChargeStuaut(int16_t ChargeStuaut) + void DialModelCharge::UpdatechargeStatus(int16_t chargeStatus) { - ChargeStuaut_ = static_cast(ChargeStuaut); + chargeStatus_ = static_cast(chargeStatus); if (onChangeListener_ != nullptr) { - onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_CHARGE, ChargeStuaut_); + onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_CHARGE, chargeStatus_); } } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h index aa35ea550..79cba458e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-08-17 16:00:26 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h + */ #ifndef _SAVEBAT_PRESENTER_H #define _SAVEBAT_PRESENTER_H @@ -14,7 +20,8 @@ namespace OHOS public UIView::OnClickListener, public UIView::OnDragListener, public UIView::OnLongPressListener, - public ModelListenerSample + public ModelListenerSample, + public UIView::OnTouchListener { public: SaveBatPresenter(); @@ -34,6 +41,8 @@ namespace OHOS bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; bool OnLongPress(UIView &view, const LongPressEvent &event); + bool OnPress(UIView &view, const PressEvent &event); + bool OnRelease(UIView &view, const ReleaseEvent &event); }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatView.h b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatView.h index 5f563e6ab..1b6be41d9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatView.h @@ -18,6 +18,8 @@ #include "components/ui_button.h" #include "components/ui_digital_clock.h" #include "components/ui_box_progress.h" +#include "components/ui_circle_progress.h" + #include "SaveBatPresenter.h" #include @@ -42,25 +44,32 @@ namespace OHOS UIView *GetView(); void RefreshView(); + void InitBatteryView(); void InitTimeView(); void InitButtonView(); + void InitShowBackView(); + + void UpdateView(); private: UIView::OnDragListener *draglistener{nullptr}; SaveBatView(SaveBatView &&) = delete; SaveBatView &operator=(SaveBatView &&) = delete; - - UILabel *timelabel = nullptr; // 时间 - UILabel *datelabel = nullptr; // 日期标签 - UILabel *weeklabel = nullptr; // 星期标签 - + /*省电界面*/ + UILabel *timelabel = nullptr; // 时间 + UILabel *datelabel = nullptr; // 日期标签 + UILabel *weeklabel = nullptr; // 星期标签 UILabel *batterylabel = nullptr; // 电量标签 UIBoxProgress *batteryprogress{nullptr}; // 电池进度条 UIImageView *batteryiamge = nullptr; // 电池框图标 - - UIButton *button_exit = nullptr; // 退出按键 + UIButton *button_exit = nullptr; // 退出按键 + /*退出界面*/ + UILabel *curren_timelabel{nullptr}; + UILabel *countlabel{nullptr}; + UIImageView *wathchiamge = nullptr; + UICircleProgress *backprogress{nullptr}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveEleModel.h b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveEleModel.h index 1d056ce5d..044c0734a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveEleModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveEleModel.h @@ -1,24 +1,36 @@ +#ifndef SAVE_ELE_MODEL_H +#define SAVE_ELE_MODEL_H -#ifndef SaveEle_MODEL_H -#define SaveEle_MODEL_H - -namespace OHOS -{ - class SaveEleModel - { - public: - static SaveEleModel *GetInstance(void); - int GetChargeStuaut(); - void SetChargeStuaut(int chargestuaut); - - private: - SaveEleModel() = default; - ~SaveEleModel() {} - SaveEleModel(const SaveEleModel &) = delete; - SaveEleModel &operator=(const SaveEleModel &) = delete; - - int ChargeStuaut = 0; // 充电状态 - }; -} - -#endif \ No newline at end of file +namespace OHOS +{ + class SaveEleModel + { + public: + // 获取单例实例 + static SaveEleModel *GetInstance(); + + // 获取充电状态 + int GetChargeStatus(); + + // 设置充电状态 + void SetChargeStatus(int chargeStatus); + + // 获取视图状态 + bool GetViewState() const { return viewState; } + + // 设置视图状态 + void SetViewState(bool state) { viewState = state; } + + private: + SaveEleModel() = default; // 默认构造函数 + ~SaveEleModel() {} // 默认析构函数 + + SaveEleModel(const SaveEleModel &) = delete; // 禁止拷贝构造 + SaveEleModel &operator=(const SaveEleModel &) = delete; // 禁止赋值操作 + + int chargeStatus = 0; // 充电状态 + bool viewState{false}; // 视图状态 + }; +} + +#endif // SAVE_ELE_MODEL_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp index c6bdb4609..349b5690d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp @@ -1,17 +1,19 @@ -/*** +/*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-08-17 11:49:58 + * @LastEditTime: 2024-08-17 15:08:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp */ #include "AppViewIDs.h" #include "components/ui_label_ext.h" -#include"ui_resource_string.h" +#include "ui_resource_string.h" #include "NativeAbility.h" #include "saveele/include/SaveBatPresenter.h" #include "saveele/include/SaveEleModel.h" + +#include "string.h" namespace OHOS { @@ -56,7 +58,7 @@ namespace OHOS void SaveBatPresenter::OnStop(void) { - + SaveEleModel::GetInstance()->SetViewState(false); Presenter::OnStop(); } @@ -69,12 +71,17 @@ namespace OHOS bool SaveBatPresenter::OnClick(UIView &view, const ClickEvent &event) { - + if (strcmp(view.GetViewId(), "button_exit") == 0) + { + /*点击*/ + bool state = SaveEleModel::GetInstance()->GetViewState(); + SaveEleModel::GetInstance()->SetViewState(!state); + SaveBatView::GetInstance()->UpdateView(); + } return true; } bool SaveBatPresenter::OnLongPress(UIView &view, const LongPressEvent &event) { - // 1.长按三秒button1 // 2.退出 button1NativeAbility::GetInstance().ChangeSlice(VIEW_SAVEELE); // 3.返回 true 以消耗点击事件 if (strcmp(view.GetViewId(), "button_exit") == 0) @@ -83,9 +90,24 @@ namespace OHOS } return true; } + bool SaveBatPresenter::OnPress(UIView &view, const PressEvent &event) + { + + return true; + } + bool SaveBatPresenter::OnRelease(UIView &view, const ReleaseEvent &event) + { + if (strcmp(view.GetViewId(), "button_exit") == 0) + { + /*释放*/ + SaveEleModel::GetInstance()->SetViewState(false); + SaveBatView::GetInstance()->UpdateView(); + } + return true; + } void SaveBatPresenter::ExitView(void) { - if (SaveEleModel::GetInstance()->GetChargeStuaut()) + if (SaveEleModel::GetInstance()->GetChargeStatus()) { NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp index bf4bb482a..e0a4b44e4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp @@ -1,6 +1,7 @@ #include "saveele/include/SaveBatView.h" +#include "saveele/include/SaveEleModel.h" #include "common/image_cache_manager.h" #include "UiConfig.h" @@ -24,6 +25,8 @@ std::string Cnweekday[] = {"周天", "周一", "周二", "周三", "周四", " static constexpr const char *WHITE_BATTERY = "/user/res/Battery/Battery-E.bin"; static constexpr const char *SAVE_BUTTON = "/user/res/Save_Ele/finger.bin"; +static constexpr const char *BACK_BUTTON = "/user/res/Save_Ele/finger2.bin"; +static constexpr const char *SAVE_WATHCH = "/user/res/Save_Ele/wathch.bin"; namespace OHOS { @@ -76,7 +79,7 @@ namespace OHOS // 构建日期和时间字符串 std::string dateStr = (month < 10 ? "0" : "") + std::to_string(month) + "-" + - (day < 10 ? "0" : "") + std::to_string(day)+" "+weekStr; + (day < 10 ? "0" : "") + std::to_string(day) + " " + weekStr; std::string stringtime = (hour < 10 ? "0" : "") + std::to_string(hour) + ":" + @@ -195,9 +198,105 @@ namespace OHOS button_exit->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); button_exit->SetOnLongPressListener(presenter_); + // button_exit->SetOnClickListener(presenter_); container_->Add(button_exit); } + void SaveBatView::InitShowBackView() + { + // 时间 + if (curren_timelabel == nullptr) + { + curren_timelabel = new UILabel(); + } + curren_timelabel->SetPosition(181, 52); + curren_timelabel->Resize(200, 60); + curren_timelabel->SetViewId("label4"); + curren_timelabel->SetStyle(STYLE_TEXT_FONT, 40); + curren_timelabel->SetText("12:10"); + curren_timelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + curren_timelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + curren_timelabel->SetRollSpeed(0); + curren_timelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + container_->Add(curren_timelabel); + curren_timelabel->SetVisible(false); + + // 圆形进度条 + if (backprogress == nullptr) + { + backprogress = new UICircleProgress(); + } + backprogress->SetPosition(143, 143); + backprogress->Resize(183, 186); + backprogress->SetViewId("circleProgress1"); + backprogress->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + backprogress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + backprogress->SetBackgroundStyle(STYLE_LINE_WIDTH, 20); + backprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6); + backprogress->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000); + backprogress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff18ef05); + backprogress->SetForegroundStyle(STYLE_LINE_WIDTH, 20); + backprogress->SetCenterPosition(92, 93); + backprogress->SetRadius(90); + backprogress->SetEndAngle(359); + backprogress->SetValue(30); + container_->Add(backprogress); + backprogress->SetVisible(false); + + // 手表image + if (wathchiamge == nullptr) + { + wathchiamge = new UIImageView(); + } + wathchiamge->SetPosition(188, 182); + wathchiamge->Resize(100, 100); + wathchiamge->SetViewId("image1"); + wathchiamge->SetSrc(SAVE_WATHCH); + container_->Add(wathchiamge); + wathchiamge->SetVisible(false); + + // 倒计时 + if (countlabel == nullptr) + { + countlabel = new UILabel(); + } + countlabel->SetPosition(221, 212); + countlabel->Resize(200, 60); + countlabel->SetViewId("label3"); + countlabel->SetStyle(STYLE_TEXT_FONT, 40); + countlabel->SetText("3"); + countlabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + countlabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + countlabel->SetRollSpeed(0); + countlabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + container_->Add(countlabel); + countlabel->SetVisible(false); + } + // 更新当前界面状态 + void SaveBatView ::UpdateView() + { + bool state = SaveEleModel::GetInstance()->GetViewState(); + + /*原界面*/ + timelabel->SetVisible(!state); + datelabel->SetVisible(!state); + weeklabel->SetVisible(!state); + batterylabel->SetVisible(!state); + batteryprogress->SetVisible(!state); + batteryiamge->SetVisible(!state); + + /*退出界面*/ + curren_timelabel->SetVisible(state); + countlabel->SetVisible(state); + wathchiamge->SetVisible(state); + backprogress->SetVisible(state); + /* + if (state) + button_exit->SetImageSrc(BACK_BUTTON, BACK_BUTTON); + else + button_exit->SetImageSrc(SAVE_BUTTON, SAVE_BUTTON); + */ + } void SaveBatView::OnStart() { container_ = new UIViewGroup(); @@ -205,6 +304,7 @@ namespace OHOS { return; } + container_->SetPosition(0, 0); container_->SetWidth(Screen::GetInstance().GetWidth()); container_->SetHeight(Screen::GetInstance().GetHeight()); @@ -214,20 +314,19 @@ namespace OHOS InitBatteryView(); InitTimeView(); InitButtonView(); + // InitShowBackView(); RootView::GetInstance()->Add(container_); } void SaveBatView::OnSetUpView() { - View::OnSetUpView(); Draw(); } void SaveBatView::OnTearDownView() { - View::OnTearDownView(); return; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp index 8f7d9f698..072adcfcd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-08-17 16:15:17 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp + */ #include "saveele/include/SaveEleModel.h" namespace OHOS @@ -8,12 +14,12 @@ namespace OHOS static SaveEleModel instance; return &instance; } - int SaveEleModel::GetChargeStuaut() + int SaveEleModel::GetChargeStatus() { - return ChargeStuaut; + return chargeStatus; } - void SaveEleModel::SetChargeStuaut(int chargestuaut) + void SaveEleModel::SetChargeStatus(int chargeStatus) { - ChargeStuaut = chargestuaut; + chargeStatus = chargeStatus; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp index e66efd33d..a1bc6a07b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp @@ -39,6 +39,7 @@ #include #include "thread_adapter.h" #include "cmsis_os.h" +#include "ui_service.h" extern "C" errcode_t uapi_get_TIME_STR(uint32_t time, char *p_time, char date_separator, char time_separator, date_format_t format); extern "C" int get_sleep_time_from_config_model(void); @@ -617,6 +618,9 @@ namespace OHOS total_minutes += 60; // 转换为正数,加60分钟 } goal_total_time = total_hours; // 确保最小时间为0小时 + + /*通知界面更新*/ + SendMsgToUIService(UI_UPDATE_SLEEP_DATA, 0, nullptr, 0); } // 获取睡眠总时长(小时) int SleepModel::get_sleep_hour() diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h index 705ddec8e..9ee46abe6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h @@ -52,7 +52,11 @@ namespace OHOS void ModifiesTime(); void RefreshData(); // 更新数据 + + /*蓝牙开启运动*/ bool send_sport_cmd(training_ble *cmd); + /*运动识别开启运动*/ + void set_sport_config(UIResourceTextId id); /*控制*/ void handleStartState(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index d61473158..687c6dfb6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -314,6 +314,26 @@ namespace OHOS return false; // 没有匹配的操作 } + /* -------------------------------- 运动识别发起处理 -------------------------------- */ + void TraingCardPresenter::set_sport_config(UIResourceTextId id) + { + if (id >= MAXSPORTID) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "id is error"); + return; + } + // 开始训练 ->不返回 + NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD); + // 配置运动项 + TraingModel::GetInstance()->SetSportEvent(id); + // 获取运动项目 + ExerciseClass type = TraingModel::GetInstance()->GetSportId(); + // 开启对应的运动 + TraingCardPresenter::GetInstance()->OpenSensor(type); + // 设置为手表开启运动 + TraingModel::GetInstance()->SetSportOpenWay(false); + } + /* -------------------------------- 协议发起运动处理 -------------------------------- */ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 041c9286a..4de3731ba 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -361,9 +361,9 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) display_api->turn_on_screen(); } #if DIALDATASET - DialModelCharge::GetInstance()->UpdateChargeStuaut(1); + DialModelCharge::GetInstance()->UpdatechargeStatus(1); #endif - SaveEleModel::GetInstance()->SetChargeStuaut(1); + SaveEleModel::GetInstance()->SetChargeStatus(1); @@ -387,9 +387,9 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) unused(topic); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !"); #if DIALDATASET - DialModelCharge::GetInstance()->UpdateChargeStuaut(0); + DialModelCharge::GetInstance()->UpdatechargeStatus(0); #endif - SaveEleModel::GetInstance()->SetChargeStuaut(0); + SaveEleModel::GetInstance()->SetChargeStatus(0); @@ -459,8 +459,8 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) //TODO: 亮屏弹窗倒计时5秒关机(不需要取消,强制关机) - // DialModelCharge::GetInstance()->UpdateChargeStuaut(0); - // SaveEleModel::GetInstance()->SetChargeStuaut(0); + // DialModelCharge::GetInstance()->UpdatechargeStatus(0); + // SaveEleModel::GetInstance()->SetChargeStatus(0); // testCHANINGView *t=testCHANINGView::GetInstance(); // if(t!=NULL) diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp index 10c4f2832..b708ae7db 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp @@ -44,6 +44,7 @@ namespace OHOS #define CLOSEBUTTON "close_button" #define NOPBUTTON "nop_button" + static int countsleep = 0; /* -------------------------------------------------------------------------- */ /*创建睡眠弹窗*/ @@ -250,6 +251,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free SleepView succeed!!"); ScreenTurnOff(); } + countsleep = 0; // 重置 return; } @@ -545,7 +547,6 @@ namespace OHOS void SleepRingPlayerCallbackImpl::OnPlaybackComplete(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnPlaybackComplete"); - static int countsleep = 0; SleepViewEventListener::GetInstance().PopInterCancelMusic(); /*达到最大次数不再播放*/ if (countsleep <= MAX_SLEEP_RING) -- 2.17.1