Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 api #247

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pgns/129283.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module.exports = [
{
node: function (n2k, state) {
return (
'navigation.course' +
state.lastCourseCalculationType +
'.crossTrackError'
'navigation.course.calcValues.crossTrackError'
)
},
filter: function (n2k, state) {
Expand Down
31 changes: 15 additions & 16 deletions pgns/129284.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ module.exports = [
{
node: function (n2k, state) {
return (
'navigation.course' +
calculationType(n2k, state) +
'.bearingTrack' +
'navigation.course.calcValues.calcMethod' +
calculationType(n2k, state)
)
},
source: 'Calculation Type'
},
{
node: function (n2k, state) {
return (
'navigation.course.calcValues.bearingTrack' +
n2k.fields['Course/Bearing reference']
)
},
Expand All @@ -27,29 +34,23 @@ module.exports = [
{
node: function (n2k, state) {
return (
'navigation.course' +
calculationType(n2k, state) +
'.nextPoint.distance'
'navigation.course.calcValues.distance'
)
},
source: 'Distance to Waypoint'
},
{
node: function (n2k, state) {
return (
'navigation.course' +
calculationType(n2k, state) +
'.nextPoint.velocityMadeGood'
'navigation.course.calcValues.velocityMadeGood'
)
},
source: 'Waypoint Closing Velocity'
},
{
node: function (n2k, state) {
return (
'navigation.course' +
calculationType(n2k, state) +
'.nextPoint.bearing' +
'navigation.course.calcValues.bearing' +
n2k.fields['Course/Bearing reference']
)
},
Expand All @@ -58,9 +59,7 @@ module.exports = [
{
node: function (n2k, state) {
return (
'navigation.course' +
calculationType(n2k, state) +
'.nextPoint.position'
'navigation.course.nextPoint.position'
)
},
value: function (n2k) {
Expand All @@ -72,7 +71,7 @@ module.exports = [
},
{
node: function (n2k) {
return 'navigation.course' + calculationType(n2k) + '.nextPoint.timeToGo'
return 'navigation.course.calcValues.timeToGo'
},
filter: function (n2k) {
return n2k.fields['ETA Date'] && n2k.fields['ETA Time']
Expand Down
4 changes: 2 additions & 2 deletions pgns/129285.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const _ = require('lodash')

module.exports = [
{
node: 'navigation.currentRoute.name',
node: 'navigation.course.activeRoute.name',
source: 'Route Name'
},
{
node: 'navigation.currentRoute.waypoints',
node: 'navigation.course.activeRoute.waypoints',
filter: n2k => {
return !_.isUndefined(n2k.fields.list)
},
Expand Down
6 changes: 3 additions & 3 deletions test/129283_xte.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('129283 cross track error', function () {
)

tree.should.have.nested.property(
'navigation.courseGreatCircle.crossTrackError.value',
'navigation.course.calcValues.crossTrackError.value',
-5.63
)
tree.should.be.validSignalKVesselIgnoringIdentity
Expand All @@ -37,7 +37,7 @@ describe('129283 cross track error', function () {
{}
)
tree.should.not.have.nested.property(
'navigation.courseGreatCircle.crossTrackError.value'
'navigation.course.calcValues.crossTrackError.value'
)
tree.should.be.validSignalKVesselIgnoringIdentity
})
Expand All @@ -50,7 +50,7 @@ describe('129283 cross track error', function () {
null
)
tree.should.not.have.nested.property(
'navigation.courseGreatCircle.crossTrackError.value'
'navigation.course.calcValues.crossTrackError.value'
)
tree.should.be.validSignalKVesselIgnoringIdentity
})
Expand Down
14 changes: 7 additions & 7 deletions test/129284_navigation_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ describe('129284 Navigation Data', function () {
)
var tree = mapper.toNested(msg)
tree.should.have.nested.property(
'navigation.courseGreatCircle.bearingTrackTrue.value',
'navigation.course.calcValues.bearingTrackTrue.value',
2.6435
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.velocityMadeGood.value',
'navigation.course.calcValues.velocityMadeGood.value',
0.06
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.distance.value',
'navigation.course.calcValues.distance.value',
1910.38
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.bearingTrue.value',
'navigation.course.calcValues.bearingTrue.value',
2.7651
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.position.value.latitude',
'navigation.course.nextPoint.position.value.latitude',
60.1366607
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.position.value.longitude',
'navigation.course.nextPoint.position.value.longitude',
24.9068518
)
tree.should.have.nested.property(
'navigation.courseGreatCircle.nextPoint.timeToGo.value',
'navigation.course.calcValues.timeToGo.value',
31360.412
)
tree.should.be.validSignalKVesselIgnoringIdentity
Expand Down