@meri-imperiumi/signalk-mob-notifier 1.0.0 → 1.0.1
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/package.json +1 -1
- package/plugin/index.js +11 -3
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -54,6 +54,10 @@ module.exports = (app) => {
|
|
|
54
54
|
// SART beacon seen!
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
|
+
if (mmsi.indexOf('974') === 0) {
|
|
58
|
+
// EPIRB seen!
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
57
61
|
return false;
|
|
58
62
|
});
|
|
59
63
|
|
|
@@ -67,7 +71,7 @@ module.exports = (app) => {
|
|
|
67
71
|
return true;
|
|
68
72
|
})
|
|
69
73
|
.forEach((mmsi) => {
|
|
70
|
-
app.handleMessage('signalk-
|
|
74
|
+
app.handleMessage('signalk-mob-notifier', {
|
|
71
75
|
context: `vessels.${app.selfId}`,
|
|
72
76
|
updates: [
|
|
73
77
|
{
|
|
@@ -87,8 +91,9 @@ module.exports = (app) => {
|
|
|
87
91
|
notified.splice(notified.indexOf(mmsi), 1);
|
|
88
92
|
});
|
|
89
93
|
|
|
94
|
+
app.setPluginStatus(`${mobs.length} MOB or SART beacons detected`);
|
|
95
|
+
|
|
90
96
|
if (mobs.length === 0) {
|
|
91
|
-
// TODO: Clear notifications
|
|
92
97
|
return;
|
|
93
98
|
}
|
|
94
99
|
mobs.forEach((mmsi) => {
|
|
@@ -96,6 +101,9 @@ module.exports = (app) => {
|
|
|
96
101
|
if (mmsi.indexOf('970') === 0) {
|
|
97
102
|
message = 'Search and Rescue Transponder Beacon detected';
|
|
98
103
|
}
|
|
104
|
+
if (mmsi.indexOf('974') === 0) {
|
|
105
|
+
message = 'Emergency Position Indicating Beacon detected';
|
|
106
|
+
}
|
|
99
107
|
// For each MOB get direction and range
|
|
100
108
|
const ownPosition = app.getSelfPath('navigation.position');
|
|
101
109
|
const mobPosition = app.getPath(`vessels.urn:mrn:imo:mmsi:${mmsi}.navigation.position`);
|
|
@@ -108,7 +116,7 @@ module.exports = (app) => {
|
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
// Raise notification
|
|
111
|
-
app.handleMessage('signalk-
|
|
119
|
+
app.handleMessage('signalk-mob-notifier', {
|
|
112
120
|
context: `vessels.${app.selfId}`,
|
|
113
121
|
updates: [
|
|
114
122
|
{
|