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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7cf834c9fd4965f0c1b3f13a4c43535f09eec5a
4
- data.tar.gz: f680d77a1081a32dd6658d15f764a0b690e3fcc7
3
+ metadata.gz: 39953a9e0ac3a393f6eb614db1cdbef190030593
4
+ data.tar.gz: a54a4d28a0c01d8d61cdc25fe3f5171f23bc82c2
5
5
  SHA512:
6
- metadata.gz: 9204ff8ed73f0e8357c05d06c22818880b52698be7e8662ab8aaf5b8cd838ac052c2a613ddc0643f3bba4aa733bc2d75e02a19fb8ad35a23c29dc122635575ff
7
- data.tar.gz: 04226a3063ba2d0c592d6acdbb3c0336ad85b112696b99240088c55f16e3f2337e1766697264b01cc95335312dde3f190a9018fe3707a510180fbddca5180f46
6
+ metadata.gz: e78fb1a2984bff8bbf88640e3e5cc4ed2f12ef4675ae95c4abb0fcdb83b5b3c389a39dc65396ab96e34f302b644589f73d17290795a51394b150cc1fd607b06b
7
+ data.tar.gz: 2af71c3e6120e00e735c1b174555616daf646324626b95018219238d3a46b113454095b9bb02d4c23f9a6c3e69f423abb67ab42a2b8c2737de5b76f368b4c75b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- @baud_rate = baud_rate
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.scrub)) until s =~ /^\$GPGGA/
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
- sp.close
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.0
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-05 00:00:00.000000000 Z
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