@onekeyfe/hd-transport-react-native 1.1.27 → 1.1.29-alpha.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 +11 -3
- package/package.json +5 -5
- package/src/index.ts +10 -2
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,EAIL,UAAU,IAAI,aAAa,EAE5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAGhB,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAahC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkBjE,KAAK,0BAA0B,GAAG;IAChC,mBAAmB,EAAE,cAAc,CAAC;IACpC,oBAAoB,EAAE,cAAc,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAIL,UAAU,IAAI,aAAa,EAE5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAGhB,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAahC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBA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A4BpB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIjE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA6MpE,IAAI;IAIE,UAAU,CAAC,OAAO,EAAE,MAAM;IA0EhC,MAAM;CAOP"}
|
package/dist/index.js
CHANGED
|
@@ -222,6 +222,11 @@ const FIRMWARE_UPLOAD_RECONNECT_RETRY_DELAY_MS = 2000;
|
|
|
222
222
|
const ANDROID_FIRMWARE_UPLOAD_PACKET_LENGTH = 192;
|
|
223
223
|
const FIRMWARE_UPLOAD_WRITE_PACKET_CAPACITY = reactNative.Platform.OS === 'ios' ? IOS_PACKET_LENGTH : ANDROID_FIRMWARE_UPLOAD_PACKET_LENGTH;
|
|
224
224
|
const ANDROID_GATT_CONGESTED_STATUS = 143;
|
|
225
|
+
const getBleIdentityName = (device) => {
|
|
226
|
+
var _a, _b;
|
|
227
|
+
const localName = device === null || device === void 0 ? void 0 : device.localName;
|
|
228
|
+
return (_b = (_a = device === null || device === void 0 ? void 0 : device.name) !== null && _a !== void 0 ? _a : localName) !== null && _b !== void 0 ? _b : null;
|
|
229
|
+
};
|
|
225
230
|
const delay = (ms) => new Promise(resolve => {
|
|
226
231
|
setTimeout(resolve, ms);
|
|
227
232
|
});
|
|
@@ -456,10 +461,10 @@ class ReactNativeBleTransport {
|
|
|
456
461
|
return;
|
|
457
462
|
}
|
|
458
463
|
}
|
|
459
|
-
blePlxManager.startDeviceScan(
|
|
464
|
+
blePlxManager.startDeviceScan(getBluetoothServiceUuids(), {
|
|
460
465
|
scanMode: reactNativeBlePlx.ScanMode.LowLatency,
|
|
461
466
|
}, (error, device) => {
|
|
462
|
-
var _a
|
|
467
|
+
var _a;
|
|
463
468
|
if (error) {
|
|
464
469
|
Log === null || Log === void 0 ? void 0 : Log.debug('ble scan manager: ', blePlxManager);
|
|
465
470
|
Log === null || Log === void 0 ? void 0 : Log.debug('ble scan error: ', error);
|
|
@@ -480,7 +485,7 @@ class ReactNativeBleTransport {
|
|
|
480
485
|
}
|
|
481
486
|
return;
|
|
482
487
|
}
|
|
483
|
-
if (hdShared.isOnekeyDevice((
|
|
488
|
+
if (hdShared.isOnekeyDevice(getBleIdentityName(device), device === null || device === void 0 ? void 0 : device.id)) {
|
|
484
489
|
Log === null || Log === void 0 ? void 0 : Log.debug('search device start ======================');
|
|
485
490
|
const { name, localName, id } = device !== null && device !== void 0 ? device : {};
|
|
486
491
|
Log === null || Log === void 0 ? void 0 : Log.debug(`device name: ${name !== null && name !== void 0 ? name : ''}\nlocalName: ${localName !== null && localName !== void 0 ? localName : ''}\nid: ${id !== null && id !== void 0 ? id : ''}`);
|
|
@@ -490,6 +495,9 @@ class ReactNativeBleTransport {
|
|
|
490
495
|
});
|
|
491
496
|
getConnectedDeviceIds(getBluetoothServiceUuids()).then(devices => {
|
|
492
497
|
for (const device of devices) {
|
|
498
|
+
if (!hdShared.isOnekeyDevice(getBleIdentityName(device), device === null || device === void 0 ? void 0 : device.id)) {
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
493
501
|
Log === null || Log === void 0 ? void 0 : Log.debug('search connected peripheral: ', device.id);
|
|
494
502
|
addDevice(device);
|
|
495
503
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29-alpha.1",
|
|
4
4
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"lint:fix": "eslint . --fix"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@onekeyfe/hd-core": "1.1.
|
|
23
|
-
"@onekeyfe/hd-shared": "1.1.
|
|
24
|
-
"@onekeyfe/hd-transport": "1.1.
|
|
22
|
+
"@onekeyfe/hd-core": "1.1.29-alpha.1",
|
|
23
|
+
"@onekeyfe/hd-shared": "1.1.29-alpha.1",
|
|
24
|
+
"@onekeyfe/hd-transport": "1.1.29-alpha.1",
|
|
25
25
|
"@onekeyfe/react-native-ble-utils": "^0.1.4",
|
|
26
26
|
"react-native-ble-plx": "3.5.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "db793e686fecbecbfa72aab8fd35c70159a72e35"
|
|
29
29
|
}
|
package/src/index.ts
CHANGED
|
@@ -54,6 +54,11 @@ type ResolvedBleCharacteristics = {
|
|
|
54
54
|
notifyCharacteristic: Characteristic;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
const getBleIdentityName = (device?: { name?: string | null } | null): string | null => {
|
|
58
|
+
const localName = (device as { localName?: string | null } | undefined)?.localName;
|
|
59
|
+
return device?.name ?? localName ?? null;
|
|
60
|
+
};
|
|
61
|
+
|
|
57
62
|
const delay = (ms: number) =>
|
|
58
63
|
new Promise<void>(resolve => {
|
|
59
64
|
setTimeout(resolve, ms);
|
|
@@ -358,7 +363,7 @@ export default class ReactNativeBleTransport {
|
|
|
358
363
|
}
|
|
359
364
|
|
|
360
365
|
blePlxManager.startDeviceScan(
|
|
361
|
-
|
|
366
|
+
getBluetoothServiceUuids(),
|
|
362
367
|
{
|
|
363
368
|
scanMode: ScanMode.LowLatency,
|
|
364
369
|
},
|
|
@@ -387,7 +392,7 @@ export default class ReactNativeBleTransport {
|
|
|
387
392
|
return;
|
|
388
393
|
}
|
|
389
394
|
|
|
390
|
-
if (isOnekeyDevice(device
|
|
395
|
+
if (isOnekeyDevice(getBleIdentityName(device), device?.id)) {
|
|
391
396
|
Log?.debug('search device start ======================');
|
|
392
397
|
const { name, localName, id } = device ?? {};
|
|
393
398
|
Log?.debug(
|
|
@@ -401,6 +406,9 @@ export default class ReactNativeBleTransport {
|
|
|
401
406
|
|
|
402
407
|
getConnectedDeviceIds(getBluetoothServiceUuids()).then(devices => {
|
|
403
408
|
for (const device of devices) {
|
|
409
|
+
if (!isOnekeyDevice(getBleIdentityName(device), device?.id)) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
404
412
|
Log?.debug('search connected peripheral: ', device.id);
|
|
405
413
|
addDevice(device as unknown as Device);
|
|
406
414
|
}
|