Skip to content

Drivetech/meitrack-parser

Repository files navigation

meitrack-parser

npm version npm downloads Build Status Coverage Status Code Climate dependency Status devDependency Status

Parse raw data from Meitrack devices

Installation

npm i -S meitrack-parser

Use

Try on Tonic

import meitrack from 'meitrack-parser'

const raw = new Buffer('$$A138,862170013556541,AAA,35,7.092076,79.960473,140412132808,A,10,9,57,275,1,14,5783799,7403612,413|1|F6E0|3933,0000,000B|0009||02D8|0122,*EE\r\n');
const data = meitrack.parse(raw);
/*
{ 
  raw: '$$A138,862170013556541,AAA,35,7.092076,79.960473,140412132808,A,10,9,57,275,1,14,5783799,7403612,413|1|F6E0|3933,0000,000B|0009||02D8|0122,*EE\r\n',
  type: 'data',
  manufacturer: 'meitrack',
  device: 'MVT380',
  imei: 862170013556541,
  command: 'AAA',
  alarm: { type: 'Gps' },
  loc: { type: 'Point', coordinates: [ 79.960473, 7.092076 ] },
  datetime: Sat Apr 12 2014 11:28:08 GMT-0200 (CLST),
  gpsStatus: true,
  satellites: 10,
  gsmSignal: 9,
  speed: 57,
  direction: 275,
  hdop: 1,
  altitude: 14,
  odometer: 5783799,
  runtime: 7403612,
  mcc: '413',
  mnc: '1',
  lac: 63200,
  cid: 14643,
  status: { 
    input: {
      '1': false,
      '2': false,
      '3': false,
      '4': false,
      '5': false,
      '6': false,
      '7': false,
      '8': false
    },
    output: {
      '1': false,
      '2': false,
      '3': false,
      '4': false,
      '5': false,
      '6': false,
      '7': false,
      '8': false
    }
  },
  voltage: {
    ad1: 0.064453125,
    ad2: 0.052734375,
    ad3: null,
    battery: 4.265625,
    inputCharge: 13.59375
  }
}
*/

License

MIT