nmea0183-signalk
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -48,2 +48,3 @@ /* | ||
VWR: require('./VWR'), | ||
ZDA: require('./ZDA'), | ||
STALK: require('./STALK'), | ||
@@ -50,0 +51,0 @@ }; |
@@ -30,6 +30,5 @@ /* | ||
*/ | ||
var session = {}; | ||
module.exports = new Codec('VDM', function(multiplexer, input, line) { | ||
var data = new Decoder(line, session); | ||
var data = new Decoder(line, multiplexer.aisSession); | ||
@@ -36,0 +35,0 @@ if (!data.valid) { |
@@ -49,2 +49,3 @@ /* | ||
this._multiplexer = new Multiplexer(this.self.id, this.self.type); | ||
this._multiplexer.aisSession = {}; | ||
this._codecs = require('../codecs'); | ||
@@ -51,0 +52,0 @@ |
@@ -16,2 +16,3 @@ /* | ||
*/ | ||
var _ = require('lodash'); | ||
@@ -185,3 +186,3 @@ ! function() { | ||
day = this.int(date.slice(0, 2), true); | ||
month = this.int(date.slice(2, 4), true); | ||
month = this.int(date.slice(2, 4)-1, true); | ||
year = this.int(date.slice(-2)); | ||
@@ -191,3 +192,3 @@ | ||
if (year < 73) { | ||
year = this.int("20" + year); | ||
year = this.int("20" + _.padStart(year, 2, '0')); | ||
} else { | ||
@@ -194,0 +195,0 @@ year = this.int("19" + year); |
{ | ||
"name": "nmea0183-signalk", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "NMEA0183 to Signal K parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,3 +7,3 @@ # signalk-parser-nmea0183 | ||
which converts [NMEA 0183](http://www.nmea.org/content/nmea_standards/nmea_0183_v_410.asp) | ||
sentences into Signal K delta messages. | ||
sentences into Signal K sparse messages. | ||
@@ -10,0 +10,0 @@ ## Supported Sentences |
@@ -5,2 +5,3 @@ var chai = require("chai"); | ||
var signalkSchema = require('signalk-schema'); | ||
const _ = require('lodash') | ||
@@ -11,3 +12,5 @@ | ||
"!AIVDM,2,1,0,A,53brRt4000010SG;700iE@LE8@Tp4000000000153P615t0Ht0SCkjH4jC1C,0*1E\n", | ||
"!AIVDM,2,2,0,A,`0000000001,2*75\n" | ||
"!AIVDM,2,2,0,A,`0000000001,2*75\n", | ||
'!AIVDM,2,1,0,A,58wt8Ui`g??r21`7S=:22058<v05Htp000000015>8OA;0sk,0*7B\n', | ||
'!AIVDM,2,2,0,A,eQ8823mDm3kP00000000000,2*5D\n' | ||
]; | ||
@@ -17,6 +20,7 @@ | ||
it(' multiline converts ok', function(done) { | ||
var parser = new(require('../lib/').Parser)({ | ||
const countDones = _.after(2, done) | ||
var parser1 = new(require('../lib/').Parser)({ | ||
selfId: 'urn:mrn:signalk:uuid:c0d79334-4e25-4245-8892-54e8ccc8021d' | ||
}); | ||
parser.on('delta', function(delta) { | ||
parser1.on('delta', function(delta) { | ||
// validate schema conformance | ||
@@ -29,6 +33,22 @@ var full = signalkSchema.deltaToFull(delta); | ||
full.vessels['urn:mrn:imo:mmsi:246326000'].should.have.property('name', 'LUTGERDINA'); | ||
done(); | ||
countDones(); | ||
}); | ||
parser.write(nmeaLines[0]); | ||
parser.write(nmeaLines[1]); | ||
var parser2 = new(require('../lib/').Parser)({ | ||
selfId: 'urn:mrn:signalk:uuid:c0d79334-4e25-4245-8892-54e8ccc8021e' | ||
}); | ||
parser2.on('delta', function(delta) { | ||
// validate schema conformance | ||
var full = signalkSchema.deltaToFull(delta); | ||
signalkSchema.fillIdentity(full); | ||
full.should.be.validSignalK; | ||
full.vessels['urn:mrn:imo:mmsi:603916439'].should.have.property('mmsi', '603916439'); | ||
full.vessels['urn:mrn:imo:mmsi:603916439'].should.have.property('name', 'ARCO AVON'); | ||
countDones(); | ||
}); | ||
parser1.write(nmeaLines[0]); | ||
parser2.write(nmeaLines[2]); | ||
parser1.write(nmeaLines[1]); | ||
parser2.write(nmeaLines[3]); | ||
}) | ||
@@ -35,0 +55,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3901069
63
2772
0