Skip to content

Instantly share code, notes, and snippets.

@psfleming
Created September 21, 2018 05:40
Show Gist options
  • Save psfleming/2d99d8709db767611cdde5cae4c4a45d to your computer and use it in GitHub Desktop.
Save psfleming/2d99d8709db767611cdde5cae4c4a45d to your computer and use it in GitHub Desktop.
FT8Call Ruby API Test
require 'gpsd_client'
require 'maidenhead'
require 'socket'
require 'json'
gpsd = GpsdClient::Gpsd.new()
gpsd.start()
if gpsd.started?
pos = gpsd.get_position
maid = Maidenhead.to_maidenhead(pos[:lat], pos[:lon], precision = 5)
u1 = UDPSocket.new
u1.connect("127.0.0.1", 34903)
msg = {:type => "STATION.SET_GRID", :value => maid}
u1.send msg.to_json, 0
puts "sending: #{msg.to_json}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment