brilliantsole 0.0.45 → 0.0.48
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/build/brilliantsole.cjs +21 -2
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.module.d.ts +20 -20
- package/build/brilliantsole.module.min.d.ts +20 -20
- package/build/brilliantsole.node.module.d.ts +12 -12
- package/build/brilliantsole.node.module.js +21 -2
- package/build/brilliantsole.node.module.js.map +1 -1
- package/package.json +1 -1
- package/src/connection/bluetooth/NobleConnectionManager.ts +26 -3
package/package.json
CHANGED
|
@@ -17,8 +17,13 @@ import BluetoothConnectionManager from "./BluetoothConnectionManager.ts";
|
|
|
17
17
|
|
|
18
18
|
const _console = createConsole("NobleConnectionManager", { log: false });
|
|
19
19
|
|
|
20
|
+
let filterUUIDs = true;
|
|
21
|
+
|
|
20
22
|
/** NODE_START */
|
|
21
23
|
import type * as noble from "@abandonware/noble";
|
|
24
|
+
import os from "os";
|
|
25
|
+
const isLinux = os.platform() == "linux";
|
|
26
|
+
filterUUIDs = !isLinux;
|
|
22
27
|
/** NODE_END */
|
|
23
28
|
|
|
24
29
|
import {
|
|
@@ -166,6 +171,7 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
166
171
|
};
|
|
167
172
|
|
|
168
173
|
async #onNoblePeripheralConnect(this: NoblePeripheral) {
|
|
174
|
+
//_console.log("#onNoblePeripheralConnect",this.id);
|
|
169
175
|
await this.connectionManager!.onNoblePeripheralConnect(this);
|
|
170
176
|
}
|
|
171
177
|
async onNoblePeripheralConnect(noblePeripheral: NoblePeripheral) {
|
|
@@ -175,15 +181,24 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
175
181
|
noblePeripheral.state
|
|
176
182
|
);
|
|
177
183
|
if (noblePeripheral.state == "connected") {
|
|
178
|
-
|
|
179
|
-
allServiceUUIDs
|
|
180
|
-
);
|
|
184
|
+
_console.log("discoverServicesAsync", noblePeripheral.id, {
|
|
185
|
+
allServiceUUIDs,
|
|
186
|
+
});
|
|
187
|
+
// services don't show up if on ubuntu if serviceUUIDs are supplied
|
|
188
|
+
if (filterUUIDs) {
|
|
189
|
+
await this.#noblePeripheral!.discoverServicesAsync(
|
|
190
|
+
allServiceUUIDs as string[]
|
|
191
|
+
);
|
|
192
|
+
} else {
|
|
193
|
+
await this.#noblePeripheral!.discoverServicesAsync();
|
|
194
|
+
}
|
|
181
195
|
}
|
|
182
196
|
// this gets called when it connects and disconnects, so we use the noblePeripheral's "state" property instead
|
|
183
197
|
await this.#onNoblePeripheralState();
|
|
184
198
|
}
|
|
185
199
|
|
|
186
200
|
async #onNoblePeripheralDisconnect(this: NoblePeripheral) {
|
|
201
|
+
//_console.log("#onNoblePeripheralDisconnect", this.id);
|
|
187
202
|
await this.connectionManager!.onNoblePeripheralConnect(this);
|
|
188
203
|
}
|
|
189
204
|
async onNoblePeripheralDisconnect(noblePeripheral: NoblePeripheral) {
|
|
@@ -274,6 +289,14 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
274
289
|
for (const index in services) {
|
|
275
290
|
const service = services[index];
|
|
276
291
|
_console.log("service", service.uuid);
|
|
292
|
+
if (service.uuid == "1800") {
|
|
293
|
+
_console.log("skipping 1800");
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (service.uuid == "1801") {
|
|
297
|
+
_console.log("skipping 1801");
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
277
300
|
const serviceName = getServiceNameFromUUID(service.uuid)!;
|
|
278
301
|
_console.assertWithError(
|
|
279
302
|
serviceName,
|