@stoprocent/bleno 0.8.2 → 0.8.4
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.
- package/lib/hci-socket/bindings.js +7 -4
- package/lib/hci-socket/hci.js +2 -1
- package/package.json +2 -2
- package/prebuilds/darwin-x64+arm64/@stoprocent+bleno.node +0 -0
- package/prebuilds/linux-x64/@stoprocent+bleno.musl.node +0 -0
- package/prebuilds/win32-ia32/@stoprocent+bleno.node +0 -0
- package/prebuilds/win32-x64/@stoprocent+bleno.node +0 -0
|
@@ -74,10 +74,11 @@ class BlenoBindings extends EventEmitter {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
init () {
|
|
77
|
-
this.
|
|
77
|
+
this._sigIntHandler = this.onSigInt.bind(this);
|
|
78
|
+
this._exitHandler = this.onExit.bind(this);
|
|
78
79
|
|
|
79
|
-
process.on('SIGINT', this.
|
|
80
|
-
process.on('exit', this.
|
|
80
|
+
process.on('SIGINT', this._sigIntHandler);
|
|
81
|
+
process.on('exit', this._exitHandler);
|
|
81
82
|
|
|
82
83
|
this._gap.on('advertisingStart', this.onAdvertisingStart.bind(this));
|
|
83
84
|
this._gap.on('advertisingStop', this.onAdvertisingStop.bind(this));
|
|
@@ -102,6 +103,8 @@ class BlenoBindings extends EventEmitter {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
stop () {
|
|
106
|
+
process.removeListener('SIGINT', this._sigIntHandler);
|
|
107
|
+
process.removeListener('exit', this._exitHandler);
|
|
105
108
|
this.stopAdvertising();
|
|
106
109
|
this.disconnect();
|
|
107
110
|
this._hci.stop();
|
|
@@ -208,7 +211,7 @@ class BlenoBindings extends EventEmitter {
|
|
|
208
211
|
onSigInt () {
|
|
209
212
|
const sigIntListeners = process.listeners('SIGINT');
|
|
210
213
|
|
|
211
|
-
if (sigIntListeners[sigIntListeners.length - 1] === this.
|
|
214
|
+
if (sigIntListeners[sigIntListeners.length - 1] === this._sigIntHandler) {
|
|
212
215
|
// we are the last listener, so exit
|
|
213
216
|
// this will trigger onExit, and clean up
|
|
214
217
|
process.exit(1);
|
package/lib/hci-socket/hci.js
CHANGED
|
@@ -116,7 +116,7 @@ class Hci extends EventEmitter {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
stop() {
|
|
119
|
+
stop () {
|
|
120
120
|
this._socket.removeAllListeners();
|
|
121
121
|
this._socket.stop();
|
|
122
122
|
}
|
|
@@ -589,6 +589,7 @@ class Hci extends EventEmitter {
|
|
|
589
589
|
debug('\t\talready closed');
|
|
590
590
|
continue;
|
|
591
591
|
}
|
|
592
|
+
|
|
592
593
|
if (pkts > this._handleAclsInProgress[handle_]) {
|
|
593
594
|
// Linux kernel may send acl packets by itself, so be ready for underflow
|
|
594
595
|
this._handleAclsInProgress[handle_] = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoprocent/bleno",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"node-gyp-build": "^4.8.1"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@stoprocent/bluetooth-hci-socket": "^1.
|
|
73
|
+
"@stoprocent/bluetooth-hci-socket": "^1.5.1",
|
|
74
74
|
"bplist-parser": "0.3.2",
|
|
75
75
|
"xpc-connect": "^3.0.0"
|
|
76
76
|
},
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|