From 041d8d89a3bb2afd5fd87b07777a7dd776026abe Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 18 Dec 2023 13:55:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=A1=E5=8F=B7=E6=94=B9=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIFlowMovie/UIFlowMovieEventCallback.c | 14 ++-- .../UIFlowPhoto/UIFlowPhotoEventCallback.c | 16 ++-- .../source/sf_app/code/include/sf_eg91_sim.h | 2 + .../sf_app/code/source/4gMng/sf_eg91_sim.c | 78 +++++++++---------- .../source/sf_app/code/source/4gMng/sf_ftp.c | 46 +++++------ .../source/sf_app/code/source/app/sf_device.c | 4 +- .../sf_app/code/source/fileMng/sf_file.c | 14 ++-- .../code/source/systemMng/sf_commu_mcu_reg.c | 11 ++- .../lib/source/sifar/code/include/sf_common.h | 2 + .../sifar/code/source/common/sf_common.c | 20 +++++ .../source/sifar/code/source/module/sf_sim.c | 1 - 11 files changed, 117 insertions(+), 91 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMovie/UIFlowMovieEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMovie/UIFlowMovieEventCallback.c index 6ceb46cc7..732b2e4ae 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMovie/UIFlowMovieEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMovie/UIFlowMovieEventCallback.c @@ -256,12 +256,12 @@ static void signal_icon_show(const short signal) } static void update_4g_module_icon(void) { - UIMenuStoreInfo *puiPara = sf_ui_para_get(); + //UIMenuStoreInfo *puiPara = sf_ui_para_get(); static short signal = SIGNAL_NOT_YET_GET; static short searching_index = -1; short signal_new = sf_cardv_get_cq_signal(); unsigned short signal_level = 0; - network_signal_level_get(puiPara->NetGeneration, signal_new, &signal_level); + network_signal_level_get(sf_get_net_generation(), signal_new, &signal_level); // printf("new signal = %d, old signal = %d\n", signal_new, signal); if(SIGNAL_NOT_YET_GET == signal_new) { @@ -294,20 +294,20 @@ const int EMPTY_IMAGE = 0; LV_PLUGIN_IMG_ID_SF_NET3G, LV_PLUGIN_IMG_ID_SF_NET4G }; -// printf("NetGeneration:%d\n", puiPara->NetGeneration); +// printf("NetGeneration:%d\n", sf_get_net_generation()); const int SIM_CARD_NOT_INIT = 0; const int NET_GENERATION_2G = 2; // const int NET_GENERATION_3G = 3; const int NET_GENERATION_4G = 4; // puiPara->NetGeneration = NET_GENERATION_4G; // Test - if (SIM_CARD_NOT_INIT == puiPara->NetGeneration - || puiPara->NetGeneration < NET_GENERATION_2G - || puiPara->NetGeneration > NET_GENERATION_4G) + if (SIM_CARD_NOT_INIT == sf_get_net_generation() + || sf_get_net_generation() < NET_GENERATION_2G + || sf_get_net_generation() > NET_GENERATION_4G) { lv_obj_set_hidden(image_4g_scr_uiflowmovie, true); return; } - int index = puiPara->NetGeneration; + int index = sf_get_net_generation(); lv_obj_set_hidden(image_4g_scr_uiflowmovie, false); lv_plugin_img_set_src(image_4g_scr_uiflowmovie, res[index]); } diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c index 13c52f09e..bc02098b3 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c @@ -546,12 +546,12 @@ static void update_4g_module_icon(void) const int NET_GENERATION_2G = 2; // const int NET_GENERATION_3G = 3; const int NET_GENERATION_4G = 4; - UIMenuStoreInfo *puiPara = sf_ui_para_get(); + //UIMenuStoreInfo *puiPara = sf_ui_para_get(); static short signal = SIGNAL_NOT_YET_GET; static short searching_index = -1; short signal_new = sf_cardv_get_cq_signal(); unsigned short signal_level = 0; - network_signal_level_get(puiPara->NetGeneration, signal_new, &signal_level); + network_signal_level_get(sf_get_net_generation(), signal_new, &signal_level); // printf("new signal = %d, old signal = %d\n", signal_new, signal); if(SIGNAL_NOT_YET_GET == signal_new) { @@ -561,7 +561,7 @@ static void update_4g_module_icon(void) // printf(" searching ... [%d]\n", searching_index); signal_icon_show(searching_index); } - else if(signal != signal_new && SIM_CARD_NOT_INIT != puiPara->NetGeneration) + else if(signal != signal_new && SIM_CARD_NOT_INIT != sf_get_net_generation()) { lv_obj_set_hidden(label_tips_scr_uiflowphoto, true); // Update the icon. @@ -613,16 +613,16 @@ const int EMPTY_IMAGE = 0; LV_PLUGIN_IMG_ID_SF_NET3G, LV_PLUGIN_IMG_ID_SF_NET4G }; -// printf("NetGeneration:%d\n", puiPara->NetGeneration); +// printf("NetGeneration:%d\n", sf_get_net_generation()); // puiPara->NetGeneration = NET_GENERATION_4G; // Test - if (SIM_CARD_NOT_INIT == puiPara->NetGeneration - || puiPara->NetGeneration < NET_GENERATION_2G - || puiPara->NetGeneration > NET_GENERATION_4G) + if (SIM_CARD_NOT_INIT == sf_get_net_generation() + || sf_get_net_generation() < NET_GENERATION_2G + || sf_get_net_generation() > NET_GENERATION_4G) { lv_obj_set_hidden(image_4g_scr_uiflowphoto, true); return; } - int index = puiPara->NetGeneration; + int index = sf_get_net_generation(); lv_obj_set_hidden(image_4g_scr_uiflowphoto, false); lv_plugin_img_set_src(image_4g_scr_uiflowphoto, res[index]); } 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 b52b28fa8..aedf04890 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 @@ -279,6 +279,8 @@ typedef enum SIM_ERR_CODE_s{ SIM_FAILED, }SIM_ERR_CODE; +UINT8 sf_get_net_generation(void); +void sf_set_net_generation(UINT8 value); SINT32 eg91_iccid_get(SF_CHAR *iccid,SF_FN_PARAM_S *pfnParam); SINT32 eg91_qsclk_set(SF_FN_PARAM_S *pfnParam); 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 ca796cc95..dbdd40aee 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 @@ -42,7 +42,7 @@ BOOL GprsNetWorkReady = FALSE; time_t sendStartTime; UINT8 gprs_search_process = GPRS_SEARCH_STEP_IDLE; extern SF_PARA_TIME_S rtcTime; -CHAR netGeneration = SF_NET_NO; +static CHAR netGeneration = SF_NET_NO; // SF_PARA_TIME_S nowDate = { 0, 0, 0, 0, 0, 0}; typedef struct sf_cimi_id @@ -54,6 +54,22 @@ typedef struct sf_cimi_id sf_cimi_id_t cimi_head = { .id = 1, .cimi = "0", .next = NULL }; +UINT8 sf_get_net_generation(void) +{ + return netGeneration; +} + +void sf_set_net_generation(UINT8 value) +{ + if((value >= SF_NET_NO) && (value <= SF_NET_4G)) + { + netGeneration = value; + } + else + { + printf("[%s:%d]value(%d) invalid,no set.\n", __FUNCTION__, __LINE__, value); + } +} UINT8 sf_qcsq_decode(char *instr, UINT8 *csqVal) { char *pStr = NULL; @@ -1784,28 +1800,28 @@ SINT32 eg91_register_net_auto(SF_FN_PARAM_S *pfnParam) SLOGI("%s", ttyData); if(strstr(ttyData, "No Service")) { - pStaticParam->NetGeneration = 2; + sf_set_net_generation(2); }else if (NULL != strtok(ttyData,"\"")){ SF_CHAR netStr[20] = { 0 }; strcpy(netStr, strtok(NULL,"\"")); MLOGD("netStr:%s\n", netStr); if((strstr(netStr,"DD") != NULL)) { - pStaticParam->NetGeneration = 4; + sf_set_net_generation(4); } else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \ || strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \ || strstr(netStr, "HSPA+") != NULL) { - pStaticParam->NetGeneration = 3; + sf_set_net_generation(3); } else { - pStaticParam->NetGeneration = 2; + sf_set_net_generation(2); } } - if(pStaticParam->NetGeneration == 4)//NetGeneration == 4 + if(sf_get_net_generation() == 4)//NetGeneration == 4 { enMmcLocation = SIM_REG_NET_QCSQ; sprintf(ttyData, "AT+QCSQ\r"); @@ -2080,24 +2096,24 @@ SINT32 eg91_register_net_manual(SF_FN_PARAM_S *pfnParam) SLOGI("%s", ttyData); if(strstr(ttyData, "No Service")) { - pStaticParam->NetGeneration = 2; + sf_set_net_generation(2); }else if (NULL != strtok(ttyData,"\"")){ SF_CHAR netStr[20] = { 0 }; strcpy(netStr, strtok(NULL,"\"")); MLOGD("netStr:%s\n", netStr); if((strstr(netStr,"DD") != NULL)) { - pStaticParam->NetGeneration = 4; + sf_set_net_generation(4); } else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \ || strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \ || strstr(netStr, "HSPA+") != NULL) { - pStaticParam->NetGeneration = 3; + sf_set_net_generation(3); } else { - pStaticParam->NetGeneration = 2; + sf_set_net_generation(2); } } @@ -2122,7 +2138,7 @@ SINT32 eg91_register_net_manual(SF_FN_PARAM_S *pfnParam) printf("cops2 is %s\r\n", pStaticParam->ServiceProvider); } - if(pStaticParam->NetGeneration == 4)//NetGeneration == 4 + if(sf_get_net_generation() == 4)//NetGeneration == 4 { enMmcLocation = SIM_REG_NET_QCSQ; sprintf(ttyData, "AT+QCSQ\r"); @@ -3766,8 +3782,7 @@ SINT32 sf_net_regist_manual(void) { if(strstr((const char *)gsmPara, "No Service")) { - //puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } else if(NULL != strtok((char *)(char *)gsmPara, "\"")) { @@ -3776,30 +3791,23 @@ SINT32 sf_net_regist_manual(void) if((strstr((const char *)netStr, "DD") != NULL)) { - //puiPara->NetGeneration = 4; - netGeneration = 4; + sf_set_net_generation(4); } else if(strstr((const char *)netStr, "CDMA") != NULL || strstr((const char *)netStr, "HDR") != NULL || strstr((const char *)netStr, "HSUPA") != NULL || strstr((const char *)netStr, "HSDPA") != NULL || (strstr((const char *)netStr, "HSPA+") != NULL)) { - //puiPara->NetGeneration = 3; - netGeneration = 3; + sf_set_net_generation(3); } else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL) { - //puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } else { - // puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } } - if(puiPara->NetGeneration != netGeneration) - { - puiPara->NetGeneration = netGeneration; - } + if(netGeneration == 4) { eNetRegLocation = QUECTEL_NETREG_QCSQ; @@ -4598,8 +4606,7 @@ SINT32 sf_auto_net_reg(void) { if(strstr((const char *)gsmPara, "No Service")) { - //puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } else if(NULL != strtok((char *)(char *)gsmPara, "\"")) { @@ -4608,30 +4615,23 @@ SINT32 sf_auto_net_reg(void) if((strstr((const char *)netStr, "DD") != NULL)) { - // puiPara->NetGeneration = 4; - netGeneration = 4; + sf_set_net_generation(4); } else if(strstr((const char *)netStr, "CDMA") != NULL || strstr((const char *)netStr, "HDR") != NULL || strstr((const char *)netStr, "HSUPA") != NULL || strstr((const char *)netStr, "HSDPA") != NULL || (strstr((const char *)netStr, "HSPA+") != NULL)) { - // puiPara->NetGeneration = 3; - netGeneration = 3; + sf_set_net_generation(3); } else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL) { - // puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } else { - // puiPara->NetGeneration = 2; - netGeneration = 2; + sf_set_net_generation(2); } } - if(puiPara->NetGeneration != netGeneration) - { - puiPara->NetGeneration = netGeneration; - } + if(netGeneration == 4) { eNetRegLocation = QUECTEL_NETREG_QCSQ; 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 db6d1c9fe..4c296a8b8 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 @@ -895,15 +895,15 @@ SINT32 sf_pic_send_ftp(void) //sendStartTime = sf_sys_os_utime_get()/1000; sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); snprintf(cameraID, sizeof(cameraID), "%s-%d-%d-%s-", pPara->ModuleImei, sf_app_get_battery(), csqlevel, CamNameStr); /* DCF 8.3 naming rule */ - if(4 == pPara->NetGeneration) + if(4 == sf_get_net_generation()) { tempPicSize = pPara->SendPicSize; } - else if(3 == pPara->NetGeneration) + else if(3 == sf_get_net_generation()) { tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0); } @@ -936,7 +936,7 @@ SINT32 sf_pic_send_ftp(void) // piccount = 1; // } // } - MLOGI("NetGeneration:%dG,tempPicSize=%d,piccount=%d,filecnt=%d\n", pPara->NetGeneration, tempPicSize, piccount, pThumbFileCfg->filecnt); + MLOGI("netGeneration:%dG,tempPicSize=%d,piccount=%d,filecnt=%d\n", sf_get_net_generation(), tempPicSize, piccount, pThumbFileCfg->filecnt); //printf("[%s:%d]piccount=%d\n", __FUNCTION__, __LINE__, piccount); @@ -1052,11 +1052,11 @@ SINT32 sf_video_send_ftp(void) MLOGD("start\n"); sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); snprintf(cameraID, sizeof(cameraID), "%s-%d-%d-%s-", pPara->ModuleImei, sf_app_get_battery(), csqlevel, CamNameStr); /* DCF 8.3 naming rule */ - printf("NetGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", pPara->NetGeneration, tempPicSize, piccount, pic); + printf("netGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", sf_get_net_generation(), tempPicSize, piccount, pic); /*sf_get_send_video_fname(videoDirKey, videoFname); sprintf((char *)ftpFileName, "%s%s", cameraID, videoFname); @@ -1238,7 +1238,7 @@ SINT32 sf_send_file_to_ftp(UINT8 mode) if(mode == 1 ) //send Original+video { - if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)) //video + if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (sf_get_net_generation() == 4)) //video { timeout = 120000; } @@ -1278,9 +1278,9 @@ SINT32 sf_send_file_to_ftp(UINT8 mode) } } - printf("[%s:%d]puiPara->NetGeneration=%d\n", __FUNCTION__, __LINE__, puiPara->NetGeneration); + printf("[%s:%d]netGeneration=%d\n", __FUNCTION__, __LINE__, sf_get_net_generation()); - if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)) //video + if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (sf_get_net_generation() == 4)) //video { if(smtpUploadVideoFlag == 0) { @@ -1319,7 +1319,7 @@ SINT32 sf_send_file_to_ftp(UINT8 mode) if(ret1 != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -1427,7 +1427,7 @@ SINT32 sf_connect_ftps_server(void) gprsMode = 0;//puiPara->GprsMode; printf("[%s:%d] ssl:%d,GprsMode:%d\n", __FUNCTION__, __LINE__, ssl, gprsMode); - if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)) //video + if(((puiPara->CamMode == SF_CAM_MODE_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO) || (puiPara->CamMode == SF_CAM_MODE_VIDEO2)) && (puiPara->SendVideoSwitch == 1) && (sf_get_net_generation() == 4)) //video { timeout = 60000; } @@ -1442,7 +1442,7 @@ SINT32 sf_connect_ftps_server(void) { FtpOpenOk = SUCCESS; } - ret = sf_ftp_stop(ssl, gprsMode); + //ret = sf_ftp_stop(ssl, gprsMode); //SF_FTP_CONNECT_END: //printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret); @@ -1561,7 +1561,7 @@ SINT32 sf_concentrated_ftp_send(void) // SINT64 sendStartTime = 0; SINT64 sendEndTime = 0; sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); // sendStartTime = sf_sys_os_utime_get()/1000; @@ -1676,7 +1676,7 @@ SF_CONCENTRATED_END: if(ret1 != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -1748,7 +1748,7 @@ SINT32 sf_hd_ftp_send(void) sf_set_send_hd(0); sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); // sendStartTime = sf_sys_os_utime_get()/1000; @@ -1858,7 +1858,7 @@ SF_HD_END: if(ret1 != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -1969,7 +1969,7 @@ SINT32 sf_video_ftp_send(void) sf_set_send_video(0); sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); // sendStartTime = sf_sys_os_utime_get()/1000; @@ -2084,7 +2084,7 @@ SF_VIDEO_END: if(ret1 != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -2176,7 +2176,7 @@ SINT32 sf_log_send_ftp(void) } if(ret != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -2295,7 +2295,7 @@ SINT32 sf_gps_send_ftp(void) } if(ret != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } #if SF_TEST_ERROR_CODE @@ -2985,11 +2985,11 @@ SINT32 sf_test_send_file_to_ftp(void) MLOGD("start\n"); sf_custom_str_get(CamNameStr); - sf_4G_signal_level_get(puiPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); snprintf(cameraID, sizeof(cameraID), "%s-%d-%d-%s-", puiPara->ModuleImei, sf_app_get_battery(), csqlevel, CamNameStr); /* DCF 8.3 naming rule */ - printf("NetGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", puiPara->NetGeneration, tempPicSize, piccount, pic); + printf("netGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", sf_get_net_generation(), tempPicSize, piccount, pic); sprintf((char *)ftpFileName, "%sMEMPHOTO.JPG", cameraID); sprintf((char *)filePath, "UFS:MEMPHOTO.JPG"); @@ -3082,7 +3082,7 @@ SINT32 sf_card_log_send_ftp(void) } if(ret != SF_FTP_ERROR_TERM) { - ret2 = sf_ftp_stop(ssl, gprsMode); + //ret2 = sf_ftp_stop(ssl, gprsMode); } MLOGD(" end ret:[0x%08X],ret2:[0x%08X]\n", ret, 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 134b8e691..712666c74 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 @@ -355,6 +355,7 @@ SINT32 sf_app_cq_signal_to_cardv(void) stMessageBuf.cmdId = CMD_GPRS; stMessageBuf.arg1 = SF_GPRS_CMD_SIGNAL; stMessageBuf.arg2 = sf_get_cq_signal(); + stMessageBuf.arg3 = ((SINT32)(((sf_get_sim_insert()) << 16) | (sf_get_net_generation()))); sf_com_message_send_to_cardv(&stMessageBuf); return SF_SUCCESS; } @@ -383,7 +384,6 @@ void sf_signal_led_show(UINT8 signalLevel) SINT32 app_led_net_reg_stop(SINT32 s32ret) { - UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); //UINT8 netSearchStep = sf_get_netsearch_step(); UINT8 signalLevel = 0; sf_app_cq_signal_to_cardv(); @@ -419,7 +419,7 @@ SINT32 app_led_net_reg_stop(SINT32 s32ret) sf_sys_status_led_set(SF_LED_SYS_STATE_SERVER_FAIL); } else { - sf_4G_signal_level_get(puiPara->NetGeneration,sf_get_cq_signal(),&signalLevel); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&signalLevel); MLOGI("signalLevel = %d\n",signalLevel); // sf_app_cq_signal_to_cardv(); sf_signal_led_show(signalLevel); 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 7492e3f82..85e1c2710 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 @@ -565,11 +565,11 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode) //sf_custom_str_get(customStr); - if(4 == pPara->NetGeneration) + if(4 == sf_get_net_generation()) { tempPicSize = pPara->SendPicSize; } - else if(3 == pPara->NetGeneration) + else if(3 == sf_get_net_generation()) { tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0); } @@ -601,7 +601,7 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode) } else if(mode == 1) { - printf("NetGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", pPara->NetGeneration, tempPicSize, piccount, pic); + printf("netGeneration:%dG,tempPicSize=%d,piccount=%d,pic=%d\n", sf_get_net_generation(), tempPicSize, piccount, pic); SendPicSize = tempPicSize; @@ -657,7 +657,7 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode) printf("[%s:%d]before,piccount=%d\n", __FUNCTION__, __LINE__, piccount); - if(4 == pPara->NetGeneration) + if(4 == sf_get_net_generation()) { if(piccount >= 2) { @@ -1008,8 +1008,8 @@ UINT32 sf_create_dailyreport_file(void) gpsStrTemp[0] = '\0'; }*/ - //csqlevel = sf_signal_level_get(pPara->NetGeneration, sf_get_cq_signal()); - sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + //csqlevel = sf_signal_level_get(sf_get_net_generation(), sf_get_cq_signal()); + sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); if(pPara->DateStyle == SF_DATE_TIME_YYMMDD) { sprintf(tmpDate, "%d/%02d/%02d %02d:%02d:%02d", drRtcTime.Year, drRtcTime.Mon, drRtcTime.Day, drRtcTime.Hour, drRtcTime.Min, drRtcTime.Sec); @@ -1036,7 +1036,7 @@ UINT32 sf_create_dailyreport_file(void) "Total Pics Sent:%ld\r\n", \ pPara->ModuleImei, \ csqlevel, \ - pPara->NetGeneration, \ + sf_get_net_generation(), \ cameraID, \ str, \ tmpDate, \ 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 76b4dc56d..38036be30 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 @@ -34,6 +34,7 @@ #include "sf_sms.h" #include "sf_system.h" #include "sf_message_queue.h" +#include "sf_eg91_sim.h" #ifdef __cplusplus #if __cplusplus extern "C" { @@ -912,7 +913,11 @@ unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val) sf_debug_save_log(); } #endif - sf_mcu_write_multi(mcuReg, mcuData, i); + if(FAIL == sf_mcu_write_multi(mcuReg, mcuData, i)) + { + sf_sleep_ms(200); + sf_mcu_write_multi(mcuReg, mcuData, i); + } return SUCCESS; } @@ -1267,9 +1272,7 @@ UINT32 sf_get_sim_insert(void) void sf_set_cq_signal(UINT8 csq) { - UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); - - if(((puiPara->NetGeneration == 4) && (csq > 0) && (csq < 129)) || ((puiPara->NetGeneration < 4) && (csq > 1) && (csq < 32))) + if(((sf_get_net_generation() == 4) && (csq > 0) && (csq < 129)) || ((sf_get_net_generation() < 4) && (csq > 1) && (csq < 32))) { cq_Signal = csq; isSignalReady = 1; diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index 62830bdeb..47409f9ca 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -192,4 +192,6 @@ void sf_set_rtsp_flag(UINT8 flag); char sf_get_cammode_statu(void); void sf_set_cammode_statu(char is); BOOL sf_set_backlight_status(unsigned char argc, char **argv); +UINT8 sf_get_net_generation(void); +void sf_set_net_generation(UINT8 value); #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 9e5f0a26c..453e6d5cb 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -101,6 +101,7 @@ static SF_BLE_STATUS_E BleStatus = SF_BLE_OK; static UINT8 McuUpdateFlag = 0; static SF_GPS_STATUS_E gGpsSearching = SF_GPS_SEARCHING_UNKNOW; static char CamMode = 0; +static CHAR netGeneration = SF_NET_NO; static SF_THREAD_S UpgradeTskParam = { .IsRun = 0, @@ -1794,6 +1795,8 @@ static SINT32 sf_cardv_proccess_cmd_gprs(SF_MESSAGE_BUF_S *pMessageBuf) { case SF_GPRS_CMD_SIGNAL: cq_Signal = pMessageBuf->arg2; + sf_set_net_generation(pMessageBuf->arg3 & 0xFF); + sf_cardv_set_sim_insert((pMessageBuf->arg3>>16)&0x0F); break; default: @@ -3395,3 +3398,20 @@ BOOL sf_set_backlight_status(unsigned char argc, char **argv) return TRUE; } + +UINT8 sf_get_net_generation(void) +{ + return netGeneration; +} + +void sf_set_net_generation(UINT8 value) +{ + if((value >= SF_NET_NO) && (value <= SF_NET_4G)) + { + netGeneration = value; + } + else + { + printf("[%s:%d]value(%d) invalid,no set.\n", __FUNCTION__, __LINE__, value); + } +} \ No newline at end of file diff --git a/code/lib/source/sifar/code/source/module/sf_sim.c b/code/lib/source/sifar/code/source/module/sf_sim.c index 7b234cd7a..e2cfc6801 100644 --- a/code/lib/source/sifar/code/source/module/sf_sim.c +++ b/code/lib/source/sifar/code/source/module/sf_sim.c @@ -138,7 +138,6 @@ SINT32 sf_module_init(VOID) UIMenuStoreInfo *pPara = sf_ui_para_get(); needRecordLogFlag = 1; - pPara->NetGeneration = SF_NET_NO; sf_4g_data_buff_clear(); sf_gsm_para_buff_clear();