From: hcj <1224667075@qq.com> Date: Thu, 6 Mar 2025 04:25:58 +0000 (+0800) Subject: AI组合数据包增加异常处理 X-Git-Tag: V1.3.115~15 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1688%2F1;p=mirrors%2FFD230.git AI组合数据包增加异常处理 --- diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index 012e13640..b8e760e5b 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -2351,6 +2351,7 @@ static void blesrvAi_send_service_task(void const *arg) fwrite(fp,1,mail.msg_len,mail.msg_data); #endif // if(get_ble_connect()) + if(mail.msg_data && mail.msg_len!=0) send_Ai_record(mail.msg_len,mail.msg_data); if(mail.msg_data) @@ -2457,23 +2458,27 @@ int send_msg_data_into_Ai_msg_queue(void *buff,uint16_t len,uint8_t type) blesrv_custom_cmd_t blesrv_mail_end={0}; - blesrv_mail_end.msg_len=g_blesrv_mail.msg_len; - blesrv_mail_end.msg_data=malloc(g_blesrv_mail.msg_len); - if(blesrv_mail_end.msg_data==NULL) + if(g_blesrv_mail.msg_len!=0 && g_blesrv_mail.msg_data!=NULL) { - return ERRCODE_FAIL; - } + blesrv_mail_end.msg_len=g_blesrv_mail.msg_len; + blesrv_mail_end.msg_data=malloc(g_blesrv_mail.msg_len); + if(blesrv_mail_end.msg_data==NULL) + { + return ERRCODE_FAIL; + } - memcpy_s( blesrv_mail_end.msg_data,singlebuflen,g_blesrv_mail.msg_data,g_blesrv_mail.msg_len); - free(g_blesrv_mail.msg_data); - g_blesrv_mail.msg_data=NULL; - g_blesrv_mail.msg_len=0; + memcpy_s( blesrv_mail_end.msg_data,singlebuflen,g_blesrv_mail.msg_data,g_blesrv_mail.msg_len); + free(g_blesrv_mail.msg_data); + g_blesrv_mail.msg_data=NULL; + g_blesrv_mail.msg_len=0; - ret = osal_msg_queue_write_copy(g_ble_Ai_record_queue, (void *)&blesrv_mail_end, sendlen , 0); - if (ret != OSAL_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"len<=singlebuflen Error blesrv Check send failed! err=0x%X %d! \r\n", ret,send_msg_data_into_Ai_msg_queue_count); + ret = osal_msg_queue_write_copy(g_ble_Ai_record_queue, (void *)&blesrv_mail_end, sendlen , 0); + if (ret != OSAL_SUCCESS) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"len<=singlebuflen Error blesrv Check send failed! err=0x%X %d! \r\n", ret,send_msg_data_into_Ai_msg_queue_count); + } } + blesrv_mail.service_handle = 0; blesrv_mail.msg_len = len; @@ -2554,9 +2559,13 @@ int send_msg_data_into_Ai_msg_queue(void *buff,uint16_t len,uint8_t type) { return ERRCODE_FAIL; } - memcpy_s( blesrv_mail.msg_data,singlebuflen,g_blesrv_mail.msg_data,g_blesrv_mail.msg_len); - free(g_blesrv_mail.msg_data); + if(g_blesrv_mail.msg_len!=0 && g_blesrv_mail.msg_data!=NULL) + { + memcpy_s( blesrv_mail.msg_data,singlebuflen,g_blesrv_mail.msg_data,g_blesrv_mail.msg_len); + free(g_blesrv_mail.msg_data); + } + g_blesrv_mail.msg_len=len; g_blesrv_mail.msg_data=malloc(len); memcpy_s( blesrv_mail.msg_data,singlebuflen,buff,len);