#!/usr/bin/perl # # Copyright (C) 2003 Tyler Allison # Version 1.0 : Released July 8, 2003 # # (see the files README and COPYING in the wx200d distro for more details.) # (wx200d can be obtained from http://wx200d.sourceforge.net) # # This script sends data to the Civilian Weather Observers Program by # using the --aprs option to the wx200 client located in the wx200d server # software (http://wx200d.sourceforge.net) # # What you need: # 1. Internet connectivity # 2. A working weather station that is plugged into a wx200d server. # 3. A CWOP callsign (http://www.findu.com/citizenweather/signup.html) # To signup you need # 3a. Your name # 3b. Your email # 3c. Nearby Town # 3d. Your address (including zip) # 3e. Elevation in meters above sea level # 4. Your Lon/Lat in DDMM.HH format # If you dont know your Lon/Lat, or you want to double check, use # http://www.geocode.com/modules.php?name=TestDrive_Eagle # You type in your street address and it gives you your Lon/Lat in # DD:MM:SS format. You can convert this to DDMM.HH format like so... # geocode.com says: 39:01:10.006N # it becomes: 3901.??N # since geocode provides SS not HH we need to convert seconds to # hundreds of seconds by 1.66*SS (so 1.66*10.006=16) # it becomes: 3901.16N # You should have converted two numbers. The Lat and Lon. # 5. Your system time syncing off a known good NTP service. If your # system has the wrong time when it submits data the data will # reported for the wrong time period. Bad! # # This script takes the information you provide (Lon/lat/callsign/etc), # combines that with what wx200 prints out and then ships it off to # the CWOP by connecting to the telnet port of the $cwop_host and spewing # out lines in a specified format. # # APRS packet format # http://pond1.gladstonefamily.net:8080/aprswxnet.html # # Run this program as a cron entry like so: # # 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/cwop > /dev/null # # !!!EDIT THE FOLLOWING TO MATCH YOUR INSTALLTION AND INFORMATION!!! # my $cmd = '/usr/local/bin/wx200 --aprs'; my $lon ="3901.16N"; my $lat ="08443.15W"; my $callsign = "CWBOGUS"; my $cwop_host = "ahubwest.net"; # # !!! NO EDIT BELOW THIS LINE REQUIRED !!! # my $aprs_net; my $aprs_data; my $iaddr; my $paddr; my $proto; my $a; use POSIX qw(strftime); use Socket; use strict; my $dateutc = strftime "%H%M%Sz", gmtime time; open PIPE, "$cmd |" or die "$0: can't pipe from $cmd: $!\n"; while () { # each line of data chomp; $aprs_net = "user $callsign pass -1 vers wx200d .01\n"; $aprs_data = "$callsign\>APRS,TCPIP*:\@$dateutc$lon/$lat\_$_"; $iaddr = inet_aton($cwop_host) or die "no host: $cwop_host"; $paddr = sockaddr_in('23',$iaddr); $proto = getprotobyname('tcp'); socket(S, PF_INET,SOCK_STREAM,$proto) or die "socket: $!"; connect(S,$paddr) or die "connect: $!"; select(S); $| = 1; select(STDOUT); $a=;print "$a"; print S "$aprs_net\r\n$aprs_data\r\n"; $a=;print "$a"; close(S); } exit;