ld3w 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ld3w.rb +21 -14
- 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: 60c0844784389da099e185e17e0c256770a0accc
|
4
|
+
data.tar.gz: 9ebc33894fe59c20cf5c49d119032cc3a9d79d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 399d5e0c9a64155e6419a9f975dfcabf28f7ecd28d399aa9a1e5ece9a2023eb1220f5d674ba2c031bc6e85f670e9c7026045d361c5c41d807b8de336d1d7b391
|
7
|
+
data.tar.gz: 1bf1c0c3db1e9e6aae375743a634eb2786b6cafae31cbb8e7fbaf546fc614aa926e38206b1f8c8ba5ec7fd7eeca0b114cfd59a4771a8a697e73d7d71a0667a00
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ld3w.rb
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|
require 'nmea_parser'
|
7
7
|
|
8
|
+
class Ld3wError < ErrorException
|
9
|
+
end
|
10
|
+
|
8
11
|
class Ld3w
|
9
12
|
|
10
13
|
|
@@ -14,21 +17,24 @@ class Ld3w
|
|
14
17
|
@file = '/dev/' + device
|
15
18
|
@np = NMEAParser.new
|
16
19
|
@affirmations = affirmations
|
20
|
+
@device = device
|
17
21
|
|
18
22
|
end
|
19
23
|
|
20
24
|
def locate()
|
21
25
|
|
22
26
|
line = ''
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
lines = []
|
28
|
+
|
29
|
+
IO.popen @command, autoclose: true do |io|
|
30
|
+
|
31
|
+
sleep 2
|
32
|
+
t = Time.now
|
33
|
+
|
34
|
+
(sleep 1; puts 'waiting ...') until File.exists?(@file) or
|
35
|
+
Time.now > (t + 10)
|
36
|
+
|
37
|
+
raise(Ld3wError, 'Cannot open file ' + @file) unless File.exists? @file
|
32
38
|
|
33
39
|
# get the data from the file
|
34
40
|
|
@@ -41,21 +47,22 @@ class Ld3w
|
|
41
47
|
c = x.split(',').count('')
|
42
48
|
|
43
49
|
if x =~ pattern and c <= 2 then
|
44
|
-
|
50
|
+
lines << x
|
45
51
|
line_count > @affirmations ? break : line_count += 1
|
46
52
|
end
|
53
|
+
sleep 0.05
|
47
54
|
end
|
48
55
|
|
49
56
|
puts 'bye'
|
50
|
-
Process.kill('
|
57
|
+
Process.kill('INT', io.pid)
|
51
58
|
|
52
59
|
end
|
53
|
-
|
54
|
-
@
|
60
|
+
|
61
|
+
#`rfcomm release #{@device}`
|
62
|
+
@np.parse(lines.last)
|
55
63
|
@np
|
56
64
|
|
57
65
|
|
58
66
|
end
|
59
67
|
|
60
68
|
end
|
61
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld3w
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
zNny3vatsFpBZYhgzFmjZhhztDhFFHmRS0GOEeH2GOaeZx61e6R+5ZDhGKvP2vXa
|
32
32
|
bG6X0NTTKzK8kg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-06-
|
34
|
+
date: 2017-06-24 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
|