From dfb2bc97551d98fb9a990a628dd4e6c1b8db13c3 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 12 Oct 2024 17:02:10 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E7=9B=AE=E6=A0=87=E8=BE=BE?= =?utf8?q?=E6=88=90=E5=BC=82=E5=B8=B8=E5=BC=B9=E5=87=BABUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/activity/include/ActivityModel.h | 4 +- .../nativeui/activity/src/ActivityModel.cpp | 83 ++++++++++++++++++ .../fd230app/nativeui/goal/src/goalmodel.cpp | 4 +- .../msg_center/src/msg_center_customer.cpp | 85 ++----------------- 4 files changed, 94 insertions(+), 82 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/activity/include/ActivityModel.h b/code/sdk/application/wearable/fd230app/nativeui/activity/include/ActivityModel.h index 7c694f9f8..db661a35e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/activity/include/ActivityModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/activity/include/ActivityModel.h @@ -47,8 +47,8 @@ public: private: ActivityModel(); bool InitStepData(void); - uint32 stepCounter; - uint32 lastSavedValue; + uint32 stepCounter=0; + uint32 lastSavedValue=0; int weekToday; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp index 4b7ea8439..925fae3f0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp @@ -24,6 +24,13 @@ #include "DialModelCalorie.h" #include "DialModelDistance.h" #include "cywee_service.h" +#include "custom_runtime.h" +#include "goal/include/goalmodel.h" +#include "goal/include/goalview.h" +#include "goal/include/goalother.h" +#include "goal_notification.h" +#include "custom_utils.h" +// #include "goal/include/goalmodel.h" using namespace std; #ifdef __cplusplus @@ -111,6 +118,8 @@ static void RefreshStepControls(const uint32_t &value, const uint16 &msgId) } } +static uint8_t goal_type=0; + static void Notify(void *args, const Topic topic, Request* request) { UNUSED(args); @@ -140,6 +149,80 @@ static void Notify(void *args, const Topic topic, Request* request) RefreshStepControls(counter, TOPIC_EVENT_STEPDATA_UPDATE); } + #ifdef FD230 + if(OHOS::GoalView::GetInstance()) + { + OHOS::GoalView::GetInstance()->GoalViewrefresh(); + } + if(OHOS::GoalotherView::GetInstance()) + { + OHOS::GoalotherView::GetInstance()->GoalViewrefresh(); + } + + if(OHOS::GoalModel::GetInstance().getstepvalue()>=100) + { + + goal_type=GOAL_STEP; + if(get_Is_shouw_falg(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_step_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + + if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done()) + { + goal_type=GOAL_DISTANCE; + if(get_Is_shouw_falg(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + + } + } + + if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done()) + { + goal_type=GOAL_FAT; + if(get_Is_shouw_falg(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + + if(OHOS::GoalModel::GetInstance().is_goal_stand_done()) + { + goal_type=GOAL_STAND; + if(get_Is_shouw_falg(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + + if(OHOS::GoalModel::GetInstance().is_goal_calories_done()) + { + goal_type=GOAL_CALOREIE; + if(get_Is_shouw_falg(goal_type)) + { + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + { + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); + } + } + } + +#endif + if (request->msgId == TOPIC_EVENT_NEXTDAY_UPDATE) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "STEP:TOPIC_EVENT_NEXTDAY_UPDATE"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp index c1e13841e..a4fc28001 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp @@ -43,7 +43,7 @@ namespace OHOS uint8_t GoalModel::getstepvalue() { int stepgoal = step; - int stepdata = OHOS::ActivityModel::GetInstance()->GetStepCounter(); + int stepdata = get_step_data();//OHOS::ActivityModel::GetInstance()->GetStepCounter(); // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d %d %f ",stepdata,stepgoal,((float)stepdata/(float)stepgoal) * 100); uint8_t value = ((float)stepdata / (float)stepgoal) * 100; @@ -66,7 +66,7 @@ namespace OHOS char stepnewstr[20]; char *GoalModel::getstepnew() { - int stepdata = OHOS::ActivityModel::GetInstance()->GetStepCounter(); + int stepdata = get_step_data(); memset((void *)stepnewstr, 0, 20); sprintf_s(stepnewstr, 20, "%d", stepdata); return stepnewstr; 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 0b3241acf..3c0d04a6a 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 @@ -398,83 +398,11 @@ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req) } - static uint8_t goal_type=0; + void MsgCenterNotifystepProc(const Topic topic, Request* req) { unused(req); -#ifdef FD230 - if(OHOS::GoalView::GetInstance()) - { - OHOS::GoalView::GetInstance()->GoalViewrefresh(); - } - if(OHOS::GoalotherView::GetInstance()) - { - OHOS::GoalotherView::GetInstance()->GoalViewrefresh(); - } - - if(OHOS::GoalModel::GetInstance().getstepvalue()>=100) - { - - goal_type=GOAL_STEP; - if(get_Is_shouw_falg(goal_type)) - { - if(OHOS::GoalModel::GetInstance().get_step_goal_show()) - { - CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); - } - } - } - - if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done()) - { - goal_type=GOAL_DISTANCE; - if(get_Is_shouw_falg(goal_type)) - { - if(OHOS::GoalModel::GetInstance().get_other_goal_show()) - { - CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); - } - - } - } - - if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done()) - { - goal_type=GOAL_FAT; - if(get_Is_shouw_falg(goal_type)) - { - if(OHOS::GoalModel::GetInstance().get_other_goal_show()) - { - CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); - } - } - } - - if(OHOS::GoalModel::GetInstance().is_goal_stand_done()) - { - goal_type=GOAL_STAND; - if(get_Is_shouw_falg(goal_type)) - { - if(OHOS::GoalModel::GetInstance().get_other_goal_show()) - { - CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); - } - } - } - if(OHOS::GoalModel::GetInstance().is_goal_calories_done()) - { - goal_type=GOAL_CALOREIE; - if(get_Is_shouw_falg(goal_type)) - { - if(OHOS::GoalModel::GetInstance().get_other_goal_show()) - { - CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); - } - } - } - -#endif // The alarm notification is not displayed if the incoming call notification is already being processed // cywee_save_data(); @@ -1037,12 +965,13 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true); return; } - cat1_call_dial(call_data); - CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); - CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + + cat1_call_dial(call_data); + CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); - cat1_phone_state_change_cb(OPERATE_DIALING); - NotificationManager::GetInstance()->SetWatchCallStatus(true); + cat1_phone_state_change_cb(OPERATE_DIALING); + NotificationManager::GetInstance()->SetWatchCallStatus(true); } free(call_data); } -- 2.17.1