brilliantsole 0.0.45 → 0.0.46
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 +23 -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 +23 -2
- package/build/brilliantsole.node.module.js.map +1 -1
- package/package.json +1 -1
- package/src/connection/bluetooth/NobleConnectionManager.ts +28 -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 {
|
|
@@ -71,7 +76,9 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
71
76
|
if (!canConnect) {
|
|
72
77
|
return false;
|
|
73
78
|
}
|
|
79
|
+
console.log("FUCK");
|
|
74
80
|
await this.#noblePeripheral!.connectAsync();
|
|
81
|
+
console.log("YEA");
|
|
75
82
|
return true;
|
|
76
83
|
}
|
|
77
84
|
async disconnect() {
|
|
@@ -166,6 +173,7 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
166
173
|
};
|
|
167
174
|
|
|
168
175
|
async #onNoblePeripheralConnect(this: NoblePeripheral) {
|
|
176
|
+
//_console.log("#onNoblePeripheralConnect",this.id);
|
|
169
177
|
await this.connectionManager!.onNoblePeripheralConnect(this);
|
|
170
178
|
}
|
|
171
179
|
async onNoblePeripheralConnect(noblePeripheral: NoblePeripheral) {
|
|
@@ -175,15 +183,24 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
175
183
|
noblePeripheral.state
|
|
176
184
|
);
|
|
177
185
|
if (noblePeripheral.state == "connected") {
|
|
178
|
-
|
|
179
|
-
allServiceUUIDs
|
|
180
|
-
);
|
|
186
|
+
_console.log("discoverServicesAsync", noblePeripheral.id, {
|
|
187
|
+
allServiceUUIDs,
|
|
188
|
+
});
|
|
189
|
+
// services don't show up if on ubuntu if serviceUUIDs are supplied
|
|
190
|
+
if (filterUUIDs) {
|
|
191
|
+
await this.#noblePeripheral!.discoverServicesAsync(
|
|
192
|
+
allServiceUUIDs as string[]
|
|
193
|
+
);
|
|
194
|
+
} else {
|
|
195
|
+
await this.#noblePeripheral!.discoverServicesAsync();
|
|
196
|
+
}
|
|
181
197
|
}
|
|
182
198
|
// this gets called when it connects and disconnects, so we use the noblePeripheral's "state" property instead
|
|
183
199
|
await this.#onNoblePeripheralState();
|
|
184
200
|
}
|
|
185
201
|
|
|
186
202
|
async #onNoblePeripheralDisconnect(this: NoblePeripheral) {
|
|
203
|
+
//_console.log("#onNoblePeripheralDisconnect", this.id);
|
|
187
204
|
await this.connectionManager!.onNoblePeripheralConnect(this);
|
|
188
205
|
}
|
|
189
206
|
async onNoblePeripheralDisconnect(noblePeripheral: NoblePeripheral) {
|
|
@@ -274,6 +291,14 @@ class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
274
291
|
for (const index in services) {
|
|
275
292
|
const service = services[index];
|
|
276
293
|
_console.log("service", service.uuid);
|
|
294
|
+
if (service.uuid == "1800") {
|
|
295
|
+
_console.log("skipping 1800");
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (service.uuid == "1801") {
|
|
299
|
+
_console.log("skipping 1801");
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
277
302
|
const serviceName = getServiceNameFromUUID(service.uuid)!;
|
|
278
303
|
_console.assertWithError(
|
|
279
304
|
serviceName,
|