From 995fc920fc8cfcf4d63a4f0f552da87e1e0296d2 Mon Sep 17 00:00:00 2001 From: alisa Date: Sun, 10 Sep 2023 23:17:55 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=B8=9A=E5=8A=A1]1.e-sim=E5=8D=A1=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=BD=91=E7=BB=9C=E6=B5=81=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/cardv/SrcCode/System/SysMain_cmd.c | 2 + .../UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h | 2 +- code/application/source/sf_app/MakeConfig.mk | 2 +- .../source/sf_app/code/include/sf_eg91_sim.h | 2 +- .../sf_app/code/include/sf_hal_ttyusb.h | 2 +- .../sf_app/code/include/sf_param_enum.h | 1 + .../sf_app/code/source/4gMng/sf_eg91_sim.c | 19 ++- .../source/sf_app/code/source/app/sf_app.c | 2 +- .../source/sf_app/code/source/app/sf_common.c | 8 +- .../lib/source/sifar/code/include/sf_common.h | 4 +- .../sifar/code/source/common/sf_common.c | 120 ++++++++++++------ 11 files changed, 115 insertions(+), 49 deletions(-) diff --git a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c index 7fda1556b..2c3e8228a 100755 --- a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c +++ b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c @@ -256,6 +256,8 @@ SXCMD_ITEM("dispparaset %", sf_cmd_disp_para_set, "dispparaset v1 v2 v3 v4 v5 v6 SXCMD_ITEM("ftpsw %", sf_cmd_ftp_switch, "ftpsw v1") SXCMD_ITEM("ftpset %", sf_cmd_ftp, "ftpset v1 v2 v3 v4") SXCMD_ITEM("ftpsset %", sf_cmd_ftps, "ftpsset v1 v2 v3 v4") +SXCMD_ITEM("sfota %", sf_cmd_ftp_ota, "sf_ota v1 v2 v3 v4") +SXCMD_ITEM("sf_sw_esim %", sf_cmd_switch_esim, "sf_switch_esim") SXCMD_ITEM("gprssw %", sf_cmd_gprs_switch, "gprssw 0/1") #endif diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h index 2e30fd94f..400b0f54b 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h @@ -197,7 +197,7 @@ #else #define DEFAULT_BOOT_WORK_MODE SF_CAM_MODE_PHOTO// #define DEFAULT_NET_WORK_NEED_SEARCH SF_ON -#define DEFAULT_AUTO_OFF_SWITCH SF_ON +#define DEFAULT_AUTO_OFF_SWITCH SF_OFF #define DEFAULT_PIR_SWITCH SF_ON #define DEFAULT_PIR_SENSITIVITY SF_PIR_SENSITIVITY_7 #define DEFAULT_TIMELAPSE_SWITCH SF_OFF diff --git a/code/application/source/sf_app/MakeConfig.mk b/code/application/source/sf_app/MakeConfig.mk index 818835aa9..b837e8fdc 100755 --- a/code/application/source/sf_app/MakeConfig.mk +++ b/code/application/source/sf_app/MakeConfig.mk @@ -84,5 +84,5 @@ C_PREDEFINED = \ -DLPA_SDK__PLATFORM_RASPBIAN \ -DLPA_SDK__SEMEDIA_DRIVER_GENERIC_MODEM \ -DLPA_SDK__USING_EX_API \ - -DLPA_SDK__MAX_SIZE_OF_DATA_IN_STORE_DATA_APDU=253 \ + -DLPA_SDK__MAX_SIZE_OF_DATA_IN_STORE_DATA_APDU=128 \ \ No newline at end of file diff --git a/code/application/source/sf_app/code/include/sf_eg91_sim.h b/code/application/source/sf_app/code/include/sf_eg91_sim.h index fc3be4feb..80abb7280 100755 --- a/code/application/source/sf_app/code/include/sf_eg91_sim.h +++ b/code/application/source/sf_app/code/include/sf_eg91_sim.h @@ -24,7 +24,7 @@ extern "C" { #define APN_4G_USCC "uscc" #define APN_4G_ATT "nxtgenphone" -#define APN_4G_VERIZON "VZWINTERNET" +#define APN_4G_VERIZON "vzwinternet" #define APN_4G_TMOBBILE "fast.t-mobile.com" diff --git a/code/application/source/sf_app/code/include/sf_hal_ttyusb.h b/code/application/source/sf_app/code/include/sf_hal_ttyusb.h index 1038d1368..5d22cfa66 100755 --- a/code/application/source/sf_app/code/include/sf_hal_ttyusb.h +++ b/code/application/source/sf_app/code/include/sf_hal_ttyusb.h @@ -47,7 +47,7 @@ extern "C" { #define E_PDP_INDEX 7 -#define V_PDP_INDEX 7 +#define V_PDP_INDEX 3 #define A_PDP_INDEX 1 typedef struct sf_SERIAL_DATA_FRAME_TYPE_S { diff --git a/code/application/source/sf_app/code/include/sf_param_enum.h b/code/application/source/sf_app/code/include/sf_param_enum.h index d02529a4c..0d260c5de 100755 --- a/code/application/source/sf_app/code/include/sf_param_enum.h +++ b/code/application/source/sf_app/code/include/sf_param_enum.h @@ -519,6 +519,7 @@ typedef enum _SF_DEV_CMD_STEP_e{ SF_DEV_CMD_ESIM_OPERATION_SCAN = 0x3, SF_DEV_CMD_ESIM_OPERATION_SELECT = 0x4, SF_DEV_CMD_ESIM_OPERATION_SWTICH = 0x5, + SF_DEV_CMD_OTA = 0x6, SF_DEV_CMD_BUTT } SF_DEV_CMD_STEP_e; 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..e7ab578ba 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 @@ -3298,14 +3298,21 @@ SINT32 sf_net_regist_manual(void) { if(strstr((const char *)puiPara->Sim4gApn, APN_4G_ATT)) { + eNetRegLocation = QUECTEL_NETREG_CGDCONT; sprintf((char *)gsmPara, "AT+CGDCONT=1,\"IPV4V6\",\"%s\"\r", puiPara->Sim4gApn); + } + else if(strstr((const char *)puiPara->Sim4gApn, APN_4G_VERIZON)) + { + eNetRegLocation = QUECTEL_SEARCH_IPV4V6; + sprintf((char *)gsmPara, "%s", "AT+QICSGP=1\r"); } else { + eNetRegLocation = QUECTEL_NETREG_CGDCONT; sprintf((char *)gsmPara, "%s", "AT+CGDCONT=1,\"IPV4V6\",\"\"\r"); } - eNetRegLocation = QUECTEL_NETREG_CGDCONT; + } //ttyData.cmp = "OK"; ttyData.len = strlen(gsmPara) + 2; @@ -3402,8 +3409,16 @@ SINT32 sf_net_regist_manual(void) if((strstr((const char *)gsmPara, "\"ims\"") == NULL) && (strstr((const char *)puiPara->Sim4gApn, APN_4G_VERIZON))) { + eNetRegLocation = QUECTEL_NETREG_QPRTPARA; - sprintf((char *)gsmPara, "AT+QPRTPARA=3\r"); + if(((SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG91_NAXD, 6) == 0))|| ((SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG95_NAXD, 6) == 0))) + { + sprintf((char *)gsmPara, "AT+QPRTPARA=3\r"); + } + else + { + sprintf((char *)gsmPara, "AT+RSTSET\r"); + } } else { diff --git a/code/application/source/sf_app/code/source/app/sf_app.c b/code/application/source/sf_app/code/source/app/sf_app.c index 40c3b8f67..4f167fb5e 100755 --- a/code/application/source/sf_app/code/source/app/sf_app.c +++ b/code/application/source/sf_app/code/source/app/sf_app.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) { printf("*********************************************\n"); printf("* *\n"); - printf("* sf_app-v5 *\n"); + printf("* sf_app-v3 *\n"); printf("* *\n"); printf("*********************************************\n"); //gpio_direction_input(C_GPIO(10)); diff --git a/code/application/source/sf_app/code/source/app/sf_common.c b/code/application/source/sf_app/code/source/app/sf_common.c index fc1783bbb..9af20dd59 100755 --- a/code/application/source/sf_app/code/source/app/sf_common.c +++ b/code/application/source/sf_app/code/source/app/sf_common.c @@ -916,7 +916,13 @@ static SINT32 sf_app_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf) case SF_DEV_CMD_ESIM_OPERATION_SWTICH: MLOGI("SF_DEV_CMD_ESIM_OPERATION_SWTICH\n"); sf_network_switch(); - + break; + + case SF_DEV_CMD_OTA: + MLOGI("SF_DEV_CMD_OTA\n"); + sf_camera_ota_ftp(); + break; + default: break; } diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index 041edd218..8cc921330 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -122,6 +122,8 @@ 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(); +BOOL sf_cmd_ftp_ota(unsigned char argc, char **argv); +BOOL sf_cmd_switch_esim(unsigned char argc, char **argv); + #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 6f77e5f7e..ed305d704 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; + //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()) @@ -1287,6 +1287,45 @@ BOOL sf_cmd_ftps(unsigned char argc, char **argv) return TRUE; } + +BOOL sf_cmd_ftp_ota(unsigned char argc, char **argv) +{ + //UINT32 value; + UIMenuStoreInfo *puiPara = sf_ui_para_get(); + if(4 == argc) + { + strncpy((char *)puiPara->OtaFtpIp, argv[0], ((sizeof(puiPara->OtaFtpIp) <= strlen(argv[0])) ? (sizeof(puiPara->OtaFtpIp)) : (strlen(argv[0])))); + strncpy((char *)puiPara->OtaFtpPort, argv[1], ((sizeof(puiPara->OtaFtpPort) <= strlen(argv[1])) ? (sizeof(puiPara->OtaFtpPort)) : (strlen(argv[1])))); + strncpy((char *)puiPara->OtaFtpUserName, argv[2], ((sizeof(puiPara->OtaFtpUserName) <= strlen(argv[2])) ? (sizeof(puiPara->OtaFtpUserName)) : (strlen(argv[2])))); + strncpy((char *)puiPara->OtaFtpPassWord, argv[3], ((sizeof(puiPara->OtaFtpPassWord) <= strlen(argv[3])) ? (sizeof(puiPara->OtaFtpPassWord)) : (strlen(argv[3])))); + + Save_MenuInfo(); + } + sleep(1); + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_DEV_CMD_OTA; + stMessageBuf.cmdId = CMD_DEV; + sf_com_message_send_to_app(&stMessageBuf); + + printf("[%s:%d] OtaFtpIp:%s\n", __FUNCTION__, __LINE__, puiPara->OtaFtpIp); + printf("[%s:%d] OtaFtpPort:%s\n", __FUNCTION__, __LINE__, puiPara->OtaFtpPort); + printf("[%s:%d] OtaFtpUserName:%s\n", __FUNCTION__, __LINE__, puiPara->OtaFtpUserName); + printf("[%s:%d] OtaFtpPassWord:%s\n", __FUNCTION__, __LINE__, puiPara->OtaFtpPassWord); + + return TRUE; +} + +BOOL sf_cmd_switch_esim(unsigned char argc, char **argv) +{ + //UINT32 value; + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_DEV_CMD_ESIM_OPERATION_SWTICH; + stMessageBuf.cmdId = CMD_DEV; + sf_com_message_send_to_app(&stMessageBuf); + + return TRUE; +} + UINT32 sf_set_pir_sensitivity(UINT8 pirs) { UINT8 digPirLevel[10] = {200, 38, 30, 24, 18, 16, 10, 9, 8, 7}; @@ -1652,6 +1691,45 @@ static SINT32 sf_cardv_proccess_cmd_gprs(SF_MESSAGE_BUF_S *pMessageBuf) return SF_SUCCESS; } +void sf_cardv_wifi_send() +{ + SINT32 fd = 0; + SINT32 sendBuffLen = 0; + SINT8 sendBuff[1024] = { 0 }; + SINT32 i = 0; + struct stat statBuf; + + if(SF_SUCCESS == sf_share_mem_hd_update()) + { + SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); + fd = sf_get_wifi_socket(); + + SF_CHAR filePath[64] = { 0 }; + SINT32 fdWifi = -1; + sprintf(filePath, "/tmp/wifiData.txt"); + printf("filePath:%s\n", filePath); + + fdWifi = open(filePath, O_RDWR, 0777); + if(fdWifi >= 0) + { + fstat(fdWifi, &statBuf); + sendBuffLen = statBuf.st_size; + printf("fSize=%d\n", sendBuffLen); + read(fdWifi, sendBuff, sendBuffLen); + close(fdWifi); + + for(i = 0; i < sendBuffLen; i++) + { + printf("[%x]-", sendBuff[i]); + } + printf("\n[cardv-sendBuff-1] e\n"); + + send(fd, sendBuff, sendBuffLen, 0); + remove("/tmp/wifiData.txt"); + } + } +} + static SINT32 sf_cardv_proccess_cmd_wifi(SF_MESSAGE_BUF_S *pMessageBuf) { MLOGI("ID = %#x\n",pMessageBuf->arg1); @@ -2011,6 +2089,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); @@ -2592,43 +2671,4 @@ UINT32 sf_cardv_hd_cap_start(void) HdCapTskCfg.IsRun = 1; return SF_SUCCESS; -} - -UINT32 sf_cardv_wifi_send() -{ - SINT32 fd = 0; - SINT32 sendBuffLen = 0; - SINT8 sendBuff[1024] = { 0 }; - SINT32 i = 0; - struct stat statBuf; - - if(SF_SUCCESS == sf_share_mem_hd_update()) - { - SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); - fd = sf_get_wifi_socket(); - - SF_CHAR filePath[64] = { 0 }; - SINT32 fdWifi = -1; - sprintf(filePath, "/tmp/wifiData.txt"); - printf("filePath:%s\n", filePath); - - fdWifi = open(filePath, O_RDWR, 0777); - if(fdWifi >= 0) - { - fstat(fdWifi, &statBuf); - sendBuffLen = statBuf.st_size; - printf("fSize=%d\n", sendBuffLen); - read(fdWifi, sendBuff, sendBuffLen); - close(fdWifi); - - for(i = 0; i < sendBuffLen; i++) - { - printf("[%x]-", sendBuff[i]); - } - printf("\n[cardv-sendBuff-1] e\n"); - - send(fd, sendBuff, sendBuffLen, 0); - remove("/tmp/wifiData.txt"); - } - } } \ No newline at end of file