Handle user did not pick peripheral

This commit is contained in:
DD Liu 2020-11-23 01:01:06 -05:00
parent 04b6963788
commit f19fd83563
2 changed files with 19 additions and 0 deletions

View file

@ -190,6 +190,15 @@ class BLE extends JSONRPC {
window.clearTimeout(this._discoverTimeoutID); window.clearTimeout(this._discoverTimeoutID);
} }
break; break;
case 'userDidNotPickPeripheral':
// this._availablePeripherals[params.peripheralId] = params;
this._runtime.emit(
this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT
);
if (this._discoverTimeoutID) {
window.clearTimeout(this._discoverTimeoutID);
}
break;
case 'characteristicDidChange': case 'characteristicDidChange':
if (this._characteristicDidChangeCallback) { if (this._characteristicDidChangeCallback) {
this._characteristicDidChangeCallback(params.message); this._characteristicDidChangeCallback(params.message);

View file

@ -128,6 +128,16 @@ class BT extends JSONRPC {
window.clearTimeout(this._discoverTimeoutID); window.clearTimeout(this._discoverTimeoutID);
} }
break; break;
//TODO why isn't 'user did pick peripheral' here?
case 'userDidNotPickPeripheral':
// this._availablePeripherals[params.peripheralId] = params;
this._runtime.emit(
this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT
);
if (this._discoverTimeoutID) {
window.clearTimeout(this._discoverTimeoutID);
}
break;
case 'didReceiveMessage': case 'didReceiveMessage':
this._messageCallback(params); // TODO: refine? this._messageCallback(params); // TODO: refine?
break; break;