From fa49a2804b5f8f5e69af9aaa99c1132de43e89a0 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 24 Dec 2024 10:33:50 +0800 Subject: [PATCH] =?utf8?q?#1237=EF=BC=8CAndroid=20app=E6=8F=90=E7=A4=BA?= =?utf8?q?=E8=A7=A3=E7=BB=91=E5=A4=B1=E8=B4=A5=E5=90=8E=E6=89=8B=E8=A1=A8?= =?utf8?q?=E5=87=BA=E7=8E=B0=E7=BB=BF=E5=B1=8F=EF=BC=8C=E5=87=BA=E7=8E=B03?= =?utf8?q?=E6=AC=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleEvent.c | 4 ++- .../broadcast/include/broadcast_feature.h | 1 + .../broadcast/src/broadcast_implement.c | 1 + .../include/notify/pairing_notification.h | 6 ++-- .../msg_center/src/msg_center_customer.cpp | 27 ++++++++++++--- .../src/notify/pairing_notification.cpp | 34 ++++++++++++++++++- 6 files changed, 65 insertions(+), 8 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index f437c6c84..294fef80b 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -727,7 +727,9 @@ void clearPaireFlag(uint8_t flag) UnbindSucessCmd(1);//1确认解绑; - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);//恢复出厂 + // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);//恢复出厂 + uint8_t shutdowflag = 2;//恢复出厂 + CustomEventPublish(TOPIC_EVENT_SHUTDOWN_ANIMATIOR, &shutdowflag, sizeof(shutdowflag)); //uapi_reboot_device(); } void clearPaireCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue)//发送清除配对指令 diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h index 75ce71cf6..d5196b6b3 100644 --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -98,6 +98,7 @@ typedef enum { TOPIC_EVENT_SLEEPNOTE, //睡眠通知 TOPIC_EVENT_DEBUGOUTPUT,//开发调试专用窗口 TOPIC_EVENT_ASSISTANT_NOTE,//语音助手结束 + TOPIC_EVENT_SHUTDOWN_ANIMATIOR,//关机Animator TOPIC_END_NUM = 20000, } TopicNum; diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c index 77a8747de..7404f171f 100644 --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c @@ -76,6 +76,7 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_MESSAGE_UPDATA,A_CORE_MASK, 1}, {TOPIC_EVENT_SLEEPNOTE,A_CORE_MASK, 1}, {TOPIC_EVENT_DEBUGOUTPUT,A_CORE_MASK, 1}, + {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,A_CORE_MASK, 1}, #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1}, {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1}, 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 ae032a794..3e76830b4 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 @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 09:48:07 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-10-10 21:51:27 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-12-23 18:15:47 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h */ #ifndef PAIRING_NOTIFICATION_H @@ -14,6 +14,8 @@ namespace OHOS UIViewGroup *CreateDeviceBindingView(void); UIViewGroup *CreateDeviceUnBindingView(void); UIViewGroup *CreateDeviceUnbindingRequestGroupView(void); + UIViewGroup *showShutDownAnimation(void); + void set_shutDownAnimation_falg(uint8_t falg); void FreeDeviceBindingView(void); void FreeDeviceUnBindingView(void); 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 0ed4c27e8..992590383 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 @@ -153,6 +153,7 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_MESSAGE_UPDATA,PRIORITY_TWO},//消息更新提醒 [3] {TOPIC_EVENT_SLEEPNOTE,PRIORITY_THREE},//睡眠弹窗 [3] {TOPIC_EVENT_DEBUGOUTPUT,PRIORITY_ONE},//开发调试专用窗口 + {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,PRIORITY_ONE},//关机动画 }; bool g_pressFlag = false; @@ -234,6 +235,7 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_MESSAGENOTE); MsgCenterSubscribeTopic(TOPIC_EVENT_SLEEPNOTE); MsgCenterSubscribeTopic(TOPIC_EVENT_DEBUGOUTPUT); + MsgCenterSubscribeTopic(TOPIC_EVENT_SHUTDOWN_ANIMATIOR); } static OHOS::UIViewGroup* ShowGoalNotify(void) @@ -326,6 +328,11 @@ static OHOS::UIViewGroup* showtransmitNotify(void) return OHOS::transmittingShow(); } +//关机动画 +static OHOS::UIViewGroup* showShutdownAnimatorNotify(void) +{ + return OHOS::showShutDownAnimation(); +} //无法呼叫sos static OHOS::UIViewGroup* showSOSNotify(void) { @@ -335,7 +342,7 @@ static OHOS::UIViewGroup* showSOSNotify(void) /*显示消息提醒*/ static OHOS::UIViewGroup *showMessageNotify(void) { OHOS::UIViewGroup *view = OHOS::CreateMessageView(); - // printf("showMessageNotify %p",view); + printf("showMessageNotify %p",view); return view; } /*显示睡眠提醒*/ @@ -386,7 +393,7 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) AlarmClockEventData* time=(AlarmClockEventData*)req->data; // The alarm notification is not displayed if the incoming call notification is already being processed cywee_save_data(); - + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时步数"); step_history_save(time->value); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据"); @@ -1140,7 +1147,7 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) else #endif { - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); } #ifdef SUPPORT_CAT1_HFP_AG_SERV @@ -1197,7 +1204,7 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) else #endif { - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); } } @@ -1492,6 +1499,17 @@ void MsgCenterNotifyDebugOutProc(const Topic topic, Request *req) NotificationManager::GetInstance()->ShowNotify(showDebugOutputNotify, (uint16_t)topic, true); } } + +//关机动画 +void MsgCenterNotifyShutDownAnimatorProc(const Topic topic, Request* req) +{ + unused(topic); + uint8_t* data=(uint8_t*)req->data; + set_shutDownAnimation_falg(data[0]); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyShutDownAnimatorProc,shutdown_flag = %d",*data); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + NotificationManager::GetInstance()->ShowNotify(showShutdownAnimatorNotify, (uint16_t)topic, true); +} //每日训练数据刷新 void MsgCenterNotifyActivityProc(const Topic topic, Request* req) { @@ -1904,6 +1922,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc}, {TOPIC_EVENT_SLEEPNOTE,MsgCenterNotifySleepProc}, {TOPIC_EVENT_DEBUGOUTPUT,MsgCenterNotifyDebugOutProc}, + {TOPIC_EVENT_SHUTDOWN_ANIMATIOR,MsgCenterNotifyShutDownAnimatorProc}, }; static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx) 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 2e088816f..5837abba9 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-11-05 14:57:06 + * @LastEditTime: 2024-12-23 18:25:27 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -79,6 +79,9 @@ namespace OHOS ShutDownImageAnimatorView *p_ShutDownImageAnimatorView{nullptr}; // 关机动画 UIViewGroup *ShutDownImageAnimatorGroupView{nullptr}; + ShutDownImageAnimatorView *shutDownImageAnimatorView{nullptr}; // 关机动画 + UIViewGroup *shutDownImageAnimatorGroupView{nullptr}; + PairingViewEventListener::PairingViewEventListener() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::PairingViewEventListener"); @@ -992,4 +995,33 @@ namespace OHOS g_timer = NULL; } } + static uint8_t shutDownAnimation_falg = -1; //关机动画标志位 + void set_shutDownAnimation_falg(uint8_t falg) + { + shutDownAnimation_falg = falg; + } + /* + * @brief 显示关机动画 + */ + UIViewGroup *showShutDownAnimation(void) + { + if (shutDownImageAnimatorView == nullptr) + { + shutDownImageAnimatorView = new ShutDownImageAnimatorView(); + if (shutDownImageAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "shutDownImageAnimatorView new fail!!"); + return nullptr; + } + shutDownImageAnimatorGroupView = shutDownImageAnimatorView->ShutDownAnimatorViewInit(); + if (shutDownImageAnimatorGroupView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "shutDownImageAnimatorGroupView new fail!!"); + return nullptr; + } + shutDownImageAnimatorView->ShutDownImageAnimator_Start(shutDownAnimation_falg); + RootView::GetInstance()->ClearOnKeyActListener(); + } + return shutDownImageAnimatorGroupView; + } } \ No newline at end of file -- 2.17.1