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 00ed105ad..563e84a59 100644 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -470,7 +470,7 @@ SINT32 sf_ftp_config(UINT8 ssl, UINT8 GprsMode, UINT8 timeout) sf_hal_ttyusb2_read(gsmPara, 200); printf("eFtpLocation=%d,time=%d\n", eFtpLocation, time); - if(gsmPara[0] != '\0') + if((gsmPara[0] != '\0') && (FTP_SIM_EXIT != eFtpLocation) && (FTP_SIM_CCHSTART != eFtpLocation) && (FTP_SIM_QSSLCFG0 != eFtpLocation)) { SLOGI("gsmPara:%s", gsmPara); } @@ -1157,62 +1157,62 @@ SINT32 sf_send_file_to_ftp(UINT8 mode) if(SF_SUCCESS == ret1) { - if(mode == 1) - { - if(((puiPara->CamMode == SF_CAM_MODE_PHOTO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO)) && (puiPara->SendPhotoSwitch == 1)) //pic(+video) - { - if(smtpUploadPicFlag == 0) - { - ret1 = sf_upload_send_files_to_module(1); + if(mode == 1) + { + if(((puiPara->CamMode == SF_CAM_MODE_PHOTO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO)) && (puiPara->SendPhotoSwitch == 1)) //pic(+video) + { + if(smtpUploadPicFlag == 0) + { + ret1 = sf_upload_send_files_to_module(1); - if(SF_UPLOAD_ERROR_RETRY == ret1) - { - printf("[%s:%d] PIC SF_UPLOAD_ERROR_RETRY\n", __FUNCTION__, __LINE__); - ret1 = sf_ftp_config(ssl, gprsMode, timeout); + if(SF_UPLOAD_ERROR_RETRY == ret1) + { + printf("[%s:%d] PIC SF_UPLOAD_ERROR_RETRY\n", __FUNCTION__, __LINE__); + ret1 = sf_ftp_config(ssl, gprsMode, timeout); - if(ret1 == SF_SUCCESS) - { - ret1 = sf_upload_send_files_to_module(1); - } - } - } + if(ret1 == SF_SUCCESS) + { + ret1 = sf_upload_send_files_to_module(1); + } + } + } - if(ret1 == SF_SUCCESS) - { - ret1 = sf_pic_send_ftp(); - } - } + if(ret1 == SF_SUCCESS) + { + ret1 = sf_pic_send_ftp(); + } + } - printf("[%s:%d]puiPara->NetGeneration=%d\n", __FUNCTION__, __LINE__, puiPara->NetGeneration); + printf("[%s:%d]puiPara->NetGeneration=%d\n", __FUNCTION__, __LINE__, puiPara->NetGeneration); - if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO)) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)) //video - { - if(smtpUploadVideoFlag == 0) - { - ret1 = sf_upload_send_files_to_module(2); + if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO)) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)) //video + { + if(smtpUploadVideoFlag == 0) + { + ret1 = sf_upload_send_files_to_module(2); - if(SF_UPLOAD_ERROR_RETRY == ret1) - { - printf("[%s:%d] SF_UPLOAD_ERROR_RETRY\n", __FUNCTION__, __LINE__); - ret1 = sf_ftp_config(ssl, gprsMode, timeout); + if(SF_UPLOAD_ERROR_RETRY == ret1) + { + printf("[%s:%d] SF_UPLOAD_ERROR_RETRY\n", __FUNCTION__, __LINE__); + ret1 = sf_ftp_config(ssl, gprsMode, timeout); - if(ret1 == SF_SUCCESS) - { - ret1 = sf_upload_send_files_to_module(2); - } - } - } + if(ret1 == SF_SUCCESS) + { + ret1 = sf_upload_send_files_to_module(2); + } + } + } - if(ret1 == SF_SUCCESS) - { - ret1 = sf_video_send_ftp(); - } - } - } - else - { - ret1 = sf_ftp_dailyreport_send(); - } + if(ret1 == SF_SUCCESS) + { + ret1 = sf_video_send_ftp(); + } + } + } + else + { + ret1 = sf_ftp_dailyreport_send(); + } } if(ret1 != SF_FTP_ERROR_TERM) @@ -3600,46 +3600,70 @@ SINT32 sf_get_ftp_open_flag(void) SINT32 sf_log_send_ftp(void) { SINT32 ret = SF_SUCCESS; - //UINT8 CamNameStr[20] = { 0 }; + SINT32 ret2 = SF_SUCCESS; //0:success; else:fail; UINT8 uploadFname[64] = { 0 }; UINT8 customStr[64] = { 0 }; UINT8 filePath[64] = { 0 }; - UINT8 timeout = 60; + UINT8 timeout = 100; UIMenuStoreInfo *pPara = sf_app_ui_para_get(); + UINT8 ssl = 0; + UINT8 gprsMode = 0; + ssl = ((2 == pPara->FtpSwitch) ? 1 : 0); + gprsMode = 0;//puiPara->GprsMode; printf("%s:%d start\n", __FUNCTION__, __LINE__); sf_set_send_log(0); - if(sf_file_IsExsit(LOG_AT_FILE_PATH) == SF_TRUE) + if(sf_file_IsExsit(LOG_AT_FILE_PATH) != SF_TRUE) { - printf("%s:%d err create dailyreport file\n", __FUNCTION__, __LINE__); + printf("%s:%d err file\n", __FUNCTION__, __LINE__); return SF_FAILURE; } - sprintf((char *)filePath, "UFS:/%s", SF_LOG_TXT); + ret = sf_ftp_config(ssl, gprsMode, timeout); - printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); - - sf_custom_str_get(customStr); - sprintf((char *)uploadFname, "%s-%s-log.txt",pPara->ModuleImei, customStr); - - ret = sf_quectel_upload_file_to_module((UINT8 *)LOG_AT_FILE_PATH, (UINT8 *)SF_LOG_TXT); - - if(SF_SUCCESS != ret) + if(SF_SUCCESS == ret) { - printf("%s:%d upload err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); + sprintf((char *)filePath, "UFS:/%s", SF_LOG_TXT); + + printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); + + sf_custom_str_get(customStr); + sprintf((char *)uploadFname, "%s-%s-log.txt",pPara->ModuleImei, customStr); + + ret = sf_quectel_upload_file_to_module((UINT8 *)LOG_AT_FILE_PATH, (UINT8 *)SF_LOG_TXT); + + if(SF_SUCCESS != ret) + { + printf("%s:%d upload err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); + } + else + { + ret = sf_ftp_send(uploadFname, filePath, timeout); + + if(SF_SUCCESS != ret) + { + printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); + } + } + } + if(ret != SF_FTP_ERROR_TERM) + { + ret2 = sf_ftp_stop(ssl, gprsMode); + } + + #if SF_TEST_ERROR_CODE + sf_set_code_err_flag(0); + #endif + printf("[%s:%d]ret:[0x%08X],ret2:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret, ret2); + + if(ret != SF_SUCCESS) + { + return ret; } else { - ret = sf_ftp_send(uploadFname, filePath, timeout); - - if(SF_SUCCESS != ret) - { - printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); - } + return ret2; } - - printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret); - return ret; } #ifdef __cplusplus #if __cplusplus