nmea0183-signalk
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -66,33 +66,35 @@ /* | ||
var self = this; | ||
// Position | ||
multiplexer | ||
.self() | ||
.group('navigation') | ||
.set('position', { | ||
source: this.source(input.instrument), | ||
timestamp: ts, | ||
longitude: self.coordinate(values[4], String(values[5]).toUpperCase()), | ||
latitude: self.coordinate(values[2], String(values[3]).toUpperCase()) | ||
}) | ||
; | ||
var vals = [ | ||
{ path: 'courseOverGroundTrue', value: self.transform(self.float(values[7]), 'deg', 'rad') }, | ||
{ path: 'speedOverGround', value: self.transform(values[6], 'knots', 'ms') } | ||
]; | ||
if(typeof values[9] !== 'undefined' && typeof values[10] === 'string') { | ||
vals.push({ path: 'magneticVariation', value: self.transform(this.magneticVariaton(values[9], values[10]), 'deg', 'rad') }); | ||
} | ||
// Other | ||
multiplexer | ||
.self() | ||
.group('navigation') | ||
.source(this.source(input.instrument)) | ||
.timestamp(ts) | ||
.values(vals) | ||
; | ||
var vals = [{ | ||
"path": "navigation.position", | ||
"value": { | ||
longitude: self.coordinate(values[4], String(values[5]).toUpperCase()), | ||
latitude: self.coordinate(values[2], String(values[3]).toUpperCase()) | ||
} | ||
},{ | ||
"path": "navigation.courseOverGroundTrue", | ||
"value": self.transform(self.float(values[7]), 'deg', 'rad') | ||
},{ | ||
"path": "navigation.speedOverGround", | ||
"value": self.transform(values[6], 'knots', 'ms') | ||
},{ | ||
"path": "navigation.datetime", | ||
"value": ts.substring(0,10)+'T'+ts.substring(11,19)+'Z' | ||
}]; | ||
if(typeof values[9] !== 'undefined' && typeof values[10] === 'string') { | ||
vals.push({ path: 'navigation.magneticVariation', value: self.transform(this.magneticVariaton(values[9], values[10]), 'deg', 'rad') }); | ||
} | ||
// Position | ||
multiplexer.self(); | ||
multiplexer.add({ | ||
"updates": [{ | ||
"source": this.source(input.instrument), | ||
"timestamp": ts, | ||
"values": vals | ||
}], | ||
"context": multiplexer._context | ||
}); | ||
return true; | ||
@@ -99,0 +101,0 @@ }); |
{ | ||
"name": "nmea0183-signalk", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "NMEA0183 to Signal K parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4004112
65
2832