nmea_plus 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -6
- data/lib/nmea_plus/message/ais/vdm.rb +1 -0
- data/lib/nmea_plus/message/ais/vdm_payload/payload.rb +198 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg.rb +21 -147
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg1.rb +28 -33
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg18.rb +5 -24
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg21.rb +2 -12
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg27.rb +30 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg4.rb +2 -13
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg5.rb +1 -1
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8.rb +48 -1
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d1f31.rb +139 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg8d366f56.rb +29 -0
- data/lib/nmea_plus/message/ais/vdm_payload/vdm_msg9.rb +2 -13
- data/lib/nmea_plus/message/nmea/aam.rb +1 -1
- data/lib/nmea_plus/message/nmea/alm.rb +1 -0
- data/lib/nmea_plus/message/nmea/apa.rb +1 -0
- data/lib/nmea_plus/message/nmea/apb.rb +1 -0
- data/lib/nmea_plus/message/nmea/bod.rb +1 -0
- data/lib/nmea_plus/message/nmea/bwc.rb +1 -0
- data/lib/nmea_plus/message/nmea/bwr.rb +1 -0
- data/lib/nmea_plus/message/nmea/bww.rb +1 -0
- data/lib/nmea_plus/message/nmea/dbk.rb +1 -0
- data/lib/nmea_plus/message/nmea/dbs.rb +1 -0
- data/lib/nmea_plus/message/nmea/dbt.rb +1 -0
- data/lib/nmea_plus/message/nmea/dcn.rb +1 -0
- data/lib/nmea_plus/message/nmea/dpt.rb +1 -0
- data/lib/nmea_plus/message/nmea/dtm.rb +1 -0
- data/lib/nmea_plus/message/nmea/fsi.rb +1 -0
- data/lib/nmea_plus/message/nmea/gbs.rb +1 -0
- data/lib/nmea_plus/message/nmea/gga.rb +1 -1
- data/lib/nmea_plus/message/nmea/glc.rb +1 -0
- data/lib/nmea_plus/message/nmea/gll.rb +1 -0
- data/lib/nmea_plus/message/nmea/gns.rb +1 -0
- data/lib/nmea_plus/message/nmea/grs.rb +1 -0
- data/lib/nmea_plus/message/nmea/gsa.rb +1 -0
- data/lib/nmea_plus/message/nmea/gst.rb +1 -0
- data/lib/nmea_plus/message/nmea/gsv.rb +1 -0
- data/lib/nmea_plus/message/nmea/gtd.rb +1 -0
- data/lib/nmea_plus/message/nmea/gxa.rb +1 -0
- data/lib/nmea_plus/message/nmea/hdg.rb +1 -0
- data/lib/nmea_plus/message/nmea/hdm.rb +1 -0
- data/lib/nmea_plus/message/nmea/hdt.rb +1 -0
- data/lib/nmea_plus/message/nmea/hfb.rb +1 -0
- data/lib/nmea_plus/message/nmea/hsc.rb +1 -0
- data/lib/nmea_plus/message/nmea/its.rb +1 -0
- data/lib/nmea_plus/message/nmea/lcd.rb +1 -0
- data/lib/nmea_plus/message/nmea/msk.rb +1 -0
- data/lib/nmea_plus/message/nmea/mss.rb +1 -0
- data/lib/nmea_plus/message/nmea/mtw.rb +1 -0
- data/lib/nmea_plus/message/nmea/mwv.rb +1 -0
- data/lib/nmea_plus/message/nmea/oln.rb +1 -0
- data/lib/nmea_plus/message/nmea/osd.rb +1 -0
- data/lib/nmea_plus/message/nmea/pashr.rb +1 -0
- data/lib/nmea_plus/message/nmea/r00.rb +1 -0
- data/lib/nmea_plus/message/nmea/rma.rb +1 -0
- data/lib/nmea_plus/message/nmea/rmb.rb +1 -0
- data/lib/nmea_plus/message/nmea/rmc.rb +1 -0
- data/lib/nmea_plus/message/nmea/rot.rb +1 -0
- data/lib/nmea_plus/message/nmea/rpm.rb +1 -0
- data/lib/nmea_plus/message/nmea/rsa.rb +1 -0
- data/lib/nmea_plus/message/nmea/rsd.rb +1 -0
- data/lib/nmea_plus/message/nmea/rte.rb +1 -0
- data/lib/nmea_plus/message/nmea/sfi.rb +1 -0
- data/lib/nmea_plus/message/nmea/stn.rb +1 -0
- data/lib/nmea_plus/message/nmea/tds.rb +1 -0
- data/lib/nmea_plus/message/nmea/tfi.rb +1 -0
- data/lib/nmea_plus/message/nmea/tpc.rb +1 -0
- data/lib/nmea_plus/message/nmea/tpr.rb +1 -0
- data/lib/nmea_plus/message/nmea/tpt.rb +1 -0
- data/lib/nmea_plus/message/nmea/trf.rb +1 -0
- data/lib/nmea_plus/message/nmea/ttm.rb +1 -0
- data/lib/nmea_plus/message/nmea/vbw.rb +1 -0
- data/lib/nmea_plus/message/nmea/vdr.rb +1 -0
- data/lib/nmea_plus/message/nmea/vhw.rb +1 -0
- data/lib/nmea_plus/message/nmea/vlw.rb +1 -0
- data/lib/nmea_plus/message/nmea/vpw.rb +1 -0
- data/lib/nmea_plus/message/nmea/vtg.rb +1 -0
- data/lib/nmea_plus/message/nmea/vwr.rb +1 -0
- data/lib/nmea_plus/message/nmea/wcv.rb +1 -0
- data/lib/nmea_plus/message/nmea/wnc.rb +1 -0
- data/lib/nmea_plus/message/nmea/wpl.rb +1 -0
- data/lib/nmea_plus/message/nmea/xdr.rb +1 -0
- data/lib/nmea_plus/message/nmea/xte.rb +1 -0
- data/lib/nmea_plus/message/nmea/xtr.rb +1 -0
- data/lib/nmea_plus/message/nmea/zda.rb +1 -0
- data/lib/nmea_plus/message/nmea/zfo.rb +1 -0
- data/lib/nmea_plus/message/nmea/ztg.rb +1 -0
- data/lib/nmea_plus/version.rb +1 -1
- metadata +8 -4
@@ -12,21 +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
|
-
|
16
|
-
case navigational_status
|
17
|
-
when 0 then return "Under way using engine"
|
18
|
-
when 1 then return "At anchor"
|
19
|
-
when 2 then return "Not under command"
|
20
|
-
when 3 then return "Restricted manoeuverability"
|
21
|
-
when 4 then return "Constrained by her draught"
|
22
|
-
when 5 then return "Moored"
|
23
|
-
when 6 then return "Aground"
|
24
|
-
when 7 then return "Engaged in Fishing"
|
25
|
-
when 8 then return "Under way sailing"
|
26
|
-
when 14 then return "AIS-SART active"
|
27
|
-
else
|
28
|
-
return "undefined"
|
29
|
-
end
|
15
|
+
get_navigational_status_description(navigational_status)
|
30
16
|
end
|
31
17
|
|
32
18
|
# The rate of turn in degrees per minute
|
@@ -35,35 +21,44 @@ module NMEAPlus
|
|
35
21
|
def rate_of_turn
|
36
22
|
ret = _i(42, 8)
|
37
23
|
return nil if ret == -128
|
38
|
-
(_I(42, 8, 3) / 4.733)
|
24
|
+
(_I(42, 8, 3) / 4.733)**2
|
39
25
|
end
|
40
26
|
|
41
|
-
payload_reader :speed_over_ground, 50, 10, :_U,
|
27
|
+
payload_reader :speed_over_ground, 50, 10, :_U, 10
|
42
28
|
payload_reader :position_10m_accuracy?, 60, 1, :_b
|
29
|
+
payload_reader :longitude, 61, 28, :_I, 60 * 10**4, 181
|
30
|
+
payload_reader :latitude, 89, 27, :_I, 60 * 10**4, 91
|
31
|
+
payload_reader :course_over_ground, 116, 12, :_U, 10, 3600
|
32
|
+
payload_reader :true_heading, 128, 9, :_u, 511
|
43
33
|
|
44
|
-
# @!
|
45
|
-
|
46
|
-
|
47
|
-
|
34
|
+
# @!visibility private
|
35
|
+
payload_reader :_time_stamp, 137, 6, :_u
|
36
|
+
|
37
|
+
# @!parse attr_reader :time_stamp
|
38
|
+
# @return [Integer]
|
39
|
+
def time_stamp
|
40
|
+
ret = _time_stamp
|
41
|
+
59 < ret ? nil : ret
|
48
42
|
end
|
49
43
|
|
50
|
-
# @!parse attr_reader :
|
51
|
-
# @return [
|
52
|
-
def
|
53
|
-
|
44
|
+
# @!parse attr_reader :position_manual_input?
|
45
|
+
# @return [bool]
|
46
|
+
def position_manual_input?
|
47
|
+
61 == _time_stamp
|
54
48
|
end
|
55
49
|
|
56
|
-
|
50
|
+
# @!parse attr_reader :position_estimated?
|
51
|
+
# @return [bool]
|
52
|
+
def position_estimated?
|
53
|
+
62 == _time_stamp
|
54
|
+
end
|
57
55
|
|
58
|
-
# @!parse attr_reader :
|
59
|
-
# @return [
|
60
|
-
def
|
61
|
-
|
62
|
-
return nil if ret == 511 # means "not available"
|
63
|
-
ret
|
56
|
+
# @!parse attr_reader :position_inoperative?
|
57
|
+
# @return [bool]
|
58
|
+
def position_inoperative?
|
59
|
+
63 == _time_stamp
|
64
60
|
end
|
65
61
|
|
66
|
-
payload_reader :time_stamp, 137, 6, :_u
|
67
62
|
payload_reader :special_manoeuvre, 143, 2, :_e
|
68
63
|
payload_reader :raim?, 148, 1, :_b
|
69
64
|
|
@@ -8,31 +8,12 @@ module NMEAPlus
|
|
8
8
|
# Base class for "Class B CS Position Report" messages (18 and 19)
|
9
9
|
class VDMMsgClassBCSPosition < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
10
10
|
|
11
|
-
payload_reader :speed_over_ground, 46, 10, :_U,
|
11
|
+
payload_reader :speed_over_ground, 46, 10, :_U, 10
|
12
12
|
payload_reader :position_10m_accuracy?, 56, 1, :_b
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
13
|
+
payload_reader :longitude, 57, 28, :_I, 60 * 10**4, 181
|
14
|
+
payload_reader :latitude, 85, 27, :_I, 60 * 10**4, 91
|
15
|
+
payload_reader :course_over_ground, 112, 12, :_U, 10
|
16
|
+
payload_reader :true_heading, 124, 9, :_u, 511
|
36
17
|
payload_reader :time_stamp, 133, 6, :_u
|
37
18
|
|
38
19
|
end
|
@@ -12,18 +12,8 @@ module NMEAPlus
|
|
12
12
|
payload_reader :name, 43, 120, :_t
|
13
13
|
|
14
14
|
payload_reader :position_10m_accuracy?, 163, 1, :_b
|
15
|
-
|
16
|
-
|
17
|
-
# @return [Float]
|
18
|
-
def longitude
|
19
|
-
_I(164, 28, 4) / 60
|
20
|
-
end
|
21
|
-
|
22
|
-
# @!parse attr_reader :latitude
|
23
|
-
# @return [Float]
|
24
|
-
def latitude
|
25
|
-
_U(192, 27, 4) / 60
|
26
|
-
end
|
15
|
+
payload_reader :longitude, 164, 28, :_I, 60 * 10**4, 181
|
16
|
+
payload_reader :latitude, 192, 27, :_I, 60 * 10**4, 91
|
27
17
|
|
28
18
|
payload_reader :ship_dimension_to_bow, 219, 9, :_u
|
29
19
|
payload_reader :ship_dimension_to_stern, 228, 9, :_u
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 27: Long Range AIS Broadcast message
|
8
|
+
class VDMMsg27 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
payload_reader :position_10m_accuracy?, 38, 1, :_b
|
11
|
+
payload_reader :raim?, 39, 1, :_b
|
12
|
+
payload_reader :navigational_status, 40, 4, :_u
|
13
|
+
|
14
|
+
# @!parse attr_reader :navigational_status_description
|
15
|
+
# @return [String] the human-readable description of navigational status
|
16
|
+
def navigational_status_description
|
17
|
+
get_navigational_status_description(navigational_status)
|
18
|
+
end
|
19
|
+
|
20
|
+
payload_reader :longitude, 44, 18, :_I, 60 * 10, 181
|
21
|
+
payload_reader :latitude, 62, 17, :_I, 60 * 10, 91
|
22
|
+
payload_reader :speed_over_ground, 79, 6, :_u
|
23
|
+
payload_reader :course_over_ground, 85, 9, :_u, 511
|
24
|
+
payload_reader :gnss?, 94, 1, :_b
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -19,19 +19,8 @@ module NMEAPlus
|
|
19
19
|
end
|
20
20
|
|
21
21
|
payload_reader :position_10m_accuracy?, 78, 1, :_b
|
22
|
-
|
23
|
-
|
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
|
-
|
22
|
+
payload_reader :longitude, 79, 28, :_I, 60 * 10**4, 181
|
23
|
+
payload_reader :latitude, 107, 27, :_I, 60 * 10**4, 91
|
35
24
|
payload_reader :epfd_type, 134, 4, :_e
|
36
25
|
payload_reader :raim?, 148, 1, :_b
|
37
26
|
|
@@ -1,18 +1,65 @@
|
|
1
1
|
require_relative 'vdm_msg'
|
2
|
+
require_relative 'vdm_msg8d1f31'
|
3
|
+
require_relative 'vdm_msg8d366f56'
|
2
4
|
|
3
5
|
module NMEAPlus
|
4
6
|
module Message
|
5
7
|
module AIS
|
6
8
|
module VDMPayload
|
9
|
+
|
7
10
|
# Type 8: Binary Broadcast Message
|
8
11
|
class VDMMsg8 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
12
|
+
|
9
13
|
payload_reader :designated_area_code, 40, 10, :_u
|
10
14
|
payload_reader :functional_id, 50, 6, :_u
|
15
|
+
|
16
|
+
# Dynamic Payload containing fields for the appropriate message 8 subtype.
|
17
|
+
# This is a factory method for the container class
|
18
|
+
# @!parse attr_reader :dp
|
19
|
+
# @return [VDMPayload::VDMMsg::VDMMsg8DynamicPayload]
|
20
|
+
def dp
|
21
|
+
ret = _dynamic_payload_container
|
22
|
+
ret.payload_bitstring = payload_bitstring
|
23
|
+
ret.fill_bits = fill_bits
|
24
|
+
ret
|
25
|
+
end
|
26
|
+
|
27
|
+
# Dynamically calculate what message subtype to use
|
28
|
+
# which depends on the designated_area_code and functional_id
|
29
|
+
def _dynamic_payload_container
|
30
|
+
class_identifier = "NMEAPlus::Message::AIS::VDMPayload::VDMMsg8d#{designated_area_code}f#{functional_id}"
|
31
|
+
ret = _object_by_name(class_identifier)
|
32
|
+
return ret unless ret.nil?
|
33
|
+
|
34
|
+
# 316 / 366
|
35
|
+
if designated_area_code == 316
|
36
|
+
class_identifier = "NMEAPlus::Message::AIS::VDMPayload::VDMMsg8d366f#{functional_id}"
|
37
|
+
ret = _object_by_name(class_identifier)
|
38
|
+
return ret unless ret.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
_object_by_name("NMEAPlus::Message::AIS::VDMPayload::VDMMsg8Undefined") # generic
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return an object by its class name, or nil if it isn't defined
|
45
|
+
def _object_by_name(class_identifier)
|
46
|
+
Object::const_get(class_identifier).new
|
47
|
+
rescue ::NameError
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# Base class for dynamic payloads (subtypes) of AIS VDM message 8
|
54
|
+
class VDMMsg8DynamicPayload < NMEAPlus::Message::AIS::VDMPayload::Payload; end
|
55
|
+
|
56
|
+
# Placeholder for undefined message 8 payload subtypes
|
57
|
+
class VDMMsg8Undefined < NMEAPlus::Message::AIS::VDMPayload::VDMMsg8DynamicPayload
|
11
58
|
payload_reader :application_data_2b, 56, 952, :_d
|
12
59
|
payload_reader :application_data_6b, 56, 952, :_6b_string
|
13
60
|
payload_reader :application_data_8b, 56, 952, :_8b_data_string
|
14
|
-
|
15
61
|
end
|
62
|
+
|
16
63
|
end
|
17
64
|
end
|
18
65
|
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
# Type 8: Binary Broadcast Message Subtype: Meteorological and Hydrological Data (IMO289)
|
8
|
+
class VDMMsg8d1f31 < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
9
|
+
|
10
|
+
payload_reader :longitude, 56, 25, :_I, 60 * 10**3, 181
|
11
|
+
payload_reader :latitude, 81, 24, :_I, 60 * 10**3, 91
|
12
|
+
payload_reader :position_10m_accuracy?, 105, 1, :_b
|
13
|
+
|
14
|
+
# @!parse attr_reader :current_time
|
15
|
+
# @return [Time] current time
|
16
|
+
def current_time
|
17
|
+
now = Time.now
|
18
|
+
day = _u(106, 5)
|
19
|
+
hour = _u(111, 5)
|
20
|
+
minute = _u(116, 6)
|
21
|
+
return nil if 0 == day
|
22
|
+
return nil if 24 == hour
|
23
|
+
return nil if 60 == minute
|
24
|
+
Time.new(now.year, now.month, day, hour, minute, 0)
|
25
|
+
end
|
26
|
+
|
27
|
+
payload_reader :wind_speed_average, 122, 7, :_u, 127
|
28
|
+
payload_reader :wind_speed_gust, 129, 7, :_u, 127
|
29
|
+
payload_reader :wind_direction, 136, 9, :_u, 360
|
30
|
+
payload_reader :wind_direction_gust, 145, 9, :_u, 360
|
31
|
+
payload_reader :air_temperature, 154, 11, :_I, 10, -1024
|
32
|
+
payload_reader :relative_humidity, 165, 7, :_u, 101
|
33
|
+
payload_reader :dew_point, 172, 10, :_I, 10, 501
|
34
|
+
payload_reader :air_pressure_hpa, 182, 9, :_UU, 1, 799, 511
|
35
|
+
payload_reader :air_pressure_tendency, 191, 2, :_u, 3
|
36
|
+
|
37
|
+
# @!parse attr_reader :air_pressure_tendency_description
|
38
|
+
# @return [String] pressure tendency description
|
39
|
+
def air_pressure_tendency_description
|
40
|
+
trend_description(air_pressure_tendency)
|
41
|
+
end
|
42
|
+
|
43
|
+
payload_reader :visibility_greater_than, 193, 1, :_b
|
44
|
+
payload_reader :horizontal_visibility, 194, 8, :_U, 10, 255
|
45
|
+
payload_reader :water_level, 201, 12, :_UU, 10**2, -10, 4001
|
46
|
+
payload_reader :water_level_tendency, 213, 2, :_u, 3
|
47
|
+
|
48
|
+
# @!parse attr_reader :water_level_tendency_description
|
49
|
+
# @return [String] water level tendency description
|
50
|
+
def water_level_tendency_description
|
51
|
+
trend_description(water_level_tendency)
|
52
|
+
end
|
53
|
+
|
54
|
+
payload_reader :water_current_speed1, 215, 8, :_U, 10, 255
|
55
|
+
payload_reader :water_current_direction1, 223, 9, :_u, 360
|
56
|
+
|
57
|
+
# surface water current
|
58
|
+
# @!parse attr_reader :water_current_depth1
|
59
|
+
# @return [Float] depth of measurement
|
60
|
+
def water_current_depth1
|
61
|
+
0
|
62
|
+
end
|
63
|
+
|
64
|
+
payload_reader :water_current_speed2, 232, 8, :_U, 10, 255
|
65
|
+
payload_reader :water_current_direction2, 240, 9, :_u, 360
|
66
|
+
payload_reader :water_current_depth2, 249, 5, :_U, 10, 31
|
67
|
+
|
68
|
+
payload_reader :water_current_speed3, 254, 8, :_U, 10, 255
|
69
|
+
payload_reader :water_current_direction3, 262, 9, :_u, 360
|
70
|
+
payload_reader :water_current_depth3, 271, 5, :_U, 10, 31
|
71
|
+
|
72
|
+
payload_reader :wave_height, 276, 8, :_U, 10, 255
|
73
|
+
payload_reader :wave_period, 284, 6, :_u, 63
|
74
|
+
payload_reader :wave_direction, 290, 9, :_u, 360
|
75
|
+
payload_reader :swell_height, 299, 8, :_U, 10, 255
|
76
|
+
payload_reader :swell_period, 307, 6, :_u, 63
|
77
|
+
payload_reader :swell_direction, 313, 9, :_u, 360
|
78
|
+
payload_reader :sea_state_beaufort, 322, 4, :_e
|
79
|
+
|
80
|
+
payload_reader :water_temperature, 326, 10, :_I, 1, 501
|
81
|
+
payload_reader :precipitation_type, 336, 3, :_u, 7
|
82
|
+
|
83
|
+
# precipitation type description
|
84
|
+
# @param [Integer] code The code for precipitation
|
85
|
+
# @return [String] the description
|
86
|
+
def precipitation_description
|
87
|
+
case precipitation_type
|
88
|
+
when 0 then return "Reserved"
|
89
|
+
when 1 then return "Rain"
|
90
|
+
when 2 then return "Thunderstorm"
|
91
|
+
when 3 then return "Freezing rain"
|
92
|
+
when 4 then return "Mixed/ice"
|
93
|
+
when 5 then return "Snow"
|
94
|
+
when 6 then return "Reserved"
|
95
|
+
# 7 is nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# @!parse attr_reader :salinity
|
100
|
+
# @return [Float] salinity
|
101
|
+
def salinity
|
102
|
+
ret = _U(339, 9, 10)
|
103
|
+
return nil if ret > 51.0 # 51.1 for sensor not available, otherwise n/a
|
104
|
+
end
|
105
|
+
|
106
|
+
# @!parse attr_reader :salinity_sensor_unavailable?
|
107
|
+
# @return [bool]
|
108
|
+
def salinity_sensor_unavailable?
|
109
|
+
_u(339, 9) == 511
|
110
|
+
end
|
111
|
+
|
112
|
+
payload_reader :ice_code, 348, 2, :_u, 3
|
113
|
+
|
114
|
+
# @param [Integer] code The code for ice
|
115
|
+
# @return [String] the description
|
116
|
+
def ice_description
|
117
|
+
case ice_code
|
118
|
+
when 0 then return "No"
|
119
|
+
when 1 then return "Yes"
|
120
|
+
when 2 then return "(reserved)"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# trend description
|
125
|
+
# @param [Integer] code The trend code
|
126
|
+
# @return [String] the description
|
127
|
+
def trend_description(code)
|
128
|
+
case code
|
129
|
+
when 0 then return "steady"
|
130
|
+
when 1 then return "decreasing"
|
131
|
+
when 2 then return "increasing"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'vdm_msg'
|
2
|
+
|
3
|
+
module NMEAPlus
|
4
|
+
module Message
|
5
|
+
module AIS
|
6
|
+
module VDMPayload
|
7
|
+
class VDMMsg8USCGEncrypted < NMEAPlus::Message::AIS::VDMPayload::VDMMsg
|
8
|
+
payload_reader :encrypted_data_2b, 56, 952, :_d
|
9
|
+
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
|
10
|
+
payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
|
11
|
+
end
|
12
|
+
|
13
|
+
# 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
|
19
|
+
|
20
|
+
# Type 8: Binary Broadcast Message Subtype: US Coast Guard (USCG) blue force encrypted data
|
21
|
+
class VDMMsg8d366f57 < VDMMsg8USCGEncrypted
|
22
|
+
payload_reader :encrypted_data_2b, 56, 952, :_d
|
23
|
+
payload_reader :encrypted_data_6b, 56, 952, :_6b_string
|
24
|
+
payload_reader :encrypted_data_8b, 56, 952, :_8b_data_string
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|