@canboat/canboatjs 2.4.0 → 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.
- package/bin/analyzerjs +1 -1
- package/ios.js +9 -1
- package/ios_canboat.js/main.js +2 -0
- package/ios_canboat.js/main.js.LICENSE.txt +17 -0
- package/ios_canboat.js/main.js.map +1 -0
- package/lib/canbus.js +1 -1
- package/lib/discovery.js +1 -1
- package/lib/fromPgn.js +8 -1
- package/lib/ikonvert.js +0 -1
- package/lib/serial.js +1 -1
- package/lib/utilities.js +0 -1
- package/lib/venus-mqtt.js +0 -1
- package/package.json +7 -4
package/lib/canbus.js
CHANGED
|
@@ -23,7 +23,6 @@ const { toPgn } = require('./toPgn')
|
|
|
23
23
|
const Parser = require('./fromPgn').Parser
|
|
24
24
|
const _ = require('lodash')
|
|
25
25
|
const CanDevice = require('./candevice')
|
|
26
|
-
const spawn = require('child_process').spawn
|
|
27
26
|
const { getPlainPGNs } = require('./utilities')
|
|
28
27
|
const { encodeCanId, parseCanId } = require('./canId')
|
|
29
28
|
const { toActisenseSerialFormat, parseActisense } = require('./stringMsg')
|
|
@@ -92,6 +91,7 @@ function CanbusStream (options) {
|
|
|
92
91
|
var canDevice = options.canDevice || 'can0'
|
|
93
92
|
if ( !this.socketcan || this.options.useSocketCanWriter ) {
|
|
94
93
|
this.socketCanWriter = null
|
|
94
|
+
const spawn = require('child_process').spawn
|
|
95
95
|
var hasWriter = spawn('sh', ['-c', 'which socketcan-writer'])
|
|
96
96
|
|
|
97
97
|
const setProviderError = this.setProviderError.bind(this)
|
package/lib/discovery.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const debug = require('debug')('canboatjs:discovery')
|
|
19
|
-
const dgram = require('dgram')
|
|
20
19
|
const { isYDRAW } = require('./stringMsg')
|
|
21
20
|
|
|
22
21
|
module.exports = function discover(app) {
|
|
@@ -33,6 +32,7 @@ module.exports = function discover(app) {
|
|
|
33
32
|
})
|
|
34
33
|
|
|
35
34
|
if ( !exists ) {
|
|
35
|
+
const dgram = require('dgram')
|
|
36
36
|
let socket = dgram.createSocket('udp4')
|
|
37
37
|
socket.on('message', function (buffer, remote) {
|
|
38
38
|
const msg = buffer.toString('utf8')
|
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}`)
|
|
@@ -392,7 +399,7 @@ class Parser extends EventEmitter {
|
|
|
392
399
|
return undefined
|
|
393
400
|
}
|
|
394
401
|
|
|
395
|
-
//
|
|
402
|
+
//Actisense W2k-1
|
|
396
403
|
parseActisenceN2KAscii(pgn_data, cb) {
|
|
397
404
|
try {
|
|
398
405
|
const { data, error, ...pgn } = parseActisenseN2KASCII(pgn_data)
|
package/lib/ikonvert.js
CHANGED
|
@@ -23,7 +23,6 @@ const {toPgn, pgnToiKonvertSerialFormat} = require('./toPgn')
|
|
|
23
23
|
const Parser = require('./fromPgn').Parser
|
|
24
24
|
const _ = require('lodash')
|
|
25
25
|
const CanDevice = require('./candevice')
|
|
26
|
-
const spawn = require('child_process').spawn
|
|
27
26
|
const { defaultTransmitPGNs } = require('./codes')
|
|
28
27
|
const { parseCanId } = require('./canId')
|
|
29
28
|
|
package/lib/serial.js
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
const debug = require('debug')('signalk:actisense-serial')
|
|
18
18
|
const debugOut = require('debug')('signalk:actisense-out')
|
|
19
19
|
const Transform = require('stream').Transform
|
|
20
|
-
const SerialPort = require('serialport')
|
|
21
20
|
const isArray = require('lodash').isArray
|
|
22
21
|
const BitStream = require('bit-buffer').BitStream
|
|
23
22
|
const BitView = require('bit-buffer').BitView
|
|
@@ -113,6 +112,7 @@ SerialStream.prototype.start = function () {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
if ( !this.options.fromFile ) {
|
|
115
|
+
const SerialPort = require('serialport')
|
|
116
116
|
this.serial = new SerialPort(this.options.device, {
|
|
117
117
|
baudRate: this.options.baudrate || 115200
|
|
118
118
|
})
|
package/lib/utilities.js
CHANGED
package/lib/venus-mqtt.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canboat/canboatjs",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Native javascript version of canboat",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev-test": "jest --watch",
|
|
8
8
|
"test": "jest && mocha --exit",
|
|
9
|
+
"code-coverage": "jest --coverage && nyc mocha --exit",
|
|
9
10
|
"create-release": "github-create-release --owner canboat --repository canboatjs",
|
|
10
11
|
"release": "git tag -d v$npm_package_version && git tag v$npm_package_version && git push --tags && git push && npm run create-release",
|
|
11
|
-
"build_ios": "webpack 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"
|
|
12
14
|
},
|
|
13
15
|
"bin": {
|
|
14
16
|
"analyzerjs": "./bin/analyzerjs",
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"@signalk/github-create-release": "^1.0.1",
|
|
69
71
|
"@signalk/server-api": "^1.39.0",
|
|
70
72
|
"baconjs": "^1.0.1",
|
|
73
|
+
"buffer": "^6.0.3",
|
|
71
74
|
"chai": "^4.1.2",
|
|
72
75
|
"chai-json-equal": "0.0.1",
|
|
73
76
|
"chai-string": "^1.5.0",
|
|
@@ -75,8 +78,8 @@
|
|
|
75
78
|
"jest": "^24.7.1",
|
|
76
79
|
"mocha": "^5.0.0",
|
|
77
80
|
"moment": "^2.24.0",
|
|
78
|
-
"
|
|
79
|
-
"webpack-cli": "^
|
|
81
|
+
"nyc": "^15.1.0",
|
|
82
|
+
"webpack-cli": "^5.1.4"
|
|
80
83
|
},
|
|
81
84
|
"optionalDependencies": {
|
|
82
85
|
"serialport": "11.x.x",
|