From fd432bcf30e64e306d30f1f3afc23495edb6e87b Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 11 Sep 2024 17:40:03 +0800 Subject: [PATCH] =?utf8?q?#154,=E8=A7=A3=E5=86=B3=EF=BC=9A=E6=89=8B?= =?utf8?q?=E8=A1=A8=E7=AB=AF=E8=B6=85=E6=97=B6=E4=B8=8D=E6=93=8D=E4=BD=9C?= =?utf8?q?=E5=90=8E=EF=BC=8C=E7=BB=91=E5=AE=9A=E8=AF=B7=E6=B1=82=E4=BC=9A?= =?utf8?q?=E7=BB=A7=E7=BB=AD=E7=95=99=E5=9C=A8=E6=89=8B=E8=A1=A8=E7=95=8C?= =?utf8?q?=E9=9D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/notify/pairing_notification.h | 16 ++++------ .../src/notify/pairing_notification.cpp | 29 +++++++------------ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h index a6cadffc2..152fcc9e4 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h @@ -2,20 +2,19 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 09:48:07 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-02 17:22:48 + * @LastEditTime: 2024-09-11 17:22:48 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h */ #ifndef PAIRING_NOTIFICATION_H #define PAIRING_NOTIFICATION_H #include "BaseView.h" -#define NO_LCD_TEST_CONNECT 0 namespace OHOS { UIViewGroup *CreateDeviceBindingView(void); UIViewGroup *CreateDeviceUnBindingView(void); - UIViewGroup * CreateDeviceUnbindingRequestGroupView(void); - + UIViewGroup *CreateDeviceUnbindingRequestGroupView(void); + void FreeDeviceBindingView(void); void FreeDeviceUnBindingView(void); void FreeDeviceUnbindingRequestGroupView(void); @@ -27,20 +26,15 @@ namespace OHOS void SetDeviceName(char *Name); char *GetDeviceName(); void DeviceUnBindingViewIsVisible(bool state); - #if NO_LCD_TEST_CONNECT - void Pairing_StartTimer(uint32_t interval = 1000*5); - #else - void Pairing_StartTimer(uint32_t interval = 1000*30); - #endif - + void Pairing_StartTimer(uint32_t interval = 1000 * 40); void Pairing_StopTimer(void); char DeviceName[50]; + private: PairingViewEventListener(); ~PairingViewEventListener(); PairingViewEventListener(const PairingViewEventListener &) = delete; const PairingViewEventListener &operator=(const PairingViewEventListener &) = delete; - }; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index 56ead691c..fac9a6c3d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-07 17:28:10 + * @LastEditTime: 2024-09-11 17:27:05 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -356,11 +356,9 @@ namespace OHOS DeviceBindingScrollView->Add(DeviceBindingButtonCancel); DeviceBindingScrollView->Add(DeviceBindingButtonOK); DeviceBindingView->Add(DeviceBindingScrollView); -#if NO_LCD_TEST_CONNECT - PairingViewEventListener::GetInstance().Pairing_StartTimer(); -#endif } + //震动一次 if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) { ui_api_vibrate_once_func(); @@ -368,6 +366,8 @@ namespace OHOS ScreenTurnOn(40 * 1000); // 亮屏操作 40秒关闭 + PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器 + NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceBindingView); return DeviceBindingView; } @@ -528,6 +528,8 @@ namespace OHOS } ScreenTurnOn(40 * 1000); // 亮屏操作 40秒关闭 + + PairingViewEventListener::GetInstance().Pairing_StartTimer(); //开启一个40s后弹窗自动销毁定时器 /* -------------------------------------------------------------------------- */ NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceUnBindingView); @@ -723,6 +725,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FreeDeviceBindingView]"); if (DeviceBindingView != nullptr) { + PairingViewEventListener::GetInstance().Pairing_StopTimer(); DeviceBindingView->RemoveAll(); if (DeviceBindingScrollView != nullptr) { @@ -772,6 +775,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnBindingView]"); if (DeviceUnBindingView != nullptr) { + PairingViewEventListener::GetInstance().Pairing_StopTimer(); DeviceUnBindingView->RemoveAll(); if (DeviceUnBindingScrollView != nullptr) { @@ -873,20 +877,7 @@ namespace OHOS static void Pairing_TimerCallbackProc(int data) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Pairing_TimerCallbackProc"); -#ifdef SUPPORT_BLE_SERVICE -#if NO_LCD_TEST_CONNECT - comfirmPaire(1); -#else - comfirmPaire(0); -#endif -#endif - if (NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND && - NotificationManager::GetInstance()->HasNotifyShowing() == true) - { - NotificationManager::GetInstance()->StopNotify(); - } - - PairingViewEventListener::GetInstance().Pairing_StopTimer(); + NotificationManager::GetInstance()->StopNotify(); } /* @@ -936,7 +927,6 @@ namespace OHOS g_timer = NULL; return; } - uapi_setScreenDuration(interval); return; } @@ -948,6 +938,7 @@ namespace OHOS // 检查定时器是否存在 if (g_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::Pairing_StopTimer"); osTimerStop(g_timer); // 删除定时器并置为 NULL osStatus_t ret = osTimerDelete(g_timer); -- 2.17.1