Skip to content

Commit

Permalink
feature: add BASE and ATON
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Feb 9, 2020
1 parent fe35435 commit b5a1d48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions hooks/VDM.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ const msgTypeToTransmitterClass = {
1: "A",
2: "A",
3: "A",
4: "BASE",
5: "A",
18: "B",
19: "B",
21: "ATON",
24: "B"
}

Expand Down
16 changes: 9 additions & 7 deletions test/VDM.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ describe('VDM', function() {
it('AtoN converts ok', () => {
const delta = new Parser().parse('!AIVDM,1,1,,A,E>k`sUoJK@@@@@@@@@@@@@@@@@@MAhJS;@neP00000N000,0*0D\n')
delta.context.should.equal('atons.urn:mrn:imo:mmsi:993672087')
delta.updates[0].values[1].value.name.should.equal('46')
delta.updates[0].values[2].path.should.equal('navigation.position')
delta.updates[0].values[2].value.longitude.should.equal(-76.128155)
delta.updates[0].values[2].value.latitude.should.equal(39.36828666666667)
delta.updates[0].values[3].path.should.equal('atonType')
delta.updates[0].values[3].value.name.should.equal('Beacon, Starboard Hand')
delta.updates[0].values[3].value.id.should.equal(14)
console.log(JSON.stringify(delta, null, 2))
delta.updates[0].values.filter(pathValue => pathValue.path === '')[0].value.mmsi.should.equal('993672087')
delta.updates[0].values.filter(pathValue => pathValue.path === '')[1].value.name.should.equal('46')

delta.updates[0].values.find(pathValue => pathValue.path === 'navigation.position').value.longitude.should.equal(-76.128155)
delta.updates[0].values.find(pathValue => pathValue.path === 'navigation.position').value.latitude.should.equal(39.36828666666667)
delta.updates[0].values.find(pathValue => pathValue.path === 'atonType').value.name.should.equal('Beacon, Starboard Hand')
delta.updates[0].values.find(pathValue => pathValue.path === 'atonType').value.id.should.equal(14)
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('ATON')
})

it('SAR aircraft', () => {
Expand Down

0 comments on commit b5a1d48

Please sign in to comment.