From: hcj <1224667075@qq.com> Date: Wed, 6 Nov 2024 10:03:27 +0000 (+0800) Subject: 修改步数刷新 X-Git-Tag: fd230_release_V1.3.102~116 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=263924c656e547b68d2f344c9d8c2615b004886b;p=mirrors%2FFD230.git 修改步数刷新 --- 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 f0948c363..ccebd96ec 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp @@ -129,103 +129,7 @@ static void Notify(void *args, const Topic topic, Request* request) return; } - if (request->msgId == TOPIC_EVENT_STEPDATA_UPDATE) - { - if (request->data == nullptr) { - return; - } - // 计步数据累加 - uint32_t counter = - 0; // OHOS::ActivityModel::GetInstance()->GetStepCounter(); - counter = *(uint32_t *)request->data; - set_step_data(counter); - counter = get_step_data();//*(uint32_t *)request->data; - OHOS::ActivityModel::GetInstance()->ReviseStepCounter(counter); - - OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数 - OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标 - OHOS::DialModelDistance::GetInstance() ->UpdateDistance(get_distance_data());//更新表盘距离 - OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(get_calories_data());//更新表盘卡路里 - - GraphicService::GetInstance()->PostGraphicEvent( - std::bind(&ActivityModel::SetStepData, ActivityModel::GetInstance(), counter)); - 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_show_flag(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_show_flag(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_show_flag(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_show_flag(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_show_flag(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/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index f04395db4..46cd19a59 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 @@ -77,6 +77,10 @@ #include "ui_service.h" #include "UiConfig.h" +#include "DialModelSteps.h" +#include "DialModelCalorie.h" +#include "DialModelDistance.h" +#include "DialModelStepgoal.h" #define DIALDATASET 1 //#include "Systemupgrade.h" @@ -409,13 +413,103 @@ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req) } +static uint8_t goal_type=0; void MsgCenterNotifystepProc(const Topic topic, Request* req) { - unused(req); + //unused(req); + if (req->msgId == TOPIC_EVENT_STEPDATA_UPDATE) + { + + #ifdef FD230 + if (req->data == nullptr) { + return; + } + // 计步数据累加 + uint32_t counter = + 0; // OHOS::ActivityModel::GetInstance()->GetStepCounter(); + counter = *(uint32_t *)req->data; + set_step_data(counter); + + OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数 + OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标 + OHOS::DialModelDistance::GetInstance() ->UpdateDistance(get_distance_data());//更新表盘距离 + OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(get_calories_data());//更新表盘卡路里 + + + 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_show_flag(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_show_flag(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_show_flag(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_show_flag(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_show_flag(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(); }