#include "includes.h" SUT_XINBIAO_PAGE sut_xinbiaopage[XINBIAO_NUM]; SUT_XINBIAO_PAGE New_xinbiaopage; SUT_XINBIAO_INFO sut_xinbiao_info; USERARR UserArr[MAX_USER]; //临时存储当前所有成员 //每次 86 都需要更新 LEADER leader[XINBIAO_NUM]; //根据 UserArr 每次更新 进表格 存入文件系统 /* 获得新的信标页 callID //是, 更新页 //否,创建新页 */ //+POC=8C00%08x%02x;%d;%d;%d;%d;%d;\r\n" //+POC:8C00 934C0008 00 3B void Recv_PackNewxinbiaopage(char*msg) { char i,j; char start=0; char *Pmsg=0; char data[500]; msg[17]=0; New_xinbiaopage.xb_CallID=htoi(msg+9); //find user name for(i=0;ixb_CallID==sut_xinbiaopage[i].xb_CallID){ memcpy(&sut_xinbiaopage[i],NewXinbiao,sizeof(SUT_XINBIAO_PAGE)); return; } } //否,创建新页 NewXinbiao->xb_id=sut_xinbiao_info.Max_id; memcpy(&sut_xinbiaopage[i+1],NewXinbiao,sizeof(SUT_XINBIAO_PAGE)); sut_xinbiao_info.Max_id++; //处理完 清空 memset(NewXinbiao,0,sizeof(NewXinbiao)); } void CalcDistance(SUT_XINBIAO_PAGE*NewXinbiao) { } /* 信标协议 cmd 00 通用 0a 摇晕 只收不发 a0 解除摇晕 0b 摇毙 不收不发 b0 解除摇毙 0c 强制打开GPS */ void XinbiaoPackSend(char cmd) { char temp[100]={0}; snprintf(temp,sizeof(temp),"AT+POC=150000%08x%02x;%d;%d;%d;%d;%d;\r\n",sutPocStatus.LocalGroup.ID,cmd,sutGpsInfo.longitue\ ,sutGpsInfo.latitue,sutGpsInfo.heading,sutGpsInfo.headerSpeed,sutGpsInfo.elevation); //strcpy(data,temp); msgAtSend(temp); MSG_INFO(1,temp); } //定时发送信标 void Xinbiao_handler(unsigned int interval){ static unsigned short cnt=0; //char Packdata[100]={0}; if(sutApp.gtMode!=0) return; if(newPara.Xinbiao_SendMode==0)return; if(newPara.gpsEnable==0)return; if(++cnt<((newPara.Xinbiao_Time+1)*5*1000/interval) && gpsCheckCnt==0) return; cnt=0; gpsCheckCnt=0; if(sutGpsInfo.isGpsValid){ XinbiaoPackSend(NULLCMD); } } void ReadXbFile() { int fd,i=0; fd=LSAPI_FS_Open(XINBIAO_FILE, LSAPI_FS_O_RDWR,0); if(fd<0){ MSG_ERR(1,"%s open read failed", XINBIAO_FILE); return; } LSAPI_FS_Seek(fd, 0L, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, (unsigned char *)&sut_xinbiaopage, sizeof(SUT_XINBIAO_PAGE)*XINBIAO_NUM); for(i=0;i