@onekeyfe/hd-transport-react-native 1.0.7-alpha.4 → 1.0.7
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.map +1 -1
- package/dist/index.js +4 -11
- package/package.json +5 -5
- package/src/index.ts +0 -16
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,UAAU,IAAI,aAAa,EAC3B,MAAM,EAEN,cAAc,EAEf,MAAM,gCAAgC,CAAC;AAExC,OAAO,SAAkD,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAkB,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAavC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,UAAU,IAAI,aAAa,EAC3B,MAAM,EAEN,cAAc,EAEf,MAAM,gCAAgC,CAAC;AAExC,OAAO,SAAkD,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAkB,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAavC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmBjE,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAC1C,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEzC,SAAS,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IAEnE,UAAU,UAAS;IAEnB,OAAO,UAAS;IAEhB,WAAW,SAAQ;IAEnB,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAExC,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,OAAO,CAAC,EAAE,YAAY,CAAC;gBAEX,OAAO,EAAE,gBAAgB;IAIrC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY;IAKvC,SAAS,CAAC,UAAU,EAAE,GAAG;IAMzB,MAAM;IAIN,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAYjC,SAAS;IA6FT,OAAO,CAAC,KAAK,EAAE,eAAe;;;IAwMpC,sBAAsB,CAAC,cAAc,EAAE,cAAc;IAkE/C,OAAO,CAAC,IAAI,EAAE,MAAM;IAepB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA+FpE,IAAI;IAIJ,MAAM;CAOP"}
|
package/dist/index.js
CHANGED
|
@@ -174,7 +174,6 @@ const transportCache = {};
|
|
|
174
174
|
let connectOptions = {
|
|
175
175
|
requestMTU: 256,
|
|
176
176
|
timeout: 3000,
|
|
177
|
-
refreshGatt: 'OnConnected',
|
|
178
177
|
};
|
|
179
178
|
const tryToGetConfiguration = (device) => {
|
|
180
179
|
if (!device || !device.serviceUUIDs)
|
|
@@ -462,7 +461,7 @@ class ReactNativeBleTransport {
|
|
|
462
461
|
let bufferLength = 0;
|
|
463
462
|
let buffer$1 = [];
|
|
464
463
|
const subscription = characteristic.monitor((error, c) => {
|
|
465
|
-
var _a, _b, _c, _d, _e
|
|
464
|
+
var _a, _b, _c, _d, _e;
|
|
466
465
|
if (error) {
|
|
467
466
|
this.Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
|
|
468
467
|
if (this.runPromise) {
|
|
@@ -473,13 +472,7 @@ class ReactNativeBleTransport {
|
|
|
473
472
|
if ((_b = error.reason) === null || _b === void 0 ? void 0 : _b.includes('Encryption is insufficient')) {
|
|
474
473
|
ERROR = hdShared.HardwareErrorCode.BleDeviceBondError;
|
|
475
474
|
}
|
|
476
|
-
|
|
477
|
-
((_d = error.reason) === null || _d === void 0 ? void 0 : _d.includes('Cannot find client characteristic config descriptor'))) {
|
|
478
|
-
this.runPromise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure, (_e = error.message) !== null && _e !== void 0 ? _e : error.reason));
|
|
479
|
-
this.Log.debug(`${hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure} ${error.message} ${error.reason}`);
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_f = error.reason) !== null && _f !== void 0 ? _f : error.message));
|
|
475
|
+
this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_c = error.reason) !== null && _c !== void 0 ? _c : error.message));
|
|
483
476
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
484
477
|
}
|
|
485
478
|
return;
|
|
@@ -500,12 +493,12 @@ class ReactNativeBleTransport {
|
|
|
500
493
|
const value = buffer.Buffer.from(buffer$1);
|
|
501
494
|
bufferLength = 0;
|
|
502
495
|
buffer$1 = [];
|
|
503
|
-
(
|
|
496
|
+
(_d = this.runPromise) === null || _d === void 0 ? void 0 : _d.resolve(value.toString('hex'));
|
|
504
497
|
}
|
|
505
498
|
}
|
|
506
499
|
catch (error) {
|
|
507
500
|
this.Log.debug('monitor data error: ', error);
|
|
508
|
-
(
|
|
501
|
+
(_e = this.runPromise) === null || _e === void 0 ? void 0 : _e.reject(error);
|
|
509
502
|
}
|
|
510
503
|
});
|
|
511
504
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "1.0.7
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"lint:fix": "eslint . --fix"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@onekeyfe/hd-shared": "^1.0.7
|
|
23
|
-
"@onekeyfe/hd-transport": "^1.0.7
|
|
24
|
-
"@onekeyfe/react-native-ble-plx": "3.0.
|
|
22
|
+
"@onekeyfe/hd-shared": "^1.0.7",
|
|
23
|
+
"@onekeyfe/hd-transport": "^1.0.7",
|
|
24
|
+
"@onekeyfe/react-native-ble-plx": "3.0.0",
|
|
25
25
|
"react-native-ble-manager": "^8.1.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "8b08f905e7426fac23b5cf9ec55eb336278f0e3b"
|
|
28
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -32,7 +32,6 @@ const transportCache: Record<string, any> = {};
|
|
|
32
32
|
let connectOptions: Record<string, unknown> = {
|
|
33
33
|
requestMTU: 256,
|
|
34
34
|
timeout: 3000,
|
|
35
|
-
refreshGatt: 'OnConnected',
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
const tryToGetConfiguration = (device: Device) => {
|
|
@@ -406,21 +405,6 @@ export default class ReactNativeBleTransport {
|
|
|
406
405
|
if (error.reason?.includes('Encryption is insufficient')) {
|
|
407
406
|
ERROR = HardwareErrorCode.BleDeviceBondError;
|
|
408
407
|
}
|
|
409
|
-
if (
|
|
410
|
-
error.reason?.includes('Cannot write client characteristic config descriptor') ||
|
|
411
|
-
error.reason?.includes('Cannot find client characteristic config descriptor')
|
|
412
|
-
) {
|
|
413
|
-
this.runPromise.reject(
|
|
414
|
-
ERRORS.TypedError(
|
|
415
|
-
HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
416
|
-
error.message ?? error.reason
|
|
417
|
-
)
|
|
418
|
-
);
|
|
419
|
-
this.Log.debug(
|
|
420
|
-
`${HardwareErrorCode.BleCharacteristicNotifyChangeFailure} ${error.message} ${error.reason}`
|
|
421
|
-
);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
408
|
this.runPromise.reject(ERRORS.TypedError(ERROR, error.reason ?? error.message));
|
|
425
409
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
426
410
|
}
|