@onekeyfe/hd-transport-react-native 1.2.8-alpha.1 → 1.2.8-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/index.js CHANGED
@@ -46,76 +46,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46
46
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
47
47
  };
48
48
 
49
- const lastKeyMissingAt = new Map();
50
- const listeners$1 = new Set();
51
- let unsubscribeNative$1;
52
- const normalizeDeviceId$1 = (deviceId) => deviceId.toLowerCase();
53
- const getCapableBleUtils$1 = () => {
54
- if (reactNative.Platform.OS !== 'android')
55
- return undefined;
56
- const bleUtils = BleUtils__default["default"];
57
- if (typeof bleUtils.supportsDeviceKeyMissing !== 'function' ||
58
- typeof bleUtils.onDeviceKeyMissing !== 'function') {
59
- return undefined;
60
- }
61
- return bleUtils.supportsDeviceKeyMissing() ? bleUtils : undefined;
62
- };
63
- const isBleKeyMissingSupported = () => getCapableBleUtils$1() !== undefined;
64
- const startBleKeyMissingTracking = () => {
65
- if (unsubscribeNative$1)
66
- return true;
67
- const bleUtils = getCapableBleUtils$1();
68
- if (!(bleUtils === null || bleUtils === void 0 ? void 0 : bleUtils.onDeviceKeyMissing))
69
- return false;
70
- unsubscribeNative$1 = bleUtils.onDeviceKeyMissing(event => {
71
- if (typeof (event === null || event === void 0 ? void 0 : event.id) !== 'string')
72
- return;
73
- const deviceId = normalizeDeviceId$1(event.id);
74
- lastKeyMissingAt.set(deviceId, Date.now());
75
- listeners$1.forEach(listener => listener(deviceId));
76
- });
77
- return true;
78
- };
79
- const stopBleKeyMissingTracking = () => {
80
- unsubscribeNative$1 === null || unsubscribeNative$1 === void 0 ? void 0 : unsubscribeNative$1();
81
- unsubscribeNative$1 = undefined;
82
- lastKeyMissingAt.clear();
83
- listeners$1.clear();
84
- };
85
- const hasBleKeyMissingSince = (deviceId, sinceMs) => {
86
- const at = lastKeyMissingAt.get(normalizeDeviceId$1(deviceId));
87
- return at !== undefined && at >= sinceMs;
88
- };
89
- const onBleKeyMissing = (deviceId, callback) => {
90
- const target = normalizeDeviceId$1(deviceId);
91
- const listener = id => {
92
- if (id === target)
93
- callback();
94
- };
95
- listeners$1.add(listener);
96
- return () => {
97
- listeners$1.delete(listener);
98
- };
99
- };
100
- const waitForBleKeyMissing = (deviceId, sinceMs, timeoutMs) => {
101
- if (!startBleKeyMissingTracking())
102
- return Promise.resolve(false);
103
- if (hasBleKeyMissingSince(deviceId, sinceMs))
104
- return Promise.resolve(true);
105
- return new Promise(resolve => {
106
- const settle = (found) => {
107
- clearTimeout(timer);
108
- cleanup();
109
- resolve(found);
110
- };
111
- const cleanup = onBleKeyMissing(deviceId, () => {
112
- if (hasBleKeyMissingSince(deviceId, sinceMs))
113
- settle(true);
114
- });
115
- const timer = setTimeout(() => settle(false), timeoutMs);
116
- });
117
- };
118
-
119
49
  let activeLogger;
120
50
  const setBleLogger = (logger) => {
121
51
  activeLogger = logger;
@@ -168,7 +98,6 @@ const onDeviceBondState = (bleMacAddress, signal, options) => new Promise((resol
168
98
  clearTimeout(pendingFailure);
169
99
  if (cleanupListener)
170
100
  cleanupListener();
171
- cleanupKeyMissing === null || cleanupKeyMissing === void 0 ? void 0 : cleanupKeyMissing();
172
101
  signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort);
173
102
  };
174
103
  const onAbort = () => {
@@ -183,15 +112,6 @@ const onDeviceBondState = (bleMacAddress, signal, options) => new Promise((resol
183
112
  reason: 'timeout',
184
113
  }));
185
114
  }, 60 * 1000);
