@onekeyfe/hd-transport-web-device 1.2.11-alpha.2 → 1.2.11-alpha.21

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
@@ -41,7 +41,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
41
41
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
42
42
  };
43
43
 
44
- const { parseConfigure: parseConfigure$1, check: check$1, ProtocolV1: ProtocolV1$1 } = transport__default["default"];
44
+ const { parseTransportConfigure: parseTransportConfigure$1, check: check$1, ProtocolV1: ProtocolV1$1 } = transport__default["default"];
45
45
  const CONFIGURATION_ID = 1;
46
46
  const INTERFACE_ID = 0;
47
47
  const ENDPOINT_ID = 1;
@@ -320,7 +320,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
320
320
  this.probedDeviceObjects.delete(path);
321
321
  }
322
322
  configure(signedData) {
323
- const messages = parseConfigure$1(signedData);
323
+ const messages = parseTransportConfigure$1(signedData);
324
324
  this.configured = true;
325
325
  this.messages = messages;
326
326
  }
@@ -332,7 +332,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
332
332
  if (schemaSource === this.protocolV2SchemaSource)
333
333
  return;
334
334
  const hadProtocolV2Schema = this.protocolV2SchemaSource !== undefined;
335
- this.messagesV2 = parseConfigure$1(signedData);
335
+ this.messagesV2 = parseTransportConfigure$1(signedData);
336
336
  this.protocolV2SchemaSource = schemaSource;
337
337
  if (!hadProtocolV2Schema)
338
338
  return;
@@ -1428,8 +1428,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
1428
1428
  }
1429
1429
  }
1430
1430
  decoded.reset();
1431
- const result = decoded.toBuffer();
1432
- return Buffer.from(result).toString('hex');
1431
+ return decoded.toString('hex');
1433
1432
  });
1434
1433
  }
