void NMEAParser::ParseNMEASentence(const char *addressField, const char *buf, const unsigned int bufSize) { // printf("parse NMEA sentence\n"); if( strcmp(addressField, "GPGGA") == NULL ) { // printf("processing GGA\n"); ProcessGPGGA(buf, bufSize); } else if( strcmp(addressField, "GPGSA") == NULL ) { ProcessGPGSA(buf, bufSize); } else if( strcmp(addressField, "GPGSV") == NULL ) { ProcessGPGSV(buf, bufSize); } else if( strcmp(addressField, "GPRMB") == NULL ) { ProcessGPRMB(buf, bufSize); } else if( strcmp(addressField, "GPRMC") == NULL ) { ProcessGPRMC(buf, bufSize); } else if( strcmp(addressField, "GPZDA") == NULL ) { ProcessGPZDA(buf, bufSize); } }
/** * Process NMEA sentence - switch on the NMEA command and call the * appropriate processor */ void GPSNmea::ProcessCommand(uint8_t *pCommand, uint8_t *pData) { /* * GPGGA */ if (!strcmp((char *) pCommand, "GPGGA")) ProcessGPGGA(pData); /* * GPRMC */ else if (!strcmp((char *) pCommand, "GPRMC")) ProcessGPRMC(pData); //m_dwCommandCount++; //return TRUE; }
//------------------------------------------------------------------------------ //new void uart0_int_handler() { unsigned long const ist = MAP_UARTIntStatus(UART_BASE, TRUE); if (ist & (UART_INT_RX | UART_INT_RT)) { MAP_UARTIntClear(UART_BASE, UART_INT_RX|UART_INT_RT); long b; while(MAP_UARTCharsAvail(UART_BASE)) { b = MAP_UARTCharGetNonBlocking(UART_BASE); if (b == -1 || (char)b == '$' || g_rx_buf_len >= UART_BUF_SZ) { g_rx_buf_len = 0; g_rx_buf[g_rx_buf_len++] = b; }else { if (b == 0x0D && g_rx_buf[0] == '$' && g_rx_buf[g_rx_buf_len-3] == '*') // +ёыш ъюэхЎ яръхЄр { if ( g_rx_buf_len > 10) { unsigned char crc; if (g_rx_buf[--g_rx_buf_len] > '9') crc = 0x0A + g_rx_buf[g_rx_buf_len]-'A'; else crc = (g_rx_buf[g_rx_buf_len]-'0'); if (g_rx_buf[--g_rx_buf_len] > '9') crc |= (0x0A + g_rx_buf[g_rx_buf_len]-'A')<< 4; else crc |= (g_rx_buf[g_rx_buf_len]-'0')<< 4; g_rx_buf_len-=2; do{ crc ^= g_rx_buf[g_rx_buf_len]; }while( --g_rx_buf_len ); if (!crc) // CRC { health_count = 0; gps_info.pack_found++; /* Parse packet */ if( !strncmp((char*)g_rx_buf, "$GPGGA", 6) ) { ProcessGPGGA(&g_rx_buf[7]); st[1] =hw_time(); } else if( !strncmp((char*)g_rx_buf, "$GPRMC", 6)) { ProcessGPRMC(&g_rx_buf[7]); // gps_pps_counter=0; // // st[0] =hw_time(); } }else { gps_info.crc_error++; } } g_rx_buf_len = 0; }else if (b != 0x0A) g_rx_buf[g_rx_buf_len++] = b; } }//while } ///// if (ist & UART_INT_TX) { MAP_UARTIntClear(UART_BASE, UART_INT_TX); tx_pkt_snd_one(); } }