[aprssig] APRS data via perl-to-tnc

Alex Carver kf4lvz at yahoo.com
Mon Oct 3 15:58:27 EDT 2011


> From: Arnie Shore 
> 
> Re "What ya trying to achieve"  I want to get an APRS
> data stream from some
> arbitrary station onto our CAD's MySQL db.
> 
> Currently, we pull a given station's data from aprs.fi
> despite that
> station's sitting maybe six feet away. An ARES/RACES team
> user has asked me
> to look into avoiding the latency and error-proneness
> inherent to the long
> path.  (Agreed that we shudda done that years ago!)
> 
> The CAD's in PHP, which hasn't much in the way of serial
> port handling
> capabilities in most of its installs, anyway.  I see


You didn't specify the OS upon which PHP is running.

PHP can open any port on a Unix system using the file I/O routines but the baud rate would be fixed to whatever the port is set for at the time.  You may be able to get around this by invoking stty via a system() call prior to opening the port.  I haven't tried it, however, so you'd have to experiment.  On Windows, you can still use the file I/O routines if you have PHP running inside an environment like Cygwin which will remap serial ports to the Unix style /dev/ttySn files.

There is a class available for PHP called PHP-serial which will get you more functionality although it won't read data in Windows right now. http://code.google.com/p/php-serial/

A third method would be to use socat as a helper application.  Socat can connect a TCP/IP socket to a serial port for read/write access.  Then you'd use PHP's socket functions to read and write data from there.  I actually use socat to bring a TNC plugged into a Windows machine over to a Linux system for use with Xastir.  I'm actually able to create a sniffer of sorts this way.  Xastir gets read/write access to the TNC but a separate terminal window has read-only access to let me watch the TNC data flow by.

> some perl examples of
> that, and one lister has described that interface as
> trivial.  And, HH has
> just shared some information re sources.  So, a Perl
> interface makes some
> sense here.
> 
> (Frankly, it sounds easily-enough done, but at the
> moment  I don't have a
> suitable receiver/tnc to play with, so I'm bothering you
> all here for some
> confirmation.)
> 
> The endgame has us adding a smallish Perl script to our CAD
> distribution to
> do so.





More information about the aprssig mailing list