Class: NMEAPlus::Message::AIS::VDMPayload::VDMMsg6d1022f61

Inherits:
VDMMsg6DynamicPayload show all
Defined in:
lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb

Overview

Type 6: Binary Addressed Message Subtype: Sealite SL125 Lantern or 155 Apollo Lantern This message has an ascii CSV payload wrapped in an armored AIS payload, wrapped in the NMEA CSV payload.

Instance Attribute Summary collapse

Attributes inherited from Payload

#fill_bits, #payload_bitstring

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Payload

#_2b_data_string, #_6b_ascii, #_6b_boolean, #_6b_integer, #_6b_integer_scaled, #_6b_integer_scaled_shifted, #_6b_negated_boolean, #_6b_string, #_6b_string_nullterminated, #_6b_unsigned_integer, #_6b_unsigned_integer_scaled, #_6b_unsigned_integer_scaled_shifted, #_8b_data_string, #_access, #_bit_slices, #_get_date_mdhm, #_object_by_name, payload_reader

Constructor Details

#initializeVDMMsg6d1022f61

Returns a new instance of VDMMsg6d1022f61.



12
13
14
15
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 12

def initialize
  super
  @fields = []
end

Instance Attribute Details

#application_dataString (readonly)

The raw payload: comma separated ascii fields

Returns:

  • (String)
  • The field defined by the 384 bits starting at payload bit 88, formatted with the function Payload#_T(, , )



19
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 19

payload_reader :application_data, 88, 384, :_T

#battery_flat?bool (readonly)

Returns The value in bit 6 of the status field.

Returns:

  • (bool)

    The value in bit 6 of the status field



54
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 54

bit_reader :battery_flat?, 6

#battery_low?bool (readonly)

Returns The value in bit 7 of the status field.

Returns:

  • (bool)

    The value in bit 7 of the status field



55
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 55

bit_reader :battery_low?, 7

#battery_voltageFloat (readonly)

The battery voltage in volts

Returns:

  • (Float)


97
98
99
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 97

def battery_voltage
  @fields[3].nil? ? nil : @fields[3].to_f
end

#flash_codeString (readonly)

A vendor-specific code

Returns:

  • (String)


90
91
92
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 90

def flash_code
  @fields[2].nil? ? nil : @fields[2].hex
end

#gps_off_station?bool (readonly)

Returns The value in bit 1 of the status field.

Returns:

  • (bool)

    The value in bit 1 of the status field



49
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 49

bit_reader :gps_off_station?, 1

#gps_sync_valid?bool (readonly)

Returns The value in bit 3 of the status field.

Returns:

  • (bool)

    The value in bit 3 of the status field



51
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 51

bit_reader :gps_sync_valid?, 3

#gps_valid?bool (readonly)

Returns The value in bit 4 of the status field.

Returns:

  • (bool)

    The value in bit 4 of the status field



52
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 52

bit_reader :gps_valid?, 4

#intensity_percentFloat (readonly)

This field seems to be a 0-100% value encoded as 6-bit. The test cases seem to indicate that it is offset by +1.5625, which may mean that “3F” is a special case. But I have no data on that.

Returns:

  • (Float)


82
83
84
85
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 82

def intensity_percent
  return nil if @fields[1].nil?
  (1 + (@fields[1].hex & "3F".hex)) * (100.0 / 2**6)
end

#latitudeFloat (readonly)

Latitude

Returns:

  • (Float)


104
105
106
107
108
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 104

def latitude
  parts = @fields[4]
  return nil if parts.nil?
  NMEAPlus::Message::Base.degrees_minutes_to_decimal(parts[0..-1], parts[-1])
end

#light_sensor_dark?bool (readonly)

Returns The value in bit 2 of the status field.

Returns:

  • (bool)

    The value in bit 2 of the status field



50
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 50

bit_reader :light_sensor_dark?, 2

#longitudeFloat (readonly)

Longitude

Returns:

  • (Float)


113
114
115
116
117
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 113

def longitude
  parts = @fields[5]
  return nil if parts.nil?
  NMEAPlus::Message::Base.degrees_minutes_to_decimal(parts[0..-1], parts[-1])
end

#operation_modeInteger (readonly)

Operation mode (integer code)

Returns:

  • (Integer)


60
61
62
63
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 60

def operation_mode
  return nil if @fields[1].nil?
  @fields[1].hex >> 6
end

#operation_mode_descriptionString (readonly)

A human-readable description of the operation mode

Returns:

  • (String)


68
69
70
71
72
73
74
75
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 68

def operation_mode_description
  case operation_mode
  when 1 then "Standby"
  when 2 then "Always on"
  else
    "description n/a" # TODO
  end
end

#supply_fail?bool (readonly)

Returns The value in bit 0 of the status field.

Returns:

  • (bool)

    The value in bit 0 of the status field



48
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 48

bit_reader :supply_fail?, 0

#temperature_sensor_hot?bool (readonly)

Returns The value in bit 5 of the status field.

Returns:

  • (bool)

    The value in bit 5 of the status field



53
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 53

bit_reader :temperature_sensor_hot?, 5

Class Method Details

.bit_reader(name, position) ⇒ void

This method returns an undefined value.

Enable a shortcut syntax for bit field attributes, in the style of ‘attr_accessor` metaprogramming. This is used to create a named field pointing to a specific bit in the first field of the payload

Parameters:

  • name (String)

    What the accessor will be called

  • position (Integer)

    The bit position in this field



44
45
46
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 44

def self.bit_reader(name, position)
  self.class_eval("def #{name};_field0_bit(#{position});end")
end

Instance Method Details

#_field0_bit(position) ⇒ bool

Return a bit from the 8 bits in field 0

Parameters:

  • position (Integer)

    the bit position: 0=MSB, 7=LSB

Returns:

  • (bool)


30
31
32
33
34
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 30

def _field0_bit(position)
  return nil if @fields[1].nil?
  mask = 1 << (7 - position)
  @fields[0].hex & mask == mask
end

#payload_bitstring=(val) ⇒ Object

Override default bitstring setting to automatically load up a fields array for easier access



22
23
24
25
# File 'lib/nmea_plus/message/ais/vdm_payload/vdm_msg6d1022f61.rb', line 22

def payload_bitstring=(val)
  super
  @fields = application_data.split(",")
end