Class: GPS_PVT::SUPL_Client
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
Instance Method Summary collapse
- #get_assisted_data ⇒ Object
-
#initialize(host, opts = {}) ⇒ SUPL_Client
constructor
A new instance of SUPL_Client.
Constructor Details
#initialize(host, opts = {}) ⇒ SUPL_Client
Returns a new instance of SUPL_Client.
13 14 15 16 17 18 19 20 21 |
# File 'lib/gps_pvt/supl.rb', line 13 def initialize(host, opts = {}) @host = host @opts = { :port => 7275, :debug => 0, :protocol => [:lpp, :rrlp], :req_data => [:ephemeris], # :almanac }.merge(opts) end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
11 12 13 |
# File 'lib/gps_pvt/supl.rb', line 11 def opts @opts end |
Instance Method Details
#get_assisted_data ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gps_pvt/supl.rb', line 23 def get_assisted_data begin @socket = TCPSocket::new(@host, @opts[:port]) if @opts[:port] == 7275 then @socket = OpenSSL::SSL::SSLSocket::new(@socket) @socket.connect end send_supl_start recv_supl_response send_supl_pos_init recv_supl_pos ensure @socket.close unless @socket.closed? end end |