From 962968f81a80765015ac1d86dee519c40ec62239 Mon Sep 17 00:00:00 2001 From: alisa Date: Wed, 30 Aug 2023 23:33:48 +0800 Subject: [PATCH] =?UTF-8?q?[e-sim]1.=E5=88=87=E7=BD=91=E8=B0=83=E8=AF=95?= =?UTF-8?q?=EF=BC=8C=E7=9B=AE=E5=89=8Deg915=E4=B8=8A=E8=AF=BB=E5=8F=96prof?= =?UTF-8?q?ile=E5=A4=B1=E8=B4=A5=202.eg91=E6=A8=A1=E5=9D=97=E6=89=A7?= =?UTF-8?q?=E8=A1=8Cat+qnvfr=E4=BC=98=E5=8C=96=EF=BC=8C=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E5=8C=B9=E9=85=8DEG91VX=E5=92=8CEG95VX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DxInput_Key.c | 13 +++++++- .../sf_app/code/include/sf_param_enum.h | 3 ++ .../sf_app/code/source/4gMng/sf_4g_lpa.c | 14 +++++---- .../sf_app/code/source/4gMng/sf_eg91_sim.c | 14 +++++++-- .../source/sf_app/code/source/app/sf_app.c | 2 +- .../source/sf_app/code/source/app/sf_common.c | 22 +++++++++++++- .../sf_app/code/source/wifi/sf_wifi_svr.c | 30 ++++++++++++------- .../sifar/code/source/common/sf_common.c | 1 + 8 files changed, 77 insertions(+), 22 deletions(-) diff --git a/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxInput_Key.c b/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxInput_Key.c index f659b6211..5b810b8ab 100755 --- a/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxInput_Key.c +++ b/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxInput_Key.c @@ -28,6 +28,9 @@ #include "sf_sd_common.h" #endif +#include "sf_sd_common.h" +#include "sf_message_queue.h" +#include "sf_param_enum.h" #if 0 #include "rtc.h" @@ -239,10 +242,14 @@ UINT32 DrvKey_DetNormalKey(void) sf_save_camera_info(); vos_perf_mark(&ttick); } - else if((0 == cmdflag) && (time == 20000)) + else if((0 == cmdflag) && (time >= 20000)) { cmdflag = 1; printf("[%s:%d] SendKeyCnt:%d KeyTestPressCnt:%d time: %dms\n", __FUNCTION__, __LINE__, SendKeyCnt, KeyTestPressCnt, time); + 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); //sf_network_switch(); } @@ -251,16 +258,20 @@ UINT32 DrvKey_DetNormalKey(void) if(KeyTestPressCnt && (0 == sf_get_fw_update())){ if((!cmdflag) && (time >= 3000) && (sf_get_pir_statu_flag())){ + printf("[%s:%d] SendKeyCnt:%d KeyTestPressCnt:%d time: %dms\n", __FUNCTION__, __LINE__, SendKeyCnt, KeyTestPressCnt, time); cmdflag = 1; //sf_set_card_statu(CMD_FORMAT_SD_STA); //BKG_PostEvent(NVTEVT_BKW_FORMAT_CARD); }else if((!cmdflag) && (time >= 10000) && (FALSE == sf_check_net_work_flag()) && (!sf_get_pir_statu_flag())){ + printf("[%s:%d] SendKeyCnt:%d KeyTestPressCnt:%d time: %dms\n", __FUNCTION__, __LINE__, SendKeyCnt, KeyTestPressCnt, time); cmdflag = 1; sf_set_module_update(1); }else if((++SendKeyCnt < SendKey_LessCnt) && (!cmdflag)){//shot key + printf("[%s:%d] SendKeyCnt:%d KeyTestPressCnt:%d time: %dms\n", __FUNCTION__, __LINE__, SendKeyCnt, KeyTestPressCnt, time); uiKeyCode |= FLGKEY_SHUTTER2; }else { printf("[%s:%d] SendKeyCnt:%d KeyTestPressCnt:%d time: %dms\n", __FUNCTION__, __LINE__, SendKeyCnt, KeyTestPressCnt, time); + SendKeyCnt = 0; KeyTestPressCnt = 0; timeflag = 0; 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 1abfaba3d..68f361eaa 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 @@ -515,6 +515,9 @@ typedef enum _SF_DEV_CMD_STEP_e{ SF_DEV_CMD_TEMPER = 0x0, SF_DEV_CMD_BAT = 0x1, SF_DEV_CMD_4G_USB_RM = 0x2, + SF_DEV_CMD_ESIM_OPERATION_SCAN = 0x3, + SF_DEV_CMD_ESIM_OPERATION_SELECT = 0x4, + SF_DEV_CMD_ESIM_OPERATION_SWTICH = 0x5, SF_DEV_CMD_BUTT } SF_DEV_CMD_STEP_e; 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 d0b39dd37..37b5b9cfe 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 @@ -2771,6 +2771,7 @@ UINT8 sf_check_network_status(void) errCode = NETWORK_NO_SIM; } + #if 0 //NetworkScan = TRUE; while(!sf_get_simcard_ready()) { @@ -2782,18 +2783,21 @@ UINT8 sf_check_network_status(void) errCode = NETWORK_NO_SIM; return errCode; } - + #endif + while(!sf_is_esim_init_finish()) { usleep(100*1000); } + SLOGD("\n"); /*adjust the module is not reset status*/ while(sf_get_module_reset_flag()) { usleep(100*1000); } + SLOGD("\n"); if(!sf_is_esim_card()) errCode = NETWORK_SIM_NOT_SUPPORTED; @@ -3238,7 +3242,7 @@ void sf_network_select(UINT8 profileId) void sf_network_switch_thread() { - printf("switch network.\n"); + SLOGD("switch network.\n"); UINT32 ret = SF_LPA_SUCCESS; UINT32 sts = 0; UINT32 retryTime=0; @@ -3248,10 +3252,10 @@ void sf_network_switch_thread() LPA_API_ERROR lpaErrCode = LPA_NO_ERROR; errCode = sf_check_network_status(); - + SLOGE("errCode:%x\n", errCode); + if(errCode == CMD_SUCCESS) - { - + { if(sf_get_active_profile_next_index(&profileId) == FALSE) { profileId = 0; 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 fc7671909..5a47c73a0 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 @@ -2664,6 +2664,7 @@ SINT32 sf_module_complete_init(void) else if(strstr((const char *)gsmPara, "+QSIMSTAT: 0,1")) { eNetRegLocation = QUECTEL_NETREG_DBGCTL; + sf_set_sim_insert(1); if(puiPara->QLogSwitch) { @@ -3263,8 +3264,9 @@ SINT32 sf_net_regist_manual(void) { SF_LOG("operation info manual set,default success.\n"); } - - if((strstr((const char *)puiPara->Sim4gApn, APN_4G_VERIZON)) && ((SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) != 0))) + SF_LOG("puiPara->ModuleVer:%s\n",puiPara->ModuleVer); + if((strstr((const char *)puiPara->Sim4gApn, APN_4G_VERIZON)) && ((SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG91_V, 6) == 0)) \ + && ((SF_STRNCMP(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG95_V, 6) == 0))) { eNetRegLocation = QUECTEL_NETREG_QNVFW; sprintf((char *)gsmPara, "%s", "at+qnvfr=\"/nv/item_files/modem/uim/gstk/feature_bmsk\"\r"); @@ -3340,7 +3342,13 @@ SINT32 sf_net_regist_manual(void) } else { - eNetRegLocation = QUECTEL_NETREG_MODULE_RESTART; + //eNetRegLocation = QUECTEL_NETREG_MODULE_RESTART; + eNetRegLocation = QUECTEL_SEARCH_IPV4V6; + sprintf((char *)gsmPara, "%s", "AT+QICSGP=1\r"); + ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen((const char *)gsmPara)); + SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE); + //ttyData.cmp = "OK"; + ttyData.len = strlen(gsmPara) + 2; } break; 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 b33261d75..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-v1 *\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 df0359b7e..96093035a 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 @@ -19,7 +19,7 @@ #include #include #include - +#include "sf_4g_lpa.h" #ifdef __cplusplus #if __cplusplus @@ -897,6 +897,26 @@ static SINT32 sf_app_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf) MLOGE("-------ttyUSB deinit fail!\n"); } break; + + case SF_DEV_CMD_ESIM_OPERATION_SCAN: + MLOGI("SF_DEV_CMD_ESIM_OPERATION_SCAN\n"); + sf_set_wifi_socket(pMessageBuf->arg2); + sf_set_wifi_cmd(0x3b);//WIFI_CONTROL_CAMERA_Network_Scan + sf_4g_operator_scan(pMessageBuf->arg3); + + break; + + case SF_DEV_CMD_ESIM_OPERATION_SELECT: + MLOGI("SF_DEV_CMD_ESIM_OPERATION_SELECT\n"); + sf_set_wifi_socket(pMessageBuf->arg2); + sf_set_wifi_cmd(0x3c);//WIFI_CONTROL_CAMERA_Network_Select + sf_network_select(pMessageBuf->arg3); + + break; + case SF_DEV_CMD_ESIM_OPERATION_SWTICH: + MLOGI("SF_DEV_CMD_ESIM_OPERATION_SWTICH\n"); + sf_network_switch(); + default: break; } diff --git a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c index 9fb5c4f93..b364f45cf 100755 --- a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c +++ b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c @@ -57,7 +57,7 @@ #include "Mode/UIModeMovie.h" #include "sf_log.h" #include "DCF.h" -#if SF_LPA_SDK +#if 0//SF_LPA_SDK #include "lpasdk/api/lpasdk_api.h" #include "sf_4g_lpa.h" #endif @@ -1064,6 +1064,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) UIMenuStoreInfo *puiPara = sf_ui_para_get(); UINT8 paraNeedReboot = 0; UINT8 paramSaveFlag = 0; + SF_MESSAGE_BUF_S stMessageBuf = {0}; // HI_MESSAGE_S stMessage; //printf("[sf_svr_packet_proc]dataLen: %d\n",dataLen); @@ -2027,23 +2028,30 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) paramSaveFlag = 1; respFlag = 2; break; -#if 0 -SF_LPA_SDK - extern void sf_4g_operator_scan(UINT8 mode); - extern void sf_network_select(UINT8 profileId); +#if 1 +//SF_LPA_SDK + //extern void sf_4g_operator_scan(UINT8 mode); + //extern void sf_network_select(UINT8 profileId); case WIFI_CONTROL_CAMERA_Network_Scan: - sf_set_wifi_socket(fd); - sf_set_wifi_cmd(WIFI_CONTROL_CAMERA_Network_Scan); - sf_4g_operator_scan(pMsgStruct->msgBuf.ctrlNetworkScan.networkCtrl); + //sf_set_wifi_socket(fd); + //SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_DEV_CMD_ESIM_OPERATION_SCAN; + stMessageBuf.arg2 = fd; + stMessageBuf.arg3 = pMsgStruct->msgBuf.ctrlNetworkScan.networkCtrl; + stMessageBuf.cmdId = CMD_DEV; + sf_com_message_send_to_app(&stMessageBuf); respFlag = 0; break; case WIFI_CONTROL_CAMERA_Network_Select: - sf_set_wifi_socket(fd); - sf_set_wifi_cmd(WIFI_CONTROL_CAMERA_Network_Select); - sf_network_select(pMsgStruct->msgBuf.ctrlNetworkSelect.profileId); + //SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_DEV_CMD_ESIM_OPERATION_SELECT; + stMessageBuf.arg2 = fd; + stMessageBuf.arg3 = pMsgStruct->msgBuf.ctrlNetworkSelect.profileId; + stMessageBuf.cmdId = CMD_DEV; + sf_com_message_send_to_app(&stMessageBuf); respFlag = 0; break; #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 5e6d8b42a..fc4f643ba 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -60,6 +60,7 @@ #include #include "UIAppNetwork.h" #include "sf_mcu.h" +#include "sf_4g_lpa.h" #include #include