1435
1434
  release(path) {
@@ -1505,7 +1504,7 @@ function resolveBlePacketCapacity(mtu, maximumPacketCapacity, fallbackPacketCapa
1505
1504
  return Math.min(maximumPacketCapacity, Math.floor(mtu) - BLE_ATT_HEADER_BYTES);
1506
1505
  }
1507
1506
 
1508
- const { parseConfigure, ProtocolV1, check } = transport__default["default"];
1507
+ const { parseTransportConfigure, ProtocolV1, check } = transport__default["default"];
1509
1508
  const toBleDescriptor = (device, protocolType) => (Object.assign(Object.assign({ id: device.id, name: device.name, path: device.id, debug: false, commType: 'electron-ble' }, (device.bleColorCode ? { bleColorCode: device.bleColorCode } : {})), (protocolType ? { protocolType } : {})));
1510
1509
  const invokeNobleBle = (request) => __awaiter(void 0, void 0, void 0, function* () {
1511
1510
  const response = yield request;
@@ -1525,6 +1524,34 @@ const BLE_PACKET_SIZE_MAXIMUM = 244;
1525
1524
  const BLE_WRITE_DELAY_MS = 5;
1526
1525
  const PROTOCOL_PROBE_TIMEOUT_MS = 3000;
1527
1526
  const PROTOCOL_V2_PROBE_TIMEOUT_MS = 5000;
1527
+ const shouldRethrowElectronProtocolProbeError = (error) => {
1528
+ if (transport.isProtocolV2LinkDisabledError(error)) {
1529
+ return true;
1530
+ }
1531
+ const code = error === null || error === void 0 ? void 0 : error.errorCode;
1532
+ return (code === hdShared.HardwareErrorCode.TransportCallInProgress ||
1533
+ code === hdShared.HardwareErrorCode.BleConnectedError ||
1534
+ code === hdShared.HardwareErrorCode.BleDeviceNotBonded ||
1535
+ code === hdShared.HardwareErrorCode.BleDeviceBondedCanceled ||
1536
+ code === hdShared.HardwareErrorCode.BleDeviceDisconnected ||
1537
+ code === hdShared.HardwareErrorCode.BleCharacteristicNotFound ||
1538
+ code === hdShared.HardwareErrorCode.BleCharacteristicNotifyError ||
1539
+ code === hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure ||
1540
+ code === hdShared.HardwareErrorCode.BleServiceNotFound ||
1541
+ code === hdShared.HardwareErrorCode.BlePoweredOff ||
1542
+ code === hdShared.HardwareErrorCode.BleUnsupported ||
1543
+ code === hdShared.HardwareErrorCode.BleLocationError);
1544
+ };
1545
+ const isUnstartedElectronWakeError = (error) => {
1546
+ var _a;
1547
+ const candidate = error;
1548
+ const code = candidate === null || candidate === void 0 ? void 0 : candidate.errorCode;
1549
+ return (((_a = candidate === null || candidate === void 0 ? void 0 : candidate.params) === null || _a === void 0 ? void 0 : _a.writeRejected) === true ||
1550
+ code === hdShared.HardwareErrorCode.BleCharacteristicNotFound ||
1551
+ code === hdShared.HardwareErrorCode.BlePoweredOff ||
1552
+ code === hdShared.HardwareErrorCode.BleUnsupported ||
1553
+ code === hdShared.HardwareErrorCode.BleLocationError);
1554
+ };
1528
1555
  class ElectronBleTransport {
1529
1556
  constructor() {
1530
1557
  this.name = 'ElectronBleTransport';
@@ -1535,8 +1562,14 @@ class ElectronBleTransport {
1535
1562
  this.retainedDevices = new Set();
1536
1563
  this.protocolV2CallCounts = new Map();
1537
1564
  this.acquiringDevices = new Set();
1565
+ this.stopped = false;
1538
1566
  this.deviceProtocol = new Map();
1539
1567
  this.deviceProtocolHints = new Map();
1568
+ this.silentDetections = new Map();
1569
+ this.probeResponseTimeoutErrors = new WeakSet();
1570
+ this.lastV1ProbeFailedWithoutTimeout = new Set();
1571
+ this.acquireGenerations = new Map();
1572
+ this.nextAcquireGeneration = 1;
1540
1573
  this.deviceMtus = new Map();
1541
1574
  this.devicePacketCapacities = new Map();
1542
1575
  this.v1Buffers = new Map();
@@ -1559,7 +1592,7 @@ class ElectronBleTransport {
1559
1592
  (_a = this.v2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
1560
1593
  this.rejectProtocolV2Frames(uuid, new Error(reason));
1561
1594
  (_b = this.Log) === null || _b === void 0 ? void 0 : _b.debug('[Electron BLE] Protocol V2 link invalidated:', uuid, reason);
1562
- if (reason.startsWith('Protocol V2 link-fatal error:')) {
1595
+ if (!this.stopped && reason.startsWith('Protocol V2 link-fatal error:')) {
1563
1596
  yield this.releaseNative(uuid, { forceNative: true });
1564
1597
  }
1565
1598
  }),
@@ -1619,6 +1652,7 @@ class ElectronBleTransport {
1619
1652
  this.devicePacketCapacities.delete(deviceId);
1620
1653
  this.v1Buffers.delete(deviceId);
1621
1654
  this.v2Assemblers.delete(deviceId);
1655
+ this.lastV1ProbeFailedWithoutTimeout.delete(deviceId);
1622
1656
  this.resetProtocolV2Frames(deviceId);
1623
1657
  this.notificationTokens.delete(deviceId);
1624
1658
  if (this.runPromise && this.runPromiseDeviceId === deviceId) {
@@ -1639,6 +1673,8 @@ class ElectronBleTransport {
1639
1673
  }
1640
1674
  init(logger, emitter) {
1641
1675
  var _a, _b;
1676
+ this.stopped = false;
1677
+ this.stopPromise = undefined;
1642
1678
  this.Log = logger;
1643
1679
  this.emitter = emitter;
1644
1680
  if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
@@ -1647,6 +1683,44 @@ class ElectronBleTransport {
1647
1683
  this.subscribeHostDisconnects();
1648
1684
  (_b = this.Log) === null || _b === void 0 ? void 0 : _b.debug('[Electron BLE] Transport initialized');
1649
1685
  }
1686
+ assertRunning() {
1687
+ if (this.stopped) {
1688
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Electron BLE transport is stopped');
1689
+ }
1690
+ }
1691
+ stop() {
1692
+ var _a;
1693
+ this.stopped = true;
1694
+ (_a = this.hostDisconnectCleanup) === null || _a === void 0 ? void 0 : _a.call(this);
1695
+ this.hostDisconnectCleanup = undefined;
1696
+ if (!this.stopPromise) {
1697
+ this.stopPromise = this.stopResources();
1698
+ }
1699
+ return this.stopPromise;
1700
+ }
1701
+ stopResources() {
1702
+ return __awaiter(this, void 0, void 0, function* () {
1703
+ const trackedDeviceIds = new Set([
1704
+ ...this.connectedDevices,
1705
+ ...this.retainedDevices,
1706
+ ...this.acquiringDevices,
1707
+ ...this.notificationCleanups.keys(),
1708
+ ...this.mtuCleanups.keys(),
1709
+ ...this.deviceProtocol.keys(),
1710
+ ...this.v1Buffers.keys(),
1711
+ ...this.v2Assemblers.keys(),
1712
+ ]);
1713
+ yield Promise.all(Array.from(trackedDeviceIds, deviceId => this.releaseNative(deviceId)));
1714
+ this.acquiringDevices.clear();
1715
+ this.acquireGenerations.clear();
1716
+ this.lastV1ProbeFailedWithoutTimeout.clear();
1717
+ this.protocolV2CallCounts.clear();
1718
+ this.silentDetections.clear();
1719
+ yield this.protocolV2Links
1720
+ .dispose('Electron BLE transport stopped')
1721
+ .catch(error => { var _a; return (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] link dispose failed:', error); });
1722
+ });
1723
+ }
1650
1724
  subscribeHostDisconnects() {
1651
1725
  var _a, _b, _c;
1652
1726
  (_a = this.hostDisconnectCleanup) === null || _a === void 0 ? void 0 : _a.call(this);
@@ -1665,7 +1739,7 @@ class ElectronBleTransport {
1665
1739
  });
1666
1740
  }
1667
1741
  configure(signedData) {
1668
- this._messages = parseConfigure(signedData);
1742
+ this._messages = parseTransportConfigure(signedData);
1669
1743
  this.configured = true;
1670
1744
  }
1671
1745
  configureProtocolV2(signedData) {
@@ -1674,7 +1748,7 @@ class ElectronBleTransport {
1674
1748
  return;
1675
1749
  }
1676
1750
  const isReconfiguration = this.protocolV2SchemaConfiguration !== undefined;
1677
- this._messagesV2 = parseConfigure(signedData);
1751
+ this._messagesV2 = parseTransportConfigure(signedData);
1678
1752
  this.protocolV2SchemaConfiguration = configuration;
1679
1753
  if (isReconfiguration) {
1680
1754
  this.protocolV2Links
@@ -1708,12 +1782,26 @@ class ElectronBleTransport {
1708
1782
  });
1709
1783
  }
1710
1784
  acquire(input) {
1711
- var _a, _b, _c, _d, _e, _f, _g;
1785
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1712
1786
  return __awaiter(this, void 0, void 0, function* () {
1713
1787
  const { uuid, forceCleanRunPromise, expectedProtocol, forceProtocolDetection } = input;
1714
1788
  if (!uuid) {
1715
1789
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleRequiredUUID);
1716
1790
  }
1791
+ if ((_a = input.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
1792
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
1793
+ }
1794
+ const acquireGeneration = this.nextAcquireGeneration;
1795
+ this.nextAcquireGeneration += 1;
1796
+ this.acquireGenerations.set(uuid, acquireGeneration);
1797
+ const isCurrentAcquire = () => this.acquireGenerations.get(uuid) === acquireGeneration;
1798
+ const assertAcquireActive = () => {
1799
+ var _a;
1800
+ this.assertRunning();
1801
+ if (((_a = input.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) || !isCurrentAcquire()) {
1802
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
1803
+ }
1804
+ };
1717
1805
  const retainedToken = this.retainedDevices.has(uuid) &&
1718
1806
  !forceProtocolDetection &&
1719
1807
  (!expectedProtocol || expectedProtocol === 'V2') &&
@@ -1724,6 +1812,7 @@ class ElectronBleTransport {
1724
1812
  if (this.connectedDevices.has(uuid) && retainedToken === undefined) {
1725
1813
  yield this.release(uuid);
1726
1814
  }
1815
+ assertAcquireActive();
1727
1816
  if (forceCleanRunPromise && this.runPromise) {
1728
1817
  const error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleForceCleanRunPromise);
1729
1818
  this.runPromise.reject(error);
@@ -1731,11 +1820,13 @@ class ElectronBleTransport {
1731
1820
  this.runPromiseDeviceId = null;
1732
1821
  }
1733
1822
  this.acquiringDevices.add(uuid);
1823
+ let connectAttempted = false;
1734
1824
  try {
1735
- if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
1825
+ if (!((_b = window.desktopApi) === null || _b === void 0 ? void 0 : _b.nobleBle)) {
1736
1826
  throw new Error('Noble BLE API not available');
1737
1827
  }
1738
1828
  const device = yield invokeNobleBle(window.desktopApi.nobleBle.getDevice(uuid));
1829
+ assertAcquireActive();
1739
1830
  if (!device) {
1740
1831
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Device ${uuid} not found`);
1741
1832
  }
@@ -1747,17 +1838,20 @@ class ElectronBleTransport {
1747
1838
  }
1748
1839
  const protocolHint = expectedProtocol
1749
1840
  ? undefined
1750
- : (_b = input.protocolHint) !== null && _b !== void 0 ? _b : this.deviceProtocolHints.get(uuid);
1841
+ : (_c = input.protocolHint) !== null && _c !== void 0 ? _c : this.deviceProtocolHints.get(uuid);
1751
1842
  if (protocolHint) {
1752
1843
  this.deviceProtocolHints.set(uuid, protocolHint);
1753
1844
  }
1754
1845
  try {
1846
+ connectAttempted = true;
1755
1847
  yield invokeNobleBle(window.desktopApi.nobleBle.connect(uuid));
1848
+ assertAcquireActive();
1756
1849
  this.connectedDevices.add(uuid);
1757
1850
  }
1758
1851
  catch (error) {
1759
1852
  this.handleBluetoothError(error);
1760
1853
  }
1854
+ assertAcquireActive();
1761
1855
  const mtuCleanup = this.createMtuSubscription(uuid);
1762
1856
  if (mtuCleanup) {
1763
1857
  this.mtuCleanups.set(uuid, mtuCleanup);
@@ -1770,49 +1864,61 @@ class ElectronBleTransport {
1770
1864
  catch (error) {
1771
1865
  this.handleBluetoothError(error);
1772
1866
  }
1773
- yield this.refreshBlePacketCapacity(uuid);
1867
+ assertAcquireActive();
1868
+ const connectedDevice = yield this.refreshBlePacketCapacity(uuid);
1869
+ assertAcquireActive();
1870
+ const resolvedDeviceName = (connectedDevice === null || connectedDevice === void 0 ? void 0 : connectedDevice.name) || device.name;
1774
1871
  const cleanup = this.createNotificationSubscription(uuid);
1775
1872
  this.notificationCleanups.set(uuid, cleanup);
1776
- const protocolType = yield this.detectProtocol(uuid, expectedProtocol, protocolHint);
1873
+ const protocolType = yield this.detectProtocol(uuid, expectedProtocol, protocolHint, {
1874
+ isKnownLegacyV1Device: hdShared.isLegacyProtocolV1BleName(resolvedDeviceName),
1875
+ onlyConnectBleDevice: input.onlyConnectBleDevice,
1876
+ abortSignal: input.abortSignal,
1877
+ });
1878
+ assertAcquireActive();
1777
1879
  if (protocolType === 'V2') {
1778
- (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug('[Electron BLE] Protocol V2 write configured', {
1880
+ (_d = this.Log) === null || _d === void 0 ? void 0 : _d.debug('[Electron BLE] Protocol V2 write configured', {
1779
1881
  writeMode: 'withoutResponse',
1780
1882
  negotiatedMtu: this.deviceMtus.get(uuid),
1781
- packetCapacity: (_d = this.devicePacketCapacities.get(uuid)) !== null && _d !== void 0 ? _d : BLE_PACKET_SIZE_FALLBACK,
1883
+ packetCapacity: (_e = this.devicePacketCapacities.get(uuid)) !== null && _e !== void 0 ? _e : BLE_PACKET_SIZE_FALLBACK,
1782
1884
  });
1783
1885
  }
1784
- return Object.assign(Object.assign({}, toBleDescriptor({ id: device.id, name: device.name }, protocolType)), { uuid });
1886
+ return Object.assign(Object.assign({}, toBleDescriptor({ id: device.id, name: resolvedDeviceName }, protocolType)), { uuid });
1785
1887
  }
1786
1888
  catch (error) {
1787
- (_e = this.Log) === null || _e === void 0 ? void 0 : _e.error('[Electron BLE] acquire failed:', error);
1788
- try {
1789
- const nobleBle = (_f = window.desktopApi) === null || _f === void 0 ? void 0 : _f.nobleBle;
1790
- if (nobleBle) {
1791
- if (this.connectedDevices.has(uuid)) {
1792
- yield invokeNobleBle(nobleBle.unsubscribe(uuid)).catch(cleanupError => {
1793
- var _a;
1794
- (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] acquire unsubscribe failed:', cleanupError);
1795
- });
1889
+ (_f = this.Log) === null || _f === void 0 ? void 0 : _f.error('[Electron BLE] acquire failed:', error);
1890
+ if (isCurrentAcquire()) {
1891
+ try {
1892
+ const nobleBle = (_g = window.desktopApi) === null || _g === void 0 ? void 0 : _g.nobleBle;
1893
+ if (nobleBle && !this.stopped && (connectAttempted || this.connectedDevices.has(uuid))) {
1894
+ if (this.connectedDevices.has(uuid)) {
1895
+ yield invokeNobleBle(nobleBle.unsubscribe(uuid)).catch(cleanupError => {
1896
+ var _a;
1897
+ (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] acquire unsubscribe failed:', cleanupError);
1898
+ });
1899
+ }
1900
+ yield invokeNobleBle(nobleBle.disconnect(uuid));
1796
1901
  }
1797
- yield invokeNobleBle(nobleBle.disconnect(uuid));
1798
1902
  }
1903
+ catch (cleanupError) {
1904
+ (_h = this.Log) === null || _h === void 0 ? void 0 : _h.debug('[Electron BLE] acquire cleanup failed:', cleanupError);
1905
+ }
1906
+ this.cleanupDeviceState(uuid);
1799
1907
  }
1800
- catch (cleanupError) {
1801
- (_g = this.Log) === null || _g === void 0 ? void 0 : _g.debug('[Electron BLE] acquire cleanup failed:', cleanupError);
1802
- }
1803
- this.cleanupDeviceState(uuid);
1804
- this.handleBluetoothError(error);
1908
+ throw this.normalizeBluetoothError(error);
1805
1909
  }
1806
1910
  finally {
1807
- this.acquiringDevices.delete(uuid);
1911
+ if (isCurrentAcquire()) {
1912
+ this.acquiringDevices.delete(uuid);
1913
+ }
1808
1914
  }
1809
1915
  });
1810
1916
  }
1811
- release(id, onclose, keepSession) {
1917
+ release(id, onclose, keepSession, options) {
1812
1918
  var _a;
1813
1919
  return __awaiter(this, void 0, void 0, function* () {
1814
1920
  try {
1815
- const retainLink = keepSession === true &&
1921
+ const retainLink = (keepSession === true || (options === null || options === void 0 ? void 0 : options.retainLink) === true) &&
1816
1922
  !onclose &&
1817
1923
  this.connectedDevices.has(id) &&
1818
1924
  this.deviceProtocol.get(id) === 'V2' &&
@@ -1899,39 +2005,110 @@ class ElectronBleTransport {
1899
2005
  this.deviceProtocol.delete(uuid);
1900
2006
  }
1901
2007
  }
1902
- detectProtocol(uuid, expectedProtocol, protocolHint) {
1903
- var _a, _b, _c;
2008
+ detectProtocol(uuid, expectedProtocol, protocolHint, options = {}) {
2009
+ var _a, _b, _c, _d;
1904
2010
  return __awaiter(this, void 0, void 0, function* () {
2011
+ if ((_a = options.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
2012
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
2013
+ }
1905
2014
  if (expectedProtocol === 'V1') {
1906
2015
  this.deviceProtocol.set(uuid, 'V1');
1907
- (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> V1 (expected, no probe)`);
2016
+ (_b = this.Log) === null || _b === void 0 ? void 0 : _b.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> V1 (expected, no probe)`);
1908
2017
  return 'V1';
1909
2018
  }
1910
2019
  if (expectedProtocol === 'V2') {
1911
2020
  if (yield this.probeProtocolV2(uuid, expectedProtocol)) {
1912
2021
  this.deviceProtocol.set(uuid, 'V2');
1913
- (_b = this.Log) === null || _b === void 0 ? void 0 : _b.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> V2 (expected)`);
2022
+ (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> V2 (expected)`);
1914
2023
  return 'V2';
1915
2024
  }
1916
2025
  throw this.createProtocolMismatchError(expectedProtocol);
1917
2026
  }
1918
2027
  const probeOrder = protocolHint === 'V2' || this.deviceProtocol.get(uuid) === 'V2' ? ['V2', 'V1'] : ['V1', 'V2'];
1919
2028
  for (let i = 0; i < probeOrder.length; i += 1) {
2029
+ this.assertRunning();
1920
2030
  const protocol = probeOrder[i];
1921
2031
  if (i > 0) {
1922
2032
  yield this.resetProbeStateAfterProtocolProbe(uuid, probeOrder[i - 1]);
2033
+ this.assertRunning();
1923
2034
  }
1924
- const detected = protocol === 'V1' ? yield this.probeProtocolV1(uuid) : yield this.probeProtocolV2(uuid);
2035
+ this.lastV1ProbeFailedWithoutTimeout.delete(uuid);
2036
+ let detected = protocol === 'V1' ? yield this.probeProtocolV1(uuid) : yield this.probeProtocolV2(uuid);
2037
+ if (!detected && protocol === 'V1' && !this.lastV1ProbeFailedWithoutTimeout.has(uuid)) {
2038
+ detected = yield this.wakeSilentProtocolV1Device(uuid, probeOrder, options);
2039
+ }
2040
+ this.assertRunning();
1925
2041
  if (detected) {
1926
2042
  this.deviceProtocol.set(uuid, protocol);
1927
- (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> ${protocol}`);
2043
+ this.silentDetections.delete(uuid);
2044
+ (_d = this.Log) === null || _d === void 0 ? void 0 : _d.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> ${protocol}`);
1928
2045
  return protocol;
1929
2046
  }
1930
2047
  }
2048
+ if (!this.silentDetections.has(uuid)) {
2049
+ this.silentDetections.set(uuid, 'silent');
2050
+ }
1931
2051
  this.deviceProtocol.delete(uuid);
1932
2052
  throw this.createProtocolDetectionError();
1933
2053
  });
1934
2054
  }
2055
+ wakeSilentProtocolV1Device(uuid, probeOrder, options = {}) {
2056
+ var _a, _b, _c, _d, _e;
2057
+ return __awaiter(this, void 0, void 0, function* () {
2058
+ if (options.onlyConnectBleDevice ||
2059
+ probeOrder[0] !== 'V1' ||
2060
+ this.silentDetections.get(uuid) === 'woken' ||
2061
+ (!options.isKnownLegacyV1Device && this.silentDetections.get(uuid) !== 'silent')) {
2062
+ return false;
2063
+ }
2064
+ if ((_a = options.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
2065
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
2066
+ }
2067
+ this.assertRunning();
2068
+ yield this.resetProbeStateAfterProtocolProbe(uuid, 'V1');
2069
+ if ((_b = options.abortSignal) === null || _b === void 0 ? void 0 : _b.aborted) {
2070
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
2071
+ }
2072
+ this.assertRunning();
2073
+ const previousSilentState = this.silentDetections.get(uuid);
2074
+ this.silentDetections.set(uuid, 'woken');
2075
+ (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug('[Electron BLE] sending Protocol V1 Initialize wake', {
2076
+ connectIdSuffix: uuid.slice(-8),
2077
+ source: options.isKnownLegacyV1Device ? 'legacy-v1-name' : 'silent-retry',
2078
+ });
2079
+ let answeredV1 = false;
2080
+ try {
2081
+ this.deviceProtocol.set(uuid, 'V1');
2082
+ const response = yield this.callProtocolV1(uuid, 'Initialize', {}, { timeoutMs: PROTOCOL_PROBE_TIMEOUT_MS }, { oneShot: true }, true);
2083
+ answeredV1 = typeof (response === null || response === void 0 ? void 0 : response.type) === 'string';
2084
+ }
2085
+ catch (error) {
2086
+ this.clearProbeProtocol(uuid, 'V1');
2087
+ if (isUnstartedElectronWakeError(error)) {
2088
+ if (previousSilentState) {
2089
+ this.silentDetections.set(uuid, previousSilentState);
2090
+ }
2091
+ else {
2092
+ this.silentDetections.delete(uuid);
2093
+ }
2094
+ }
2095
+ (_d = this.Log) === null || _d === void 0 ? void 0 : _d.debug('[Electron BLE] Protocol V1 Initialize wake failed:', error);
2096
+ if (shouldRethrowElectronProtocolProbeError(error)) {
2097
+ throw error;
2098
+ }
2099
+ }
2100
+ if (answeredV1) {
2101
+ return true;
2102
+ }
2103
+ if ((_e = options.abortSignal) === null || _e === void 0 ? void 0 : _e.aborted) {
2104
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
2105
+ }
2106
+ this.assertRunning();
2107
+ yield this.resetProbeStateAfterProtocolProbe(uuid, 'V1');
2108
+ this.assertRunning();
2109
+ return this.probeProtocolV1(uuid);
2110
+ });
2111
+ }
1935
2112
  createNotificationSubscription(uuid) {
1936
2113
  var _a;
1937
2114
  if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
@@ -1973,15 +2150,19 @@ class ElectronBleTransport {
1973
2150
  }
1974
2151
  try {
1975
2152
  this.deviceProtocol.set(uuid, 'V1');
1976
- yield this.callProtocolV1(uuid, 'GetFeatures', {}, { timeoutMs: PROTOCOL_PROBE_TIMEOUT_MS });
2153
+ this.lastV1ProbeFailedWithoutTimeout.delete(uuid);
2154
+ yield this.callProtocolV1(uuid, 'GetFeatures', {}, { timeoutMs: PROTOCOL_PROBE_TIMEOUT_MS }, { oneShot: true }, true);
1977
2155
  return true;
1978
2156
  }
1979
2157
  catch (error) {
1980
2158
  this.clearProbeProtocol(uuid, 'V1');
1981
2159
  (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] Protocol V1 GetFeatures probe failed:', error);
1982
- if (transport.isProtocolV2LinkDisabledError(error)) {
2160
+ if (shouldRethrowElectronProtocolProbeError(error)) {
1983
2161
  throw error;
1984
2162
  }
2163
+ if (!(error instanceof Error && this.probeResponseTimeoutErrors.has(error))) {
2164
+ this.lastV1ProbeFailedWithoutTimeout.add(uuid);
2165
+ }
1985
2166
  return false;
1986
2167
  }
1987
2168
  });
@@ -2015,12 +2196,14 @@ class ElectronBleTransport {
2015
2196
  writeOnce(uuid, hexData) {
2016
2197
  var _a;
2017
2198
  return __awaiter(this, void 0, void 0, function* () {
2199
+ this.assertRunning();
2018
2200
  const nobleBle = (_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle;
2019
2201
  if (!nobleBle) {
2020
2202
  throw new Error('Noble BLE API not available');
2021
2203
  }
2022
2204
  try {
2023
2205
  yield invokeNobleBle(nobleBle.write(uuid, hexData, { pacingDelayMs: 0 }));
2206
+ this.assertRunning();
2024
2207
  }
2025
2208
  catch (error) {
2026
2209
  this.handleBluetoothError(error);
@@ -2033,6 +2216,7 @@ class ElectronBleTransport {
2033
2216
  const nobleBle = (_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle;
2034
2217
  const device = nobleBle ? yield invokeNobleBle(nobleBle.getDevice(uuid)) : undefined;
2035
2218
  this.updateBlePacketCapacity(uuid, device === null || device === void 0 ? void 0 : device.mtu);
2219
+ return device;
2036
2220
  });
2037
2221
  }
2038
2222
  updateBlePacketCapacity(uuid, mtu) {
@@ -2224,7 +2408,7 @@ class ElectronBleTransport {
2224
2408
  yield this.callProtocolV1(uuid, name, data);
2225
2409
  });
2226
2410
  }
2227
- callProtocolV1(uuid, name, data, options) {
2411
+ callProtocolV1(uuid, name, data, options, writeOptions, isProtocolProbe = false) {
2228
2412
  var _a, _b;
2229
2413
  return __awaiter(this, void 0, void 0, function* () {
2230
2414
  if (!this._messages) {
@@ -2241,6 +2425,7 @@ class ElectronBleTransport {
2241
2425
  const messages = this._messages;
2242
2426
  const buffers = ProtocolV1.encodeTransportPackets(messages, name, data);
2243
2427
  let timeout;
2428
+ let responseTimedOut = false;
2244
2429
  try {
2245
2430
  if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
2246
2431
  throw new Error('Noble BLE write API not available');
@@ -2254,13 +2439,16 @@ class ElectronBleTransport {
2254
2439
  if (hexString.length === 0) {
2255
2440
  throw new Error(`Buffer ${i + 1} is empty`);
2256
2441
  }
2257
- yield invokeNobleBle(window.desktopApi.nobleBle.write(uuid, hexString));
2442
+ yield invokeNobleBle(writeOptions
2443
+ ? window.desktopApi.nobleBle.write(uuid, hexString, writeOptions)
2444
+ : window.desktopApi.nobleBle.write(uuid, hexString));
2258
2445
  }
2259
2446
  const response = yield Promise.race([
2260
2447
  runPromise.promise,
2261
2448
  new Promise((_, reject) => {
2262
2449
  if (options === null || options === void 0 ? void 0 : options.timeoutMs) {
2263
2450
  timeout = setTimeout(() => {
2451
+ responseTimedOut = true;
2264
2452
  const error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleTimeoutError, `BLE response timeout after ${options.timeoutMs}ms for ${name}`);
2265
2453
  runPromise.reject(error);
2266
2454
  reject(error);
@@ -2276,18 +2464,21 @@ class ElectronBleTransport {
2276
2464
  }
2277
2465
  catch (e) {
2278
2466
  (_b = this.Log) === null || _b === void 0 ? void 0 : _b.error('[Electron BLE] Protocol V1 call error:', e);
2279
- const isProbeTimeout = name === 'GetFeatures' && (options === null || options === void 0 ? void 0 : options.timeoutMs) === PROTOCOL_PROBE_TIMEOUT_MS;
2280
2467
  if ((e === null || e === void 0 ? void 0 : e.errorCode) === hdShared.HardwareErrorCode.BleTimeoutError) {
2281
2468
  this.v1Buffers.set(uuid, { buffer: [], bufferLength: 0 });
2282
2469
  const notifyCleanup = this.notificationCleanups.get(uuid);
2283
2470
  notifyCleanup === null || notifyCleanup === void 0 ? void 0 : notifyCleanup();
2284
2471
  this.notificationCleanups.delete(uuid);
2285
2472
  this.notificationTokens.delete(uuid);
2286
- if (!isProbeTimeout) {
2473
+ if (!isProtocolProbe) {
2287
2474
  yield this.releaseNative(uuid, { forceNative: true });
2288
2475
  }
2289
2476
  }
2290
- throw this.normalizeBluetoothError(e);
2477
+ const normalized = this.normalizeBluetoothError(e);
2478
+ if (isProtocolProbe && responseTimedOut && normalized instanceof Error) {
2479
+ this.probeResponseTimeoutErrors.add(normalized);
2480
+ }
2481
+ throw normalized;
2291
2482
  }
2292
2483
  finally {
2293
2484
  if (timeout)
package/dist/webusb.d.ts CHANGED
@@ -18,8 +18,8 @@ export default class WebUsbTransport extends ProtocolV2UsbTransportBase<string>
18
18
  private handleOperationSequence;
19
19
  private deviceLogSequence;
20
20
  private deviceLogIds;
21
- messages: ReturnType<typeof transport.parseConfigure> | undefined;
22
- messagesV2: ReturnType<typeof transport.parseConfigure> | undefined;
21
+ messages: ReturnType<typeof transport.parseTransportConfigure> | undefined;
22
+ messagesV2: ReturnType<typeof transport.parseTransportConfigure> | undefined;
23
23
  private protocolV2SchemaSource;
24
24
  private deviceProtocol;
25
25
  private confirmedDeviceProtocols;
@@ -1 +1 @@
1
- {"version":3,"file":"webusb.d.ts","sourceRoot":"","sources":["../src/webusb.ts"],"names":[],"mappings":";;AACA,OAAO,SAAS,EAAE,EAQhB,0BAA0B,EAG3B,MAAM,wBAAwB,CAAC;AAahC,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,oBAA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;YAsBf,mBAAmB;YA+CnB,cAAc;YAad,yBAAyB;YAKzB,yBAAyB;YAMzB,uBAAuB;YA0CvB,eAAe;YAqBf,eAAe;IAiBvB,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB;YA2BlB,cAAc;YAkCd,cAAc;IAkBtB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IA+C5C,OAAO,CAAC,IAAI,EAAE,MAAM;IA8B1B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB;IAUtD,SAAS,CAAC,sBAAsB;cAIhB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;cAIA,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC;cASN,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKrE,SAAS,CAAC,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;IAWjF,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-web-device",
3
- "version": "1.2.11-alpha.2",
3
+ "version": "1.2.11-alpha.21",
4
4
  "author": "OneKey",
5
5
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
6
6
  "license": "MIT",
@@ -21,13 +21,14 @@
21
21
  "lint:fix": "eslint . --fix"
22
22
  },
23
23
  "dependencies": {
24
- "@onekeyfe/hd-shared": "1.2.11-alpha.2",
25
- "@onekeyfe/hd-transport": "1.2.11-alpha.2"
24
+ "@onekeyfe/hd-shared": "1.2.11-alpha.21",
25
+ "@onekeyfe/hd-transport": "1.2.11-alpha.21",
26
+ "bytebuffer": "^5.0.1"
26
27
  },
27
28
  "devDependencies": {
28
- "@onekeyfe/hd-transport-electron": "1.2.11-alpha.2",
29
+ "@onekeyfe/hd-transport-electron": "1.2.11-alpha.21",
29
30
  "@types/w3c-web-usb": "^1.0.6",
30
31
  "@types/web-bluetooth": "^0.0.17"
31
32
  },
32
- "gitHead": "4c3d7c0222a3708521b6a7701d5740ff8253c28f"
33
+ "gitHead": "3f09b63248967f5b5b18eca9cdd2ad3bceabf23e"
33
34
  }