1.信号改使用全局变量

This commit is contained in:
payton 2023-12-18 13:55:23 +08:00
parent 3ae9ca53e6
commit 041d8d89a3
11 changed files with 117 additions and 91 deletions

View File

@ -256,12 +256,12 @@ static void signal_icon_show(const short signal)
} }
static void update_4g_module_icon(void) 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 signal = SIGNAL_NOT_YET_GET;
static short searching_index = -1; static short searching_index = -1;
short signal_new = sf_cardv_get_cq_signal(); short signal_new = sf_cardv_get_cq_signal();
unsigned short signal_level = 0; 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); // printf("new signal = %d, old signal = %d\n", signal_new, signal);
if(SIGNAL_NOT_YET_GET == signal_new) 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_NET3G,
LV_PLUGIN_IMG_ID_SF_NET4G 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 SIM_CARD_NOT_INIT = 0;
const int NET_GENERATION_2G = 2; const int NET_GENERATION_2G = 2;
// const int NET_GENERATION_3G = 3; // const int NET_GENERATION_3G = 3;
const int NET_GENERATION_4G = 4; const int NET_GENERATION_4G = 4;
// puiPara->NetGeneration = NET_GENERATION_4G; // Test // puiPara->NetGeneration = NET_GENERATION_4G; // Test
if (SIM_CARD_NOT_INIT == puiPara->NetGeneration if (SIM_CARD_NOT_INIT == sf_get_net_generation()
|| puiPara->NetGeneration < NET_GENERATION_2G || sf_get_net_generation() < NET_GENERATION_2G
|| puiPara->NetGeneration > NET_GENERATION_4G) || sf_get_net_generation() > NET_GENERATION_4G)
{ {
lv_obj_set_hidden(image_4g_scr_uiflowmovie, true); lv_obj_set_hidden(image_4g_scr_uiflowmovie, true);
return; return;
} }
int index = puiPara->NetGeneration; int index = sf_get_net_generation();
lv_obj_set_hidden(image_4g_scr_uiflowmovie, false); lv_obj_set_hidden(image_4g_scr_uiflowmovie, false);
lv_plugin_img_set_src(image_4g_scr_uiflowmovie, res[index]); lv_plugin_img_set_src(image_4g_scr_uiflowmovie, res[index]);
} }

View File

@ -546,12 +546,12 @@ static void update_4g_module_icon(void)
const int NET_GENERATION_2G = 2; const int NET_GENERATION_2G = 2;
// const int NET_GENERATION_3G = 3; // const int NET_GENERATION_3G = 3;
const int NET_GENERATION_4G = 4; 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 signal = SIGNAL_NOT_YET_GET;
static short searching_index = -1; static short searching_index = -1;
short signal_new = sf_cardv_get_cq_signal(); short signal_new = sf_cardv_get_cq_signal();
unsigned short signal_level = 0; 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); // printf("new signal = %d, old signal = %d\n", signal_new, signal);
if(SIGNAL_NOT_YET_GET == signal_new) if(SIGNAL_NOT_YET_GET == signal_new)
{ {
@ -561,7 +561,7 @@ static void update_4g_module_icon(void)
// printf(" searching ... [%d]\n", searching_index); // printf(" searching ... [%d]\n", searching_index);
signal_icon_show(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); lv_obj_set_hidden(label_tips_scr_uiflowphoto, true);
// Update the icon. // Update the icon.
@ -613,16 +613,16 @@ const int EMPTY_IMAGE = 0;
LV_PLUGIN_IMG_ID_SF_NET3G, LV_PLUGIN_IMG_ID_SF_NET3G,
LV_PLUGIN_IMG_ID_SF_NET4G 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 // puiPara->NetGeneration = NET_GENERATION_4G; // Test
if (SIM_CARD_NOT_INIT == puiPara->NetGeneration if (SIM_CARD_NOT_INIT == sf_get_net_generation()
|| puiPara->NetGeneration < NET_GENERATION_2G || sf_get_net_generation() < NET_GENERATION_2G
|| puiPara->NetGeneration > NET_GENERATION_4G) || sf_get_net_generation() > NET_GENERATION_4G)
{ {
lv_obj_set_hidden(image_4g_scr_uiflowphoto, true); lv_obj_set_hidden(image_4g_scr_uiflowphoto, true);
return; return;
} }
int index = puiPara->NetGeneration; int index = sf_get_net_generation();
lv_obj_set_hidden(image_4g_scr_uiflowphoto, false); lv_obj_set_hidden(image_4g_scr_uiflowphoto, false);
lv_plugin_img_set_src(image_4g_scr_uiflowphoto, res[index]); lv_plugin_img_set_src(image_4g_scr_uiflowphoto, res[index]);
} }

View File

@ -279,6 +279,8 @@ typedef enum SIM_ERR_CODE_s{
SIM_FAILED, SIM_FAILED,
}SIM_ERR_CODE; }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_iccid_get(SF_CHAR *iccid,SF_FN_PARAM_S *pfnParam);
SINT32 eg91_qsclk_set(SF_FN_PARAM_S *pfnParam); SINT32 eg91_qsclk_set(SF_FN_PARAM_S *pfnParam);

View File

@ -42,7 +42,7 @@ BOOL GprsNetWorkReady = FALSE;
time_t sendStartTime; time_t sendStartTime;
UINT8 gprs_search_process = GPRS_SEARCH_STEP_IDLE; UINT8 gprs_search_process = GPRS_SEARCH_STEP_IDLE;
extern SF_PARA_TIME_S rtcTime; 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}; // SF_PARA_TIME_S nowDate = { 0, 0, 0, 0, 0, 0};
typedef struct sf_cimi_id 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 }; 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) UINT8 sf_qcsq_decode(char *instr, UINT8 *csqVal)
{ {
char *pStr = NULL; char *pStr = NULL;
@ -1784,28 +1800,28 @@ SINT32 eg91_register_net_auto(SF_FN_PARAM_S *pfnParam)
SLOGI("%s", ttyData); SLOGI("%s", ttyData);
if(strstr(ttyData, "No Service")) if(strstr(ttyData, "No Service"))
{ {
pStaticParam->NetGeneration = 2; sf_set_net_generation(2);
}else if (NULL != strtok(ttyData,"\"")){ }else if (NULL != strtok(ttyData,"\"")){
SF_CHAR netStr[20] = { 0 }; SF_CHAR netStr[20] = { 0 };
strcpy(netStr, strtok(NULL,"\"")); strcpy(netStr, strtok(NULL,"\""));
MLOGD("netStr:%s\n", netStr); MLOGD("netStr:%s\n", netStr);
if((strstr(netStr,"DD") != NULL)) if((strstr(netStr,"DD") != NULL))
{ {
pStaticParam->NetGeneration = 4; sf_set_net_generation(4);
} }
else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \ else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \
|| strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \ || strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \
|| strstr(netStr, "HSPA+") != NULL) || strstr(netStr, "HSPA+") != NULL)
{ {
pStaticParam->NetGeneration = 3; sf_set_net_generation(3);
} }
else 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; enMmcLocation = SIM_REG_NET_QCSQ;
sprintf(ttyData, "AT+QCSQ\r"); sprintf(ttyData, "AT+QCSQ\r");
@ -2080,24 +2096,24 @@ SINT32 eg91_register_net_manual(SF_FN_PARAM_S *pfnParam)
SLOGI("%s", ttyData); SLOGI("%s", ttyData);
if(strstr(ttyData, "No Service")) if(strstr(ttyData, "No Service"))
{ {
pStaticParam->NetGeneration = 2; sf_set_net_generation(2);
}else if (NULL != strtok(ttyData,"\"")){ }else if (NULL != strtok(ttyData,"\"")){
SF_CHAR netStr[20] = { 0 }; SF_CHAR netStr[20] = { 0 };
strcpy(netStr, strtok(NULL,"\"")); strcpy(netStr, strtok(NULL,"\""));
MLOGD("netStr:%s\n", netStr); MLOGD("netStr:%s\n", netStr);
if((strstr(netStr,"DD") != NULL)) if((strstr(netStr,"DD") != NULL))
{ {
pStaticParam->NetGeneration = 4; sf_set_net_generation(4);
} }
else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \ else if(strstr(netStr, "CDMA") != NULL || strstr(netStr, "HDR") != NULL \
|| strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \ || strstr(netStr, "HSUPA") != NULL || strstr(netStr, "HSDPA") != NULL \
|| strstr(netStr, "HSPA+") != NULL) || strstr(netStr, "HSPA+") != NULL)
{ {
pStaticParam->NetGeneration = 3; sf_set_net_generation(3);
} }
else 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); 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; enMmcLocation = SIM_REG_NET_QCSQ;
sprintf(ttyData, "AT+QCSQ\r"); sprintf(ttyData, "AT+QCSQ\r");
@ -3766,8 +3782,7 @@ SINT32 sf_net_regist_manual(void)
{ {
if(strstr((const char *)gsmPara, "No Service")) if(strstr((const char *)gsmPara, "No Service"))
{ {
//puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
else if(NULL != strtok((char *)(char *)gsmPara, "\"")) else if(NULL != strtok((char *)(char *)gsmPara, "\""))
{ {
@ -3776,30 +3791,23 @@ SINT32 sf_net_regist_manual(void)
if((strstr((const char *)netStr, "DD") != NULL)) if((strstr((const char *)netStr, "DD") != NULL))
{ {
//puiPara->NetGeneration = 4; sf_set_net_generation(4);
netGeneration = 4;
} }
else if(strstr((const char *)netStr, "CDMA") != NULL || strstr((const char *)netStr, "HDR") != NULL || strstr((const char *)netStr, "HSUPA") != NULL 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)) || strstr((const char *)netStr, "HSDPA") != NULL || (strstr((const char *)netStr, "HSPA+") != NULL))
{ {
//puiPara->NetGeneration = 3; sf_set_net_generation(3);
netGeneration = 3;
} }
else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL) else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL)
{ {
//puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
else else
{ {
// puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
} }
if(puiPara->NetGeneration != netGeneration)
{
puiPara->NetGeneration = netGeneration;
}
if(netGeneration == 4) if(netGeneration == 4)
{ {
eNetRegLocation = QUECTEL_NETREG_QCSQ; eNetRegLocation = QUECTEL_NETREG_QCSQ;
@ -4598,8 +4606,7 @@ SINT32 sf_auto_net_reg(void)
{ {
if(strstr((const char *)gsmPara, "No Service")) if(strstr((const char *)gsmPara, "No Service"))
{ {
//puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
else if(NULL != strtok((char *)(char *)gsmPara, "\"")) else if(NULL != strtok((char *)(char *)gsmPara, "\""))
{ {
@ -4608,30 +4615,23 @@ SINT32 sf_auto_net_reg(void)
if((strstr((const char *)netStr, "DD") != NULL)) if((strstr((const char *)netStr, "DD") != NULL))
{ {
// puiPara->NetGeneration = 4; sf_set_net_generation(4);
netGeneration = 4;
} }
else if(strstr((const char *)netStr, "CDMA") != NULL || strstr((const char *)netStr, "HDR") != NULL || strstr((const char *)netStr, "HSUPA") != NULL 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)) || strstr((const char *)netStr, "HSDPA") != NULL || (strstr((const char *)netStr, "HSPA+") != NULL))
{ {
// puiPara->NetGeneration = 3; sf_set_net_generation(3);
netGeneration = 3;
} }
else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL) else if(strstr((const char *)netStr, "CMDA") != NULL || strstr((const char *)netStr, "G") != NULL)
{ {
// puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
else else
{ {
// puiPara->NetGeneration = 2; sf_set_net_generation(2);
netGeneration = 2;
} }
} }
if(puiPara->NetGeneration != netGeneration)
{
puiPara->NetGeneration = netGeneration;
}
if(netGeneration == 4) if(netGeneration == 4)
{ {
eNetRegLocation = QUECTEL_NETREG_QCSQ; eNetRegLocation = QUECTEL_NETREG_QCSQ;

View File

@ -895,15 +895,15 @@ SINT32 sf_pic_send_ftp(void)
//sendStartTime = sf_sys_os_utime_get()/1000; //sendStartTime = sf_sys_os_utime_get()/1000;
sf_custom_str_get(CamNameStr); 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 */ 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; tempPicSize = pPara->SendPicSize;
} }
else if(3 == pPara->NetGeneration) else if(3 == sf_get_net_generation())
{ {
tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0); tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0);
} }
@ -936,7 +936,7 @@ SINT32 sf_pic_send_ftp(void)
// piccount = 1; // 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); //printf("[%s:%d]piccount=%d\n", __FUNCTION__, __LINE__, piccount);
@ -1052,11 +1052,11 @@ SINT32 sf_video_send_ftp(void)
MLOGD("start\n"); MLOGD("start\n");
sf_custom_str_get(CamNameStr); 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 */ 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); /*sf_get_send_video_fname(videoDirKey, videoFname);
sprintf((char *)ftpFileName, "%s%s", cameraID, 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(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; 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) if(smtpUploadVideoFlag == 0)
{ {
@ -1319,7 +1319,7 @@ SINT32 sf_send_file_to_ftp(UINT8 mode)
if(ret1 != SF_FTP_ERROR_TERM) if(ret1 != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -1427,7 +1427,7 @@ SINT32 sf_connect_ftps_server(void)
gprsMode = 0;//puiPara->GprsMode; gprsMode = 0;//puiPara->GprsMode;
printf("[%s:%d] ssl:%d,GprsMode:%d\n", __FUNCTION__, __LINE__, ssl, 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; timeout = 60000;
} }
@ -1442,7 +1442,7 @@ SINT32 sf_connect_ftps_server(void)
{ {
FtpOpenOk = SUCCESS; FtpOpenOk = SUCCESS;
} }
ret = sf_ftp_stop(ssl, gprsMode); //ret = sf_ftp_stop(ssl, gprsMode);
//SF_FTP_CONNECT_END: //SF_FTP_CONNECT_END:
//printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret); //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 sendStartTime = 0;
SINT64 sendEndTime = 0; SINT64 sendEndTime = 0;
sf_custom_str_get(CamNameStr); 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; // sendStartTime = sf_sys_os_utime_get()/1000;
@ -1676,7 +1676,7 @@ SF_CONCENTRATED_END:
if(ret1 != SF_FTP_ERROR_TERM) if(ret1 != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -1748,7 +1748,7 @@ SINT32 sf_hd_ftp_send(void)
sf_set_send_hd(0); sf_set_send_hd(0);
sf_custom_str_get(CamNameStr); 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; // sendStartTime = sf_sys_os_utime_get()/1000;
@ -1858,7 +1858,7 @@ SF_HD_END:
if(ret1 != SF_FTP_ERROR_TERM) if(ret1 != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -1969,7 +1969,7 @@ SINT32 sf_video_ftp_send(void)
sf_set_send_video(0); sf_set_send_video(0);
sf_custom_str_get(CamNameStr); 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; // sendStartTime = sf_sys_os_utime_get()/1000;
@ -2084,7 +2084,7 @@ SF_VIDEO_END:
if(ret1 != SF_FTP_ERROR_TERM) if(ret1 != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -2176,7 +2176,7 @@ SINT32 sf_log_send_ftp(void)
} }
if(ret != SF_FTP_ERROR_TERM) if(ret != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -2295,7 +2295,7 @@ SINT32 sf_gps_send_ftp(void)
} }
if(ret != SF_FTP_ERROR_TERM) if(ret != SF_FTP_ERROR_TERM)
{ {
ret2 = sf_ftp_stop(ssl, gprsMode); //ret2 = sf_ftp_stop(ssl, gprsMode);
} }
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
@ -2985,11 +2985,11 @@ SINT32 sf_test_send_file_to_ftp(void)
MLOGD("start\n"); MLOGD("start\n");
sf_custom_str_get(CamNameStr); 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 */ 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 *)ftpFileName, "%sMEMPHOTO.JPG", cameraID);
sprintf((char *)filePath, "UFS:MEMPHOTO.JPG"); sprintf((char *)filePath, "UFS:MEMPHOTO.JPG");
@ -3082,7 +3082,7 @@ SINT32 sf_card_log_send_ftp(void)
} }
if(ret != SF_FTP_ERROR_TERM) 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); MLOGD(" end ret:[0x%08X],ret2:[0x%08X]\n", ret, ret2);

View File

@ -355,6 +355,7 @@ SINT32 sf_app_cq_signal_to_cardv(void)
stMessageBuf.cmdId = CMD_GPRS; stMessageBuf.cmdId = CMD_GPRS;
stMessageBuf.arg1 = SF_GPRS_CMD_SIGNAL; stMessageBuf.arg1 = SF_GPRS_CMD_SIGNAL;
stMessageBuf.arg2 = sf_get_cq_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); sf_com_message_send_to_cardv(&stMessageBuf);
return SF_SUCCESS; return SF_SUCCESS;
} }
@ -383,7 +384,6 @@ void sf_signal_led_show(UINT8 signalLevel)
SINT32 app_led_net_reg_stop(SINT32 s32ret) SINT32 app_led_net_reg_stop(SINT32 s32ret)
{ {
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
//UINT8 netSearchStep = sf_get_netsearch_step(); //UINT8 netSearchStep = sf_get_netsearch_step();
UINT8 signalLevel = 0; UINT8 signalLevel = 0;
sf_app_cq_signal_to_cardv(); 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); sf_sys_status_led_set(SF_LED_SYS_STATE_SERVER_FAIL);
} }
else { 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); MLOGI("signalLevel = %d\n",signalLevel);
// sf_app_cq_signal_to_cardv(); // sf_app_cq_signal_to_cardv();
sf_signal_led_show(signalLevel); sf_signal_led_show(signalLevel);