186
- const cleanupKeyMissing = startBleKeyMissingTracking()
187
- ? onBleKeyMissing(bleMacAddress, () => {
188
- cleanup();
189
- reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleBondInvalid, undefined, {
190
- phase: 'bond',
191
- reason: 'key_missing',
192
- }));
193
- })
194
- : undefined;
195
115
  const cleanupListener = BleUtils__default["default"].onDeviceBondState(peripheral => {
196
116
  var _a;
197
117
  if (((_a = peripheral.id) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== bleMacAddress.toLowerCase()) {
@@ -308,252 +228,53 @@ const timer = process.env.NODE_ENV === 'development'
308
228
  },
309
229
  };
310
230
 
311
- const subscribeBleOn = (bleManager, ms = 1000) => new Promise((resolve, reject) => {
231
+ const subscribeBleOn = (bleManager, ms = 2000) => new Promise((resolve, reject) => {
312
232
  let done = false;
233
+ let pendingError;
234
+ let cancelTimeout = () => undefined;
235
+ let removeSubscription = () => undefined;
236
+ const finish = (error) => {
237
+ if (done)
238
+ return;
239
+ done = true;
240
+ cancelTimeout();
241
+ removeSubscription();
242
+ if (error)
243
+ reject(error);
244
+ else
245
+ resolve();
246
+ };
313
247
  const subscription = bleManager.onStateChange(state => {
314
248
  if (state === 'PoweredOn') {
315
- if (done)
316
- return;
317
- clearTimeout();
318
- done = true;
319
- subscription.remove();
320
- resolve();
249
+ finish();
321
250
  }
322
- }, true);
323
- const clearTimeout = timer.timeout(() => {
324
- if (done)
325
- return;
326
- subscription.remove();
327
- reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlePermissionError));
328
- }, ms);
329
- });
330
-
331
- const HCI_PIN_OR_KEY_MISSING = 0x06;
332
- const lastEncryption = new Map();
333
- const lastAclDisconnectAt = new Map();
334
- const listeners = new Set();
335
- let unsubscribeNative;
336
- const normalizeDeviceId = (deviceId) => deviceId.toLowerCase();
337
- const isEncrypted = (record) => record.status === 0 && record.enabled;
338
- const getCapableBleUtils = () => {
339
- if (reactNative.Platform.OS !== 'android')
340
- return undefined;
341
- const bleUtils = BleUtils__default["default"];
342
- if (typeof bleUtils.supportsDeviceEncryptionChange !== 'function' ||
343
- typeof bleUtils.onDeviceEncryptionChange !== 'function' ||
344
- typeof bleUtils.onDeviceAclDisconnected !== 'function') {
345
- return undefined;
346
- }
347
- return bleUtils.supportsDeviceEncryptionChange() ? bleUtils : undefined;
348
- };
349
- const notify = (deviceId) => {
350
- listeners.forEach(listener => listener(deviceId));
351
- };
352
- const startBleEncryptionTracking = () => {
353
- if (unsubscribeNative)
354
- return true;
355
- const bleUtils = getCapableBleUtils();
356
- if (!(bleUtils === null || bleUtils === void 0 ? void 0 : bleUtils.onDeviceEncryptionChange) || !bleUtils.onDeviceAclDisconnected)
357
- return false;
358
- unsubscribeNative = [
359
- bleUtils.onDeviceEncryptionChange(event => {
360
- if (typeof (event === null || event === void 0 ? void 0 : event.id) !== 'string')
361
- return;
362
- const deviceId = normalizeDeviceId(event.id);
363
- lastEncryption.set(deviceId, {
364
- at: Date.now(),
365
- status: Number(event.status),
366
- enabled: event.enabled === true,
367
- });
368
- notify(deviceId);
369
- }),
370
- bleUtils.onDeviceAclDisconnected(event => {
371
- if (typeof (event === null || event === void 0 ? void 0 : event.id) !== 'string')
372
- return;
373
- const deviceId = normalizeDeviceId(event.id);
374
- lastAclDisconnectAt.set(deviceId, Date.now());
375
- notify(deviceId);
376
- }),
377
- ];
378
- return true;
379
- };
380
- const stopBleEncryptionTracking = () => {
381
- unsubscribeNative === null || unsubscribeNative === void 0 ? void 0 : unsubscribeNative.forEach(unsubscribe => unsubscribe());
382
- unsubscribeNative = undefined;
383
- lastEncryption.clear();
384
- lastAclDisconnectAt.clear();
385
- listeners.clear();
386
- };
387
- const markBleLinkEncrypted = (deviceId) => {
388
- if (!unsubscribeNative)
389
- return;
390
- lastEncryption.set(normalizeDeviceId(deviceId), { at: Date.now(), status: 0, enabled: true });
391
- };
392
- const waitForAndroidLinkEncryption = ({ deviceId, linkStartedAt, resultTimeoutMs, repairTimeoutMs, keyMissingGraceMs, signal, onRepairStarted, }) => {
393
- if (!startBleEncryptionTracking())
394
- return Promise.resolve('unresolved');
395
- startBleKeyMissingTracking();
396
- const target = normalizeDeviceId(deviceId);
397
- const previous = lastEncryption.get(target);
398
- const previousDropAt = lastAclDisconnectAt.get(target);
399
- if (previous &&
400
- previous.at < linkStartedAt &&
401
- isEncrypted(previous) &&
402
- (previousDropAt === undefined || previousDropAt < previous.at)) {
403
- return Promise.resolve('already-encrypted');
404
- }
405
- return new Promise((resolve, reject) => {
406
- if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
407
- reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected));
408
- return;
251
+ else if (state === 'PoweredOff') {
252
+ pendingError = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlePoweredOff);
409
253
  }
410
- let repairStartedAt;
411
- let droppedDuringRepair = false;
412
- let timer;
413
- let settled = false;
414
- const cleanup = () => {
415
- settled = true;
416
- if (timer)
417
- clearTimeout(timer);
418
- listeners.delete(onLinkEvent);
419
- cleanupKeyMissing();
420
- signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort);
421
- };
422
- const finish = (result) => {
423
- cleanup();
424
- resolve(result);
425
- };
426
- const fail = (error) => {
427
- cleanup();
428
- reject(error);
429
- };
430
- const arm = (ms, onExpire) => {
431
- if (timer)
432
- clearTimeout(timer);
433
- timer = setTimeout(onExpire, ms);
434
- };
435
- const bondInvalid = () => hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleBondInvalid, undefined, {
436
- phase: 'connect',
437
- reason: 'key_missing',
438
- });
439
- const evaluate = () => {
440
- if (settled)
441
- return;
442
- const record = lastEncryption.get(target);
443
- const dropAt = lastAclDisconnectAt.get(target);
444
- if (repairStartedAt === undefined) {
445
- if (hasBleKeyMissingSince(target, linkStartedAt)) {
446
- fail(bondInvalid());
447
- return;
448
- }
449
- if (dropAt !== undefined && dropAt >= linkStartedAt) {
450
- finish('unresolved');
451
- return;
452
- }
453
- if (!record || record.at < linkStartedAt)
454
- return;
455
- if (isEncrypted(record)) {
456
- finish('encrypted');
457
- return;
458
- }
459
- if (record.status !== HCI_PIN_OR_KEY_MISSING) {
460
- finish('unresolved');
461
- return;
462
- }
463
- repairStartedAt = record.at;
464
- onRepairStarted === null || onRepairStarted === void 0 ? void 0 : onRepairStarted();
465
- arm(repairTimeoutMs, () => fail(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceNotBonded, 'Bluetooth pairing timed out', {
466
- phase: 'bond',
467
- reason: 'timeout',
468
- })));
469
- return;
470
- }
471
- if (hasBleKeyMissingSince(target, repairStartedAt)) {
472
- fail(bondInvalid());
473
- return;
474
- }
475
- if (record && record.at > repairStartedAt && isEncrypted(record)) {
476
- finish('re-paired');
477
- return;
478
- }
479
- if (!droppedDuringRepair && dropAt !== undefined && dropAt >= repairStartedAt) {
480
- droppedDuringRepair = true;
481
- arm(keyMissingGraceMs, () => fail(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected)));
482
- }
483
- };
484
- const onLinkEvent = id => {
485
- if (id === target)
486
- evaluate();
487
- };
488
- const onAbort = () => fail(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected));
489
- listeners.add(onLinkEvent);
490
- const cleanupKeyMissing = onBleKeyMissing(target, evaluate);
491
- signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
492
- arm(resultTimeoutMs, () => finish('unresolved'));
493
- evaluate();
494
- });
495
- };
496
-
497
- const IOS_PERIPHERAL_DISCONNECTED$1 = 7;
498
- const IOS_PEER_TERMINATION_LINK_WINDOW_MS = 10000;
499
- const IOS_PEER_TERMINATION_REPEAT_WINDOW_MS = 60000;
500
- const isIosPeerTerminationError = (error) => (error === null || error === void 0 ? void 0 : error.iosErrorCode) ===
501
- IOS_PERIPHERAL_DISCONNECTED$1;
502
- class IosPeerTerminationTracker {
503
- constructor() {
504
- this.linkStartedAt = new Map();
505
- this.terminatedAt = new Map();
506
- this.evidenceAt = new Map();
507
- }
508
- attemptStarted(deviceId) {
509
- this.linkStartedAt.delete(deviceId);
510
- this.terminatedAt.delete(deviceId);
511
- }
512
- linkStarted(deviceId) {
513
- this.linkStartedAt.set(deviceId, Date.now());
514
- this.terminatedAt.delete(deviceId);
515
- }
516
- note(deviceId, error) {
517
- if (!isIosPeerTerminationError(error))
518
- return;
519
- if (!this.terminatedAt.has(deviceId))
520
- this.terminatedAt.set(deviceId, Date.now());
521
- }
522
- linkProven(deviceId) {
523
- this.forget(deviceId);
524
- }
525
- forget(deviceId) {
526
- this.linkStartedAt.delete(deviceId);
527
- this.terminatedAt.delete(deviceId);
528
- this.evidenceAt.delete(deviceId);
529
- }
530
- attemptFailed(deviceId) {
531
- const startedAt = this.linkStartedAt.get(deviceId);
532
- const terminatedAt = this.terminatedAt.get(deviceId);
533
- const previous = this.evidenceAt.get(deviceId);
534
- this.forget(deviceId);
535
- if (startedAt === undefined ||
536
- terminatedAt === undefined ||
537
- terminatedAt - startedAt > IOS_PEER_TERMINATION_LINK_WINDOW_MS) {
538
- return false;
254
+ else if (state === 'Unsupported') {
255
+ pendingError = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleUnsupported);
539
256
  }
540
- if (previous !== undefined &&
541
- terminatedAt - previous <= IOS_PEER_TERMINATION_REPEAT_WINDOW_MS) {
542
- return true;
257
+ else if (state === 'Unauthorized') {
258
+ pendingError = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleLocationError);
543
259
  }
544
- this.evidenceAt.set(deviceId, terminatedAt);
545
- return false;
260
+ else {
261
+ pendingError = undefined;
262
+ }
263
+ }, true);
264
+ removeSubscription = () => subscription.remove();
265
+ if (done) {
266
+ removeSubscription();
546
267
  }
