[ntp:questions] win32_io.c

Charles Elliott elliott.ch at verizon.net
Tue Jun 21 02:08:03 UTC 2011


Hello:

 

                In win32_io.c why is the event char set to CR instead of LF
as the NMEA protocol indicates lines are terminated with CRLF?  This might
make a difference as if one read the message string without the LF, leaving
it in the buffer, the next line might be begun with the LF.  The relevant
line is #228 dcb.EvtChar = 13; /* CR */ // Should be 10;

 

                Also on win32_io.c, why is the is the Comm Mask set to watch
out for the CD line, in addition to the event flag?  If one just waits for
the event char, then he is sure of receiving a whole line.  If he waits for
the CD line, then a partial line or, worse, a line plus a partial line might
be read.  The relevant code begins at line #276 and is

 

/* watch out for CR (dcb.EvtChar) as well as the CD line */

      if (!SetCommMask(h, EV_RXFLAG | EV_RLSD)) {

            msyslog(LOG_ERR, "Device %s SetCommMask error: %m", windev);

            return 0;

      }

I left out the EV_RLSD and it works well in a clock simulator I wrote.

 

Charles Elliott

 




More information about the questions mailing list