nmea_plus 1.0.6 → 1.0.7

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
2
  SHA1:
3
- metadata.gz: ab50fa5e587f895b72ed894cf0c4e3f280956146
4
- data.tar.gz: 923806c46670760a1f3832b23ae93f37001f4c80
3
+ metadata.gz: a0eca727afdb573f7ffede6594fc3d7acda16a48
4
+ data.tar.gz: 6ad4878023b3743d36954b020c8f08d97ea2ec62
5
5
  SHA512:
6
- metadata.gz: b59b0f3ea335e74df47fd85587e88907d41e61052a5a2da22f7d3fc9882fbf30a6294cad1d95cbc65774eafb6a35cb30e73293cbf547b12de916423c0c6444df
7
- data.tar.gz: 2e572c97ed129692c193ebefa13bd20598e1e49b29fe23c99000cd669e30bab93599dac69757cb27a0a5a27d1406e3a182fd0f43ba9adfce581b5d7396c8a67c
6
+ metadata.gz: 9ab5c817f001fb525e698b1e3588690bfbcf7952fd85faebe27df6e1c214cceecb5502ec0aedc39e74f33a0e1255524fe172059f1d9b870f1fec9eb245b526b1
7
+ data.tar.gz: 9338e0e75eae30e96717ffa45053ae7fbd03383f49b22793a0b4b87ddfcfb17d508ae6197490093a6aab7e859a67426d329731907949b992a334ecee765a71b7
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/nmea_plus.svg)](https://rubygems.org/gems/nmea_plus)
4
4
  [![Build Status](https://travis-ci.org/ifreecarve/nmea_plus.svg)](https://travis-ci.org/ifreecarve/nmea_plus)
5
- [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/nmea_plus/1.0.6)
5
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/nmea_plus/1.0.7)
6
6
 
7
7
  [NMEA Plus](https://github.com/ifreecarve/nmea_plus) is a Ruby gem for parsing and decoding "GPS" messages: NMEA, AIS, and any other similar formats of short messaging typically used by marine equipment. It provides convenient access (by name) to the fields of each message type, and a stream reader designed for use with Ruby Blocks.
8
8
 
@@ -97,7 +97,7 @@ Because the message types are standard, if no override is found for a particular
97
97
  Additionally, AIS message type definitions were implemented from the unofficial spec found here:
98
98
  http://catb.org/gpsd/AIVDM.html
99
99
 
100
- > Currently AIVDM messages types 1, 2, 3, 4, 5, 8, 9, 12, 14, 18, 19, and 21 are implemented.
100
+ > Currently AIVDM messages types 1, 2, 3, 4, 5, 8, 9, 12, 14, 18, 19, 20, 21, and 24 are implemented.
101
101
 
102
102
  Support for proprietary messages is also possible. PASHR is included as proof-of-concept.
103
103
 
@@ -114,4 +114,4 @@ This gem was written by Ian Katz (ifreecarve@gmail.com) in 2015. It's released
114
114
 
115
115
  ## See Also
116
116
 
117
- * [Contributing](CONTRIBUTING.md)
117
+ * [Contributing](CONTRIBUTING.md)
@@ -25,7 +25,9 @@ require_relative "vdm_payload/vdm_msg9"
25
25
  require_relative "vdm_payload/vdm_msg12"
26
26
  require_relative "vdm_payload/vdm_msg14"
27
27
  require_relative "vdm_payload/vdm_msg18" # also includes 19
28
+ require_relative "vdm_payload/vdm_msg20"
28
29
  require_relative "vdm_payload/vdm_msg21"
30
+ require_relative "vdm_payload/vdm_msg24"
29
31
 
30
32
  module NMEAPlus
31
33
  module Message
@@ -1,5 +1,3 @@
1
- class Class
2
- end
3
1
 
4
2
  module NMEAPlus
5
3
  module Message
@@ -8,6 +6,9 @@ module NMEAPlus
8
6
  module VDMPayload
9
7
  # The base class for the AIS payload (of {NMEAPlus::Message::AIS::VDM}), which uses its own encoding for its own subtypes
10
8
  class VDMMsg
9
+
10
+ def initialize; end
11
+
11
12
  # @return [String] The raw "armored payload" in the original message
12
13
  attr_accessor :payload_bitstring
13
14
 
@@ -225,6 +226,11 @@ module NMEAPlus
225
226
  end
226
227
  end
227
228
 
229
+ # An MMSI is associated with an auxiliary craft when it is of the form 98XXXYYYY
230
+ def auxiliary_craft?
231
+ 980_000_000 < source_mmsi && source_mmsi < 990_000_000
232
+ end
233
+
228
234
  end
229
235
 
230
236
  # We haven't defined all the AIS payload types, so this is a catch-all
@@ -0,0 +1,29 @@
1
+ require_relative 'vdm_msg'
2
+
3
+ module NMEAPlus
4
+ module Message
5
+ module AIS
6
+ module VDMPayload
7
+ # Type 20 Data Link Management Message
8
+ class VDMMsg20 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
9
+ payload_reader :offset1, 40, 12, :_u
10
+ payload_reader :reserved_slots1, 52, 4, :_u
11
+ payload_reader :timeout1, 56, 3, :_u
12
+ payload_reader :increment1, 59, 11, :_u
13
+ payload_reader :offset2, 70, 12, :_u
14
+ payload_reader :reserved_slots2, 82, 4, :_u
15
+ payload_reader :timeout2, 86, 3, :_u
16
+ payload_reader :increment2, 89, 11, :_u
17
+ payload_reader :offset3, 100, 12, :_u
18
+ payload_reader :reserved_slots3, 112, 4, :_u
19
+ payload_reader :timeout3, 116, 3, :_u
20
+ payload_reader :increment3, 119, 11, :_u
21
+ payload_reader :offset4, 130, 12, :_u
22
+ payload_reader :reserved_slots4, 142, 4, :_u
23
+ payload_reader :timeout4, 146, 3, :_u
24
+ payload_reader :increment4, 149, 11, :_u
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -7,6 +7,7 @@ module NMEAPlus
7
7
  # Type 21: Aid-to-Navigation Report
8
8
  class VDMMsg21 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
9
9
 
10
+ # TODO: Navaid type descriptions (there are 32 of them)
10
11
  payload_reader :aid_type, 38, 5, :_e
11
12
  payload_reader :name, 43, 120, :_t
12
13
 
@@ -38,6 +39,7 @@ module NMEAPlus
38
39
 
39
40
  payload_reader :name_extension, 272, 88, :_t
40
41
 
42
+ # TODO: full name property?
41
43
  end
42
44
  end
43
45
  end
@@ -0,0 +1,50 @@
1
+ require_relative 'vdm_msg'
2
+
3
+ module NMEAPlus
4
+ module Message
5
+ module AIS
6
+ module VDMPayload
7
+ # Type 24: Static Data Report
8
+ class VDMMsg24 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
9
+
10
+ payload_reader :part_number, 38, 2, :_u
11
+
12
+ # Override default bitstring setting to dynamically calculate what fields belong in this message
13
+ # which can be either part A or part B dpeending on the {#part_number} field
14
+ def payload_bitstring=(val)
15
+ super
16
+
17
+ case part_number
18
+ when 0
19
+ self.class.payload_reader :name, 40, 120, :_t
20
+ when 1
21
+ self.class.payload_reader :ship_cargo_type, 40, 8, :_e
22
+ self.class.payload_reader :vendor_id, 48, 18, :_t
23
+ self.class.payload_reader :model_code, 66, 4, :_u
24
+ self.class.payload_reader :serial_number, 70, 20, :_u
25
+ self.class.payload_reader :callsign, 90, 42, :_t
26
+
27
+ # If the MMSI is that of an auxiliary craft, these 30 bits are read as the MMSI of the mother ship.
28
+ # otherwise they are the vessel dimensions
29
+ if auxiliary_craft?
30
+ self.class.payload_reader :mothership_mmsi, 132, 30, :_u
31
+ else
32
+ self.class.payload_reader :ship_dimension_to_bow, 132, 9, :_u
33
+ self.class.payload_reader :ship_dimension_to_stern, 141, 9, :_u
34
+ self.class.payload_reader :ship_dimension_to_port, 150, 6, :_u
35
+ self.class.payload_reader :ship_dimension_to_starboard, 156, 6, :_u
36
+ end
37
+ end
38
+ end
39
+
40
+ # @!parse attr_reader :ship_cargo_type_description
41
+ # @return [String] Cargo type description
42
+ def ship_cargo_type_description
43
+ get_ship_cargo_type_description(ship_cargo_type)
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module NMEAPlus
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nmea_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Katz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: racc
@@ -201,7 +201,9 @@ files:
201
201
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg12.rb
202
202
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg14.rb
203
203
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg18.rb
204
+ - lib/nmea_plus/message/ais/vdm_payload/vdm_msg20.rb
204
205
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg21.rb
206
+ - lib/nmea_plus/message/ais/vdm_payload/vdm_msg24.rb
205
207
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg4.rb
206
208
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg5.rb
207
209
  - lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb