node-switchbot 1.7.0 → 1.7.1-beta.0

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.
@@ -131,7 +131,7 @@ class SwitchbotDevice {
131
131
  });
132
132
 
133
133
  // Connect
134
- this._peripheral.connect((error) => {
134
+ this._peripheral.connectAsync((error) => {
135
135
  if (error) {
136
136
  reject(error);
137
137
  return;
@@ -145,7 +145,7 @@ class SwitchbotDevice {
145
145
  resolve();
146
146
  })
147
147
  .catch((error) => {
148
- this._peripheral.disconnect();
148
+ this._peripheral.disconnectAsync();
149
149
  reject(error);
150
150
  });
151
151
  });
@@ -224,7 +224,7 @@ class SwitchbotDevice {
224
224
 
225
225
  _discoverServices() {
226
226
  return new Promise((resolve, reject) => {
227
- this._peripheral.discoverServices([], (error, service_list) => {
227
+ this._peripheral.discoverServicesAsync([], (error, service_list) => {
228
228
  if (error) {
229
229
  reject(error);
230
230
  return;
@@ -321,7 +321,7 @@ class SwitchbotDevice {
321
321
  // Unsubscribe
322
322
  this._unsubscribe().then(() => {
323
323
  // Disconnect
324
- this._peripheral.disconnect(() => {
324
+ this._peripheral.disconnectAsync(() => {
325
325
  resolve();
326
326
  });
327
327
  });
package/lib/switchbot.js CHANGED
@@ -30,7 +30,7 @@ class Switchbot {
30
30
  if (params && params.noble) {
31
31
  noble = params.noble;
32
32
  } else {
33
- noble = require("@abandonware/noble");
33
+ noble = require('@abandonware/noble')({extended: false});
34
34
  }
35
35
 
36
36
  // Public properties
@@ -127,7 +127,7 @@ class Switchbot {
127
127
  clearTimeout(timer);
128
128
  }
129
129
  this.noble.removeAllListeners("discover");
130
- this.noble.stopScanning();
130
+ this.noble.stopScanningAsync(() => process.exit());
131
131
  let device_list = [];
132
132
  for (let addr in peripherals) {
133
133
  device_list.push(peripherals[addr]);
@@ -155,7 +155,7 @@ class Switchbot {
155
155
  });
156
156
 
157
157
  // Start scanning
158
- this.noble.startScanning(
158
+ this.noble.startScanningAsync([
159
159
  this._PRIMARY_SERVICE_UUID_LIST,
160
160
  false,
161
161
  (error) => {
@@ -167,7 +167,7 @@ class Switchbot {
167
167
  finishDiscovery();
168
168
  }, p.duration);
169
169
  }
170
- );
170
+ ], false);
171
171
  })
172
172
  .catch((error) => {
173
173
  reject(error);
@@ -371,7 +371,7 @@ class Switchbot {
371
371
  });
372
372
 
373
373
  // Start scanning
374
- this.noble.startScanning(
374
+ this.noble.startScanningAsync([
375
375
  this._PRIMARY_SERVICE_UUID_LIST,
376
376
  true,
377
377
  (error) => {
@@ -381,7 +381,7 @@ class Switchbot {
381
381
  resolve();
382
382
  }
383
383
  }
384
- );
384
+ ], false);
385
385
  })
386
386
  .catch((error) => {
387
387
  reject(error);
@@ -402,7 +402,7 @@ class Switchbot {
402
402
  * ---------------------------------------------------------------- */
403
403
  stopScan() {
404
404
  this.noble.removeAllListeners("discover");
405
- this.noble.stopScanning();
405
+ this.noble.stopScanningAsync(() => process.exit());
406
406
  }
407
407
 
408
408
  /* ------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-switchbot",
3
- "version": "1.7.0",
3
+ "version": "1.7.1-beta.0",
4
4
  "description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).",
5
5
  "main": "./lib/switchbot.js",
6
6
  "files": [
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "readmeFilename": "README.md",
36
36
  "dependencies": {
37
- "@abandonware/noble": "^1.9.2-15"
37
+ "@abandonware/noble": "^1.9.2-17"
38
38
  },
39
39
  "devDependencies": {
40
- "npm-check-updates": "^16.5.1"
40
+ "npm-check-updates": "^16.6.0"
41
41
  }
42
- }
42
+ }