From 4e2273fb77449994ebc7bbc15cf6e0827faad953 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 5 Nov 2024 16:46:40 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E6=AF=8F=E6=97=A5=E7=9B=AE?= =?utf8?q?=E6=A0=87=E8=BE=BE=E6=88=90=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/activity/src/ActivityModel.cpp | 12 +++--- .../fd230app/nativeui/goal/src/goalmodel.cpp | 10 ++--- .../include/notify/goal_notification.h | 4 +- .../msg_center/src/msg_center_customer.cpp | 42 +++++++++++-------- .../src/notify/goal_notification.cpp | 8 ++-- 5 files changed, 42 insertions(+), 34 deletions(-) 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 a05caf528..5eb74d044 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp @@ -165,7 +165,7 @@ static void Notify(void *args, const Topic topic, Request* request) { goal_type=GOAL_STEP; - if(get_Is_shouw_falg(goal_type)) + if(get_Is_show_flag(goal_type)) { if(OHOS::GoalModel::GetInstance().get_step_goal_show()) { @@ -177,7 +177,7 @@ static void Notify(void *args, const Topic topic, Request* request) if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done()) { goal_type=GOAL_DISTANCE; - if(get_Is_shouw_falg(goal_type)) + if(get_Is_show_flag(goal_type)) { if(OHOS::GoalModel::GetInstance().get_other_goal_show()) { @@ -190,7 +190,7 @@ static void Notify(void *args, const Topic topic, Request* request) if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done()) { goal_type=GOAL_FAT; - if(get_Is_shouw_falg(goal_type)) + if(get_Is_show_flag(goal_type)) { if(OHOS::GoalModel::GetInstance().get_other_goal_show()) { @@ -202,9 +202,9 @@ static void Notify(void *args, const Topic topic, Request* request) if(OHOS::GoalModel::GetInstance().is_goal_stand_done()) { goal_type=GOAL_STAND; - if(get_Is_shouw_falg(goal_type)) + if(get_Is_show_flag(goal_type)) { - if(OHOS::GoalModel::GetInstance().get_other_goal_show()) + if(OHOS::GoalModel::GetInstance().get_other_goal_show()) { CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1); } @@ -214,7 +214,7 @@ static void Notify(void *args, const Topic topic, Request* request) if(OHOS::GoalModel::GetInstance().is_goal_calories_done()) { goal_type=GOAL_CALOREIE; - if(get_Is_shouw_falg(goal_type)) + if(get_Is_show_flag(goal_type)) { if(OHOS::GoalModel::GetInstance().get_other_goal_show()) { 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 acb62290e..2d12c49bd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp @@ -26,11 +26,11 @@ namespace OHOS void GoalModel::GoalModelInitdata() { - OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME),OHOS::GOAL_CALOREIE); - OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME),OHOS::GOAL_STAND); - OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME),OHOS::GOAL_FAT); - OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME),OHOS::GOAL_DISTANCE); - OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME),OHOS::GOAL_STEP); + OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME),OHOS::GOAL_CALOREIE); + OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME),OHOS::GOAL_STAND); + OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME),OHOS::GOAL_FAT); + OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME),OHOS::GOAL_DISTANCE); + OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME),OHOS::GOAL_STEP); step_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEP); other_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER); diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/goal_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/goal_notification.h index e96dd068f..336a85017 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/goal_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/goal_notification.h @@ -23,9 +23,9 @@ namespace OHOS UIViewGroup *GoalviewShow(void); void set_goal_flag_view(uint8_t falg); - uint8_t get_Is_shouw_falg(uint8_t type); + uint8_t get_Is_show_flag(uint8_t type); - uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type); + uint8_t set_Is_show_flag(uint8_t flag,uint8_t type); class GoalViewEventListener : public OHOS::UIView::OnClickListener, 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 8ccff4567..36248f2a4 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 @@ -369,9 +369,7 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); } - - - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); calories_history_save(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据"); distances_history_save(); @@ -387,10 +385,10 @@ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req) uint8_t* data=(uint8_t*)req->data; - if(get_Is_shouw_falg(data[0])) + if(get_Is_show_flag(data[0])) { set_goal_flag_view(data[0]); - set_Is_shouw_falg(0,data[0]); + set_Is_show_flag(0,data[0]); const power_display_svr_api_t *display_api = power_display_svr_get_api(); @@ -602,13 +600,18 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req) OHOS::BloodOxygenModel::GetInstance())); printf("health end\n"); /* --------------------------------- 每日目标相关 --------------------------------- */ + cywee_reset_history_daily_data(); //清除运动相关数据 + // 午夜清除运动数据 for(int i=1;i<6;i++) { - set_Is_shouw_falg(1,i); + set_Is_show_flag(1,i); } - cywee_reset_history_daily_data(); //清除运动相关数据 + + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL); + + // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); printf("sport end\n"); /* ---------------------------------- 呼吸训练相关 ---------------------------------- */ RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime(); @@ -977,7 +980,6 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); - //暂时关闭该功能,易导致系统音频锁死 SetMicMutecat1(false); cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE); @@ -997,6 +999,7 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) unused(req); if (req == NULL) return ; char* call_data = (char*)malloc(req->len); + if(call_data==NULL) return; int32 ret = memcpy_s(call_data, req->len, req->data, req->len); if (ret != EOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!"); @@ -1004,8 +1007,6 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) // int ret = PlayersModel::GetInstance()->PlayerStop(); stopPlayingMusic(); - - if(strcmp(call_data,"SOS")==0) { @@ -1014,17 +1015,17 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) return; } - cat1_call_dial(call_data); - - CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); + cat1_call_dial(call_data); - CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); - NotificationManager::GetInstance()->SetWatchCallStatus(true); + CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); + + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + NotificationManager::GetInstance()->SetWatchCallStatus(true); - cat1_phone_state_change_cb(OPERATE_DIALING); - - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); + cat1_phone_state_change_cb(OPERATE_DIALING); + + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); @@ -1048,6 +1049,11 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) if (req == NULL) return ; char* call_data = (char*)malloc(req->len); + + if(call_data==NULL) + { + return; + } int32 ret = memcpy_s(call_data, req->len, req->data, req->len); if(strcmp("callfail",call_data)==0) diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp index 41dbdfa81..7cf2eb2a9 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp @@ -170,7 +170,7 @@ namespace OHOS // } // } - uint8_t get_Is_shouw_falg(uint8_t type) + uint8_t get_Is_show_flag(uint8_t type) { switch (type) { case GOAL_CALOREIE: @@ -195,13 +195,13 @@ namespace OHOS } - uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type) + uint8_t set_Is_show_flag(uint8_t flag,uint8_t type) { switch (type) { case GOAL_CALOREIE: GOAL_CALOREIE_falg=flag; - ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME,flag); + ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME,flag); break; case GOAL_FAT: @@ -271,6 +271,7 @@ namespace OHOS InitLabel(labeltag, 70, 215, 326, 97, "label2", tagString.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 80); labeltag->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); + labeltag->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); getView->Add(labeltag); // 初始化图片数组以及动画 @@ -413,6 +414,7 @@ namespace OHOS break; } labeltag->SetText(tagString.c_str()); + labeltag->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); getView->Invalidate(); } -- 2.17.1