@canboat/canboatjs 3.0.0 → 3.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/lib/n2kDevice.js +15 -7
- package/package.json +1 -1
package/lib/n2kDevice.js
CHANGED
|
@@ -161,7 +161,9 @@ class N2kDevice extends EventEmitter {
|
|
|
161
161
|
function handleISORequest(device, n2kMsg) {
|
|
162
162
|
debug('handleISORequest %j', n2kMsg)
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
const PGN = n2kMsg.fields.PGN || n2kMsg.fields.pgn
|
|
165
|
+
|
|
166
|
+
switch (PGN) {
|
|
165
167
|
case 126996: // Product Information request
|
|
166
168
|
sendProductInformation(device)
|
|
167
169
|
break;
|
|
@@ -177,8 +179,8 @@ function handleISORequest(device, n2kMsg) {
|
|
|
177
179
|
break;
|
|
178
180
|
default:
|
|
179
181
|
if ( !device.options.disableNAKs ) {
|
|
180
|
-
debug(`Got unsupported ISO request for PGN ${
|
|
181
|
-
sendNAKAcknowledgement(device, n2kMsg.src,
|
|
182
|
+
debug(`Got unsupported ISO request for PGN ${PGN}. Sending NAK.`)
|
|
183
|
+
sendNAKAcknowledgement(device, n2kMsg.src, PGN)
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
}
|
|
@@ -197,13 +199,16 @@ function handleGroupFunction(device, n2kMsg) {
|
|
|
197
199
|
function handleRequestGroupFunction(device, n2kMsg) {
|
|
198
200
|
if ( !device.options.disableNAKs ) {
|
|
199
201
|
// We really don't support group function requests for any PGNs yet -> always respond with pgnErrorCode 1 = "PGN not supported"
|
|
200
|
-
|
|
202
|
+
|
|
203
|
+
const PGN = n2kMsg.fields.PGN || n2kMsg.fields.pgn
|
|
204
|
+
|
|
205
|
+
debug("Sending 'PGN Not Supported' Group Function response for requested PGN", PGN)
|
|
201
206
|
|
|
202
207
|
const acknowledgement = {
|
|
203
208
|
pgn: 126208,
|
|
204
209
|
dst: n2kMsg.src,
|
|
205
210
|
"Function Code": 2,
|
|
206
|
-
"PGN":
|
|
211
|
+
"PGN": PGN,
|
|
207
212
|
"PGN error code": 4,
|
|
208
213
|
"Transmission interval/Priority error code": 0,
|
|
209
214
|
"# of Parameters": 0
|
|
@@ -215,13 +220,16 @@ function handleGroupFunction(device, n2kMsg) {
|
|
|
215
220
|
function handleCommandGroupFunction(device, n2kMsg) {
|
|
216
221
|
if ( !device.options.disableNAKs ) {
|
|
217
222
|
// We really don't support group function commands for any PGNs yet -> always respond with pgnErrorCode 1 = "PGN not supported"
|
|
218
|
-
|
|
223
|
+
|
|
224
|
+
const PGN = n2kMsg.fields.PGN || n2kMsg.fields.pgn
|
|
225
|
+
|
|
226
|
+
debug("Sending 'PGN Not Supported' Group Function response for commanded PGN", PGN)
|
|
219
227
|
|
|
220
228
|
const acknowledgement = {
|
|
221
229
|
pgn: 126208,
|
|
222
230
|
dst: n2kMsg.src,
|
|
223
231
|
"Function Code": 2,
|
|
224
|
-
"PGN":
|
|
232
|
+
"PGN": PGN,
|
|
225
233
|
"PGN error code": 4,
|
|
226
234
|
"Transmission interval/Priority error code": 0,
|
|
227
235
|
"# of Parameters": 0
|