1.修改gps;2.去掉多余的头文件

This commit is contained in:
payton 2023-12-28 10:41:06 +08:00
parent 23f4de153d
commit 5737d78b10
4 changed files with 121 additions and 4 deletions

View File

@ -62,6 +62,8 @@ SINT32 eg91_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 au
SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day); SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day);
UINT32 sf_gps_close(void);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -17,12 +17,15 @@
#include "sf_eg91_sim.h" #include "sf_eg91_sim.h"
#include "sf_param_common.h" #include "sf_param_common.h"
#include "sf_module.h" #include "sf_module.h"
#include "sf_commu_mcu_reg.h"
#include "sf_common.h"
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
extern "C" { extern "C" {
#endif #endif
#endif #endif
extern char logStr[128];
extern char gsmPara[GPRS_INFO_LINE_MAX];
static unsigned long int gps_get_seconds(SF_PARA_TIME_S *pTime) static unsigned long int gps_get_seconds(SF_PARA_TIME_S *pTime)
{ {
@ -1011,7 +1014,119 @@ SINT32 eg91_gps_search_result(SF_FN_PARAM_S *pfnParam)
} }
return ret; return ret;
} }
/*************************************************
Function: sf_gps_close
Description: gps close
Input: N/A
Output: N/A
Return: N/A
Others: N/A
*************************************************/
UINT32 sf_gps_close(void)
{
SINT32 ret = 0; //0:start; 1:success; 2:timeout; 3:fail;
UINT8 time = 0;
UINT8 calltime = 0;
SIM_SEARCH_GPS_e eSmsLocation = SIM_SEARCH_GPS_END;
int ttyRet = 0;
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
SF_TTY_DATA_TYPE_S ttyData = { .waitMs = 1000, .len = 3, .lenMax = (GPRS_INFO_LINE_MAX-1), .cmp = "OK", .cmperr = "ERROR", .data = gsmPara};
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
sf_gsm_para_buff_clear();
while(sf_app_while_flag())
{
switch(eSmsLocation)
{
case SIM_SEARCH_GPS_END:
if(strstr((const char *)gsmPara, "OK"))
{
if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q))
{
strcpy((char *)gsmPara, "AT+QGPSXTRA=0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_SIM_ERROR_AT_TIMEOUT);
eSmsLocation = SIM_SEARCH_GPS_EXIT;
}
else {
goto SF_GPS_RETURN;
}
}
else
{
if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q))
{
strcpy((char *)gsmPara, "AT+QGPS=0\r");
}
else {
strcpy((char *)gsmPara, "AT+QGPSEND\r");
}
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_SIM_ERROR_AT_TIMEOUT);
if(!puiPara->GprsMode)
{
sf_sleep_ms(800);
}
}
break;
case SIM_SEARCH_GPS_EXIT:
if(strstr((const char *)gsmPara, "OK"))
{
goto SF_GPS_RETURN;
}
else if(strstr((const char *)gsmPara, "ERROR"))
{
strcpy((char *)gsmPara, "AT+QGPSXTRA=0\r");
ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara));
SF_CHECK_RETURN(ttyRet, SF_SIM_ERROR_AT_TIMEOUT);
}
else
{
calltime++;
if(calltime > 20)
{
ret = SF_SIM_ERROR_AT_TIMEOUT;
sprintf((char *)logStr, "[%s:%d]ErrorCode=0x%08x,AT+QGPSXTRA Timeout.", __FUNCTION__, __LINE__, ret);
SLOGE(logStr);
goto SF_GPS_RETURN;
}
}
break;
default:
break;
}
sf_gsm_para_buff_clear();
sf_hal_ttyusb2_read_buf(&ttyData);
printf("-----eSmsLocation:%d-----time:%d-----\n", eSmsLocation, time);
if(gsmPara[0] != '\0')
{
printf("[%s:%d]gsmPara===>%s<================end\n", __FUNCTION__, __LINE__, gsmPara);
}
time++;
if(time >= 100)
{
ret = SF_SIM_ERROR_AT_TIMEOUT;
sprintf((char *)logStr, "ReadMsg Wait Init Timeout.\n[ERROR]eSmsLocation=%d", eSmsLocation);
SLOGE(logStr);
time = 0;
goto SF_GPS_RETURN;
}
}
SF_GPS_RETURN:
printf("[%s:%d] ret:%d\n", __FUNCTION__, __LINE__, ret);
return ret;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus

View File

@ -19,7 +19,6 @@ extern "C" {
#include "sf_eg91_sim.h" #include "sf_eg91_sim.h"
#include "sf_param_common.h" #include "sf_param_common.h"
#include "sf_common.h" #include "sf_common.h"
#include "sf_commu_mcu_reg.h"
#include "sf_datahttp.h" #include "sf_datahttp.h"
#include "sf_service.h" #include "sf_service.h"
#include "sf_ftp.h" #include "sf_ftp.h"

View File

@ -58,7 +58,7 @@
#include "at_manager.h" #include "at_manager.h"
#include "Log.h" #include "Log.h"
#include "sf_4g_lpa.h" #include "sf_4g_lpa.h"
#include "sf_eg91_gps.h"
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
extern "C" { extern "C" {
@ -1880,7 +1880,8 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
.period_ms = KEEP_SERACHING_PERIOD_MS, .period_ms = KEEP_SERACHING_PERIOD_MS,
}; };
keep_get_gps_location(gps_param); keep_get_gps_location(gps_param);
gps_close(); //gps_close();
sf_gps_close();
} }
s32ret = sf_read_message(); s32ret = sf_read_message();