Class: SGS::GPS
Instance Attribute Summary collapse
-
#cmg ⇒ Object
Returns the value of attribute cmg.
-
#location ⇒ Object
Returns the value of attribute location.
-
#magvar ⇒ Object
Returns the value of attribute magvar.
-
#sog ⇒ Object
Returns the value of attribute sog.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
-
.daemon ⇒ Object
Main daemon function (called from executable).
Instance Method Summary collapse
-
#initialize(lat = nil, long = nil) ⇒ GPS
constructor
A new instance of GPS.
-
#is_valid ⇒ Object
Set the validity.
-
#valid? ⇒ Boolean
Is the GPS data valid?.
Methods inherited from RedisBase
#count, #count_name, #load, load, #make_redis_name, #publish, redis, redis_handle, #redis_read_var, #save, #save_and_publish, setup, subscribe, to_redis, var_init
Constructor Details
#initialize(lat = nil, long = nil) ⇒ GPS
Returns a new instance of GPS.
39 40 41 42 43 44 45 46 47 |
# File 'lib/sgs/gps.rb', line 39 def initialize(lat = nil, long = nil) @time = Time.new(2000, 1, 1) @location = Location.new(lat, long) @sog = 0.0 @cmg = 0.0 @magvar = nil @valid = false super() end |
Instance Attribute Details
#cmg ⇒ Object
Returns the value of attribute cmg.
37 38 39 |
# File 'lib/sgs/gps.rb', line 37 def cmg @cmg end |
#location ⇒ Object
Returns the value of attribute location.
37 38 39 |
# File 'lib/sgs/gps.rb', line 37 def location @location end |
#magvar ⇒ Object
Returns the value of attribute magvar.
37 38 39 |
# File 'lib/sgs/gps.rb', line 37 def magvar @magvar end |
#sog ⇒ Object
Returns the value of attribute sog.
37 38 39 |
# File 'lib/sgs/gps.rb', line 37 def sog @sog end |
#time ⇒ Object
Returns the value of attribute time.
37 38 39 |
# File 'lib/sgs/gps.rb', line 37 def time @time end |
Class Method Details
.daemon ⇒ Object
Main daemon function (called from executable)
51 52 53 54 55 |
# File 'lib/sgs/gps.rb', line 51 def self.daemon loop do sleep 300 end end |
Instance Method Details
#is_valid ⇒ Object
Set the validity
59 60 61 |
# File 'lib/sgs/gps.rb', line 59 def is_valid @valid = true end |
#valid? ⇒ Boolean
Is the GPS data valid?
65 66 67 |
# File 'lib/sgs/gps.rb', line 65 def valid? @valid == true end |