Skip to content
Snippets Groups Projects
Verified Commit 19be5539 authored by Erick Hitter's avatar Erick Hitter
Browse files

Add support to CLI for multiple locks

parent 0f7fe3aa
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,14 @@ var augustctl = require('./index');
var config = require(process.env.AUGUSTCTL_CONFIG || './config.json');
var op = process.argv[2];
var whichLock = process.argv[2];
if ( config.hasOwnProperty(whichLock) ) {
config = config[whichLock];
} else {
throw new Error('invalid lock specified:' + whichLock);
}
var op = process.argv[3];
if (typeof augustctl.Lock.prototype[op] !== 'function') {
throw new Error('invalid operation: ' + op);
}
......
{
"front": {
"lockUuid": "abcdef012345",
"offlineKey": "ABCDEF0123456789ABCDEF0123456789",
"offlineKeyOffset": 1
},
"rear": {
"lockUuid": "abcdef456789",
"offlineKey": "ABCDEF0123456789ABCDEF0123456789",
"offlineKeyOffset": 1
}
}
......@@ -13,7 +13,7 @@ function scan(uuid) {
noble.on('stateChange', function(state) {
if (state === 'poweredOn') {
noble.startScanning([ Lock.BLE_COMMAND_SERVICE ]);
noble.startScanning([ Lock.BLE_COMMAND_SERVICE ], true);
} else {
noble.stopScanning();
}
......@@ -23,7 +23,6 @@ function scan(uuid) {
return new Promise(function(resolve) {
noble.on('discover', function(peripheral) {
if (uuid === undefined || peripheral.uuid === uuid) {
noble.stopScanning();
resolve(peripheral);
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment