@onekeyfe/hd-transport-electron 1.2.0-alpha.180 → 1.2.0-alpha.181
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.
|
@@ -32,7 +32,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
32
32
|
|
|
33
33
|
function initNobleBleSupport(webContents) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const { setupNobleBleHandlers } = yield Promise.resolve().then(function () { return require('./noble-ble-handler-
|
|
35
|
+
const { setupNobleBleHandlers } = yield Promise.resolve().then(function () { return require('./noble-ble-handler-424cf446.js'); });
|
|
36
36
|
setupNobleBleHandlers(webContents);
|
|
37
37
|
});
|
|
38
38
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-e30b8ae0.js');
|
|
4
4
|
var hdShared = require('@onekeyfe/hd-shared');
|
|
5
5
|
var pRetry = require('p-retry');
|
|
6
6
|
|
|
@@ -1015,11 +1015,12 @@ function setupConnectionAndDiscoverServices(peripheral, deviceId, webContents) {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
catch (discoveryError) {
|
|
1017
1017
|
if (peripheral.state === 'connected') {
|
|
1018
|
-
logger === null || logger === void 0 ? void 0 : logger.error('[NobleBLE] Service discovery failed on a live link, dropping it
|
|
1018
|
+
logger === null || logger === void 0 ? void 0 : logger.error('[NobleBLE] Service discovery failed on a live link, dropping it before the fresh scan', discoveryError);
|
|
1019
1019
|
yield disconnectDevice(deviceId).catch(() => undefined);
|
|
1020
|
-
throw discoveryError;
|
|
1021
1020
|
}
|
|
1022
|
-
|
|
1021
|
+
else {
|
|
1022
|
+
logger === null || logger === void 0 ? void 0 : logger.error('[NobleBLE] Service discovery failed, attempting fresh scan...', discoveryError);
|
|
1023
|
+
}
|
|
1023
1024
|
return freshScanAndDiscover(deviceId, webContents);
|
|
1024
1025
|
}
|
|
1025
1026
|
});
|
|
@@ -1206,9 +1207,9 @@ function connectDevice(deviceId, webContents) {
|
|
|
1206
1207
|
}
|
|
1207
1208
|
catch (setupError) {
|
|
1208
1209
|
logger === null || logger === void 0 ? void 0 : logger.error('[NobleBLE] Connection setup failed:', setupError);
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1210
|
+
disconnectDevice(deviceId)
|
|
1211
|
+
.catch(() => undefined)
|
|
1212
|
+
.then(() => reject(setupError));
|
|
1212
1213
|
}
|
|
1213
1214
|
}));
|
|
1214
1215
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noble-ble-handler.d.ts","sourceRoot":"","sources":["../src/noble-ble-handler.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAA+B,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAoFhE,wBAAgB,+BAA+B,CAAC,OAAO,CAAC,EAAE,oBAAoB,UAI7E;
|
|
1
|
+
{"version":3,"file":"noble-ble-handler.d.ts","sourceRoot":"","sources":["../src/noble-ble-handler.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAA+B,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAoFhE,wBAAgB,+BAA+B,CAAC,OAAO,CAAC,EAAE,oBAAoB,UAI7E;AAswDD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAkMpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-electron",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.181",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"electron-log": ">=4.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-core": "1.2.0-alpha.
|
|
29
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
30
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-core": "1.2.0-alpha.181",
|
|
29
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.181",
|
|
30
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.181",
|
|
31
31
|
"@stoprocent/noble": "2.3.16",
|
|
32
32
|
"p-retry": "^4.6.2"
|
|
33
33
|
},
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"electron": "^25.0.0",
|
|
37
37
|
"typescript": "^5.3.3"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "cb79652ebe130ceb01490195aa8903715f267e36"
|
|
40
40
|
}
|
package/src/noble-ble-handler.ts
CHANGED
|
@@ -1431,21 +1431,24 @@ async function setupConnectionAndDiscoverServices(
|
|
|
1431
1431
|
try {
|
|
1432
1432
|
return await discoverServicesAndCharacteristicsWithRetry(peripheral, deviceId);
|
|
1433
1433
|
} catch (discoveryError) {
|
|
1434
|
-
// A connected peripheral does not advertise, so the fresh scan below
|
|
1435
|
-
// only run out its timeout. Drop the link
|
|
1436
|
-
//
|
|
1437
|
-
//
|
|
1438
|
-
//
|
|
1439
|
-
//
|
|
1434
|
+
// A connected peripheral does not advertise, so the fresh scan below would
|
|
1435
|
+
// only run out its timeout. Drop the link first, then rescan: the cold
|
|
1436
|
+
// reconnect is what recovers a device whose stack stopped serving its
|
|
1437
|
+
// application layer. Recover here rather than throwing to the caller —
|
|
1438
|
+
// one acquire pays ~2s for the rescan, while a thrown error costs the
|
|
1439
|
+
// renderer a full retry round trip.
|
|
1440
1440
|
if (peripheral.state === 'connected') {
|
|
1441
1441
|
logger?.error(
|
|
1442
|
-
'[NobleBLE] Service discovery failed on a live link, dropping it
|
|
1442
|
+
'[NobleBLE] Service discovery failed on a live link, dropping it before the fresh scan',
|
|
1443
1443
|
discoveryError
|
|
1444
1444
|
);
|
|
1445
1445
|
await disconnectDevice(deviceId).catch(() => undefined);
|
|
1446
|
-
|
|
1446
|
+
} else {
|
|
1447
|
+
logger?.error(
|
|
1448
|
+
'[NobleBLE] Service discovery failed, attempting fresh scan...',
|
|
1449
|
+
discoveryError
|
|
1450
|
+
);
|
|
1447
1451
|
}
|
|
1448
|
-
logger?.error('[NobleBLE] Service discovery failed, attempting fresh scan...', discoveryError);
|
|
1449
1452
|
return freshScanAndDiscover(deviceId, webContents);
|
|
1450
1453
|
}
|
|
1451
1454
|
}
|
|
@@ -1716,9 +1719,14 @@ async function connectDevice(deviceId: string, webContents: WebContents): Promis
|
|
|
1716
1719
|
resolve();
|
|
1717
1720
|
} catch (setupError) {
|
|
1718
1721
|
logger?.error('[NobleBLE] Connection setup failed:', setupError);
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
+
// Never reject from inside a raw disconnect callback: noble only fires
|
|
1723
|
+
// it on a real 'disconnect' event, so a peripheral that is already
|
|
1724
|
+
// down leaves this promise — and the renderer acquire awaiting it —
|
|
1725
|
+
// pending forever. disconnectDevice always settles (it no-ops on an
|
|
1726
|
+
// unknown peripheral and caps the confirm wait).
|
|
1727
|
+
disconnectDevice(deviceId)
|
|
1728
|
+
.catch(() => undefined)
|
|
1729
|
+
.then(() => reject(setupError));
|
|
1722
1730
|
}
|
|
1723
1731
|
});
|
|
1724
1732
|
});
|