@canboat/canboatjs 2.4.0 → 2.4.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/ios.js +9 -1
- package/ios_canboat.js/main.js +2454 -0
- package/ios_canboat.js/main.js.LICENSE.txt +8 -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 +4 -0
- package/lib/ikonvert.js +0 -1
- package/lib/serial.js +1 -1
- package/lib/stringMsg.js +1 -0
- package/lib/utilities.js +0 -1
- package/lib/venus-mqtt.js +0 -1
- package/package.json +6 -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
|
@@ -372,7 +372,9 @@ class Parser extends EventEmitter {
|
|
|
372
372
|
//Yacht Devices NMEA2000 Wifi gateway
|
|
373
373
|
parseYDGW02(pgn_data, cb) {
|
|
374
374
|
try {
|
|
375
|
+
//consoleLog('HELLO FROM CANBIOATJS')
|
|
375
376
|
const { data, direction, error, ...pgn } = parseYDRAW(pgn_data)
|
|
377
|
+
//consoleLog('HELLO FROM CANBIOATJS 2')
|
|
376
378
|
if (!error && direction === 'R') {
|
|
377
379
|
const bs = new BitStream(data)
|
|
378
380
|
delete pgn.format
|
|
@@ -382,10 +384,12 @@ class Parser extends EventEmitter {
|
|
|
382
384
|
return res
|
|
383
385
|
}
|
|
384
386
|
} else if ( error ) {
|
|
387
|
+
consoleLog(error)
|
|
385
388
|
cb && cb(error)
|
|
386
389
|
this.emit('error', pgn_data, error)
|
|
387
390
|
}
|
|
388
391
|
} catch ( error ) {
|
|
392
|
+
consoleLog(error)
|
|
389
393
|
cb && cb(error)
|
|
390
394
|
this.emit('error', pgn_data, error)
|
|
391
395
|
}
|
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/stringMsg.js
CHANGED
|
@@ -101,6 +101,7 @@ 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')
|
|
104
105
|
return buildMsg(
|
|
105
106
|
parseCanIdStr(canId), 'YDRAW', arrBuff(data),
|
|
106
107
|
{ direction, time }
|
package/lib/utilities.js
CHANGED
package/lib/venus-mqtt.js
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canboat/canboatjs",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
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"
|
|
12
13
|
},
|
|
13
14
|
"bin": {
|
|
14
15
|
"analyzerjs": "./bin/analyzerjs",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@signalk/github-create-release": "^1.0.1",
|
|
69
70
|
"@signalk/server-api": "^1.39.0",
|
|
70
71
|
"baconjs": "^1.0.1",
|
|
72
|
+
"buffer": "^6.0.3",
|
|
71
73
|
"chai": "^4.1.2",
|
|
72
74
|
"chai-json-equal": "0.0.1",
|
|
73
75
|
"chai-string": "^1.5.0",
|
|
@@ -75,8 +77,8 @@
|
|
|
75
77
|
"jest": "^24.7.1",
|
|
76
78
|
"mocha": "^5.0.0",
|
|
77
79
|
"moment": "^2.24.0",
|
|
78
|
-
"
|
|
79
|
-
"webpack-cli": "^
|
|
80
|
+
"nyc": "^15.1.0",
|
|
81
|
+
"webpack-cli": "^5.1.4"
|
|
80
82
|
},
|
|
81
83
|
"optionalDependencies": {
|
|
82
84
|
"serialport": "11.x.x",
|