From 4a3ce299800be81263cf9a059d78649e87fd5b6a Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 21 Jun 2024 18:21:36 +0800 Subject: [PATCH] =?utf8?q?=E5=AE=9E=E7=8E=B0=E6=B6=88=E6=81=AF=E5=BC=B9?= =?utf8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/traing/src/TraingModel.cpp | 4 +-- .../service/ble_service/bleservice/bleEvent.c | 3 +- .../msg_center/src/msg_center_customer.cpp | 29 +++++++++++-------- .../src/notify/message_notification.cpp | 9 ++++-- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index c027afd97..50bee175f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -322,8 +322,8 @@ namespace OHOS // 达到最高心率进行心率提醒弹窗 if (sportdata->heart >= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_TRAINING_HEART_MAX)) { - uapi_set_screen_on_api(); // 亮屏检测 - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + uapi_set_screen_on_api(); // 亮屏检测 + custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, true); } // sportdata->duration = cyweeInfo->duration; 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 ca2750e04..394ef20d6 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -5040,7 +5040,6 @@ uint8_t jscheck_ancs(uint8_t *data) return 2; } - int uid_t = 0; int appid_t = 0; int hasCode_t = 0; @@ -5075,7 +5074,6 @@ uint8_t jscheck_ancs(uint8_t *data) title_c->valuestring[len++] = '.'; title_c->valuestring[len++] = 0; } - memcpy(titleBuf,(uint8_t *)title_c->valuestring,len); } cJSON* msg = cJSON_GetObjectItem(root, "msg"); @@ -5134,6 +5132,7 @@ void ancsDataShowCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData, value[17] = 1; value[18] = Calculate_CRC(value,18); sendBleData(value,19); + CustomEventPublish(TOPIC_EVENT_MESSAGENOTE,&data,1); }else{ value[17] = 0; value[18] = Calculate_CRC(value,18); 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 6e0935721..be46f563b 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 @@ -627,6 +627,22 @@ void MsgCenterNotifyStopSPO2MonitoringProc(const Topic topic, Request* req) } } +//消息通知 +void MsgCenterNotifyMessageProc(const Topic topic, Request* req) +{ + unused(topic); + unused(req); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyMessageProc !"); + //亮屏显示新信息弹窗 + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) + { + display_api->turn_on_screen(); + } + display_api->set_screen_set_keepon_timeout(1000*5); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(showMessageNotify, (uint16_t)topic, true); +} #endif @@ -918,15 +934,7 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true); } -//消息通知 -void MsgCenterNotifyMessageProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyMessageProc !"); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(showMessageNotify, (uint16_t)topic, true); -} + void MsgCenterNotifyActivityProc(const Topic topic, Request* req) { unused(topic); @@ -980,7 +988,6 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) return; } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->sedentary_status = %d, stand_freq = %d", cywee_Inactivity_Info->sedentary_status, cywee_Inactivity_Info->stand_freq); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number); if(cywee_Inactivity_Info->sedentary_status==9) @@ -988,8 +995,6 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) set_stand_falg(); } - - static int interval = 0;//久坐间隔时间 switch (cywee_Inactivity_Info->output_number) { diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp index b2ff7d1e5..107229844 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp @@ -10,6 +10,9 @@ #include "message/include/MessageModel.h" #include "message_notification.h" #include "string" +#include "vibrator_service.h" +extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); + namespace OHOS { @@ -143,7 +146,8 @@ namespace OHOS messageLabel->SetText(messageStr.c_str()); messageLabel->SetTextColor(Color::Gray()); messageLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP); + messageLabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP); // 换行裁剪 + messageLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); // 居中显示 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel is ok"); /*加载清除按键*/ @@ -165,7 +169,8 @@ namespace OHOS MessageGroupView->Add(deleteButton); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!"); - + // 震动提醒 + custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); return MessageGroupView; } /*释放消息弹窗视图*/ -- 2.17.1