mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Handle user did not pick peripheral
This commit is contained in:
parent
04b6963788
commit
f19fd83563
2 changed files with 19 additions and 0 deletions
|
@ -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);
|
||||||
|
|
10
src/io/bt.js
10
src/io/bt.js
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue