@sailingnaturali/signalk-dsc 0.1.0 → 0.1.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # signalk-dsc
1
+ # @sailingnaturali/signalk-dsc
2
2
 
3
3
  SignalK plugin that receives, logs, and alerts on **DSC** (VHF digital selective
4
4
  calling) traffic — distress, urgency, safety, and routine calls — from both
@@ -14,6 +14,17 @@ has **no** PGN 129808 mapping at all. If you might be the nearest boat, you want
14
14
  every received alert stored with its position and surfaced as an alarm — that is
15
15
  this plugin.
16
16
 
17
+ Logging that traffic is also the regulatory standard. Maritime radio rules
18
+ require *compulsorily-equipped* vessels to record every distress, urgency, and
19
+ safety call **made or intercepted**, with the time and position of the station
20
+ in distress ([47 CFR §80.409](https://www.law.cornell.edu/cfr/text/47/80.409);
21
+ SOLAS Ch. IV; ITU Radio Regulations; Canada's TP 1539). Pleasure craft are
22
+ generally exempt from the log mandate — this just gives you that same
23
+ SOLAS-grade record automatically. The parser gaps and the regulation are written
24
+ up in more detail [on the engineering blog][writeup].
25
+
26
+ [writeup]: https://engineering.sailingnaturali.com/signalk-dsc-distress-call-logging-nmea0183-dse-pgn-129808/
27
+
17
28
  ## What you get
18
29
 
19
30
  For every DSC call heard by a connected radio:
Binary file
Binary file
package/lib/dsc.js CHANGED
@@ -112,8 +112,15 @@ function parseDsc(parts) {
112
112
  const distress = event.category === 'distress';
113
113
  if (distress) {
114
114
  const natureCode = field(parts, 3);
115
- event.natureOfDistress =
116
- NATURES[natureCode] || (natureCode ? `code-${natureCode}` : 'undesignated');
115
+ // natureCode arrives over the air, unsanitised. Only a clean numeric code
116
+ // may reach the NATURES lookup or the code-NN fallback: a key like
117
+ // "__proto__" would otherwise resolve to Object.prototype, and any dotted
118
+ // value would inject extra segments into the notification path that the
119
+ // server walks unguarded (SignalK/signalk-server#2768). Anything else
120
+ // collapses to a safe constant.
121
+ event.natureOfDistress = /^\d{1,2}$/.test(natureCode)
122
+ ? NATURES[natureCode] || `code-${natureCode}`
123
+ : 'undesignated';
117
124
  event.distressedMmsi = parseMmsi(parts[7]);
118
125
  }
119
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailingnaturali/signalk-dsc",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Receive, log, and alert on DSC (VHF digital selective calling) calls — distress, urgency, safety, routine — from NMEA 0183 ($CDDSC/$CDDSE) and NMEA 2000 (PGN 129808).",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,9 +25,17 @@
25
25
  "bugs": {
26
26
  "url": "https://github.com/sailingnaturali/signalk-dsc/issues"
27
27
  },
28
+ "signalk": {
29
+ "displayName": "DSC",
30
+ "screenshots": [
31
+ "./docs/screenshots/config.png",
32
+ "./docs/screenshots/data-table.png"
33
+ ]
34
+ },
28
35
  "files": [
29
36
  "index.js",
30
- "lib"
37
+ "lib",
38
+ "docs/screenshots/"
31
39
  ],
32
40
  "publishConfig": {
33
41
  "access": "public"