signalk-vessels-to-ais 1.4.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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/index.js +7 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,6 +9,7 @@ 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
12
13
  - v1.4.0, add: Event output name to user configurable
13
14
  - v1.3.0, add: Navigational Status variations
14
15
  - v1.2.2, fix: if own position is not available
package/index.js CHANGED
@@ -256,11 +256,7 @@ module.exports = function createPlugin(app) {
256
256
  dst = jsonContent[jsonKey].navigation.destination.commonName.value;
257
257
  } catch (error) { dst = ''; }
258
258
  try {
259
- if (i === 0) {
260
- callSign = jsonContent[jsonKey].communication.callsignVhf;
261
- } else {
262
- callSign = jsonContent[jsonKey].communication.value.callsignVhf;
263
- }
259
+ callSign = jsonContent[jsonKey].communication.callsignVhf.value || jsonContent[jsonKey].communication.callsignVhf;
264
260
  } catch (error) { callSign = ''; }
265
261
  try {
266
262
  imo = (jsonContent[jsonKey].registrations.value.imo).substring(4, 20);
@@ -299,11 +295,6 @@ module.exports = function createPlugin(app) {
299
295
 
300
296
  if (i === 0) {
301
297
  own = true;
302
- if (sendOwn) {
303
- ais = 'A';
304
- } else {
305
- ais = '';
306
- }
307
298
  } else {
308
299
  own = false;
309
300
  }
@@ -380,7 +371,7 @@ module.exports = function createPlugin(app) {
380
371
  dimD: beam,
381
372
  };
382
373
 
383
- if (aisDelay && (ais === 'A' || ais === 'B')) {
374
+ if (aisDelay && (ais === 'A' || ais === 'B' || ais === 'BASE')) {
384
375
  // eslint-disable-next-line no-useless-concat
385
376
  app.debug(`Distance range: ${distance}km, AIS target distance: ${dist}km` + `, Class ${ais} Vessel` + `, MMSI:${mmsi}`);
386
377
  if (ais === 'A') {
@@ -389,11 +380,15 @@ module.exports = function createPlugin(app) {
389
380
  aisOut(encMsg5, aisTime);
390
381
  }
391
382
  if (ais === 'B') {
392
- app.debug(`class B, ${i}, time: ${aisTime}`);
383
+ app.debug(`class ${ais}, ${i}, time: ${aisTime}`);
393
384
  aisOut(encMsg18, aisTime);
394
385
  aisOut(encMsg240, aisTime);
395
386
  aisOut(encMsg241, aisTime);
396
387
  }
388
+ if (ais === 'BASE') {
389
+ app.debug(`class ${ais}, ${i}, time: ${aisTime}`);
390
+ aisOut(encMsg3, aisTime);
391
+ }
397
392
  app.debug('--------------------------------------------------------');
398
393
  }
399
394
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-vessels-to-ais",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "SignalK server plugin to convert other vessel data to NMEA0183 AIS format and forward it out to 3rd party applications",
5
5
  "main": "index.js",
6
6
  "scripts": {