gpsd2json 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61aaf077f1e5605afa404ee0b7639296273c1f43
4
- data.tar.gz: 219dccf5fe3dc81841c126362a9eba3ddb983baa
3
+ metadata.gz: 8c49bbcd7d99574f44023b3c45e21d72346e9de2
4
+ data.tar.gz: eebfbedc75d4be1fe44128467e6522dcc5c577fd
5
5
  SHA512:
6
- metadata.gz: 0dc9aadcfadb0779369fa5094ad951decb2d6deafbb93cb71e37c09868f333a665a8703f5b97e7b6a83741a417efe23cf78a1ff92331e74e02c3a9e78851608f
7
- data.tar.gz: 0ddb145d5046fa5d313a29d392253ce14d28868eb2a83d4f69f149aa0f811a2c4a0d2403047c8caeb65e1e0c8563707619ced218cc3fed8cbcc38be6a6a9ed45
6
+ metadata.gz: 4957c8ca9e23b93961553fe786efef10491c71a2d675148b2c1f16b2b168b0575f014b2adf06c80f3100529b3360461ead5feb65292c2ec161aae5f38ccb213a
7
+ data.tar.gz: b03b35c6c397e209064ddc6539491bc42eeec4764d91e2e4598c5fec15d2c58ad88a367b297c46dc9940acce7c7b3eec71f009e3d1bdc552a1bdceb26db8b510
data/README.md CHANGED
@@ -1,46 +1,79 @@
1
1
  # gpsd2json
2
2
  ruby client to receive JSON formatted info of the gps daemon
3
3
 
4
- ## initialization
4
+ ## Setup
5
+
6
+ Make sure you have gpsd installed and you have of course a gps connected to your device
5
7
  ```bash
8
+ # Install
9
+ sudo apt-get install gpsd
10
+ # Check if your gps is available
11
+ cgps
12
+ # Install the gps2json gem
13
+ gem install gps2json
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Start an irb session
19
+
20
+ ```bash
21
+ irb
6
22
  require 'gpsd2json'
7
23
  gps = GPSD2JSON.new()
8
24
  ```
9
- ## First you set some callbacks on the most important changes
25
+
26
+ Set the callbacks on the position and satellite change events
27
+
10
28
  ```bash
11
- gps.on_position_change { |pos| STDERR.puts pos.inpect }
29
+ gps.on_position_change { |pos| STDERR.puts "New position: #{pos.inpect}" }
12
30
  gps.on_satellites_change { |sats| STDERR.puts "#{sats.count} found, #{sats.count{|sat| sat['used']} are used" }
13
31
  ```
14
- ## Then, your start watching
32
+
33
+ Then, your start watching
34
+
15
35
  ```bash
16
36
  gps.start
17
37
  ```
18
- after this, the positions will be given to the callback block
19
38
 
20
- ## When you had enough, you can stop watching
39
+ If you have the gps connected you should get the satelites callback first.
40
+ It has to connect te the deamon and the deamon has to tell te gps to start
41
+ dumping the data if it did not do so already, but this should be all done
42
+ withing a second or so.
43
+
44
+ To get position change callbacks, the gps should have enough sattelites with
45
+ a fix and the speed should be higher then the minimum speed, which defaults to 0.
46
+
47
+
48
+ You can stop watching with
49
+
21
50
  ```bash
22
51
  gps.stop
23
52
  ```
24
53
 
25
- ## there is on more callback to receive all data as raw json
54
+ There is also a on_raw_data callback you can use to see all data that is dumped by the deamon
55
+
26
56
  ```bash
27
57
  gps.on_raw_data { |json| STDERR.puts json.inspect}
28
58
  ```
29
59
 
30
- ## Also, you can change the minimum speed requered to return a position change, with
60
+ You can change the minimum speed requered to return a position change, with
61
+
31
62
  ```bash
32
63
  gps.change_min_speed(speed: <whatever speed>)
33
64
  ```
34
65
 
35
- ## development
66
+ ## Development
67
+
36
68
  ```bash
37
69
  # Install
70
+ git clone git@github.com:mmolhoek/gpsd2json.git
71
+ cd gpsd2json
38
72
  bundle
39
73
  # irb
40
74
  bundle exec irb -r ./lib/gpsd2json.rb
41
- # test
75
+ # test (with coverage to ./coverage/index.html)
42
76
  bundle exec rspec --color -fd spec/gpsd_client_test.rb
43
77
  ```
44
- it also have a code coverage dir for you to see if your test set is about 95%
45
78
 
46
- send me PR if you want changes, but only dare to do so when you added the proper tests
79
+ Send me PR if you want changes, but only dare to do so when you added the proper tests and the overall coverage stays above 95%
@@ -25,7 +25,7 @@ class GPSD2JSON
25
25
  @port = port
26
26
  @trackthread = nil
27
27
  @socket_init_thread = nil
28
- @min_speed = 0.8 # speed needs to be higher than this to make the gps info count
28
+ @min_speed = 0 # speed needs to be higher than this to make the gps info count
29
29
  @last = nil #last gps info
30
30
  @sats = nil # last satellites info
31
31
  @json_raw_callback = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpsd2json
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
  - Mischa Molhoek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -110,7 +110,7 @@ extra_rdoc_files:
110
110
  files:
111
111
  - LICENSE
112
112
  - README.md
113
- - lib/gps2json.rb
113
+ - lib/gpsd2json.rb
114
114
  homepage: http://github.com/mmolhoek/gpsd2json
115
115
  licenses:
116
116
  - MIT