View File

@ -565,11 +565,11 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode)
//sf_custom_str_get(customStr); //sf_custom_str_get(customStr);
if(4 == pPara->NetGeneration) if(4 == sf_get_net_generation())
{ {
tempPicSize = pPara->SendPicSize; tempPicSize = pPara->SendPicSize;
} }
else if(3 == pPara->NetGeneration) else if(3 == sf_get_net_generation())
{ {
tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0); tempPicSize = ((1 <= pPara->SendPicSize) ? 1 : 0);
} }
@ -601,7 +601,7 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode)
} }
else if(mode == 1) 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; 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); printf("[%s:%d]before,piccount=%d\n", __FUNCTION__, __LINE__, piccount);
if(4 == pPara->NetGeneration) if(4 == sf_get_net_generation())
{ {
if(piccount >= 2) if(piccount >= 2)
{ {
@ -1008,8 +1008,8 @@ UINT32 sf_create_dailyreport_file(void)
gpsStrTemp[0] = '\0'; gpsStrTemp[0] = '\0';
}*/ }*/
//csqlevel = sf_signal_level_get(pPara->NetGeneration, sf_get_cq_signal()); //csqlevel = sf_signal_level_get(sf_get_net_generation(), sf_get_cq_signal());
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);
if(pPara->DateStyle == SF_DATE_TIME_YYMMDD) 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); 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", \ "Total Pics Sent:%ld\r\n", \
pPara->ModuleImei, \ pPara->ModuleImei, \
csqlevel, \ csqlevel, \
pPara->NetGeneration, \ sf_get_net_generation(), \
cameraID, \ cameraID, \
str, \ str, \
tmpDate, \ tmpDate, \

