From: hcj <1224667075@qq.com> Date: Sat, 26 Oct 2024 01:56:43 +0000 (+0800) Subject: 增加3次连续震动,给目标达成 X-Git-Tag: fd230_release_V1.3.102~183 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1261%2F4;p=mirrors%2FFD230.git 增加3次连续震动,给目标达成 --- 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 880c9bc04..348a9c0e6 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 @@ -19,6 +19,8 @@ #include "upg.h" #include "custom_runtime.h" #include "vibrator_service.h" +#include "osal_timer.h" +#include "cmsis_os2.h" namespace OHOS { @@ -38,6 +40,8 @@ namespace OHOS static ImageAnimatorInfo *winimageAnimatorInfo{nullptr}; static std::string winbasePath = "/user/res/Training/training_GIF/win/"; + static osTimerId_t GoalviewShow_timer= NULL; + void Freegoalview(void) { if (getView != nullptr) @@ -82,6 +86,18 @@ namespace OHOS labelgettag = nullptr; } + if(GoalviewShow_timer) + { + osTimerStop(GoalviewShow_timer); + osStatus_t ret = osTimerDelete(GoalviewShow_timer); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed ret = %lx!", ret); + return; + } + GoalviewShow_timer = nullptr; + } + + RootView::GetInstance()->Remove(getView); delete getView; @@ -266,12 +282,63 @@ namespace OHOS getView->Add(imageAnimator); } + static uint8_t GoalviewShowCallBack_FALG=0; + + + static void GoalviewShowCallBack(int data) + { + GoalviewShowCallBack_FALG--; + if(GoalviewShowCallBack_FALG) + { + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + ui_api_vibrate_once_func(); + } + } + if(GoalviewShowCallBack_FALG==0) + { + if(GoalviewShow_timer) + { + osTimerStop(GoalviewShow_timer); + osStatus_t ret = osTimerDelete(GoalviewShow_timer); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed ret = %lx!", ret); + return; + } + GoalviewShow_timer = nullptr; + } + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hintdialtimerCallBack ??????!"); + + } + + UIViewGroup *GoalviewShow() { - // 震动一次 - if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + // 震动3次 + + if(GoalviewShow_timer) { - ui_api_vibrate_once_func(); + osTimerStop(GoalviewShow_timer); + osStatus_t ret = osTimerDelete(GoalviewShow_timer); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed ret = %lx!", ret); + return NULL; + } + GoalviewShow_timer = nullptr; + } + + uint32_t tick; + osStatus_t retTimer; + GoalviewShowCallBack_FALG=3; + GoalviewShow_timer = osTimerNew((osTimerFunc_t)GoalviewShowCallBack, osTimerPeriodic, NULL, NULL); + tick =osMs2Tick(1000);// osMs2Tick(1000); + retTimer = osTimerStart(GoalviewShow_timer, tick); + if (retTimer != osOK && GoalviewShow_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(GoalviewShow_timer); + GoalviewShow_timer = NULL; + return NULL; }