@canboat/canboatjs 2.4.1 → 2.4.2

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.
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */
7
+
8
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
+
1
10
  /**
2
11
  * @license
3
12
  * Lodash <https://lodash.com/>
package/lib/fromPgn.js CHANGED
@@ -165,6 +165,13 @@ class Parser extends EventEmitter {
165
165
  }
166
166
  bs.view.buffer.copy(packet.buffer, 0, FASTPACKET_BUCKET_0_OFFSET, 8)
167
167
  trace(`${pgn.pgn} targetStart: 0 sourceStart: ${FASTPACKET_BUCKET_0_OFFSET}`)
168
+ } else if ( !packet.buffer ) {
169
+ //we got a non-zero bucket, but we never got the zero bucket
170
+ debug(`PGN ${pgn.pgn} malformed packet for ${pgn.src} received; got a non-zero bucket first`)
171
+ cb && cb(`Could not parse ${JSON.stringify(pgn)}`)
172
+ bs.byteIndex = start
173
+ delete this.devices[pgn.src][pgn.pgn]
174
+ return
168
175
  } else {
169
176
  if (packet.lastPacket + 1 != packetIndex) {
170
177
  debug(`PGN ${pgn.pgn} malformed packet for ${pgn.src} received; expected ${packet.lastPacket+1} but got ${packetIndex}`)
@@ -372,9 +379,7 @@ class Parser extends EventEmitter {
372
379
  //Yacht Devices NMEA2000 Wifi gateway
373
380
  parseYDGW02(pgn_data, cb) {
374
381
  try {
375
- //consoleLog('HELLO FROM CANBIOATJS')
376
382
  const { data, direction, error, ...pgn } = parseYDRAW(pgn_data)
377
- //consoleLog('HELLO FROM CANBIOATJS 2')
378
383
  if (!error && direction === 'R') {
379
384
  const bs = new BitStream(data)
380
385
  delete pgn.format
@@ -384,19 +389,17 @@ class Parser extends EventEmitter {
384
389
  return res
385
390
  }
386
391
  } else if ( error ) {
387
- consoleLog(error)
388
392
  cb && cb(error)
389
393
  this.emit('error', pgn_data, error)
390
394
  }
391
395
  } catch ( error ) {
392
- consoleLog(error)
393
396
  cb && cb(error)
394
397
  this.emit('error', pgn_data, error)
395
398
  }
396
399
  return undefined
397
400
  }
398
401
 
399
- //Yacht Devices NMEA2000 Wifi gateway
402
+ //Actisense W2k-1
400
403
  parseActisenceN2KAscii(pgn_data, cb) {
401
404
  try {
402
405
  const { data, error, ...pgn } = parseActisenseN2KASCII(pgn_data)
package/lib/stringMsg.js CHANGED
@@ -101,7 +101,6 @@ exports.parseYDRAW = (input) => {
101
101
  const parts = input.split(' ')
102
102
  if ( parts.length < 4 ) return buildErr('YDRAW', 'Invalid parts.', input)
103
103
  const [ time, direction, canId, ...data ] = parts // time format HH:mm:ss.SSS
104
- //consoleLog('parseYDRAW build')
105
104
  return buildMsg(
106
105
  parseCanIdStr(canId), 'YDRAW', arrBuff(data),
107
106
  { direction, time }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canboat/canboatjs",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Native javascript version of canboat",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "code-coverage": "jest --coverage && nyc mocha --exit",
10
10
  "create-release": "github-create-release --owner canboat --repository canboatjs",
11
11
  "release": "git tag -d v$npm_package_version && git tag v$npm_package_version && git push --tags && git push && npm run create-release",
12
- "build_ios": "webpack -c ./webpack.config.js --mode development ./ios.js -o ios_canboat.js"
12
+ "build_ios": "webpack -c ./webpack.config.js --mode development ./ios.js -o ios_canboat.js",
13
+ "build_prod_ios": "webpack -c ./webpack.config.js --mode production ./ios.js -o ios_canboat.js"
13
14
  },
14
15
  "bin": {
15
16
  "analyzerjs": "./bin/analyzerjs",