Code Search for Developers
 
 
  

misc_nmea.c from EmStar at Krugle


Show misc_nmea.c syntax highlighted

/*
 * misc_nmea -- Utils for creating/decoding NMEA sentences
 *
 * $Id: misc_nmea.c,v 1.1 2004/03/18 17:30:40 jelson Exp $
 */

char misc_nmea_id[] = "$Id: misc_nmea.c,v 1.1 2004/03/18 17:30:40 jelson Exp $";

#include "misc.h"

/*
 * Given a string of the format
 *   $<sentence>....*
 * ... add the NMEA checksum to the end of the string.
 */
void nmea_checksum(char *sentence)
{
  int sum = 0;

  /* go past the $ at the beginning */
  while (*sentence == '$')
    sentence++;

  /* scan for the '*' at the end */
  do {
    if (*sentence == '\0') {
      elog(LOG_ERR, "NMEA string not terminated with '*'!");
      return;
    }

    sum = (sum ^ *sentence) & 0xff;
    sentence++;
  } while (*sentence != '*');

  /* append the computed checksum to the sentence */
  sprintf(sentence+1, "%X%X", (sum & 0xf0) >> 4, sum & 0xf);
}




See more files for this project here

EmStar

EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.

Project homepage: http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other

  elog.c
  elog_emit.c
  file.c
  misc_angles.c
  misc_buf.c
  misc_crc32.c
  misc_filename.c
  misc_hash.c
  misc_init.c
  misc_lock.c
  misc_math.c
  misc_namelist.c
  misc_network.c
  misc_nmea.c
  misc_opt.c
  misc_parse.c
  misc_proc.c
  misc_random.c
  misc_ringbuff.c
  misc_serial.c
  misc_signals.c
  misc_sim.c
  misc_time.c
  misc_types.c
  misc_version.c
  string.c