Skip to content

Commit

Permalink
Add type and device
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Mar 2, 2016
1 parent c815401 commit eb7ffb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const getMvt380 = (raw) => {
const status = match[27].split('').map(x => pad(4, parseInt(x, 10).toString(2), '0')).join('');
const data = {
raw: match[0],
type: 'MVT380',
type: 'data',
device: 'MVT380',
imei: parseInt(match[3], 10),
command: match[4],
event: getEvent(match[5]),
Expand Down
3 changes: 2 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ describe('meitrack-parzer', () => {
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);
expect(data.raw).to.eql(raw.toString());
expect(data.type).to.eql('MVT380');
expect(data.device).to.eql('MVT380');
expect(data.type).to.eql('data');
expect(data.imei).to.eql(862170013556541);
expect(data.command).to.eql('AAA');
expect(data.event).to.eql('timeIntervalTracking');
Expand Down

0 comments on commit eb7ffb2

Please sign in to comment.