ogn_client-ruby 0.2.3 → 0.2.5

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
- SHA1:
3
- metadata.gz: 457a6b32a8d8a124283e05e320f14b6d4d2a1310
4
- data.tar.gz: cca65cf62df04c2ae068ba0adeee9fe1805769d8
2
+ SHA256:
3
+ metadata.gz: eb15fb964225bbe71a8ed8a69e6b2787b62fbf3cbbf70abd3a6d8b7b51092abb
4
+ data.tar.gz: 91b768c27573bd84da400f2ab6bb6692f646d1b767eb05c6ee629fa5d445ec26
5
5
  SHA512:
6
- metadata.gz: 4b1dee00b45b66bdfe7a02070e6c8acb518a5df6f7d9c248aee836dab60ce01907bd84590e3b346c9c9defb9a39b6b8c19eda8cf814a1ee8278d6b64e11f4160
7
- data.tar.gz: d6f3e85e414a4d3533376295676019e0f9c78015bec1346743711f9c3859782a80f7578d2d18b42bfe2ae9c3b7f37e4c6e03a9e257fd01ebf44104f4503e6dc3
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
- * add support for explicit message date
4
- * fix ogn2kml for larger tracks
17
+ * add support for explicit message date
18
+ * fix ogn2kml for larger tracks
5
19
 
6
20
  ## 0.2.2
7
21
 
8
- * add example executables
9
- * ognlogd
10
- * ogn2kml
22
+ * add example executables
23
+ * ognlogd
24
+ * ogn2kml
11
25
 
12
26
  ## 0.2.0
13
27
 
