Class: PostRunner::EPO_Downloader
- Inherits:
-
Object
- Object
- PostRunner::EPO_Downloader
- Defined in:
- lib/postrunner/EPO_Downloader.rb
Overview
This class can download the current set of Extended Prediction Orbit data for GPS satellites and store them in the EPO.BIN file format. Some Garmin devices pick up this file under GARMIN/GARMIN/REMOTESW/EPO.BIN.
Constant Summary collapse
- @@URI =
URI('http://omt.garmin.com/Rce/ProtobufApi/EphemerisService/GetEphemerisData')
- @@POST_DATA =
This is the payload of the POST request. It was taken from www.kluenter.de/garmin-ephemeris-files-and-linux/. It may contain a product ID or serial number.
"\n-\n\aexpress\u0012\u0005de_DE\u001A\aWindows\"\u0012601 Service Pack 1\u0012\n\b\x8C\xB4\x93\xB8\u000E\u0012\u0000\u0018\u0000\u0018\u001C\"\u0000"
- @@HEADER =
{ 'Garmin-Client-Name' => 'CoreService', 'Content-Type' => 'application/octet-stream', 'Content-Length' => '63' }
Instance Method Summary collapse
-
#download(output_file) ⇒ Object
Download the current EPO data from the Garmin server and write it into the specified output file.
-
#initialize ⇒ EPO_Downloader
constructor
Create an EPO_Downloader object.
Constructor Details
#initialize ⇒ EPO_Downloader
Create an EPO_Downloader object.
35 36 37 38 39 |
# File 'lib/postrunner/EPO_Downloader.rb', line 35 def initialize @http = Net::HTTP.new(@@URI.host, @@URI.port) @request = Net::HTTP::Post.new(@@URI.path, initheader = @@HEADER) @request.body = @@POST_DATA end |
Instance Method Details
#download(output_file) ⇒ Object
Download the current EPO data from the Garmin server and write it into the specified output file.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/postrunner/EPO_Downloader.rb', line 45 def download(output_file) return false unless (epo = get_epo_from_server) return false unless (epo = fix(epo)) return false unless check_epo_data(epo) write_file(output_file, epo) Log.info "Extended Prediction Orbit (EPO) data has been downloaded " + "from Garmin site." true end |