@onekeyfe/hd-transport-react-native 1.0.7 → 1.0.8-alpha.0

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":"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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AAC;IA+FpE,IAAI;IAIJ,MAAM;CAOP"}
package/dist/index.js CHANGED
@@ -174,6 +174,7 @@ const transportCache = {};
174
174
  let connectOptions = {
175
175
  requestMTU: 256,
176
176
  timeout: 3000,
177
+ refreshGatt: 'OnConnected',
177
178
  };
178
179
  const tryToGetConfiguration = (device) => {
179
180
  if (!device || !device.serviceUUIDs)
@@ -461,7 +462,7 @@ class ReactNativeBleTransport {
461
462
  let bufferLength = 0;
462
463
  let buffer$1 = [];
463
464
  const subscription = characteristic.monitor((error, c) => {
464
- var _a, _b, _c, _d, _e;
465
+ var _a, _b, _c, _d, _e, _f, _g, _h;
465
466
  if (error) {
466
467
  this.Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
467
468
  if (this.runPromise) {
@@ -472,7 +473,13 @@ class ReactNativeBleTransport {
472
473
  if ((_b = error.reason) === null || _b === void 0 ? void 0 : _b.includes('Encryption is insufficient')) {
473
474
  ERROR = hdShared.HardwareErrorCode.BleDeviceBondError;
474
475
  }
475
- this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_c = error.reason) !== null && _c !== void 0 ? _c : error.message));
476
+ if (((_c = error.reason) === null || _c === void 0 ? void 0 : _c.includes('Cannot write client characteristic config descriptor')) ||
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));
476
483
  this.Log.debug(': monitor notify error, and has unreleased Promise');
477
484
  }
478
485
  return;
@@ -493,12 +500,12 @@ class ReactNativeBleTransport {
493
500
  const value = buffer.Buffer.from(buffer$1);
494
501
  bufferLength = 0;
495
502
  buffer$1 = [];
496
- (_d = this.runPromise) === null || _d === void 0 ? void 0 : _d.resolve(value.toString('hex'));
503
+ (_g = this.runPromise) === null || _g === void 0 ? void 0 : _g.resolve(value.toString('hex'));
497
504
  }
498
505
  }
499
506
  catch (error) {
500
507
  this.Log.debug('monitor data error: ', error);
501
- (_e = this.runPromise) === null || _e === void 0 ? void 0 : _e.reject(error);
508
+ (_h = this.runPromise) === null || _h === void 0 ? void 0 : _h.reject(error);
502
509
  }
503
510
  });
504
511
  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.8-alpha.0",
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.0",
22
+ "@onekeyfe/hd-shared": "^1.0.8-alpha.0",
23
+ "@onekeyfe/hd-transport": "^1.0.8-alpha.0",
24
+ "@onekeyfe/react-native-ble-plx": "3.0.1",
25
25
  "react-native-ble-manager": "^8.1.0"
26
26
  },
27
- "gitHead": "8b08f905e7426fac23b5cf9ec55eb336278f0e3b"
27
+ "gitHead": "5e68522825bfe3e42fac05c795fbee6caa7cc260"
28
28
  }
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ const transportCache: Record<string, any> = {};
32
32
  let connectOptions: Record<string, unknown> = {
33
33
  requestMTU: 256,
34
34
  timeout: 3000,
35
+ refreshGatt: 'OnConnected',
35
36
  };
36
37
 
37
38
  const tryToGetConfiguration = (device: Device) => {
@@ -405,6 +406,21 @@ export default class ReactNativeBleTransport {
405
406
  if (error.reason?.includes('Encryption is insufficient')) {
406
407
  ERROR = HardwareErrorCode.BleDeviceBondError;
407
408
  }
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
+ }
408
424
  this.runPromise.reject(ERRORS.TypedError(ERROR, error.reason ?? error.message));
409
425
  this.Log.debug(': monitor notify error, and has unreleased Promise');
410
426
  }