From 9fbdc026400a74d15bd2a379d083b97587b7c2c3 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 2 Dec 2022 16:35:16 -0500 Subject: [PATCH 1/9] Added changes to accomodate ShipModul Miniplex ShipModul now uses C and R in their PSMDST message to represent a message being sent or received. --- hooks/proprietary/PSMDST.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hooks/proprietary/PSMDST.js b/hooks/proprietary/PSMDST.js index 0116d958..72df31c0 100644 --- a/hooks/proprietary/PSMDST.js +++ b/hooks/proprietary/PSMDST.js @@ -17,22 +17,24 @@ 'use strict' /* -0 1 2 3 -| | | | -$PSMDST,xx,yy,nn*CS +0 1 2 3 4 +| | | | | +$PSMDST,Z,xx,yy,nn*CS where: PSMDST Raymarine Seatalk1 datagram sentence -0 00-9C Datagram type -1 hex First datagram content -2 hex Last datagram content -3 hex Checksum +0 C/R R for Recevied messages, C for sent messages +1 00-9C Datagram type +2 hex First datagram content +3 hex Last datagram content +4 hex Checksum */ const seatalkHooks = require('../seatalk') module.exports = function (input, session) { const { id, sentence, parts, tags } = input - const key = '0x' + parts[0].toUpperCase() + const key = '0x' + parts[1].toUpperCase(); + input.parts = parts.slice(1, input.parts.length); if (typeof seatalkHooks[key] === 'function') { return seatalkHooks[key](input, session) } else { From cf63345db5eba7cb77232f62e587f1fbe2881828 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 2 Dec 2022 17:29:34 -0500 Subject: [PATCH 2/9] Updated test to include R for $PSMDST sentence ShipModul now includes an R for receive data in the PSMDST sentence. --- test/seatalk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/seatalk.js b/test/seatalk.js index fb3947b3..97bcf4e6 100644 --- a/test/seatalk.js +++ b/test/seatalk.js @@ -53,7 +53,7 @@ const should = chai.Should() chai.use(require('chai-things')) describe('seatalk', () => { - ;['$PSMDST,', '$STALK,'].forEach((prefix) => { + ;['$PSMDST,R,', '$STALK,'].forEach((prefix) => { it(`${prefix} 0x00 depth converted`, () => { const fullSentence = utils.appendChecksum(`${prefix}${depthData}`) const delta = new Parser().parse(fullSentence) From 8e451e8851132b6e2c285f72eab314e3ebb41451 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 2 Dec 2022 18:03:03 -0500 Subject: [PATCH 3/9] Added both original and new ShipModul decoding This change checks for a new field 'R' in the PSMDST message. This field has been added to the ShipModul Miniplex firmware and indicates that the messages is received from the ST network. --- hooks/proprietary/PSMDST.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hooks/proprietary/PSMDST.js b/hooks/proprietary/PSMDST.js index 72df31c0..6fe136a8 100644 --- a/hooks/proprietary/PSMDST.js +++ b/hooks/proprietary/PSMDST.js @@ -22,7 +22,7 @@ $PSMDST,Z,xx,yy,nn*CS where: PSMDST Raymarine Seatalk1 datagram sentence -0 C/R R for Recevied messages, C for sent messages +0 C/R R for Recevied messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex 1 00-9C Datagram type 2 hex First datagram content 3 hex Last datagram content @@ -33,8 +33,10 @@ const seatalkHooks = require('../seatalk') module.exports = function (input, session) { const { id, sentence, parts, tags } = input - const key = '0x' + parts[1].toUpperCase(); - input.parts = parts.slice(1, input.parts.length); + if (parts[0].toUpperCase() === 'R') { + input.parts = parts.slice(1, input.parts.length); + } + const key = '0x' + input.parts[0].toUpperCase(); if (typeof seatalkHooks[key] === 'function') { return seatalkHooks[key](input, session) } else { From 5b302291e384c3019ea74d18c83413a8c8556ed1 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 2 Dec 2022 18:05:11 -0500 Subject: [PATCH 4/9] Updated test to include 'R' field from ShipModul The newest firmware of ShipModul Miniplex adds 'R' after the PSMDST to indicate that the message has been received from the ST network. --- test/seatalk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/seatalk.js b/test/seatalk.js index 97bcf4e6..7a1abb8f 100644 --- a/test/seatalk.js +++ b/test/seatalk.js @@ -53,7 +53,7 @@ const should = chai.Should() chai.use(require('chai-things')) describe('seatalk', () => { - ;['$PSMDST,R,', '$STALK,'].forEach((prefix) => { + ;['$PSMDST', '$PSMDST_R', '$STALK,'].forEach((prefix) => { it(`${prefix} 0x00 depth converted`, () => { const fullSentence = utils.appendChecksum(`${prefix}${depthData}`) const delta = new Parser().parse(fullSentence) From 0dea5a1ae7236595cb49a686a2298beddd299206 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Tue, 14 Feb 2023 12:58:46 -0500 Subject: [PATCH 5/9] Update PSMDST.js --- hooks/proprietary/PSMDST.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hooks/proprietary/PSMDST.js b/hooks/proprietary/PSMDST.js index 6fe136a8..f72e1e18 100644 --- a/hooks/proprietary/PSMDST.js +++ b/hooks/proprietary/PSMDST.js @@ -17,16 +17,16 @@ 'use strict' /* -0 1 2 3 4 -| | | | | +0 1 2 3 4 5 +| | | | | | $PSMDST,Z,xx,yy,nn*CS where: -PSMDST Raymarine Seatalk1 datagram sentence -0 C/R R for Recevied messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex -1 00-9C Datagram type -2 hex First datagram content -3 hex Last datagram content -4 hex Checksum +0 PSMDST Raymarine Seatalk1 datagram sentence +1 C/R R for Recevied messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex +2 00-9C Datagram type +3 hex First datagram content +4 hex Last datagram content +5 hex Checksum */ const seatalkHooks = require('../seatalk') From 3a8ea04ddf015b1a64f898734d6f394653362dd2 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Tue, 14 Feb 2023 12:59:31 -0500 Subject: [PATCH 6/9] Update PSMDST.js --- hooks/proprietary/PSMDST.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/proprietary/PSMDST.js b/hooks/proprietary/PSMDST.js index f72e1e18..57dc36ca 100644 --- a/hooks/proprietary/PSMDST.js +++ b/hooks/proprietary/PSMDST.js @@ -22,7 +22,7 @@ $PSMDST,Z,xx,yy,nn*CS where: 0 PSMDST Raymarine Seatalk1 datagram sentence -1 C/R R for Recevied messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex +1 C/R R for Received messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex 2 00-9C Datagram type 3 hex First datagram content 4 hex Last datagram content From c9d8e5f34713cdd07aadf4f08e85996cb01e3ea0 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 17 Feb 2023 10:47:03 -0500 Subject: [PATCH 7/9] Update seatalk.js --- test/seatalk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/seatalk.js b/test/seatalk.js index 7a1abb8f..7c422cb8 100644 --- a/test/seatalk.js +++ b/test/seatalk.js @@ -53,7 +53,7 @@ const should = chai.Should() chai.use(require('chai-things')) describe('seatalk', () => { - ;['$PSMDST', '$PSMDST_R', '$STALK,'].forEach((prefix) => { + ;['$PSMDST,', '$PSMDST,R,', '$STALK,'].forEach((prefix) => { it(`${prefix} 0x00 depth converted`, () => { const fullSentence = utils.appendChecksum(`${prefix}${depthData}`) const delta = new Parser().parse(fullSentence) From 5656af413035f58d49d7a050b4ea4aaf040c0878 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 17 Feb 2023 10:48:59 -0500 Subject: [PATCH 8/9] Update seatalk.js --- test/seatalk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/seatalk.js b/test/seatalk.js index 7c422cb8..1e634292 100644 --- a/test/seatalk.js +++ b/test/seatalk.js @@ -53,7 +53,7 @@ const should = chai.Should() chai.use(require('chai-things')) describe('seatalk', () => { - ;['$PSMDST,', '$PSMDST,R,', '$STALK,'].forEach((prefix) => { + ;['$PSMDST,', '$PSMDST_R,', '$STALK,'].forEach((prefix) => { it(`${prefix} 0x00 depth converted`, () => { const fullSentence = utils.appendChecksum(`${prefix}${depthData}`) const delta = new Parser().parse(fullSentence) From 62eb50ce0e5e4d9bdf56fcf1ab595052c1fcbba2 Mon Sep 17 00:00:00 2001 From: Jason Protzman Date: Fri, 17 Feb 2023 10:52:53 -0500 Subject: [PATCH 9/9] Update seatalk.js --- test/seatalk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/seatalk.js b/test/seatalk.js index 1e634292..7c422cb8 100644 --- a/test/seatalk.js +++ b/test/seatalk.js @@ -53,7 +53,7 @@ const should = chai.Should() chai.use(require('chai-things')) describe('seatalk', () => { - ;['$PSMDST,', '$PSMDST_R,', '$STALK,'].forEach((prefix) => { + ;['$PSMDST,', '$PSMDST,R,', '$STALK,'].forEach((prefix) => { it(`${prefix} 0x00 depth converted`, () => { const fullSentence = utils.appendChecksum(`${prefix}${depthData}`) const delta = new Parser().parse(fullSentence)