nmea_plus 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +5 -5
- data/lib/nmea_plus/message/ais/vdm_payload/payload.rb +3 -0
- data/lib/nmea_plus/message/ais/vdm_payload/sub_area.rb +140 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb +0 -2
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg6.rb +2 -13
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg6_dynamic_payload.rb +21 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb +2 -2
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d235f10.rb +2 -2
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb +3 -12
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8_dynamic_payload.rb +21 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d1f22.rb +210 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d1f31.rb +2 -2
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb +9 -12
- data/lib/nmea_plus/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4995804e2eba3842192e6ca02309efe1867b439a
|
4
|
+
data.tar.gz: ff77b5f6dee8dc838fd7a62c321c0655f4c81033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0354acd88c7ca3c349d12d6be23e127ec8468e3db846eb99156ce8a15be2b6f461a60d3cd4473542f0ce6303ebdd6f15dcbcc8ac1aa9c0c27f6306843cf88a3
|
7
|
+
data.tar.gz: fdbdb7dfbbc1164242a9226d0d19583f25180141b554db6681c4573219039a9a7fa0ec4198b1684dea6f8d47b86e9ea90935b2dbcd39a2a6cbfac434bda0f4ad
|
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
lib/nmea_plus.rb lib/nmea_plus/message/nmea/base_nmea.rb lib/nmea_plus/message/ais/vdm_payload/
|
1
|
+
lib/nmea_plus.rb lib/nmea_plus/message/nmea/base_nmea.rb lib/nmea_plus/message/ais/vdm_payload/payload.rb lib/nmea_plus/message/ais/vdm_payload/*_dynamic_payload.rb lib/nmea_plus/message/ais/vdm_payload/subarea.rb lib/**/*.rb
|
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.
|
5
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/nmea_plus/1.0.10)
|
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
|
|
@@ -89,7 +89,7 @@ end
|
|
89
89
|
This gem was coded to accept the standard NMEA messages defined in the unoffical spec found here:
|
90
90
|
http://www.catb.org/gpsd/NMEA.txt
|
91
91
|
|
92
|
-
Because the message types are standard, if no override is found for a particular talker ID then the message will parse according to the command (the last 3 characters) of the data type. In other words,
|
92
|
+
Because the message types are standard, if no override is found for a particular talker ID then the message will parse according to the command (the last 3 characters) of the data type. In other words, `$GPGLL` will use the general `GLL` message type. Currently, the following standard message types are supported:
|
93
93
|
|
94
94
|
> AAM, ALM, APA, APB, BOD, BWC, BWR, BWW, DBK, DBS, DBT, DCN, DPT, DTM, FSI, GBS, GGA, GLC, GLL, GNS, GRS, GSA, GST, GSV, GTD, GXA, HDG, HDM, HDT, HFB, HSC, ITS, LCD, MSK, MSS, MTW, MWV, OLN, OSD, R00, RMA, RMB, RMC, ROT, RPM, RSA, RSD, RTE, SFI, STN, TDS, TFI, TPC, TPR, TPT, TRF, TTM, VBW, VDR, VHW, VLW, VPW, VTG, VWR, WCV, WNC, WPL, XDR, XTE, XTR, ZDA, ZFO, ZTG
|
95
95
|
|
@@ -101,18 +101,18 @@ Support for proprietary NMEA messages is also possible. PASHR is included as pr
|
|
101
101
|
AIS message type definitions were implemented from the unofficial spec found here:
|
102
102
|
http://catb.org/gpsd/AIVDM.html
|
103
103
|
|
104
|
-
The AIS payload can be found in the
|
104
|
+
The AIS payload can be found in the payload field of a `VDM` message (aka `!AIVDM`, `!ABVDM`, `!SAVDM`). Currently, the following AIS message types are supported:
|
105
105
|
|
106
106
|
> 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 18, 19, 20, 21, 24, 27
|
107
107
|
|
108
108
|
> Type 6 subtypes for DAC/FID: 235/10, 1022/61
|
109
109
|
|
110
|
-
> Type 8 subtypes for DAC/FID: 1/31, 366/56, 366/57
|
110
|
+
> Type 8 subtypes for DAC/FID: 1/22, 1/31, 366/56, 366/57
|
111
111
|
|
112
112
|
|
113
113
|
## Disclaimer
|
114
114
|
|
115
|
-
This module was written from information scraped together on the web,
|
115
|
+
This module was written primarily from information scraped together on the web, with minimal testing on an actual device (an SR161 AIS receiver). A lack of test cases -- especially for more obscure message types -- is a barrier to completeness. Please don't entrust your life or the safety of a ship to this code without doing your own rigorous testing.
|
116
116
|
|
117
117
|
|
118
118
|
## Author
|
@@ -2,6 +2,9 @@
|
|
2
2
|
module NMEAPlus
|
3
3
|
module Message
|
4
4
|
module AIS
|
5
|
+
|
6
|
+
# This module contains all the VDM payload types and subtypes.
|
7
|
+
# @see VDMMsg
|
5
8
|
module VDMPayload
|
6
9
|
# Basic tools for interpreting the armored (binary) payload encoding of AIS.
|
7
10
|
# This class provides convenience functions for accessing the fields as the appropriate data type,
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
module NMEAPlus
|
3
|
+
module Message
|
4
|
+
module AIS
|
5
|
+
module VDMPayload
|
6
|
+
# A sub-structure in a payload: 87 bits describing a shape
|
7
|
+
class SubArea < Payload
|
8
|
+
|
9
|
+
payload_reader :shape_id, 0, 3, :_e
|
10
|
+
|
11
|
+
# @!parse attr_reader :shape_description
|
12
|
+
# @return [String] Shape description
|
13
|
+
def shape_description
|
14
|
+
case shape_id
|
15
|
+
when 0 then "Circle or point"
|
16
|
+
when 1 then "Rectangle"
|
17
|
+
when 2 then "Sector"
|
18
|
+
when 3 then "Polyline"
|
19
|
+
when 4 then "Polygon"
|
20
|
+
when 5 then "Associated text"
|
21
|
+
when 6, 7 then "Reserved"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
# Catch-all for undefined shape IDs
|
28
|
+
class SubAreaUndefined < SubArea; end
|
29
|
+
|
30
|
+
# SubArea structure base type for a region with scale
|
31
|
+
class SubAreaScaled < SubArea
|
32
|
+
payload_reader :scale_factor, 3, 2, :_u
|
33
|
+
|
34
|
+
# @!parse attr_reader :scale_meters
|
35
|
+
# @return [Integer] Scale factor represented in meters to multiply by
|
36
|
+
def scale_meters
|
37
|
+
10**scale_factor
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# SubArea structure base type for a region anchored to a point
|
42
|
+
class SubAreaAnchored < SubAreaScaled
|
43
|
+
payload_reader :longitude, 5, 25, :_I, 60 * 10**3, 181
|
44
|
+
payload_reader :latitude, 30, 24, :_I, 60 * 10**3, 91
|
45
|
+
payload_reader :precision, 54, 3, :_u
|
46
|
+
end
|
47
|
+
|
48
|
+
# SubArea structure type 0: Circle or point
|
49
|
+
class SubArea0 < SubAreaAnchored
|
50
|
+
payload_reader :radius, 57, 12, :_u
|
51
|
+
|
52
|
+
# @!parse attr_reader :radius_meters
|
53
|
+
# @return [Integer] Radius in meters, according to scale factor
|
54
|
+
def radius_meters
|
55
|
+
radius * scale_meters
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# SubArea structure type 1: Rectangle
|
60
|
+
class SubArea1 < SubAreaAnchored
|
61
|
+
payload_reader :dimension_east, 57, 8, :_u
|
62
|
+
payload_reader :dimension_north, 65, 8, :_u
|
63
|
+
|
64
|
+
payload_reader :orientation, 73, 9, :_u
|
65
|
+
|
66
|
+
# @!parse attr_reader :dimension_east_meters
|
67
|
+
# @return [Integer] Box dimension in meters, according to scale factor
|
68
|
+
def dimension_east_meters
|
69
|
+
dimension_east * scale_meters
|
70
|
+
end
|
71
|
+
|
72
|
+
# @!parse attr_reader :dimension_east_meters
|
73
|
+
# @return [Integer] Box dimension in meters, according to scale factor
|
74
|
+
def dimension_north_meters
|
75
|
+
dimension_north * scale_meters
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# SubArea structure type 2: Sector
|
80
|
+
class SubArea2 < SubAreaAnchored
|
81
|
+
payload_reader :radius, 57, 12, :_u
|
82
|
+
payload_reader :boundary_left, 69, 9, :_u
|
83
|
+
payload_reader :boundary_right, 78, 9, :_u
|
84
|
+
|
85
|
+
# @!parse attr_reader :radius_meters
|
86
|
+
# @return [Integer] Radius in meters, according to scale factor
|
87
|
+
def radius_meters
|
88
|
+
radius * scale_meters
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# SubArea structure type 3: Polyline
|
94
|
+
class SubArea3 < SubAreaScaled
|
95
|
+
|
96
|
+
payload_reader :bearing1, 5, 10, :_u, 720
|
97
|
+
payload_reader :distance1, 15, 10, :_u
|
98
|
+
payload_reader :bearing2, 25, 10, :_u, 720
|
99
|
+
payload_reader :distance2, 35, 10, :_u
|
100
|
+
payload_reader :bearing3, 45, 10, :_u, 720
|
101
|
+
payload_reader :distance3, 55, 10, :_u
|
102
|
+
payload_reader :bearing4, 65, 10, :_u, 720
|
103
|
+
payload_reader :distance4, 75, 10, :_u
|
104
|
+
|
105
|
+
class ShapePoint
|
106
|
+
attr_accessor :bearing
|
107
|
+
attr_accessor :distance
|
108
|
+
attr_accessor :distance_meters
|
109
|
+
end
|
110
|
+
|
111
|
+
# @!parse attr_reader :points
|
112
|
+
# @return [Array] Array of points
|
113
|
+
def points
|
114
|
+
ret = []
|
115
|
+
|
116
|
+
# load up from existing properties
|
117
|
+
(1..4).each do |i|
|
118
|
+
d = send("distance#{i}")
|
119
|
+
sp = ShapePoint.new
|
120
|
+
sp.bearing = send("bearing#{i}")
|
121
|
+
sp.distance = d
|
122
|
+
sp.distance_meters = d * scale_meters
|
123
|
+
ret << sp
|
124
|
+
end
|
125
|
+
ret
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# SubArea structure type 4: Polygon
|
130
|
+
class SubArea4 < SubArea3; end
|
131
|
+
|
132
|
+
# SubArea structure type 5: Associated text
|
133
|
+
class SubArea5 < SubArea
|
134
|
+
payload_reader :text, 3, 84, :_t
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -3,8 +3,6 @@ require_relative "payload"
|
|
3
3
|
module NMEAPlus
|
4
4
|
module Message
|
5
5
|
module AIS
|
6
|
-
# This module contains all the VDM payload types and subtypes.
|
7
|
-
# @see {VDMMsg}
|
8
6
|
module VDMPayload
|
9
7
|
|
10
8
|
# The base class for the {NMEAPlus::Message::AIS::VDM#ais AIS payload}, which uses its own encoding for its own subtypes
|
@@ -19,7 +19,7 @@ module NMEAPlus
|
|
19
19
|
# Dynamic Payload containing fields for the appropriate message 6 subtype.
|
20
20
|
# This is a factory method for the container class
|
21
21
|
# @!parse attr_reader :dp
|
22
|
-
# @return [
|
22
|
+
# @return [VDMMsg6DynamicPayload]
|
23
23
|
def dp
|
24
24
|
ret = _dynamic_payload_container
|
25
25
|
ret.payload_bitstring = payload_bitstring
|
@@ -34,21 +34,10 @@ module NMEAPlus
|
|
34
34
|
ret = _object_by_name(class_identifier)
|
35
35
|
return ret unless ret.nil?
|
36
36
|
|
37
|
-
_object_by_name("NMEAPlus::Message::AIS::VDMPayload::
|
37
|
+
_object_by_name("NMEAPlus::Message::AIS::VDMPayload::VDMMsg6Undefined") # generic
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
41
|
-
|
42
|
-
# Base class for dynamic payloads (subtypes) of AIS VDM message 6
|
43
|
-
class VDMMsg6DynamicPayload < NMEAPlus::Message::AIS::VDMPayload::Payload; end
|
44
|
-
|
45
|
-
# Placeholder for undefined message 8 payload subtypes
|
46
|
-
class VDMMsg6Undefined < NMEAPlus::Message::AIS::VDMPayload::VDMMsg6DynamicPayload
|
47
|
-
payload_reader :application_data_2b, 56, 952, :_d
|
48
|
-
payload_reader :application_data_6b, 56, 952, :_6b_string
|
49
|
-
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
50
|
-
end
|
51
|
-
|
52
41
|
end
|
53
42
|
end
|
54
43
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'payload'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
|
8
|
+
# Base class for dynamic payloads (subtypes) of AIS VDM message 6
|
9
|
+
class VDMMsg6DynamicPayload < NMEAPlus::Message::AIS::VDMPayload::Payload; end
|
10
|
+
|
11
|
+
# Placeholder for undefined message 6 payload subtypes
|
12
|
+
class VDMMsg6Undefined < NMEAPlus::Message::AIS::VDMPayload::VDMMsg6DynamicPayload
|
13
|
+
payload_reader :application_data_2b, 56, 952, :_d
|
14
|
+
payload_reader :application_data_6b, 56, 952, :_6b_string
|
15
|
+
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'vdm_msg6_dynamic_payload'
|
2
2
|
|
3
3
|
module NMEAPlus
|
4
4
|
module Message
|
@@ -7,7 +7,7 @@ module NMEAPlus
|
|
7
7
|
|
8
8
|
# Type 6: Binary Addressed Message Subtype: Sealite SL125 Lantern or 155 Apollo Lantern
|
9
9
|
# This message has an ascii CSV payload wrapped in an armored AIS payload, wrapped in the NMEA CSV payload.
|
10
|
-
class VDMMsg6d1022f61 < NMEAPlus::Message::AIS::VDMPayload::
|
10
|
+
class VDMMsg6d1022f61 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg6DynamicPayload
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
super
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'vdm_msg6_dynamic_payload'
|
2
2
|
|
3
3
|
module NMEAPlus
|
4
4
|
module Message
|
@@ -6,7 +6,7 @@ module NMEAPlus
|
|
6
6
|
module VDMPayload
|
7
7
|
|
8
8
|
# Type 6: Binary Addressed Message Subtype: GLA Aid to Navigation Monitoring Data
|
9
|
-
class VDMMsg6d235f10 < NMEAPlus::Message::AIS::VDMPayload::
|
9
|
+
class VDMMsg6d235f10 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg6DynamicPayload
|
10
10
|
|
11
11
|
payload_reader :analog_internal, 88, 10, :_U, 20, 0
|
12
12
|
payload_reader :analog_external1, 98, 10, :_U, 20, 0
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'vdm_msg'
|
2
|
+
require_relative 'vdm_msg8d1f22'
|
2
3
|
require_relative 'vdm_msg8d1f31'
|
3
4
|
require_relative 'vdm_msg8d366f56'
|
4
5
|
|
@@ -16,7 +17,7 @@ module NMEAPlus
|
|
16
17
|
# Dynamic Payload containing fields for the appropriate message 8 subtype.
|
17
18
|
# This is a factory method for the container class
|
18
19
|
# @!parse attr_reader :dp
|
19
|
-
# @return [
|
20
|
+
# @return [VDMMsg8DynamicPayload]
|
20
21
|
def dp
|
21
22
|
ret = _dynamic_payload_container
|
22
23
|
ret.payload_bitstring = payload_bitstring
|
@@ -26,6 +27,7 @@ module NMEAPlus
|
|
26
27
|
|
27
28
|
# Dynamically calculate what message subtype to use
|
28
29
|
# which depends on the designated_area_code and functional_id
|
30
|
+
# @private
|
29
31
|
def _dynamic_payload_container
|
30
32
|
class_identifier = "NMEAPlus::Message::AIS::VDMPayload::VDMMsg8d#{designated_area_code}f#{functional_id}"
|
31
33
|
ret = _object_by_name(class_identifier)
|
@@ -42,17 +44,6 @@ module NMEAPlus
|
|
42
44
|
end
|
43
45
|
|
44
46
|
end
|
45
|
-
|
46
|
-
# Base class for {VDMMsg8#dp dynamic payload}s (subtypes) of {VDMMsg8 AIS VDM message 8}
|
47
|
-
class VDMMsg8DynamicPayload < NMEAPlus::Message::AIS::VDMPayload::Payload; end
|
48
|
-
|
49
|
-
# Placeholder for undefined message 8 payload subtypes
|
50
|
-
class VDMMsg8Undefined < NMEAPlus::Message::AIS::VDMPayload::VDMMsg8DynamicPayload
|
51
|
-
payload_reader :application_data_2b, 56, 952, :_d
|
52
|
-
payload_reader :application_data_6b, 56, 952, :_6b_string
|
53
|
-
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
54
|
-
end
|
55
|
-
|
56
47
|
end
|
57
48
|
end
|
58
49
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'payload'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
|
8
|
+
# Base class for {VDMMsg8#dp dynamic payload}s (subtypes) of {VDMMsg8 AIS VDM message 8}
|
9
|
+
class VDMMsg8DynamicPayload < NMEAPlus::Message::AIS::VDMPayload::Payload; end
|
10
|
+
|
11
|
+
# Placeholder for undefined message 8 payload subtypes
|
12
|
+
class VDMMsg8Undefined < VDMMsg8DynamicPayload
|
13
|
+
payload_reader :application_data_2b, 56, 952, :_d
|
14
|
+
payload_reader :application_data_6b, 56, 952, :_6b_string
|
15
|
+
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
require_relative 'vdm_msg8_dynamic_payload'
|
2
|
+
require_relative 'sub_area'
|
3
|
+
|
4
|
+
module NMEAPlus
|
5
|
+
module Message
|
6
|
+
module AIS
|
7
|
+
module VDMPayload
|
8
|
+
# Type 8: Binary Broadcast Message Subtype: Area Notice (addressed)
|
9
|
+
class VDMMsg8d1f22 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg8DynamicPayload
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
super
|
13
|
+
@sub_areas = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def payload_bitstring=(val)
|
17
|
+
# Override default bitstring setting to dynamically calculate what SubArea fields belong in this message
|
18
|
+
super
|
19
|
+
|
20
|
+
@sub_areas = []
|
21
|
+
(111...val.length).step(87).each do |pos|
|
22
|
+
shape_id = _u(pos, 3) # 3 bits at the beginning form the shape ID
|
23
|
+
container = _dynamic_subarea_container(shape_id)
|
24
|
+
container.payload_bitstring = payload_bitstring[pos..(pos + 87)]
|
25
|
+
@sub_areas << container
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Dynamically calculate what subarea type to use
|
30
|
+
# which depends on the designated_area_code and functional_id
|
31
|
+
# @private
|
32
|
+
def _dynamic_subarea_container(shape_id)
|
33
|
+
class_identifier = "NMEAPlus::Message::AIS::VDMPayload::SubArea#{shape_id}"
|
34
|
+
ret = _object_by_name(class_identifier)
|
35
|
+
return ret unless ret.nil?
|
36
|
+
|
37
|
+
_object_by_name("NMEAPlus::Message::AIS::VDMPayload::SubAreaUndefined") # generic
|
38
|
+
end
|
39
|
+
|
40
|
+
payload_reader :linkage_id, 56, 10, :_u
|
41
|
+
payload_reader :notice_id, 66, 7, :_u
|
42
|
+
|
43
|
+
# @!parse attr_reader :notice_description
|
44
|
+
# @return [String] Area notice description
|
45
|
+
def notice_description
|
46
|
+
case notice_id
|
47
|
+
when 0 then "Caution Area: Marine mammals habitat"
|
48
|
+
when 1 then "Caution Area: Marine mammals in area - reduce speed"
|
49
|
+
when 2 then "Caution Area: Marine mammals in area - stay clear"
|
50
|
+
when 3 then "Caution Area: Marine mammals in area - report sightings"
|
51
|
+
when 4 then "Caution Area: Protected habitat - reduce speed"
|
52
|
+
when 5 then "Caution Area: Protected habitat - stay clear"
|
53
|
+
when 6 then "Caution Area: Protected habitat - no fishing or anchoring"
|
54
|
+
when 7 then "Caution Area: Derelicts (drifting objects)"
|
55
|
+
when 8 then "Caution Area: Traffic congestion"
|
56
|
+
when 9 then "Caution Area: Marine event"
|
57
|
+
when 10 then "Caution Area: Divers down"
|
58
|
+
when 11 then "Caution Area: Swim area"
|
59
|
+
when 12 then "Caution Area: Dredge operations"
|
60
|
+
when 13 then "Caution Area: Survey operations"
|
61
|
+
when 14 then "Caution Area: Underwater operation"
|
62
|
+
when 15 then "Caution Area: Seaplane operations"
|
63
|
+
when 16 then "Caution Area: Fishery - nets in water"
|
64
|
+
when 17 then "Caution Area: Cluster of fishing vessels"
|
65
|
+
when 18 then "Caution Area: Fairway closed"
|
66
|
+
when 19 then "Caution Area: Harbour closed"
|
67
|
+
when 20 then "Caution Area: Risk (define in associated text field)"
|
68
|
+
when 21 then "Caution Area: Underwater vehicle operation"
|
69
|
+
when 22 then "(reserved for future use)"
|
70
|
+
when 23 then "Environmental Caution Area: Storm front (line squall)"
|
71
|
+
when 24 then "Environmental Caution Area: Hazardous sea ice"
|
72
|
+
when 25 then "Environmental Caution Area: Storm warning (storm cell or line of storms)"
|
73
|
+
when 26 then "Environmental Caution Area: High wind"
|
74
|
+
when 27 then "Environmental Caution Area: High waves"
|
75
|
+
when 28 then "Environmental Caution Area: Restricted visibility (fog, rain, etc.)"
|
76
|
+
when 29 then "Environmental Caution Area: Strong currents"
|
77
|
+
when 30 then "Environmental Caution Area: Heavy icing"
|
78
|
+
when 31 then "(reserved for future use)"
|
79
|
+
when 32 then "Restricted Area: Fishing prohibited"
|
80
|
+
when 33 then "Restricted Area: No anchoring."
|
81
|
+
when 34 then "Restricted Area: Entry approval required prior to transit"
|
82
|
+
when 35 then "Restricted Area: Entry prohibited"
|
83
|
+
when 36 then "Restricted Area: Active military OPAREA"
|
84
|
+
when 37 then "Restricted Area: Firing - danger area."
|
85
|
+
when 38 then "Restricted Area: Drifting Mines"
|
86
|
+
when 39 then "(reserved for future use)"
|
87
|
+
when 40 then "Anchorage Area: Anchorage open"
|
88
|
+
when 41 then "Anchorage Area: Anchorage closed"
|
89
|
+
when 42 then "Anchorage Area: Anchorage prohibited"
|
90
|
+
when 43 then "Anchorage Area: Deep draft anchorage"
|
91
|
+
when 44 then "Anchorage Area: Shallow draft anchorage"
|
92
|
+
when 45 then "Anchorage Area: Vessel transfer operations"
|
93
|
+
when 46 then "(reserved for future use)"
|
94
|
+
when 47 then "(reserved for future use)"
|
95
|
+
when 48 then "(reserved for future use)"
|
96
|
+
when 49 then "(reserved for future use)"
|
97
|
+
when 50 then "(reserved for future use)"
|
98
|
+
when 51 then "(reserved for future use)"
|
99
|
+
when 52 then "(reserved for future use)"
|
100
|
+
when 53 then "(reserved for future use)"
|
101
|
+
when 54 then "(reserved for future use)"
|
102
|
+
when 55 then "(reserved for future use)"
|
103
|
+
when 56 then "Security Alert - Level 1"
|
104
|
+
when 57 then "Security Alert - Level 2"
|
105
|
+
when 57 then "Security Alert - Level 3"
|
106
|
+
when 59 then "(reserved for future use)"
|
107
|
+
when 60 then "(reserved for future use)"
|
108
|
+
when 61 then "(reserved for future use)"
|
109
|
+
when 62 then "(reserved for future use)"
|
110
|
+
when 63 then "(reserved for future use)"
|
111
|
+
when 64 then "Distress Area: Vessel disabled and adrift"
|
112
|
+
when 65 then "Distress Area: Vessel sinking"
|
113
|
+
when 66 then "Distress Area: Vessel abandoning ship"
|
114
|
+
when 67 then "Distress Area: Vessel requests medical assistance"
|
115
|
+
when 68 then "Distress Area: Vessel flooding"
|
116
|
+
when 69 then "Distress Area: Vessel fire/explosion"
|
117
|
+
when 70 then "Distress Area: Vessel grounding"
|
118
|
+
when 71 then "Distress Area: Vessel collision"
|
119
|
+
when 72 then "Distress Area: Vessel listing/capsizing"
|
120
|
+
when 73 then "Distress Area: Vessel under assault"
|
121
|
+
when 74 then "Distress Area: Person overboard"
|
122
|
+
when 75 then "Distress Area: SAR area"
|
123
|
+
when 76 then "Distress Area: Pollution response area"
|
124
|
+
when 77 then "(reserved for future use)"
|
125
|
+
when 78 then "(reserved for future use)"
|
126
|
+
when 79 then "(reserved for future use)"
|
127
|
+
when 80 then "Instruction: Contact VTS at this point/juncture"
|
128
|
+
when 81 then "Instruction: Contact Port Administration at this point/juncture"
|
129
|
+
when 82 then "Instruction: Do not proceed beyond this point/juncture"
|
130
|
+
when 83 then "Instruction: Await instructions prior to proceeding beyond this point/juncture"
|
131
|
+
when 84 then "Proceed to this location - await instructions"
|
132
|
+
when 85 then "Clearance granted - proceed to berth"
|
133
|
+
when 86 then "(reserved for future use)"
|
134
|
+
when 87 then "(reserved for future use)"
|
135
|
+
when 88 then "Information: Pilot boarding position"
|
136
|
+
when 89 then "Information: Icebreaker waiting area"
|
137
|
+
when 90 then "Information: Places of refuge"
|
138
|
+
when 91 then "Information: Position of icebreakers"
|
139
|
+
when 92 then "Information: Location of response units"
|
140
|
+
when 93 then "VTS active target"
|
141
|
+
when 94 then "Rogue or suspicious vessel"
|
142
|
+
when 95 then "Vessel requesting non-distress assistance"
|
143
|
+
when 96 then "Chart Feature: Sunken vessel"
|
144
|
+
when 97 then "Chart Feature: Submerged object"
|
145
|
+
when 98 then "Chart Feature:Semi-submerged object"
|
146
|
+
when 99 then "Chart Feature: Shoal area"
|
147
|
+
when 100 then "Chart Feature: Shoal area due north"
|
148
|
+
when 101 then "Chart Feature: Shoal area due east"
|
149
|
+
when 102 then "Chart Feature: Shoal area due south"
|
150
|
+
when 103 then "Chart Feature: Shoal area due west"
|
151
|
+
when 104 then "Chart Feature: Channel obstruction"
|
152
|
+
when 105 then "Chart Feature: Reduced vertical clearance"
|
153
|
+
when 106 then "Chart Feature: Bridge closed"
|
154
|
+
when 107 then "Chart Feature: Bridge partially open"
|
155
|
+
when 108 then "Chart Feature: Bridge fully open"
|
156
|
+
when 109 then "(reserved for future use)"
|
157
|
+
when 110 then "(reserved for future use)"
|
158
|
+
when 111 then "(reserved for future use)"
|
159
|
+
when 112 then "Report from ship: Icing info"
|
160
|
+
when 113 then "(reserved for future use)"
|
161
|
+
when 114 then "Report from ship: Miscellaneous information - define in associated text field"
|
162
|
+
when 115 then "(reserved for future use)"
|
163
|
+
when 116 then "(reserved for future use)"
|
164
|
+
when 117 then "(reserved for future use)"
|
165
|
+
when 118 then "(reserved for future use)"
|
166
|
+
when 119 then "(reserved for future use)"
|
167
|
+
when 120 then "Route: Recommended route"
|
168
|
+
when 121 then "Route: Alternative route"
|
169
|
+
when 122 then "Route: Recommended route through ice"
|
170
|
+
when 123 then "(reserved for future use)"
|
171
|
+
when 124 then "(reserved for future use)"
|
172
|
+
when 125 then "Other - Define in associated text field"
|
173
|
+
when 126 then "Cancellation - cancel area as identified by Message Linkage ID"
|
174
|
+
when 127 then "Undefined (default)"
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# @!parse attr_reader :utc_time
|
179
|
+
# @return [Time] utc time
|
180
|
+
def utc_time
|
181
|
+
now = Time.now
|
182
|
+
month = _u(73, 4)
|
183
|
+
day = _u(77, 5)
|
184
|
+
hour = _u(82, 5)
|
185
|
+
minute = _u(87, 6)
|
186
|
+
return nil if 0 == month
|
187
|
+
return nil if 24 == hour
|
188
|
+
return nil if 60 == minute
|
189
|
+
Time.new(now.year, month, day, hour, minute, 0)
|
190
|
+
end
|
191
|
+
|
192
|
+
payload_reader :duration, 93, 18, :_u, 262_143
|
193
|
+
|
194
|
+
# Sub-areas defined by this message
|
195
|
+
# @return [Array] An array of {SubArea} objects
|
196
|
+
attr_accessor :sub_areas
|
197
|
+
|
198
|
+
# @!parse attr_reader :sub_area_text
|
199
|
+
# @return [String] The concatenated text of all subarea texts
|
200
|
+
def sub_area_text
|
201
|
+
texts = sub_areas.select { |a| a.shape_id == 5 }
|
202
|
+
return nil if texts.empty?
|
203
|
+
texts.collect(&:text).join
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'vdm_msg8_dynamic_payload'
|
2
2
|
|
3
3
|
module NMEAPlus
|
4
4
|
module Message
|
5
5
|
module AIS
|
6
6
|
module VDMPayload
|
7
7
|
# Type 8: Binary Broadcast Message Subtype: Meteorological and Hydrological Data (IMO289)
|
8
|
-
class VDMMsg8d1f31 < NMEAPlus::Message::AIS::VDMPayload::
|
8
|
+
class VDMMsg8d1f31 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg8DynamicPayload
|
9
9
|
|
10
10
|
payload_reader :longitude, 56, 25, :_I, 60 * 10**3, 181
|
11
11
|
payload_reader :latitude, 81, 24, :_I, 60 * 10**3, 91
|
@@ -1,28 +1,25 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'vdm_msg8_dynamic_payload'
|
2
2
|
|
3
3
|
module NMEAPlus
|
4
4
|
module Message
|
5
5
|
module AIS
|
6
6
|
module VDMPayload
|
7
|
-
|
7
|
+
|
8
|
+
# Basic decoding of "blue force" encrypted binary messages.
|
9
|
+
# Note that this module is incapable of decrypting the messages. It can only deocde and return
|
10
|
+
# the encrypted payload to be decrypted elsewhere.
|
11
|
+
class VDMMsg8USCGEncrypted < VDMMsg8DynamicPayload
|
8
12
|
payload_reader :encrypted_data_2b, 56, 952, :_d
|
9
13
|
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
|
10
14
|
payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
|
11
15
|
end
|
12
16
|
|
13
17
|
# Type 8: Binary Broadcast Message Subtype: US Coast Guard (USCG) blue force encrypted position report
|
14
|
-
class VDMMsg8d366f56 < VDMMsg8USCGEncrypted
|
15
|
-
payload_reader :encrypted_data_2b, 56, 952, :_d
|
16
|
-
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
|
17
|
-
payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
|
18
|
-
end
|
18
|
+
class VDMMsg8d366f56 < VDMMsg8USCGEncrypted; end
|
19
19
|
|
20
20
|
# Type 8: Binary Broadcast Message Subtype: US Coast Guard (USCG) blue force encrypted data
|
21
|
-
class VDMMsg8d366f57 < VDMMsg8USCGEncrypted
|
22
|
-
|
23
|
-
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
|
24
|
-
payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
|
25
|
-
end
|
21
|
+
class VDMMsg8d366f57 < VDMMsg8USCGEncrypted; end
|
22
|
+
|
26
23
|
end
|
27
24
|
end
|
28
25
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Katz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/nmea_plus/message/ais/base_ais.rb
|
198
198
|
- lib/nmea_plus/message/ais/vdm.rb
|
199
199
|
- lib/nmea_plus/message/ais/vdm_payload/payload.rb
|
200
|
+
- lib/nmea_plus/message/ais/vdm_payload/sub_area.rb
|
200
201
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb
|
201
202
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg1.rb
|
202
203
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg12.rb
|
@@ -209,10 +210,13 @@ files:
|
|
209
210
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg4.rb
|
210
211
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg5.rb
|
211
212
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg6.rb
|
213
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg6_dynamic_payload.rb
|
212
214
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb
|
213
215
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d235f10.rb
|
214
216
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg7.rb
|
215
217
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb
|
218
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8_dynamic_payload.rb
|
219
|
+
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d1f22.rb
|
216
220
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d1f31.rb
|
217
221
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb
|
218
222
|
- lib/nmea_plus/message/ais/vdm_payload/vdm_msg9.rb
|