#include "upg.h"
#include "custom_runtime.h"
#include "vibrator_service.h"
+#include "osal_timer.h"
+#include "cmsis_os2.h"
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)
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;
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;
}