signalk-vessels-to-ais 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.js +15 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ User can configure:
|
|
|
9
9
|
- Own data can be added to AIS sending
|
|
10
10
|
|
|
11
11
|
New:
|
|
12
|
+
- v1.5.0, fix: callSign reading
|
|
13
|
+
- v1.4.0, add: Event output name to user configurable
|
|
12
14
|
- v1.3.0, add: Navigational Status variations
|
|
13
15
|
- v1.2.2, fix: if own position is not available
|
|
14
16
|
- v1.2.1, fix: own vessel sending
|
package/index.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = function createPlugin(app) {
|
|
|
43
43
|
const setStatus = app.setPluginStatus || app.setProviderStatus;
|
|
44
44
|
|
|
45
45
|
let useTag;
|
|
46
|
+
let eventName
|
|
46
47
|
|
|
47
48
|
const httpsAgent = new https.Agent({
|
|
48
49
|
rejectUnauthorized: false,
|
|
@@ -52,6 +53,7 @@ module.exports = function createPlugin(app) {
|
|
|
52
53
|
|
|
53
54
|
plugin.start = function (options) {
|
|
54
55
|
useTag = options.useTag;
|
|
56
|
+
eventName = options.eventName;
|
|
55
57
|
|
|
56
58
|
positionUpdate = options.position_update * 60;
|
|
57
59
|
distance = options.distance;
|
|
@@ -149,7 +151,7 @@ module.exports = function createPlugin(app) {
|
|
|
149
151
|
}
|
|
150
152
|
if (sentence && sentence.length > 0) {
|
|
151
153
|
app.debug(taggString + sentence);
|
|
152
|
-
app.emit(
|
|
154
|
+
app.emit(eventName, taggString + sentence);
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
|
|
@@ -254,11 +256,7 @@ module.exports = function createPlugin(app) {
|
|
|
254
256
|
dst = jsonContent[jsonKey].navigation.destination.commonName.value;
|
|
255
257
|
} catch (error) { dst = ''; }
|
|
256
258
|
try {
|
|
257
|
-
|
|
258
|
-
callSign = jsonContent[jsonKey].communication.callsignVhf;
|
|
259
|
-
} else {
|
|
260
|
-
callSign = jsonContent[jsonKey].communication.value.callsignVhf;
|
|
261
|
-
}
|
|
259
|
+
callSign = jsonContent[jsonKey].communication.callsignVhf.value || jsonContent[jsonKey].communication.callsignVhf;
|
|
262
260
|
} catch (error) { callSign = ''; }
|
|
263
261
|
try {
|
|
264
262
|
imo = (jsonContent[jsonKey].registrations.value.imo).substring(4, 20);
|
|
@@ -297,11 +295,6 @@ module.exports = function createPlugin(app) {
|
|
|
297
295
|
|
|
298
296
|
if (i === 0) {
|
|
299
297
|
own = true;
|
|
300
|
-
if (sendOwn) {
|
|
301
|
-
ais = 'A';
|
|
302
|
-
} else {
|
|
303
|
-
ais = '';
|
|
304
|
-
}
|
|
305
298
|
} else {
|
|
306
299
|
own = false;
|
|
307
300
|
}
|
|
@@ -378,7 +371,7 @@ module.exports = function createPlugin(app) {
|
|
|
378
371
|
dimD: beam,
|
|
379
372
|
};
|
|
380
373
|
|
|
381
|
-
if (aisDelay && (ais === 'A' || ais === 'B')) {
|
|
374
|
+
if (aisDelay && (ais === 'A' || ais === 'B' || ais === 'BASE')) {
|
|
382
375
|
// eslint-disable-next-line no-useless-concat
|
|
383
376
|
app.debug(`Distance range: ${distance}km, AIS target distance: ${dist}km` + `, Class ${ais} Vessel` + `, MMSI:${mmsi}`);
|
|
384
377
|
if (ais === 'A') {
|
|
@@ -387,11 +380,15 @@ module.exports = function createPlugin(app) {
|
|
|
387
380
|
aisOut(encMsg5, aisTime);
|
|
388
381
|
}
|
|
389
382
|
if (ais === 'B') {
|
|
390
|
-
app.debug(`class
|
|
383
|
+
app.debug(`class ${ais}, ${i}, time: ${aisTime}`);
|
|
391
384
|
aisOut(encMsg18, aisTime);
|
|
392
385
|
aisOut(encMsg240, aisTime);
|
|
393
386
|
aisOut(encMsg241, aisTime);
|
|
394
387
|
}
|
|
388
|
+
if (ais === 'BASE') {
|
|
389
|
+
app.debug(`class ${ais}, ${i}, time: ${aisTime}`);
|
|
390
|
+
aisOut(encMsg3, aisTime);
|
|
391
|
+
}
|
|
395
392
|
app.debug('--------------------------------------------------------');
|
|
396
393
|
}
|
|
397
394
|
}
|
|
@@ -444,6 +441,11 @@ module.exports = function createPlugin(app) {
|
|
|
444
441
|
default: 100,
|
|
445
442
|
title: 'AIS target within range [km]',
|
|
446
443
|
},
|
|
444
|
+
eventName: {
|
|
445
|
+
type: 'string',
|
|
446
|
+
default: 'nmea0183out',
|
|
447
|
+
title: 'Output event name',
|
|
448
|
+
},
|
|
447
449
|
},
|
|
448
450
|
};
|
|
449
451
|
|
package/package.json
CHANGED