[Xastir] How to get CWOP weather on APRS network

Tom Russo russo at bogodyn.org
Thu Jan 20 10:49:49 PST 2022


Resurrecting an ancient thread, because Dj opened an issue on GitHub about it
this week, and I tracked down what is happening here.  I'm following up to
the original thread to clear up the misunderstanding and get the answer into
the mailing list archive where it could presumably be found in web searches.

Dj had Xastir and WeeWx's APRS extension working, but only by modifying
main.c.

The reason for the suggested mods of main.c in the message I'm replying to
is to work around some mistaken usage of xastir_udp_client, which I think
may have been the result of some incomplete  (or perhaps overly vague) 
documentation.

xastir_udp_client does NOT insert the packet header "FROMCALL>TOCALL:" into
the data passed to it on the command line, it does a straight insersion of
the data passed to it directly into Xastir's incoming packet stream.  And so
one MUST include "FROMCALL>TOCALL:" at the beginning of the packet oneself.
Some other APRS tools for injecting packets do this for you, but 
xastir_udp_client does not.

Once injected, Xastir creates a third-party packet out of the data.  Third 
party packets look like "xastircall>APX219,PATH1,PATH2...:}tpcall>tocall:..."
where "xastircall" is the call sign of the Xastir instance and "tpcall" is the 
call sign of the third party station (which may be the same as Xastir's).  
When properly formatted, these packets show up in APRS clients (including web
based ones like aprs.fi) as being from tpcall.

The main.c changes Dj mentions here basically break the third-party insertion 
and mask the fact that he's left out the packet header in what he's passed to
xastir_udp_client.  The fact that he was leaving out "tpcall>tocall:" was
why his packets were being flagged as invalid without those
modifications (the stuff after the "}" was incomplete).

Once that usage error is corrected, Xastir should be able to take WeeWx's data
just fine.  So the script to do the insertion would be:

 #!/bin/bash
 #
 weatherpacket=`cat /dev/shm/aprs.pkt`
 /usr/local/xastir/bin/xastir_udp_client localhost 2023 YOURCALL XXXX -to_rf
 "YOURCALL>APX219:$weatherpacket"


with the obvious modification to make it correct for your call sign.  This 
will work with Xastir unmodified, and is as xastir_udp_client was meant
to be invoked.

I have examined the xastir_udp_client man page and found it to leave too much
to interpretation.  I edited it and added more notes about how it really works
so that perhaps it will be easier for others to grok in the future.  If anyone
still finds it confusing, I can modify it further.
    
On Sat, Oct 31, 2020 at 08:30:18PM -0400, we recorded a bogon-computron collision of the <xastir at deej.net> flavor, containing:
> On 10/30/2020 1:07 AM, Steven Morrison wrote:
> > I can configure the WeeWx program to generate a report and send it to the
> xastir Pi, but how can i receive that report and transmit it in xastir?
> 
> 
> I'm doing it as follows in Linux (Raspberry Pi) with both WeeWx and Xastir
> running on the same RPi, but you could easily rsync the /dev/shm/aprs.kpt
> file to a different computer if needed.
> 
> I have the APRS extension loaded into WeeWx
> (https://github.com/cavedon/weewx-aprs).
> 
> In /etc/weewx/weewx.conf I have:
> 
> # Options for extension 'aprs'
> [APRS]
>     comment = "RaspberryPi-Xastir-Wx-Topsham,ME"
>     include_position = 1
>     symbol_code = _
>     symbol_table = /
>     output_filename = /dev/shm/aprs.pkt
> 
> 
> Then I have a crontab entry that does:
> 
> 01,11,21,31,41,51 * * * * /home/xastir/scripts/send-weather-rf.sh >
> /dev/null
> 
> 
> and the send-weather-rf.sh script looks like (XXXX is my 4 digit APRS code):
> 
> #!/bin/bash
> #
> weatherpacket=`cat /dev/shm/aprs.pkt`
> /usr/local/xastir/bin/xastir_udp_client localhost 2023 N1JOV XXXX -to_rf
> $weatherpacket
> 
> 
> I am using an older version of Xastar (2.1.1) compiled from source code, and
> had to make the following change in main.c to make the xastir_udp_client
> command work for the above.  I do not know if this still needs to be done in
> later versions.
> 
> main.c is my custom version, main.c.orig is the original.
> 
> $ diff main.c main.c.orig
> 12180,12183c12180,12183
> < //                            char path[100+1];
> < //                            char info[100+1];
> < //                            char *path0 = NULL;
> < //                            char *info0 = NULL;
> ---
> >                             char path[100+1];
> >                             char info[100+1];
> >                             char *path0 = NULL;
> >                             char *info0 = NULL;
> 12187,12188c12187,12188
> < //                            path0 = strtok(line,":");   // Pointer to
> start of path
> < //                            info0 = strtok(NULL,"");    // Pointer to
> information field
> ---
> >                             path0 = strtok(line,":");   // Pointer to
> start of path
> >                             info0 = strtok(NULL,"");    // Pointer to
> information field
> 12190,12197c12190,12196
> < //                            xastir_snprintf(path, sizeof(path), "%s",
> path0);
> < //                            xastir_snprintf(info, sizeof(info), "%s",
> info0);
> < //                            //fprintf(stderr, "path: %s\n", path);
> < //                            //fprintf(stderr, "info: %s\n", info);
> < //                            //fprintf(stderr, "line: %s\n", line);
> < //                            xastir_snprintf(line, sizeof(line),
> "%s%s%s", path, ",NOGATE:", info);
> < //                            xastir_snprintf(line, sizeof(line),
> "%s%s%s", path);
> < //                            //fprintf(stderr, "line: %s\n", line);
> ---
> >                             xastir_snprintf(path, sizeof(path), "%s",
> path0);
> >                             xastir_snprintf(info, sizeof(info), "%s",
> info0);
> >                             //fprintf(stderr, "path: %s\n", path);
> >                             //fprintf(stderr, "info: %s\n", info);
> >                             //fprintf(stderr, "line: %s\n", line);
> >                             xastir_snprintf(line, sizeof(line), "%s%s%s",
> path, ",NOGATE:", info);
> >                             //fprintf(stderr, "line: %s\n", line);
> 12239c12238
> < // *(line + line_offset - 1) = '}';
> ---
> > *(line + line_offset - 1) = '}';
> 12242,12243c12241
> < //                                (char *)(line + line_offset - 1),  //
> Raw data line
> <                                 (char *)(line + line_offset), // Raw data
> line
> ---
> >                                 (char *)(line + line_offset - 1),  // Raw
> data line
> 
> 
> -Dj
> 
> 
> -- 
> Dj Merrill - N1JOV - EAA Chapter 87
> Currently Flying: Glastar
> Previously: Cessna 150 - Glasair 1 FT - Grumman AA1B
> 
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir

-- 
Tom Russo    KM5VY
Tijeras, NM  

 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]



More information about the Xastir mailing list