From 164dd268dda7cf5abde4290da2bb95e1cd53d508 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Fri, 20 Sep 2024 16:37:23 +0800 Subject: [PATCH] =?utf8?q?=E8=93=9D=E7=89=99=E6=96=87=E4=BB=B6=E5=8F=96?= =?utf8?q?=E6=B6=88=E4=BC=A0=E8=BE=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleEvent.c | 40 +++++++++++++++-- .../msg_center/src/msg_center_customer.cpp | 4 +- .../msg_center/src/notify/transmitting.cpp | 44 +++++++++++++------ 3 files changed, 69 insertions(+), 19 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 d017903f0..a8b532301 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -7188,13 +7188,45 @@ errcode_t check_header(msg_header_t *header ) errcode_t cancel_recv_file(ble_read_data *buffer_handle) { - if(BR_TRANSFER_timer) { - timer_flie_flag=1; + timer_flie_flag=0; + osTimerStop(BR_TRANSFER_timer); + osTimerDelete(BR_TRANSFER_timer); + BR_TRANSFER_timer = NULL; } - ble_reply_cmd(FILE_RECV_REPLY_STAT_CMD,0);//接收失败 - + + if(timer_flie_type==1) + { + TRANSMIT_DATA=TRANS_OTA_FAIL; + } + else if (timer_flie_type==3) + { + TRANSMIT_DATA=TRANS_DIAL_FAIL; + } + else + { + TRANSMIT_DATA=TRANS_FREE; + } + + ble_read_timer_p->receive_file_flag = 0; + if (ble_read_timer_p->file_recv_stat.recv_file_stat != 2) //已经下载完毕的文件,没有必要cancel了。 + { + if (ble_read_timer_p->file_recv_stat.file!=NULL) + { + fclose(ble_read_timer_p->file_recv_stat.file); + ble_read_timer_p->file_recv_stat.file = NULL; + } + if (ble_read_timer_p->file_recv_stat.file_name != NULL) + { + free(ble_read_timer_p->file_recv_stat.file_name); + ble_read_timer_p->file_recv_stat.file_name=NULL; + } + ble_read_timer_p->file_recv_stat.recv_file_stat = -1; + ble_read_timer_p=NULL; + } + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + return ERRCODE_SUCC; } 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 0e4f5118e..f0dfda271 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 @@ -1462,8 +1462,8 @@ void MsgCenterNotifybleTransmit(const Topic topic, Request* req) { set_transmittingShow_falg(data[0]); - if(NotificationManager::GetInstance()->HasNotifyShowing()) - NotificationManager::GetInstance()->StopNotify(); + // if(NotificationManager::GetInstance()->HasNotifyShowing()) + // NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true); } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp index b245d14da..1341d748d 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp @@ -191,11 +191,12 @@ namespace OHOS // Add to rootView UIViewGroup_transmitting->Add(Title); - updatasider = new UISlider(); + if (updatasider == nullptr) { + updatasider = new UISlider(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView new fail"); - return ; + } updatasider->SetSliderColor(Color::Gray(), Color::Silver()); @@ -234,11 +235,12 @@ namespace OHOS UIViewGroup_transmitting->Add(label_); //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; + } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -249,6 +251,12 @@ namespace OHOS osStatus_t retTimer; Set_OTA_recv_value(); + if(transmitting_timer!=NULL) + { + osTimerStop(transmitting_timer); + osTimerDelete(transmitting_timer); + transmitting_timer = NULL; + } transmitting_timer = osTimerNew((osTimerFunc_t)OTATimerCallBack, osTimerPeriodic, NULL, NULL); tick =500;// osMs2Tick(1000); retTimer = osTimerStart(transmitting_timer, tick); @@ -301,11 +309,11 @@ namespace OHOS UIViewGroup_transmitting->Add(label_); //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -355,11 +363,12 @@ namespace OHOS //Add ImageView to App - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; + } transmitting_img->SetPosition(117, 87, 230, 160); const char *imagesPath = TRANSMITTING_OTA_DOWN; @@ -462,11 +471,11 @@ namespace OHOS label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(193, 150,80, 80); const char *imagesPath = TRANSMITTING_SUCC_PATH; @@ -475,7 +484,12 @@ namespace OHOS uint32_t tick; osStatus_t retTimer; - + if(transmitting_timer!=NULL) + { + osTimerStop(transmitting_timer); + osTimerDelete(transmitting_timer); + transmitting_timer = NULL; + } transmitting_timer = osTimerNew((osTimerFunc_t)dialtimerCallBack, osTimerPeriodic, NULL, NULL); tick =2000;// osMs2Tick(1000); retTimer = osTimerStart(transmitting_timer, tick); @@ -530,11 +544,11 @@ namespace OHOS label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) { + transmitting_img = new UIImageView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); - return ; } transmitting_img->SetPosition(193, 150,80, 80); const char *imagesPath = TRANSMITTING_FAIL_PATH; @@ -560,6 +574,10 @@ namespace OHOS UIViewGroup_transmitting->SetPosition(0, 0, 466, 466); //UIViewGroup_transmitting->SetStyle(STYLE_BACKGROUND_OPA, 0); } + else + { + UIViewGroup_transmitting->RemoveAll(); + } switch (Transmitting_falg) { -- 2.17.1