Skip to content

Drivetech/tz-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tz-parser

npm version npm downloads dependency Status Build Status devDependency Status Join the chat at https://gitter.im/lgaticaq/tz-parser

Parse raw data from TZ-AVL devices

Installation

npm i -S tz-parser

Use

Try on Tonic

import tz from 'tz-parser'

const raw = new Buffer('$$B6869444005480041|91$GPRMC,194329.000,A,3321.6735,S,07030.7640,W,0.00,0.00,090216,,,A*6C|02.1|01.3|01.7|000000000000|20160209194326|13981188|00000000|32D3A03F|0000|0.6376|0100|7B20\r\n');
const data = tz.parse(raw);
/*{
  raw: '$$B6869444005480041|91$GPRMC,194329.000,A,3321.6735,S,07030.7640,W,0.00,0.00,090216,,,A*6C|02.1|01.3|01.7|000000000000|20160209194326|13981188|00000000|32D3A03F|0000|0.6376|0100|7B20\r\n',
  type: 'TZ-AVL05',
  imei: 869444005480041,
  alarmType: { type: 'Sleep', status: true },
  gprmcData: {
    raw: '$GPRMC,194329.000,A,3321.6735,S,07030.7640,W,0.00,0.00,090216,,,A*6C',
    valid: true,
    type: 'RMC',
    datetime: Tue Feb 09 2016 19:43:29 GMT+0000 (UTC),
    loc: { type: 'Point', coordinates: [ -70.51273333, -33.361225 ] },
    gps: true,
    speed: 0,
    track: '0.00',
    magneticVariation: null,
    mode: 'Autonomous'
  },
  pdop: 2.1,
  hdop: 1.3,
  vdop: 1.7,
  status: {
    raw: '000000000000',
    sos: false,
    input: { '1': false, '2': false, '3': false, '4': false, '5': false },
    output: { '1': false, '2': false },
    charge: true
  },
  datetime: Tue Feb 09 2016 19:43:26 GMT+0000 (UTC),
  voltage: { battery: 3.98, inputCharge: 11.88, ada: 0, adb: 0 },
  lac: 13011,
  cid: 41023,
  temperature: 0,
  odometer: 0.6376,
  serialId: 100,
  valid: true,
  currentData: { isCurrent: false, diff: '13 días' },
  gps: 'enable'
}*/