Class: GPS_PVT::SUPL_Client

Inherits:
Object
  • Object
show all
Includes:
UPL
Defined in:
lib/gps_pvt/supl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, opts = {}) ⇒ SUPL_Client

Returns a new instance of SUPL_Client.



13
14
15
16
17
18
19
20
# File 'lib/gps_pvt/supl.rb', line 13

def initialize(host, opts = {})
  @host = host
  @opts = {
    :port => 7275,
    :debug => 0,
    :protocol => [:lpp, :rrlp],
  }.merge(opts)
end

Instance Attribute Details

#optsObject

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_dataObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gps_pvt/supl.rb', line 22

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