547
- reset() {
548
- this.linkStartedAt.clear();
549
- this.terminatedAt.clear();
550
- this.evidenceAt.clear();
268
+ else {
269
+ cancelTimeout = timer.timeout(() => {
270
+ finish(pendingError !== null && pendingError !== void 0 ? pendingError : hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleScanError));
271
+ }, ms);
551
272
  }
552
- }
273
+ });
553
274
 
554
275
  const BLE_PLX_DEVICE_DISCONNECTED = 201;
555
276
  const IOS_PERIPHERAL_DISCONNECTED = 7;
556
- const nativeErrorText$1 = (error) => [error.reason, error.message]
277
+ const nativeErrorText = (error) => [error.reason, error.message]
557
278
  .filter((value) => typeof value === 'string')
558
279
  .join(' ');
559
280
  const isNativeBleDisconnectError = (error) => {
@@ -562,48 +283,15 @@ const isNativeBleDisconnectError = (error) => {
562
283
  }
563
284
  const nativeError = error;
564
285
  return (nativeError.errorCode === BLE_PLX_DEVICE_DISCONNECTED ||
565
- nativeError.iosErrorCode === IOS_PERIPHERAL_DISCONNECTED);
286
+ nativeError.iosErrorCode === IOS_PERIPHERAL_DISCONNECTED ||
287
+ nativeErrorText(nativeError).toLowerCase().includes('was disconnected'));
566
288
  };
