@onekeyfe/hd-transport-react-native 0.1.59 → 0.2.1
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 +8 -4
- package/package.json +4 -4
- package/src/index.ts +8 -6
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,sBAAsB,CAAC;AAE9B,OAAO,SAAiC,MAAM,wBAAwB,CAAC;AACvE,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;IA2ET,OAAO,CAAC,KAAK,EAAE,eAAe;;;IAgMpC,sBAAsB,CAAC,cAAc,EAA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+439,15 @@ class ReactNativeBleTransport {
|
|
|
439
439
|
let bufferLength = 0;
|
|
440
440
|
let buffer$1 = [];
|
|
441
441
|
const subscription = characteristic.monitor((error, c) => {
|
|
442
|
-
var _a, _b, _c;
|
|
442
|
+
var _a, _b, _c, _d;
|
|
443
443
|
if (error) {
|
|
444
444
|
this.Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
|
|
445
445
|
if (this.runPromise) {
|
|
446
|
-
|
|
446
|
+
let ERROR = hdShared.HardwareErrorCode.BleCharacteristicNotifyError;
|
|
447
|
+
if ((_a = error.reason) === null || _a === void 0 ? void 0 : _a.includes('The connection has timed out unexpectedly')) {
|
|
448
|
+
ERROR = hdShared.HardwareErrorCode.BleTimeoutError;
|
|
449
|
+
}
|
|
450
|
+
this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_b = error.reason) !== null && _b !== void 0 ? _b : error.message));
|
|
447
451
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
448
452
|
}
|
|
449
453
|
return;
|
|
@@ -464,12 +468,12 @@ class ReactNativeBleTransport {
|
|
|
464
468
|
const value = buffer.Buffer.from(buffer$1);
|
|
465
469
|
bufferLength = 0;
|
|
466
470
|
buffer$1 = [];
|
|
467
|
-
(
|
|
471
|
+
(_c = this.runPromise) === null || _c === void 0 ? void 0 : _c.resolve(value.toString('hex'));
|
|
468
472
|
}
|
|
469
473
|
}
|
|
470
474
|
catch (error) {
|
|
471
475
|
this.Log.debug('monitor data error: ', error);
|
|
472
|
-
(
|
|
476
|
+
(_d = this.runPromise) === null || _d === void 0 ? void 0 : _d.reject(error);
|
|
473
477
|
}
|
|
474
478
|
});
|
|
475
479
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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": "^0.1
|
|
23
|
-
"@onekeyfe/hd-transport": "^0.1
|
|
22
|
+
"@onekeyfe/hd-shared": "^0.2.1",
|
|
23
|
+
"@onekeyfe/hd-transport": "^0.2.1",
|
|
24
24
|
"react-native-ble-manager": "^8.1.0",
|
|
25
25
|
"react-native-ble-plx": "^2.0.3"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "2ed876d7027dd9c59a5d742648c2355cc595fd2f"
|
|
28
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -368,12 +368,14 @@ export default class ReactNativeBleTransport {
|
|
|
368
368
|
}`
|
|
369
369
|
);
|
|
370
370
|
if (this.runPromise) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
371
|
+
let ERROR:
|
|
372
|
+
| typeof HardwareErrorCode.BleCharacteristicNotifyError
|
|
373
|
+
| typeof HardwareErrorCode.BleTimeoutError =
|
|
374
|
+
HardwareErrorCode.BleCharacteristicNotifyError;
|
|
375
|
+
if (error.reason?.includes('The connection has timed out unexpectedly')) {
|
|
376
|
+
ERROR = HardwareErrorCode.BleTimeoutError;
|
|
377
|
+
}
|
|
378
|
+
this.runPromise.reject(ERRORS.TypedError(ERROR, error.reason ?? error.message));
|
|
377
379
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
378
380
|
}
|
|
379
381
|
return;
|