@onekeyfe/hd-transport-electron 1.2.0-alpha.17 → 1.2.0-alpha.171

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/ble-ops.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import type { Characteristic } from '@stoprocent/noble';
3
3
  import type { Logger } from './types/noble-extended';
4
+ type BleCallback = (error?: Error) => void;
5
+ export declare function runBleCallbackOperation(operation: (callback: BleCallback) => void, options: {
6
+ timeoutMs: number;
7
+ timeoutBehavior: 'resolve' | 'reject';
8
+ }): Promise<void>;
4
9
  export interface SoftRefreshParams {
5
10
  deviceId: string;
6
11
  notifyCharacteristic: Characteristic | null | undefined;
@@ -11,4 +16,5 @@ export interface SoftRefreshParams {
11
16
  logger: Logger | null;
12
17
  }
13
18
  export declare function softRefreshSubscription(params: SoftRefreshParams): Promise<void>;
19
+ export {};
14
20
  //# sourceMappingURL=ble-ops.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ble-ops.d.ts","sourceRoot":"","sources":["../src/ble-ops.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;IACxD,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,GAAG,MAAM,CAAC,CAAC;IAC9E,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CtF"}
1
+ {"version":3,"file":"ble-ops.d.ts","sourceRoot":"","sources":["../src/ble-ops.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,KAAK,WAAW,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAE3C,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,EAC1C,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,GACpE,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;IACxD,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,GAAG,MAAM,CAAC,CAAC;IAC9E,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CtF"}
@@ -0,0 +1,2 @@
1
+ export declare function resolveBlePacketCapacity(mtu: number | null | undefined, maximumPacketCapacity: number, fallbackPacketCapacity: number): number;
2
+ //# sourceMappingURL=ble-packet-capacity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ble-packet-capacity.d.ts","sourceRoot":"","sources":["../src/ble-packet-capacity.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,qBAAqB,EAAE,MAAM,EAC7B,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAMR"}
@@ -32,7 +32,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
32
32
 
33
33
  function initNobleBleSupport(webContents) {
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
- const { setupNobleBleHandlers } = yield Promise.resolve().then(function () { return require('./noble-ble-handler-16791965.js'); });
35
+ const { setupNobleBleHandlers } = yield Promise.resolve().then(function () { return require('./noble-ble-handler-e8b87173.js'); });
36
36
  setupNobleBleHandlers(webContents);
37
37
  });
38
38
  }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { WebContents } from 'electron';
2
2
  import { Characteristic, Peripheral } from '@stoprocent/noble';
3
3
  import { OneKeyDeviceInfoBase } from '@onekeyfe/hd-transport';
4
+ import { EBleDisconnectReason } from '@onekeyfe/hd-shared';
4
5
 
5
6
  interface DeviceInfo extends OneKeyDeviceInfoBase {
6
7
  id: string;
7
8
  name: string;
8
9
  state: string;
10
+ mtu?: number;
9
11
  }
10
12
  interface CharacteristicPair {
11
13
  write: Characteristic;
@@ -26,6 +28,14 @@ interface Logger {
26
28
  error(message: string, ...args: any[]): void;
27
29
  }
28
30
 
31
+ /**
32
+ * Desktop API types for Electron preload script
33
+ * These types define the core interface for Noble BLE communication
34
+ */
35
+
36
+ interface NobleBleWriteOptions {
37
+ pacingDelayMs?: number;
38
+ }
29
39
  interface NobleBleAPI {
30
40
  enumerate: () => Promise<{
31
41
  id: string;
@@ -34,16 +44,29 @@ interface NobleBleAPI {
34
44
  getDevice: (uuid: string) => Promise<{
35
45
  id: string;
36
46
  name: string;
47
+ mtu?: number;
37
48
  } | null>;
38
49
  connect: (uuid: string) => Promise<void>;
50
+ release?: (uuid: string, keepSession?: boolean) => Promise<void>;
39
51
  disconnect: (uuid: string) => Promise<void>;
40
52
  subscribe: (uuid: string) => Promise<void>;
41
53
  unsubscribe: (uuid: string) => Promise<void>;
42
- write: (uuid: string, data: string) => Promise<void>;
54
+ write: (uuid: string, data: string, options?: NobleBleWriteOptions) => Promise<void>;
43
55
  onNotification: (callback: (deviceId: string, data: string) => void) => () => void;
56
+ onMtuChanged?: (callback: (device: {
57
+ id: string;
58
+ mtu: number;
59
+ }) => void) => () => void;
60
+ /**
61
+ * Fires whenever a BLE link drops. `reason` distinguishes a real peripheral
62
+ * drop from the main process freeing an idle link on its keep-alive timer;
63
+ * it is optional so an older host bridge that omits it still type-checks
64
+ * (absent is treated as a real drop by consumers).
65
+ */
44
66
  onDeviceDisconnected: (callback: (device: {
45
67
  id: string;
46
68
  name: string;
69
+ reason?: EBleDisconnectReason;
47
70
  }) => void) => () => void;
48
71
  checkAvailability: () => Promise<{
49
72
  available: boolean;
@@ -58,4 +81,4 @@ interface DesktopAPI {
58
81
 
59
82
  declare function initNobleBleSupport(webContents: WebContents): Promise<void>;
60
83
 
61
- export { CharacteristicPair, DesktopAPI, DeviceInfo, Logger, NobleBleAPI, NobleModule, initNobleBleSupport };
84
+ export { CharacteristicPair, DesktopAPI, DeviceInfo, Logger, NobleBleAPI, NobleBleWriteOptions, NobleModule, initNobleBleSupport };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnE,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,WAAW,iBAGjE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEzF,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,WAAW,iBAGjE"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-55699e30.js');
5
+ var index = require('./index-b37d926c.js');
6
6
 
7
7
 
8
8