@stoprocent/bleno 0.10.1 → 0.10.2
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/acl-stream.js +7 -6
- package/lib/hci-socket/bindings.js +5 -3
- package/lib/hci-socket/gatt.js +5 -5
- package/lib/hci-socket/mgmt.js +4 -0
- package/lib/hci-socket/smp.js +4 -0
- package/package.json +2 -2
- package/prebuilds/darwin-x64+arm64/@stoprocent+bleno.node +0 -0
- package/prebuilds/win32-ia32/@stoprocent+bleno.node +0 -0
- package/prebuilds/win32-x64/@stoprocent+bleno.node +0 -0
|
@@ -11,16 +11,17 @@ class AclStream extends EventEmitter {
|
|
|
11
11
|
this._smp = new Smp(this, localAddressType, localAddress, remoteAddressType, remoteAddress);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
close () {
|
|
15
|
+
this.emit('end', this._handle);
|
|
16
|
+
this._smp.close();
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
write (cid, data) {
|
|
15
20
|
this._hci.queueAclDataPkt(this._handle, cid, data);
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
push (
|
|
19
|
-
|
|
20
|
-
this.emit('data', handle, cid, data);
|
|
21
|
-
} else {
|
|
22
|
-
this.emit('end', handle);
|
|
23
|
-
}
|
|
23
|
+
push (cid, data) {
|
|
24
|
+
this.emit('data', this._handle, cid, data);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
pushEncrypt (encrypt) {
|
|
@@ -77,6 +77,7 @@ class BlenoBindings extends EventEmitter {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
init () {
|
|
80
|
+
|
|
80
81
|
this._sigIntHandler = this.onSigInt.bind(this);
|
|
81
82
|
this._exitHandler = this.onExit.bind(this);
|
|
82
83
|
|
|
@@ -173,12 +174,13 @@ class BlenoBindings extends EventEmitter {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
const { address, aclStream } = this._connections.get(handle);
|
|
176
|
-
|
|
177
|
+
|
|
177
178
|
if (aclStream) {
|
|
178
|
-
aclStream.
|
|
179
|
+
aclStream.close();
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
this._connections.delete(handle);
|
|
183
|
+
|
|
182
184
|
this.emit('disconnect', address, handle);
|
|
183
185
|
|
|
184
186
|
if (this._advertising) {
|
|
@@ -211,7 +213,7 @@ class BlenoBindings extends EventEmitter {
|
|
|
211
213
|
onAclDataPkt (handle, cid, data) {
|
|
212
214
|
const connection = this._connections.get(handle);
|
|
213
215
|
if (connection && connection.aclStream) {
|
|
214
|
-
connection.aclStream.push(
|
|
216
|
+
connection.aclStream.push(cid, data);
|
|
215
217
|
}
|
|
216
218
|
}
|
|
217
219
|
|
package/lib/hci-socket/gatt.js
CHANGED
|
@@ -278,14 +278,13 @@ class Gatt extends EventEmitter {
|
|
|
278
278
|
aclStream,
|
|
279
279
|
mtu: 23,
|
|
280
280
|
});
|
|
281
|
-
|
|
282
281
|
this._aclStreamCallbacks.set(connection, {
|
|
283
282
|
onData: function (connection, cid, data) {
|
|
284
283
|
this.onAclStreamData(connection, cid, data);
|
|
285
|
-
},
|
|
284
|
+
}.bind(this),
|
|
286
285
|
onEnd: function (connection) {
|
|
287
286
|
this.onAclStreamEnd(connection);
|
|
288
|
-
}
|
|
287
|
+
}.bind(this)
|
|
289
288
|
});
|
|
290
289
|
|
|
291
290
|
aclStream.on('data', this._aclStreamCallbacks.get(connection).onData.bind(this));
|
|
@@ -308,8 +307,8 @@ class Gatt extends EventEmitter {
|
|
|
308
307
|
const { aclStream } = this._connections.get(connection);
|
|
309
308
|
|
|
310
309
|
aclStream.removeListener('data', this._aclStreamCallbacks.get(connection).onData);
|
|
311
|
-
aclStream.removeListener('end', this._aclStreamCallbacks.get(connection).onEnd);
|
|
312
|
-
|
|
310
|
+
aclStream.removeListener('end', this._aclStreamCallbacks.get(connection).onEnd);
|
|
311
|
+
|
|
313
312
|
// Clean up subscriptions for this connection
|
|
314
313
|
for (let i = 0; i < this._handles.length; i++) {
|
|
315
314
|
if (this._handles[i] &&
|
|
@@ -327,6 +326,7 @@ class Gatt extends EventEmitter {
|
|
|
327
326
|
}
|
|
328
327
|
|
|
329
328
|
this._connections.delete(connection);
|
|
329
|
+
this._aclStreamCallbacks.delete(connection);
|
|
330
330
|
this._preparedWriteRequests.delete(connection);
|
|
331
331
|
}
|
|
332
332
|
|
package/lib/hci-socket/mgmt.js
CHANGED
package/lib/hci-socket/smp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoprocent/bleno",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
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",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"node-gyp-build": "^4.8.4"
|
|
70
70
|
},
|
|
71
71
|
"optionalDependencies": {
|
|
72
|
-
"@stoprocent/bluetooth-hci-socket": "^2.1.
|
|
72
|
+
"@stoprocent/bluetooth-hci-socket": "^2.1.1"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|