567
289
  const toBleDisconnectHardwareError = (error) => {
568
290
  if ((error === null || error === void 0 ? void 0 : error.errorCode) === hdShared.HardwareErrorCode.BleDeviceDisconnected) {
569
291
  return error;
570
292
  }
571
293
  const nativeError = (error !== null && error !== void 0 ? error : {});
572
- return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected, nativeErrorText$1(nativeError) || undefined);
573
- };
574
-
575
- const ATT_INSUFFICIENT_AUTHENTICATION = 5;
576
- const ATT_INSUFFICIENT_ENCRYPTION = 15;
577
- const IOS_PEER_REMOVED_PAIRING_INFORMATION = 14;
578
- const nativeErrorText = (error) => [error.reason, error.message]
579
- .filter((value) => typeof value === 'string')
580
- .join(' ');
581
- const isNativeBleStaleBondError = (error) => {
582
- if (!error || typeof error !== 'object') {
583
- return typeof error === 'string' ? hdShared.isBleStaleBondErrorText(error) : false;
584
- }
585
- const nativeError = error;
586
- if (nativeError.attErrorCode === ATT_INSUFFICIENT_AUTHENTICATION ||
587
- nativeError.attErrorCode === ATT_INSUFFICIENT_ENCRYPTION ||
588
- nativeError.androidErrorCode === ATT_INSUFFICIENT_AUTHENTICATION ||
589
- nativeError.androidErrorCode === ATT_INSUFFICIENT_ENCRYPTION ||
590
- nativeError.iosErrorCode === IOS_PEER_REMOVED_PAIRING_INFORMATION) {
591
- return true;
592
- }
593
- return hdShared.isBleStaleBondErrorText(nativeErrorText(nativeError));
594
- };
595
- const toBleStaleBondHardwareError = (error) => {
596
- if (hdShared.isBleStaleBondHardwareError(error)) {
597
- return error;
598
- }
599
- const nativeError = (error !== null && error !== void 0 ? error : {});
600
- const text = nativeErrorText(nativeError);
601
- const normalizedText = text.toLowerCase();
602
- const peerRemoved = nativeError.iosErrorCode === IOS_PEER_REMOVED_PAIRING_INFORMATION ||
603
- normalizedText.includes('peer removed pairing information');
604
- return hdShared.ERRORS.TypedError(peerRemoved
605
- ? hdShared.HardwareErrorCode.BlePeerRemovedPairingInformation
606
- : hdShared.HardwareErrorCode.BleDeviceBondError, text || undefined);
294
+ return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected, nativeErrorText(nativeError) || undefined);
607
295
  };
608
296
 
