nmea_plus 1.0.5 → 1.0.6
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 +4 -4
- data/README.md +2 -2
- data/lib/nmea_plus/message/ais/vdm.rb +7 -1
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb +71 -2
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg1.rb +6 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg12.rb +20 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg14.rb +16 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg18.rb +75 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg21.rb +45 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg4.rb +42 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg5.rb +6 -63
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb +1 -27
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg9.rb +38 -0
- data/lib/nmea_plus/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab50fa5e587f895b72ed894cf0c4e3f280956146
|
4
|
+
data.tar.gz: 923806c46670760a1f3832b23ae93f37001f4c80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b59b0f3ea335e74df47fd85587e88907d41e61052a5a2da22f7d3fc9882fbf30a6294cad1d95cbc65774eafb6a35cb30e73293cbf547b12de916423c0c6444df
|
7
|
+
data.tar.gz: 2e572c97ed129692c193ebefa13bd20598e1e49b29fe23c99000cd669e30bab93599dac69757cb27a0a5a27d1406e3a182fd0f43ba9adfce581b5d7396c8a67c
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/nmea_plus)
|
4
4
|
[](https://travis-ci.org/ifreecarve/nmea_plus)
|
5
|
-
[](http://rubydoc.
|
5
|
+
[](http://www.rubydoc.info/gems/nmea_plus/1.0.6)
|
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, 5, and
|
100
|
+
> Currently AIVDM messages types 1, 2, 3, 4, 5, 8, 9, 12, 14, 18, 19, and 21 are implemented.
|
101
101
|
|
102
102
|
Support for proprietary messages is also possible. PASHR is included as proof-of-concept.
|
103
103
|
|
@@ -17,9 +17,15 @@ end
|
|
17
17
|
|
18
18
|
=end
|
19
19
|
|
20
|
-
require_relative "vdm_payload/vdm_msg1"
|
20
|
+
require_relative "vdm_payload/vdm_msg1" # also incldues 2 and 3
|
21
|
+
require_relative "vdm_payload/vdm_msg4"
|
21
22
|
require_relative "vdm_payload/vdm_msg5"
|
22
23
|
require_relative "vdm_payload/vdm_msg8"
|
24
|
+
require_relative "vdm_payload/vdm_msg9"
|
25
|
+
require_relative "vdm_payload/vdm_msg12"
|
26
|
+
require_relative "vdm_payload/vdm_msg14"
|
27
|
+
require_relative "vdm_payload/vdm_msg18" # also includes 19
|
28
|
+
require_relative "vdm_payload/vdm_msg21"
|
23
29
|
|
24
30
|
module NMEAPlus
|
25
31
|
module Message
|
@@ -6,7 +6,7 @@ module NMEAPlus
|
|
6
6
|
module AIS
|
7
7
|
# There are many VDM payload types, and this is their container. See {VDMMsg}.
|
8
8
|
module VDMPayload
|
9
|
-
# The base class for the AIS payload (of {NMEAPlus::Message::AIS::VDM}) which
|
9
|
+
# The base class for the AIS payload (of {NMEAPlus::Message::AIS::VDM}), which uses its own encoding for its own subtypes
|
10
10
|
class VDMMsg
|
11
11
|
# @return [String] The raw "armored payload" in the original message
|
12
12
|
attr_accessor :payload_bitstring
|
@@ -115,7 +115,7 @@ module NMEAPlus
|
|
115
115
|
# scale an integer by dividing it by 10^decimal_places
|
116
116
|
# @param start [Integer] The index of the first bit in the payload field
|
117
117
|
# @param length [Integer] The number of bits in the payload field
|
118
|
-
# @param decimal_places [Integer] The power of ten to use in scaling the result
|
118
|
+
# @param decimal_places [Integer] The power of ten to use in scaling down the result
|
119
119
|
# @return [Integer] an integer value
|
120
120
|
def _6b_integer_scaled(start, length, decimal_places)
|
121
121
|
_6b_integer(start, length).to_f / (10 ** decimal_places)
|
@@ -156,6 +156,75 @@ module NMEAPlus
|
|
156
156
|
alias_method :_t, :_6b_string_nullterminated
|
157
157
|
alias_method :_d, :_2b_data_string
|
158
158
|
|
159
|
+
# The ship cargo type description lookup table
|
160
|
+
# @param code [Integer] The cargo type id
|
161
|
+
# @return [String] Cargo type description
|
162
|
+
def get_ship_cargo_type_description(code)
|
163
|
+
case code
|
164
|
+
when 0 then return nil
|
165
|
+
when 1...19 then return "(future use)"
|
166
|
+
when 20 then return "WIG (any)"
|
167
|
+
when 21 then return "WIG Hazardous category A"
|
168
|
+
when 22 then return "WIG Hazardous category B"
|
169
|
+
when 23 then return "WIG Hazardous category C"
|
170
|
+
when 24 then return "WIG Hazardous category D"
|
171
|
+
when 25...29 then return "WIG (future use)"
|
172
|
+
when 30 then return "Fishing"
|
173
|
+
when 31 then return "Towing"
|
174
|
+
when 32 then return "Towing (large)"
|
175
|
+
when 33 then return "Dredging/underwater ops"
|
176
|
+
when 34 then return "Diving ops"
|
177
|
+
when 35 then return "Military ops"
|
178
|
+
when 36 then return "Sailing"
|
179
|
+
when 37 then return "Pleasure craft"
|
180
|
+
when 38, 39 then return "Reserved"
|
181
|
+
when 40 then return "High Speed Craft"
|
182
|
+
when 41 then return "HSC Hazardous category A"
|
183
|
+
when 42 then return "HSC Hazardous category B"
|
184
|
+
when 43 then return "HSC Hazardous category C"
|
185
|
+
when 44 then return "HSC Hazardous category D"
|
186
|
+
when 45...48 then return "HSC (reserved)"
|
187
|
+
when 49 then return "HSC (no additional information)"
|
188
|
+
when 50 then return "Pilot Vessel"
|
189
|
+
when 51 then return "Search and Rescue Vessel"
|
190
|
+
when 52 then return "Tug"
|
191
|
+
when 53 then return "Port Tender"
|
192
|
+
when 54 then return "Anti-pollution equipment"
|
193
|
+
when 55 then return "Law Enforcement"
|
194
|
+
when 56, 57 then return "Spare - Local Vessel"
|
195
|
+
when 58 then return "Medical Transport"
|
196
|
+
when 59 then return "Noncombatant ship according to RR Resolution No. 18"
|
197
|
+
when 60 then return "Passenger"
|
198
|
+
when 61 then return "Passenger, Hazardous category A"
|
199
|
+
when 62 then return "Passenger, Hazardous category B"
|
200
|
+
when 63 then return "Passenger, Hazardous category C"
|
201
|
+
when 64 then return "Passenger, Hazardous category D"
|
202
|
+
when 65..68 then return "Passenger, Reserved for future use"
|
203
|
+
when 69 then return "Passenger, No additional information"
|
204
|
+
when 70 then return "Cargo"
|
205
|
+
when 71 then return "Cargo, Hazardous category A"
|
206
|
+
when 72 then return "Cargo, Hazardous category B"
|
207
|
+
when 73 then return "Cargo, Hazardous category C"
|
208
|
+
when 74 then return "Cargo, Hazardous category D"
|
209
|
+
when 75..78 then return "Cargo, Reserved for future use"
|
210
|
+
when 79 then return "Cargo, No additional information"
|
211
|
+
when 80 then return "Tanker"
|
212
|
+
when 81 then return "Tanker, Hazardous category A"
|
213
|
+
when 82 then return "Tanker, Hazardous category B"
|
214
|
+
when 83 then return "Tanker, Hazardous category C"
|
215
|
+
when 84 then return "Tanker, Hazardous category D"
|
216
|
+
when 85.88 then return "Tanker, Reserved for future use"
|
217
|
+
when 89 then return "Tanker, No additional information"
|
218
|
+
when 90 then return "Other Type"
|
219
|
+
when 91 then return "Other Type, Hazardous category A"
|
220
|
+
when 92 then return "Other Type, Hazardous category B"
|
221
|
+
when 93 then return "Other Type, Hazardous category C"
|
222
|
+
when 94 then return "Other Type, Hazardous category D"
|
223
|
+
when 95..98 then return "Other Type, Reserved for future use"
|
224
|
+
when 99 then return "Other Type, no additional information"
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
159
228
|
end
|
160
229
|
|
161
230
|
# We haven't defined all the AIS payload types, so this is a catch-all
|
@@ -12,6 +12,7 @@ module NMEAPlus
|
|
12
12
|
# @!parse attr_reader :navigational_status_description
|
13
13
|
# @return [String] the human-readable description of navigational status
|
14
14
|
def navigational_status_description
|
15
|
+
return nil if navigational_status.nil?
|
15
16
|
case navigational_status
|
16
17
|
when 0 then return "Under way using engine"
|
17
18
|
when 1 then return "At anchor"
|
@@ -68,8 +69,13 @@ module NMEAPlus
|
|
68
69
|
|
69
70
|
end
|
70
71
|
|
72
|
+
# Position report class A, which is really {VDMMsgCNB}
|
71
73
|
class VDMMsg1 < VDMMsgCNB; end
|
74
|
+
|
75
|
+
# Position report class A, which is really {VDMMsgCNB}
|
72
76
|
class VDMMsg2 < VDMMsgCNB; end
|
77
|
+
|
78
|
+
# Position report class A, which is really {VDMMsgCNB}
|
73
79
|
class VDMMsg3 < VDMMsgCNB; end
|
74
80
|
end
|
75
81
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 12: Addressed Safety-Related Message
|
8
|
+
class VDMMsg12 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
payload_reader :sequence_number, 38, 2, :_u
|
11
|
+
payload_reader :destination_mmsi, 40, 30, :_u
|
12
|
+
payload_reader :retransmit?, 70, 1, :_b
|
13
|
+
|
14
|
+
# Safety message
|
15
|
+
payload_reader :text, 72, 936, :_t
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 14: Safety-Related Broadcast Message
|
8
|
+
class VDMMsg14 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
# Safety message
|
11
|
+
payload_reader :text, 40, 968, :_t
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
|
8
|
+
# Base class for "Class B CS Position Report" messages (18 and 19)
|
9
|
+
class VDMMsgClassBCSPosition < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
10
|
+
|
11
|
+
payload_reader :speed_over_ground, 46, 10, :_U, 1
|
12
|
+
payload_reader :position_10m_accuracy?, 56, 1, :_b
|
13
|
+
|
14
|
+
# @!parse attr_reader :longitude
|
15
|
+
# @return [Float]
|
16
|
+
def longitude
|
17
|
+
_I(57, 28, 4) / 60
|
18
|
+
end
|
19
|
+
|
20
|
+
# @!parse attr_reader :latitude
|
21
|
+
# @return [Float]
|
22
|
+
def latitude
|
23
|
+
_U(85, 27, 4) / 60
|
24
|
+
end
|
25
|
+
|
26
|
+
payload_reader :course_over_ground, 112, 12, :_U, 1
|
27
|
+
|
28
|
+
# @!parse attr_reader :true_heading
|
29
|
+
# @return [Float]
|
30
|
+
def true_heading
|
31
|
+
ret = _u(124, 9)
|
32
|
+
return nil if ret == 511 # means "not available"
|
33
|
+
ret
|
34
|
+
end
|
35
|
+
|
36
|
+
payload_reader :time_stamp, 133, 6, :_u
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# Type 18: Standard Class B CS Position Report
|
41
|
+
class VDMMsg18 < VDMMsgClassBCSPosition
|
42
|
+
payload_reader :cs_unit?, 141, 1, :_b
|
43
|
+
payload_reader :display?, 142, 1, :_b
|
44
|
+
payload_reader :dsc?, 143, 1, :_b
|
45
|
+
payload_reader :band?, 144, 1, :_b
|
46
|
+
payload_reader :accept_message_22?, 145, 1, :_b
|
47
|
+
payload_reader :assigned?, 146, 1, :_b
|
48
|
+
payload_reader :raim?, 147, 1, :_b
|
49
|
+
end
|
50
|
+
|
51
|
+
# Type 19: Extended Class B CS Position Report
|
52
|
+
class VDMMsg19 < VDMMsgClassBCSPosition
|
53
|
+
payload_reader :name, 143, 120, :_t
|
54
|
+
payload_reader :ship_cargo_type, 263, 8, :_e
|
55
|
+
payload_reader :ship_dimension_to_bow, 271, 9, :_u
|
56
|
+
payload_reader :ship_dimension_to_stern, 280, 9, :_u
|
57
|
+
payload_reader :ship_dimension_to_port, 289, 6, :_u
|
58
|
+
payload_reader :ship_dimension_to_starboard, 295, 6, :_u
|
59
|
+
payload_reader :epfd_type, 301, 4, :_e
|
60
|
+
payload_reader :raim?, 305, 1, :_b
|
61
|
+
payload_reader :dte?, 306, 1, :_b
|
62
|
+
payload_reader :assigned?, 307, 1, :_b
|
63
|
+
|
64
|
+
# @!parse attr_reader :ship_cargo_type_description
|
65
|
+
# @return [String] Cargo type description
|
66
|
+
def ship_cargo_type_description
|
67
|
+
get_ship_cargo_type_description(ship_cargo_type)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 21: Aid-to-Navigation Report
|
8
|
+
class VDMMsg21 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
payload_reader :aid_type, 38, 5, :_e
|
11
|
+
payload_reader :name, 43, 120, :_t
|
12
|
+
|
13
|
+
payload_reader :position_10m_accuracy?, 163, 1, :_b
|
14
|
+
|
15
|
+
# @!parse attr_reader :longitude
|
16
|
+
# @return [Float]
|
17
|
+
def longitude
|
18
|
+
_I(164, 28, 4) / 60
|
19
|
+
end
|
20
|
+
|
21
|
+
# @!parse attr_reader :latitude
|
22
|
+
# @return [Float]
|
23
|
+
def latitude
|
24
|
+
_U(192, 27, 4) / 60
|
25
|
+
end
|
26
|
+
|
27
|
+
payload_reader :ship_dimension_to_bow, 219, 9, :_u
|
28
|
+
payload_reader :ship_dimension_to_stern, 228, 9, :_u
|
29
|
+
payload_reader :ship_dimension_to_port, 237, 6, :_u
|
30
|
+
payload_reader :ship_dimension_to_starboard, 243, 6, :_u
|
31
|
+
payload_reader :epfd_type, 249, 4, :_e
|
32
|
+
payload_reader :time_stamp, 253, 6, :_u
|
33
|
+
payload_reader :off_position?, 259, 1, :_b
|
34
|
+
|
35
|
+
payload_reader :raim?, 268, 1, :_b
|
36
|
+
payload_reader :virtual_aid?, 269, 1, :_b
|
37
|
+
payload_reader :assigned?, 270, 1, :_b
|
38
|
+
|
39
|
+
payload_reader :name_extension, 272, 88, :_t
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 4: Base Station Report
|
8
|
+
class VDMMsg4 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
# @!parse attr_reader :current_time
|
11
|
+
# @return [Time] current time
|
12
|
+
def current_time
|
13
|
+
Time.new(_u(38, 14),
|
14
|
+
_u(52, 4),
|
15
|
+
_u(56, 5),
|
16
|
+
_u(61, 5),
|
17
|
+
_u(66, 6),
|
18
|
+
_u(72, 6))
|
19
|
+
end
|
20
|
+
|
21
|
+
payload_reader :position_10m_accuracy?, 78, 1, :_b
|
22
|
+
|
23
|
+
# @!parse attr_reader :longitude
|
24
|
+
# @return [Float]
|
25
|
+
def longitude
|
26
|
+
_I(79, 28, 4) / 60
|
27
|
+
end
|
28
|
+
|
29
|
+
# @!parse attr_reader :latitude
|
30
|
+
# @return [Float]
|
31
|
+
def latitude
|
32
|
+
_U(107, 27, 4) / 60
|
33
|
+
end
|
34
|
+
|
35
|
+
payload_reader :epfd_type, 134, 4, :_e
|
36
|
+
payload_reader :raim?, 148, 1, :_b
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -4,6 +4,7 @@ module NMEAPlus
|
|
4
4
|
module Message
|
5
5
|
module AIS
|
6
6
|
module VDMPayload
|
7
|
+
# Type 5: Static and Voyage Related Data
|
7
8
|
class VDMMsg5 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
8
9
|
|
9
10
|
payload_reader :ais_version, 38, 2, :_u
|
@@ -17,6 +18,8 @@ module NMEAPlus
|
|
17
18
|
payload_reader :ship_dimension_to_starboard, 264, 6, :_u
|
18
19
|
payload_reader :epfd_type, 270, 4, :_e
|
19
20
|
|
21
|
+
# @!parse attr_reader :eta
|
22
|
+
# @return [Time] ETA
|
20
23
|
def eta
|
21
24
|
now = Time.now
|
22
25
|
Time.new(now.year,
|
@@ -31,70 +34,10 @@ module NMEAPlus
|
|
31
34
|
payload_reader :destination, 302, 120, :_t
|
32
35
|
payload_reader :dte?, 422, 1, :_b
|
33
36
|
|
37
|
+
# @!parse attr_reader :ship_cargo_type_description
|
38
|
+
# @return [String] Cargo type description
|
34
39
|
def ship_cargo_type_description
|
35
|
-
|
36
|
-
when 0 then return nil
|
37
|
-
when 1...19 then return "(future use)"
|
38
|
-
when 20 then return "WIG (any)"
|
39
|
-
when 21 then return "WIG Hazardous category A"
|
40
|
-
when 22 then return "WIG Hazardous category B"
|
41
|
-
when 23 then return "WIG Hazardous category C"
|
42
|
-
when 24 then return "WIG Hazardous category D"
|
43
|
-
when 25...29 then return "WIG (future use)"
|
44
|
-
when 30 then return "Fishing"
|
45
|
-
when 31 then return "Towing"
|
46
|
-
when 32 then return "Towing (large)"
|
47
|
-
when 33 then return "Dredging/underwater ops"
|
48
|
-
when 34 then return "Diving ops"
|
49
|
-
when 35 then return "Military ops"
|
50
|
-
when 36 then return "Sailing"
|
51
|
-
when 37 then return "Pleasure craft"
|
52
|
-
when 38, 39 then return "Reserved"
|
53
|
-
when 40 then return "High Speed Craft"
|
54
|
-
when 41 then return "HSC Hazardous category A"
|
55
|
-
when 42 then return "HSC Hazardous category B"
|
56
|
-
when 43 then return "HSC Hazardous category C"
|
57
|
-
when 44 then return "HSC Hazardous category D"
|
58
|
-
when 45...48 then return "HSC (reserved)"
|
59
|
-
when 49 then return "HSC (no additional information)"
|
60
|
-
when 50 then return "Pilot Vessel"
|
61
|
-
when 51 then return "Search and Rescue Vessel"
|
62
|
-
when 52 then return "Tug"
|
63
|
-
when 53 then return "Port Tender"
|
64
|
-
when 54 then return "Anti-pollution equipment"
|
65
|
-
when 55 then return "Law Enforcement"
|
66
|
-
when 56, 57 then return "Spare - Local Vessel"
|
67
|
-
when 58 then return "Medical Transport"
|
68
|
-
when 59 then return "Noncombatant ship according to RR Resolution No. 18"
|
69
|
-
when 60 then return "Passenger"
|
70
|
-
when 61 then return "Passenger, Hazardous category A"
|
71
|
-
when 62 then return "Passenger, Hazardous category B"
|
72
|
-
when 63 then return "Passenger, Hazardous category C"
|
73
|
-
when 64 then return "Passenger, Hazardous category D"
|
74
|
-
when 65..68 then return "Passenger, Reserved for future use"
|
75
|
-
when 69 then return "Passenger, No additional information"
|
76
|
-
when 70 then return "Cargo"
|
77
|
-
when 71 then return "Cargo, Hazardous category A"
|
78
|
-
when 72 then return "Cargo, Hazardous category B"
|
79
|
-
when 73 then return "Cargo, Hazardous category C"
|
80
|
-
when 74 then return "Cargo, Hazardous category D"
|
81
|
-
when 75..78 then return "Cargo, Reserved for future use"
|
82
|
-
when 79 then return "Cargo, No additional information"
|
83
|
-
when 80 then return "Tanker"
|
84
|
-
when 81 then return "Tanker, Hazardous category A"
|
85
|
-
when 82 then return "Tanker, Hazardous category B"
|
86
|
-
when 83 then return "Tanker, Hazardous category C"
|
87
|
-
when 84 then return "Tanker, Hazardous category D"
|
88
|
-
when 85.88 then return "Tanker, Reserved for future use"
|
89
|
-
when 89 then return "Tanker, No additional information"
|
90
|
-
when 90 then return "Other Type"
|
91
|
-
when 91 then return "Other Type, Hazardous category A"
|
92
|
-
when 92 then return "Other Type, Hazardous category B"
|
93
|
-
when 93 then return "Other Type, Hazardous category C"
|
94
|
-
when 94 then return "Other Type, Hazardous category D"
|
95
|
-
when 95..98 then return "Other Type, Reserved for future use"
|
96
|
-
when 99 then return "Other Type, no additional information"
|
97
|
-
end
|
40
|
+
get_ship_cargo_type_description(ship_cargo_type)
|
98
41
|
end
|
99
42
|
|
100
43
|
end
|
@@ -4,6 +4,7 @@ module NMEAPlus
|
|
4
4
|
module Message
|
5
5
|
module AIS
|
6
6
|
module VDMPayload
|
7
|
+
# Type 8: Binary Broadcast Message
|
7
8
|
class VDMMsg8 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
8
9
|
payload_reader :designated_area_code, 40, 10, :_u
|
9
10
|
payload_reader :functional_id, 50, 6, :_u
|
@@ -11,33 +12,6 @@ module NMEAPlus
|
|
11
12
|
payload_reader :application_data_6b, 56, 952, :_6b_string
|
12
13
|
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
13
14
|
|
14
|
-
payload_reader :ais_version, 38, 2, :_u
|
15
|
-
payload_reader :imo_number, 40, 30, :_u
|
16
|
-
payload_reader :callsign, 70, 42, :_t
|
17
|
-
payload_reader :name, 112, 120, :_t
|
18
|
-
payload_reader :ship_cargo_type, 232, 8, :_e
|
19
|
-
payload_reader :ship_dimension_to_bow, 240, 9, :_u
|
20
|
-
payload_reader :ship_dimension_to_stern, 249, 9, :_u
|
21
|
-
payload_reader :ship_dimension_to_port, 258, 6, :_u
|
22
|
-
payload_reader :ship_dimension_to_starboard, 264, 6, :_u
|
23
|
-
payload_reader :epfd_type, 270, 4, :_e
|
24
|
-
|
25
|
-
# @!parse attr_reader :eta
|
26
|
-
# @return [Time]
|
27
|
-
def eta
|
28
|
-
now = Time.now
|
29
|
-
Time.new(now.year,
|
30
|
-
_u(274, 4),
|
31
|
-
_u(278, 5),
|
32
|
-
_u(283, 5),
|
33
|
-
_u(288, 6),
|
34
|
-
0)
|
35
|
-
end
|
36
|
-
|
37
|
-
payload_reader :static_draught, 294, 8, :_U, 1
|
38
|
-
payload_reader :destination, 302, 120, :_t
|
39
|
-
payload_reader :dte?, 422, 1, :_b
|
40
|
-
|
41
15
|
end
|
42
16
|
end
|
43
17
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 9: Standard SAR Aircraft Position Report
|
8
|
+
class VDMMsg9 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
payload_reader :altitude_meters, 38, 12, :_u
|
11
|
+
|
12
|
+
payload_reader :speed_over_ground, 50, 10, :_U, 1
|
13
|
+
payload_reader :position_10m_accuracy?, 60, 1, :_b
|
14
|
+
|
15
|
+
# @!parse attr_reader :longitude
|
16
|
+
# @return [Float]
|
17
|
+
def longitude
|
18
|
+
_I(61, 28, 4) / 60
|
19
|
+
end
|
20
|
+
|
21
|
+
# @!parse attr_reader :latitude
|
22
|
+
# @return [Float]
|
23
|
+
def latitude
|
24
|
+
_U(89, 27, 4) / 60
|
25
|
+
end
|
26
|
+
|
27
|
+
payload_reader :course_over_ground, 116, 12, :_U, 1
|
28
|
+
payload_reader :time_stamp, 128, 6, :_u
|
29
|
+
payload_reader :dte?, 142, 1, :_b
|
30
|
+
|
31
|
+
payload_reader :assigned?, 146, 1, :_b
|
32
|
+
payload_reader :raim?, 147, 1, :_b
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/nmea_plus/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.6
|
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-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|
@@ -198,8 +198,14 @@ files:
|
|
198
198
|
- lib/nmea_plus/message/ais/vdm.rb
|
199
199
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb
|
200
200
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg1.rb
|
201
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg12.rb
|
202
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg14.rb
|
203
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg18.rb
|
204
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg21.rb
|
205
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg4.rb
|
201
206
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg5.rb
|
202
207
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb
|
208
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg9.rb
|
203
209
|
- lib/nmea_plus/message/base.rb
|
204
210
|
- lib/nmea_plus/message/nmea/aam.rb
|
205
211
|
- lib/nmea_plus/message/nmea/alm.rb
|