@canboat/canboatjs 2.8.0 → 2.8.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/stringMsg.js CHANGED
@@ -285,7 +285,7 @@ exports.parseCandump3 = (input) => {
285
285
  const [ timestamp, bus, canFrame ] = input.split(' ')
286
286
  const [ canId, data ] = canFrame.split('#')
287
287
  return buildMsg(
288
- parseCanIdStr(canId), 'candump3', arrBuff(data), { timestamp, bus }
288
+ parseCanIdStr(canId), 'candump3', Buffer.from(data, 'hex'), { timestamp, bus }
289
289
  )
290
290
  }
291
291
 
@@ -1,6 +1,6 @@
1
1
  const {
2
2
  encodeActisense, encodeYDRAW, parseActisense, parseCandump1, parseCandump2,
3
- parsePCDIN, parsePDGY, parseN2kString, parsePDGYdebug, parseYDRAW, encodeActisenseN2KACSII, parseActisenseN2KASCII
3
+ parsePCDIN, parsePDGY, parseN2kString, parsePDGYdebug, parseYDRAW, encodeActisenseN2KACSII, parseActisenseN2KASCII, parseCandump3
4
4
  } = require('./stringMsg')
5
5
 
6
6
  /* globals describe test expect */
@@ -61,6 +61,33 @@ describe('parseMultiLineCandump', () => {
61
61
  })
62
62
  })
63
63
 
64
+ describe('parseMultiLineCandumpV3', () => {
65
+ test('multi line messages', () => {
66
+ const msgs = [
67
+ '(0000000000.352000) vcan0 09F20101#601A00B706670D0B',
68
+ '(0000000000.353000) vcan0 09F20101#6186BA042600105F',
69
+ '(0000000000.354000) vcan0 09F20101#62090000008F027F',
70
+ '(0000000000.355000) vcan0 09F20101#63000000007F7FFF'
71
+ ]
72
+ let res
73
+ msgs.forEach((msg) => {
74
+ res = parseCandump3(msg)
75
+ })
76
+ console.log(res.data.toString('hex'))
77
+ expect(res).toEqual({
78
+ bus: "vcan0",
79
+ canId: 166854913,
80
+ data: Buffer.from('63000000007f7fff', 'hex'),
81
+ dst: 255,
82
+ format: 'candump3',
83
+ src: 1,
84
+ pgn: 127489,
85
+ prio: 2,
86
+ timestamp: '(0000000000.355000)'
87
+ })
88
+ })
89
+ })
90
+
64
91
  describe('parseActisense', () => {
65
92
  test('basic msg', () => {
66
93
  const msg = '2016-04-09T16:41:09.078Z,3,127257,17,255,8,00,ff,7f,52,00,21,fe,ff'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canboat/canboatjs",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Native javascript version of canboat",
5
5
  "main": "index.js",
6
6
  "scripts": {