14
- * support for receiver versions <= 0.2.6
15
- * renamed `Sender` to `SenderBeacon`
16
- * devided `Receiver` to `ReceiverBeacon` and `ReceiverStatus`
17
- * `ReceiverStatus` is *not* available for receiver versions < 0.2.6
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
- * renamed sender and receiver attributes
22
- * `Sender#signal` -> `Sender#signal_quality`
23
- * `Sender#power` -> `Sender#signal_power`
24
- * `Receiver#signal` -> `Receiver#signal_quality`
25
- * `Receiver#senders_signal` -> `Receiver#senders_signal_quality`
26
- * `Receiver#good_senders_signal` -> `Receiver#good_senders_signal_quality`
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
- * support for receiver versions <= 0.2.5
31
- * faster message parsing
32
- * new sender and receiver attributes
33
- * `Sender#power`
34
- * `Receiver#voltage`
35
- * `Receiver#amperage`
36
- * `Receiver#senders`
37
- * `Receiver#senders_visible`
38
- * `Receiver#senders_invisible`
39
- * `Receiver#voltage`
40
- * `Receiver#senders_signal`
41
- * `Receiver#senders_messages`
42
- * `Receiver#good_and_bad_senders`
43
- * `Receiver#good_senders`
44
- * `Receiver#bad_senders`
45
- * renamed receiver attributes
46
- * `Receiver#manual_correction` -> `Receiver#rf_correction_manual`
47
- * `Receiver#automatic_correction` -> `Receiver#rf_correction_automatic`
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
- * supported receiver versions <= 0.2.4
52
- * remove debug support and raise errors instead
53
- * convert raw messages to UTF-8 before parsing
54
- * new sender and receiver attributes
55
- * `Sender#flight_level
56
- * `Sender#flarm_software_version`
57
- * `Sender#flarm_hardware_version`
58
- * `Sender#flarm_id`
59
- * `Receiver#manual_correction`
60
- * `Receiver#automatic_correction`
61
- * renamed message attribute
62
- * `Message#speed` -> `Message#ground_speed`
63
- * verification of supported receiver version
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
- * OGN subscription
68
- * parser for senders, receivers and comments with attributes
69
- * `Message#raw`
70
- * `Message#callsign`
71
- * `Message#receiver`
72
- * `Message#time`
73
- * `Message#longitude`
74
- * `Message#latitude`
75
- * `Message#altitude`
76
- * `Message#heading`
77
- * `Message#speed`
78
- * `Sender#stealth_mode`
79
- * `Sender#no_tracking`
80
- * `Sender#sender_type`
81
- * `Sender#address_type`
82
- * `Sender#id`
83
- * `Sender#climb_rate`
84
- * `Sender#turn_rate`
85
- * `Sender#signal`
86
- * `Sender#errors`
87
- * `Sender#frequency_offset`
88
- * `Sender#gps_accuracy`
89
- * `Sender#proximity`
90
- * `Receiver#version`
91
- * `Receiver#platform`
92
- * `Receiver#cpu_load`
93
- * `Receiver#cpu_temperature`
94
- * `Receiver#ram_free`
95
- * `Receiver#ram_total`
96
- * `Receiver#ntp_offset`
97
- * `Receiver#ntp_correction`
98
- * `Receiver#signal`
99
- * `Comment#comment`
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
  [![Version](https://img.shields.io/gem/v/ogn_client-ruby.svg?style=flat)](https://rubygems.org/gems/ogn_client-ruby)
2
- [![Continuous Integration](https://img.shields.io/travis/svoop/ogn_client-ruby/master.svg?style=flat)](https://travis-ci.org/svoop/ogn_client-ruby)
3
- [![Code Climate](https://img.shields.io/codeclimate/github/svoop/ogn_client-ruby.svg?style=flat)](https://codeclimate.com/github/svoop/ogn_client-ruby)
4
- [![Gitter](https://img.shields.io/gitter/room/svoop/ogn_client-ruby.svg?style=flat)](https://gitter.im/svoop/ogn_client-ruby)
5
- [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](https://donorbox.org/bitcetera-ogn_client-ruby)
2
+ [![Tests](https://img.shields.io/github/workflow/status/svoop/ogn_client-ruby/Test.svg?style=flat&label=tests)](https://github.com/svoop/ogn_client-ruby/actions?workflow=Test)
3
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/svoop/ogn_client-ruby.svg?style=flat)](https://codeclimate.com/github/svoop/ogn_client-ruby)
4
+ [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](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
- Add this line to your application's Gemfile:
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 execute:
33
+ And then install the bundle:
25
34
 
26
- $ bundle
35
+ ```
36
+ bundle install --trust-policy MediumSecurity
37
+ ```
27
38
 
28
- Or install it yourself with:
39
+ ### Standalone
29
40
 
30
- $ gem install ogn_client-ruby
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
- Check out the repository, install the dependencies and run the test suite:
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
- If you are on macOS, *guard*, *guard-minitest* and *minitest-osx* are also installed and therefore you get the test results as notifications by running a guard watchdog with:
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
- $ guard
238
+ ```
239
+ export SPEC_SCOPE=all
240
+ ```
225
241
 
226
- To play around with the gem:
242
+ Please submit issues on:
227
243
 
228
- $ bin/console
244
+ https://github.com/svoop/ogn_client-ruby/issues
229
245
 
230
- And to install this gem onto your local machine:
246
+ To contribute code, fork the project on Github, add your code and submit a
247
+ pull request:
231
248
 
232
- $ bundle exec rake install
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 'progressbar', '~> 1.8'
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
- progressbar = ProgressBar.create(format: '%e |%b>%i| %p%% %t', total: lines.count)
75
- xml = XML::Document.new
76
- root = xml.root = XML::Node.new(:kml)
77
- root['xmlns'] = 'http://www.opengis.net/kml/2.2'
78
- root['xmlns:gx'] = 'http://www.google.com/kml/ext/2.2'
79
- root << (document = XML::Node.new(:Document))
80
- document << XML::Node.new(:name, 'OGN')
81
- style_nodes { |n| document << xml.import(n) }
82
- document << (folder = XML::Node.new(:Folder))
83
- folder << XML::Node.new(:name, 'Tracks')
84
- folder << (placemark = XML::Node.new(:Placemark))
85
- placemark << XML::Node.new(:name, @callsign || 'all')
86
- placemark << XML::Node.new(:styleUrl, '#track')
87
- placemark << (track = XML::Node.new(:'gx:Track'))
88
- track << XML::Node.new(:altitudeMode, 'absolute')
89
- time = XML::Node.new(:'gx:SimpleArrayData')
90
- time['name'] = 'Time'
91
- ground_speed = XML::Node.new(:'gx:SimpleArrayData')
92
- ground_speed['name'] = 'Ground Speed'
93
- climb_rate = XML::Node.new(:'gx:SimpleArrayData')
94
- climb_rate['name'] = 'Climb Rate'
95
- turn_rate = XML::Node.new(:'gx:SimpleArrayData')
96
- turn_rate['name'] = 'Turn Rate'
97
- array_data = { when: [], coord: [], angles: [] }
98
- lines.each do |line|
99
- if (sender = OGNClient::Message.parse(line, date: @date)).is_a? OGNClient::SenderBeacon
100
- if !@callsign || sender.callsign == @callsign
101
- array_data[:when] << XML::Node.new(:when, sender.time.xmlschema)
102
- array_data[:coord] << XML::Node.new(:'gx:coord', "#{sender.longitude} #{sender.latitude} #{sender.altitude}")
103
- array_data[:angles] << XML::Node.new(:'gx:angles', "#{sender.heading} 0 0")
104
- time << XML::Node.new(:'gx:value', sender.time.getlocal.strftime('%H:%M:%S'))
105
- ground_speed << XML::Node.new(:'gx:value', sender.ground_speed.to_i.to_s)
106
- climb_rate << XML::Node.new(:'gx:value', sender.climb_rate.to_i.to_s)
107
- turn_rate << XML::Node.new(:'gx:value', sender.turn_rate.to_i.to_s)
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
- track << (extended_data = XML::Node.new(:ExtendedData))
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
@@ -1,3 +1,3 @@
1
1
  module OGNClient
2
- VERSION = "0.2.3".freeze
2
+ VERSION = "0.2.5".freeze
3
3
  end
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ >) �zV���a%���� zc�i�Y�5�����9��Ƌb�5�K�nh��-])�h\V����UK�z��܍�]6$G�a�� i\����Cy��7�Х�܄���]�8^�(�<�o���s+Y�m�FI���[;�oBs\fX����%wx����WX�׾�!�"P�7:�.G�4-8����0}#J��t��[B��4� :�\CJj̑�!�7�9�1�W�OZr�^R�~��7��
2
+ �4�$��ԱS���=r�)��
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.3
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
- date: 2017-06-24 00:00:00.000000000 Z
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: bundler
35
+ name: rake
15
36
  requirement: !ruby/object:Gem::Requirement
16
37
  requirements:
17
- - - "~>"
38
+ - - ">="
18
39
  - !ruby/object:Gem::Version
19
- version: '1.10'
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: '1.10'
47
+ version: '0'
27
48
  - !ruby/object:Gem::Dependency
28
- name: rake
49
+ name: pry
29
50
  requirement: !ruby/object:Gem::Requirement
30
51
  requirements:
31
- - - "~>"
52
+ - - ">="
32
53
  - !ruby/object:Gem::Version
33
- version: '10.0'
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: '10.0'
61
+ version: '0'
41
62
  - !ruby/object:Gem::Dependency
42
- name: pry
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-reporters
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: minitest-matchers
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
- description: OGN (glidernet.org) broadcasts aircraft positions as APRS/APRS-IS messages.
98
- This gem hooks into this stream of data and provides the necessary classes to parse
99
- the raw message strings into meaningful objects.
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
- - Rakefile
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
- post_install_message:
139
- rdoc_options: []
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: '2.1'
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
- rubyforge_project:
154
- rubygems_version: 2.6.11
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
@@ -1,14 +0,0 @@
1
- ---
2
- languages:
3
- Ruby: true
4
- engines:
5
- fixme:
6
- enabled: true
7
- rubocop:
8
- enabled: true
9
- ratings:
10
- paths:
11
- - "lib/**"
12
- - "**.rb"
13
- exclude_paths:
14
- - "spec/**/*"
data/.editorconfig DELETED
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- .DS_Store
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-2.4.1
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- language: ruby
3
- rvm:
4
- - 2.4.1
5
- - 2.3.4
6
- - 2.2.7
7
- before_install: gem install bundler -v 1.14.6
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- if RUBY_PLATFORM.match /darwin/
6
- gem 'guard'
7
- gem 'guard-minitest'
8
- gem 'minitest-osx'
9
- end
data/Guardfile DELETED
@@ -1,7 +0,0 @@
1
- clearing :on
2
-
3
- guard :minitest do
4
- watch(%r{^spec/(.*)_spec\.rb})
5
- watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
6
- watch(%r{^spec/spec_helper\.rb}) { 'spec' }
7
- end
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
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "ogn_client"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- require "pry"
10
- Pry.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here.
@@ -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