Skip to content

Java: Test Message 16 - assigned mode command #29

@schwehr

Description

@schwehr

https://github.com/schwehr/libais/blob/master/src/test/ais16_test.cc:

TEST(Ais16Test, DecodeAnything) {
  // !SAVDO,1,1,,B,@03OwnQ9RgLP3h0000000000,0*32,b003669978,1426173689
  std::unique_ptr<Ais16> msg = Init(
      "!SAVDO,1,1,,B,@03OwnQ9RgLP3h0000000000,0*32");

  Validate(
      msg.get(), 0, 3669978, 0,
      308461000, 60, 0,  // Destination A.
      0, 0, 00,  // Destination B.
      -1);
}

TEST(Ais16Test, BitsLeftOver) {
  std::unique_ptr<Ais16> msg(new Ais16("@fffffhfffffffff", 4));
  EXPECT_TRUE(msg->had_error());
  EXPECT_EQ(AIS_ERR_BAD_BIT_COUNT, msg->get_error());
}

TEST(Ais16Test, InvalidButCommon168Bits) {
  // !AIVDM,1,1,,B,@bQBNdhP010Fh<LMb;:GLOvJP4@d,0*7F
  std::unique_ptr<Ais16> msg(new Ais16("@bQBNdhP010Fh<LMb;:GLOvJP4@d", 0));
  Validate(msg.get(), 2, 705994419, 0, 134218757, 2819, 113, 916638301, 3199,
           922, -1);
}

https://github.com/schwehr/libais/blob/master/test/data/typeexamples.json

!AIVDM,1,1,,A,@TFtghNJ4G5?C7mV,0*3D,d-109,S1632,t010843.00,T43.5188,r003669945,1325984926,1325984896
{"repeat": 2, "increment2": 0, "offset2": 0, "increment1": 982, "mmsi": 292499393, "spare2": 6, "mmsi2": 0, "scaled": true, "spare": 3, "device": "stdin", "type": 16, "class": "AIS", "mmsi1": 646208595, "offset1": 3377}

https://github.com/schwehr/libais/blob/master/test/data/test.aivdm

# 16 - "@" Assigned mode command
!AIVDM,1,1,,A,@pCdoqggJc1KHfk`lIowv;WB,0*3C,d-113,S1457,t044938.00,T38.85972309,r01SPTW1,1272430182
!AIVDM,1,1,,B,@;IoLG5SKikg2E6fBW:?sTKV,0*36,r17PJUN1,1272433312
!AIVDM,1,1,,A,@m6t?hGwsbFuG59:M0,4*04,d-124,S2090,t074655.00,T55.73818711,r07RTRU1,1272440816
!AIVDM,1,1,,B,@h3OwhiGOl583h0000000500,0*30,b003669956,1272442253
!AIVDM,1,1,,B,@h3OwhiGOl583h0000000500,0*30,b003669954,1272442372
!AIVDM,1,1,,B,@h3OwhiGOl583h0000000500,0*30,b003669956,1272442494
!AIVDM,1,1,,B,@h3OwhiGOl583h0000000500,0*30,b003669952,1272442614
!AIVDM,1,1,,B,@lI`<5vWhhn2=4NA;Qo6G@,4*62,r17PANC1,1272446831
!AIVDM,1,1,,A,@u9D<59lD97uMwtAOWp,2*68,d-127,S1746,t100546.00,T46.57176849,r09NGMI1,1272449149

https://git.savannah.gnu.org/cgit/gpsd.git/tree/test/sample.aivdm#n667

# From AISHub. These are only a regression test to check that the C and Python
# decoders do the same thing, not yet checked against other
# decoders. 
#
# This is the 96-bit version addressing just one destination MMSI.
!AIVDM,1,1,,A,@01uEO@mMk7P<P00,0*18
#       Message Type             : 16
#       Repeat Indicator         : 0
#       MMSI                     : 2053501
#       Interrogated MMSI 1      : 224251000
#       First slot offset        : 200
#       First slot increment     : 0
#
# FIX-ME: Need an example of the 144-bit variant of type 16 with two MMSIs, g.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions