-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.js
34 lines (31 loc) · 860 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* To test the plugin
* - install the plugin (for example with npm link)
* - activate the plugin
* - add an UDP NMEA0183 connection to the server
* - send data via udp
* echo '$IIXXX,1,2,3,foobar,D*17' | nc -u -w 0 127.0.0.1 7777
*/
module.exports = function (app) {
const plugin = {}
plugin.id = plugin.name = plugin.description = 'signalk-nmea0183-custom-sentence-plugin'
plugin.start = function () {
app.emitPropertyValue('nmea0183sentenceParser', {
sentence: 'XXX',
parser: ({ id, sentence, parts, tags }, session) => {
return {
updates: [
{
values: [
{ path: 'navigation.speedOverGround', value: Number(parts[0]) }
]
}
]
}
}
})
}
plugin.stop = function () { }
plugin.schema = {}
return plugin
}