@rhizomatics/signalk-einklabel-plugin 1.3.0-beta7 → 1.3.0-beta8
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/dist/cli/index.js +0 -0
- package/dist/devices/bleBackend.js +16 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
File without changes
|
|
@@ -168,6 +168,8 @@ async function ensureDeviceVisible(bleApi, pluginId, address, timeoutMs) {
|
|
|
168
168
|
throw new Error(`device ${address} isn't visible to the SignalK BLE Manager yet (out of range, asleep, or never seen) after waiting ${timeoutMs}ms`);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
/** Upper bound on how long a timed-out `bleApi.connectGATT()` is given to settle server-side before a retry - see `bleApiBackend`. */
|
|
172
|
+
const CONNECT_SETTLE_GRACE_MS = 30000;
|
|
171
173
|
let bleManagerQueue = Promise.resolve();
|
|
172
174
|
/**
|
|
173
175
|
* Runs `fn` only once every earlier caller has finished, so paints to different devices never hold
|
|
@@ -209,7 +211,20 @@ function bleApiBackend(bleApi, pluginId) {
|
|
|
209
211
|
// background) so a caller retrying straight away - `withRetries` - can't race it with a new
|
|
210
212
|
// `connectGATT()` and get rejected with "has a GATT claim in progress" for its trouble.
|
|
211
213
|
await bleApi.releaseGATTDevice(address, pluginId).catch(() => { });
|
|
212
|
-
|
|
214
|
+
// ...except a claim still *connecting* isn't in the server's claim table yet, only its pending
|
|
215
|
+
// set, which `releaseGATTDevice` doesn't touch - so while the server's own connect is still in
|
|
216
|
+
// flight, a retry's `connectGATT()` is rejected outright with "has a GATT claim in progress".
|
|
217
|
+
// Give that connect a bounded chance to settle first, so the retry gets a clean slate.
|
|
218
|
+
const late = await Promise.race([
|
|
219
|
+
connecting.catch(() => undefined),
|
|
220
|
+
(0, bleDiscovery_1.sleep)(Math.min(timeoutMs, CONNECT_SETTLE_GRACE_MS)).then(() => undefined),
|
|
221
|
+
]);
|
|
222
|
+
if (late) {
|
|
223
|
+
await Promise.allSettled([bleApi.releaseGATTDevice(address, pluginId), late.disconnect()]);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
void connecting.then((c) => c.disconnect()).catch(() => { });
|
|
227
|
+
}
|
|
213
228
|
throw new Error(`connecting to device timed out after ${timeoutMs}ms`);
|
|
214
229
|
}
|
|
215
230
|
return withSessionWatchdog(conn, GATT_SESSION_WATCHDOG_MS, async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizomatics/signalk-einklabel-plugin",
|
|
3
|
-
"version": "1.3.0-
|
|
3
|
+
"version": "1.3.0-beta8",
|
|
4
4
|
"description": "Display SignalK data on eInk Electronic Shelf Labels, includes working examples for tide clock and watch schedule.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ble",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "^5.5.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
|
-
"node": ">=
|
|
78
|
+
"node": ">=22"
|
|
79
79
|
},
|
|
80
80
|
"signalk": {
|
|
81
81
|
"displayName": "eInk Label Displays",
|