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.6.0 to 3.7.0

54

hooks/VDM.js

@@ -36,3 +36,4 @@ 'use strict'

10: 'hazardous material wing in ground',
14: 'ais-sart'
14: 'ais-sart',
15: 'default'
};

@@ -63,2 +64,9 @@

const specialManeuverMapping = {
0: 'not available',
1: 'not engaged',
2: 'engaged',
3: 'reserved'
}
module.exports = function (input, session) {

@@ -199,2 +207,13 @@ const { id, sentence, parts, tags } = input

if ( data.imo ) {
values.push({
path: '',
value: {
registrations: {
imo: `IMO ${data.imo}`
}
}
})
}
var contextPrefix = msgTypeToPrefix[data.aistype] || "vessels."

@@ -211,2 +230,14 @@

}
if ( typeof data.offpos !== 'undefined' ) {
values.push({
path: 'offPosition',
value: data.offpos == 1
})
}
if ( typeof data.virtual !== 'undefined' ) {
values.push({
path: 'virtual',
value: data.virtual == 1
})
}
}

@@ -225,2 +256,23 @@

if ( typeof data.smi !== 'undefined' ) {
values.push({
path: 'navigation.specialManeuver',
value: specialManeuverMapping[data.smi]
})
}
if ( typeof data.dac !== 'undefined' ) {
values.push({
path: 'sensors.ais.designatedAreaCode',
value: data.dac
})
}
if ( typeof data.fid !== 'undefined' ) {
values.push({
path: 'sensors.ais.functionalId',
value: data.fid
})
}
if (values.length === 0) {

@@ -227,0 +279,0 @@ return null

11

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

@@ -8,3 +8,5 @@ "main": "index.js",

"test": "mocha",
"deploy": "npm test && git tag -a v$npm_package_version -m 'Release v$npm_package_version'; git push --tags; npm publish --access public --scope @signalk ."
"deploy": "npm test && npm run release && npm publish --access public --scope @signalk .",
"create-release": "github-create-release --owner signalk --repository signalk-parser-nmea0183",
"release": "git tag -d v$npm_package_version && git tag v$npm_package_version && git push --tags && git push && npm run create-release"
},

@@ -29,3 +31,3 @@ "bin": {

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

@@ -35,5 +37,6 @@ "split": "^1.0.1"

"devDependencies": {
"debug": "^4.0.1",
"@signalk/github-create-release": "^1.2.0",
"chai": "^4.1.2",
"chai-things": "^0.2.0",
"debug": "^4.0.1",
"mocha": "^6.1.3"

@@ -40,0 +43,0 @@ },

@@ -57,3 +57,2 @@ 'use strict'

should.not.exist(delta.updates[0].values.find((pv) => { return pv.path === 'navigation.speedOverGround'}))
should.not.exist(delta.updates[0].values.find((pv) => { return pv.path === 'navigation.state'}))
})

@@ -64,3 +63,2 @@

delta.context.should.equal('atons.urn:mrn:imo:mmsi:993672087')
console.log(JSON.stringify(delta, null, 2))
delta.updates[0].values.filter(pathValue => pathValue.path === '')[0].value.mmsi.should.equal('993672087')

@@ -74,2 +72,4 @@ delta.updates[0].values.filter(pathValue => pathValue.path === '')[1].value.name.should.equal('46')

delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('ATON')
delta.updates[0].values.find(pathValue => pathValue.path === 'offPosition').value.should.equal(false)
delta.updates[0].values.find(pathValue => pathValue.path === 'virtual').value.should.equal(false)
})

@@ -103,3 +103,41 @@

delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.class').value.should.equal('A')
})
it('Off Position AtoN converts ok', () => {
const delta = new Parser().parse("!AIVDM,1,1,,A,E>k`sV6rKP00000000000000000=Al7t;A5E800000N@00,0*43\n")
delta.updates[0].values.find(pathValue => pathValue.path === 'offPosition').value.should.equal(true)
})
it('class A position report with specialManeuver 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.specialManeuver').value.should.equal('not engaged')
})
it('class A position report with specialManeuver 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.specialManeuver').value.should.equal('not engaged')
})
it('msg type 8 converts ok', () => {
const delta = new Parser().parse('!AIVDM,1,1,,A,85Mv070j2d>=<e<<=PQhhg`59P00,0*26')
delta.context.should.equal('vessels.urn:mrn:imo:mmsi:366968860')
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.designatedAreaCode').value.should.equal(200)
delta.updates[0].values.find(pathValue => pathValue.path === 'sensors.ais.functionalId').value.should.equal(10)
})
it('virtual aton converts ok', () => {
const delta = new Parser().parse('!AIVDM,1,1,,A,E02E340W6@1WPab3bPa200000000:uoH?9Ur000003v010,4*5C\n')
delta.updates[0].values.find(pathValue => pathValue.path === 'virtual').value.should.equal(true)
})
it('imo conerts ok', () => {
const parser = new Parser()
let delta = parser.parse('!AIVDM,2,1,9,A,54hi<240?JU9`L<f220l4T@DhhF222222222220U5HD2:40Ht90000000000,0*60')
should.equal(delta, null)
delta = parser.parse('!AIVDM,2,2,9,A,00000000002,2*2F')
delta.context.should.equal('vessels.urn:mrn:imo:mmsi:319573000')
delta.updates[0].values.filter(pathValue => pathValue.path === '')[3].value.registrations.imo.should.equal('IMO 1010258')
})
})
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