//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// Parses LXWPn sentences. /// /// @param d device descriptor /// @param sentence received NMEA sentence /// @param info GPS info to be updated /// /// @retval true if the sentence has been parsed /// //static BOOL DevLX16xx::ParseNMEA(PDeviceDescriptor_t d, TCHAR* sentence, NMEA_INFO* info) { static int i=40; if (!NMEAParser::NMEAChecksum(sentence) || (info == NULL)){ return FALSE; } if (_tcsncmp(_T("$LXWP2"), sentence, 6) == 0) { if(iLX16xx_RxUpdateTime > 0) { iLX16xx_RxUpdateTime--; } else { if(fabs(oldMC - MACCREADY)> 0.005f) { LX16xxPutMacCready( d, MACCREADY); oldMC = MACCREADY; MacCreadyUpdateTimeout = 2; } } } /* configure LX after 30 GPS positions */ if (_tcsncmp(_T("$GPGGA"), sentence, 6) == 0) { if(i++ > 10) { SetupLX_Sentence(d); i=0; } } if (_tcsncmp(_T("$LXWP0"), sentence, 6) == 0) return LXWP0(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP1"), sentence, 6) == 0) return LXWP1(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP2"), sentence, 6) == 0) return LXWP2(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP3"), sentence, 6) == 0) return LXWP3(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP4"), sentence, 6) == 0) return LXWP4(d, sentence + 7, info); return(false); } // ParseNMEA()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// Parses LXWPn sentences. /// /// @param d device descriptor /// @param sentence received NMEA sentence /// @param info GPS info to be updated /// /// @retval true if the sentence has been parsed /// //static BOOL DevLXV7::ParseNMEA(PDeviceDescriptor_t d, TCHAR* sentence, NMEA_INFO* info) { static int i=40; TCHAR szTmp[256]; if (_tcsncmp(_T("$LXWP2"), sentence, 6) == 0) { if(iLXV7_RxUpdateTime > 0) { iLXV7_RxUpdateTime--; } else { if(fabs(LXV7_oldMC - MACCREADY)> 0.005f) { LXV7PutMacCready( d, MACCREADY); LXV7_oldMC = MACCREADY; LXV7_MacCreadyUpdateTimeout = 2; } } } /* configure LX after 10 GPS positions */ if (_tcsncmp(_T("$GPGGA"), sentence, 6) == 0) { if(i++ > 4) { SetupLX_Sentence(d); i=0; } } static int oldQFEOff =0; static int iOldQNH =0; int iQNH = (int)(QNH*100.0); if(iQNH != iOldQNH) { iOldQNH = iQNH; _stprintf(szTmp, TEXT("$PLXV0,QNH,W,%i"),(int)iQNH); LXV7NMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); } int QFE = (int)QFEAltitudeOffset; if(QFE != oldQFEOff) { oldQFEOff = QFE; _stprintf(szTmp, TEXT("$PLXV0,ELEVATION,W,%i"),(int)(QFEAltitudeOffset)); LXV7NMEAddCheckSumStrg(szTmp); // d->Com->WriteString(szTmp); } if(LXV7_iGPSBaudrate ==0) { _stprintf(szTmp, TEXT("$PLXV0,BRGPS,R")); LXV7NMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); } if (_tcsncmp(_T("$PLXVF"), sentence, 6) == 0) return PLXVF(d, sentence + 7, info); else if (_tcsncmp(_T("$PLXVS"), sentence, 6) == 0) return PLXVS(d, sentence + 7, info); else if (_tcsncmp(_T("$PLXV0"), sentence, 6) == 0) return PLXV0(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP0"), sentence, 6) == 0) return LXWP0(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP1"), sentence, 6) == 0) return LXWP1(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP2"), sentence, 6) == 0) return LXWP2(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP3"), sentence, 6) == 0) return LXWP3(d, sentence + 7, info); else if (_tcsncmp(_T("$LXWP4"), sentence, 6) == 0) return LXWP4(d, sentence + 7, info); return(false); } // ParseNMEA()