-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add B&G WS320 related PGNs (65309 and 65312) #224
Open
theikkila
wants to merge
4
commits into
SignalK:master
Choose a base branch
from
theikkila:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = [ | ||
{ | ||
source: 'Battery Status', | ||
node: function(n2k){ | ||
return `instruments.wireless.${n2k.src}.batteryStatus` | ||
} | ||
},{ | ||
source: 'Battery Charge Status', | ||
node: function(n2k){ | ||
return `instruments.wireless.${n2k.src}.batteryChargeStatus` | ||
} | ||
},{ | ||
source: 'Status', | ||
node: function(n2k){ | ||
return `instruments.wireless.${n2k.src}.status` | ||
} | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = [ | ||
{ | ||
source: 'Signal Strength', | ||
node: function(n2k){ | ||
return `instruments.wireless.${n2k.src}.signalStrength` | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
65309: require('./65309.js'), | ||
65312: require('./65312.js'), | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
const chai = require('chai') | ||
chai.Should() | ||
chai.use(require('chai-things')) | ||
chai.use(require('@signalk/signalk-schema').chaiModule) | ||
|
||
const N2kMapper = require('../n2kMapper').N2kMapper | ||
const toNested = require('./testMapper').toNested | ||
|
||
describe('B&G PGNs work', function () { | ||
const n2kMapper = new N2kMapper() | ||
|
||
n2kMapper.toDelta({ | ||
canId: 486481152, | ||
prio: 7, | ||
src: 0, | ||
dst: 255, | ||
pgn: 65309, | ||
time: '1628312401044;A;06:25:52.641', | ||
input: ['1628312401044;A;06:25:52.641 R 1CFF1D00 13 99 00 4E 0A FF FF 7F'], | ||
fields: { | ||
'Manufacturer Code': 'Navico', | ||
'Industry Code': 'Marine Industry', | ||
Status: 0, | ||
'Battery Status': 78, | ||
'Battery Charge Status': 10, | ||
Reserved2: 8388607 | ||
}, | ||
description: 'Navico: Wireless Battery Status', | ||
timestamp: '2021-09-05T14:43:06.818Z' | ||
}) | ||
|
||
it('65309 WS320 Battery status', function () { | ||
var tree = toNested( | ||
JSON.parse( | ||
'{"canId":486481152,"prio":7,"src":0,"dst":255,"pgn":65309,"time":"1628312401044;A;06:25:52.641","input":["1628312401044;A;06:25:52.641 R 1CFF1D00 13 99 00 4E 0A FF FF 7F"],"fields":{"Manufacturer Code":"Navico","Industry Code":"Marine Industry","Status":0,"Battery Status":78,"Battery Charge Status":10,"Reserved2":8388607},"description":"Navico: Wireless Battery Status","timestamp":"2021-09-05T14:43:06.818Z"}' | ||
), | ||
n2kMapper.state | ||
) | ||
|
||
tree.should.have.nested.property( | ||
'instruments.wireless.0.batteryStatus.value', | ||
78 | ||
) | ||
tree.should.have.nested.property( | ||
'instruments.wireless.0.batteryChargeStatus.value', | ||
10 | ||
) | ||
tree.should.have.nested.property('instruments.wireless.0.status.value', 0) | ||
}) | ||
n2kMapper.toDelta({ | ||
canId: 486481920, | ||
prio: 7, | ||
src: 0, | ||
dst: 255, | ||
pgn: 65312, | ||
time: '1628312404394;A;06:25:56.008', | ||
input: ['1628312404394;A;06:25:56.008 R 1CFF2000 13 99 00 2D 7F FF FF FF'], | ||
fields: { | ||
'Manufacturer Code': 'Navico', | ||
'Industry Code': 'Marine Industry', | ||
Unknown: 0, | ||
'Signal Strength': 45, | ||
Reserved2: 16777087 | ||
}, | ||
description: 'Navico: Wireless Signal Status', | ||
timestamp: '2021-09-05T14:43:06.823Z' | ||
}) | ||
|
||
it('65312 WS320 Signal status', function () { | ||
var tree = toNested( | ||
JSON.parse( | ||
'{"canId":486481920,"prio":7,"src":0,"dst":255,"pgn":65312,"time":"1628312404394;A;06:25:56.008","input":["1628312404394;A;06:25:56.008 R 1CFF2000 13 99 00 2D 7F FF FF FF"],"fields":{"Manufacturer Code":"Navico","Industry Code":"Marine Industry","Unknown":0,"Signal Strength":45,"Reserved2":16777087},"description":"Navico: Wireless Signal Status","timestamp":"2021-09-05T14:43:06.823Z"}' | ||
), | ||
n2kMapper.state | ||
) | ||
|
||
tree.should.have.nested.property( | ||
'instruments.wireless.0.signalStrength.value', | ||
45 | ||
) | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think using
src
as the instance identifier makes sense, as it can change essentially randomly when the bus reshuffles addresses. @sbender9 should this becanId
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it should probably use canId. The canId may not be there initially, so should ignore messages until it is there.