ogn_client-ruby 0.2.3 → 0.2.5
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +93 -79
- data/README.md +42 -25
- data/exe/ogn2geojson +89 -0
- data/exe/ogn2kml +87 -92
- data/lib/ogn_client/version.rb +1 -1
- data.tar.gz.sig +2 -0
- metadata +81 -41
- metadata.gz.sig +0 -0
- data/.code_climate.yml +0 -14
- data/.editorconfig +0 -12
- data/.gitignore +0 -10
- data/.ruby-version +0 -1
- data/.travis.yml +0 -7
- data/Gemfile +0 -9
- data/Guardfile +0 -7
- data/Rakefile +0 -13
- data/bin/console +0 -10
- data/bin/setup +0 -7
- data/ogn_client-ruby.gemspec +0 -29
- data/tasks/test.rake +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: eb15fb964225bbe71a8ed8a69e6b2787b62fbf3cbbf70abd3a6d8b7b51092abb
|
|
4
|
+
data.tar.gz: 91b768c27573bd84da400f2ab6bb6692f646d1b767eb05c6ee629fa5d445ec26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8f2004a739e3f1fb6c0580591d82141361f055707fb7a6e09f40ab22e8f3566378f08b4746d25f3f653b17da42a91ca6c6f7c52b4a88e54c0db17895abc750a
|
|
7
|
+
data.tar.gz: 72ca00d255bffdddf3e0b81694f2d29531df31a906cffefe6e6d5d8c4e9594aed7ff116674a0f2944e13549c9e7f8f21a119f56b19b3ff922c7c2cd772effeec
|
checksums.yaml.gz.sig
ADDED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,99 +1,113 @@
|
|
|
1
|
+
## Main
|
|
2
|
+
|
|
3
|
+
Nothing so far
|
|
4
|
+
|
|
5
|
+
## 0.2.5
|
|
6
|
+
|
|
7
|
+
* skip live tests by default
|
|
8
|
+
* update certificate
|
|
9
|
+
|
|
10
|
+
## 0.2.4
|
|
11
|
+
|
|
12
|
+
* add ogn2geojson
|
|
13
|
+
* sign gem and add checksums
|
|
14
|
+
|
|
1
15
|
## 0.2.3
|
|
2
16
|
|
|
3
|
-
|
|
4
|
-
|
|
17
|
+
* add support for explicit message date
|
|
18
|
+
* fix ogn2kml for larger tracks
|
|
5
19
|
|
|
6
20
|
## 0.2.2
|
|
7
21
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
* add example executables
|
|
23
|
+
* ognlogd
|
|
24
|
+
* ogn2kml
|
|
11
25
|
|
|
12
26
|
## 0.2.0
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
* support for receiver versions <= 0.2.6
|
|
29
|
+
* renamed `Sender` to `SenderBeacon`
|
|
30
|
+
* devided `Receiver` to `ReceiverBeacon` and `ReceiverStatus`
|
|
31
|
+
* `ReceiverStatus` is *not* available for receiver versions < 0.2.6
|
|
18
32
|
|
|
19
33
|
## 0.1.3
|
|
20
34
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
* renamed sender and receiver attributes
|
|
36
|
+
* `Sender#signal` -> `Sender#signal_quality`
|
|
37
|
+
* `Sender#power` -> `Sender#signal_power`
|
|
38
|
+
* `Receiver#signal` -> `Receiver#signal_quality`
|
|
39
|
+
* `Receiver#senders_signal` -> `Receiver#senders_signal_quality`
|
|
40
|
+
* `Receiver#good_senders_signal` -> `Receiver#good_senders_signal_quality`
|
|
27
41
|
|
|
28
42
|
## 0.1.2
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
* support for receiver versions <= 0.2.5
|
|
45
|
+
* faster message parsing
|
|
46
|
+
* new sender and receiver attributes
|
|
47
|
+
* `Sender#power`
|
|
48
|
+
* `Receiver#voltage`
|
|
49
|
+
* `Receiver#amperage`
|
|
50
|
+
* `Receiver#senders`
|
|
51
|
+
* `Receiver#senders_visible`
|
|
52
|
+
* `Receiver#senders_invisible`
|
|
53
|
+
* `Receiver#voltage`
|
|
54
|
+
* `Receiver#senders_signal`
|
|
55
|
+
* `Receiver#senders_messages`
|
|
56
|
+
* `Receiver#good_and_bad_senders`
|
|
57
|
+
* `Receiver#good_senders`
|
|
58
|
+
* `Receiver#bad_senders`
|
|
59
|
+
* renamed receiver attributes
|
|
60
|
+
* `Receiver#manual_correction` -> `Receiver#rf_correction_manual`
|
|
61
|
+
* `Receiver#automatic_correction` -> `Receiver#rf_correction_automatic`
|
|
48
62
|
|
|
49
63
|
## 0.1.1
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
* supported receiver versions <= 0.2.4
|
|
66
|
+
* remove debug support and raise errors instead
|
|
67
|
+
* convert raw messages to UTF-8 before parsing
|
|
68
|
+
* new sender and receiver attributes
|
|
69
|
+
* `Sender#flight_level
|
|
70
|
+
* `Sender#flarm_software_version`
|
|
71
|
+
* `Sender#flarm_hardware_version`
|
|
72
|
+
* `Sender#flarm_id`
|
|
73
|
+
* `Receiver#manual_correction`
|
|
74
|
+
* `Receiver#automatic_correction`
|
|
75
|
+
* renamed message attribute
|
|
76
|
+
* `Message#speed` -> `Message#ground_speed`
|
|
77
|
+
* verification of supported receiver version
|
|
64
78
|
|
|
65
79
|
## 0.1.0
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
* OGN subscription
|
|
82
|
+
* parser for senders, receivers and comments with attributes
|
|
83
|
+
* `Message#raw`
|
|
84
|
+
* `Message#callsign`
|
|
85
|
+
* `Message#receiver`
|
|
86
|
+
* `Message#time`
|
|
87
|
+
* `Message#longitude`
|
|
88
|
+
* `Message#latitude`
|
|
89
|
+
* `Message#altitude`
|
|
90
|
+
* `Message#heading`
|
|
91
|
+
* `Message#speed`
|
|
92
|
+
* `Sender#stealth_mode`
|
|
93
|
+
* `Sender#no_tracking`
|
|
94
|
+
* `Sender#sender_type`
|
|
95
|
+
* `Sender#address_type`
|
|
96
|
+
* `Sender#id`
|
|
97
|
+
* `Sender#climb_rate`
|
|
98
|
+
* `Sender#turn_rate`
|
|
99
|
+
* `Sender#signal`
|
|
100
|
+
* `Sender#errors`
|
|
101
|
+
* `Sender#frequency_offset`
|
|
102
|
+
* `Sender#gps_accuracy`
|
|
103
|
+
* `Sender#proximity`
|
|
104
|
+
* `Receiver#version`
|
|
105
|
+
* `Receiver#platform`
|
|
106
|
+
* `Receiver#cpu_load`
|
|
107
|
+
* `Receiver#cpu_temperature`
|
|
108
|
+
* `Receiver#ram_free`
|
|
109
|
+
* `Receiver#ram_total`
|
|
110
|
+
* `Receiver#ntp_offset`
|
|
111
|
+
* `Receiver#ntp_correction`
|
|
112
|
+
* `Receiver#signal`
|
|
113
|
+
* `Comment#comment`
|
data/README.md
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
[](https://rubygems.org/gems/ogn_client-ruby)
|
|
2
|
-
[](https://donorbox.org/bitcetera-ogn_client-ruby)
|
|
2
|
+
[](https://github.com/svoop/ogn_client-ruby/actions?workflow=Test)
|
|
3
|
+
[](https://codeclimate.com/github/svoop/ogn_client-ruby)
|
|
4
|
+
[](https://donorbox.org/bitcetera)
|
|
6
5
|
|
|
7
6
|
# ogn_client-ruby
|
|
8
7
|
|
|
9
8
|
[OGN](http://glidernet.org) broadcasts aircraft positions as [APRS](http://www.aprs.org)/[APRS-IS](http://www.aprs-is.net) messages. This gem hooks into this stream of data and provides the necessary classes to parse the raw message strings into meaningful objects.
|
|
10
9
|
|
|
11
|
-
* Author: [Sven Schwyn](http://bitcetera.com)
|
|
12
10
|
* Homepage: https://github.com/svoop/ogn_client-ruby
|
|
11
|
+
* Author: [Sven Schwyn](http://bitcetera.com)
|
|
13
12
|
|
|
14
13
|
:loudspeaker: A word from the shameless commerce division: Looking for a freelance Ruby developer? Surf to http://bitcetera.com and contact Sven. Or [show your support with a donation](https://donorbox.org/bitcetera-ogn_client-ruby). Yes, we do sponsored features, too.
|
|
15
14
|
|
|
16
15
|
## Installation
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
### Security
|
|
18
|
+
|
|
19
|
+
This gem is [cryptographically signed](https://guides.rubygems.org/security/#using-gems) in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
gem cert --add <(curl -Ls https://raw.github.com/svoop/ogn_client-ruby/master/certs/svoop.pem)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Bundler
|
|
26
|
+
|
|
27
|
+
Add the following to the <tt>Gemfile</tt> or <tt>gems.rb</tt> of your [Bundler](https://bundler.io) powered Ruby project:
|
|
19
28
|
|
|
20
29
|
```ruby
|
|
21
30
|
gem 'ogn_client-ruby', require: 'ogn_client'
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
And then
|
|
33
|
+
And then install the bundle:
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
```
|
|
36
|
+
bundle install --trust-policy MediumSecurity
|
|
37
|
+
```
|
|
27
38
|
|
|
28
|
-
|
|
39
|
+
### Standalone
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
If you're only going to use [the executables](#executables):
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
gem install ogn_client-ruby --trust-policy MediumSecurity
|
|
45
|
+
```
|
|
31
46
|
|
|
32
47
|
## Usage
|
|
33
48
|
|
|
@@ -195,11 +210,12 @@ A simple daemon to log raw APRS messages to daily files.
|
|
|
195
210
|
|
|
196
211
|
ognlogd --help
|
|
197
212
|
|
|
198
|
-
### ogn2kml
|
|
213
|
+
### ogn2kml and ogn2geojson
|
|
199
214
|
|
|
200
|
-
Convert raw APRS messages (e.g. from `ognlogd`) to KML.
|
|
215
|
+
Convert raw APRS messages (e.g. from `ognlogd`) to KML or GeoJSON.
|
|
201
216
|
|
|
202
217
|
ogn2kml --help
|
|
218
|
+
ogn2geojson --help
|
|
203
219
|
|
|
204
220
|
## Community Support
|
|
205
221
|
|
|
@@ -211,25 +227,26 @@ Convert raw APRS messages (e.g. from `ognlogd`) to KML.
|
|
|
211
227
|
|
|
212
228
|
## Development
|
|
213
229
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
$ git clone git@github.com:svoop/ogn_client-ruby.git
|
|
217
|
-
$ cd ogn_client-ruby
|
|
218
|
-
$ gem install bundler
|
|
219
|
-
$ bin/setup
|
|
220
|
-
$ rake
|
|
230
|
+
To install the development dependencies and then run the test suite:
|
|
221
231
|
|
|
222
|
-
|
|
232
|
+
bundle install
|
|
233
|
+
bundle exec rake # run tests once
|
|
234
|
+
bundle exec guard # run tests whenever files are modified
|
|
235
|
+
|
|
236
|
+
The test suite may run against live OGN data if you set the `SPEC_SCOPE` environment variable, by default, these tests are skipped.
|
|
223
237
|
|
|
224
|
-
|
|
238
|
+
```
|
|
239
|
+
export SPEC_SCOPE=all
|
|
240
|
+
```
|
|
225
241
|
|
|
226
|
-
|
|
242
|
+
Please submit issues on:
|
|
227
243
|
|
|
228
|
-
|
|
244
|
+
https://github.com/svoop/ogn_client-ruby/issues
|
|
229
245
|
|
|
230
|
-
|
|
246
|
+
To contribute code, fork the project on Github, add your code and submit a
|
|
247
|
+
pull request:
|
|
231
248
|
|
|
232
|
-
|
|
249
|
+
https://help.github.com/articles/fork-a-repo
|
|
233
250
|
|
|
234
251
|
## Feature Brainstorming
|
|
235
252
|
|
data/exe/ogn2geojson
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/inline'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
gemfile do
|
|
8
|
+
source 'https://rubygems.org'
|
|
9
|
+
ruby '>= 2.4'
|
|
10
|
+
gem 'ogn_client-ruby', '~> 0.2', require: 'ogn_client'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Converter
|
|
14
|
+
RED = 140.freeze
|
|
15
|
+
GREEN = 112.freeze
|
|
16
|
+
|
|
17
|
+
def initialize
|
|
18
|
+
OptionParser.new do |o|
|
|
19
|
+
o.banner = <<~END
|
|
20
|
+
Convert raw OGN APRS to GeoJSON.
|
|
21
|
+
Usage: ogn2geojson [options] infile
|
|
22
|
+
END
|
|
23
|
+
o.on('-a', '--about', 'author and license information') { puts 'Written by Sven Schwyn (bitcetera.com) and distributed under MIT license.'; exit }
|
|
24
|
+
o.on('-c', '--callsign STRING', String, 'aircraft callsign (e.g. FLRAABBCC)') { |v| @callsign = v }
|
|
25
|
+
o.on('-d', '--date YYYY-MM-DD', String, 'date the APRS messages were recorded (default: today)') { |v| @date = v }
|
|
26
|
+
o.on('-o', '--outfile FILE', String, 'generated GeoJSON file (default: INFILE.geojson)') { |v| @outfile = v.sub(/\.geojson$/, '') + '.geojson' }
|
|
27
|
+
end.parse!
|
|
28
|
+
@infile = ARGV.pop
|
|
29
|
+
fail 'infile not found' unless @infile && File.exists?(@infile)
|
|
30
|
+
@outfile ||= @infile.sub(/\.\w+$/, '') + '.geojson'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def feature(from_point, to_point, properties={})
|
|
34
|
+
{
|
|
35
|
+
type: 'Feature',
|
|
36
|
+
geometry: {
|
|
37
|
+
type: 'LineString',
|
|
38
|
+
coordinates: [from_point, to_point]
|
|
39
|
+
},
|
|
40
|
+
properties: {
|
|
41
|
+
'stroke-width': 2,
|
|
42
|
+
'stroke-opacity': 1
|
|
43
|
+
}.merge(properties)
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def stroke_for(climb_rate)
|
|
48
|
+
case
|
|
49
|
+
when climb_rate == 0
|
|
50
|
+
"rgb(0, 0, 0)"
|
|
51
|
+
when climb_rate < 0
|
|
52
|
+
color = RED + ([climb_rate.abs, 5].min * ((250 - RED) / 5)).round
|
|
53
|
+
"rgb(#{color}, 0, 0)"
|
|
54
|
+
when climb_rate > 0
|
|
55
|
+
color = GREEN + ([climb_rate, 5].min * ((250 - GREEN) / 5)).round
|
|
56
|
+
"rgb(0, #{color}, 0)"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def convert!
|
|
61
|
+
lines = File.readlines(@infile)
|
|
62
|
+
features = lines.each.with_object([]) do |line, features|
|
|
63
|
+
if (sender = OGNClient::Message.parse(line, date: @date)).is_a? OGNClient::SenderBeacon
|
|
64
|
+
if !@callsign || sender.callsign == @callsign
|
|
65
|
+
to_point = [sender.longitude, sender.latitude, sender.altitude]
|
|
66
|
+
if @from_point
|
|
67
|
+
features << feature(@from_point, to_point,
|
|
68
|
+
time: sender.time.getlocal.strftime('%H:%M:%S'),
|
|
69
|
+
heading: sender.heading,
|
|
70
|
+
'ground-speed': sender.ground_speed,
|
|
71
|
+
'climb-rate': sender.climb_rate,
|
|
72
|
+
'turn-rate': sender.turn_rate,
|
|
73
|
+
stroke: stroke_for(sender.climb_rate)
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
@from_point = to_point
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
File.write(@outfile, JSON.pretty_generate(type: "FeatureCollection", features: features))
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
begin
|
|
85
|
+
Converter.new.convert!
|
|
86
|
+
rescue => exception
|
|
87
|
+
puts "#{File.basename($0)}: #{exception.message}"
|
|
88
|
+
exit 1
|
|
89
|
+
end
|
data/exe/ogn2kml
CHANGED
|
@@ -6,8 +6,7 @@ require 'optparse'
|
|
|
6
6
|
gemfile do
|
|
7
7
|
source 'https://rubygems.org'
|
|
8
8
|
ruby '>= 2.4'
|
|
9
|
-
gem '
|
|
10
|
-
gem 'libxml-ruby', '~> 3.0', require: 'xml'
|
|
9
|
+
gem 'builder', '~> 3'
|
|
11
10
|
gem 'ogn_client-ruby', '~> 0.2', require: 'ogn_client'
|
|
12
11
|
end
|
|
13
12
|
|
|
@@ -28,104 +27,100 @@ class Converter
|
|
|
28
27
|
@outfile ||= @infile.sub(/\.\w+$/, '') + '.kml'
|
|
29
28
|
end
|
|
30
29
|
|
|
31
|
-
def style_nodes
|
|
32
|
-
fragment = <<~END
|
|
33
|
-
<Fragment>
|
|
34
|
-
<Style id="track_normal">
|
|
35
|
-
<IconStyle>
|
|
36
|
-
<Icon>
|
|
37
|
-
<href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
|
|
38
|
-
</Icon>
|
|
39
|
-
</IconStyle>
|
|
40
|
-
<LineStyle>
|
|
41
|
-
<color>99ffac59</color>
|
|
42
|
-
<width>6</width>
|
|
43
|
-
</LineStyle>
|
|
44
|
-
</Style>
|
|
45
|
-
<Style id="track_highlight">
|
|
46
|
-
<IconStyle>
|
|
47
|
-
<scale>1.2</scale>
|
|
48
|
-
<Icon>
|
|
49
|
-
<href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
|
|
50
|
-
</Icon>
|
|
51
|
-
</IconStyle>
|
|
52
|
-
<LineStyle>
|
|
53
|
-
<color>99ffac59</color>
|
|
54
|
-
<width>8</width>
|
|
55
|
-
</LineStyle>
|
|
56
|
-
</Style>
|
|
57
|
-
<StyleMap id="track">
|
|
58
|
-
<Pair>
|
|
59
|
-
<key>normal</key>
|
|
60
|
-
<styleUrl>#track_normal</styleUrl>
|
|
61
|
-
</Pair>
|
|
62
|
-
<Pair>
|
|
63
|
-
<key>highlight</key>
|
|
64
|
-
<styleUrl>#track_highlight</styleUrl>
|
|
65
|
-
</Pair>
|
|
66
|
-
</StyleMap>
|
|
67
|
-
</Fragment>
|
|
68
|
-
END
|
|
69
|
-
XML::Parser.string(fragment).parse.root.each_child { |c| yield c }
|
|
70
|
-
end
|
|
71
|
-
|
|
72
30
|
def convert!
|
|
73
31
|
lines = File.readlines(@infile)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
32
|
+
points = lines.map do |line|
|
|
33
|
+
message = OGNClient::Message.parse(line, date: @date)
|
|
34
|
+
if message.is_a?(OGNClient::SenderBeacon) && (!@callsign || @callsign == message.callsign)
|
|
35
|
+
{
|
|
36
|
+
when: message.time.xmlschema,
|
|
37
|
+
coord: "#{message.longitude} #{message.latitude} #{message.altitude}",
|
|
38
|
+
angles: "#{message.heading} 0 0",
|
|
39
|
+
time: message.time.getlocal.strftime('%H:%M:%S'),
|
|
40
|
+
ground_speed: message.ground_speed.to_i.to_s,
|
|
41
|
+
climb_rate: message.climb_rate.to_i.to_s,
|
|
42
|
+
turn_rate: message.turn_rate.to_i.to_s
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
end.compact
|
|
46
|
+
xml = Builder::XmlMarkup.new indent: 2
|
|
47
|
+
xml.instruct!
|
|
48
|
+
xml.kml(
|
|
49
|
+
xmlns: 'http://www.opengis.net/kml/2.2',
|
|
50
|
+
'xmlns:gx': 'http://www.google.com/kml/ext/2.2'
|
|
51
|
+
) do
|
|
52
|
+
xml.Document do
|
|
53
|
+
xml.name 'OGN'
|
|
54
|
+
# Styles
|
|
55
|
+
xml.Style(id: 'track_normal') do
|
|
56
|
+
xml.IconStyle do
|
|
57
|
+
xml.Icon do
|
|
58
|
+
xml.href 'http://earth.google.com/images/kml-icons/track-directional/track-0.png'
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
xml.LineStyle do
|
|
62
|
+
xml.color '99ffac59'
|
|
63
|
+
xml.width '6'
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
xml.Style(id: 'track_highlight') do
|
|
67
|
+
xml.IconStyle do
|
|
68
|
+
xml.scale '1.2'
|
|
69
|
+
xml.Icon do
|
|
70
|
+
xml.href 'http://earth.google.com/images/kml-icons/track-directional/track-0.png'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
xml.LineStyle do
|
|
74
|
+
xml.color '99ffac59'
|
|
75
|
+
xml.width '8'
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
xml.StyleMap(id: 'track') do
|
|
79
|
+
xml.Pair do
|
|
80
|
+
xml.key 'normal'
|
|
81
|
+
xml.styleUrl '#track_normal'
|
|
82
|
+
end
|
|
83
|
+
xml.Pair do
|
|
84
|
+
xml.key 'highlight'
|
|
85
|
+
xml.styleUrl '#track_highlight'
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
# Tracks
|
|
89
|
+
xml.Folder do
|
|
90
|
+
xml.name 'Tracks'
|
|
91
|
+
xml.Placemark do
|
|
92
|
+
xml.name @callsign || 'all'
|
|
93
|
+
xml.styleUrl '#track'
|
|
94
|
+
xml.tag!('gx:Track') do
|
|
95
|
+
xml.altitudeMode 'absolute'
|
|
96
|
+
points.each { |p| xml.when p[:when] }
|
|
97
|
+
points.each { |p| xml.tag!('gx:coord', p[:coord]) }
|
|
98
|
+
points.each { |p| xml.tag!('gx:angles', p[:angles]) }
|
|
99
|
+
xml.ExtendedData do
|
|
100
|
+
xml.SchemaData(schemaUrl: '#schema') do
|
|
101
|
+
xml.tag!('gx:SimpleArrayData', name: 'Time') do
|
|
102
|
+
points.each { |p| xml.tag!('gx:value', p[:time]) }
|
|
103
|
+
end
|
|
104
|
+
xml.tag!('gx:SimpleArrayData', name: 'Ground Speed') do
|
|
105
|
+
points.each { |p| xml.tag!('gx:value', p[:ground_speed]) }
|
|
106
|
+
end
|
|
107
|
+
xml.tag!('gx:SimpleArrayData', name: 'Turn Rate') do
|
|
108
|
+
points.each { |p| xml.tag!('gx:value', p[:turn_rate]) }
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
108
114
|
end
|
|
109
115
|
end
|
|
110
|
-
progressbar.increment
|
|
111
|
-
end
|
|
112
|
-
array_data.keys.each do |key|
|
|
113
|
-
array_data[key].each { |d| track << d }
|
|
114
116
|
end
|
|
115
|
-
|
|
116
|
-
extended_data << (schema_data = XML::Node.new(:SchemaData))
|
|
117
|
-
schema_data['schemaUrl'] = '#schema'
|
|
118
|
-
schema_data << time
|
|
119
|
-
schema_data << ground_speed
|
|
120
|
-
schema_data << climb_rate
|
|
121
|
-
schema_data << turn_rate
|
|
122
|
-
xml.save(@outfile, encoding: XML::Encoding::UTF_8)
|
|
117
|
+
File.write(@outfile, xml.target!)
|
|
123
118
|
end
|
|
124
119
|
end
|
|
125
120
|
|
|
126
121
|
begin
|
|
127
122
|
Converter.new.convert!
|
|
128
|
-
rescue => exception
|
|
129
|
-
puts "#{File.basename($0)}: #{exception.message}"
|
|
130
|
-
exit 1
|
|
123
|
+
#rescue => exception
|
|
124
|
+
# puts "#{File.basename($0)}: #{exception.message}"
|
|
125
|
+
# exit 1
|
|
131
126
|
end
|
data/lib/ogn_client/version.rb
CHANGED
data.tar.gz.sig
ADDED
metadata
CHANGED
|
@@ -1,45 +1,66 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ogn_client-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Schwyn
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
|
-
cert_chain:
|
|
11
|
-
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIDODCCAiCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhydWJ5
|
|
14
|
+
L0RDPWJpdGNldGVyYS9EQz1jb20wHhcNMjIxMTA2MTIzNjUwWhcNMjMxMTA2MTIz
|
|
15
|
+
NjUwWjAjMSEwHwYDVQQDDBhydWJ5L0RDPWJpdGNldGVyYS9EQz1jb20wggEiMA0G
|
|
16
|
+
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDcLg+IHjXYaUlTSU7R235lQKD8ZhEe
|
|
17
|
+
KMhoGlSUonZ/zo1OT3KXcqTCP1iMX743xYs6upEGALCWWwq+nxvlDdnWRjF3AAv7
|
|
18
|
+
ikC+Z2BEowjyeCCT/0gvn4ohKcR0JOzzRaIlFUVInlGSAHx2QHZ2N8ntf54lu7nd
|
|
19
|
+
L8CiDK8rClsY4JBNGOgH9UC81f+m61UUQuTLxyM2CXfAYkj/sGNTvFRJcNX+nfdC
|
|
20
|
+
hM9r2kH1+7wsa8yG7wJ2IkrzNACD8v84oE6qVusN8OLEMUI/NaEPVPbw2LUM149H
|
|
21
|
+
PVa0i729A4IhroNnFNmw4wOC93ARNbM1+LW36PLMmKjKudf5Exg8VmDVAgMBAAGj
|
|
22
|
+
dzB1MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSfK8MtR62mQ6oN
|
|
23
|
+
yoX/VKJzFjLSVDAdBgNVHREEFjAUgRJydWJ5QGJpdGNldGVyYS5jb20wHQYDVR0S
|
|
24
|
+
BBYwFIEScnVieUBiaXRjZXRlcmEuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQAYG2na
|
|
25
|
+
ye8OE2DANQIFM/xDos/E4DaPWCJjX5xvFKNKHMCeQYPeZvLICCwyw2paE7Otwk6p
|
|
26
|
+
uvbg2Ks5ykXsbk5i6vxDoeeOLvmxCqI6m+tHb8v7VZtmwRJm8so0eSX0WvTaKnIf
|
|
27
|
+
CAn1bVUggczVdNoBXw9WAILKyw9bvh3Ft740XZrR74sd+m2pGwjCaM8hzLvrVbGP
|
|
28
|
+
DyYhlBeRWyQKQ0WDIsiTSRhzK8HwSTUWjvPwx7SEdIU/HZgyrk0ETObKPakVu6bH
|
|
29
|
+
kAyiRqgxF4dJviwtqI7mZIomWL63+kXLgjOjMe1SHxfIPo/0ji6+r1p4KYa7o41v
|
|
30
|
+
fwIwU1MKlFBdsjkd
|
|
31
|
+
-----END CERTIFICATE-----
|
|
32
|
+
date: 2022-11-06 00:00:00.000000000 Z
|
|
12
33
|
dependencies:
|
|
13
34
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
35
|
+
name: rake
|
|
15
36
|
requirement: !ruby/object:Gem::Requirement
|
|
16
37
|
requirements:
|
|
17
|
-
- - "
|
|
38
|
+
- - ">="
|
|
18
39
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
40
|
+
version: '0'
|
|
20
41
|
type: :development
|
|
21
42
|
prerelease: false
|
|
22
43
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
44
|
requirements:
|
|
24
|
-
- - "
|
|
45
|
+
- - ">="
|
|
25
46
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
47
|
+
version: '0'
|
|
27
48
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
49
|
+
name: pry
|
|
29
50
|
requirement: !ruby/object:Gem::Requirement
|
|
30
51
|
requirements:
|
|
31
|
-
- - "
|
|
52
|
+
- - ">="
|
|
32
53
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
54
|
+
version: '0'
|
|
34
55
|
type: :development
|
|
35
56
|
prerelease: false
|
|
36
57
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
58
|
requirements:
|
|
38
|
-
- - "
|
|
59
|
+
- - ">="
|
|
39
60
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
61
|
+
version: '0'
|
|
41
62
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
63
|
+
name: minitest
|
|
43
64
|
requirement: !ruby/object:Gem::Requirement
|
|
44
65
|
requirements:
|
|
45
66
|
- - ">="
|
|
@@ -53,7 +74,7 @@ dependencies:
|
|
|
53
74
|
- !ruby/object:Gem::Version
|
|
54
75
|
version: '0'
|
|
55
76
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: minitest
|
|
77
|
+
name: minitest-sound
|
|
57
78
|
requirement: !ruby/object:Gem::Requirement
|
|
58
79
|
requirements:
|
|
59
80
|
- - ">="
|
|
@@ -67,7 +88,7 @@ dependencies:
|
|
|
67
88
|
- !ruby/object:Gem::Version
|
|
68
89
|
version: '0'
|
|
69
90
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: minitest-
|
|
91
|
+
name: minitest-focus
|
|
71
92
|
requirement: !ruby/object:Gem::Requirement
|
|
72
93
|
requirements:
|
|
73
94
|
- - ">="
|
|
@@ -81,7 +102,7 @@ dependencies:
|
|
|
81
102
|
- !ruby/object:Gem::Version
|
|
82
103
|
version: '0'
|
|
83
104
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
105
|
+
name: guard
|
|
85
106
|
requirement: !ruby/object:Gem::Requirement
|
|
86
107
|
requirements:
|
|
87
108
|
- - ">="
|
|
@@ -94,30 +115,40 @@ dependencies:
|
|
|
94
115
|
- - ">="
|
|
95
116
|
- !ruby/object:Gem::Version
|
|
96
117
|
version: '0'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
- !ruby/object:Gem::Dependency
|
|
119
|
+
name: guard-minitest
|
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
type: :development
|
|
126
|
+
prerelease: false
|
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
description: |
|
|
133
|
+
OGN (glidernet.org) broadcasts aircraft positions as APRS/APRS-IS messages.
|
|
134
|
+
This gem hooks into this stream of data and provides the necessary classes
|
|
135
|
+
to parse the raw message strings into meaningful objects.
|
|
100
136
|
email:
|
|
101
137
|
- ruby@bitcetera.com
|
|
102
138
|
executables:
|
|
139
|
+
- ogn2geojson
|
|
103
140
|
- ogn2kml
|
|
104
141
|
- ognlogd
|
|
105
142
|
extensions: []
|
|
106
|
-
extra_rdoc_files:
|
|
143
|
+
extra_rdoc_files:
|
|
144
|
+
- README.md
|
|
145
|
+
- CHANGELOG.md
|
|
146
|
+
- LICENSE.txt
|
|
107
147
|
files:
|
|
108
|
-
- ".code_climate.yml"
|
|
109
|
-
- ".editorconfig"
|
|
110
|
-
- ".gitignore"
|
|
111
|
-
- ".ruby-version"
|
|
112
|
-
- ".travis.yml"
|
|
113
148
|
- CHANGELOG.md
|
|
114
|
-
- Gemfile
|
|
115
|
-
- Guardfile
|
|
116
149
|
- LICENSE.txt
|
|
117
150
|
- README.md
|
|
118
|
-
-
|
|
119
|
-
- bin/console
|
|
120
|
-
- bin/setup
|
|
151
|
+
- exe/ogn2geojson
|
|
121
152
|
- exe/ogn2kml
|
|
122
153
|
- exe/ognlogd
|
|
123
154
|
- lib/ogn_client.rb
|
|
@@ -129,30 +160,39 @@ files:
|
|
|
129
160
|
- lib/ogn_client/messages/receiver_status.rb
|
|
130
161
|
- lib/ogn_client/messages/sender_beacon.rb
|
|
131
162
|
- lib/ogn_client/version.rb
|
|
132
|
-
- ogn_client-ruby.gemspec
|
|
133
|
-
- tasks/test.rake
|
|
134
163
|
homepage: https://github.com/svoop/ogn_client-ruby
|
|
135
164
|
licenses:
|
|
136
165
|
- MIT
|
|
137
|
-
metadata:
|
|
138
|
-
|
|
139
|
-
|
|
166
|
+
metadata:
|
|
167
|
+
homepage_uri: https://github.com/svoop/ogn_client-ruby
|
|
168
|
+
changelog_uri: https://github.com/svoop/ogn_client-ruby/blob/master/CHANGELOG.md
|
|
169
|
+
source_code_uri: https://github.com/svoop/ogn_client-ruby
|
|
170
|
+
documentation_uri: https://www.rubydoc.info/gems/ogn_client-ruby
|
|
171
|
+
bug_tracker_uri: https://github.com/svoop/ogn_client-ruby/issues
|
|
172
|
+
post_install_message:
|
|
173
|
+
rdoc_options:
|
|
174
|
+
- "--title"
|
|
175
|
+
- OGN Subscriber and Parser
|
|
176
|
+
- "--main"
|
|
177
|
+
- README.md
|
|
178
|
+
- "--line-numbers"
|
|
179
|
+
- "--inline-source"
|
|
180
|
+
- "--quiet"
|
|
140
181
|
require_paths:
|
|
141
182
|
- lib
|
|
142
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
184
|
requirements:
|
|
144
185
|
- - ">="
|
|
145
186
|
- !ruby/object:Gem::Version
|
|
146
|
-
version:
|
|
187
|
+
version: 2.4.0
|
|
147
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
189
|
requirements:
|
|
149
190
|
- - ">="
|
|
150
191
|
- !ruby/object:Gem::Version
|
|
151
192
|
version: '0'
|
|
152
193
|
requirements: []
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
signing_key:
|
|
194
|
+
rubygems_version: 3.3.25
|
|
195
|
+
signing_key:
|
|
156
196
|
specification_version: 4
|
|
157
197
|
summary: Subscriber and parser for APRS messages from OGN
|
|
158
198
|
test_files: []
|
metadata.gz.sig
ADDED
|
Binary file
|
data/.code_climate.yml
DELETED
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ruby-2.4.1
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Guardfile
DELETED
data/Rakefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require 'bundler/gem_tasks'
|
|
2
|
-
|
|
3
|
-
require 'rake/testtask'
|
|
4
|
-
|
|
5
|
-
Rake::TestTask.new do |t|
|
|
6
|
-
t.libs << 'lib'
|
|
7
|
-
t.test_files = FileList['spec/lib/**/*_spec.rb']
|
|
8
|
-
t.verbose = true
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
task :default => :test
|
|
12
|
-
|
|
13
|
-
Dir.glob('tasks/*.rake').each { |task| load task }
|
data/bin/console
DELETED
data/bin/setup
DELETED
data/ogn_client-ruby.gemspec
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'ogn_client/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = 'ogn_client-ruby'
|
|
8
|
-
spec.version = OGNClient::VERSION
|
|
9
|
-
spec.authors = ['Sven Schwyn']
|
|
10
|
-
spec.email = ['ruby@bitcetera.com']
|
|
11
|
-
spec.summary = %q{Subscriber and parser for APRS messages from OGN}
|
|
12
|
-
spec.description = %q{OGN (glidernet.org) broadcasts aircraft positions as APRS/APRS-IS messages. This gem hooks into this stream of data and provides the necessary classes to parse the raw message strings into meaningful objects.}
|
|
13
|
-
spec.homepage = 'https://github.com/svoop/ogn_client-ruby'
|
|
14
|
-
spec.license = 'MIT'
|
|
15
|
-
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
-
spec.bindir = 'exe'
|
|
18
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
-
spec.require_paths = ['lib']
|
|
20
|
-
|
|
21
|
-
spec.required_ruby_version = '>= 2.1'
|
|
22
|
-
|
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.10'
|
|
24
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
25
|
-
spec.add_development_dependency 'pry'
|
|
26
|
-
spec.add_development_dependency 'minitest'
|
|
27
|
-
spec.add_development_dependency 'minitest-reporters'
|
|
28
|
-
spec.add_development_dependency 'minitest-matchers'
|
|
29
|
-
end
|
data/tasks/test.rake
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
require 'ogn_client'
|
|
2
|
-
require 'tempfile'
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
|
|
5
|
-
namespace :test do
|
|
6
|
-
|
|
7
|
-
desc "Reset the test suite"
|
|
8
|
-
task :reset do
|
|
9
|
-
FileUtils.rm_f('spec/fixtures/messages.txt')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
desc "Feed live APRS messages to the parser"
|
|
13
|
-
task :live do
|
|
14
|
-
callsign = "ROCT#{rand(1000)}"
|
|
15
|
-
counter = 0
|
|
16
|
-
loop do
|
|
17
|
-
OGNClient::APRS.start(callsign: callsign) do |aprs|
|
|
18
|
-
while raw = aprs.gets do
|
|
19
|
-
begin
|
|
20
|
-
OGNClient::Message.parse raw
|
|
21
|
-
rescue OGNClient::Error => error
|
|
22
|
-
puts "ERROR: #{error.message}"
|
|
23
|
-
end
|
|
24
|
-
counter += 1
|
|
25
|
-
puts "INFO: captured #{counter} messages" if counter % 1000 == 0
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
namespace :live do
|
|
32
|
-
desc "Record live APRS messages"
|
|
33
|
-
task :record do
|
|
34
|
-
callsign = "ROCT#{rand(1000)}"
|
|
35
|
-
counter = 0
|
|
36
|
-
File.open("#{Dir.tmpdir}/ogn_messages.txt", "w") do |file|
|
|
37
|
-
OGNClient::APRS.start(callsign: callsign) do |aprs|
|
|
38
|
-
while raw = aprs.gets do
|
|
39
|
-
file.print raw
|
|
40
|
-
counter += 1
|
|
41
|
-
puts "INFO: captured #{counter} messages" if counter % 1000 == 0
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
desc "Feed recorded APRS messages to the parser"
|
|
48
|
-
task :replay do
|
|
49
|
-
File.open("#{Dir.tmpdir}/ogn_messages.txt") do |file|
|
|
50
|
-
while raw = file.gets do
|
|
51
|
-
begin
|
|
52
|
-
OGNClient::Message.parse raw
|
|
53
|
-
rescue OGNClient::Error => error
|
|
54
|
-
puts "ERROR: #{error.message}"
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|