#include "includes.h" SUT_MESS sutMess; //GPS_DEF gpsInfo; const unsigned short GPS_TimeTable[GPS_TABLE_NUM]={5,10,15,30,60,120,300}; void gpsDataInit(void){ //memset((unsigned char *)&sutMess, 0, sizeof(SUT_MESS)); memset((unsigned char *)&sutGpsInfo, 0, sizeof(SUT_GPS_INF)); GPSInit(); GpsTimeUpdate(); } unsigned short getGPSTimeValue(unsigned char index){ return GPS_TimeTable[index]; } unsigned char gpsCheckCnt=1;//默认开机查询一? void gpsCheckInfo(void){//查询GPS信息 gpsCheckCnt++; } /*控制查询GPS状? dly:接口被调用的频率,单位ms*/ /* AT+POC=11000032322e32333231312c3130332e3132333132312c352c32302c362e302c0425242 52600 32322e32333231312c3130332e3132333132312c352c32302c362e302c042524252600 ʾ γ 22.23211 103.123121 ٶ 5km/h 20 ȣΪ 6.0 4 ǣ ȷֱΪ 37db 36db 37db 38db */ void gpsProCtl(int dly){ static unsigned short cnt=0; unsigned char GpsDatabuf[100]; unsigned char restohex[20]; unsigned char destohex[40]; if(newPara.gpsEnable==0)return; if(sutApp.gtMode!=0) return; if(++cnt<(GPS_TimeTable[newPara.gpsTimeIndex]*1000/dly) && gpsCheckCnt==0) return; cnt=0; if(sutGpsInfo.g_GpsEnable)msgAtSend("AT+GPSRD=\"ALL\"\r\n"); //gpsCheckCnt=0; if(sutGpsInfo.isGpsValid){ snprintf(restohex,sizeof(restohex),"%d.%06d,%d.%06d",sutGpsInfo.latitue/1000000,sutGpsInfo.latitue%1000000,sutGpsInfo.longitue/1000000,sutGpsInfo.longitue%1000000); AscStrTurnHexStr(restohex,destohex); snprintf(GpsDatabuf,sizeof(GpsDatabuf),"AT+POC=110000%s2c352c32302c362e302c042524252600\r\n",destohex); msgAtSend(GpsDatabuf); } } /* +CGPS:bf,ba,gf,[Lat],[Long] bf:0 部标关闭 1 部标打开 ba:0 部标未鉴?1 部标已鉴? gf:0 GPS关闭 1 GPS打开 Lat: 已定位才有,定位纬度 ??已放?000000) Long: 已定位才有,定位经度 ??已放?000000) 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