@onekeyfe/hd-transport-react-native 1.2.8-alpha.117 → 1.2.8-alpha.119

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as transport from '@onekeyfe/hd-transport';
2
- import transport__default, { ProtocolType, OneKeyDeviceInfoBase, TransportCallOptions } from '@onekeyfe/hd-transport';
2
+ import transport__default, { ProtocolType, OneKeyDeviceInfoBase, OneKeyMobileDeviceInfo, TransportCallOptions } from '@onekeyfe/hd-transport';
3
3
  import { Device, Characteristic, Subscription, BleManager } from 'react-native-ble-plx';
4
4
  import { Deferred } from '@onekeyfe/hd-shared';
5
5
  import EventEmitter from 'events';
@@ -67,24 +67,12 @@ declare const BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD = 2;
67
67
  type ProtocolV2BleTuning = {
68
68
  iosPacketLength?: number;
69
69
  androidPacketLength?: number;
70
- /**
71
- * Write each multi-packet high-throughput frame with one native call when the native
72
- * BLE module supports it. Defaults to true; false keeps the per-packet JS write loop.
73
- */
74
- nativeFrameWrite?: boolean;
75
- /**
76
- * Android CONNECTION_PRIORITY_HIGH around Protocol V2 high-throughput calls. 'auto' (the
77
- * default) requests it below Android 17 only; true or false forces it on every version.
78
- */
79
- androidHighConnectionPriority?: boolean | 'auto';
80
70
  };
81
71
  declare function configureProtocolV2BleTuning(tuning?: ProtocolV2BleTuning): void;
82
72
  declare function resetProtocolV2BleTuning(): void;
83
73
  declare function getProtocolV2BleTuning(): {
84
74
  iosPacketLength: number;
85
75
  androidPacketLength: number;
86
- nativeFrameWrite: boolean;
87
- androidHighConnectionPriority: boolean | "auto";
88
76
  };
89
77
  /**
90
78
  * With no cached GATT table the stack runs its own discovery (up to ~8s) before the MTU
@@ -122,7 +110,7 @@ declare const PROTOCOL_REPROBE_FALLBACK_ATTEMPTS = 3;
122
110
  /** BLE setup timeouts since the last successful setup before the manager is recreated. */
123
111
  declare const BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD = 2;
124
112
  declare const BLE_SETUP_WEDGED_MESSAGE = "BLE setup wedged repeatedly";
