Skip to content

Commit

Permalink
feature: send ikconvert network info (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbender9 authored Aug 14, 2020
1 parent c2488ac commit c8d2312
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/ikonvert.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,26 @@ iKonvertStream.prototype._transform = function (chunk, encoding, done) {

if ( line.startsWith('$PDGY,TEXT') ) {
debug(line)
} else if ( line.startsWith('$PDGY,000000,') ) {
let parts = line.split(',')

if ( parts[2] && parts[2].length > 0 ) {
const pgn = {
pgn: 0x40100,
prio: 7,
dst: 255,
src: 0,
'CAN network load': Number(parts[2]),
Errors: Number(parts[3]),
'Device count': Number(parts[4]),
'Uptime': Number(parts[5]),
'Gateway address': Number(parts[6]),
'Rejected TX requests': Number(parts[7])
}
this.push(`!PDGY,${pgn.pgn},${pgn.prio},${pgn.src},${pgn.dst},0,${toPgn(pgn).toString('base64')}`)
done()
return
}
} else if ( line.startsWith('$PDGY,NAK') ) {
let parts = line.split(',')
let msg = `NavLink2 error ${parts[2]}: ${parts[3]}`
Expand Down

0 comments on commit c8d2312

Please sign in to comment.