From b0874d5307436e11bd8def2f37f7a74ad2b2d0ae Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 30 Sep 2025 18:08:53 +0800 Subject: [PATCH] =?utf8?q?GOAL=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/AlarmClockTimerConfig.cpp | 29 ++++++++ .../nativeapp/nativeui/goal/src/goalmodel.cpp | 7 -- .../msg_center/src/msg_center_customer.cpp | 74 +++++++++---------- .../src/notify/goal_notification.cpp | 53 ------------- .../nativeapp/nativeui/goal/src/goalmodel.cpp | 4 - 5 files changed, 62 insertions(+), 105 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index d0dffed00..df272d9fd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -40,6 +40,13 @@ #include "cywee_service.h" #endif +#ifdef SUPPORT_CYWEE_SERVICE +#include "cywee_data.h" +#include "cywee_hal.h" +#endif + + + #ifdef SUPPORT_PPG_SERVICE #include "ppg_service.h" #endif @@ -48,6 +55,9 @@ extern "C" { #endif + #ifdef SUPPORT_CYWEE_SERVICE + void stepdataTime(void); + #endif static AlarmCtrl g_alarmCtrA; static AlarmCtrl g_alarmCtrB; @@ -435,6 +445,9 @@ extern "C" HandleAlarmOnTime(&curTime); HandleSleepReminder(&curTime); HandleMusicUpdate(); + #ifdef SUPPORT_CYWEE_SERVICE + stepdataTime(); + #endif // 以下弹窗被控制 if (HandleCanShowDialog()) @@ -492,6 +505,22 @@ extern "C" std::bind(AlarmTimerEventPublish, TOPIC_EVENT_ON_TIME, unuse)); } } +#ifdef SUPPORT_CYWEE_SERVICE + + static uint32_t last_step = 0; + + void stepdataTime(void) + { + AlarmClockEventData unuse; + uint32_t new_data = cywee_get_sport_data(STEP); + if(last_step!=new_data) + { + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(AlarmTimerEventPublish, TOPIC_EVENT_STEPDATA_UPDATE, unuse)); + last_step=new_data; + } + } +#endif // 睡眠提醒 void HandleSleepReminder(const struct tm *curTime) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/goalmodel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/goalmodel.cpp index 931040d74..d8fdfab54 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/goalmodel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/goalmodel.cpp @@ -529,7 +529,6 @@ namespace OHOS } free(date); return toal_data; - // return 0; } @@ -547,7 +546,6 @@ namespace OHOS if(value>0) toal_date+=value; return toal_date; - return 0; } float GoalModel::show_data_calories_refresh(void) @@ -564,7 +562,6 @@ namespace OHOS toal_date+=_f_value; return toal_date; - return 0; } float GoalModel::show_data_distance_refresh(void) @@ -581,8 +578,6 @@ namespace OHOS toal_date+=_f_value; return toal_date; - - // return 0; } uint32_t GoalModel::show_data_fat_refresh(void) @@ -599,8 +594,6 @@ namespace OHOS toal_date+=_16_value; return toal_date; - - // return 0; } 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 6b27f7383..39208a411 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 @@ -45,7 +45,9 @@ #ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif - +#include "goal/include/goalmodel.h" +#include "goal/include/goalview.h" +#include "goal/include/goalother.h" #include "ConfigModel.h" #include "PlayersModelC.h" #include "PlayersModel.h" @@ -78,10 +80,13 @@ #ifdef SUPPORT_CYWEE_SERVICE #include "cywee_hal.h" +#include "cywee_data.h" #endif #include "cat1_pub_api.h" +#include "uiservice/include/ui_service.h" +#include "goal_notification.h" namespace OHOS { #ifdef __cplusplus @@ -116,11 +121,12 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,PRIORITY_TWO}, - {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO}, #endif + {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO}, + {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO}, {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE}, @@ -417,24 +423,28 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) unused(req); AlarmClockEventData* time=(AlarmClockEventData*)req->data; #ifdef SUPPORT_CYWEE_SERVICE -#if 0 + cywee_save_data(); //暂时没有这个函数 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数"); - step_history_save(time->value); + cywee_step_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据"); - if(get_stand_falg()) - stand_history_save(time->value); + if(cywee_get_stand_flag()) + cywee_stand_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); - calories_history_save(time->value); + cywee_calories_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据"); - distances_history_save(time->value); + cywee_distances_history_save(time->value); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据"); - fat_history_save(time->value); + cywee_fat_history_save(time->value); // 保存完增加一次读取数据 SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); #endif - #endif -} + } //设备绑定通知 void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) { @@ -999,9 +1009,6 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req) } #endif - - -#if 0 //每日活动 void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req) { @@ -1009,24 +1016,18 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req) if (CheckPriority(topic)) { uint8_t* data=(uint8_t*)req->data; - #if 0 + if(get_Is_show_flag(data[0])) { set_goal_flag_view(data[0]); set_Is_show_flag(0,data[0]); - const power_display_svr_api_t *display_api = power_display_svr_get_api(); - - if (display_api->get_screen_state() != SCREEN_ON) - { - display_api->turn_on_screen(); - } - + uapi_set_screen_on_api(); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast(topic), true); } - #endif - + } } @@ -1037,27 +1038,16 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req) if (req->msgId == TOPIC_EVENT_STEPDATA_UPDATE) { - #ifdef SUPPORT_CYWEE_SERVICE + #ifdef SUPPORT_CYWEE_SERVICE if (req->data == nullptr) { return; } // 计步数据累加 - uint32_t counter = 0; - // OHOS::ActivityModel::GetInstance()->GetStepCounter(); - counter = *(uint32_t *)req->data; - set_step_data(counter); - counter=OHOS::GoalModel::GetInstance().show_data_step_refresh(); - uint32_t calories= OHOS::GoalModel::GetInstance().show_data_calories_refresh(); - float distance= OHOS::GoalModel::GetInstance().show_data_distance_refresh(); - // OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数 - // OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标 - // OHOS::DialModelDistance::GetInstance() ->UpdateDistance(distance);//更新表盘距离 - // OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(calories);//更新表盘卡路里 - // OHOS::DialModelKcalgoalStr::GetInstance() ->UpdateKcalgoalStr(calories);//更新卡路里目标值 - // OHOS::DialModelKcalgoalValue::GetInstance() ->UpdateKcalgoalValue(calories);//更新卡路里int目标值 - // OHOS::DialModelStepgoalStr::GetInstance() ->UpdateStepgoalStr(counter);//更新步数目标值 - // OHOS::DialModelStepgoalValue::GetInstance() ->UpdateStepgoalValue(counter);//更新步数int目标值 - + + OHOS::GoalModel::GetInstance().show_data_step_refresh(); + OHOS::GoalModel::GetInstance().show_data_calories_refresh(); + OHOS::GoalModel::GetInstance().show_data_distance_refresh(); + if(OHOS::GoalView::GetInstance()) { GraphicService::GetInstance()->PostGraphicEvent( @@ -1139,6 +1129,7 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req) } +#if 0 //每日训练数据刷新 void MsgCenterNotifyActivityProc(const Topic topic, Request* req) { @@ -1513,6 +1504,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc}, {TOPIC_EVENT_ON_TIME, MsgCenterNotifyONtimeProc},//增加整点保存数据 {TOPIC_EVENT_NEXTDAY_UPDATE, MsgCenterNotifyNextDayProc}, + {TOPIC_EVENT_STEPDATA_UPDATE, MsgCenterNotifystepProc}, {TOPIC_EVENT_HFP_INCOMMING, MsgCenterNotifyHfpIncomingProc}, {TOPIC_EVENT_HFP_PHONE_ACTIVE, MsgCenterNotifyHfpPhoneProc}, diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/goal_notification.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/goal_notification.cpp index 487ec4cc1..160752bd8 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/goal_notification.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/goal_notification.cpp @@ -124,59 +124,6 @@ namespace OHOS static uint8_t GOAL_STEP_falg = 1; - // static uint8_t set_last_show_time(uint8_t type) - // { - - // switch (type) { - // case GOAL_CALOREIE: - // ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES); - // break; - // case GOAL_FAT: - // ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION); - // break; - // case GOAL_STAND: - // ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES); - // break; - // case GOAL_DISTANCE: - // ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE); - // break; - // case GOAL_STEP: - // ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);; - // break; - // default: - // break; - // } - // } - - // static uint8_t get_last_show_time(uint8_t type) - // { - // uint32_t tagType =flag_goal; - // switch (tagType) { - // case GOAL_CALOREIE: - // tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES); - // tagString=std::to_string(tag)+"kcal"; - // break; - // case GOAL_FAT: - // tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION); - // tagString=std::to_string(tag)+"min"; - // break; - // case GOAL_STAND: - // tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES); - // tagString=std::to_string(tag)+"times"; - // break; - // case GOAL_DISTANCE: - // tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE); - // tagString=std::to_string(tag)+"km"; - // break; - // case GOAL_STEP: - // tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);; - // tagString=std::to_string(tag)+"steps"; - // break; - // default: - // break; - // } - // } - uint8_t get_Is_show_flag(uint8_t type) { switch (type) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/goal/src/goalmodel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/goal/src/goalmodel.cpp index 931040d74..b4a09ea64 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/goal/src/goalmodel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/goal/src/goalmodel.cpp @@ -547,7 +547,6 @@ namespace OHOS if(value>0) toal_date+=value; return toal_date; - return 0; } float GoalModel::show_data_calories_refresh(void) @@ -564,7 +563,6 @@ namespace OHOS toal_date+=_f_value; return toal_date; - return 0; } float GoalModel::show_data_distance_refresh(void) @@ -581,8 +579,6 @@ namespace OHOS toal_date+=_f_value; return toal_date; - - // return 0; } uint32_t GoalModel::show_data_fat_refresh(void) -- 2.17.1