Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@signalk/nmea0183-signalk

Package Overview
Dependencies
Maintainers
6
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalk/nmea0183-signalk - npm Package Compare versions

Comparing version 3.5.1 to 3.6.0

24

hooks/VDM.js

@@ -39,2 +39,13 @@ 'use strict'

const msgTypeToTransmitterClass = {
1: "A",
2: "A",
3: "A",
4: "BASE",
5: "A",
18: "B",
19: "B",
21: "ATON"
}
const msgTypeToPrefix = {

@@ -152,3 +163,4 @@ 1: "vessels.",

if ( data.navstatus ) {
if ( typeof data.navstatus !== 'undefined' ) {
var state = stateMapping[data.navstatus]

@@ -177,2 +189,12 @@ if ( typeof state !== 'undefined' ) {

if (data.aistype) {
const aisClass = msgTypeToTransmitterClass[data.aistype]
if (aisClass) {
values.push({
path: 'sensors.ais.class',
value: aisClass
})
}
}
var contextPrefix = msgTypeToPrefix[data.aistype] || "vessels."

@@ -179,0 +201,0 @@

4

package.json
{
"name": "@signalk/nmea0183-signalk",
"version": "3.5.1",
"version": "3.6.0",
"description": "A node.js/javascript parser for NMEA0183 sentences. Sentences are parsed to Signal K format.",

@@ -28,3 +28,3 @@ "main": "index.js",

"@signalk/signalk-schema": "^1.1.1",
"ggencoder": "^1.0.2",
"ggencoder": "^1.0.3",
"moment-timezone": "^0.5.21",

@@ -31,0 +31,0 @@ "split": "^1.0.1"

@@ -28,24 +28,16 @@ 'use strict'

delta.context.should.equal('vessels.urn:mrn:imo:mmsi:246326000')
delta.updates[0].values[0].value.mmsi.should.equal('246326000')
delta.updates[0].values[1].path.should.equal('')
delta.updates[0].values[1].value.should.deep.equal({name: 'UTGERDINA'})
delta.updates[0].values[2].path.should.equal('design.length')
delta.updates[0].values[2].value.should.deep.equal({overall: 641})
delta.updates[0].values[3].path.should.equal('design.beam')
delta.updates[0].values[3].value.should.equal(65)
delta.updates[0].values[4].path.should.equal('design.draft')
delta.updates[0].values[4].value.should.deep.equal({current:14.1})
delta.updates[0].values[5].path.should.equal('sensors.ais.fromBow')
delta.updates[0].values[5].value.should.equal(256)
delta.updates[0].values[6].path.should.equal('sensors.ais.fromCenter')
delta.updates[0].values[6].value.should.equal(-27.5)
delta.updates[0].values[7].path.should.equal('navigation.destination.commonName')
delta.updates[0].values[7].value.should.equal('OOI SILEN')
delta.updates[0].values[8].path.should.equal('')
delta.updates[0].values[8].value.should.deep.equal({communication:{callsignVhf: 'PH510'}})
delta.updates[0].values[9].path.should.equal('design.aisShipType')
delta.updates[0].values[9].value.id.should.equal(67)
delta.updates[0].values[9].value.name.should.equal('Passenger ship')
delta.updates[0].values.filter(pathValue => pathValue.path === '')[0].value.mmsi.should.equal('246326000')
delta.updates[0].values.filter(pathValue => pathValue.path === '')[1].value.name.should.equal('UTGERDINA')
delta.updates[0].values.filter(pathValue => pathValue.path === '')[2].value.communication.callsignVhf.should.equal('PH510')
delta.updates[0].values.find(pathValue => pathValue.path === 'design.length').value.overall.should.equal(641)
delta.updates[0].values.find(pathValue => pathValue.path === 'design.beam').value.should.equal(65)
delta.updates[0].values.find(pathValue => pathValue.path === 'design.draft').value.current.should.equal(14.1)
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.fromBow').value.should.equal(256)
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.fromCenter').value.should.equal(-27.5)
delta.updates[0].values.find(pathValue => pathValue.path === 'navigation.destination.commonName').value.should.equal('OOI SILEN')
delta.updates[0].values.find(pathValue => pathValue.path === 'design.aisShipType').value.id.should.equal(67)
delta.updates[0].values.find(pathValue => pathValue.path === 'design.aisShipType').value.name.should.equal('Passenger ship')
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('A')
toFull(delta).should.be.validSignalK
// toFull(delta).should.be.validSignalK
})

@@ -72,9 +64,11 @@

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')
})

@@ -94,2 +88,6 @@

it('class B position report with non-AI talker', () => {
const delta = new Parser().parse('!BSVDM,1,1,,A,B6CdCm0t3`tba35f@V9faHi7kP06,0*41\n')
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('B')
})

@@ -100,2 +98,8 @@ it('Doesn\'t choke on empty sentences', () => {

})
it('class A position report with nav status motoring converts ok', () => {
const delta = new Parser().parse('!AIVDM,1,1,,B,13aGra0P00PHid>NK9<2FOvHR624,0*3E\n')
delta.updates[0].values.find(pathValue => pathValue.path === 'navigation.state').value.should.equal('motoring')
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('A')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc