1.dp记录的错误码修改

This commit is contained in:
payton 2023-12-19 10:46:46 +08:00
parent e5416993b6
commit 6e47f2c698
4 changed files with 74 additions and 15 deletions

View File

@ -45,6 +45,7 @@ UINT8 sf_get_send_file_total(void);
SINT32 sf_mem_upload_file_to_module(UINT32 MemPhotoAddr, UINT32 MemPhotosize); SINT32 sf_mem_upload_file_to_module(UINT32 MemPhotoAddr, UINT32 MemPhotosize);
SINT32 sf_usr_mem_photo_ch(void); SINT32 sf_usr_mem_photo_ch(void);
UINT8 sf_save_sd_log(void); UINT8 sf_save_sd_log(void);
void sf_log_error_code(char* buff);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -4532,6 +4532,8 @@ SINT32 sf_auto_net_reg(void)
SLOGE(gsmPara); SLOGE(gsmPara);
sprintf((char *)logStr, "AT+CGREG? Timeout,Error Code:0x%08X\n", ret); sprintf((char *)logStr, "AT+CGREG? Timeout,Error Code:0x%08X\n", ret);
SLOGE(logStr); SLOGE(logStr);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
goto SF_MODULE_END; goto SF_MODULE_END;
} }
} }
@ -4699,6 +4701,8 @@ SINT32 sf_auto_net_reg(void)
SLOGE(gsmPara); SLOGE(gsmPara);
sprintf((char *)logStr, "Error Code:0x%08X\n", ret); sprintf((char *)logStr, "Error Code:0x%08X\n", ret);
SLOGE(logStr); SLOGE(logStr);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
goto SF_MODULE_END; goto SF_MODULE_END;
} }
} }
@ -4750,6 +4754,8 @@ SINT32 sf_auto_net_reg(void)
SLOGE(gsmPara); SLOGE(gsmPara);
sprintf((char *)logStr, "Error Code:0x%08X\n", ret); sprintf((char *)logStr, "Error Code:0x%08X\n", ret);
SLOGE(logStr); SLOGE(logStr);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
goto SF_MODULE_END; goto SF_MODULE_END;
} }
else else
@ -4768,6 +4774,8 @@ SINT32 sf_auto_net_reg(void)
SLOGE(gsmPara); SLOGE(gsmPara);
sprintf((char *)logStr, "Error Code:0x%08X\n", ret); sprintf((char *)logStr, "Error Code:0x%08X\n", ret);
SLOGE(logStr); SLOGE(logStr);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
goto SF_MODULE_END; goto SF_MODULE_END;
} }
else else

View File