View File

@ -34,6 +34,7 @@
#include "sf_sms.h" #include "sf_sms.h"
#include "sf_system.h" #include "sf_system.h"
#include "sf_message_queue.h" #include "sf_message_queue.h"
#include "sf_eg91_sim.h"
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
extern "C" { extern "C" {
@ -912,7 +913,11 @@ unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val)
sf_debug_save_log(); sf_debug_save_log();
} }
#endif #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; return SUCCESS;
} }
@ -1267,9 +1272,7 @@ UINT32 sf_get_sim_insert(void)
void sf_set_cq_signal(UINT8 csq) void sf_set_cq_signal(UINT8 csq)
{ {
UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); if(((sf_get_net_generation() == 4) && (csq > 0) && (csq < 129)) || ((sf_get_net_generation() < 4) && (csq > 1) && (csq < 32)))
if(((puiPara->NetGeneration == 4) && (csq > 0) && (csq < 129)) || ((puiPara->NetGeneration < 4) && (csq > 1) && (csq < 32)))
{ {
cq_Signal = csq; cq_Signal = csq;
isSignalReady = 1; isSignalReady = 1;

View File

@ -192,4 +192,6 @@ void sf_set_rtsp_flag(UINT8 flag);
char sf_get_cammode_statu(void); char sf_get_cammode_statu(void);
void sf_set_cammode_statu(char is); void sf_set_cammode_statu(char is);
BOOL sf_set_backlight_status(unsigned char argc, char **argv); BOOL sf_set_backlight_status(unsigned char argc, char **argv);
UINT8 sf_get_net_generation(void);
void sf_set_net_generation(UINT8 value);
#endif #endif

View File

@ -101,6 +101,7 @@ static SF_BLE_STATUS_E BleStatus = SF_BLE_OK;
static UINT8 McuUpdateFlag = 0; static UINT8 McuUpdateFlag = 0;
static SF_GPS_STATUS_E gGpsSearching = SF_GPS_SEARCHING_UNKNOW; static SF_GPS_STATUS_E gGpsSearching = SF_GPS_SEARCHING_UNKNOW;
static char CamMode = 0; static char CamMode = 0;
static CHAR netGeneration = SF_NET_NO;
static SF_THREAD_S UpgradeTskParam = static SF_THREAD_S UpgradeTskParam =
{ {
.IsRun = 0, .IsRun = 0,
@ -1794,6 +1795,8 @@ static SINT32 sf_cardv_proccess_cmd_gprs(SF_MESSAGE_BUF_S *pMessageBuf)
{ {
case SF_GPRS_CMD_SIGNAL: case SF_GPRS_CMD_SIGNAL:
cq_Signal = pMessageBuf->arg2; cq_Signal = pMessageBuf->arg2;
sf_set_net_generation(pMessageBuf->arg3 & 0xFF);
sf_cardv_set_sim_insert((pMessageBuf->arg3>>16)&0x0F);
break; break;
default: default:
@ -3395,3 +3398,20 @@ BOOL sf_set_backlight_status(unsigned char argc, char **argv)
return TRUE; 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);
}
}

View File

@ -138,7 +138,6 @@ SINT32 sf_module_init(VOID)
UIMenuStoreInfo *pPara = sf_ui_para_get(); UIMenuStoreInfo *pPara = sf_ui_para_get();
needRecordLogFlag = 1; needRecordLogFlag = 1;
pPara->NetGeneration = SF_NET_NO;
sf_4g_data_buff_clear(); sf_4g_data_buff_clear();
sf_gsm_para_buff_clear(); sf_gsm_para_buff_clear();