gpsd_client 0.0.1 → 0.0.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.
- data/README.md +28 -3
- data/lib/.gitignore +2 -0
- data/lib/gpsd_client.rb +2 -3
- data/lib/gpsd_client/version.rb +1 -1
- metadata +4 -2
data/README.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
# GpsdClient
|
2
2
|
|
3
|
-
|
3
|
+
A simple GPSd client intended for use on the Raspberry Pi.
|
4
4
|
|
5
|
-
|
5
|
+
Actually only implements new(options = {}), start(), stop(), and get_position() which are just a few but very simple methods.
|
6
|
+
(See Usage)
|
7
|
+
|
8
|
+
|
9
|
+
* Next days will fix some non fatal bugs. (like actually closing the socket on stop())
|
10
|
+
* Next version will implement fix_status(), time(), speed() and altitude().
|
11
|
+
* Next Next will clean-up the code.
|
12
|
+
* The Next after the Next-Next will add some documentation.
|
13
|
+
|
14
|
+
Stay Tuned!
|
6
15
|
|
7
16
|
## Installation
|
8
17
|
|
@@ -22,7 +31,23 @@ Or install it yourself as:
|
|
22
31
|
|
23
32
|
## Usage
|
24
33
|
|
25
|
-
|
34
|
+
```ruby
|
35
|
+
# you can specify the host and port for remotes machines or different ports
|
36
|
+
# ...or not. (defaults to "localhost", 2947)
|
37
|
+
|
38
|
+
# gpsd = GpsdClient::Gpsd.new({:host => "nameofthehost", :port => 2947})
|
39
|
+
gpsd = GpsdClient::Gpsd.new()
|
40
|
+
gpsd.start()
|
41
|
+
|
42
|
+
if gpsd.started?
|
43
|
+
pos = gpsd.get_position
|
44
|
+
# => {:lat => xx, :lon => xx}
|
45
|
+
end
|
46
|
+
|
47
|
+
# To stop polling the daemon
|
48
|
+
gpsd.stop()
|
49
|
+
# Actually Gpsd.stop() doesn't close the connection socket (to be fixed)
|
50
|
+
```
|
26
51
|
|
27
52
|
## Development
|
28
53
|
|
data/lib/.gitignore
ADDED
data/lib/gpsd_client.rb
CHANGED
@@ -60,14 +60,13 @@ module GpsdClient
|
|
60
60
|
# http://www.catb.org/gpsd/client-howto.html
|
61
61
|
# mode 1 means no valid data
|
62
62
|
# return "Lat: #{line['lat'].to_s}, Lon: #{line['lon'].to_s}" unless line['mode'] == 1
|
63
|
-
return {lat: line['lat'], lon: line['lon']} unless line['mode'] == 1
|
63
|
+
return {lat: line['lat'], lon: line['lon'], time: line['time'], speed: line['speed'], altitude: line['alt']} unless line['mode'] == 1
|
64
64
|
end
|
65
65
|
|
66
66
|
reads = reads + 1
|
67
67
|
|
68
68
|
end
|
69
|
-
|
70
|
-
return {lat: nil, lon: nil}
|
69
|
+
return {lat: nil, lon: nil, time: nil, speed: nil, altitude: nil } unless line['mode'] == 1
|
71
70
|
end
|
72
71
|
|
73
72
|
private
|
data/lib/gpsd_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpsd_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -74,7 +74,9 @@ files:
|
|
74
74
|
- Rakefile
|
75
75
|
- bin/console
|
76
76
|
- bin/setup
|
77
|
+
- gpsd_client-0.0.2.gem
|
77
78
|
- gpsd_client.gemspec
|
79
|
+
- lib/.gitignore
|
78
80
|
- lib/gpsd_client.rb
|
79
81
|
- lib/gpsd_client/version.rb
|
80
82
|
homepage: https://github.com/rccursach/gpsd_client
|