609
297
  const isHeaderChunk = (chunk) => {
@@ -697,8 +385,7 @@ const isWedgedWriteError = (error) => (error === null || error === void 0 ? void
697
385
  error.message.startsWith(WEDGED_WRITE_MESSAGE);
698
386
  const shouldRethrowProtocolProbeError = (error) => {
699
387
  const code = error === null || error === void 0 ? void 0 : error.errorCode;
700
- return (hdShared.isBleStaleBondHardwareError(error) ||
701
- isNativeBleDisconnectError(error) ||
388
+ return (isNativeBleDisconnectError(error) ||
702
389
  code === hdShared.HardwareErrorCode.BleDeviceNotBonded ||
703
390
  code === hdShared.HardwareErrorCode.BleDeviceBondedCanceled ||
704
391
  code === hdShared.HardwareErrorCode.BleDeviceDisconnected ||
@@ -706,18 +393,6 @@ const shouldRethrowProtocolProbeError = (error) => {
706
393
  code === hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure ||
707
394
  code === hdShared.HardwareErrorCode.BleWriteCharacteristicError);
708
395
  };
709
- const ANDROID_KEY_MISSING_LINK_WINDOW_MS = 10000;
710
- const ANDROID_KEY_MISSING_GRACE_MS = 500;
711
- const ANDROID_ENCRYPTION_RESULT_TIMEOUT_MS = 1500;
712
- const ANDROID_SYSTEM_REPAIR_TIMEOUT_MS = 35000;
713
- const isAndroidLinkLossError = (error) => {
714
- const code = error === null || error === void 0 ? void 0 : error.errorCode;
715
- return (isNativeBleDisconnectError(error) ||
716
- code === hdShared.HardwareErrorCode.BleDeviceNotBonded ||
717
- code === hdShared.HardwareErrorCode.BleDeviceDisconnected ||
718
- code === hdShared.HardwareErrorCode.BleCharacteristicNotifyError ||
719
- code === hdShared.HardwareErrorCode.BleConnectedError);
720
- };
721
396
  const BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD = 2;
722
397
  const DEVICE_SCAN_TIMEOUT_MS = 3000;
723
398
  const IOS_NOTIFY_READY_DELAY_MS = 150;
@@ -877,21 +552,14 @@ const resolveNegotiatedMtu = (device, cancelTransaction) => shouldRefreshNegotia
877
552
  ? requestNegotiatedMtu(device, 'connected', 0, cancelTransaction)
878
553
  : Promise.resolve({ device, timedOut: false });
879
554
  function remapError(error) {
880
- var _a;
881
- if (error instanceof reactNativeBlePlx.BleError) {
882
- if (isNativeBleStaleBondError(error)) {
883
- throw toBleStaleBondHardwareError(error);
884
- }
885
- if ((error === null || error === void 0 ? void 0 : error.attErrorCode) === 22) {
886
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceBondError);
887
- }
555
+ var _a, _b;
556
+ if (isNativeBleDisconnectError(error)) {
557
+ throw toBleDisconnectHardwareError(error);
888
558
  }
889
- if (error instanceof Error &&
890
- error.message &&
891
- (error.message.includes('was disconnected') || error.message.includes('not found'))) {
559
+ if (error instanceof Error && ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('not found'))) {
892
560
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
893
561
  }
894
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleConnectedError, (_a = error.reason) !== null && _a !== void 0 ? _a : error);
562
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleConnectedError, (_b = error.reason) !== null && _b !== void 0 ? _b : error);
895
563
  }
896
564
  class ReactNativeBleTransport {
897
565
  constructor(options) {
@@ -914,10 +582,6 @@ class ReactNativeBleTransport {
914
582
  this.protocolReprobeFailures = new Map();
915
583
  this.silentDetections = new Map();
916
584
  this.androidGattCacheRefreshes = new Set();
917
- this.staleBondErrors = new Map();
918
- this.androidLinkStartedAt = new Map();
919
- this.iosPeerTermination = new IosPeerTerminationTracker();
920
- this.acquiringProtocolV2 = new Set();
921
585
  this.protocolV2Assemblers = new Map();
922
586
  this.protocolV2FrameQueues = new Map();
923
587
  this.protocolV2FramePromises = new Map();
@@ -964,10 +628,6 @@ class ReactNativeBleTransport {
964
628
  init(logger, emitter) {
965
629
  setBleLogger(logger);
966
630
  this.emitter = emitter;
967
- if (reactNative.Platform.OS === 'android') {
968
- startBleKeyMissingTracking();
969
- startBleEncryptionTracking();
970
- }
971
631
  }
972
632
  configure(signedData) {
973
633
  const messages = parseConfigure(signedData);
@@ -1190,7 +850,6 @@ class ReactNativeBleTransport {
1190
850
  const scanStartedAt = Date.now();
1191
851
  let firstDeviceMs;
1192
852
  const blePlxManager = yield this.getPlxManager();
1193
- yield subscribeBleOn(blePlxManager);
1194
853
  if (reactNative.Platform.OS === 'android' && reactNative.Platform.Version >= 31) {
1195
854
  Log === null || Log === void 0 ? void 0 : Log.debug('requesting permissions, please wait...');
1196
855
  const resultConnect = yield reactNative.PermissionsAndroid.requestMultiple([
@@ -1200,9 +859,10 @@ class ReactNativeBleTransport {
1200
859
  Log === null || Log === void 0 ? void 0 : Log.debug('requesting permissions, result: ', resultConnect);
1201
860
  if (resultConnect[reactNative.PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT] !== 'granted' ||
1202
861
  resultConnect[reactNative.PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN] !== 'granted') {
1203
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlePermissionError);
862
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleLocationError);
1204
863
  }
1205
864
  }
865
+ yield subscribeBleOn(blePlxManager);
1206
866
  if (this.stopped)
1207
867
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1208
868
  return new Promise((resolve, reject) => {
@@ -1243,8 +903,11 @@ class ReactNativeBleTransport {
1243
903
  var _a, _b;
1244
904
  if (error) {
1245
905
  Log === null || Log === void 0 ? void 0 : Log.debug('ble scan error: ', error);
1246
- if ([reactNativeBlePlx.BleErrorCode.BluetoothPoweredOff, reactNativeBlePlx.BleErrorCode.BluetoothInUnknownState].includes(error.errorCode)) {
1247
- finishScan(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlePermissionError));
906
+ if (error.errorCode === reactNativeBlePlx.BleErrorCode.BluetoothPoweredOff) {
907
+ finishScan(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlePoweredOff));
908
+ }
909
+ else if (error.errorCode === reactNativeBlePlx.BleErrorCode.BluetoothUnsupported) {
910
+ finishScan(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleUnsupported));
1248
911
  }
1249
912
  else if (error.errorCode === reactNativeBlePlx.BleErrorCode.BluetoothUnauthorized) {
1250
913
  finishScan(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleLocationError));
@@ -1341,6 +1004,7 @@ class ReactNativeBleTransport {
1341
1004
  if (this.stopped)
1342
1005
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1343
1006
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] BLE MTU ready', {
1007
+ connectionId: monitorToken,
1344
1008
  platform: reactNative.Platform.OS,
1345
1009
  requested: getRequestedBleMtu(),
1346
1010
  actual: transport$1.mtuSize,
@@ -1354,14 +1018,7 @@ class ReactNativeBleTransport {
1354
1018
  if (!uuid) {
1355
1019
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleRequiredUUID);
1356
1020
  }
1357
- return this.runLifecycleOperation(uuid, () => __awaiter(this, void 0, void 0, function* () {
1358
- try {
1359
- return yield this.acquireUnlocked(input);
1360
- }
1361
- catch (error) {
1362
- throw this.resolveIosBondInvalid(input, yield this.resolveAndroidBondInvalid(uuid, error));
1363
- }
1364
- }));
1021
+ return this.runLifecycleOperation(uuid, () => this.acquireUnlocked(input));
1365
1022
  });
1366
1023
  }
1367
1024
  acquireUnlocked(input) {
@@ -1370,10 +1027,6 @@ class ReactNativeBleTransport {
1370
1027
  if (this.stopped)
1371
1028
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1372
1029
  const { uuid, forceCleanRunPromise, expectedProtocol, skipProtocolProbe } = input;
1373
- this.iosPeerTermination.attemptStarted(uuid);
1374
- const shouldMapProtocolV2StaleBond = expectedProtocol
1375
- ? expectedProtocol === 'V2'
1376
- : this.confirmedProtocolV2.has(uuid);
1377
1030
  const cachedTransport = transportCache[uuid];
1378
1031
  if (skipProtocolProbe && !cachedTransport && this.blePlxManager) {
1379
1032
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] refresh uncached BLE connection for firmware install:', uuid);
@@ -1417,7 +1070,6 @@ class ReactNativeBleTransport {
1417
1070
  }
1418
1071
  let device = null;
1419
1072
  const isAndroid = reactNative.Platform.OS === 'android';
1420
- let androidBondedBeforeConnect = false;
1421
1073
  const refreshAndroidGattCache = isAndroid && (!!skipProtocolProbe || this.androidGattCacheRefreshes.has(uuid));
1422
1074
  let nativeConnectOptions = connectOptions;
1423
1075
  if (isAndroid) {
@@ -1445,12 +1097,8 @@ class ReactNativeBleTransport {
1445
1097
  if (this.stopped)
1446
1098
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1447
1099
  if (reactNative.Platform.OS === 'android') {
1448
- startBleKeyMissingTracking();
1449
- startBleEncryptionTracking();
1450
- this.androidLinkStartedAt.delete(uuid);
1451
1100
  try {
1452
1101
  const bondState = yield pairDevice(uuid);
1453
- androidBondedBeforeConnect = !bondState.bonding && bondState.bonded;
1454
1102
  if (bondState.bonding) {
1455
1103
  yield onDeviceBondState(uuid, this.bondAbortController.signal, {
1456
1104
  systemInitiated: bondState.initiated === false,
@@ -1466,7 +1114,6 @@ class ReactNativeBleTransport {
1466
1114
  }));
1467
1115
  throw error;
1468
1116
  }
1469
- this.androidLinkStartedAt.set(uuid, Date.now());
1470
1117
  }
1471
1118
  if (this.stopped)
1472
1119
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
@@ -1621,16 +1268,7 @@ class ReactNativeBleTransport {
1621
1268
  if (protocolHint) {
1622
1269
  this.deviceProtocolHints.set(uuid, protocolHint);
1623
1270
  }
1624
- if (shouldMapProtocolV2StaleBond) {
1625
- this.acquiringProtocolV2.add(uuid);
1626
- }
1627
- let linkEncryption;
1628
1271
  try {
1629
- if (androidBondedBeforeConnect && !skipProtocolProbe) {
1630
- linkEncryption = yield this.waitForAndroidLinkSecurity(uuid);
1631
- if (this.stopped)
1632
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1633
- }
1634
1272
  yield this.installTransportForAcquire(uuid, acquiredDevice, {
1635
1273
  writeCharacteristic,
1636
1274
  notifyCharacteristic,
@@ -1664,24 +1302,17 @@ class ReactNativeBleTransport {
1664
1302
  }));
1665
1303
  if (this.stopped)
1666
1304
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
1667
- this.iosPeerTermination.linkProven(uuid);
1668
1305
  const currentTransport = transportCache[uuid];
1669
1306
  if (!currentTransport) {
1670
1307
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotFound);
1671
1308
  }
1672
1309
  this.attachDisconnectSubscription(currentTransport, currentTransport.device, uuid);
1673
- if (linkEncryption === 'unresolved') {
1674
- markBleLinkEncrypted(uuid);
1675
- }
1676
1310
  return { uuid, protocolType };
1677
1311
  }
1678
1312
  catch (error) {
1679
1313
  yield this.disconnectUnlocked(uuid);
1680
1314
  throw error;
1681
1315
  }
1682
- finally {
1683
- this.acquiringProtocolV2.delete(uuid);
1684
- }
1685
1316
  });
1686
1317
  }
1687
1318
  _monitorCharacteristic(characteristic, uuid, monitorToken, notifyTransactionId) {
@@ -1691,8 +1322,6 @@ class ReactNativeBleTransport {
1691
1322
  var _a, _b, _c, _d, _e, _f;
1692
1323
  const isCurrentMonitor = this.monitorTokens.get(uuid) === monitorToken;
1693
1324
  if (error) {
1694
- if (isCurrentMonitor)
1695
- this.noteIosLinkError(uuid, 'notify', error);
1696
1325
  Log === null || Log === void 0 ? void 0 : Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
1697
1326
  if (this.firmwareUploadWriteRecoveryIds.has(uuid)) {
1698
1327
  Log === null || Log === void 0 ? void 0 : Log.debug('notify error ignored during FirmwareUpload write recovery: ', uuid);
@@ -1702,11 +1331,6 @@ class ReactNativeBleTransport {
1702
1331
  Log === null || Log === void 0 ? void 0 : Log.debug('monitor error ignored for stale transport: ', uuid, notifyTransactionId);
1703
1332
  return;
1704
1333
  }
1705
- if ((this.getActiveProtocol(uuid) === 'V2' || this.acquiringProtocolV2.has(uuid)) &&
1706
- isNativeBleStaleBondError(error)) {
1707
- this.rememberStaleBondError(uuid, toBleStaleBondHardwareError(error));
1708
- return;
1709
- }
1710
1334
  if (reactNative.Platform.OS === 'android' && isStaleGattTableNotifyReason(error.reason)) {
1711
1335
  this.androidGattCacheRefreshes.add(uuid);
1712
1336
  }
@@ -1835,8 +1459,6 @@ class ReactNativeBleTransport {
1835
1459
  this.protocolV2HighVolumeLogSignatures.delete(uuid);
1836
1460
  this.deviceProtocol.delete(uuid);
1837
1461
  this.probingProtocols.delete(uuid);
1838
- this.staleBondErrors.delete(uuid);
1839
- this.acquiringProtocolV2.delete(uuid);
1840
1462
  (_e = this.protocolV2Assemblers.get(uuid)) === null || _e === void 0 ? void 0 : _e.reset();
1841
1463
  this.protocolV2Assemblers.delete(uuid);
1842
1464
  this.resetProtocolV2Frames(uuid);
@@ -1880,94 +1502,9 @@ class ReactNativeBleTransport {
1880
1502
  if (protocol !== 'V2' && this.runPromise && !forceRun) {
1881
1503
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportCallInProgress);
1882
1504
  }
1883
- try {
1884
- return protocol === 'V2'
1885
- ? yield this.callProtocolV2(uuid, name, data, options)
1886
- : yield this.callProtocolV1(uuid, name, data, options);
1887
- }
1888
- catch (error) {
1889
- throw yield this.resolveAndroidBondInvalid(uuid, error);
1890
- }
1891
- });
1892
- }
1893
- resolveAndroidBondInvalid(uuid, error) {
1894
- return __awaiter(this, void 0, void 0, function* () {
1895
- if (reactNative.Platform.OS !== 'android' || !isBleKeyMissingSupported())
1896
- return error;
1897
- if (hdShared.isBleStaleBondHardwareError(error) || !isAndroidLinkLossError(error))
1898
- return error;
1899
- const linkStartedAt = this.androidLinkStartedAt.get(uuid);
1900
- if (linkStartedAt === undefined ||
1901
- Date.now() - linkStartedAt > ANDROID_KEY_MISSING_LINK_WINDOW_MS) {
1902
- return error;
1903
- }
1904
- if (!(yield waitForBleKeyMissing(uuid, linkStartedAt, ANDROID_KEY_MISSING_GRACE_MS))) {
1905
- return error;
1906
- }
1907
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Android key missing, bond is invalid:', uuid);
1908
- return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleBondInvalid, undefined, {
1909
- phase: 'connect',
1910
- reason: 'key_missing',
1911
- });
1912
- });
1913
- }
1914
- noteIosLinkError(uuid, stage, error) {
1915
- if (reactNative.Platform.OS !== 'ios')
1916
- return;
1917
- this.iosPeerTermination.note(uuid, error);
1918
- if (stage !== 'gatt-setup' && !isNativeBleDisconnectError(error))
1919
- return;
1920
- const native = (error !== null && error !== void 0 ? error : {});
1921
- const code = (value) => typeof value === 'number' || typeof value === 'string' ? value : undefined;
1922
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] iOS operation failed', {
1923
- connectIdSuffix: uuid.slice(-8),
1924
- stage,
1925
- errorCode: code(native.errorCode),
1926
- iosErrorCode: code(native.iosErrorCode),
1927
- attErrorCode: code(native.attErrorCode),
1928
- });
1929
- }
1930
- resolveIosBondInvalid(input, error) {
1931
- if (reactNative.Platform.OS !== 'ios')
1932
- return error;
1933
- const { uuid, skipProtocolProbe } = input;
1934
- if (skipProtocolProbe || hdShared.isBleStaleBondHardwareError(error)) {
1935
- this.iosPeerTermination.forget(uuid);
1936
- return error;
1937
- }
1938
- if (!this.iosPeerTermination.attemptFailed(uuid))
1939
- return error;
1940
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] iOS peer ended two new links in a row, bond is invalid:', {
1941
- connectIdSuffix: uuid.slice(-8),
1942
- });
1943
- return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleBondInvalid, undefined, {
1944
- phase: 'connect',
1945
- reason: 'peer_disconnected',
1946
- });
1947
- }
1948
- waitForAndroidLinkSecurity(uuid) {
1949
- return __awaiter(this, void 0, void 0, function* () {
1950
- const linkStartedAt = this.androidLinkStartedAt.get(uuid);
1951
- if (linkStartedAt === undefined)
1952
- return 'unresolved';
1953
- const waitStartedAt = Date.now();
1954
- const result = yield waitForAndroidLinkEncryption({
1955
- deviceId: uuid,
1956
- linkStartedAt,
1957
- resultTimeoutMs: ANDROID_ENCRYPTION_RESULT_TIMEOUT_MS,
1958
- repairTimeoutMs: ANDROID_SYSTEM_REPAIR_TIMEOUT_MS,
1959
- keyMissingGraceMs: ANDROID_KEY_MISSING_GRACE_MS,
1960
- signal: this.bondAbortController.signal,
1961
- onRepairStarted: () => {
1962
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Android bond lost, waiting for system re-pairing:', uuid);
1963
- },
1964
- });
1965
- Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Android link encryption', {
1966
- connectIdSuffix: uuid.slice(-8),
1967
- result,
1968
- waitedMs: Date.now() - waitStartedAt,
1969
- });
1970
- return result;
1505
+ return protocol === 'V2'
1506
+ ? this.callProtocolV2(uuid, name, data, options)
1507
+ : this.callProtocolV1(uuid, name, data, options);
1971
1508
  });
1972
1509
  }
1973
1510
  callProtocolV1(uuid, name, data, options) {
@@ -2183,10 +1720,6 @@ class ReactNativeBleTransport {
2183
1720
  this.androidPriorityResetTimers.forEach(timeout => clearTimeout(timeout));
2184
1721
  this.androidPriorityResetTimers.clear();
2185
1722
  this.androidHighPriorityDevices.clear();
2186
- this.androidLinkStartedAt.clear();
2187
- this.iosPeerTermination.reset();
2188
- stopBleKeyMissingTracking();
2189
- stopBleEncryptionTracking();
2190
1723
  const error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceDisconnected);
2191
1724
  (_a = this.runPromise) === null || _a === void 0 ? void 0 : _a.reject(error);
2192
1725
  this.runPromise = null;
@@ -2247,7 +1780,6 @@ class ReactNativeBleTransport {
2247
1780
  }
2248
1781
  this.deviceProtocol.delete(session);
2249
1782
  this.probingProtocols.delete(session);
2250
- this.staleBondErrors.delete(session);
2251
1783
  this.deviceProtocolHints.delete(session);
2252
1784
  this.sessionProtocols.delete(session);
2253
1785
  this.protocolReprobeFailures.delete(session);
@@ -2440,7 +1972,6 @@ class ReactNativeBleTransport {
2440
1972
  }),
2441
1973
  ]);
