From 2faf2ea480b8391daa74eb0cfc9eeee24e277aa6 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 6 Feb 2026 20:23:18 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E7=9B=AE=E6=A0=87=E8=BE=BE?= =?utf8?q?=E6=88=90=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/AlarmClockTimerConfig.cpp | 2 +- .../msg_center/src/msg_center_customer.cpp | 44 +++++++++---------- .../src/notify/goal_notification.cpp | 29 +++++++++--- code/sdk/zhihui/utils/custom_utils_at_cmd.c | 18 ++++++++ code/sdk/zhihui/utilscpp/custom_utilscpp.cpp | 2 +- 5 files changed, 64 insertions(+), 31 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index e6d41d102..76b4172e9 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -259,7 +259,7 @@ extern "C" } broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request); broadcastApi->Release((IUnknown *)broadcastApi); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish end!!"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmEventPublish end!!"); return; } diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp index 8e9e857f9..d5b30108e 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp @@ -466,11 +466,11 @@ #ifdef SUPPORT_BLE_SERVICE //unused(req); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!"); - // 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(); - // } + 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(); + } uint8_t* data=(uint8_t*)req->data; /* 安全:固定上限 + 显式终止 */ const size_t kMaxDevName = 64; @@ -1328,23 +1328,23 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) //运动目标通知 void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req) { - unused(req); - if (CheckPriority(topic)) - { - uint8_t* data=(uint8_t*)req->data; - 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(); - - uapi_set_screen_on_api(); - - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast(topic), true); - } - } + unused(req); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyGoalShowViewProc目标达成 !"); + if (CheckPriority(topic)) + { + uint8_t* data=(uint8_t*)req->data; + 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(); + uapi_set_screen_on_api(); + + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast(topic), true); + } + } } //喝水提醒通知 void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req) diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/goal_notification.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/goal_notification.cpp index 33915881b..bba70c4eb 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/goal_notification.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/goal_notification.cpp @@ -8,6 +8,7 @@ #include "components/ui_label.h" #include "components/ui_label_ext.h" #include "components/ui_label_button_ext.h" +#include "components/ui_image_view.h" #include "osal_timer.h" #include "cmsis_os2.h" #include "NativeAbility.h" @@ -47,6 +48,7 @@ namespace OHOS static const ImageInfo **winimageInfos{nullptr}; static ImageAnimatorInfo *winimageAnimatorInfo{nullptr}; static std::string winbasePath = "/user/res/Training/training_GIF/win/"; + static UIImageView *image_goalview = nullptr; static osTimerId_t GoalviewShow_timer = NULL; @@ -90,6 +92,11 @@ namespace OHOS delete[] winimageAnimatorInfo; winimageAnimatorInfo = nullptr; } + if (image_goalview) + { + delete image_goalview; + image_goalview = nullptr; + } if (GoalviewShow_timer) { osTimerStop(GoalviewShow_timer); @@ -263,7 +270,6 @@ namespace OHOS break; case GOAL_STEP: tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT); - ; tagString = std::to_string(tag) + "steps"; break; default: @@ -274,11 +280,19 @@ namespace OHOS labeltag->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); labeltag->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); // 初始化图片数组以及动画 - winimageInfos = CreateImageInfoArray(winbasePath.c_str(), 94); - winimageAnimatorInfo = new ImageAnimatorInfo[94]; - InitImageAnimatorSource(imageAnimator, winimageAnimatorInfo, winimageInfos, - 94, 173, 100, 120, 120, "imageAnimator1", 10); - imageAnimator->Start(); + // winimageInfos = CreateImageInfoArray(winbasePath.c_str(), 94); + // winimageAnimatorInfo = new ImageAnimatorInfo[94]; + // InitImageAnimatorSource(imageAnimator, winimageAnimatorInfo, winimageInfos, + // 94, 173, 100, 120, 120, "imageAnimator1", 10); + // imageAnimator->Start(); + + if(image_goalview == nullptr) + { + image_goalview = new UIImageView(); + image_goalview->SetPosition(173,100,120, 120); + image_goalview->SetSrc("/user/res/Training/training_GIF/win/10.bin"); + } + } static uint8_t GoalviewShowCallBack_FALG = 0; @@ -371,7 +385,8 @@ namespace OHOS getView->Add(labelpre); getView->Add(buttonok_); getView->Add(labeltag); - getView->Add(imageAnimator); + // getView->Add(imageAnimator); + getView->Add(image_goalview); NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(Freegoalview); } else diff --git a/code/sdk/zhihui/utils/custom_utils_at_cmd.c b/code/sdk/zhihui/utils/custom_utils_at_cmd.c index e27023fd2..6300ce6ec 100644 --- a/code/sdk/zhihui/utils/custom_utils_at_cmd.c +++ b/code/sdk/zhihui/utils/custom_utils_at_cmd.c @@ -2283,6 +2283,22 @@ static uint32_t custom_sio_debug_enable(uint8_t *para, uint32_t paraLen, char *s return ERRCODE_SUCC; } +/** + * @brief AT^GOALSHOW - Show goal view + * Usage: AT^GOALSHOW + */ +static uint32_t custom_goal_show(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + // 解析参数(如果提供) + uint8_t type_2 = 0; + if (para != NULL && paraLen > 0) { + type_2 = (uint8_t)atoi((char *)para); + } + CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&type_2,1); + return ERRCODE_SUCC; +} + static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^CUSTOM_SN", custom_utils_setsn, (char *)"123456789ABCDEF2345678" }, { (char *)"AT^CUSTOM_SN_REQ", custom_utils_getsn, (char *)" " }, @@ -2400,6 +2416,8 @@ static const at_cmd_table_t g_custom_utils_cmd[] = { /* SPI1 init/deinit test AT commands */ { (char *)"AT^SPIINIT", custom_spi_init_test, (char *)" " }, { (char *)"AT^SPIDEINIT", custom_spi_deinit_test, (char *)" " }, + + { (char *)"AT^GOALSHOW", custom_goal_show, (char *)" " }, }; diff --git a/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp b/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp index 51e130ac3..7cc718fd9 100644 --- a/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp +++ b/code/sdk/zhihui/utilscpp/custom_utilscpp.cpp @@ -569,7 +569,7 @@ void CustomEventPublish(uint16_t topic, uint8_t *data, uint32_t size) { } broadcastApi->Release((IUnknown *)broadcastApi); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish end!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CustomEventPublish end!!"); // // 释放内存 // free(publishData); -- 2.17.1