/********************************************************************************** * File Name: TSGpsProcess.c * Function Describe:device for Gps Process for TS/T808 * Relate Module: * Explain: ²ÉÓÃTCP»òUDP¸ñʽ´«Êä * Writer: wuzhao * Date: 2015.12.14 *ÍâÉèÀàÐÍ£º0x01£¬ *ÃüÁîÀàÐÍ£º0x05 ***********************************************************************************/ #define THIS_FILE_ID 24 //------------------------------------------------------------------------------------------- #include "includes.h" SUT_GPS_SEND_DATA sutGpsSendData; //SUT_PRODUCT_PARA TSsutProductPara; REGISTRATION Regist; AVL_MSG_BODY_ATTRIB msgBodyAttrib; MSG_HEAD msghead; MSG_PACKET msgPacket; AUTH auth; SIM SimData; unsigned int a; unsigned int b; char GPSDataBuf[8]; char GPSDataBuf1[8]; //*p_buf -- *m_data size -- m_size /********************************************************************************** GpsSendHead ***********************************************************************************/ void TSGpsServerConect(void) { int len; unsigned char buf[100]; unsigned char temp[5]; SUTDS ds; SlwTrace(INF, "Device ACK",1); memcpy(temp, (unsigned char*)&sutFeed.feedliushuiID,2); ds.Data.usData=sutFeed.feedID; temp[2] = ds.Data.ucData.b2; temp[3] = ds.Data.ucData.b1; temp[4] = sutFeed.result; len=TSGpsPacket(buf,sutProductPara.PSN,TS_TERMINAL_UNIVERSAL_ANSWER,temp,sizeof(temp)); MC8332ModemSendTcpData(GPS_DATA_SOCKET,buf,len); } //´Ó³§É̱àºÅµ½Óû§Êý¾ÝÒÀ´ÎÀÛ¼ÓµÄÀۼӺͣ¬È¡ÀۼӵĵµÍ8λ×÷ΪУÑéÂë unsigned char TSGetCheckSum(unsigned char *pData,int len) { int i; unsigned char sum= pData[1]; //sum=0; for(i=1;i>8)&0xff; pBuf[i++]=ID&0xff; //ÏûÏ¢ÌåÊôÐÔ msgBodyAttrib.EncrypType=NO_ENCRYP;//NO_ENCRYP; msgBodyAttrib.msgBodyLength=(DataLen); pBuf[i++]=msgBodyAttrib.EncrypType; pBuf[i++]=msgBodyAttrib.msgBodyLength; //SIM¿¨ºÅ if(sutProductPara.SIMFlag!=1){ pBuf[i++]=0; // for (j=0;j<10;j+=2) { pBuf[i++]=(Psnsv[j]<<4)|(Psnsv[j+1]&0x0F); } }else{ for(j=0;j<6;j++){ pBuf[i++]=SimData.SIM[j]; } } //ÏûÏ¢Á÷Ë®ºÅ pBuf[i++] = (liushiID>>8)&0xff; pBuf[i++] = liushiID&0xff; liushiID++; if(pData!=NULL) { //snum++; //ÏûÏ¢°ü·â×°Ïî //msgPacket.msgPacketID=0x30; //msgPacket.msgTotalCount=0x30; //pBuf[i++] = msgPacket.msgPacketID; //pBuf[i++] = msgPacket.msgTotalCount; //MSnum++; //°ü·â×°Ïî 4 for(j=0;j>8)&0xffff); // Regist.CityID = (TS_CITYID&0xffff); // Regist.CityID = ((TS_CITYID>>24)&0xffff); // Regist.CityID = ((TS_CITYID>>16)&0xffff); // // Regist.proID =((TS_PROID>>8)&0xff); // Regist.proID =(TS_PROID&0xff); // // for(i = 0; i < 5; i++){ // Regist.Manufacturers[i] = acTemp[i]; // } // for(i = 0; i < 20; i++){ // Regist.TerMod[i]= acTemp[i+5]; // } // for(i = 0; i < 4; i++){ // Regist.TerID[i]= acTemp[i+25]; // } // // Regist.PlateColor=0x01;//δÉÏÅÆÈ¡ÖµÎª0 // // ³µÅÆÑÕɫΪ0 ±íʾ³µÁ¾VIN // for(i = 0; i < 8; i++){//7»á·µ»Ø // Regist.Plate[i] = TSacTemp[i]; // } // }else{ Regist.proID =((sutProductPara.proID>>8)&0xff); Regist.proID =(sutProductPara.proID&0xff); Regist.CityID = ((sutProductPara.CityID>>24)&0xffff); Regist.CityID = ((sutProductPara.CityID>>16)&0xffff); Regist.CityID = ((sutProductPara.CityID>>8)&0xffff); Regist.CityID = (sutProductPara.CityID&0xffff); for(i = 0; i < 5; i++){ Regist.Manufacturers[i] = sutProductPara.Manufacturers[i]; } for(i = 0; i < 20; i++){ //sscanf(sutProductPara.TerMod+2*i,"%2x",&Table1[i]); if((i<20)&&(sutProductPara.TerMod[i]!='0')){ //sscanf(sutProductPara.TerMod+2*i,"%2x",&Table1[i]); Regist.TerMod[i]= sutProductPara.TerMod[i]; }else{ Regist.TerMod[i]=0x00; } } for(i = 0; i < 4; i++){ sscanf(sutProductPara.TerID+2*i,"%2x",&Temp1[i]); Regist.TerID[i]= Temp1[i]; } Regist.PlateColor=sutProductPara.PlateColor;// for(i = 0; i < 8; i++){ sscanf(sutProductPara.Plate+2*i,"%2x",&Temp[i]); Regist.Plate[i] = Temp[i]; } // } } /************************************************************ ÖÕ¶Ë×¢²á¡¢×¢Ïú *3431303030ÖÆ×÷ÉÌID 3230313430340000000000000000000000000000ÖÕ¶ËÐͺŠ30303030313131 ÖÕ¶ËID *************************************************************/ uint32_t Process_TSRegistration(char* buf, uint32_t len) { unsigned char SendBuf[100]; unsigned short PacketLen; if(g_ucSelect==1){ TSMakeSendData(); }else{ TSRegData(); } //REGISTRATION Regist; PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_REGISTRATION,(unsigned char *)&Regist,sizeof(REGISTRATION)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return len; } void Registration(void) { SlwTrace(INF,"Try-Reg!",1); if(sutProductPara.SIMFlag){SIMReg();} #if 0 if(sutProductPara.Select==1) TSMakeSendStrData(); // ´®¿Ú×¢²á else TSRegData(sutProductPara.PSN); #else TSRegData(); #endif } void RegistrationLogout(void) { unsigned char SendBuf[100]; unsigned short PacketLen; unsigned char *data=NULL; PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_CANCELLATION,data,0); MC8332ModemSendTcpData(0,SendBuf,PacketLen); } /************************************************************ Öն˼øÈ¨ *************************************************************/ void Authentication(void) { unsigned char SendBuf[100]; unsigned short PacketLen; SlwTrace(INF,"Re-Authentication!",1); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_AUTHENTICATION,(unsigned char *)&sutProductPara.AutH,sizeof(AUTH));//ʵ¼ÊÊÇ·µ»ØµÄ¼øÈ¨ÐÅÏ¢ MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); } //ÒÔÏ uint32_t Process_TSAuthentication(char* buf, uint32_t len) { unsigned char SendBuf[100]; unsigned short PacketLen; TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_AUTHENTICATION,(unsigned char *)&auth,sizeof(AUTH)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return len; } /************************************************************ λÖÃÐÅÏ¢²éѯ *************************************************************/ uint32_t Process_TSCenterGetPos_rsp(unsigned char* buf, unsigned short len) { unsigned char SendBuf[100]; unsigned short PacketLen; TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_LOCATION_INFORMATION_INQUIRY,(unsigned char *)&sutGpsSendData,sizeof(SUT_GPS_SEND_DATA)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return 0; } uint32_t Process_TSClient_rsp(char* buf, unsigned short len) { if(!sutGpsInfo.isServerLogin){ sutGpsInfo.isServerLogin=1; SlwTrace(INF,"[Gps Logined]",1); } return 0; } /************************************************************************************************** *¿´Ï Èç¹ûÒ»Ö±·¢×¢²áÐÅÏ¢»áÈçºÎ ***************************************************************************************************/ void TSGpsTimingSendPos(void) { unsigned char SendBuf[100]; unsigned short PacketLen; SlwTrace(INF,"TSGpsTimingSendPos",1); TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_LOCATION_INFORMATION_REPORTING,(unsigned char *)&sutGpsSendData,sizeof(SUT_GPS_SEND_DATA)); MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); return ; } /*********************************************************************************** *·þÎñÆ÷ÉèÖÃÖ÷¶¯Éϱ¨Ê±¼ä *Êý¾Ý¸ñʽ HEAD1 HEAD2 CMD LEN1 LEN2 PSN1 PSN2 PSN3 PSN4 X1 X2 CHECK END 29 29 34 00 08 PSN[4] X1 X2 CHECK 0D time=X1*256+X2 ***********************************************************************************/ uint32_t Process_TSCenterGetPosTimerout(char* buf, uint32_t len) { char SendBuf[100]; unsigned short t; unsigned short PacketLen; //Ìø¹ýÖÕ¶ËÐòÁкÅ4 bytes //»ñȡʱ¼ä sutGpsInfo.GPS_UploadTime =((unsigned short)buf[9]&0xff<<8) + (unsigned short)buf[10]&0xff ; snprintf(SendBuf, sizeof(SendBuf),"[GpsTime=%d]",sutGpsInfo.GPS_UploadTime); SlwTrace(INF,SendBuf,1); TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_EVENT_REPORT,(unsigned char *)&sutGpsSendData,sizeof(SUT_GPS_SEND_DATA)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return len; } /************************************************************ ½¨Á¢ºÃÁ¬½Óºó£¬Ïòƽ̨·¢ËÍÖն˼øÈ¨ÏûÏ¢½øÐмøÈ¨¡¢½¨Á¢Á´½Ó *************************************************************/ /************************************************************ Á¬½Ó½¨Á¢ºÍÖն˼øÈ¨³É¹¦ºó£¬ÖÕ¶ËÖÜÆÚÐÔÏòƽ̨·¢ËÍÖÕ¶ËÐÄÌøÐÅÏ¢£¬Æ´Í¼ÊÕµ½ºó ÏòÖÕ¶Ë·¢ËÍÆ½Ì¨Í¨ÓÃÓ¦´ðÏûÏ¢£¬·¢ËÍÖÜÆÚÓÉÖն˲ÎÊýÖ¸¶¨¡¢Á´½Óά³Ö *************************************************************/ uint32_t Process_TSPlatformAnswer(char* buf, uint32_t len) { unsigned char SendBuf[100]; unsigned short PacketLen; TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_PLATFORM_UNIVERSAL_ANSWER,(unsigned char *)&sutGpsSendData,sizeof(SUT_GPS_SEND_DATA)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return 0; } uint32_t Process_TSTerminalHeartbeat(char* buf, uint32_t len) { unsigned char SendBuf[100]; unsigned short PacketLen; TSMakeGpsSendData(); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_HEARTBEAT,(unsigned char *)&sutGpsSendData,sizeof(SUT_GPS_SEND_DATA)); MC8332ModemSendTcpData(0,SendBuf,PacketLen); return 0; } void TS_SendHeartTick(void) { unsigned char SendBuf[100]; unsigned short PacketLen; SlwTrace(INF, "HeartTick",1); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_HEARTBEAT,0,0); MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); } void TS_SendSOSMessage(void) { unsigned char SendBuf[100]; unsigned short PacketLen; SlwTrace(INF, "SOS Send",1); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_SEND_SOS_SMS,0,0); MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); } void TS_ReqRealTime(void) { unsigned char SendBuf[100]; unsigned short PacketLen; SlwTrace(INF, "ReqRealTime",1); PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_REQTIME,0,0); MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); } /************************************************************ ƽ̨Ö÷·¢ÏûÏ¢£¬ÖÕ¶ËÖ÷·¢ÏûÏ¢ *************************************************************/ /****************************************************************************** *Ŀǰ·þÎñÆ÷Ö»×öÁË£º×¢²á£¬È¡Ïû×¢²á£¬Î»ÖÃÐÅÏ¢£¬¼øÈ¨ÏûÏ¢ *******************************************************************************/ TSCmd_struct TSCmd_info[] = { {TS_TERMINAL_REGISTRATION, Process_TSRegistration},//ÖÕ¶Ë×¢²á // {TS_TERMINAL_REGISTRATION_REPLY, Process_TSRegistrationReply},//ÖÕ¶Ë×¢²áÓ¦´ð {TS_TERMINAL_AUTHENTICATION, Process_TSAuthentication},//¼øÈ¨ // {TS_SETTING_TERMINAL_PARAMETERS, Process_TSParametersSet}, {TS_LOCATION_INFORMATION_INQUIRY, Process_TSCenterGetPos_rsp},//λÖòéѯ // {XINGAN_PACKET_CENTER_CMD_GET_STAT, Process_XinganCenterGetStat_rsp}, // {XINGAN_PACKET_CENTER_CMD_RESET, Process_XinganCenterReset_rsp}, // {XINGAN_PACKET_CENTER_CMD_DEFAULT_SET, Process_XinganCenterDefaultSet_rsp}, {TS_TERMINAL_HEARTBEAT, Process_TSCenterGetPosTimerout}, // {XINGAN_PACKET_CENTER_CMD_GET_POS_LENOUT, Process_XinganCenterGetPosLenout}, // {XINGAN_PACKET_CENTER_CMD_CLOSE_WARNING, Process_XinganCenterCloseWarning_rsp}, // {XINGAN_PACKET_CENTER_CMD_OPEN_OIL_WAY, Process_XinganCenterOpenOilWay_rsp}, // {XINGAN_PACKET_CENTER_CMD_CLOSE_OIL_WAY, Process_XinganCenterCloseOilWay_rsp}, // {XINGAN_PACKET_CENTER_CMD_GET_VER, Process_XinganCenterGetVer_rsp}, // {XINGAN_PACKET_CENTER_CMD_DIAL_CALL, Process_XinganCenterDialCall_rsp} , // {XINGAN_PACKET_CENTER_CMD_HIGH_SPEED_WARNING, Process_XinganCenterHighSpeedWarning_rsp}, // {XINGAN_PACKET_CENTER_CMD_STATISTICS_MILE, Process_XinganCenterStatisticsMile_rsp}, // {XINGAN_PACKET_CENTER_CMD_UDP_IPPORT, Process_XinganCenterIPport_rsp}, // {XINGAN_PACKET_CENTER_CMD_APN, Process_XinganCenterApn_rsp}, // {TS_EVENT_REPORT, Process_TSClient_rsp}, // // {XINGAN_PACKET_CLIENT_CMD_CONNECT, Process_XinganClientConnectReq}, // {XINGAN_PACKET_CLIENT_SEND_POS_DATA, Process_XinganClientSendPosData}, // {XINGAN_PACKET_CLIENT_CMD_SEND_WARNING_DATA, Process_XinganClientSendWarnData}, //{TS_QUERY_TERMINAL_PARAMETERS, Process_TSParametersQuery}, //{TS_TERMINAL_CONTROL, Process_TSTerminalContrl}, {TS_PLATFORM_UNIVERSAL_ANSWER, Process_TSPlatformAnswer}, {TS_TERMINAL_HEARTBEAT, Process_TSTerminalHeartbeat}, }; TSGPS_process_packet GetTSProcessFun(uint32_t Cmd) { uint32_t j; for(j=0;j>4)&0x0F)*10 + (bcd[i]&0x0F); dec += tmp * power(100, length-1-i); } return dec; } /******************************************************** 10½øÖÆ×ªBCD ********************************************************/ int DectoBCD(int Dec, unsigned char *Bcd, int length) { int i; int temp; for(i=length-1; i>=0; i--) { temp = Dec%100; Bcd[i] = ((temp/10)<<4) + ((temp%10) & 0x0F); Dec /= 100; } return 0; } //#define GPS_DEBUG_GPS_SEND_DATA /*************************************************************************** *MakeGpsSendData ¸ù¾ÝsutGpsInfoÉú³ÉsutGpsSendData ****************************************************************************/ void TSMakeGpsSendData(void)//5´¦ { char sv[17]; char data[3]; char buf[10]; int buf1[3]; int j,temp,num; char *pTemp; char WWWW[5]; static int Table[4]={0}; static int Table1[4]={0}; sutGpsSendData.Time[0] = sutGpsInfo.year; sutGpsSendData.Time[1] = sutGpsInfo.month; sutGpsSendData.Time[2] = sutGpsInfo.day; sutGpsSendData.Time[3] = sutGpsInfo.hour; sutGpsSendData.Time[4] = sutGpsInfo.minu; sutGpsSendData.Time[5] = sutGpsInfo.sec; sutGpsSendData.St=0x00; #if 0 if(sutGpsInfo.isGpsValid) {//wjl 1121 sutGpsSendData.status |=(0x01<<24);//ACC sutGpsSendData.status |=(0x01<<25);//¶¨Î»±êÖ¾ sutGpsSendData.status |=(0x01<<28);//ÔËӪ״̬ }else sutGpsSendData.status=0; #else sutGpsSendData.status=0; if(sutGpsInfo.isGpsValid) { sutGpsSendData.status |=(1<<24);//b0 1 acc sutGpsSendData.status |=(1<<25);//b1 1 ¶¨Î» if(sutGpsInfo.NSFlag=='S') sutGpsSendData.status |=(1<<26);//b2 1 ÄÏγ if(sutGpsInfo.EWFlag=='W') sutGpsSendData.status |=(1<<27);//b3 1 Î÷¾­ sutGpsSendData.status |=(1<<28);//b4 1 ÔËÓª //sutGpsSendData.status |=(1<<29);//b5 1 ¾­Î³¶ÈÒѼÓÃÜ //sutGpsSendData.status |=(1<<30);//b6 ±£Áô //sutGpsSendData.status |=(1<<31);//b7 ±£Áô //sutGpsSendData.status |=(1<<16);//b8 ÔØ×´Ì¬-1 //sutGpsSendData.status |=(1<<17);//b9 ÔØ×´Ì¬-0 //sutGpsSendData.status |=(1<<18);//b10 ³µÁ¾ÓÍ״̬ //sutGpsSendData.status |=(1<<19);//b11 ³µÁ¾µç·״̬ //sutGpsSendData.status |=(1<<20);//b12 ³µËø×´Ì¬ //sutGpsSendData.status |=(1<<21);//b13 ÃÅ1״̬ //sutGpsSendData.status |=(1<<22);//b14 ÃÅ2״̬ //sutGpsSendData.status |=(1<<23);//b15 ÃÅ3״̬ //sutGpsSendData.status |=(1<<8);//b16 ÃÅ4״̬ //sutGpsSendData.status |=(1<<9);//b17 ÃÅ5״̬ //sutGpsSendData.status |=(1<<10);//b18 ÊÇ·ñʹÓÃGPSÎÀÐǶ¨Î» //sutGpsSendData.status |=(1<<11);//b19 ÊÇ·ñʹÓñ±¶·ÎÀÐǶ¨Î» //sutGpsSendData.status |=(1<<12);//b20 ÊÇ·ñʹÓÃGLONASSÎÀÐǶ¨Î» //sutGpsSendData.status |=(1<<13);//b21 ÊÇ·ñʹÓÃGalileoÎÀÐǶ¨Î» } #endif sutGpsSendData.Mileag=((sutGpsInfo.StatisticsMile>>8)&0xFF)|(((sutGpsInfo.StatisticsMile)&0xFF)<<8); sutGpsSendData.SSFF=((sutGpsInfo.speed>>8)&0xFF)|(((sutGpsInfo.speed)&0xFF)<<8); sutGpsSendData.Acpect=sutGpsInfo.aspect; GetCoordinates(1); sutGpsSendData.WWWW[0] = sutGpsInfo.testWD>>24; sutGpsSendData.WWWW[1] = sutGpsInfo.testWD>>16; sutGpsSendData.WWWW[2] = sutGpsInfo.testWD>>8; sutGpsSendData.WWWW[3] = sutGpsInfo.testWD; sutGpsSendData.JJJJ[0] = sutGpsInfo.testJD>>24; sutGpsSendData.JJJJ[1] = sutGpsInfo.testJD>>16; sutGpsSendData.JJJJ[2] = sutGpsInfo.testJD>>8; sutGpsSendData.JJJJ[3] = sutGpsInfo.testJD; } void AscStrTurnHexStr(char *AscStr, char *HexStr) { char *pAscStr=AscStr; int i=4; unsigned char d,h,l; while(i){ d=(unsigned char)*pAscStr++; l=d&0x0f; h=d>>4; *HexStr++=AscToHex(h); *HexStr++=AscToHex(l); i--; } *HexStr=0; } void getData(void) { // char buf[10]; // char buf1[8]; // char buf2[4]={0}; // char temp[3]; // char temp1[3]; // char temp2[5]; // char temp3[5]; // char data[6]; // char data1[6]; // char data2[6]; // int i,num,num1,j,w,Gdata,k; // double Jnum1,Jnum2,Jnum3;//ÓÐСÊýλ 8λÓÐЧ // double Wnum1,Wnum2,Wnum3;//ÓÐСÊýλ 8λÓÐЧ // char b[]="0123456789ABCDEF"; // MakeGpsSendData(); //// AscStrToHexStr((char *)sutLcdGpsSendData.JJJJ,buf1); // AscStrTurnHexStr((char *)sutLcdGpsSendData.JJJJ,buf1); // memset(temp, 0, sizeof(temp)); // for(i=0;i<3;i++){ // temp[i]=buf1[i]; // } // j=atoi(temp); // memset(temp2, 0, sizeof(temp2)); // for(i=0;i<6;i++){ // temp2[i]=buf1[i+3]; // } // num=atoi(temp2); // Jnum1=num/1000; // Jnum1 /=60; // Jnum2 = (num%1000)*60; // Jnum2 /=3600000; // Jnum3=Jnum1+Jnum2; // // //sutLcdGpsSendData.j=j*1000000+Jnum3*1000000; // sutLcdGpsSendData.j = (j+Jnum3)*1000000; // sprintf(buf,",%d,",sutLcdGpsSendData.j); // SlwTrace(INF,buf); // i =0; // k=6; // memset(data, 0, sizeof(data)); // while(sutLcdGpsSendData.j>0){ // data[i]=sutLcdGpsSendData.j%16; // GPSDataBuf[k]=b[data[i]];//data1 // sutLcdGpsSendData.j=sutLcdGpsSendData.j/16; // k--; // i++; // } // SlwTrace(INF,GPSDataBuf); //// AscStrToHexStr((char *)sutLcdGpsSendData.WWWW,buf2); // AscStrTurnHexStr((char *)sutLcdGpsSendData.WWWW,buf2); // for(i=0;i<3;i++){ // temp1[i]=buf2[i]; // } // w=atoi(temp1); // for(i=0;i<6;i++){//5 // temp3[i]=buf2[i+3]; // } // num1=atoi(temp3); // Wnum1=num1/1000; // Wnum1 /=60; // Wnum2 = (num1%1000)*60; // Wnum2 /=3600000; // Wnum3=Wnum1+Wnum2; // // //sutLcdGpsSendData.W=w*1000000+Wnum3*1000000; // sutLcdGpsSendData.W=(w+Wnum3)*1000000; // buf[0]=0; // sprintf(buf,"%d",sutLcdGpsSendData.W); // SlwTrace(INF,buf); // i =0; // k=6; // data1[0]=0; // while(sutLcdGpsSendData.W>0){ // data1[i]=sutLcdGpsSendData.W%16; // GPSDataBuf1[k]=b[data1[i]];//data1 // sutLcdGpsSendData.W=sutLcdGpsSendData.W/16; // k--; // i++; // } // SlwTrace(INF,GPSDataBuf1); // buf[0]=0; // sprintf(buf,"%d",sutLcdGpsSendData.j); // SlwTrace(INF,buf); // buf[0]=0; // sprintf(buf,"%d",sutLcdGpsSendData.W); // SlwTrace(INF,buf); } void TSRegData(void){ int i; static int Temp1[7]; static int Table1[20]={0}; static int Temp[8]; unsigned char SendBuf[100],len; unsigned short PacketLen,data1,data2,data3,data4; unsigned int PSN; PSN=sutProductPara.PSN; Regist.proID=0; Regist.CityID=0; for(i = 0; i < 5; i++) Regist.Manufacturers[i] = 0; for(i = 0; i < 20; i++) Regist.TerMod[i]= 0x00; Regist.TerID[0]=(unsigned char)((PSN>>24)&0xff);//û³öÀ´ÏÔʾÂÒÂë Regist.TerID[1]=(unsigned char)((PSN>>16)&0xff); Regist.TerID[2]=(unsigned char)((PSN>>8)&0xff); Regist.TerID[3]=(unsigned char)(PSN&0xff); for(i = 0; i < 3; i++) Regist.TerID[i+4]= 0x00; Regist.PlateColor=0; for(i = 0; i < 8; i++) Regist.Plate[i] = 0x00; PacketLen=TSGpsPacket(SendBuf,sutProductPara.PSN,TS_TERMINAL_REGISTRATION,(unsigned char *)&Regist,sizeof(REGISTRATION)); MC8332ModemSendTcpData(GPS_DATA_SOCKET,SendBuf,PacketLen); } void SIMReg(void) { int i; static int Table1[6]={0}; for(i = 0; i < 6; i++){ sscanf(sutProductPara.SIM+2*i,"%2x",&Table1[i]); SimData.SIM[i]= Table1[i]; } }