2442
1974
  succeeded = true;
2443
- this.iosPeerTermination.linkStarted(uuid);
2444
1975
  return result;
2445
1976
  }
2446
1977
  catch (error) {
@@ -2487,16 +2018,15 @@ class ReactNativeBleTransport {
2487
2018
  return result;
2488
2019
  }
2489
2020
  catch (error) {
2490
- this.noteIosLinkError(uuid, 'gatt-setup', error);
2491
- if (reactNative.Platform.OS === 'ios' && isNativeBleStaleBondError(error)) {
2492
- throw toBleStaleBondHardwareError(error);
2493
- }
2494
2021
  if (timedOut || isNativeOperationTimeoutError(error)) {
2495
2022
  const resetManager = this.abandonStalledConnection(uuid, timedOut ? 'gatt-backstop' : 'gatt-native');
2496
2023
  if (resetManager) {
2497
2024
  throw this.createWedgedBleSetupError();
2498
2025
  }
2499
2026
  }
2027
+ if (isNativeBleDisconnectError(error)) {
2028
+ throw toBleDisconnectHardwareError(error);
2029
+ }
2500
2030
  if (reactNative.Platform.OS === 'android' && isMissingGattShapeError(error)) {
2501
2031
  this.androidGattCacheRefreshes.add(uuid);
2502
2032
  }
@@ -2530,8 +2060,6 @@ class ReactNativeBleTransport {
2530
2060
  }
2531
2061
  this.deviceProtocol.delete(uuid);
2532
2062
  this.probingProtocols.delete(uuid);
2533
- this.staleBondErrors.delete(uuid);
2534
- this.acquiringProtocolV2.delete(uuid);
2535
2063
  this.protocolV2Assemblers.delete(uuid);
2536
2064
  this.resetProtocolV2Frames(uuid);
2537
2065
  if (timeouts >= BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD) {
@@ -2569,7 +2097,6 @@ class ReactNativeBleTransport {
2569
2097
  this.writeTimeoutCounts.delete(uuid);
2570
2098
  }
2571
2099
  catch (error) {
2572
- this.noteIosLinkError(uuid, 'write', error);
2573
2100
  if (timedOut) {
2574
2101
  if (isCurrentOwner && !isCurrentOwner()) {
2575
2102
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] stale BLE write timed out, link kept:', uuid);
@@ -2602,8 +2129,6 @@ class ReactNativeBleTransport {
2602
2129
  }
2603
2130
  this.deviceProtocol.delete(uuid);
2604
2131
  this.probingProtocols.delete(uuid);
2605
- this.staleBondErrors.delete(uuid);
2606
- this.acquiringProtocolV2.delete(uuid);
2607
2132
  this.protocolV2Assemblers.delete(uuid);
2608
2133
  this.resetProtocolV2Frames(uuid);
2609
2134
  if (timeouts >= BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD) {
@@ -2648,8 +2173,6 @@ class ReactNativeBleTransport {
2648
2173
  });
2649
2174
  this.deviceProtocol.clear();
2650
2175
  this.probingProtocols.clear();
2651
- this.staleBondErrors.clear();
2652
- this.acquiringProtocolV2.clear();
2653
2176
  this.sessionProtocols.clear();
2654
2177
  this.protocolReprobeFailures.clear();
2655
2178
  this.silentDetections.clear();
@@ -2702,9 +2225,6 @@ class ReactNativeBleTransport {
2702
2225
  });
2703
2226
  return 'V1';
2704
2227
  }
2705
- if (expectedProtocol === 'V2' || this.acquiringProtocolV2.has(uuid)) {
2706
- this.throwIfStaleBondError(uuid);
2707
- }
2708
2228
  if (expectedProtocol === 'V2') {
2709
2229
  if (yield this.probeProtocolV2(uuid)) {
2710
2230
  this.deviceProtocol.set(uuid, 'V2');
@@ -2863,7 +2383,6 @@ class ReactNativeBleTransport {
2863
2383
  }
2864
2384
  this.probingProtocols.set(uuid, 'V2');
2865
2385
  (_a = this.protocolV2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
2866
- this.throwIfStaleBondError(uuid);
2867
2386
  const detected = yield transport.probeProtocolV2({
2868
2387
  call: (name, data, options) => this.callProtocolV2(uuid, name, data, options),
2869
2388
  timeoutMs: PROTOCOL_V2_PROBE_TIMEOUT_MS,
@@ -2935,19 +2454,6 @@ class ReactNativeBleTransport {
2935
2454
  framePromise.reject(error);
2936
2455
  }
2937
2456
  }
2938
- rememberStaleBondError(uuid, error) {
2939
- this.staleBondErrors.set(uuid, error);
2940
- this.rejectProtocolV2Frames(uuid, error);
2941
- if (this.runPromise && this.runPromiseDeviceId === uuid) {
2942
- this.runPromise.reject(error);
2943
- }
2944
- }
2945
- throwIfStaleBondError(uuid) {
2946
- const error = this.staleBondErrors.get(uuid);
2947
- if (error) {
2948
- throw error;
2949
- }
2950
- }
2951
2457
  readProtocolV2Frame(uuid) {
2952
2458
  return __awaiter(this, void 0, void 0, function* () {
2953
2459
  const queuedFrame = this.getProtocolV2FrameQueue(uuid).shift();
@@ -2996,11 +2502,6 @@ class ReactNativeBleTransport {
2996
2502
  return;
2997
2503
  }
2998
2504
  catch (error) {
2999
- if (isNativeBleStaleBondError(error) || hdShared.isBleStaleBondHardwareError(error)) {
3000
- const bondError = toBleStaleBondHardwareError(error);
3001
- this.rememberStaleBondError(uuid, bondError);
3002
- throw bondError;
3003
- }
3004
2505
  if (isNativeBleDisconnectError(error)) {
3005
2506
  throw toBleDisconnectHardwareError(error);
3006
2507
  }
@@ -3226,12 +2727,8 @@ class ReactNativeBleTransport {
3226
2727
  }
3227
2728
  }
3228
2729
 
3229
- exports.ANDROID_ENCRYPTION_RESULT_TIMEOUT_MS = ANDROID_ENCRYPTION_RESULT_TIMEOUT_MS;
3230
- exports.ANDROID_KEY_MISSING_GRACE_MS = ANDROID_KEY_MISSING_GRACE_MS;
3231
- exports.ANDROID_KEY_MISSING_LINK_WINDOW_MS = ANDROID_KEY_MISSING_LINK_WINDOW_MS;
3232
2730
  exports.ANDROID_LINK_DROP_QUIET_MS = ANDROID_LINK_DROP_QUIET_MS;
3233
2731
  exports.ANDROID_MTU_EXCHANGE_TIMEOUT_MS = ANDROID_MTU_EXCHANGE_TIMEOUT_MS;
3234
- exports.ANDROID_SYSTEM_REPAIR_TIMEOUT_MS = ANDROID_SYSTEM_REPAIR_TIMEOUT_MS;
3235
2732
  exports.BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD = BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD;
3236
2733
  exports.BLE_CONNECT_TIMEOUT_MS = BLE_CONNECT_TIMEOUT_MS;
3237
2734
  exports.BLE_GATT_SETUP_TIMEOUT_MS = BLE_GATT_SETUP_TIMEOUT_MS;