@ -970,6 +970,8 @@ SINT32 sf_pic_send_ftp(void)
//TIMEOUT //TIMEOUT
//pSifarPara->picSendTimeoutCount++; //pSifarPara->picSendTimeoutCount++;
printf("%s:%d err ftpFileName:%s filePath:%s picSendFailCount:%d sendThumbnailFailCount:%d\n", __FUNCTION__, __LINE__, ftpFileName[pic], filePath[pic],pSifarPara->picSendFailCount, pSifarPara->sendThumbnailFailCount); printf("%s:%d err ftpFileName:%s filePath:%s picSendFailCount:%d sendThumbnailFailCount:%d\n", __FUNCTION__, __LINE__, ftpFileName[pic], filePath[pic],pSifarPara->picSendFailCount, pSifarPara->sendThumbnailFailCount);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
} }
else { else {
if(!sf_get_mode_flag()){ if(!sf_get_mode_flag()){
@ -1084,6 +1086,8 @@ SINT32 sf_video_send_ftp(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ret, ftpFileName, filePath); printf("%s:%d err ret: [0x%08X] ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ret, ftpFileName, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
} }
} }
@ -1130,6 +1134,8 @@ SINT32 sf_ftp_dailyreport_send(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
}else { }else {
DailyReportFtpSendSucess = 1; DailyReportFtpSendSucess = 1;
pSifarPara->picSendCount = 0; pSifarPara->picSendCount = 0;
@ -1147,6 +1153,7 @@ SINT32 sf_ftp_dailyreport_send(void)
pSifarPara->videoSendFailCount = 0; pSifarPara->videoSendFailCount = 0;
pSifarPara->videoSendSucessCount = 0; pSifarPara->videoSendSucessCount = 0;
pSifarPara->SendlowPowerWarnCnt = 0; pSifarPara->SendlowPowerWarnCnt = 0;
sf_file_remove(SF_ERROR_CODE);
} }
sf_dailyReport_set(); sf_dailyReport_set();
} }
@ -1513,6 +1520,11 @@ SINT32 sf_camera_ota_ftp(void)
} }
sf_set_fw_update(0); sf_set_fw_update(0);
} }
else
{
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
}
} }
MLOGD(" end ret:[0x%08X]\n", ret); MLOGD(" end ret:[0x%08X]\n", ret);
@ -1645,6 +1657,8 @@ SINT32 sf_concentrated_ftp_send(void)
goto SF_CONCENTRATED_MODULE_REBOOT; goto SF_CONCENTRATED_MODULE_REBOOT;
} }
timeoutCnt++; timeoutCnt++;
SF_SPRINTF(logStr, "%x,", ret1);
sf_log_error_code(logStr);
goto SF_CONCENTRATED_END; goto SF_CONCENTRATED_END;
} }
else { else {
@ -1825,6 +1839,8 @@ SINT32 sf_hd_ftp_send(void)
goto SF_HD_MODULE_REBOOT; goto SF_HD_MODULE_REBOOT;
} }
timeoutCnt++; timeoutCnt++;
SF_SPRINTF(logStr, "%x,", ret1);
sf_log_error_code(logStr);
goto SF_HD_END; goto SF_HD_END;
} }
else { else {
@ -2056,6 +2072,8 @@ SINT32 sf_video_ftp_send(void)
goto SF_VIDEO_MODULE_REBOOT; goto SF_VIDEO_MODULE_REBOOT;
} }
timeoutCnt++; timeoutCnt++;
SF_SPRINTF(logStr, "%x,", ret1);
sf_log_error_code(logStr);
goto SF_VIDEO_END; goto SF_VIDEO_END;
} }
else { else {
@ -2172,6 +2190,8 @@ SINT32 sf_log_send_ftp(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
} }
} }
} }
@ -2230,6 +2250,8 @@ SINT32 sf_low_power_warn_send_ftp(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
}else { }else {
pSifarPara->SendlowPowerWarnCnt++; pSifarPara->SendlowPowerWarnCnt++;
} }
@ -2285,6 +2307,8 @@ SINT32 sf_gps_send_ftp(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
} }
else { else {
//GPS send success,add gps send flag //GPS send success,add gps send flag
@ -3075,6 +3099,8 @@ SINT32 sf_card_log_send_ftp(void)
if(SF_SUCCESS != ret) if(SF_SUCCESS != ret)
{ {
printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath);
SF_SPRINTF(logStr, "%x,", ret);
sf_log_error_code(logStr);
} }
else { else {

View File

@ -1301,23 +1301,23 @@ UINT32 sf_create_dailyreport_file(void)
if(sf_file_IsExsit(SF_ERROR_CODE) == SF_TRUE){ if(sf_file_IsExsit(SF_ERROR_CODE) == SF_TRUE){
size = sf_get_file_size((UINT8 *)SF_ERROR_CODE); size = sf_get_file_size((UINT8 *)SF_ERROR_CODE);
} fd1 = open(SF_ERROR_CODE, O_RDONLY, S_IRUSR | S_IWUSR);
fd1 = open(SF_ERROR_CODE, O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR); if(fd1)
if(fd1)
{
//size = sp5kFsFileSizeGet(fd1);
buf = malloc(size);
if (buf)
{ {
read(fd1, buf, size-1); //size = sp5kFsFileSizeGet(fd1);
printf("error code size=%d\n",size); buf = malloc(size);
write(fd, buf, size-1);
write(fd, (UINT8 *)"\r\n", SF_STRLEN("\r\n"));
free(buf);
}
close(fd1); if (buf)
{
read(fd1, buf, size-1);
printf("error code size=%d\n",size);
write(fd, buf, size-1);
write(fd, (UINT8 *)"\r\n", SF_STRLEN("\r\n"));
free(buf);
}
close(fd1);
}
} }
szTmpsize=SF_STRLEN(cfgTmp); szTmpsize=SF_STRLEN(cfgTmp);
@ -1881,6 +1881,30 @@ UINT8 sf_save_sd_log(void)
return ret; return ret;
} }
/*************************************************
Function: sf_log_error_code
Description: save error code
Input: error code
Output: N/A
Return: N/A
Others: N/A
*************************************************/
void sf_log_error_code(char* buff)
{
UINT32 fd = 0;
if(sf_in_card_exist())
{
fd = open(SF_ERROR_CODE, O_WRONLY | O_CREAT);
if(fd)
{
lseek(fd, 0, SEEK_END);
write(fd, buff, strlen(buff));
close(fd);
system("sync");
}
}
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }