#include "includes.h" SUT_MESS sutMess; GPS_DEF gpsInfo; const unsigned short GPS_TimeTable[GPS_TABLE_NUM]={0,5,10,15,30,60,120,300}; void gpsDataInit(void){ memset((unsigned char *)&sutMess, 0, sizeof(SUT_MESS)); memset((unsigned char *)&gpsInfo, 0, sizeof(GPS_DEF)); } unsigned short getGPSTimeValue(unsigned char index){ return GPS_TimeTable[index]; } static unsigned char gpsCheckCnt=1;//默认开机查询一次 void gpsCheckInfo(void){//查询GPS信息 gpsCheckCnt++; } /*控制查询GPS状态 dly:接口被调用的频率,单位ms*/ void gpsProCtl(int dly){ static unsigned short cnt=0; if(sutApp.gtMode!=0) return;//GT模式后不再查询 if(getAppObjStatus(ASLEEP_POC)==0) return;//POC休眠时,不发指令 if(++cnt<(5*1000/dly) && gpsCheckCnt==0) return; cnt=0; //以下5秒操作一次 msgAtSend("AT+CGPS\r\n"); gpsCheckCnt=0; } /* +CGPS:bf,ba,gf,[Lat],[Long] bf:0 部标关闭 1 部标打开 ba:0 部标未鉴权 1 部标已鉴权 gf:0 GPS关闭 1 GPS打开 Lat: 已定位才有,定位纬度 度.度(已放大1000000) Long: 已定位才有,定位经度 度.度(已放大1000000) msg=bf,ba,gf,[Lat],[Long] */ void proGpsMsg(char *msg){ int i; unsigned char needCloseGps=0; unsigned char needOpenGps=0; unsigned char dotNum=0,lach=0; unsigned char bblF=0,bbAuth=0,gpsF=0; unsigned int Lat=0,Long=0; //获取部标开关状态 bblF=atoi(msg); for(i=0;i