diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index 6a55e2e28..728598a3b 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -1173,12 +1173,6 @@ SINT32 sf_ftp_dailyreport_send(void) ret = SF_SUCCESS;//sf_quectel_upload_file_to_module((UINT8 *)SF_DAILYREPORT_FILENAME, (UINT8 *)SF_DAILYREPORT_TXT); - char *err_code_path = sf_root_path_strcat(SF_ERROR_CODE); - if(err_code_path == NULL) - { - free(err_code_path); - return SF_FAILURE; - } if(SF_SUCCESS != ret) { printf("%s:%d upload err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); @@ -1225,12 +1219,24 @@ SINT32 sf_ftp_dailyreport_send(void) pSifarPara->videoSendFailCount = 0; pSifarPara->videoSendSucessCount = 0; pSifarPara->SendlowPowerWarnCnt = 0; - sf_file_remove(err_code_path); + + memset(filePath, '\0', sizeof(filePath)); + snprintf((char *)filePath, sizeof(filePath), "/mnt/sd/%s", SF_ERROR_CODE); + if(sf_file_IsExsit((char *)filePath) == SF_TRUE) + { + sf_file_remove((char *)filePath); + } + memset(filePath, '\0', sizeof(filePath)); + snprintf((char *)filePath, sizeof(filePath), "/mnt/sd2/%s", SF_ERROR_CODE); + if(sf_file_IsExsit((char *)filePath) == SF_TRUE) + { + sf_file_remove((char *)filePath); + } + system("sync"); } sf_dailyReport_set(); } MLOGD(" end ret:[0x%08X]\n", ret); - free(err_code_path); return ret; } diff --git a/code/application/source/sf_app/code/source/fileMng/sf_file.c b/code/application/source/sf_app/code/source/fileMng/sf_file.c index f1c1a525c..a3f1cc14d 100755 --- a/code/application/source/sf_app/code/source/fileMng/sf_file.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_file.c @@ -941,6 +941,8 @@ UINT32 sf_create_dailyreport_file(void) SINT16 fTemper = 0, cTemper = 0; char imageSize = 0; char videoSize = 0; + UINT8 filePath[64] = { 0 }; + /*Avoid New Card*/ if(SF_CAMID_ON == pPara->CamNameSwitch) @@ -1285,18 +1287,14 @@ UINT32 sf_create_dailyreport_file(void) //printf("szTmpsize=%d\n",szTmpsize); write(fd, szTmp2, szTmpsize); - char *err_code_path = sf_root_path_strcat(SF_ERROR_CODE); - if(err_code_path == NULL) - { - free(err_code_path); - return SF_FAILURE; - } - if(sf_file_IsExsit(err_code_path) == SF_TRUE){ - size = sf_get_file_size((UINT8 *)err_code_path); - fd1 = open(err_code_path, O_RDONLY, S_IRUSR | S_IWUSR); + memset(filePath, '\0', sizeof(filePath)); + snprintf((char *)filePath, sizeof(filePath), "/mnt/sd/%s", SF_ERROR_CODE); + if(sf_file_IsExsit((char *)filePath) == SF_TRUE) + { + size = sf_get_file_size(filePath); + fd1 = open((char *)filePath, O_RDONLY, S_IRUSR | S_IWUSR); if(fd1) { - free(err_code_path); //size = sp5kFsFileSizeGet(fd1); buf = malloc(size); @@ -1310,6 +1308,33 @@ UINT32 sf_create_dailyreport_file(void) } close(fd1); + fd1 = 0; + buf = NULL; + } + } + + memset(filePath, '\0', sizeof(filePath)); + snprintf((char *)filePath, sizeof(filePath), "/mnt/sd2/%s", SF_ERROR_CODE); + if(sf_file_IsExsit((char *)filePath) == SF_TRUE) + { + size = sf_get_file_size(filePath); + fd1 = open((char *)filePath, O_RDONLY, S_IRUSR | S_IWUSR); + if(fd1) + { + //size = sp5kFsFileSizeGet(fd1); + buf = malloc(size); + + 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); + fd1 = 0; } }