125
- type IOneKeyDevice = OneKeyDeviceInfoBase & Device;
113
+ type IOneKeyDevice = OneKeyDeviceInfoBase & Device & Pick<OneKeyMobileDeviceInfo, 'bleColorCode'>;
126
114
  declare class ReactNativeBleTransport {
127
115
  blePlxManager: BleManager | undefined;
128
116
  _messages: ReturnType<typeof transport__default.parseConfigure> | undefined;
@@ -170,10 +158,6 @@ declare class ReactNativeBleTransport {
170
158
  private protocolV2HighVolumeLogSignatures;
171
159
  private androidHighPriorityDevices;
172
160
  private androidPriorityResetTimers;
173
- /** In-flight native frame write per device; Protocol V2 writes are serialized per device. */
174
- private protocolV2FrameWrites;
175
- private protocolV2FrameWriteCounter;
176
- private protocolV2FileWritePerfs;
177
161
  private nextMonitorToken;
178
162
  /** Serializes transport lifecycle changes for the same physical device. */
179
163
  private lifecycleOperations;
@@ -275,21 +259,6 @@ declare class ReactNativeBleTransport {
275
259
  private readProtocolV2Frame;
276
260
  private writeProtocolV2Packet;
277
261
  private writeProtocolV2Frame;
278
- /**
279
- * The native frame write only replaces the per-packet loop where its JS<->native round trips
280
- * dominate: multi-packet (checked by the caller) high-throughput frames written without response.
281
- */
282
- private resolveProtocolV2NativeFrameWriter;
283
- /**
284
- * Writes one frame with a single native call that sends its packets in order without response.
285
- * Nothing here retries it: a resend could duplicate bytes the device already received. The
286
- * native transaction is cancelled on abort, watchdog expiry, generation change and link
287
- * teardown so the native side stops writing a frame nobody waits for any more.
288
- */
289
- private writeProtocolV2NativeFrame;
290
- /** Stops the native frame write in flight on `uuid`, optionally only one of `generation`. */
291
- private cancelProtocolV2FrameWrite;
292
- private cancelNativeTransaction;
293
262
  private callProtocolV2;
294
263
  private ensureProtocolV2HighThroughputMtu;
295
264
  private clearAndroidPriorityResetTimer;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sour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AsB;IAU9B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,sBAAsB;YAShB,mBAAmB;YAiBnB,qBAAqB;YA8DrB,oBAAoB;YAgCpB,cAAc;YAmFd,iCAAiC;IAsB/C,OAAO,CAAC,8BAA8B;YAQxB,mCAAmC;IAsBjD,OAAO,CAAC,yCAAyC;YAanC,gCAAgC;IAoB9C,OAAO,CAAC,uBAAuB;IAmD/B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
package/dist/index.js CHANGED
@@ -400,8 +400,6 @@ const ANDROID_NOTIFY_READY_DELAY_MS = 300;
400
400
  const DEFAULT_PROTOCOL_V2_BLE_TUNING = {
401
401
  iosPacketLength: IOS_PROTOCOL_V2_PACKET_LENGTH,
402
402
  androidPacketLength: ANDROID_PROTOCOL_V2_PACKET_LENGTH,
403
- nativeFrameWrite: true,
404
- androidHighConnectionPriority: 'auto',
405
403
  };
406
404
  let protocolV2BleTuning = Object.assign({}, DEFAULT_PROTOCOL_V2_BLE_TUNING);
407
405
  const normalizePositiveInteger = (value, fallback) => {
@@ -414,13 +412,6 @@ function configureProtocolV2BleTuning(tuning = {}) {
414
412
  protocolV2BleTuning = {
415
413
  iosPacketLength: normalizePositiveInteger(tuning.iosPacketLength, protocolV2BleTuning.iosPacketLength),
416
414
  androidPacketLength: normalizePositiveInteger(tuning.androidPacketLength, protocolV2BleTuning.androidPacketLength),
417
- nativeFrameWrite: typeof tuning.nativeFrameWrite === 'boolean'
418
- ? tuning.nativeFrameWrite
419
- : protocolV2BleTuning.nativeFrameWrite,
420
- androidHighConnectionPriority: typeof tuning.androidHighConnectionPriority === 'boolean' ||
421
- tuning.androidHighConnectionPriority === 'auto'
422
- ? tuning.androidHighConnectionPriority
423
- : protocolV2BleTuning.androidHighConnectionPriority,
424
415
  };
425
416
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] BLE tuning configured', protocolV2BleTuning);
426
417
  }
@@ -431,107 +422,33 @@ function resetProtocolV2BleTuning() {
431
422
  function getProtocolV2BleTuning() {
432
423
  return Object.assign({}, protocolV2BleTuning);
433
424
  }
434
- const getProtocolV2NativeFrameWriter = (manager) => {
435
- var _a;
436
- const candidate = manager;
437
- if (!candidate || typeof candidate.writeCharacteristicWithoutResponseFrame !== 'function') {
438
- return undefined;
439
- }
440
- try {
441
- return ((_a = candidate.isWriteCharacteristicWithoutResponseFrameSupported) === null || _a === void 0 ? void 0 : _a.call(candidate)) === true
442
- ? candidate
443
- : undefined;
444
- }
445
- catch (_b) {
446
- return undefined;
447
- }
448
- };
449
- const getNativeBleErrorReason = (error) => {
450
- const { reason, message } = (error !== null && error !== void 0 ? error : {});
451
- if (typeof reason === 'string' && reason)
452
- return reason;
453
- return typeof message === 'string' && message ? message : undefined;
454
- };
455
- const nowMs = () => typeof performance !== 'undefined' && typeof performance.now === 'function'
456
- ? performance.now()
457
- : Date.now();
458
- const roundMs = (ms) => Math.round(ms * 10) / 10;
459
- const FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS = [1, 2, 3, 5, 8];
460
- const createDurationStats = () => {
461
- let total = 0;
462
- let count = 0;
463
- let max = 0;
464
- return {
465
- add(ms) {
466
- total += ms;
467
- count += 1;
468
- max = Math.max(max, ms);
469
- },
470
- summarize: () => ({
471
- total: roundMs(total),
472
- avg: count ? roundMs(total / count) : 0,
473
- max: roundMs(max),
474
- }),
475
- };
476
- };
477
- const createProtocolV2FileWritePerf = () => {
478
- const startedAt = nowMs();
479
- let nativeFrames = 0;
480
- let frames = 0;
481
- let packets = 0;
482
- let frameBytes = 0;
483
- const write = createDurationStats();
484
- const readWait = createDurationStats();
485
- const packet = createDurationStats();
486
- const packetHistogram = FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS.map(() => 0).concat(0);
487
- return {
488
- startFrame(mode) {
489
- if (mode === 'native-frame')
490
- nativeFrames += 1;
491
- },
492
- recordFrame(bytes, framePackets, elapsedMs) {
493
- frames += 1;
494
- packets += framePackets;
495
- frameBytes += bytes;
496
- write.add(elapsedMs);
497
- },
498
- recordPacket(elapsedMs) {
499
- packet.add(elapsedMs);
500
- const bucket = FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS.findIndex(bound => elapsedMs < bound);
501
- packetHistogram[bucket < 0 ? FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS.length : bucket] += 1;
502
- },
503
- recordReadWait(elapsedMs) {
504
- readWait.add(elapsedMs);
505
- },
506
- summarize(ok) {
507
- const mode = nativeFrames > 0 ? 'native-frame' : 'per-packet';
508
- const packetStats = packet.summarize();
509
- return Object.assign({ platform: reactNative.Platform.OS, mode,
510
- ok,
511
- frames,
512
- packets,
513
- frameBytes, elapsedMs: roundMs(nowMs() - startedAt), writeMs: write.summarize(), readWaitMs: readWait.summarize() }, (mode === 'per-packet'
514
- ? { packetMs: { avg: packetStats.avg, max: packetStats.max, hist: [...packetHistogram] } }
515
- : {}));
516
- },
517
- };
518
- };
519
425
  function getDeviceDisplayName(device) {
520
426
  return (device === null || device === void 0 ? void 0 : device.name) || (device === null || device === void 0 ? void 0 : device.localName) || null;
521
427
  }
428
+ const bleColorCodesById = new Map();
429
+ function getManufacturerDataLength(device) {
430
+ return (device === null || device === void 0 ? void 0 : device.manufacturerData) ? buffer.Buffer.from(device.manufacturerData, 'base64').length : 0;
431
+ }
432
+ function rememberBleColorCode(device) {
433
+ if (!(device === null || device === void 0 ? void 0 : device.id) || !device.manufacturerData)
434
+ return;
435
+ const colorCode = hdShared.parseOnekeyBleColorCode(buffer.Buffer.from(device.manufacturerData, 'base64'));
436
+ const key = device.id.toLowerCase();
437
+ if (colorCode && bleColorCodesById.get(key) !== colorCode) {
438
+ bleColorCodesById.set(key, colorCode);
439
+ Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] BLE color code', {
440
+ deviceId: device.id,
441
+ bleColorCode: colorCode,
442
+ });
443
+ }
444
+ }
445
+ function withBleColorCode(device) {
446
+ const bleColorCode = bleColorCodesById.get(device.id.toLowerCase());
447
+ return bleColorCode ? Object.assign(Object.assign({}, device), { bleColorCode }) : device;
448
+ }
522
449
  const IOS_REQUEST_MTU = 247;
523
450
  const ANDROID_REQUEST_MTU = 517;
524
451
  const ANDROID_HIGH_PRIORITY_IDLE_MS = 1000;
525
- const ANDROID_HIGH_PRIORITY_PERIPHERAL_LATENCY_API_LEVEL = 37;
526
- const shouldRequestAndroidHighConnectionPriority = () => {
527
- if (reactNative.Platform.OS !== 'android')
528
- return false;
529
- const { androidHighConnectionPriority } = protocolV2BleTuning;
530
- if (typeof androidHighConnectionPriority === 'boolean')
531
- return androidHighConnectionPriority;
532
- const apiLevel = Number(reactNative.Platform.Version);
533
- return !(Number.isFinite(apiLevel) && apiLevel >= ANDROID_HIGH_PRIORITY_PERIPHERAL_LATENCY_API_LEVEL);
534
- };
535
452
  const getRequestedBleMtu = () => reactNative.Platform.OS === 'android' ? ANDROID_REQUEST_MTU : IOS_REQUEST_MTU;
536
453
  const BLE_NATIVE_CONNECT_TIMEOUT_MS = 3000;
537
454
  const BLE_MTU_REQUEST_TIMEOUT_MS = BLE_NATIVE_CONNECT_TIMEOUT_MS;
@@ -724,9 +641,6 @@ class ReactNativeBleTransport {
724
641
  this.protocolV2HighVolumeLogSignatures = new Map();
725
642
  this.androidHighPriorityDevices = new Set();
726
643
  this.androidPriorityResetTimers = new Map();
727
- this.protocolV2FrameWrites = new Map();
728
- this.protocolV2FrameWriteCounter = 0;
729
- this.protocolV2FileWritePerfs = new Map();
730
644
  this.nextMonitorToken = 1;
731
645
  this.lifecycleOperations = new Map();
732
646
  this.scanCleanups = new Set();
@@ -988,7 +902,7 @@ class ReactNativeBleTransport {
988
902
  if (error)
989
903
  reject(error);
990
904
  else
991
- resolve(deviceList);
905
+ resolve(deviceList.map(withBleColorCode));
992
906
  });
993
907
  return scanCleanup;
994
908
  };
