Skip to content

Commit

Permalink
Add getRebootCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Apr 1, 2016
1 parent 2673b5d commit fb651fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,15 @@ const parseCommand = (data) => {
return getCommand(data.imei, raw);
};

const getRebootCommand = (imei) => {
return getCommand(imei, 'F02');
};

module.exports = {
parse: parse,
patterns: patterns,
getMvt380: getMvt380,
isMeitrack: isMeitrack,
parseCommand: parseCommand
parseCommand: parseCommand,
getRebootCommand: getRebootCommand
};
5 changes: 5 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ describe('meitrack-parser', () => {
const data = meitrack.parseCommand(command);
expect(data).to.match(/^@@([\x41-\x7A])(\d{1,3}),353358017784062,C01,0,10000\*([0-9A-F]{2})\r\n$/);
});

it('should return command reboot', () => {
const data = meitrack.getRebootCommand(353358017784062);
expect(data).to.match(/^@@([\x41-\x7A])(\d{1,3}),353358017784062,F02\*([0-9A-F]{2})\r\n$/);
});
});

0 comments on commit fb651fe

Please sign in to comment.