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 6f4a86a commit cdb2f6b
Show file tree
Hide file tree
Showing 2 changed files with 16 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 @@ -737,6 +737,10 @@ const parseCommand = (data) => {
return command;
};

const getRebootCommand = (password='000000') => {
return `*${password},991#`;
};

module.exports = {
parse: parse,
patterns: patterns,
Expand All @@ -752,5 +756,6 @@ module.exports = {
verifyLen: verifyLen,
verifyCrc: verifyCrc,
isTz: isTz,
parseCommand: parseCommand
parseCommand: parseCommand,
getRebootCommand: getRebootCommand
};
10 changes: 10 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,4 +849,14 @@ describe('tz-parzer', () => {
const raw = tz.parseCommand(data);
expect(raw).to.eql('*000000,404,1,300#');
});

it('should return raw command reboot', () => {
const raw = tz.getRebootCommand();
expect(raw).to.eql('*000000,991#');
});

it('should return raw command reboot with password', () => {
const raw = tz.getRebootCommand('123456');
expect(raw).to.eql('*123456,991#');
});
});

0 comments on commit cdb2f6b

Please sign in to comment.