serialport_gps 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/serialport_gps.rb +9 -17
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39953a9e0ac3a393f6eb614db1cdbef190030593
|
4
|
+
data.tar.gz: a54a4d28a0c01d8d61cdc25fe3f5171f23bc82c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e78fb1a2984bff8bbf88640e3e5cc4ed2f12ef4675ae95c4abb0fcdb83b5b3c389a39dc65396ab96e34f302b644589f73d17290795a51394b150cc1fd607b06b
|
7
|
+
data.tar.gz: 2af71c3e6120e00e735c1b174555616daf646324626b95018219238d3a46b113454095b9bb02d4c23f9a6c3e69f423abb67ab42a2b8c2737de5b76f368b4c75b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/serialport_gps.rb
CHANGED
@@ -6,6 +6,7 @@ require 'nmea_parser'
|
|
6
6
|
require 'run_every'
|
7
7
|
require 'serialport'
|
8
8
|
|
9
|
+
|
9
10
|
class SerialPortGPS
|
10
11
|
|
11
12
|
attr_reader :time, :latitude, :longitude, :to_h
|
@@ -22,19 +23,14 @@ class SerialPortGPS
|
|
22
23
|
@callback = callback
|
23
24
|
|
24
25
|
#params for serial port
|
25
|
-
@port = port
|
26
|
-
|
27
|
-
@data_bits = 8
|
28
|
-
@stop_bits = 1
|
29
|
-
@parity = SerialPort::NONE
|
30
|
-
|
26
|
+
@port, @baud_rate, @data_bits, @stop_bits, @parity = port, baud_rate,
|
27
|
+
8, 1, SerialPort::NONE
|
31
28
|
@np = NMEAParser.new
|
32
29
|
end
|
33
30
|
|
34
31
|
def start
|
35
32
|
|
36
33
|
@running = true
|
37
|
-
#sp = @sp
|
38
34
|
|
39
35
|
RunEvery.new(seconds: @refresh_rate) do
|
40
36
|
|
@@ -46,26 +42,22 @@ class SerialPortGPS
|
|
46
42
|
sleep 4
|
47
43
|
s = ''
|
48
44
|
|
49
|
-
(s = sp.gets; @np.parse(s
|
45
|
+
(s = sp.gets.scrub; @np.parse(s)) until s =~ /^\$GPGGA/
|
46
|
+
sp.close
|
50
47
|
|
51
48
|
rescue
|
52
|
-
puts 'warning: ' +($!).inspect
|
49
|
+
puts 'warning: ' + ($!).inspect
|
53
50
|
retry
|
54
51
|
end
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
@time, @latitude, @longitude = @np.time, @np.latitude, @np.longitude
|
59
|
-
@to_h = @np.to_h
|
53
|
+
@time, @latitude, @longitude, @to_h = @np.time, @np.latitude,
|
54
|
+
@np.longitude, @np.to_h
|
60
55
|
@callback.call
|
61
56
|
end
|
62
57
|
end
|
63
58
|
|
64
|
-
|
65
59
|
def stop()
|
66
|
-
|
67
60
|
@running = false
|
68
|
-
|
69
61
|
end
|
70
62
|
|
71
63
|
end
|
@@ -74,4 +66,4 @@ if __FILE__ == $0 then
|
|
74
66
|
|
75
67
|
gps = SerialPortGPS.new
|
76
68
|
gps.start
|
77
|
-
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialport_gps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
ewjgWJOdFqxFejbi9KWKC5p41B61CLUVpBaNg+MMy6q1GwkifCJIdi2tKu5b/O0K
|
32
32
|
Z4KfhyVeTsL078HV
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-07-
|
34
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nmea_parser
|
metadata.gz.sig
CHANGED
Binary file
|