@onekeyfe/hwk-desktop-noble-ble 1.2.11-alpha.1 → 1.2.11-alpha.3
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/{chunk-O6YS25TV.mjs → chunk-ILABAQJY.mjs} +1 -9
- package/dist/chunk-ILABAQJY.mjs.map +1 -0
- package/dist/constants.d.mts +1 -12
- package/dist/constants.d.ts +1 -12
- package/dist/constants.js +2 -12
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +3 -7
- package/dist/index.d.mts +2 -26
- package/dist/index.d.ts +2 -26
- package/dist/index.js +47 -316
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -309
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-O6YS25TV.mjs.map +0 -1
|
@@ -23,12 +23,6 @@ var THIRD_PARTY_BLE_CHANNELS = {
|
|
|
23
23
|
/** push event: main → renderer when device disconnects unexpectedly */
|
|
24
24
|
disconnected: "$onekey-3p-ble-disconnected"
|
|
25
25
|
};
|
|
26
|
-
var THIRD_PARTY_BLE_IPC_ERROR_TYPE = "ThirdPartyBleIpcError";
|
|
27
|
-
function isThirdPartyBleIpcErrorResponse(response) {
|
|
28
|
-
if (!response || typeof response !== "object") return false;
|
|
29
|
-
const candidate = response;
|
|
30
|
-
return candidate.type === THIRD_PARTY_BLE_IPC_ERROR_TYPE && candidate.success === false && typeof candidate.error?.message === "string";
|
|
31
|
-
}
|
|
32
26
|
var THIRD_PARTY_BLE_SCAN_DURATION_MS = 5e3;
|
|
33
27
|
var THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS = 1e4;
|
|
34
28
|
var THIRD_PARTY_BLE_DEVICE_TTL_MS = 5e3;
|
|
@@ -38,12 +32,10 @@ var THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3e3;
|
|
|
38
32
|
export {
|
|
39
33
|
__require,
|
|
40
34
|
THIRD_PARTY_BLE_CHANNELS,
|
|
41
|
-
THIRD_PARTY_BLE_IPC_ERROR_TYPE,
|
|
42
|
-
isThirdPartyBleIpcErrorResponse,
|
|
43
35
|
THIRD_PARTY_BLE_SCAN_DURATION_MS,
|
|
44
36
|
THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS,
|
|
45
37
|
THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
46
38
|
THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS,
|
|
47
39
|
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
48
40
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-ILABAQJY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Renderer/main IPC channels shared by every third-party BLE vendor; prefixed to\n * avoid clashing with the OneKey handler (`$onekey-noble-ble-*`) in one app.\n */\nexport const THIRD_PARTY_BLE_CHANNELS = {\n scan: '$onekey-3p-ble-scan',\n stopScan: '$onekey-3p-ble-stop-scan',\n connect: '$onekey-3p-ble-connect',\n disconnect: '$onekey-3p-ble-disconnect',\n write: '$onekey-3p-ble-write',\n subscribe: '$onekey-3p-ble-subscribe',\n unsubscribe: '$onekey-3p-ble-unsubscribe',\n availability: '$onekey-3p-ble-availability',\n getDevice: '$onekey-3p-ble-get-device',\n readRssi: '$onekey-3p-ble-read-rssi',\n cancelPairing: '$onekey-3p-ble-cancel-pairing',\n /** push event: main → renderer with assembled BLE notification payload */\n notification: '$onekey-3p-ble-notification',\n /** push event: main → renderer when device disconnects unexpectedly */\n disconnected: '$onekey-3p-ble-disconnected',\n} as const;\n\nexport type ThirdPartyBleChannel =\n (typeof THIRD_PARTY_BLE_CHANNELS)[keyof typeof THIRD_PARTY_BLE_CHANNELS];\n\n/** Reconnect scan window for `connect(id)`. */\nexport const THIRD_PARTY_BLE_SCAN_DURATION_MS = 5_000;\n\n/** Continuous scan auto-stops this long after the last poll (reset, not accumulated). */\nexport const THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS = 10_000;\n\n/** Drop a device from the snapshot if it hasn't re-advertised within this window. */\nexport const THIRD_PARTY_BLE_DEVICE_TTL_MS = 5_000;\n\n/** Time we'll wait for noble to reach `poweredOn` before failing init. */\nexport const THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS = 10_000;\n\n/** Time an availability check waits for a fresh noble to report its first state. */\nexport const THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3_000;\n"],"mappings":";;;;;;;;AAIO,IAAM,2BAA2B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAEd,cAAc;AAChB;AAMO,IAAM,mCAAmC;AAGzC,IAAM,oCAAoC;AAG1C,IAAM,gCAAgC;AAGtC,IAAM,sCAAsC;AAG5C,IAAM,0CAA0C;","names":[]}
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ConnectorSerializedError } from '@onekeyfe/hwk-adapter-core';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Renderer/main IPC channels shared by every third-party BLE vendor; prefixed to
|
|
5
3
|
* avoid clashing with the OneKey handler (`$onekey-noble-ble-*`) in one app.
|
|
@@ -22,15 +20,6 @@ declare const THIRD_PARTY_BLE_CHANNELS: {
|
|
|
22
20
|
readonly disconnected: "$onekey-3p-ble-disconnected";
|
|
23
21
|
};
|
|
24
22
|
type ThirdPartyBleChannel = (typeof THIRD_PARTY_BLE_CHANNELS)[keyof typeof THIRD_PARTY_BLE_CHANNELS];
|
|
25
|
-
declare const THIRD_PARTY_BLE_IPC_ERROR_TYPE = "ThirdPartyBleIpcError";
|
|
26
|
-
/** What a handler wrapped by `withThirdPartyBleIpcErrors` returns instead of throwing. */
|
|
27
|
-
interface ThirdPartyBleIpcErrorResponse {
|
|
28
|
-
type: typeof THIRD_PARTY_BLE_IPC_ERROR_TYPE;
|
|
29
|
-
success: false;
|
|
30
|
-
error: ConnectorSerializedError;
|
|
31
|
-
}
|
|
32
|
-
/** For the preload, which imports this entry: rethrow `response.error` when this matches. */
|
|
33
|
-
declare function isThirdPartyBleIpcErrorResponse(response: unknown): response is ThirdPartyBleIpcErrorResponse;
|
|
34
23
|
/** Reconnect scan window for `connect(id)`. */
|
|
35
24
|
declare const THIRD_PARTY_BLE_SCAN_DURATION_MS = 5000;
|
|
36
25
|
/** Continuous scan auto-stops this long after the last poll (reset, not accumulated). */
|
|
@@ -42,4 +31,4 @@ declare const THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS = 10000;
|
|
|
42
31
|
/** Time an availability check waits for a fresh noble to report its first state. */
|
|
43
32
|
declare const THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3000;
|
|
44
33
|
|
|
45
|
-
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
34
|
+
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS, type ThirdPartyBleChannel };
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ConnectorSerializedError } from '@onekeyfe/hwk-adapter-core';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Renderer/main IPC channels shared by every third-party BLE vendor; prefixed to
|
|
5
3
|
* avoid clashing with the OneKey handler (`$onekey-noble-ble-*`) in one app.
|
|
@@ -22,15 +20,6 @@ declare const THIRD_PARTY_BLE_CHANNELS: {
|
|
|
22
20
|
readonly disconnected: "$onekey-3p-ble-disconnected";
|
|
23
21
|
};
|
|
24
22
|
type ThirdPartyBleChannel = (typeof THIRD_PARTY_BLE_CHANNELS)[keyof typeof THIRD_PARTY_BLE_CHANNELS];
|
|
25
|
-
declare const THIRD_PARTY_BLE_IPC_ERROR_TYPE = "ThirdPartyBleIpcError";
|
|
26
|
-
/** What a handler wrapped by `withThirdPartyBleIpcErrors` returns instead of throwing. */
|
|
27
|
-
interface ThirdPartyBleIpcErrorResponse {
|
|
28
|
-
type: typeof THIRD_PARTY_BLE_IPC_ERROR_TYPE;
|
|
29
|
-
success: false;
|
|
30
|
-
error: ConnectorSerializedError;
|
|
31
|
-
}
|
|
32
|
-
/** For the preload, which imports this entry: rethrow `response.error` when this matches. */
|
|
33
|
-
declare function isThirdPartyBleIpcErrorResponse(response: unknown): response is ThirdPartyBleIpcErrorResponse;
|
|
34
23
|
/** Reconnect scan window for `connect(id)`. */
|
|
35
24
|
declare const THIRD_PARTY_BLE_SCAN_DURATION_MS = 5000;
|
|
36
25
|
/** Continuous scan auto-stops this long after the last poll (reset, not accumulated). */
|
|
@@ -42,4 +31,4 @@ declare const THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS = 10000;
|
|
|
42
31
|
/** Time an availability check waits for a fresh noble to report its first state. */
|
|
43
32
|
declare const THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3000;
|
|
44
33
|
|
|
45
|
-
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
34
|
+
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS, type ThirdPartyBleChannel };
|
package/dist/constants.js
CHANGED
|
@@ -22,12 +22,10 @@ var constants_exports = {};
|
|
|
22
22
|
__export(constants_exports, {
|
|
23
23
|
THIRD_PARTY_BLE_CHANNELS: () => THIRD_PARTY_BLE_CHANNELS,
|
|
24
24
|
THIRD_PARTY_BLE_DEVICE_TTL_MS: () => THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
25
|
-
THIRD_PARTY_BLE_IPC_ERROR_TYPE: () => THIRD_PARTY_BLE_IPC_ERROR_TYPE,
|
|
26
25
|
THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS: () => THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS,
|
|
27
26
|
THIRD_PARTY_BLE_SCAN_DURATION_MS: () => THIRD_PARTY_BLE_SCAN_DURATION_MS,
|
|
28
27
|
THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS: () => THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS,
|
|
29
|
-
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS: () => THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
30
|
-
isThirdPartyBleIpcErrorResponse: () => isThirdPartyBleIpcErrorResponse
|
|
28
|
+
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS: () => THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
31
29
|
});
|
|
32
30
|
module.exports = __toCommonJS(constants_exports);
|
|
33
31
|
var THIRD_PARTY_BLE_CHANNELS = {
|
|
@@ -47,12 +45,6 @@ var THIRD_PARTY_BLE_CHANNELS = {
|
|
|
47
45
|
/** push event: main → renderer when device disconnects unexpectedly */
|
|
48
46
|
disconnected: "$onekey-3p-ble-disconnected"
|
|
49
47
|
};
|
|
50
|
-
var THIRD_PARTY_BLE_IPC_ERROR_TYPE = "ThirdPartyBleIpcError";
|
|
51
|
-
function isThirdPartyBleIpcErrorResponse(response) {
|
|
52
|
-
if (!response || typeof response !== "object") return false;
|
|
53
|
-
const candidate = response;
|
|
54
|
-
return candidate.type === THIRD_PARTY_BLE_IPC_ERROR_TYPE && candidate.success === false && typeof candidate.error?.message === "string";
|
|
55
|
-
}
|
|
56
48
|
var THIRD_PARTY_BLE_SCAN_DURATION_MS = 5e3;
|
|
57
49
|
var THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS = 1e4;
|
|
58
50
|
var THIRD_PARTY_BLE_DEVICE_TTL_MS = 5e3;
|
|
@@ -62,11 +54,9 @@ var THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3e3;
|
|
|
62
54
|
0 && (module.exports = {
|
|
63
55
|
THIRD_PARTY_BLE_CHANNELS,
|
|
64
56
|
THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
65
|
-
THIRD_PARTY_BLE_IPC_ERROR_TYPE,
|
|
66
57
|
THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS,
|
|
67
58
|
THIRD_PARTY_BLE_SCAN_DURATION_MS,
|
|
68
59
|
THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS,
|
|
69
|
-
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
70
|
-
isThirdPartyBleIpcErrorResponse
|
|
60
|
+
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
71
61
|
});
|
|
72
62
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Renderer/main IPC channels shared by every third-party BLE vendor; prefixed to\n * avoid clashing with the OneKey handler (`$onekey-noble-ble-*`) in one app.\n */\nexport const THIRD_PARTY_BLE_CHANNELS = {\n scan: '$onekey-3p-ble-scan',\n stopScan: '$onekey-3p-ble-stop-scan',\n connect: '$onekey-3p-ble-connect',\n disconnect: '$onekey-3p-ble-disconnect',\n write: '$onekey-3p-ble-write',\n subscribe: '$onekey-3p-ble-subscribe',\n unsubscribe: '$onekey-3p-ble-unsubscribe',\n availability: '$onekey-3p-ble-availability',\n getDevice: '$onekey-3p-ble-get-device',\n readRssi: '$onekey-3p-ble-read-rssi',\n cancelPairing: '$onekey-3p-ble-cancel-pairing',\n /** push event: main → renderer with assembled BLE notification payload */\n notification: '$onekey-3p-ble-notification',\n /** push event: main → renderer when device disconnects unexpectedly */\n disconnected: '$onekey-3p-ble-disconnected',\n} as const;\n\nexport type ThirdPartyBleChannel =\n (typeof THIRD_PARTY_BLE_CHANNELS)[keyof typeof THIRD_PARTY_BLE_CHANNELS];\n\n/** Reconnect scan window for `connect(id)`. */\nexport const THIRD_PARTY_BLE_SCAN_DURATION_MS = 5_000;\n\n/** Continuous scan auto-stops this long after the last poll (reset, not accumulated). */\nexport const THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS = 10_000;\n\n/** Drop a device from the snapshot if it hasn't re-advertised within this window. */\nexport const THIRD_PARTY_BLE_DEVICE_TTL_MS = 5_000;\n\n/** Time we'll wait for noble to reach `poweredOn` before failing init. */\nexport const THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS = 10_000;\n\n/** Time an availability check waits for a fresh noble to report its first state. */\nexport const THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS = 3_000;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,2BAA2B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAEd,cAAc;AAChB;AAMO,IAAM,mCAAmC;AAGzC,IAAM,oCAAoC;AAG1C,IAAM,gCAAgC;AAGtC,IAAM,sCAAsC;AAG5C,IAAM,0CAA0C;","names":[]}
|
package/dist/constants.mjs
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
THIRD_PARTY_BLE_CHANNELS,
|
|
3
3
|
THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
4
|
-
THIRD_PARTY_BLE_IPC_ERROR_TYPE,
|
|
5
4
|
THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS,
|
|
6
5
|
THIRD_PARTY_BLE_SCAN_DURATION_MS,
|
|
7
6
|
THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS,
|
|
8
|
-
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
9
|
-
|
|
10
|
-
} from "./chunk-O6YS25TV.mjs";
|
|
7
|
+
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
8
|
+
} from "./chunk-ILABAQJY.mjs";
|
|
11
9
|
export {
|
|
12
10
|
THIRD_PARTY_BLE_CHANNELS,
|
|
13
11
|
THIRD_PARTY_BLE_DEVICE_TTL_MS,
|
|
14
|
-
THIRD_PARTY_BLE_IPC_ERROR_TYPE,
|
|
15
12
|
THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS,
|
|
16
13
|
THIRD_PARTY_BLE_SCAN_DURATION_MS,
|
|
17
14
|
THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS,
|
|
18
|
-
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
19
|
-
isThirdPartyBleIpcErrorResponse
|
|
15
|
+
THIRD_PARTY_BLE_STATE_SETTLE_TIMEOUT_MS
|
|
20
16
|
};
|
|
21
17
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ElectronBleConnectOptions, ElectronBleScanOptions } from '@onekeyfe/hwk-adapter-core';
|
|
2
|
-
|
|
3
|
-
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_IPC_ERROR_TYPE, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, ThirdPartyBleChannel, isThirdPartyBleIpcErrorResponse } from './constants.mjs';
|
|
2
|
+
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, ThirdPartyBleChannel } from './constants.mjs';
|
|
4
3
|
|
|
5
4
|
type BleDebugLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
6
5
|
type BleDebugLogEntry = {
|
|
@@ -159,8 +158,6 @@ interface NobleBleHandlerOptions {
|
|
|
159
158
|
nobleFactory?: NobleFactory;
|
|
160
159
|
/** Override the overall connect timeout (tests only; defaults to 31s). */
|
|
161
160
|
connectTimeoutMs?: number;
|
|
162
|
-
/** Override the subscribe timeout (tests only; defaults to 60s). */
|
|
163
|
-
subscribeTimeoutMs?: number;
|
|
164
161
|
logger?: BleDebugLogger;
|
|
165
162
|
/**
|
|
166
163
|
* Vendors served over IPC, keyed by the `vendor` the renderer sends. Replaces the default map
|
|
@@ -173,13 +170,10 @@ declare class NobleBleHandler {
|
|
|
173
170
|
private _noble;
|
|
174
171
|
private readonly _factory;
|
|
175
172
|
private readonly _connectTimeoutMs;
|
|
176
|
-
private readonly _subscribeTimeoutMs;
|
|
177
173
|
private readonly _logger?;
|
|
178
174
|
private readonly _vendors;
|
|
179
175
|
private readonly _discovered;
|
|
180
176
|
private readonly _lastSeen;
|
|
181
|
-
private readonly _advertisedUuids;
|
|
182
|
-
private readonly _keptByMemory;
|
|
183
177
|
private readonly _connected;
|
|
184
178
|
private _discoverHandler?;
|
|
185
179
|
private _scanning;
|
|
@@ -209,7 +203,6 @@ declare class NobleBleHandler {
|
|
|
209
203
|
* packet, and a Safe 7 ADV carries only its name (UUID is in the scan response).
|
|
210
204
|
*/
|
|
211
205
|
scan(options?: ElectronBleScanOptions): Promise<ThirdPartyBleDeviceInfo[]>;
|
|
212
|
-
private _rememberServiceUuids;
|
|
213
206
|
/**
|
|
214
207
|
* In-range devices matching the caller, minus TTL-expired ones. `_discovered`
|
|
215
208
|
* is only a cache; a missing device can still be reached by `_directConnect`.
|
|
@@ -261,12 +254,6 @@ declare class NobleBleHandler {
|
|
|
261
254
|
private _connectInner;
|
|
262
255
|
disconnect(id: string): Promise<void>;
|
|
263
256
|
subscribe(id: string): Promise<void>;
|
|
264
|
-
private _withSubscribeTimeout;
|
|
265
|
-
/**
|
|
266
|
-
* noble-win reports a failed subscribe only as `status: <AsyncStatus>`. Error (3) on a live
|
|
267
|
-
* link is a device refusing the bond Windows holds; a link already gone fails it the same way.
|
|
268
|
-
*/
|
|
269
|
-
private _toSubscribeError;
|
|
270
257
|
unsubscribe(id: string): Promise<void>;
|
|
271
258
|
write(id: string, hexData: string): Promise<void>;
|
|
272
259
|
/** Retire a renderer's handler without stopping a process-wide native manager. */
|
|
@@ -310,21 +297,10 @@ interface ThirdPartyBleSupportHandle {
|
|
|
310
297
|
stop?(): void;
|
|
311
298
|
}) => void): Promise<void>;
|
|
312
299
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Electron IPC keeps only an Error's message; as data, a `createHwkError`'s code and params
|
|
315
|
-
* survive. Only those cross, so the renderer rebuilds exactly what the host threw.
|
|
316
|
-
*/
|
|
317
|
-
declare function createThirdPartyBleIpcErrorResponse(error: unknown): ThirdPartyBleIpcErrorResponse;
|
|
318
|
-
/**
|
|
319
|
-
* Handlers registered through this resolve failures as `ThirdPartyBleIpcErrorResponse`.
|
|
320
|
-
* Wrap the `ipcMain` that registers with Electron so inner wrappers still see throws, and
|
|
321
|
-
* pair it with a preload that rethrows `response.error`.
|
|
322
|
-
*/
|
|
323
|
-
declare function withThirdPartyBleIpcErrors(ipcMain: IpcMainLike): IpcMainLike;
|
|
324
300
|
/**
|
|
325
301
|
* Wire a `NobleBleHandler` to Electron IPC once `BrowserWindow` is ready. Call dispose()
|
|
326
302
|
* when retiring a renderer and disposeForAppQuit() before Node teardown.
|
|
327
303
|
*/
|
|
328
304
|
declare function initThirdPartyBleSupport(webContents: WebContentsLike, options?: InitThirdPartyBleSupportOptions): ThirdPartyBleSupportHandle;
|
|
329
305
|
|
|
330
|
-
export { type BleDebugLogEntry, type BleDebugLogLevel, type BleDebugLogger, DEFAULT_THIRD_PARTY_BLE_VENDORS, type InitThirdPartyBleSupportOptions, type IpcMainLike, NobleBleHandler, type NobleBleHandlerOptions, type ThirdPartyBleApi, type ThirdPartyBleAvailability, type ThirdPartyBleDeviceInfo,
|
|
306
|
+
export { type BleDebugLogEntry, type BleDebugLogLevel, type BleDebugLogger, DEFAULT_THIRD_PARTY_BLE_VENDORS, type InitThirdPartyBleSupportOptions, type IpcMainLike, NobleBleHandler, type NobleBleHandlerOptions, type ThirdPartyBleApi, type ThirdPartyBleAvailability, type ThirdPartyBleDeviceInfo, type ThirdPartyBleSupportHandle, type ThirdPartyBleVendorProfile, initThirdPartyBleSupport, redactBleDebugLogData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ElectronBleConnectOptions, ElectronBleScanOptions } from '@onekeyfe/hwk-adapter-core';
|
|
2
|
-
|
|
3
|
-
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_IPC_ERROR_TYPE, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, ThirdPartyBleChannel, isThirdPartyBleIpcErrorResponse } from './constants.js';
|
|
2
|
+
export { THIRD_PARTY_BLE_CHANNELS, THIRD_PARTY_BLE_DEVICE_TTL_MS, THIRD_PARTY_BLE_POWER_ON_TIMEOUT_MS, THIRD_PARTY_BLE_SCAN_DURATION_MS, THIRD_PARTY_BLE_SCAN_IDLE_STOP_MS, ThirdPartyBleChannel } from './constants.js';
|
|
4
3
|
|
|
5
4
|
type BleDebugLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
6
5
|
type BleDebugLogEntry = {
|
|
@@ -159,8 +158,6 @@ interface NobleBleHandlerOptions {
|
|
|
159
158
|
nobleFactory?: NobleFactory;
|
|
160
159
|
/** Override the overall connect timeout (tests only; defaults to 31s). */
|
|
161
160
|
connectTimeoutMs?: number;
|
|
162
|
-
/** Override the subscribe timeout (tests only; defaults to 60s). */
|
|
163
|
-
subscribeTimeoutMs?: number;
|
|
164
161
|
logger?: BleDebugLogger;
|
|
165
162
|
/**
|
|
166
163
|
* Vendors served over IPC, keyed by the `vendor` the renderer sends. Replaces the default map
|
|
@@ -173,13 +170,10 @@ declare class NobleBleHandler {
|
|
|
173
170
|
private _noble;
|
|
174
171
|
private readonly _factory;
|
|
175
172
|
private readonly _connectTimeoutMs;
|
|
176
|
-
private readonly _subscribeTimeoutMs;
|
|
177
173
|
private readonly _logger?;
|
|
178
174
|
private readonly _vendors;
|
|
179
175
|
private readonly _discovered;
|
|
180
176
|
private readonly _lastSeen;
|
|
181
|
-
private readonly _advertisedUuids;
|
|
182
|
-
private readonly _keptByMemory;
|
|
183
177
|
private readonly _connected;
|
|
184
178
|
private _discoverHandler?;
|
|
185
179
|
private _scanning;
|
|
@@ -209,7 +203,6 @@ declare class NobleBleHandler {
|
|
|
209
203
|
* packet, and a Safe 7 ADV carries only its name (UUID is in the scan response).
|
|
210
204
|
*/
|
|
211
205
|
scan(options?: ElectronBleScanOptions): Promise<ThirdPartyBleDeviceInfo[]>;
|
|
212
|
-
private _rememberServiceUuids;
|
|
213
206
|
/**
|
|
214
207
|
* In-range devices matching the caller, minus TTL-expired ones. `_discovered`
|
|
215
208
|
* is only a cache; a missing device can still be reached by `_directConnect`.
|
|
@@ -261,12 +254,6 @@ declare class NobleBleHandler {
|
|
|
261
254
|
private _connectInner;
|
|
262
255
|
disconnect(id: string): Promise<void>;
|
|
263
256
|
subscribe(id: string): Promise<void>;
|
|
264
|
-
private _withSubscribeTimeout;
|
|
265
|
-
/**
|
|
266
|
-
* noble-win reports a failed subscribe only as `status: <AsyncStatus>`. Error (3) on a live
|
|
267
|
-
* link is a device refusing the bond Windows holds; a link already gone fails it the same way.
|
|
268
|
-
*/
|
|
269
|
-
private _toSubscribeError;
|
|
270
257
|
unsubscribe(id: string): Promise<void>;
|
|
271
258
|
write(id: string, hexData: string): Promise<void>;
|
|
272
259
|
/** Retire a renderer's handler without stopping a process-wide native manager. */
|
|
@@ -310,21 +297,10 @@ interface ThirdPartyBleSupportHandle {
|
|
|
310
297
|
stop?(): void;
|
|
311
298
|
}) => void): Promise<void>;
|
|
312
299
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Electron IPC keeps only an Error's message; as data, a `createHwkError`'s code and params
|
|
315
|
-
* survive. Only those cross, so the renderer rebuilds exactly what the host threw.
|
|
316
|
-
*/
|
|
317
|
-
declare function createThirdPartyBleIpcErrorResponse(error: unknown): ThirdPartyBleIpcErrorResponse;
|
|
318
|
-
/**
|
|
319
|
-
* Handlers registered through this resolve failures as `ThirdPartyBleIpcErrorResponse`.
|
|
320
|
-
* Wrap the `ipcMain` that registers with Electron so inner wrappers still see throws, and
|
|
321
|
-
* pair it with a preload that rethrows `response.error`.
|
|
322
|
-
*/
|
|
323
|
-
declare function withThirdPartyBleIpcErrors(ipcMain: IpcMainLike): IpcMainLike;
|
|
324
300
|
/**
|
|
325
301
|
* Wire a `NobleBleHandler` to Electron IPC once `BrowserWindow` is ready. Call dispose()
|
|
326
302
|
* when retiring a renderer and disposeForAppQuit() before Node teardown.
|
|
327
303
|
*/
|
|
328
304
|
declare function initThirdPartyBleSupport(webContents: WebContentsLike, options?: InitThirdPartyBleSupportOptions): ThirdPartyBleSupportHandle;
|
|
329
305
|
|
|
330
|
-
export { type BleDebugLogEntry, type BleDebugLogLevel, type BleDebugLogger, DEFAULT_THIRD_PARTY_BLE_VENDORS, type InitThirdPartyBleSupportOptions, type IpcMainLike, NobleBleHandler, type NobleBleHandlerOptions, type ThirdPartyBleApi, type ThirdPartyBleAvailability, type ThirdPartyBleDeviceInfo,
|
|
306
|
+
export { type BleDebugLogEntry, type BleDebugLogLevel, type BleDebugLogger, DEFAULT_THIRD_PARTY_BLE_VENDORS, type InitThirdPartyBleSupportOptions, type IpcMainLike, NobleBleHandler, type NobleBleHandlerOptions, type ThirdPartyBleApi, type ThirdPartyBleAvailability, type ThirdPartyBleDeviceInfo, type ThirdPartyBleSupportHandle, type ThirdPartyBleVendorProfile, initThirdPartyBleSupport, redactBleDebugLogData };
|