From 0e379d2fa40e711074c556743f3db0e288e59e21 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 15:48:03 +0800 Subject: [PATCH 01/11] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8Dlog=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sf_app/code/source/app/sf_service.c | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) 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 7a330b96b..2e966a487 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 @@ -1145,6 +1145,11 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { if(sf_get_send_video()){ s32ret = sf_video_ftp_send(); } + + if(sf_get_send_log()){ + s32ret = sf_log_send_ftp(); + } + break; case SF_MCU_STARTUP_SYN_PARAM: if (pCustomerParam->GpsSendFlag) { @@ -1177,6 +1182,11 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { if(sf_get_send_video()){ s32ret = sf_video_ftp_send(); } + + if(sf_get_send_log()){ + s32ret = sf_log_send_ftp(); + } + SLOGD("GpsSendFlag:%d\n", pCustomerParam->GpsSendFlag); break; default: @@ -1485,13 +1495,22 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) s32ret = sf_read_message(); SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); - if (sf_get_pic()) { + if (sf_get_pic()) + { s32ret = sf_app_to_cardv_capture(); - } else if (sf_get_send_hd()) { + } + else if (sf_get_send_hd()) + { s32ret = sf_app_to_cardv_hd_ture(); - } else if (sf_get_send_video()) { + } + else if (sf_get_send_video()) + { s32ret = sf_video_ftp_send(); } + else if(sf_get_send_log()) + { + s32ret = sf_log_send_ftp(); + } break; case SF_MCU_STARTUP_TIMELAPSE: @@ -1779,13 +1798,22 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) s32ret = sf_file_send_auto(); SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); - if (sf_get_pic()) { + if (sf_get_pic()) + { s32ret = sf_app_to_cardv_capture(); - } else if (sf_get_send_hd()) { + } + else if (sf_get_send_hd()) + { s32ret = sf_app_to_cardv_hd_ture(); - } else if (sf_get_send_video()) { + } + else if (sf_get_send_video()) + { s32ret = sf_video_ftp_send(); } + else if(sf_get_send_log()) + { + s32ret = sf_log_send_ftp(); + } // sf_share_mem_customer_down(1); break; From 9fa3a0833dad458dbe8d7ff3ef13c687225b7bf6 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 15:48:26 +0800 Subject: [PATCH 02/11] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/source/sf_app/code/source/app/sf_system.c | 8 ++++---- .../source/sf_app/code/source/fileMng/sf_file.c | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index ba02cd6be..1c71c6be5 100755 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -1027,19 +1027,19 @@ SINT32 sf_app_para_check_start(void) SINT32 sf_app_para_check_stop(void) { UINT16 ret = 0; - MLOGD("s\n"); + //MLOGD("s\n"); if(0 == ParaTskCfg.IsRun){ return SF_SUCCESS; } ParaTskCfg.IsRun = 0; - MLOGD("s1\n"); + //MLOGD("s1\n"); if(TRUE == sf_get_para_check_flag()){ MLOGI("menu info is changed\n"); sf_share_mem_customer_down(1); } - MLOGD("s2\n"); + //MLOGD("s2\n"); ret = pthread_join(ParaTskCfg.TskId, NULL); if(ret != SF_SUCCESS) @@ -1047,7 +1047,7 @@ SINT32 sf_app_para_check_stop(void) MLOGD("thread stop fail!\n"); return ret; } - MLOGD("e\n"); + //MLOGD("e\n"); return SF_SUCCESS; } 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 8d42d1431..846dea335 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 @@ -1549,10 +1549,6 @@ BOOL sf_check_auto_thumb_file(VOID) } } } - - if(0 == puiPara->SendType){ - sf_file_remove(tmp); - } printf("%s:%d e \n", __FUNCTION__, __LINE__); From e400e93ea1648e84a52b061cb059db186920c9ec Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 15:49:00 +0800 Subject: [PATCH 03/11] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8FileSys=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtos/code/driver/na51089/source/mcu/sf_mcu.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/rtos/code/driver/na51089/source/mcu/sf_mcu.c b/rtos/code/driver/na51089/source/mcu/sf_mcu.c index 6ec99d445..be290a099 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_mcu.c +++ b/rtos/code/driver/na51089/source/mcu/sf_mcu.c @@ -2168,7 +2168,7 @@ void sf_file_thumb_cfg_sava(void) FST_FILE fs = 0; //char buff[SF_SEND_LIST_ITEM_LENGTH+1] = {0}; //int fd = 0; - static int flag = 0; + //static int flag = 0; //struct stat st; #if SF_IQ_TEST != ENABLE INT32 uiStatus = 0; @@ -2184,17 +2184,11 @@ void sf_file_thumb_cfg_sava(void) //printf("Add %s to send.List\n", sendfname); if(0 == puiPara->SendType){ snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_AUTO); - if((access(sendListName, F_OK) == 0) && (0 == flag)) - { - printf("%s:%d DeleteFile:%s\r\n", __FUNCTION__, __LINE__, sendListName); - if (FileSys_DeleteFile(sendListName) != FST_STA_OK) { - DBG_IND("Ignore deleting file.\r\n"); - } - } - flag = 1; + fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE); }else { snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_LIST); + fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE); } /*if(access(sendListName, F_OK) == 0) @@ -2205,7 +2199,6 @@ void sf_file_thumb_cfg_sava(void) else { fd = open(sendListName, O_APPEND | O_WRONLY | O_CREAT); }*/ - fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE); if(/*fd*/fs) { FileSys_StatFile(fs, &FileStat); From 3ff21467cdd5756def65bd266bb0f8af72e810cc Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 15:49:24 +0800 Subject: [PATCH 04/11] =?UTF-8?q?1.=E5=8E=BB=E9=99=A4=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/lib/source/sifar/code/source/common/sf_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 6f77e5f7e..36c2449cc 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -296,7 +296,7 @@ void sf_mode_detect(void) { AutoOfftime=0; } - AutoOfftime=0; + //if(((System_GetState(SYS_STATE_CURRMODE) == PRIMARY_MODE_PHOTO)&& (gPhotoData.State == PHOTO_ST_VIEW)) // || ((System_GetState(SYS_STATE_CURRMODE) == PRIMARY_MODE_MOVIE) && (FlowMovie_GetMovDataState() == MOV_ST_VIEW))) if(sf_is_preview()) From d382794c6227fb31ef2e5b2d21ed12415e462131 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 21:07:53 +0800 Subject: [PATCH 05/11] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7ftp?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c | 8 ++++---- .../cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h | 4 ++-- .../cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c | 8 ++++---- .../cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c index bd03725cd..b5e0f2d63 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c @@ -1795,14 +1795,14 @@ void SysResetFlag(void) //SF_STRCPY(puiPara ->APNGPRS, "3gnet"); #else sf_base64_decode(USER_FTP_IP, (char *)tmpStr); - snprintf((char *)puiPara->FtpIp, sizeof(puiPara->FtpIp), (char *)tmpStr); - snprintf((char *)puiPara->FtpPort, sizeof(puiPara->FtpPort), USER_FTP_PORT); + snprintf((char *)puiPara->FtpsIp, sizeof(puiPara->FtpsIp), (char *)tmpStr); + snprintf((char *)puiPara->FtpsPort, sizeof(puiPara->FtpsPort), USER_FTP_PORT); memset(tmpStr, '\0', sizeof(tmpStr)); sf_base64_decode(USER_FTP_USERNAME, (char *)tmpStr); - snprintf((char *)puiPara->FtpUsr, sizeof(puiPara->FtpUsr), (char *)tmpStr); + snprintf((char *)puiPara->FtpsUsr, sizeof(puiPara->FtpsUsr), (char *)tmpStr); memset(tmpStr, '\0', sizeof(tmpStr)); sf_base64_decode(USER_FTP_PASSWORD, (char *)tmpStr); - snprintf((char *)puiPara->FtpPwd, sizeof(puiPara->FtpPwd), (char *)tmpStr); + snprintf((char *)puiPara->FtpsPwd, sizeof(puiPara->FtpsPwd), (char *)tmpStr); #endif diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h index abb3cb8b5..95dd0cfec 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h @@ -523,12 +523,12 @@ typedef struct _UIMenuUIMenuStoreInfo { UINT8 FtpIp[40]; UINT8 FtpPort[5]; UINT8 FtpUsr[40]; - UINT8 FtpPwd[20]; + UINT8 FtpPwd[40]; UINT8 FtpsIp[40]; UINT8 FtpsPort[5]; UINT8 FtpsUsr[40]; - UINT8 FtpsPwd[20]; + UINT8 FtpsPwd[40]; UINT8 OtaFtpIp[40]; UINT8 OtaFtpPort[5]; diff --git a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c index 3dc72ad83..47efe151b 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c +++ b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c @@ -1222,14 +1222,14 @@ void SysResetFlag(void) //SF_STRCPY(puiPara ->APNGPRS, "3gnet"); #else sf_base64_decode(USER_FTP_IP, (char *)tmpStr); - snprintf((char *)puiPara->FtpIp, sizeof(puiPara->FtpIp), (char *)tmpStr); - snprintf((char *)puiPara->FtpPort, sizeof(puiPara->FtpPort), USER_FTP_PORT); + snprintf((char *)puiPara->FtpsIp, sizeof(puiPara->FtpsIp), (char *)tmpStr); + snprintf((char *)puiPara->FtpsPort, sizeof(puiPara->FtpsPort), USER_FTP_PORT); memset(tmpStr, '\0', sizeof(tmpStr)); sf_base64_decode(USER_FTP_USERNAME, (char *)tmpStr); - snprintf((char *)puiPara->FtpUsr, sizeof(puiPara->FtpUsr), (char *)tmpStr); + snprintf((char *)puiPara->FtpsUsr, sizeof(puiPara->FtpsUsr), (char *)tmpStr); memset(tmpStr, '\0', sizeof(tmpStr)); sf_base64_decode(USER_FTP_PASSWORD, (char *)tmpStr); - snprintf((char *)puiPara->FtpPwd, sizeof(puiPara->FtpPwd), (char *)tmpStr); + snprintf((char *)puiPara->FtpsPwd, sizeof(puiPara->FtpsPwd), (char *)tmpStr); #endif diff --git a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h index fbaaf0aa5..d638f78b1 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h +++ b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h @@ -522,12 +522,12 @@ typedef struct _UIMenuUIMenuStoreInfo { UINT8 FtpIp[40]; UINT8 FtpPort[5]; UINT8 FtpUsr[40]; - UINT8 FtpPwd[20]; + UINT8 FtpPwd[40]; UINT8 FtpsIp[40]; UINT8 FtpsPort[5]; UINT8 FtpsUsr[40]; - UINT8 FtpsPwd[20]; + UINT8 FtpsPwd[40]; UINT8 OtaFtpIp[40]; UINT8 OtaFtpPort[5]; From 5a146dd990dae816e500176e6c360cffb6f9df2e Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 21:08:23 +0800 Subject: [PATCH 06/11] =?UTF-8?q?1.ver:7MD4RCwD901=202.ftp=20test=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h | 6 +++--- .../application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h b/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h index 90ce536c2..0c90dd60a 100755 --- a/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h +++ b/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h @@ -921,7 +921,7 @@ #define HUNTING_MCU_UART ENABLE #define HUNTING_IR_LED_940 ENABLE #define SF_EXIF_MN_BUF_SIZE 256 -#define SF_BASE_VERSION "7MD4RCwD9T1" +#define SF_BASE_VERSION "7MD4RCwD901" #define HW_S530 1 #define DCF_DIR_NAME "MEDIA" /* 100MEDIA */ #define DCF_FILE_NAME "SYFW" /* SYFW0001.JPG */ @@ -955,10 +955,10 @@ #define SF_4G_USB_NET_DOWNLOAD 1 -#define SF_TEST_GPRS 1 +#define SF_TEST_GPRS 0 #define CUSTOM_TEST_FTPS 0 -#define SF_TEST_OTA_FTP 1 +#define SF_TEST_OTA_FTP 0 #define CUSTOM_TEST_OTA_FTP 0 #define SF_BATTERY_TEST DISABLE #define SF_BATTERY_TEST_FILE "A:\\BATTERY.TXT" diff --git a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h index 54a198ae7..c22b2b314 100755 --- a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h +++ b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h @@ -947,7 +947,7 @@ #define HUNTING_MCU_UART ENABLE #define HUNTING_IR_LED_940 ENABLE #define SF_EXIF_MN_BUF_SIZE 256 -#define SF_BASE_VERSION "7MD4RCwD9T1" +#define SF_BASE_VERSION "7MD4RCwD901" #define HW_S530 1 #define DCF_DIR_NAME "MEDIA" /* 100MEDIA */ #define DCF_FILE_NAME "SYFW" /* SYFW0001.JPG */ @@ -971,10 +971,10 @@ #define SF_4G_USB_NET_DOWNLOAD 1 -#define SF_TEST_GPRS 1 +#define SF_TEST_GPRS 0 #define CUSTOM_TEST_FTPS 0 -#define SF_TEST_OTA_FTP 1 +#define SF_TEST_OTA_FTP 0 #define CUSTOM_TEST_OTA_FTP 0 #define FASTBOOT_WAIT_FILESYS_TIMEOUT_MS 5000 From 8ce2b8abbe86b809c2e8c9b3a22c1e3be7c01f8a Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 21:09:24 +0800 Subject: [PATCH 07/11] =?UTF-8?q?1.=E5=8E=BB=E9=99=A4=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=202.=E4=BF=AE=E5=A4=8Dftp=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=203.=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/source/sifar/code/include/sf_common.h | 2 +- .../sifar/code/source/common/sf_common.c | 35 ++++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index 041edd218..e260e189a 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -122,6 +122,6 @@ UINT32 sf_cardv_cap_start(void); UINT32 sf_cardv_hd_cap_start(void); void sf_cardv_set_wait_shared_condition(int in); int sf_cardv_para_signaling_start(void); -UINT32 sf_cardv_wifi_send(); +UINT32 sf_cardv_wifi_send(void); #endif diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 36c2449cc..6c34e93d2 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -1257,15 +1257,19 @@ BOOL sf_cmd_ftp(unsigned char argc, char **argv) UIMenuStoreInfo *puiPara = sf_ui_para_get(); //printf("[%s:%d] value:%d\n", __FUNCTION__, __LINE__,value); if(4 == argc) - { + { + memset(puiPara ->FtpIp,'\0', sizeof(puiPara ->FtpIp)); + memset(puiPara ->FtpPort, '\0', sizeof(puiPara ->FtpPort)); + memset(puiPara ->FtpUsr, '\0', sizeof(puiPara ->FtpUsr)); + memset(puiPara ->FtpPwd,'\0', sizeof(puiPara ->FtpPwd)); strncpy((char *)puiPara->FtpIp, argv[0], ((sizeof(puiPara->FtpIp) <= strlen(argv[0])) ? (sizeof(puiPara->FtpIp)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpPort, argv[0], ((sizeof(puiPara->FtpPort) <= strlen(argv[0])) ? (sizeof(puiPara->FtpPort)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpUsr, argv[0], ((sizeof(puiPara->FtpUsr) <= strlen(argv[0])) ? (sizeof(puiPara->FtpUsr)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpPwd, argv[0], ((sizeof(puiPara->FtpPwd) <= strlen(argv[0])) ? (sizeof(puiPara->FtpPwd)) : (strlen(argv[0])))); + strncpy((char *)puiPara->FtpPort, argv[1], ((sizeof(puiPara->FtpPort) <= strlen(argv[1])) ? (sizeof(puiPara->FtpPort)) : (strlen(argv[1])))); + strncpy((char *)puiPara->FtpUsr, argv[2], ((sizeof(puiPara->FtpUsr) <= strlen(argv[2])) ? (sizeof(puiPara->FtpUsr)) : (strlen(argv[2])))); + strncpy((char *)puiPara->FtpPwd, argv[3], ((sizeof(puiPara->FtpPwd) <= strlen(argv[3])) ? (sizeof(puiPara->FtpPwd)) : (strlen(argv[3])))); Save_MenuInfo(); } - printf("[%s:%d] FtpIp:%s\n", __FUNCTION__, __LINE__,puiPara->FtpIp); + printf("[%s:%d] FtpIp:%s FtpPort:%s FtpUsr:%s FtpPwd:%s\n", __FUNCTION__, __LINE__,puiPara->FtpIp,puiPara ->FtpPort,puiPara ->FtpUsr,puiPara ->FtpPwd); return TRUE; } @@ -1275,15 +1279,19 @@ BOOL sf_cmd_ftps(unsigned char argc, char **argv) UIMenuStoreInfo *puiPara = sf_ui_para_get(); //printf("[%s:%d] value:%d\n", __FUNCTION__, __LINE__,value); if(4 == argc) - { + { + memset(puiPara ->FtpsIp,'\0', sizeof(puiPara ->FtpsIp)); + memset(puiPara ->FtpsPort, '\0', sizeof(puiPara ->FtpsPort)); + memset(puiPara ->FtpsUsr, '\0', sizeof(puiPara ->FtpsUsr)); + memset(puiPara ->FtpsPwd,'\0', sizeof(puiPara ->FtpsPwd)); strncpy((char *)puiPara->FtpsIp, argv[0], ((sizeof(puiPara->FtpsIp) <= strlen(argv[0])) ? (sizeof(puiPara->FtpsIp)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpsPort, argv[0], ((sizeof(puiPara->FtpsPort) <= strlen(argv[0])) ? (sizeof(puiPara->FtpsPort)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpsUsr, argv[0], ((sizeof(puiPara->FtpsUsr) <= strlen(argv[0])) ? (sizeof(puiPara->FtpsUsr)) : (strlen(argv[0])))); - strncpy((char *)puiPara->FtpsPwd, argv[0], ((sizeof(puiPara->FtpsPwd) <= strlen(argv[0])) ? (sizeof(puiPara->FtpsPwd)) : (strlen(argv[0])))); + strncpy((char *)puiPara->FtpsPort, argv[1], ((sizeof(puiPara->FtpsPort) <= strlen(argv[1])) ? (sizeof(puiPara->FtpsPort)) : (strlen(argv[1])))); + strncpy((char *)puiPara->FtpsUsr, argv[2], ((sizeof(puiPara->FtpsUsr) <= strlen(argv[2])) ? (sizeof(puiPara->FtpsUsr)) : (strlen(argv[2])))); + strncpy((char *)puiPara->FtpsPwd, argv[3], ((sizeof(puiPara->FtpsPwd) <= strlen(argv[3])) ? (sizeof(puiPara->FtpsPwd)) : (strlen(argv[3])))); Save_MenuInfo(); } - printf("[%s:%d] FtpIp:%s\n", __FUNCTION__, __LINE__,puiPara->FtpIp); + printf("[%s:%d] FtpsIp:%s FtpsPort:%s FtpsUsr:%s FtpsPwd:%s\n", __FUNCTION__, __LINE__,puiPara->FtpsIp,puiPara ->FtpsPort,puiPara ->FtpsUsr,puiPara ->FtpsPwd); return TRUE; } @@ -2023,7 +2031,8 @@ void* sf_sys_do_upgrade(void *arg) } sf_mcu_reg_set(SF_MCU_SOFT_UPDATE, 0); sf_set_send_statu(FALSE); - if(PWR_ON_SETUP == sf_cardv_convert_power_on_mode()){ + //if(PWR_ON_SETUP == sf_cardv_convert_power_on_mode()) + { vos_util_delay_ms(1000); Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, 0); } @@ -2594,7 +2603,7 @@ UINT32 sf_cardv_hd_cap_start(void) } -UINT32 sf_cardv_wifi_send() +UINT32 sf_cardv_wifi_send(void) { SINT32 fd = 0; SINT32 sendBuffLen = 0; @@ -2604,7 +2613,7 @@ UINT32 sf_cardv_wifi_send() if(SF_SUCCESS == sf_share_mem_hd_update()) { - SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); + //SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); fd = sf_get_wifi_socket(); SF_CHAR filePath[64] = { 0 }; From b1ec28e97939dea4090b6acc2727f527ebd34991 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 6 Sep 2023 21:09:40 +0800 Subject: [PATCH 08/11] =?UTF-8?q?1.=E5=8E=BB=E9=99=A4=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_4g_lpa.h | 20 +- .../sf_app/code/source/4gMng/sf_4g_lpa.c | 302 +++++++++--------- 2 files changed, 161 insertions(+), 161 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_4g_lpa.h b/code/application/source/sf_app/code/include/sf_4g_lpa.h index b5f5b1f53..f01d8b7b1 100755 --- a/code/application/source/sf_app/code/include/sf_4g_lpa.h +++ b/code/application/source/sf_app/code/include/sf_4g_lpa.h @@ -9,13 +9,13 @@ #define INPUT_SUBFOLDER "mnt/sd/config" #define OUTPUT_SUBFOLDER "mnt/sd/logs" -#ifndef true -#define true 1 -#endif - -#ifndef false -#define false 0 -#endif +#ifndef true +#define true 1 +#endif + +#ifndef false +#define false 0 +#endif #define PROFILE_STATE_DISABLED 0 @@ -48,8 +48,8 @@ LPA_API_ERROR sf_enable_profile(UINT8 indexProfiles); UINT32 sf_profile_name_paired(UINT8 *profileName, UINT8 *operatorName); void sf_lpa_profile_active_change(void); -UINT8 sf_is_esim_card(); -UINT8 sf_is_esim_init_finish(); +UINT8 sf_is_esim_card(void); +UINT8 sf_is_esim_init_finish(void); UINT32 sf_get_profile_total(void); UINT32 sf_is_profile_index_enable(UINT8 index); @@ -70,7 +70,7 @@ SINT32 sf_lpa_set_download_profile_iccid(SINT8* iccid); void sf_set_wifi_socket(int fd); int sf_get_wifi_socket(void); void sf_set_wifi_cmd(UINT8 cmd); -UINT8 sf_get_wifi_cmd(); +UINT8 sf_get_wifi_cmd(void); void sf_network_select(UINT8* profileId); void sf_4g_operator_scan(UINT8 mode); diff --git a/code/application/source/sf_app/code/source/4gMng/sf_4g_lpa.c b/code/application/source/sf_app/code/source/4gMng/sf_4g_lpa.c index 8a7e1e4a8..9f99652a9 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_4g_lpa.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_4g_lpa.c @@ -1918,7 +1918,7 @@ void sf_set_esim_card(UINT8 flag) g_esim_flag = flag; } -UINT8 sf_is_esim_card() +UINT8 sf_is_esim_card(void) { return g_esim_flag; } @@ -1930,7 +1930,7 @@ void sf_set_esim_init_finish(UINT8 flag) { g_esim_init_finish_flag = flag; } -UINT8 sf_is_esim_init_finish() +UINT8 sf_is_esim_init_finish(void) { return g_esim_init_finish_flag; } @@ -1971,7 +1971,7 @@ void sf_lpa_profile_info_refresh(void) -void sf_sample_lpa_thread() +void sf_sample_lpa_thread(void) { bool res; const LPA_API_VERSION* lpaApiVersion; @@ -2346,7 +2346,7 @@ void sf_sample_lpa_init(void) if(!SfLpaTskParam.IsRun) { - pthread_create(&SfLpaTskParam.TskId, NULL, sf_sample_lpa_thread, NULL); + pthread_create(&SfLpaTskParam.TskId, NULL, (void *)sf_sample_lpa_thread, NULL); SfLpaTskParam.IsRun = 1; } } @@ -2369,7 +2369,7 @@ void sf_profile_active_change_thread(ULONG tmp) void sf_lpa_profile_active_change(void) { pthread_t tLpaProfileActiveTask; - pthread_create(&tLpaProfileActiveTask,NULL,sf_profile_active_change_thread,(void *)NULL); + pthread_create(&tLpaProfileActiveTask,NULL,(void *)sf_profile_active_change_thread,(void *)NULL); } @@ -2803,42 +2803,42 @@ void sf_operator_scan_thread(UINT32 *tmp) { printf("scan network.\n"); - UINT8 totalOperator = 0; - UINT8 totalProfile = 0; - UINT8 i = 0; - UINT8 errCode = CMD_SUCCESS; - UINT8 mode = (UINT8)*tmp; - UINT8 *sendBuff = NULL; - UINT16 sendBuffLen = 0; - APP_SVR_PACKET_T *pMsgParse = NULL; - SF_OPERATORS_LIST_T operatorInfo; - Operator_Info_T *pOperatorInfo = NULL; - Profile_Info_T *pProfileInfo = NULL; - LPA_PROFILE_INFO profileItem; - UINT16 profileListBase = 0; + UINT8 totalOperator = 0; + UINT8 totalProfile = 0; + UINT8 i = 0; + UINT8 errCode = CMD_SUCCESS; + UINT8 mode = (UINT8)*tmp; + UINT8 *sendBuff = NULL; + UINT16 sendBuffLen = 0; + APP_SVR_PACKET_T *pMsgParse = NULL; + SF_OPERATORS_LIST_T operatorInfo; + Operator_Info_T *pOperatorInfo = NULL; + Profile_Info_T *pProfileInfo = NULL; + LPA_PROFILE_INFO profileItem; + UINT16 profileListBase = 0; UINT8 OperatorNameL[20] = {0}; SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); - - memset((void *)&profileItem, 0, sizeof(LPA_PROFILE_INFO)); - memset((void *)&operatorInfo, 0, sizeof(SF_OPERATORS_LIST_T)); - - printf("mode=%d\n", mode); - - errCode = sf_check_network_status(); - - if(errCode == CMD_SUCCESS) - { - totalOperator = sf_get_operator_total(); - - if(mode == 0) //scan - { + + memset((void *)&profileItem, 0, sizeof(LPA_PROFILE_INFO)); + memset((void *)&operatorInfo, 0, sizeof(SF_OPERATORS_LIST_T)); + + printf("mode=%d\n", mode); + + errCode = sf_check_network_status(); + + if(errCode == CMD_SUCCESS) + { + totalOperator = sf_get_operator_total(); + + if(mode == 0) //scan + { errCode = NETWORK_CMD_NOT_SUPPORT; #if 0 - sf_operator_delete_to_list(); - sf_operator_scan(); - totalOperator = sf_get_operator_total(); + sf_operator_delete_to_list(); + sf_operator_scan(); + totalOperator = sf_get_operator_total(); #endif - } + } else if(mode == 1) //not scan and return esim info { @@ -2851,71 +2851,71 @@ void sf_operator_scan_thread(UINT32 *tmp) { errCode = NETWORK_CMD_NOT_SUPPORT; } - - totalProfile = sf_get_profile_total(); - } + + totalProfile = sf_get_profile_total(); + } //int fd = sf_get_wifi_socket(); UINT8 currentCmd = sf_get_wifi_cmd(); - { - sendBuffLen = 10/*Magic+MsgLen+CMD+ACK+EndFlag*/ + 5/*Operator/Profile Total,ID*/ + totalOperator * sizeof(Operator_Info_T) + totalProfile * sizeof(Profile_Info_T); - printf("sendBuffLen=%d totalOperator=%d totalProfile=%d\n", sendBuffLen, totalOperator, totalProfile); - sendBuff = malloc(sendBuffLen); - memset((void *)sendBuff, 0, sendBuffLen); - pMsgParse = (APP_SVR_PACKET_T *)sendBuff; - pMsgParse->magicNum = htons(MSG_PRE_FIX); - pMsgParse->cmd = htons(currentCmd); - pMsgParse->rsp = htons(MSG_WIFI_2_APP); - pMsgParse->msglen = htons(sendBuffLen - 2*sizeof(UINT16)); - pMsgParse->msgBuf.rctrlNetworkScan.cmdRet = errCode; - - pMsgParse->msgBuf.rctrlNetworkScan.buff[0] = totalOperator; - pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff; - pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]); - + { + sendBuffLen = 10/*Magic+MsgLen+CMD+ACK+EndFlag*/ + 5/*Operator/Profile Total,ID*/ + totalOperator * sizeof(Operator_Info_T) + totalProfile * sizeof(Profile_Info_T); + printf("sendBuffLen=%d totalOperator=%d totalProfile=%d\n", sendBuffLen, totalOperator, totalProfile); + sendBuff = malloc(sendBuffLen); + memset((void *)sendBuff, 0, sendBuffLen); + pMsgParse = (APP_SVR_PACKET_T *)sendBuff; + pMsgParse->magicNum = htons(MSG_PRE_FIX); + pMsgParse->cmd = htons(currentCmd); + pMsgParse->rsp = htons(MSG_WIFI_2_APP); + pMsgParse->msglen = htons(sendBuffLen - 2*sizeof(UINT16)); + pMsgParse->msgBuf.rctrlNetworkScan.cmdRet = errCode; + + pMsgParse->msgBuf.rctrlNetworkScan.buff[0] = totalOperator; + pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff; + pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]); + sf_get_operatorname(OperatorNameL); - for(i = 0; i < totalOperator; i++) - { - if(sf_get_operator_item(i, &operatorInfo) == SUCCESS) - { - pOperatorInfo[i].operatorId = operatorInfo.Index; - SF_STRNCPY(&(pOperatorInfo[i].operatorName), &(operatorInfo.OperatorNameLong), 16); - pOperatorInfo[i].signalVal = operatorInfo.SignalVal; - - if(SF_STRNCMP(operatorInfo.OperatorNameLong, OperatorNameL, sizeof(operatorInfo.OperatorNameLong)) == 0) - { - pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = operatorInfo.Index; - } - } - } - - profileListBase = 2 + totalOperator * sizeof(Operator_Info_T); - printf("profileListBase=%d\n", profileListBase); - pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase] = totalProfile; //htons(totalProfile); - pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = 0xff; - pProfileInfo = (Profile_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 2]); - - for(i = 0; i < totalProfile; i++) - { - if(sf_get_profile_item(i, &profileItem) == SUCCESS) - { - pProfileInfo[i].profileId = i; - SF_STRNCPY(&pProfileInfo[i].profileName, profileItem.profileName, 16); - - if(profileItem.profileState[0] == PROFILE_STATE_ENABLED) - { - pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = i; - } - } - } - - sendBuff[sendBuffLen - 2] = 0xff; - sendBuff[sendBuffLen - 1] = 0xee; - + for(i = 0; i < totalOperator; i++) + { + if(sf_get_operator_item(i, &operatorInfo) == SUCCESS) + { + pOperatorInfo[i].operatorId = operatorInfo.Index; + SF_STRNCPY(&(pOperatorInfo[i].operatorName), &(operatorInfo.OperatorNameLong), 16); + pOperatorInfo[i].signalVal = operatorInfo.SignalVal; + + if(SF_STRNCMP(operatorInfo.OperatorNameLong, OperatorNameL, sizeof(operatorInfo.OperatorNameLong)) == 0) + { + pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = operatorInfo.Index; + } + } + } + + profileListBase = 2 + totalOperator * sizeof(Operator_Info_T); + printf("profileListBase=%d\n", profileListBase); + pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase] = totalProfile; //htons(totalProfile); + pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = 0xff; + pProfileInfo = (Profile_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 2]); + + for(i = 0; i < totalProfile; i++) + { + if(sf_get_profile_item(i, &profileItem) == SUCCESS) + { + pProfileInfo[i].profileId = i; + SF_STRNCPY(&pProfileInfo[i].profileName, profileItem.profileName, 16); + + if(profileItem.profileState[0] == PROFILE_STATE_ENABLED) + { + pMsgParse->msgBuf.rctrlNetworkScan.buff[profileListBase + 1] = i; + } + } + } + + sendBuff[sendBuffLen - 2] = 0xff; + sendBuff[sendBuffLen - 1] = 0xee; + //memdump(sendBuff, sendBuffLen); //send(fd,(void *)sendBuff, sendBuffLen, 0); wifiCfg->Lenth = sendBuffLen; @@ -2948,7 +2948,7 @@ void sf_operator_scan_thread(UINT32 *tmp) sf_share_mem_wifi_down(1); } - + } @@ -3065,16 +3065,16 @@ void sf_network_select_thread(UINT8 * tmp) UINT32 ret = SF_LPA_SUCCESS; UINT32 sts = 0; UINT32 retryTime=0; - UINT8 errCode = CMD_SUCCESS; + UINT8 errCode = CMD_SUCCESS; UINT8 profileId = *tmp; UINT8 curActiveProfileId = 0; UINT32 totalProfile = 0; LPA_API_ERROR lpaErrCode = LPA_NO_ERROR; - - errCode = sf_check_network_status(); - - if(errCode == CMD_SUCCESS) - { + + errCode = sf_check_network_status(); + + if(errCode == CMD_SUCCESS) + { sf_get_profile_active_index(&curActiveProfileId); @@ -3108,11 +3108,11 @@ void sf_network_select_thread(UINT8 * tmp) //LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode); if(lpaErrCode == LPA_NO_ERROR) - { + { sf_lpa_profile_info_refresh(); - errCode = CMD_SUCCESS; + errCode = CMD_SUCCESS; sts = 1; - } + } else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) { retryTime++; @@ -3147,24 +3147,24 @@ void sf_network_select_thread(UINT8 * tmp) continue; } else - { + { if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND) - { - printf("status:PROFILE_NOT_FOUND\n"); - errCode = NETWORK_PROFILE_NOT_FOUND; - } + { + printf("status:PROFILE_NOT_FOUND\n"); + errCode = NETWORK_PROFILE_NOT_FOUND; + } else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE) - { - printf("status:PROFILE_IS_ENABLE\n"); - errCode = NETWORK_NOT_NEED_SET; - } - else - { - printf("status:SELECT_FAILED\n"); - errCode = NETWORK_PROFILE_SELECT_FAILED; - } + { + printf("status:PROFILE_IS_ENABLE\n"); + errCode = NETWORK_NOT_NEED_SET; + } + else + { + printf("status:SELECT_FAILED\n"); + errCode = NETWORK_PROFILE_SELECT_FAILED; + } sts = 1; - } + } } if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) @@ -3267,9 +3267,9 @@ void sf_network_select_thread(UINT8 * tmp) } - } + } - sf_wifi_server_network_select_finish(errCode); + sf_wifi_server_network_select_finish(errCode); #if ((!SF_IQ_DEBUG)&&(!SF_4G_TEST)) if(errCode == CMD_SUCCESS) @@ -3281,14 +3281,14 @@ void sf_network_select_thread(UINT8 * tmp) #endif -#if 0 - if((errCode == CMD_SUCCESS) || (errCode == NETWORK_PROFILE_SELECT_FAILED)) - { - sleep(3); - sf_send_poweroff_msg(); - printf("[power off] %s(%d)\n",__FUNCTION__,__LINE__); - } - +#if 0 + if((errCode == CMD_SUCCESS) || (errCode == NETWORK_PROFILE_SELECT_FAILED)) + { + sleep(3); + sf_send_poweroff_msg(); + printf("[power off] %s(%d)\n",__FUNCTION__,__LINE__); + } + #endif } @@ -3307,15 +3307,15 @@ void sf_network_switch_thread() UINT32 ret = SF_LPA_SUCCESS; UINT32 sts = 0; UINT32 retryTime=0; - UINT8 errCode = CMD_SUCCESS; - UINT8 profileId = 0; + UINT8 errCode = CMD_SUCCESS; + UINT8 profileId = 0; UINT8 curActiveProfileId = 0; LPA_API_ERROR lpaErrCode = LPA_NO_ERROR; - - errCode = sf_check_network_status(); + + errCode = sf_check_network_status(); SLOGE("errCode:%x\n", errCode); - if(errCode == CMD_SUCCESS) + if(errCode == CMD_SUCCESS) { if(sf_get_active_profile_next_index(&profileId) == FALSE) { @@ -3338,11 +3338,11 @@ void sf_network_switch_thread() //LOG_DM_RS("Swich Result:0x%02x\n", lpaErrCode); if(lpaErrCode == LPA_NO_ERROR) - { + { sf_lpa_profile_info_refresh(); - errCode = CMD_SUCCESS; + errCode = CMD_SUCCESS; sts = 1; - } + } else if (lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) { retryTime++; @@ -3377,24 +3377,24 @@ void sf_network_switch_thread() continue; } else - { + { if(lpaErrCode == SF_LPA_ERROR_PROFILE_NOT_FOUND) - { - printf("status:PROFILE_NOT_FOUND\n"); - errCode = NETWORK_PROFILE_NOT_FOUND; - } + { + printf("status:PROFILE_NOT_FOUND\n"); + errCode = NETWORK_PROFILE_NOT_FOUND; + } else if(lpaErrCode == SF_LPA_ERROR_PROFILE_IS_ENABLE) - { - printf("status:PROFILE_IS_ENABLE\n"); - errCode = NETWORK_NOT_NEED_SET; - } - else - { - printf("status:SELECT_FAILED\n"); - errCode = NETWORK_PROFILE_SELECT_FAILED; - } + { + printf("status:PROFILE_IS_ENABLE\n"); + errCode = NETWORK_NOT_NEED_SET; + } + else + { + printf("status:SELECT_FAILED\n"); + errCode = NETWORK_PROFILE_SELECT_FAILED; + } sts = 1; - } + } } if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) From f60c8701abbce42816c74175f80bf7311ad2d4b5 Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 7 Sep 2023 14:07:41 +0800 Subject: [PATCH 09/11] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=88=B0=E5=90=AF=E5=8A=A8=E6=A8=A1=E5=BC=8F=E4=B8=8D=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_system.h | 1 + .../source/sf_app/code/source/app/sf_system.c | 25 +++++++++++---- .../code/source/systemMng/sf_commu_mcu_reg.c | 31 +++++++++++++++---- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_system.h b/code/application/source/sf_app/code/include/sf_system.h index 337efbac7..cdc3a7e1b 100755 --- a/code/application/source/sf_app/code/include/sf_system.h +++ b/code/application/source/sf_app/code/include/sf_system.h @@ -63,6 +63,7 @@ SINT32 sf_app_load_ko_start(void); SINT32 sf_app_mcu_para_start(void); SINT32 app_auto_poweroff_start(void); UINT8 sf_check_power_on_mode(void); +void sf_power_off_msg_to_cardv(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index 1c71c6be5..8b05728ce 100755 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -894,7 +894,6 @@ UINT8 *sf_versionGet(UINT8 ver[],UINT8 fea[]) *************************************************/ void sf_power_off(void) { - SF_MESSAGE_BUF_S stMessageBuf = {0}; UINT8 PowerOnMode = sf_poweron_type_get(); printf("[%s:%d] s\n", __FUNCTION__, __LINE__); if(SF_FAILURE == sf_check_sd()) @@ -935,11 +934,7 @@ void sf_power_off(void) sf_power_off_check_ui_para_sava(); sf_statistics_param_save(psfPara); - MLOGI(" SF_KEY_PIN_AOTU_MODE_POWOFF CMD_KEY\n"); - stMessageBuf.cmdId = CMD_KEY; - stMessageBuf.arg1 = SF_EVENT_KEY_SHORT_CLICK; - stMessageBuf.arg2 = SF_KEY_PIN_AOTU_MODE_POWOFF;//auto mode powoff - sf_com_message_send_to_cardv(&stMessageBuf); + sf_power_off_msg_to_cardv(); printf("[%s:%d] e\n", __FUNCTION__, __LINE__); } pthread_cond_t condition; @@ -1481,4 +1476,22 @@ SINT32 sf_app_mcu_para_stop(void) return ret; } return SF_SUCCESS; +} + +/************************************************* + Function: sf_power_off_msg_to_cardv + Description: power off + Input: N/A + Output: N/A + Return: N/A + Others: N/A +*************************************************/ +void sf_power_off_msg_to_cardv(void) +{ + SF_MESSAGE_BUF_S stMessageBuf = {0}; + SLOGI(" SF_KEY_PIN_AOTU_MODE_POWOFF CMD_KEY\n"); + stMessageBuf.cmdId = CMD_KEY; + stMessageBuf.arg1 = SF_EVENT_KEY_SHORT_CLICK; + stMessageBuf.arg2 = SF_KEY_PIN_AOTU_MODE_POWOFF;//auto mode powoff + sf_com_message_send_to_cardv(&stMessageBuf); } \ No newline at end of file diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c index 00c697923..06c8d0c2a 100755 --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c @@ -30,7 +30,9 @@ #include #include #include "sf_common.h" +#include "sf_param_common.h" #include "sf_sms.h" +#include "sf_system.h" #ifdef __cplusplus #if __cplusplus extern "C" { @@ -128,12 +130,15 @@ unsigned char sf_mcu_power_on_para_get (MCUParam_t attrId) { unsigned char dataTemp1 = 0, dataTemp2 = 0; unsigned char startMode = 0; + unsigned char startModetmp = sf_poweron_type_get(); + int startflag = 1; //unsigned char mcuVer = 0; unsigned char mcuReg[REG_SIZE] = { 0 }; unsigned char mcuData[REG_SIZE] = { 0 }; unsigned char i = 0; SF_TIME_S time; + SF_CHK_STARTMODE: if(attrId == SF_MCU_STARTMODE) { sf_mcu_read(START_MODE, &dataTemp1); @@ -163,15 +168,29 @@ unsigned char sf_mcu_power_on_para_get (MCUParam_t attrId) IRSHTTER = (dataTemp2 << 8) | dataTemp1; } + if((startMode != startModetmp) && (startflag)) + { + startflag = 0; + sf_sleep_ms(200); + goto SF_CHK_STARTMODE; + } printf(" start mode = %d IRSHTTER = %d McuVersion:%d.%d.%d\n", startMode, IRSHTTER, (McuVersion>>8)&0xFF, McuVersion & 0xFF, McuSubVersion); sf_mcu_rtc_get(&time); - if(SF_TRUE == sf_sys_rtc_time_check((SF_PARA_TIME_S*)&time)){ - sf_sys_rtc_time_set((SF_PARA_TIME_S*)&time); - }else{ - sf_sys_rtc_time_reset(); + if(startMode == startModetmp) + { + if(SF_TRUE == sf_sys_rtc_time_check((SF_PARA_TIME_S*)&time)){ + sf_sys_rtc_time_set((SF_PARA_TIME_S*)&time); + }else{ + sf_sys_rtc_time_reset(); + } } - sf_poweron_type_set(startMode); - if(SF_MCU_STARTUP_ONKEY == startMode) + else + { + sf_power_off_msg_to_cardv(); + } + //sf_poweron_type_set(startMode); + + if(SF_MCU_STARTUP_ONKEY == startModetmp) ConfigureModeFlag = 1; //McuPowerOnMode = startMode; return startMode; From 0a7fbcec2f16da49479c5e8035703ecf769208ea Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 7 Sep 2023 14:10:01 +0800 Subject: [PATCH 10/11] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=86=99mcu=202.=E4=BF=AE=E5=A4=8Dcardv=E4=B8=8B=E5=86=99mcu?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/lib/source/sifar/code/source/common/sf_common.c | 2 ++ code/lib/source/sifar/code/source/mcu/sf_mcu_client.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 6c34e93d2..f74db15c2 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -2019,6 +2019,7 @@ void* sf_sys_do_upgrade(void *arg) //sf_set_fw_update(1); sf_set_send_statu(TRUE); sf_sys_status_led_set(SF_LED_SYS_STATE_UPDATE); + vos_util_delay_ms(500); //BKG_PostEvent(NVTEVT_BKW_FW_UPDATE); if(0 != sf_fwupdate()){ sf_sys_status_led_set(SF_LED_SYS_STATE_ERROR); @@ -2640,4 +2641,5 @@ UINT32 sf_cardv_wifi_send(void) remove("/tmp/wifiData.txt"); } } + return 0; } \ No newline at end of file diff --git a/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c b/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c index d3319ecbc..d97e7ef9f 100644 --- a/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c +++ b/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c @@ -1408,7 +1408,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) { #if HUNTING_CAMERA_4G == ENABLE SF_MESSAGE_BUF_S stMessageBuf = {0}; - stMessageBuf.arg2 = val; + stMessageBuf.arg3 = val; stMessageBuf.arg2 = attrId; stMessageBuf.arg1 = SF_MCU_CMD_SET_MCU; stMessageBuf.cmdId = CMD_MCU; From 049a600c44c8e0c4cd5eb5488970c16e85242e71 Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 7 Sep 2023 15:56:44 +0800 Subject: [PATCH 11/11] =?UTF-8?q?1.=E5=8E=BB=E9=99=A4=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E8=AD=A6=E5=91=8A=202.=E4=BF=AE=E5=A4=8Dftp?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=90=8Eled=E7=81=AF=E6=98=BE=E7=A4=BA=203.?= =?UTF-8?q?=E5=8E=BB=E9=99=A4ntp=E6=97=B6=E9=97=B4=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_4g_lpa.h | 2 +- .../source/sf_app/code/include/sf_service.h | 2 +- .../sf_app/code/source/4gMng/sf_eg91_sim.c | 14 ++-- .../source/sf_app/code/source/4gMng/sf_ftp.c | 1 + .../sf_app/code/source/app/sf_service.c | 69 +++++++++---------- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_4g_lpa.h b/code/application/source/sf_app/code/include/sf_4g_lpa.h index f01d8b7b1..5a3d77204 100755 --- a/code/application/source/sf_app/code/include/sf_4g_lpa.h +++ b/code/application/source/sf_app/code/include/sf_4g_lpa.h @@ -50,7 +50,7 @@ void sf_lpa_profile_active_change(void); UINT8 sf_is_esim_card(void); UINT8 sf_is_esim_init_finish(void); - +SF_BOOL sf_get_eid(UINT8 *eidStr); UINT32 sf_get_profile_total(void); UINT32 sf_is_profile_index_enable(UINT8 index); UINT32 sf_get_profile_item(UINT8 index, LPA_PROFILE_INFO *profileInfo); diff --git a/code/application/source/sf_app/code/include/sf_service.h b/code/application/source/sf_app/code/include/sf_service.h index fbc520e3b..f943e9750 100755 --- a/code/application/source/sf_app/code/include/sf_service.h +++ b/code/application/source/sf_app/code/include/sf_service.h @@ -102,7 +102,7 @@ void keep_seraching_gps_location(const int timeout_ms); void app_RegisterNet_stop(void); int sf_check_sd(void); void sf_save_camera_gps_info(void); - +void set_at_parament(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c index 189060c47..99e3b21c3 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c @@ -4669,9 +4669,11 @@ SINT32 sf_get_utc(VOID) rtcTime.Hour = hour; rtcTime.Min = minute; rtcTime.Sec = second; - sf_sys_rtc_time_set(&rtcTime); - sf_set_mcu_rtc_flag(1); - printf("[%s:%d]set RTC: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, __LINE__, rtcTime.Year, rtcTime.Mon, rtcTime.Day, rtcTime.Hour, rtcTime.Min, rtcTime.Sec); + if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { + sf_sys_rtc_time_set(&rtcTime); + sf_set_mcu_rtc_flag(1); + printf("[%s:%d]set RTC: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, __LINE__, rtcTime.Year, rtcTime.Mon, rtcTime.Day, rtcTime.Hour, rtcTime.Min, rtcTime.Sec); + } } goto SF_UTC_END; @@ -4833,7 +4835,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) if(strstr((const char *)gsmPara, "+QNTP: 0") != NULL) { time = 0; - int zoneSecond = 0; + //int zoneSecond = 0; UINT8 *CCLK = (UINT8 *)strstr((const char *)gsmPara, "+QNTP: 0"); year = (CCLK[10] - '0') * 1000 + (CCLK[11] - '0') * 100 + (CCLK[12] - '0') * 10 + (CCLK[13] - '0'); @@ -4857,7 +4859,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) } //getUtcTimeFlag = 1; - rtcTime.Year = year; + /*rtcTime.Year = year; rtcTime.Mon = month; rtcTime.Day = day; rtcTime.Hour = hour; @@ -4885,7 +4887,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) sf_sys_rtc_time_set(&rtcTime); sf_set_mcu_rtc_flag(1); printf("[%s:%d]set RTC: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, __LINE__, rtcTime.Year, rtcTime.Mon, rtcTime.Day, rtcTime.Hour, rtcTime.Min, rtcTime.Sec); - } + }*/ goto SF_GEN_NTP_QIDEACT; } 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 fbe82d39a..0cecacb78 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 @@ -1295,6 +1295,7 @@ SINT32 sf_send_file_to_ftp(UINT8 mode) } else { + FtpOpenOk = SUCCESS; return ret2; } } 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 2e966a487..b4bc41570 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 @@ -57,7 +57,7 @@ #include "sf_system.h" #include "at_manager.h" #include "Log.h" - +#include "sf_4g_lpa.h" #ifdef __cplusplus #if __cplusplus @@ -170,11 +170,11 @@ static SINT16 app_Qlog_procress(void) { } #endif -void sf_usb_net_init() +void sf_usb_net_init(void) { static U16 flag = 0; SF_CHAR cmdStr[128] ={0}; - int ret = 0; + //int ret = 0; UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); if(flag == 0) @@ -197,7 +197,7 @@ void sf_usb_net_init() { sprintf(cmdStr, "/usr/bin/quectel-CM-EG91 -n %d&", E_PDP_INDEX); } - ret = system(cmdStr); + system(cmdStr); sleep(3); } @@ -232,31 +232,31 @@ SINT32 sf_USB_net_init(void) for (i = 0; i < 20; i++) { if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0) - { + { ret = sf_check_usb0(); if(ret != SUCCESS) - { + { ret = sf_check_eth0(); } } - else - { + else + { ret = sf_check_eth0(); if(ret != SUCCESS) - { + { ret = sf_check_usb0(); } } if (SUCCESS == ret) - { + { ret = SF_SUCCESS; MLOGI("usb net ip up\r\n"); break; } - else - { + else + { sleep(1); } } @@ -1231,7 +1231,10 @@ SINT32 sf_cardv_file_to_app_send_thread(void) { ThumbSend.IsRun = 0; sf_file_thumb_cfg_clear(); sf_share_mem_file_down(1, s32ret); - + + if (sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { + app_led_net_reg_stop(s32ret); + } if ((sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY) && (!sf_sms_check_send())) { sf_power_off(); } @@ -1282,9 +1285,9 @@ static SINT32 app_Register_Net_Error_return_setup(SF_FN_PARAM_S *pfnParam, SLOGD("s32ret:%x\n", s32ret); // SLOGD("bind flag:%x\n", pStaticParam->bindFlag); if (sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { - if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { - sf_sys_rtc_time_set(&rtcTime); - } + //if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { + // sf_sys_rtc_time_set(&rtcTime); + //} app_led_net_reg_stop(s32ret); } @@ -1311,10 +1314,10 @@ static SINT32 app_Register_Net_Error_return_server(SF_FN_PARAM_S *pfnParam, SLOGE("s32ret:%#x\n", s32ret); // SLOGD("bind flag:%x\n", pStaticParam->bindFlag); if (sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { - if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { - sf_sys_rtc_time_set(&rtcTime); - sf_sys_rtoscmd_set(4, NULL); // SET RTC time to rtos - } + //if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { + // sf_sys_rtc_time_set(&rtcTime); + // sf_sys_rtoscmd_set(4, NULL); // SET RTC time to rtos + // } app_led_net_reg_stop(s32ret); } @@ -1394,7 +1397,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) if(sf_is_esim_card()) { - sf_get_eid(eid); + sf_get_eid((UINT8*)eid); printf("pPara->EsimEid=%s\n", pCustomerParam->EsimEid); printf("pPara->eid=%s\n", eid); if((pCustomerParam->EsimEid[0] != '\0') && (SF_STRCMP(pCustomerParam->EsimEid, eid) != 0)) @@ -1437,10 +1440,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) #endif s32ret = sf_get_utc(); - if ((s32ret == SF_SIM_ERROR_UTC) && (SF_ON != pCustomerParam->GpsSwitch)) { - SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; - s32ret = sf_get_ntp(s32ret, ¤t_time); - } + sf_4G_usb_net_apn_cfg(pfnParam); set_at_parament(); sf_USB_net_init(); @@ -1602,11 +1602,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) sf_USB_net_init(); s32ret = sf_get_utc(); - if ((s32ret == SF_SIM_ERROR_UTC) && - (SF_ON != pCustomerParam->GpsSwitch)) { - SF_PARA_TIME_S current_time = {0, 0, 0, 0, 0, 0}; - s32ret = sf_get_ntp(s32ret, ¤t_time); - } + if ((SF_ON == pCustomerParam->GpsSwitch)) { s32ret = open_gps(s32ret); } @@ -1654,7 +1650,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) if(sf_is_esim_card()) { - sf_get_eid(eid); + sf_get_eid((UINT8*)eid); printf("pPara->EsimEid=%s\n", pCustomerParam->EsimEid); printf("pPara->eid=%s\n", eid); if((pCustomerParam->EsimEid[0] != '\0') && (SF_STRCMP(pCustomerParam->EsimEid, eid) != 0)) @@ -1740,10 +1736,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) sf_USB_net_init(); s32ret = sf_get_utc(); - if ((s32ret == SF_SIM_ERROR_UTC) && (SF_ON != pCustomerParam->GpsSwitch)) { - SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; - s32ret = sf_get_ntp(s32ret, ¤t_time); - } + if ((SF_ON == pCustomerParam->GpsSwitch)) { s32ret = open_gps(s32ret); } @@ -2052,10 +2045,10 @@ void set_at_parament(void) SINT32 open_gps(const SINT32 utc) { - UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); - SINT32 s32ret = 0; + //UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); + //SINT32 s32ret = 0; SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; - s32ret = sf_get_ntp(utc, ¤t_time); + sf_get_ntp(utc, ¤t_time); #define NTP_TIME_LENGTH 32 char ntp_time[NTP_TIME_LENGTH] = {0}; snprintf(ntp_time, NTP_TIME_LENGTH, "%04d/%02d/%02d,%02d:%02d:%02d",