DenaliHardtail
DenaliHardtail

Reputation: 28306

How can i emulate streaming data from a serial port?

I have a text file containing NMEA (GPS) data that I' like to replay to a COM port so the application I'm building can read it.

I considered writing a quick C# console app to loop over the file but I don't have any COM ports. This appraoch would require a virtual COM port and I'm not sure what challenges that would entail.

I also looked at GPSGate. Nice product but it doesn't seem to replay NMEA files over one of its virtual com ports.

How can I stream an existing text file to simulate GPS over a serial connection? I prefer a serial port, rather than mocking, to avoid reworking the application I'm developing and to facilitate use with other applications that use GPS over serial ports for which we don't have source code.

Update 1 - I downloaded a trial version of Virtual Serial Port Driver by Eltima and within a few minutes had some C# code writing to a serial port and appearing in Termite. Yes, it works but $100 seems excessive for what I'm trying to accomplish. Open source or free commercial would be preferred.

Upvotes: 2

Views: 3713

Answers (2)

woodwa
woodwa

Reputation: 101

You need a virtual serial port such as: http://sourceforge.net/projects/com0com/

and a hyper terminal replacement.. in XP and earlier it was very easy with the shipped copy of hyperterminal as mentioned bellow..

You set up a virtual null modem connection

  • Null modem has a COM4 to COM5 Connection established as Null modem std gps is 4800Baud
  • Hyperterminal to COM5
  • Application to COM4

Copy paste your NMEA Values into Hyperterminal this isn't 1Hz like GPS though.. to enable 1Hz(or 1 line per second) you will need to find a different application than hyperterminal to send the messages at 1 second increments.

Upvotes: 0

Nodak
Nodak

Reputation: 979

gpsfake is part of the gpsd project

gpsfake is a test harness for gpsd and its clients. It opens a pty (pseudo-TTY), launches a gpsd instance that thinks the slave side of the pty is its GPS device, and repeatedly feeds the contents of one or more test logfiles through the master side to the GPS. If there are multiple logfiles, sentences from them are interleaved in the order the files are specified.

You can port the output to a virtual serial via /usr/bin/gpspipe -r | socat - PTY,link=/tmp/gpsd.pty,raw using gpspipe, also from the gpsd project, to be picked up however you choose.

It is POSIX compliant.

Upvotes: 4

Related Questions