@onekeyfe/hd-transport-web-device 1.2.0-alpha.185 → 1.2.0-alpha.186
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";AA2BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAIvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB;CACF;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAiCF,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,OAAO,CAAC,SAAS,CAA0D;IAE3E,OAAO,CAAC,WAAW,CAA0D;IAE7E,OAAO,CAAC,6BAA6B,CAAqB;IAE1D,IAAI,SAA0B;IAE9B,UAAU,UAAS;IAEnB,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,IAAI,CAAQ;IAExD,OAAO,CAAC,kBAAkB,CAAuB;IAEjD,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,OAAO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CAAiC;YAwBjC,eAAe;YAqBf,eAAe;YAyBf,SAAS;YAiBT,wBAAwB;IAKtC,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,kBAAkB;IA+B1B,OAAO,CAAC,iCAAiC;IAazC,OAAO,CAAC,4BAA4B;IAkBpC,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,sBAAsB;YAShB,mBAAmB;IAiBjC,OAAO,CAAC,4BAA4B;IAqB9B,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB;IAuB1B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;YAatD,cAAc;YAqFd,cAAc;IA0B5B,OAAO,CAAC,uBAAuB;IAyC/B,OAAO,CAAC,6BAA6B;IA4CrC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
|
package/dist/index.js
CHANGED
|
@@ -821,7 +821,7 @@ function resolveBlePacketCapacity(mtu, maximumPacketCapacity, fallbackPacketCapa
|
|
|
821
821
|
return Math.min(maximumPacketCapacity, Math.floor(mtu) - BLE_ATT_HEADER_BYTES);
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
const { parseConfigure, ProtocolV1,
|
|
824
|
+
const { parseConfigure, ProtocolV1, check } = transport__default["default"];
|
|
825
825
|
const toBleDescriptor = (device, protocolType) => (Object.assign({ id: device.id, name: device.name, path: device.id, debug: false, commType: 'electron-ble' }, (protocolType ? { protocolType } : {})));
|
|
826
826
|
const BLE_PACKET_SIZE_FALLBACK = 192;
|
|
827
827
|
const BLE_PACKET_SIZE_MAXIMUM = 244;
|
|
@@ -1385,28 +1385,16 @@ class ElectronBleTransport {
|
|
|
1385
1385
|
this.handleProtocolV1Notification(deviceId, hexData);
|
|
1386
1386
|
}
|
|
1387
1387
|
readProtocolV2LinkDisabledFailure(deviceId, hexData) {
|
|
1388
|
-
var _a, _b;
|
|
1389
1388
|
if (!this._messages || !this._messagesV2)
|
|
1390
1389
|
return undefined;
|
|
1391
1390
|
const assembler = this.v2Assemblers.get(deviceId);
|
|
1392
1391
|
if (!assembler)
|
|
1393
1392
|
return undefined;
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
const firmwareMessage = (_b = response.message) === null || _b === void 0 ? void 0 : _b.message;
|
|
1400
|
-
if (transport.isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
1401
|
-
return transport.createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
catch (_c) {
|
|
1407
|
-
assembler.reset();
|
|
1408
|
-
}
|
|
1409
|
-
return undefined;
|
|
1393
|
+
return transport.detectProtocolV2LinkDisabledError({
|
|
1394
|
+
schemas: { protocolV1: this._messages, protocolV2: this._messagesV2 },
|
|
1395
|
+
assembler,
|
|
1396
|
+
bytes: transport.hexToBytes(hexData),
|
|
1397
|
+
});
|
|
1410
1398
|
}
|
|
1411
1399
|
handleProtocolV2Notification(deviceId, hexData) {
|
|
1412
1400
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-web-device",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.186",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"lint:fix": "eslint . --fix"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
25
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
24
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.186",
|
|
25
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.186"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@onekeyfe/hd-transport-electron": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-transport-electron": "1.2.0-alpha.186",
|
|
29
29
|
"@types/w3c-web-usb": "^1.0.6",
|
|
30
30
|
"@types/web-bluetooth": "^0.0.17"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d4b7f8e0e308ed4b95b1d82e385e1ec4b3e0e3f6"
|
|
33
33
|
}
|
|
@@ -6,10 +6,9 @@ import transport, {
|
|
|
6
6
|
ProtocolV2LinkManager,
|
|
7
7
|
TRANSPORT_EVENT,
|
|
8
8
|
bytesToHex,
|
|
9
|
-
|
|
9
|
+
detectProtocolV2LinkDisabledError,
|
|
10
10
|
hexToBytes,
|
|
11
11
|
isProtocolV2LinkDisabledError,
|
|
12
|
-
isProtocolV2LinkDisabledFailure,
|
|
13
12
|
probeProtocolV2 as probeProtocolV2Helper,
|
|
14
13
|
writeProtocolV2BleFrame,
|
|
15
14
|
} from '@onekeyfe/hd-transport';
|
|
@@ -36,7 +35,7 @@ import type {
|
|
|
36
35
|
} from '@onekeyfe/hd-transport';
|
|
37
36
|
import type EventEmitter from 'events';
|
|
38
37
|
|
|
39
|
-
const { parseConfigure, ProtocolV1,
|
|
38
|
+
const { parseConfigure, ProtocolV1, check } = transport;
|
|
40
39
|
|
|
41
40
|
declare global {
|
|
42
41
|
interface Window {
|
|
@@ -769,27 +768,11 @@ export default class ElectronBleTransport {
|
|
|
769
768
|
const assembler = this.v2Assemblers.get(deviceId);
|
|
770
769
|
if (!assembler) return undefined;
|
|
771
770
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
frame
|
|
778
|
-
)
|
|
779
|
-
);
|
|
780
|
-
if (response.type === 'Failure') {
|
|
781
|
-
const failureCode = response.message?.code;
|
|
782
|
-
const firmwareMessage = response.message?.message;
|
|
783
|
-
if (isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
784
|
-
return createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
} catch {
|
|
789
|
-
// A normal Protocol V1 notification is not a Protocol V2 frame.
|
|
790
|
-
assembler.reset();
|
|
791
|
-
}
|
|
792
|
-
return undefined;
|
|
771
|
+
return detectProtocolV2LinkDisabledError({
|
|
772
|
+
schemas: { protocolV1: this._messages, protocolV2: this._messagesV2 },
|
|
773
|
+
assembler,
|
|
774
|
+
bytes: hexToBytes(hexData),
|
|
775
|
+
});
|
|
793
776
|
}
|
|
794
777
|
|
|
795
778
|
private handleProtocolV2Notification(deviceId: string, hexData: string): void {
|