Skip to content

MMSIs should be output as strings, with zero prefixes preserved #391

@tkurki

Description

@tkurki

Works with canboat with "002442103" as MMSI

echo '2019-01-25T19:00:00.326Z,7,129793,43,255,26,04,77,43,25,00,bd,73,b1,02,ae,39,ef,1e,03,f0,db,c4,28,c9,c2,00,01,46,10,00,fc' | ./rel/darwin-arm64/analyzer -json | tail -1 | json
INFO 2026-01-29T20:07:21.093Z [analyzer] Detected FAST format with all frames on one line
{
  "timestamp": "2019-01-25T19:00:00.326Z",
  "prio": 7,
  "src": 43,
  "dst": 255,
  "pgn": 129793,
  "description": "AIS UTC and Date Report",
  "fields": {
    "Message ID": "Base station report",
    "Repeat Indicator": "Initial",
    "User ID": "002442103",
    "Longitude": 4.5183933,
    "Latitude": 51.899435,
    "Position Accuracy": "High",
    "RAIM": "in use",
    "Reserved": "00",
    "Position Time": "18:59:59.0000",
    "Communication State": "C9 C2 00",
    "AIS Transceiver information": "Channel A VDL reception",
    "Position Date": "2019.01.25",
    "GNSS type": "GPS"
  }
}

but canboatjs mangles the MMSI as a number

echo '2019-01-25T19:00:00.326Z,7,129793,43,255,26,04,77,43,25,00,bd,73,b1,02,ae,39,ef,1e,03,f0,db,c4,28,c9,c2,00,01,46,10,00,fc' | dist/bin/analyzerjs.js | json
{
  "pgn": 129793,
  "prio": 7,
  "src": 43,
  "dst": 255,
  "timestamp": "2019-01-25T19:00:00.326Z",
  "input": [
    "2019-01-25T19:00:00.326Z,7,129793,43,255,26,04,77,43,25,00,bd,73,b1,02,ae,39,ef,1e,03,f0,db,c4,28,c9,c2,00,01,46,10,00,fc"
  ],
  "description": "AIS UTC and Date Report",
  "fields": {
    "Message ID": "Base station report",
    "Repeat Indicator": "Initial",
    "User ID": 2442103,
    "Longitude": 4.5183933,
    "Latitude": 51.899435,
    "Position Accuracy": "High",
    "RAIM": "in use",
    "Reserved1": 0,
    "Position Time": "18:59:59",
    "Communication State": 49865,
    "AIS Transceiver information": "Channel A VDL reception",
    "Position Date": "2019.01.25",
    "Reserved2": 0,
    "GNSS type": "GPS"
  },
  "id": "aisUtcAndDateReport"
}

canboat/canboat#267

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions