예제 #1
0
bool
LXDevice::ParseNMEA(const char *String, NMEAInfo &info)
{
  if (!VerifyNMEAChecksum(String))
    return false;

  NMEAInputLine line(String);
  char type[16];
  line.Read(type, 16);

  if (StringIsEqual(type, "$LXWP0"))
    return LXWP0(line, info);

  if (StringIsEqual(type, "$LXWP1"))
    return LXWP1(line, info);

  if (StringIsEqual(type, "$LXWP2"))
    return LXWP2(line, info);

  if (StringIsEqual(type, "$LXWP3"))
    return LXWP3(line, info);

  if (StringIsEqual(type, "$PLXVF"))
    return PLXVF(line, info);

  if (StringIsEqual(type, "$PLXVS"))
    return PLXVS(line, info);

  return false;
}
예제 #2
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// 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 DevLX::ParseNMEA(PDeviceDescriptor_t d, TCHAR* sentence, NMEA_INFO* info)
{
  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);

  return(false);
} // ParseNMEA()
예제 #3
0
파일: devLX16xx.cpp 프로젝트: LK8000/LK8000
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// 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()
예제 #4
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// 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 DevLX::ParseNMEA(PDeviceDescriptor_t d, TCHAR* sentence, NMEA_INFO* info)
{
  if (!NMEAParser::NMEAChecksum(sentence) || (info == NULL)){
    return FALSE;
  }

  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);

  return(false);
} // ParseNMEA()
예제 #5
0
파일: LX.cpp 프로젝트: hnpilot/XCSoar
bool
LXDevice::ParseNMEA(const char *String, NMEA_INFO *GPS_INFO, bool enable_baro)
{
  NMEAInputLine line(String);
  char type[16];
  line.read(type, 16);

  if (strcmp(type, "$LXWP0") == 0)
    return LXWP0(line, GPS_INFO, enable_baro);

  if (strcmp(type, "$LXWP1") == 0)
    return LXWP1(line, GPS_INFO);

  if (strcmp(type, "$LXWP2") == 0)
    return LXWP2(line, GPS_INFO);

  return false;
}
예제 #6
0
파일: Parser.cpp 프로젝트: kwtskran/XCSoar
bool
LXDevice::ParseNMEA(const char *String, NMEAInfo &info)
{
  if (!VerifyNMEAChecksum(String))
    return false;

  NMEAInputLine line(String);
  char type[16];
  line.Read(type, 16);

  if (StringIsEqual(type, "$LXWP0"))
    return LXWP0(line, info);

  if (StringIsEqual(type, "$LXWP1")) {
    /* if in pass-through mode, assume that this line was sent by the
       secondary device */
    DeviceInfo &device_info = mode == Mode::PASS_THROUGH
      ? info.secondary_device
      : info.device;
    LXWP1(line, device_info);

    const bool saw_v7 = device_info.product.equals("V7");
    const bool saw_nano = device_info.product.equals("NANO");
    const bool saw_lx16xx = device_info.product.equals("1606") ||
                             device_info.product.equals("1600");

    if (mode == Mode::PASS_THROUGH) {
      /* in pass-through mode, we should never clear the V7 flag,
         because the V7 is still there, even though it's "hidden"
         currently */
      is_v7 |= saw_v7;
      is_nano |= saw_nano;
      is_lx16xx |= saw_lx16xx;
      is_forwarded_nano = saw_nano;
    } else {
      is_v7 = saw_v7;
      is_nano = saw_nano;
      is_lx16xx = saw_lx16xx;
    }

    if (saw_v7 || saw_nano || saw_lx16xx)
      is_colibri = false;

    return true;
  }

  if (StringIsEqual(type, "$LXWP2"))
    return LXWP2(line, info);

  if (StringIsEqual(type, "$LXWP3"))
    return LXWP3(line, info);

  if (StringIsEqual(type, "$PLXV0")) {
    is_v7 = true;
    is_colibri = false;
    return PLXV0(line, v7_settings);
  }

  if (StringIsEqual(type, "$PLXVC")) {
    is_nano = true;
    is_colibri = false;
    PLXVC(line, info.device, info.secondary_device, nano_settings);
    is_forwarded_nano = info.secondary_device.product.equals("NANO");
    return true;
  }

  if (StringIsEqual(type, "$PLXVF")) {
    is_v7 = true;
    is_colibri = false;
    return PLXVF(line, info);
  }

  if (StringIsEqual(type, "$PLXVS")) {
    is_v7 = true;
    is_colibri = false;
    return PLXVS(line, info);
  }

  return false;
}
예제 #7
0
파일: devLXV7.cpp 프로젝트: Mazuk/LK8000
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// 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()