From 13c9931f127ceb724574b6e20e504f07756d04b2 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 17 Jan 2024 11:29:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=86=85=E5=AD=98=E5=8F=91=E9=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_device.h | 2 ++ .../source/sf_app/code/source/4gMng/sf_ftp.c | 27 ++++++++++++------- .../source/sf_app/code/source/app/sf_device.c | 17 +++++++++++- .../sf_app/code/source/app/sf_service.c | 10 +++---- .../sf_app/code/source/fileMng/sf_file.c | 17 ++++++++++-- 5 files changed, 56 insertions(+), 17 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_device.h b/code/application/source/sf_app/code/include/sf_device.h index 1cff97ec6..2edccbb32 100644 --- a/code/application/source/sf_app/code/include/sf_device.h +++ b/code/application/source/sf_app/code/include/sf_device.h @@ -47,6 +47,8 @@ SINT32 app_led_pin_init(void); SINT32 sf_in_card_exist(void); +SINT32 sf_in_emmc_exist(void); + SINT32 sf_is_card_full(void); void sf_set_card_full(SINT32 vol); 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 1f30153e7..cd556e262 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 @@ -3168,7 +3168,7 @@ SINT32 sf_mem_send_file_to_ftp(void) printf("netGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", sf_get_net_generation(), tempPicSize, piccount, pic); sprintf((char *)ftpFileName, "%sN-E1000001.JPG", cameraID); - sprintf((char *)filePath, "UFS:MEMPHOTO.JPG"); + sprintf((char *)filePath, "/tmp/MEMPHOTO.JPG"); printf("%s:%d ftpFileName:%s filePath:%s \n", __FUNCTION__, __LINE__, ftpFileName, filePath); @@ -3177,18 +3177,27 @@ SINT32 sf_mem_send_file_to_ftp(void) gprsMode = 0;//puiPara->GprsMode; printf("[%s:%d] ssl:%d,GprsMode:%d\n", __FUNCTION__, __LINE__, ssl, gprsMode); - - ret1 = sf_mem_ftp_config(ssl, gprsMode, timeout); + ret1 = sf_ftp_config(ssl, gprsMode, timeout); if(SF_SUCCESS == ret1) { - ret1 = sf_mem_ftp_send(ftpFileName, filePath, timeout); - } + ret1 = sf_ftp_send(ftpFileName, filePath, timeout); + } + /* + else { + ret1 = sf_mem_ftp_config(ssl, gprsMode, timeout); + + if(SF_SUCCESS == ret1) + { + ret1 = sf_mem_ftp_send(ftpFileName, filePath, timeout); + } + + if(ret1 != SF_FTP_ERROR_TERM) + { + ret2 = sf_mem_ftp_stop(ssl, gprsMode); + } + }*/ - if(ret1 != SF_FTP_ERROR_TERM) - { - ret2 = sf_mem_ftp_stop(ssl, gprsMode); - } MLOGD(" end ret1:[0x%08X],ret2:[0x%08X]\n", ret1, ret2); diff --git a/code/application/source/sf_app/code/source/app/sf_device.c b/code/application/source/sf_app/code/source/app/sf_device.c index 1f7a5afc7..7913b8af4 100755 --- a/code/application/source/sf_app/code/source/app/sf_device.c +++ b/code/application/source/sf_app/code/source/app/sf_device.c @@ -531,6 +531,13 @@ SINT32 sf_in_card_exist(void) return (regValue & 0xFF) ? 0:1; } +SINT32 sf_in_emmc_exist(void) +{ + if (access("/dev/mmcblk1p1", F_OK) == SUCCESS) { + return 1; + } + return 0; +} SINT32 sf_is_card_full(void) { @@ -539,7 +546,15 @@ SINT32 sf_is_card_full(void) void sf_set_card_full(SINT32 vol) { - IsCardFull = vol; + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + if((0 == puiPara->SendType) && (!sf_get_mode_flag())) + { + MLOGW("The memory sending function has been enabled, but the identification is not effective. IsCardFull:%d\n",vol); + IsCardFull = 0; + } + else { + IsCardFull = vol; + } } SINT32 sf_is_card(void) diff --git a/code/application/source/sf_app/code/source/app/sf_service.c b/code/application/source/sf_app/code/source/app/sf_service.c index caa5a1bd3..9256e2f22 100755 --- a/code/application/source/sf_app/code/source/app/sf_service.c +++ b/code/application/source/sf_app/code/source/app/sf_service.c @@ -2429,11 +2429,11 @@ int sf_check_sd(void) { UINT8 i = 0; int ret = SF_SUCCESS; - // if(0 == sf_in_card_exist()) - // { - // NET_SLOGE("NO SD\r\n"); - // return SF_FAILURE; - // } + if(0 == sf_in_card_exist() && (0 == sf_in_emmc_exist())) + { + NET_SLOGE("NO SD\r\n"); + return SF_FAILURE; + } if (sf_sd_status_get() != SF_SD_OK) { ret = SF_FAILURE; for (i = 0; i < 20; i++) 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 36d962269..84628ccf5 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 @@ -1924,7 +1924,7 @@ SINT32 sf_mem_upload_file_to_module(UINT32 MemPhotoAddr, UINT32 MemPhotosize) sf_test_uploadFsize = 0; ret = sf_hal_ttyusb2_write((SF_CHAR *)MemPhotoAddr, MemPhotosize); - if(ret != SF_FAILURE) + if(ret != (SINT32)MemPhotosize) { printf("[%s:%d]Upload data error\n", __FUNCTION__, __LINE__); } @@ -1976,11 +1976,24 @@ UINT32 MemPhotoAddr , MemPhotosize; SINT32 sf_usr_mem_photo_ch(void) { SYS_USRMEM usrmem = {0}; + UINT32 fd = 0; if(sys_usrmem_init(&usrmem) == 0){ if(sys_usrmem_read_photo(&usrmem, &MemPhotoAddr, &MemPhotosize) == 0){ SLOGI("photo address %lx, size %lx", MemPhotoAddr, MemPhotosize); - return sf_mem_upload_file_to_module(MemPhotoAddr, MemPhotosize); + + fd = open("/tmp/MEMPHOTO.JPG", O_WRONLY | O_CREAT); + if(fd) + { + lseek(fd, 0, SEEK_END); + write(fd, MemPhotoAddr, MemPhotosize); + close(fd); + system("sync"); + return 0; + } + else { + return 1;//sf_mem_upload_file_to_module(MemPhotoAddr, MemPhotosize); + } } else{ SLOGE("read photo failed\n");