Created
September 21, 2018 05:40
-
-
Save psfleming/2d99d8709db767611cdde5cae4c4a45d to your computer and use it in GitHub Desktop.
FT8Call Ruby API Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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