From: luozheng <1732036298@qq.com> Date: Mon, 19 Aug 2024 03:27:21 +0000 (+0800) Subject: 运动识别弹窗修改,需要添加开始运动接口 X-Git-Tag: release_V1.2.70_20241020_135402~636^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F723%2Fhead;p=mirrors%2FFD230.git 运动识别弹窗修改,需要添加开始运动接口 --- diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h index f43542591..7125889c3 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:43:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 09:31:47 + * @LastEditTime: 2024-08-19 11:00:50 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h */ @@ -26,6 +26,7 @@ namespace OHOS void SetMotionTypeId(int type); int GetMotionType(void); + int GetMotionTypeTextId(void); private: MotionRecognitionViewEventListener(); 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 85ce94449..f492994eb 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 @@ -1140,7 +1140,7 @@ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) { uint8_t* motionType=(uint8_t*)req->data; WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType); - if(*motionType == 0) //未知运动不弹窗 + if(*motionType > 5 || *motionType <1) //未知运动不弹窗 { return; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp index 10b984f94..fb625cedc 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:44:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 10:15:11 + * @LastEditTime: 2024-08-19 11:25:09 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp */ #include "notification_manager.h" @@ -69,6 +69,8 @@ namespace OHOS /*关闭弹窗*/ NotificationManager::GetInstance()->StopNotify(); /*开始运动*/ + int textId = GetMotionTypeTextId(); + // set_sport_config(textId); } return true; @@ -123,15 +125,36 @@ namespace OHOS motionType = STR_MOTION_DETECTION_ROWING_NOTE; break; case 5: - motionType = STR_MOTION_DETECTION_ROWING_NOTE; - break; - default: - motionType = STR_MOTION_DETECTION_WALK_NOTE; + motionType = STR_MOTION_DETECTION_ELLIPTICAL_NOTE; break; } return motionType; } + int MotionRecognitionViewEventListener::GetMotionTypeTextId(void) + { + int motionTypeTextId; + switch (motionTypeId) + { + case 1: + motionTypeTextId = STR_EXERCISE_OUTDOORWALKING; + break; + case 2: + motionTypeTextId = STR_EXERCISE_OUTDOORRUNNING; + break; + case 3: + motionTypeTextId = STR_EXERCISE_OUTDOORBIKING; + break; + case 4: + motionTypeTextId = STR_EXERCISE_ROWINGMACHINE; + break; + case 5: + motionTypeTextId = STR_EXERCISE_ELLIPTICALTRAINER; + break; + } + return motionTypeTextId; + } + static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id) { if (label == nullptr)