1.优化代码,以免app崩溃
This commit is contained in:
parent
ff663b3226
commit
de6ac0bbc4
36
code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c
Normal file → Executable file
36
code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c
Normal file → Executable file
|
@ -2325,10 +2325,11 @@ SINT32 sf_module_complete_init(void)
|
|||
|
||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||
|
||||
SLOGD(" s");
|
||||
SLOGD(" s\n");
|
||||
|
||||
//needRecordLogFlag = 1;
|
||||
puiPara->NetGeneration = SF_NET_NO;
|
||||
sf_gsm_para_buff_clear();
|
||||
|
||||
while(sf_app_while_flag())
|
||||
{
|
||||
|
@ -2369,7 +2370,7 @@ SINT32 sf_module_complete_init(void)
|
|||
sf_test_code_err(eNetRegLocation, "test");
|
||||
#endif
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "AT+GSN")))
|
||||
{
|
||||
delim = " \r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "AT+GSN"), delim);
|
||||
|
@ -2382,8 +2383,10 @@ SINT32 sf_module_complete_init(void)
|
|||
mm++;
|
||||
pTemp = strtok((char *)0, delim);
|
||||
}
|
||||
strcpy((char *)strNow, (const char *)strtmp[1]);
|
||||
SLOGD("strNow=%s,strSave=%s", strNow, strSave);
|
||||
snprintf((char *)strNow, sizeof(strNow), "%s", (const char *)strtmp[1]);
|
||||
|
||||
//strcpy((char *)strNow, (const char *)strtmp[1]);
|
||||
SLOGD("strNow=%s,strSave=%s\n", strNow, strSave);
|
||||
|
||||
if((strNow[0] != '\0') && (strncmp((char *)strNow, (char *)strSave, MODULE_IMEI_LEN) == 0))
|
||||
{
|
||||
|
@ -2394,7 +2397,7 @@ SINT32 sf_module_complete_init(void)
|
|||
puiPara->DailyReportTime.Min = ((UINT16)(puiPara->ModuleImei[13]-48)*10+(puiPara->ModuleImei[14]-48))%60;
|
||||
|
||||
SLOGI(puiPara->ModuleImei);
|
||||
SF_DEBUG("ModuleImei=%s", puiPara->ModuleImei);
|
||||
SF_DEBUG("ModuleImei=%s\n", puiPara->ModuleImei);
|
||||
}
|
||||
|
||||
eNetRegLocation = QUECTEL_NETREG_ATI;
|
||||
|
@ -2431,7 +2434,7 @@ SINT32 sf_module_complete_init(void)
|
|||
|
||||
case QUECTEL_NETREG_ATI:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "Revision")))
|
||||
{
|
||||
delim = " \r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "Revision"), delim);
|
||||
|
@ -2446,7 +2449,7 @@ SINT32 sf_module_complete_init(void)
|
|||
}
|
||||
|
||||
strcpy((char *)puiPara->ModuleVer, (const char *)strtmp[1]);
|
||||
SF_DEBUG("ModuleVer=%s", puiPara->ModuleVer);
|
||||
SF_DEBUG("ModuleVer=%s\n", puiPara->ModuleVer);
|
||||
if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q)){
|
||||
at_manager_init(AT_MODULE_TYPE_EG915Q, sf_hal_ttyusb2_read, sf_hal_ttyusb2_write);
|
||||
}
|
||||
|
@ -2950,7 +2953,7 @@ SINT32 sf_module_complete_init(void)
|
|||
|
||||
case QUECTEL_NETREG_QCCID:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "+QCCID:")))
|
||||
{
|
||||
delim = " \r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "+QCCID:"), delim);
|
||||
|
@ -2964,7 +2967,7 @@ SINT32 sf_module_complete_init(void)
|
|||
pTemp = strtok((char *)0, delim);
|
||||
}
|
||||
strcpy((char *)strNow, (const char *)strtmp[1]);
|
||||
SLOGD("strNow=%s,strSave=%s", strNow, strSave);
|
||||
SLOGD("strNow=%s,strSave=%s\n", strNow, strSave);
|
||||
|
||||
if((strNow[0] != '\0') && (strncmp((char *)strNow, (char *)strSave, MODULE_ICCID_LEN) == 0))
|
||||
{
|
||||
|
@ -2972,7 +2975,7 @@ SINT32 sf_module_complete_init(void)
|
|||
{
|
||||
memset(puiPara->SimIccid, '\0', sizeof(puiPara->SimIccid));
|
||||
strncpy((char *)puiPara->SimIccid, (const char *)strNow, MODULE_ICCID_LEN);
|
||||
SF_DEBUG("SimIccid=%s", puiPara->SimIccid);
|
||||
SF_DEBUG("SimIccid=%s\n", puiPara->SimIccid);
|
||||
}
|
||||
|
||||
goto SF_MODULE_END;
|
||||
|
@ -3061,7 +3064,7 @@ SINT32 sf_net_regist_manual(void)
|
|||
|
||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||
|
||||
SF_LOG(" s");
|
||||
SF_LOG(" s\n");
|
||||
|
||||
#if MEGA_TEST
|
||||
|
||||
|
@ -3072,6 +3075,7 @@ SINT32 sf_net_regist_manual(void)
|
|||
|
||||
#endif
|
||||
|
||||
sf_gsm_para_buff_clear();
|
||||
|
||||
while(sf_app_while_flag())
|
||||
{
|
||||
|
@ -3404,7 +3408,7 @@ SINT32 sf_net_regist_manual(void)
|
|||
|
||||
case QUECTEL_NETREG_CIMI_2:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "AT+CIMI")))
|
||||
{
|
||||
delim = " \r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "AT+CIMI"), delim);
|
||||
|
@ -3623,7 +3627,7 @@ SINT32 sf_net_regist_manual(void)
|
|||
|
||||
case QUECTEL_NETREG_CSQ:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "+CSQ:")))
|
||||
{
|
||||
delim = " ,\r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "+CSQ:"), delim);
|
||||
|
@ -3794,7 +3798,7 @@ SINT32 sf_auto_net_reg(void)
|
|||
|
||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||
|
||||
SF_LOG(" s");
|
||||
SF_LOG(" s\n");
|
||||
|
||||
//needRecordLogFlag = 1;
|
||||
puiPara->NetGeneration = 0;
|
||||
|
@ -4035,7 +4039,7 @@ SINT32 sf_auto_net_reg(void)
|
|||
|
||||
case QUECTEL_NETREG_CIMI_2:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "AT+CIMI")))
|
||||
{
|
||||
delim = " \r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "AT+CIMI"), delim);
|
||||
|
@ -4215,7 +4219,7 @@ SINT32 sf_auto_net_reg(void)
|
|||
|
||||
case QUECTEL_NETREG_CSQ:
|
||||
|
||||
if(strstr((const char *)gsmPara, "OK"))
|
||||
if(strstr((const char *)gsmPara, "OK") && (strstr((const char *)gsmPara, "+CSQ:")))
|
||||
{
|
||||
delim = " ,\r\n";
|
||||
pTemp = strtok((char *)strstr((const char *)gsmPara, "+CSQ:"), delim);
|
||||
|
|
Loading…
Reference in New Issue
Block a user