@@ -1028,6 +942,7 @@ class ReactNativeBleTransport {
1028
942
  }
1029
943
  return;
1030
944
  }
945
+ rememberBleColorCode(device);
1031
946
  const displayName = getDeviceDisplayName(device);
1032
947
  const isUnnamedIOSPeripheral = reactNative.Platform.OS === 'ios' && !(displayName === null || displayName === void 0 ? void 0 : displayName.trim());
1033
948
  const isOneKey = !isUnnamedIOSPeripheral &&
@@ -1077,6 +992,8 @@ class ReactNativeBleTransport {
1077
992
  deviceId: device.id,
1078
993
  name: displayName,
1079
994
  serviceUUIDs: device.serviceUUIDs,
995
+ manufacturerDataLength: getManufacturerDataLength(device),
996
+ bleColorCode: bleColorCodesById.get(device.id.toLowerCase()),
1080
997
  });
1081
998
  }
1082
999
  };
@@ -1525,7 +1442,6 @@ class ReactNativeBleTransport {
1525
1442
  }
1526
1443
  releaseUnlocked(uuid, onclose = false) {
1527
1444
  return __awaiter(this, void 0, void 0, function* () {
1528
- this.cancelProtocolV2FrameWrite(uuid, new Error('React Native BLE transport released'));
1529
1445
  yield this.protocolV2Links.invalidateLink(uuid, 'React Native BLE transport released');
1530
1446
  return this.releaseNative(uuid, onclose);
1531
1447
  });
@@ -1533,7 +1449,6 @@ class ReactNativeBleTransport {
1533
1449
  releaseNative(uuid, onclose = false) {
1534
1450
  var _a, _b, _c, _d, _e;
1535
1451
  return __awaiter(this, void 0, void 0, function* () {
1536
- this.cancelProtocolV2FrameWrite(uuid, new Error('React Native BLE transport released'));
1537
1452
  const transport = transportCache[uuid];
1538
1453
  const manager = this.blePlxManager;
1539
1454
  if (this.runPromise && this.runPromiseDeviceId === uuid) {
@@ -1860,9 +1775,6 @@ class ReactNativeBleTransport {
1860
1775
  disconnectUnlocked(session) {
1861
1776
  var _a, _b, _c;
1862
1777
  return __awaiter(this, void 0, void 0, function* () {
1863
- this.clearAndroidPriorityResetTimer(session);
1864
- this.androidHighPriorityDevices.delete(session);
1865
- this.cancelProtocolV2FrameWrite(session, new Error('React Native BLE transport disconnected'));
1866
1778
  yield this.protocolV2Links.invalidateLink(session, 'React Native BLE transport disconnected');
1867
1779
  const transport = transportCache[session];
1868
1780
  const manager = this.blePlxManager;
@@ -2232,7 +2144,6 @@ class ReactNativeBleTransport {
2232
2144
  Log === null || Log === void 0 ? void 0 : Log.error('[ReactNativeBleTransport] BLE write timed out, tearing down link:', uuid, {
2233
2145
  consecutiveWriteTimeouts: timeouts,
2234
2146
  });
2235
- this.cancelProtocolV2FrameWrite(uuid, hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, `BLE write timeout after ${BLE_WRITE_PACKET_TIMEOUT_MS}ms`));
2236
2147
  const wedged = transportCache[uuid];
2237
2148
  this.disconnect(uuid).catch(error => {
2238
2149
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] wedged link teardown failed (ignored):', error);
@@ -2256,7 +2167,6 @@ class ReactNativeBleTransport {
2256
2167
  const manager = this.blePlxManager;
2257
2168
  this.blePlxManager = undefined;
2258
2169
  const reason = 'React Native BLE manager reset';
2259
- Array.from(this.protocolV2FrameWrites.keys()).forEach(uuid => this.cancelProtocolV2FrameWrite(uuid, new Error(reason)));
2260
2170
  Object.entries(transportCache).forEach(([uuid, cachedTransport]) => {
2261
2171
  var _a, _b, _c, _d;
2262
2172
  try {
@@ -2646,163 +2556,17 @@ class ReactNativeBleTransport {
2646
2556
  androidPacketLength: tuning.androidPacketLength,
2647
2557
  mtu: transport$1.mtuSize,
2648
2558
  });
2649
- const perf = context.messageName === 'FilesystemFileWrite'
2650
- ? this.protocolV2FileWritePerfs.get(uuid)
2651
- : undefined;
2652
- const startedAt = perf ? nowMs() : 0;
2653
- const nativeFrameWriter = frame.length > packetCapacity
2654
- ? this.resolveProtocolV2NativeFrameWriter(transport$1, context, tuning.nativeFrameWrite)
2655
- : undefined;
2656
- perf === null || perf === void 0 ? void 0 : perf.startFrame(nativeFrameWriter ? 'native-frame' : 'per-packet');
2657
- if (nativeFrameWriter) {
2658
- yield this.writeProtocolV2NativeFrame(uuid, transport$1, nativeFrameWriter, frame, packetCapacity, context, assertCurrentGeneration);
2659
- }
2660
- else {
2661
- yield transport.writeProtocolV2BleFrame({
2662
- frame,
2663
- packetCapacity,
2664
- assertActive: assertCurrentGeneration,
2665
- signal: context.signal,
2666
- abortMessage: `Protocol V2 BLE write aborted for ${context.messageName}`,
2667
- wait: delay,
2668
- writePacket: (packet) => __awaiter(this, void 0, void 0, function* () {
2669
- const packetStartedAt = perf ? nowMs() : 0;
2670
- yield this.writeProtocolV2Packet(uuid, transport$1, buffer.Buffer.from(packet).toString('base64'), context, assertCurrentGeneration);
2671
- perf === null || perf === void 0 ? void 0 : perf.recordPacket(nowMs() - packetStartedAt);
2672
- }),
2673
- });
2674
- }
2675
- perf === null || perf === void 0 ? void 0 : perf.recordFrame(frame.length, Math.ceil(frame.length / packetCapacity), nowMs() - startedAt);
2676
- });
2677
- }
2678
- resolveProtocolV2NativeFrameWriter(transport, context, nativeFrameWrite) {
2679
- if (!context.highThroughput || nativeFrameWrite === false)
2680
- return undefined;
2681
- if (shouldWriteProtocolV2WithResponse({
2682
- platform: reactNative.Platform.OS,
2683
- highThroughput: context.highThroughput,
2684
- requestedWithResponse: context.writeWithResponse,
2685
- characteristic: transport.writeCharacteristic,
2686
- })) {
2687
- return undefined;
2688
- }
2689
- if (typeof transport.writeCharacteristic.id !== 'number')
2690
- return undefined;
2691
- return getProtocolV2NativeFrameWriter(this.blePlxManager);
2692
- }
2693
- writeProtocolV2NativeFrame(uuid, transport, manager, frame, packetCapacity, context, assertCurrentGeneration) {
2694
- return __awaiter(this, void 0, void 0, function* () {
2695
- const abortMessage = `Protocol V2 BLE write aborted for ${context.messageName}`;
2696
- assertCurrentGeneration();
2697
- if (context.signal.aborted) {
2698
- throw new Error(abortMessage);
2699
- }
2700
- this.protocolV2FrameWriteCounter += 1;
2701
- const transactionId = `${uuid}:v2frame:${context.generation}:${this.protocolV2FrameWriteCounter}`;
2702
- let cancelError;
2703
- let rejectCancelled = () => undefined;
2704
- const cancelled = new Promise((_, reject) => {
2705
- rejectCancelled = reject;
2559
+ yield transport.writeProtocolV2BleFrame({
2560
+ frame,
2561
+ packetCapacity,
2562
+ assertActive: assertCurrentGeneration,
2563
+ signal: context.signal,
2564
+ abortMessage: `Protocol V2 BLE write aborted for ${context.messageName}`,
2565
+ wait: delay,
2566
+ writePacket: packet => this.writeProtocolV2Packet(uuid, transport$1, buffer.Buffer.from(packet).toString('base64'), context, assertCurrentGeneration),
2706
2567
  });
2707
- const active = {
2708
- transactionId,
2709
- generation: context.generation,
2710
- cancel: error => {
2711
- if (cancelError)
2712
- return;
2713
- cancelError = error;
2714
- if (this.protocolV2FrameWrites.get(uuid) === active) {
2715
- this.protocolV2FrameWrites.delete(uuid);
2716
- }
2717
- rejectCancelled(error);
2718
- this.cancelNativeTransaction(manager, transactionId);
2719
- },
2720
- };
2721
- const isCurrentOwner = () => {
2722
- try {
2723
- assertCurrentGeneration();
2724
- return !context.signal.aborted;
2725
- }
2726
- catch (_a) {
2727
- return false;
2728
- }
2729
- };
2730
- const onAbort = () => active.cancel(new Error(abortMessage));
2731
- let timer;
2732
- let completed = false;
2733
- let nativeError;
2734
- try {
2735
- const nativeWrite = Promise.resolve(manager.writeCharacteristicWithoutResponseFrame(transport.writeCharacteristic.id, buffer.Buffer.from(frame).toString('base64'), packetCapacity, transactionId));
2736
- nativeWrite.catch(() => undefined);
2737
- this.protocolV2FrameWrites.set(uuid, active);
2738
- context.signal.addEventListener('abort', onAbort);
2739
- yield Promise.race([
2740
- nativeWrite,
2741
- cancelled,
2742
- new Promise((_, reject) => {
2743
- timer = setTimeout(() => {
2744
- const owner = isCurrentOwner();
2745
- const error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, `BLE write timeout after ${BLE_WRITE_PACKET_TIMEOUT_MS}ms`);
2746
- active.cancel(error);
2747
- reject(error);
2748
- if (owner) {
2749
- this.tearDownWedgedLink(uuid);
2750
- }
2751
- else {
2752
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] stale BLE frame write timed out, link kept');
2753
- }
2754
- }, BLE_WRITE_PACKET_TIMEOUT_MS);
2755
- }),
2756
- ]);
2757
- completed = true;
2758
- }
2759
- catch (error) {
2760
- nativeError = error;
2761
- }
2762
- finally {
2763
- if (timer)
2764
- clearTimeout(timer);
2765
- context.signal.removeEventListener('abort', onAbort);
2766
- }
2767
- if (completed) {
2768
- this.writeTimeoutCounts.delete(uuid);
2769
- try {
2770
- assertCurrentGeneration();
2771
- }
2772
- catch (error) {
2773
- active.cancel(error instanceof Error ? error : new Error(String(error)));
2774
- }
2775
- }
2776
- if (this.protocolV2FrameWrites.get(uuid) === active) {
2777
- this.protocolV2FrameWrites.delete(uuid);
2778
- }
2779
- if (cancelError)
2780
- throw cancelError;
2781
- if (completed)
2782
- return;
2783
- if (isNativeBleDisconnectError(nativeError)) {
2784
- throw toBleDisconnectHardwareError(nativeError);
2785
- }
2786
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, getNativeBleErrorReason(nativeError));
2787
2568
  });
2788
2569
  }
2789
- cancelProtocolV2FrameWrite(uuid, error, generation) {
2790
- const active = this.protocolV2FrameWrites.get(uuid);
2791
- if (!active || (generation !== undefined && active.generation !== generation))
2792
- return;
2793
- active.cancel(error);
2794
- }
2795
- cancelNativeTransaction(manager, transactionId) {
2796
- const logFailure = (error) => Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Protocol V2 frame write cancellation failed', {
2797
- error: error instanceof Error ? error.message : String(error),
2798
- });
2799
- try {
2800
- Promise.resolve(manager.cancelTransaction(transactionId)).catch(logFailure);
2801
- }
2802
- catch (error) {
2803
- logFailure(error);
2804
- }
2805
- }
2806
2570
  callProtocolV2(uuid, name, data, options) {
2807
2571
  var _a;
2808
2572
  return __awaiter(this, void 0, void 0, function* () {
@@ -2841,36 +2605,12 @@ class ReactNativeBleTransport {
2841
2605
  packetCapacity,
2842
2606
  });
2843
2607
  }
2844
- const frameWriteMode = this.resolveProtocolV2NativeFrameWriter(currentTransport, { highThroughput: true, writeWithResponse: options === null || options === void 0 ? void 0 : options.writeWithResponse }, tuning.nativeFrameWrite)
2845
- ? 'native-frame'
2846
- : 'per-packet';
2847
- const frameWriteModeSignature = `frameWriteMode:${frameWriteMode}`;
2848
- if (!loggedSignatures.has(frameWriteModeSignature)) {
2849
- loggedSignatures.add(frameWriteModeSignature);
2850
- this.protocolV2HighVolumeLogSignatures.set(uuid, loggedSignatures);
2851
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Protocol V2 frame write mode', {
2852
- platform: reactNative.Platform.OS,
2853
- mode: frameWriteMode,
2854
- nativeFrameWrite: tuning.nativeFrameWrite,
2855
- nativeFrameWriteSupported: !!getProtocolV2NativeFrameWriter(this.blePlxManager),
2856
- packetCapacity,
2857
- });
2858
- }
2859
2608
  }
2860
2609
  if (highThroughputWrite) {
2861
2610
  yield this.enableAndroidHighConnectionPriority(uuid);
2862
2611
  }
2863
- const fileWritePerf = name === 'FilesystemFileWrite' && (options === null || options === void 0 ? void 0 : options.fileWritePipeline)
2864
- ? createProtocolV2FileWritePerf()
2865
- : undefined;
2866
- if (fileWritePerf) {
2867
- this.protocolV2FileWritePerfs.set(uuid, fileWritePerf);
2868
- }
2869
- let fileWriteOk = false;
2870
2612
  try {
2871
- const response = yield this.protocolV2Links.call(uuid, () => this.createProtocolV2Adapter(uuid), name, data, callOptions);
2872
- fileWriteOk = response.type !== 'Failure';
2873
- return response;
2613
+ return yield this.protocolV2Links.call(uuid, () => this.createProtocolV2Adapter(uuid), name, data, callOptions);
2874
2614
  }
2875
2615
  catch (e) {
2876
2616
  Log === null || Log === void 0 ? void 0 : Log.error('[ReactNativeBleTransport] Protocol V2 call error:', e);
@@ -2888,12 +2628,6 @@ class ReactNativeBleTransport {
2888
2628
  if (highThroughputWrite) {
2889
2629
  this.scheduleAndroidBalancedConnectionPriority(uuid);
2890
2630
  }
2891
- if (fileWritePerf) {
2892
- if (this.protocolV2FileWritePerfs.get(uuid) === fileWritePerf) {
2893
- this.protocolV2FileWritePerfs.delete(uuid);
2894
- }
2895
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] FileWrite perf', fileWritePerf.summarize(fileWriteOk));
2896
- }
2897
2631
  }
2898
2632
  });
2899
2633
  }
@@ -2919,25 +2653,12 @@ class ReactNativeBleTransport {
2919
2653
  }
2920
2654
  }
2921
2655
  enableAndroidHighConnectionPriority(uuid) {
2922
- var _a;
2923
2656
  return __awaiter(this, void 0, void 0, function* () {
2924
2657
  if (reactNative.Platform.OS !== 'android')
2925
2658
  return;
2926
2659
  this.clearAndroidPriorityResetTimer(uuid);
2927
2660
  if (this.androidHighPriorityDevices.has(uuid))
2928
2661
  return;
2929
- if (!shouldRequestAndroidHighConnectionPriority()) {
2930
- const loggedSignatures = (_a = this.protocolV2HighVolumeLogSignatures.get(uuid)) !== null && _a !== void 0 ? _a : new Set();
2931
- if (!loggedSignatures.has('androidPriority:peripheral')) {
2932
- loggedSignatures.add('androidPriority:peripheral');
2933
- this.protocolV2HighVolumeLogSignatures.set(uuid, loggedSignatures);
2934
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Android BLE connection priority left to peripheral', {
2935
- apiLevel: reactNative.Platform.Version,
2936
- setting: protocolV2BleTuning.androidHighConnectionPriority,
2937
- });
2938
- }
2939
- return;
2940
- }
2941
2662
  const transport = transportCache[uuid];
2942
2663
  if (!transport)
2943
2664
  return;
@@ -3007,14 +2728,9 @@ class ReactNativeBleTransport {
3007
2728
  const currentTransport = this.getCachedTransport(uuid);
3008
2729
  yield this.writeProtocolV2Frame(uuid, currentTransport, frame, context, assertCurrentGeneration);
3009
2730
  }),
3010
- readFrame: (context) => __awaiter(this, void 0, void 0, function* () {
2731
+ readFrame: () => __awaiter(this, void 0, void 0, function* () {
3011
2732
  assertCurrentGeneration();
3012
- const perf = (context === null || context === void 0 ? void 0 : context.messageName) === 'FilesystemFileWrite'
3013
- ? this.protocolV2FileWritePerfs.get(uuid)
3014
- : undefined;
3015
- const startedAt = perf ? nowMs() : 0;
3016
2733
  const rxFrame = yield this.readProtocolV2Frame(uuid);
3017
- perf === null || perf === void 0 ? void 0 : perf.recordReadWait(nowMs() - startedAt);
3018
2734
  if (!(rxFrame instanceof Uint8Array)) {
3019
2735
  throw new Error('Protocol V2 response is not Uint8Array');
3020
2736
  }
@@ -3022,7 +2738,6 @@ class ReactNativeBleTransport {
3022
2738
  }),
3023
2739
  reset: (reason) => {
3024
2740
  var _a;
3025
- this.cancelProtocolV2FrameWrite(uuid, new Error(reason), generation);
3026
2741
  if (this.monitorTokens.get(uuid) !== generation)
3027
2742
  return;
3028
2743
  (_a = this.protocolV2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-react-native",
3
- "version": "1.2.8-alpha.117",
3
+ "version": "1.2.8-alpha.119",
4
4
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,11 +20,11 @@
20
20
  "lint:fix": "eslint . --fix"
21
21
  },
22
22
  "dependencies": {
23
- "@onekeyfe/hd-core": "1.2.8-alpha.117",
24
- "@onekeyfe/hd-shared": "1.2.8-alpha.117",
25
- "@onekeyfe/hd-transport": "1.2.8-alpha.117",
23
+ "@onekeyfe/hd-core": "1.2.8-alpha.119",
24
+ "@onekeyfe/hd-shared": "1.2.8-alpha.119",
25
+ "@onekeyfe/hd-transport": "1.2.8-alpha.119",
26
26
  "@onekeyfe/react-native-ble-utils": "0.1.9",
27
27
  "react-native-ble-plx": "3.5.1"
28
28
  },
29
- "gitHead": "610f1a979c682817acf9b4d195365dc5ed806138"
29
+ "gitHead": "26953c0d533e9a05980abc8ea43e7bbd45ead861"
30
30
  }