mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Properly disconnect BLE socket.
This commit is contained in:
parent
43fd733b15
commit
308bb7095a
2 changed files with 4 additions and 8 deletions
|
@ -75,8 +75,8 @@ class GdxFor {
|
|||
* Called by the runtime when user wants to scan for a peripheral.
|
||||
*/
|
||||
scan () {
|
||||
if (this._device) {
|
||||
this._device.close();
|
||||
if (this._scratchLinkSocket) {
|
||||
this._scratchLinkSocket.disconnect();
|
||||
}
|
||||
|
||||
this._scratchLinkSocket = new BLE(this._runtime, this._extensionId, {
|
||||
|
@ -104,8 +104,8 @@ class GdxFor {
|
|||
* Disconnect from the GDX FOR.
|
||||
*/
|
||||
disconnect () {
|
||||
if (this._device) {
|
||||
this._device.close();
|
||||
if (this._scratchLinkSocket) {
|
||||
this._scratchLinkSocket.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,10 +39,6 @@ class ScratchLinkDeviceAdapter {
|
|||
const response = new DataView(array.buffer);
|
||||
return this._deviceOnResponse(response);
|
||||
}
|
||||
|
||||
close () {
|
||||
return this.scratchLinkSocket.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ScratchLinkDeviceAdapter;
|
||||
|
|
Loading…
Reference in a new issue