My APRS-related pages begin here!
I have a Kenwood TH-D7 transceiver, APRS equipped.
Problem: how can I get station positions heard by TH-D7? (for example, to be used for display mapping on a chart).
Solution: use the small Ruby program below.
Preparation:
Note:
Normal output example:
5 2009-02-07 00:53:34 41:05'51"N 014:46'69"E IW8ZZZ-11
6 2009-02-07 00:55:18 40:41'24"N 014:28'16"E IZ8ZZZ
7 2009-02-07 00:59:14 40:48'64"N 014:21'43"E IK8ZZZ-7
...
Final statistics output example:
13 stations:
IZ8ZZZ
total packets: 3
first packet on: 2009-02-06 23:55:17
last packet on: 2009-02-06 23:59:16
last different known positions:
2009-02-06 23:57:16: 40:41'24"N 014:28'16"E
2009-02-06 23:59:16: 40:41'22"N 014:23'52"E
...
The script I used to parse the GPS POI (point of interest)
strings coming from the TH-D7:
#!/usr/bin/env ruby
def estra p
"#{p[0..1]}:#{p[2..3]}'#{p[5..6]}\""
end
n,chi,qua,ore,pri = 0,{},{},{},{}
while s=gets
x,t = s.split(/,/), Time.now.strftime("%Y-%m-%d %H:%M:%S")
poi = x.last.split("*").first
sta = poi.split("-").first.strip
pos = "#{estra(x[1])}#{x[2]} #{x[3][0].chr}#{estra(x[3][1..-1])}#{x[4]}"
unless chi.has_key?(sta) # se mai sentito prima:
chi[sta] = t # ricordiamoci il primo orario che e' stato sentito
qua[sta] = 0
pri[sta] = {} # inizializziamo la lista delle posizioni
end
ore[sta] = t # timestamp ultima volta che e' stato sentito
qua[sta] += 1
pri[sta][pos] = t # a che ora e' stato visto l'ultima volta li'
n += 1
print "%5d " % n
puts "#{t} #{pos} #{poi}"
break if File::exists?("/tmp/stop")
end
puts "#{chi.size} stations:"
puts
chi.each do |sta, t|
puts "#{sta}"
puts " total packets: #{qua[sta]}"
puts " first packet on: #{t}"
puts " last packet on: #{ore[sta]}"
puts " last different known positions:"
pri[sta].each do |p, t|
puts " #{t}: #{p}"
end
puts
end