Beispiel #1
0
def decode_msg_27(bit_arr: bitarray.bitarray) -> typing.Dict:
    """
    Long Range AIS Broadcast message
    Src: https://gpsd.gitlab.io/gpsd/AIVDM.html#_type_27_long_range_ais_broadcast_message
    """
    get_int_from_data = partial(get_int, bit_arr)
    return {
        'type': get_int_from_data(0, 6),
        'repeat': get_int_from_data(8, 8),
        'mmsi': get_int_from_data(8, 38),
        'accuracy': bit_arr[38],
        'raim': bit_arr[39],
        'status': NavigationStatus(get_int_from_data(40, 44)),
        'lon': get_int_from_data(44, 62, signed=True) / 600.0,
        'lat': get_int_from_data(62, 79, signed=True) / 600.0,
        'speed': get_int_from_data(79, 85),
        'course': get_int_from_data(85, 94),
        'gnss': bit_arr[94],
    }
Beispiel #2
0
def decode_msg_1(bit_arr: bitarray) -> dict:
    """
    AIS Vessel position report using SOTDMA (Self-Organizing Time Division Multiple Access)
    Src: https://gpsd.gitlab.io/gpsd/AIVDM.html#_types_1_2_and_3_position_report_class_a
    """
    get_int_from_data = partial(get_int, bit_arr)
    return {
        'type': get_int_from_data(0, 6),
        'repeat': get_int_from_data(6, 8),
        'mmsi': get_int_from_data(8, 38),
        'status': NavigationStatus(get_int_from_data(38, 42)),
        'turn': get_int_from_data(42, 50, signed=True),
        'speed': get_int_from_data(50, 60) / 10.0,
        'accuracy': bit_arr[60],
        'lon': get_int_from_data(61, 89, signed=True) / 600000.0,
        'lat': get_int_from_data(89, 116, signed=True) / 600000.0,
        'course': get_int_from_data(116, 128) * 0.1,
        'heading': get_int_from_data(128, 137),
        'second': get_int_from_data(137, 143),
        'maneuver': ManeuverIndicator(get_int_from_data(143, 145)),
        'raim': bit_arr[148],
        'radio': get_int_from_data(149, bit_arr.length()),
    }
Beispiel #3
0
 def test_nav_status(self):
     self.assertEqual(NavigationStatus(3), NavigationStatus.RestrictedManoeuverability)
     self.assertEqual(NavigationStatus(17), NavigationStatus.Undefined)