@stoprocent/bleno 0.8.1 → 0.8.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/index.d.ts +3 -1
- package/lib/bleno.js +5 -0
- package/lib/hci-socket/bindings.js +7 -3
- package/lib/hci-socket/hci.js +5 -0
- package/lib/mac/src/noble_mac.mm +7 -0
- 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
package/index.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ declare class PrimaryService {
|
|
|
103
103
|
toString(): string;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
interface Bleno extends NodeJS.EventEmitter {
|
|
106
|
+
export interface Bleno extends NodeJS.EventEmitter {
|
|
107
107
|
readonly Characteristic: typeof Characteristic;
|
|
108
108
|
readonly Descriptor: typeof Descriptor;
|
|
109
109
|
readonly PrimaryService: typeof PrimaryService;
|
|
@@ -120,6 +120,8 @@ interface Bleno extends NodeJS.EventEmitter {
|
|
|
120
120
|
|
|
121
121
|
disconnect(): void;
|
|
122
122
|
|
|
123
|
+
stop(): void;
|
|
124
|
+
|
|
123
125
|
setAddress(address: string): void;
|
|
124
126
|
|
|
125
127
|
setServices(services: ReadonlyArray<PrimaryService>, callback?: (arg: Error | undefined | null) => void): void;
|
package/lib/bleno.js
CHANGED
|
@@ -211,6 +211,11 @@ class Bleno extends EventEmitter {
|
|
|
211
211
|
this._bindings.disconnect();
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
stop () {
|
|
215
|
+
debug('stop');
|
|
216
|
+
this._bindings.stop();
|
|
217
|
+
}
|
|
218
|
+
|
|
214
219
|
updateRssi (callback) {
|
|
215
220
|
if (typeof callback === 'function') {
|
|
216
221
|
this.once('rssiUpdate', (rssi) => callback(null, rssi));
|
|
@@ -101,6 +101,12 @@ class BlenoBindings extends EventEmitter {
|
|
|
101
101
|
this._hci.init();
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
stop () {
|
|
105
|
+
this.stopAdvertising();
|
|
106
|
+
this.disconnect();
|
|
107
|
+
this._hci.stop();
|
|
108
|
+
}
|
|
109
|
+
|
|
104
110
|
onStateChange (state) {
|
|
105
111
|
if (this._state === state) {
|
|
106
112
|
return;
|
|
@@ -210,9 +216,7 @@ class BlenoBindings extends EventEmitter {
|
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
onExit () {
|
|
213
|
-
this.
|
|
214
|
-
|
|
215
|
-
this.disconnect();
|
|
219
|
+
this.stop();
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
package/lib/hci-socket/hci.js
CHANGED
package/lib/mac/src/noble_mac.mm
CHANGED
|
@@ -228,6 +228,12 @@ Napi::Value BlenoMac::CleanUp(const Napi::CallbackInfo& info) {
|
|
|
228
228
|
return Napi::Value();
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
Napi::Value BlenoMac::Stop(const Napi::CallbackInfo& info) {
|
|
232
|
+
CHECK_MANAGER()
|
|
233
|
+
CleanUp(info);
|
|
234
|
+
return Napi::Value();
|
|
235
|
+
}
|
|
236
|
+
|
|
231
237
|
Napi::Function BlenoMac::GetClass(Napi::Env env) {
|
|
232
238
|
return DefineClass(env, "BlenoMac", {
|
|
233
239
|
BlenoMac::InstanceMethod("init", &BlenoMac::Init),
|
|
@@ -248,6 +254,7 @@ Napi::Function BlenoMac::GetClass(Napi::Env env) {
|
|
|
248
254
|
BlenoMac::InstanceMethod("readHandle", &BlenoMac::ReadValue),
|
|
249
255
|
BlenoMac::InstanceMethod("writeHandle", &BlenoMac::WriteValue),
|
|
250
256
|
BlenoMac::InstanceMethod("cleanUp", &BlenoMac::CleanUp),
|
|
257
|
+
BlenoMac::InstanceMethod("stop", &BlenoMac::Stop),
|
|
251
258
|
});
|
|
252
259
|
}
|
|
253
260
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoprocent/bleno",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"node-gyp-build": "^4.8.1"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@stoprocent/bluetooth-hci-socket": "^1.4.
|
|
73
|
+
"@stoprocent/bluetooth-hci-socket": "^1.4.2",
|
|
74
74
|
"bplist-parser": "0.3.2",
|
|
75
75
|
"xpc-connect": "^3.0.0"
|
|
76
76
|
},
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|