-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
const canboatjs = require('../index') | ||
//const canboatjs = require('@canboat/canboatjs') | ||
const Parser = require('../index').FromPgn | ||
var parser = new canboatjs.FromPgn() | ||
|
||
let messageCb = (data) => { | ||
let jsonData = parser.parse(data, (err) => { if ( err ) console.error(err) }) | ||
if ( jsonData ) { | ||
//process | ||
} | ||
} | ||
|
||
let simpleCan = new canboatjs.SimpleCan({ | ||
canDevice: 'can0', | ||
preferredAddress: 35, | ||
disableDefaultTransmitPGNs: true, | ||
transmitPGNs: [], | ||
addressClaim: { | ||
"Unique Number": 139725, | ||
"Manufacturer Code": 'Fusion Electronics', | ||
"Device Function": 130, | ||
"Device Class": 'Entertainment', | ||
"Device Instance Lower": 0, | ||
"Device Instance Upper": 0, | ||
"System Instance": 0, | ||
"Industry Group": 'Marine' | ||
}, | ||
productInfo: { | ||
"NMEA 2000 Version": 1300, | ||
"Product Code": 667, | ||
"Model ID": "MS-UD650", | ||
"Software Version Code": "1.0", | ||
"Model Version": "1.0", | ||
"Model Serial Code": "123456", | ||
"Certification Level": 0, | ||
"Load Equivalency": 1 | ||
} | ||
}, messageCb) | ||
|
||
simpleCan.start() | ||
|