/* Instead of just merging input from a secondary device, which is
 * part of the design of NMEA and which would make life easy, Trimble 
 * wraps messages in a proprietary message  PTNLAG001. This handler
 * just re-serializes the contents of that message and bounces
 * it back to ArGPS for further parsing.
 */
void ArTrimbleGPS::handlePTNLAG001(ArNMEAParser::Message m)
{
  ArNMEAParser::MessageVector *message = m.message;
  if(message->size() < 2) return;
  std::string text;
  size_t len = 0;
  // Undo split by commas, skip msg[0] which is "PTNLAG001"
  for(ArNMEAParser::MessageVector::const_iterator i = message->begin() + 1; i != message->end(); ++i)
  {
    if(i != message->begin()) text += ",";
    text += *i;
    len += (*i).length() + 1;
  }
#ifdef DEBUG_ARTRIMBLEGPS
  printf("XXXXXXXXX Got PTNLAG001 contents from Trimble, %d bytes: %s\n", len, text.c_str());
#endif

  // Reparse contents. Note, this will clobber NMEA parser state, including
  // *message, so after  calling this we can't do anything else with it. (So
  // exit the function)
  text += "\r\n";
  len += 2;
  myNMEAParser.parse(text.c_str(), len);
}
示例#2
0
void ArNovatelGPS::handleNovatelGPGGA(ArNMEAParser::Message msg)
{
  // call base handler
  ArGPS::handleGPGGA(msg);

  // Some of Novatel's values are different from the standard:
  // (see
  // http://na1.salesforce.com/_ui/selfservice/pkb/PublicKnowledgeSolution/d?orgId=00D300000000T86&id=501300000008RAN&retURL=%2Fsol%2Fpublic%2Fsolutionbrowser.jsp%3Fsearch%3DGPGGA%26cid%3D000000000000000%26orgId%3D00D300000000T86%26t%3D4&ps=1 or search Novatel's Knowlege Base for "GPGGA")
 
  ArNMEAParser::MessageVector *message = msg.message;
  if(message->size() < 7) return;
  switch((*message)[6].c_str()[0])
  {
    case '2':
      myData.fixType = OmnistarConverging;
      break;
    case '5':
      myData.fixType = OmnistarConverged;
      break;
    case '9':
      myData.fixType = DGPSFix;
      break;
  }
}