@stoprocent/noble 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,10 +104,8 @@ NobleBindings.prototype.startScanning = function (
104
104
  };
105
105
 
106
106
  NobleBindings.prototype.stopScanning = function () {
107
- if (this._isScanning) {
108
- this._gap.stopScanning();
109
- }
110
- else {
107
+ this._gap.stopScanning();
108
+ if (!this._isScanning) {
111
109
  this.emit('scanStop');
112
110
  }
113
111
  };
@@ -215,7 +213,9 @@ NobleBindings.prototype.onScanParametersSet = function () {
215
213
  };
216
214
 
217
215
  NobleBindings.prototype.onScanStart = function (filterDuplicates) {
218
- this._isScanning = true;
216
+ if (this._isScanningStarted) {
217
+ this._isScanning = true;
218
+ }
219
219
  this.emit('scanStart', filterDuplicates);
220
220
  };
221
221
 
@@ -292,10 +292,6 @@ NobleBindings.prototype.onLeConnComplete = function (
292
292
  supervisionTimeout,
293
293
  masterClockAccuracy
294
294
  ) {
295
- //
296
- this._isScanning = false;
297
- this._isScanningStarted = false;
298
-
299
295
  if (role !== 0 && role !== undefined) {
300
296
  // not master, ignore
301
297
  return;
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "name": "@stoprocent/noble",
8
8
  "description": "A Node.js BLE (Bluetooth Low Energy) central library.",
9
- "version": "2.1.5",
9
+ "version": "2.1.6",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/stoprocent/noble.git"
@@ -216,7 +216,7 @@ describe('hci-socket bindings', () => {
216
216
 
217
217
  bindings.stopScanning();
218
218
 
219
- expect(bindings._gap.stopScanning).not.toHaveBeenCalled();
219
+ expect(bindings._gap.stopScanning).toHaveBeenCalledTimes(1);
220
220
  expect(scanStopSpy).toHaveBeenCalledTimes(1);
221
221
  });
222
222
  });