📄 gps.c
字号:
}
if(cycle > 3)
{
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsGSV.PRV04, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsGSV.elevation04, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsGSV.depression04, tempStr);
memset(tempStr, 0, 30);
getStringEnd('*', tempStr);
strcpy(gpsGSV.noise04, tempStr);
}
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
tempStr[2] = '\0';
strcpy(gpsGSV.endvalue, tempStr);
printf("\n********************$GPGSV***************************\n");
printf(" TOT_Item: %s\n", gpsGSV.totalnum);
printf(" Cur_Item: %s\n", gpsGSV.currentnum);
printf(" TOT_Star: %s\n", gpsGSV.totalstar);
printf(" PRV01: %s\n", gpsGSV.PRV01);
printf(" Elevation01: %s\n", gpsGSV.elevation01);
printf(" Depression01: %s\n", gpsGSV.depression01);
printf(" Noise01: %s\n", gpsGSV.noise01);
printf(" PRV02: %s\n", gpsGSV.PRV02);
printf(" Elevation02: %s\n", gpsGSV.elevation02);
printf(" Depression02: %s\n", gpsGSV.depression02);
printf(" Noise02: %s\n", gpsGSV.noise02);
printf(" PRV03: %s\n", gpsGSV.PRV03);
printf(" Elevation03: %s\n", gpsGSV.elevation03);
printf(" Depression03: %s\n", gpsGSV.depression03);
printf(" Noise03: %s\n", gpsGSV.noise03);
printf(" PRV04: %s\n", gpsGSV.PRV04);
printf(" Elevation04: %s\n", gpsGSV.elevation04);
printf(" Depression04: %s\n", gpsGSV.depression04);
printf(" Noise04: %s\n", gpsGSV.noise04);
printf(" ENDValue: %s\n", gpsGSV.endvalue);
return;
}
/*******************************************************************************
** Function: Get GPVTG for buffer **
** In: NULL **
** Out: GPVTG Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsGPVTG()
{
printf("$GPVTG............\n");
return;
}
/*******************************************************************************
** Function: Get LCGLL for buffer **
** In: NULL **
** Out: LCGLL Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsLCGLL()
{
printf("$LCGLL............\n");
return;
}
/*******************************************************************************
** Function: Get LCVTG for buffer **
** In: NULL **
** Out: LCVTG Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsLCVTG()
{
printf("$LCVTG............\n");
return;
}
/*******************************************************************************
** Function: Get PGRME for buffer **
** In: NULL **
** Out: PGRME Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsPGRME()
{
printf("$PGRME............\n");
return;
}
/*******************************************************************************
** Function: Get PGRMT for buffer **
** In: NULL **
** Out: PGRMT Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsPGRMT()
{
printf("$PGRMT............\n");
return;
}
/*******************************************************************************
** Function: Get GPRMC for buffer **
** In: NULL **
** Out: GPRMC Information **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void gpsGPRMC()
{
printf("$GPRMC............\n");
#if 0
GPRMCHead gpsMCSignal;
char tempStr[30] = {0};
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.time, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.statu, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.latitude, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.southornorth, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.longitude, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.eastorwest, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.high, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.director, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.date, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.magic, tempStr);
memset(tempStr, 0, 30);
getStringEnd(',', tempStr);
strcpy(gpsMCSignal.magicdirtor, tempStr);
printf("**********************************************************\n");
printf("Time : %s\n", gpsMCSignal.time);
printf("Statue : %s\n", gpsMCSignal.statu);
printf("Latitude : %s\n", gpsMCSignal.latitude);
printf("Southornorth: %s\n", gpsMCSignal.southornorth);
printf("Longitude : %s\n", gpsMCSignal.longitude);
printf("Eastorwest : %s\n", gpsMCSignal.eastorwest);
printf("High : %s\n", gpsMCSignal.high);
printf("Director : %s\n", gpsMCSignal.director);
printf("Date : %s\n", gpsMCSignal.date);
printf("Magic : %s\n", gpsMCSignal.magic);
printf("Magicdirtor : %s\n", gpsMCSignal.magicdirtor);
#endif
}
/*******************************************************************************
** Function: get a string location **
** In: a char buffer **
** Out: NULL **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void getString(char strChar[])
{
char temp[20] = {0};
strlwr(strChar);
checkNULL();
while(gpsMessage[buffEnd][0] != '$')
{
gpsMessage[buffEnd][0] = 0;
gpsMessage[buffEnd][1] = 0;
buffEnd = (buffEnd + 1) % 1024;
checkNULL();
}
getStringEnd(',' ,temp);
strlwr(temp);
strcpy(strChar, temp);
return;
}
/*******************************************************************************
** Function: check next is NULL **
** In: a char buffer **
** Out: NULL **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void checkNULL()
{
while(gpsMessage[buffEnd][1] == 0);
}
/*******************************************************************************
** Function: get next n char **
** In: start position, get length, a char buffer **
** Out: a char string **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
void getNextChar(int length, char backstr[])
{
int ii = 0;
while(ii < length)
{
checkNULL();
backstr[ii] = gpsMessage[buffEnd][0];
gpsMessage[buffEnd][0] = 0;
gpsMessage[buffEnd][1] = 0;
buffEnd =(buffEnd + 1) % 1024;
ii++;
}
backstr[ii] = 0;
}
void getStringEnd(char stopcn, char backstr[])
{
int ii = 0;
checkNULL();
while((gpsMessage[buffEnd][0] != stopcn) && (gpsMessage[buffEnd][0] != '\n'))
{
backstr[ii] = gpsMessage[buffEnd][0];
gpsMessage[buffEnd][0] = 0;
gpsMessage[buffEnd][1] = 0;
buffEnd =(buffEnd + 1) % 1024;
ii++;
checkNULL();
}
gpsMessage[buffEnd][0] = 0;
gpsMessage[buffEnd][1] = 0;
buffEnd =(buffEnd + 1) % 1024;
backstr[ii] = '\0';
}
void showPass()
{
printf("\n");
printf("***********************************************************\n");
printf("\n\n");
printf(" ********** *** ***** *****\n");
printf(" ** ** ** ** ** ** \n");
printf(" ** ** ** ** ** ** \n");
printf(" ** ** ** ** ** ** \n");
printf(" ********** ********* ** ** \n");
printf(" ** ** ** ** ** \n");
printf(" ** ** ** ** ** \n");
printf(" ** ** ** ** ** \n");
printf(" ** ** ** ** ** \n");
printf("************************************************************\n");
printf("\n\n");
}
/*******************************************************************************
** Function: GPS test Program **
** sense the GPS Port, Get the GPS Data **
** In: NULL **
** Out: NULL **
** Date: 2007-8-1 Author: Owen.Lu **
*******************************************************************************/
int main()
{
char GPSPort[10] = {0};
int receiveLength = 0;
printf("GPS Test Program V1.01, add star Test\n");
sprintf(GPSPort, "%s", "COM");
getGPSPort(GPSPort);
idComDev = CreateFile(GPSPort, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
assert(idComDev != INVALID_HANDLE_VALUE);
setCOMPortPrj();
CreateThread(NULL, 0, receiveGPSProc, NULL, 0, 0);
CreateThread(NULL, 0, analyseGPSProc, NULL, 0, 0);
while(1)
{
/*
if(testCycle > 0x2)
{
break;
}
*/
Sleep(100);
}
showPass();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -