mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Merge pull request #2710 from fsih/useCdm
Handle user did not pick peripheral
This commit is contained in:
commit
a0c11d6d86
2 changed files with 26 additions and 0 deletions
|
@ -190,6 +190,14 @@ class BLE extends JSONRPC {
|
|||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
break;
|
||||
case 'userDidNotPickPeripheral':
|
||||
this._runtime.emit(
|
||||
this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT
|
||||
);
|
||||
if (this._discoverTimeoutID) {
|
||||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
break;
|
||||
case 'characteristicDidChange':
|
||||
if (this._characteristicDidChangeCallback) {
|
||||
this._characteristicDidChangeCallback(params.message);
|
||||
|
|
18
src/io/bt.js
18
src/io/bt.js
|
@ -128,6 +128,24 @@ class BT extends JSONRPC {
|
|||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
break;
|
||||
case 'userDidPickPeripheral':
|
||||
this._availablePeripherals[params.peripheralId] = params;
|
||||
this._runtime.emit(
|
||||
this._runtime.constructor.USER_PICKED_PERIPHERAL,
|
||||
this._availablePeripherals
|
||||
);
|
||||
if (this._discoverTimeoutID) {
|
||||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
break;
|
||||
case 'userDidNotPickPeripheral':
|
||||
this._runtime.emit(
|
||||
this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT
|
||||
);
|
||||
if (this._discoverTimeoutID) {
|
||||
window.clearTimeout(this._discoverTimeoutID);
|
||||
}
|
||||
break;
|
||||
case 'didReceiveMessage':
|
||||
this._messageCallback(params); // TODO: refine?
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue