@onekeyfe/hd-transport-react-native 1.2.8-alpha.118 → 1.2.8-alpha.119
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 +0 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -315
- package/package.json +5 -5
- package/src/__tests__/protocolV2Link.test.ts +0 -96
- package/src/index.ts +30 -450
- package/src/__tests__/nativeFrameWrite.test.ts +0 -910
package/dist/index.d.ts
CHANGED
|
@@ -67,24 +67,12 @@ declare const BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD = 2;
|
|
|
67
67
|
type ProtocolV2BleTuning = {
|
|
68
68
|
iosPacketLength?: number;
|
|
69
69
|
androidPacketLength?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Write each multi-packet high-throughput frame with one native call when the native
|
|
72
|
-
* BLE module supports it. Defaults to true; false keeps the per-packet JS write loop.
|
|
73
|
-
*/
|
|
74
|
-
nativeFrameWrite?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Android CONNECTION_PRIORITY_HIGH around Protocol V2 high-throughput calls. 'auto' (the
|
|
77
|
-
* default) requests it below Android 17 only; true or false forces it on every version.
|
|
78
|
-
*/
|
|
79
|
-
androidHighConnectionPriority?: boolean | 'auto';
|
|
80
70
|
};
|
|
81
71
|
declare function configureProtocolV2BleTuning(tuning?: ProtocolV2BleTuning): void;
|
|
82
72
|
declare function resetProtocolV2BleTuning(): void;
|
|
83
73
|
declare function getProtocolV2BleTuning(): {
|
|
84
74
|
iosPacketLength: number;
|
|
85
75
|
androidPacketLength: number;
|
|
86
|
-
nativeFrameWrite: boolean;
|
|
87
|
-
androidHighConnectionPriority: boolean | "auto";
|
|
88
76
|
};
|
|
89
77
|
/**
|
|
90
78
|
* With no cached GATT table the stack runs its own discovery (up to ~8s) before the MTU
|
|
@@ -170,10 +158,6 @@ declare class ReactNativeBleTransport {
|
|
|
170
158
|
private protocolV2HighVolumeLogSignatures;
|
|
171
159
|
private androidHighPriorityDevices;
|
|
172
160
|
private androidPriorityResetTimers;
|
|
173
|
-
/** In-flight native frame write per device; Protocol V2 writes are serialized per device. */
|
|
174
|
-
private protocolV2FrameWrites;
|
|
175
|
-
private protocolV2FrameWriteCounter;
|
|
176
|
-
private protocolV2FileWritePerfs;
|
|
177
161
|
private nextMonitorToken;
|
|
178
162
|
/** Serializes transport lifecycle changes for the same physical device. */
|
|
179
163
|
private lifecycleOperations;
|
|
@@ -275,25 +259,6 @@ declare class ReactNativeBleTransport {
|
|
|
275
259
|
private readProtocolV2Frame;
|
|
276
260
|
private writeProtocolV2Packet;
|
|
277
261
|
private writeProtocolV2Frame;
|
|
278
|
-
/**
|
|
279
|
-
* The native frame write only replaces the per-packet loop where its JS<->native round trips
|
|
280
|
-
* dominate: multi-packet (checked by the caller) high-throughput frames written without response.
|
|
281
|
-
*/
|
|
282
|
-
private resolveProtocolV2NativeFrameWriter;
|
|
283
|
-
/**
|
|
284
|
-
* Writes one frame with a single native call that sends its packets in order without response.
|
|
285
|
-
* Nothing here retries it: a resend could duplicate bytes the device already received. The
|
|
286
|
-
* native transaction is cancelled on abort, watchdog expiry and link teardown so the native
|
|
287
|
-
* side stops writing a frame nobody waits for any more; a generation change detected after
|
|
288
|
-
* the frame completes still fails the write.
|
|
289
|
-
*/
|
|
290
|
-
private writeProtocolV2NativeFrame;
|
|
291
|
-
/** Stops the native frame write in flight on `uuid`, optionally only one of `generation`. */
|
|
292
|
-
private cancelProtocolV2FrameWrite;
|
|
293
|
-
private cancelNativeTransaction;
|
|
294
|
-
private getProtocolV2FileWritePerf;
|
|
295
|
-
/** Returns true the first time `signature` is seen for `uuid` on this link. */
|
|
296
|
-
private markProtocolV2LogSignature;
|
|
297
262
|
private callProtocolV2;
|
|
298
263
|
private ensureProtocolV2HighThroughputMtu;
|
|
299
264
|
private clearAndroidPriorityResetTimer;
|
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,EAGL,UAAU,IAAI,aAAa,EAG5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAChB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAI3B,KAAK,YAAY,EAKjB,KAAK,oBAAoB,EAI1B,MAAM,wBAAwB,CAAC;AA4BhC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAI1C,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;AAEjE,KAAK,8BAA8B,GAAG,eAAe,GAAG;IAMtD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAkBF,KAAK,4BAA4B,GAAG,WAAW,CAAC;AAChD,KAAK,0BAA0B,GAAG;IAChC,mBAAmB,EAAE,cAAc,CAAC;IACpC,oBAAoB,EAAE,cAAc,CAAC;CACtC,CAAC;AAkCF,eAAO,MAAM,+BAA+B,UACnC,OAAO,KACb,4BAA4B,GAAG,IAsBjC,CAAC;AAcF,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eAAO,MAAM,8BAA8B,OAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,UAAU,IAAI,aAAa,EAG5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAChB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAI3B,KAAK,YAAY,EAKjB,KAAK,oBAAoB,EAI1B,MAAM,wBAAwB,CAAC;AA4BhC,OAAO,Y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OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB;YA2BlB,cAAc;IA0P5B,IAAI;IA8CE,UAAU,CAAC,OAAO,EAAE,MAAM;YAIlB,kBAAkB;YAkFlB,iBAAiB;IAkC/B,OAAO,CAAC,4BAA4B;YAQtB,qBAAqB;IAoB7B,MAAM;YAoBE,mBAAmB;YA4DnB,eAAe;YA6Bf,kBAAkB;YAkDlB,iCAAiC;IA8D/C,OAAO,CAAC,wBAAwB;IAwChC,OAAO,CAAC,yBAAyB;IAMjC,OAAO,CAAC,kBAAkB;YAcZ,cAAc;IA8C5B,OAAO,CAAC,kBAAkB;IA6B1B,OAAO,CAAC,eAAe;IAgEvB,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,iBAAiB;YAIX,cAAc;YA+Gd,0BAA0B;YAsB1B,iCAAiC;YAoDjC,eAAe;YAsBf,eAAe;IA2B7B,OAAO,CAAC,4BAA4B;IA2BpC,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,sBAAsB;YAShB,mBAAmB;YAiBnB,qBAAqB;YA8DrB,oBAAoB;YAgCpB,cAAc;YAmFd,iCAAiC;IAsB/C,OAAO,CAAC,8BAA8B;YAQxB,mCAAmC;IAsBjD,OAAO,CAAC,yCAAyC;YAanC,gCAAgC;IAoB9C,OAAO,CAAC,uBAAuB;IAmD/B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
|
package/dist/index.js
CHANGED
|
@@ -383,7 +383,6 @@ const WEDGED_WRITE_MESSAGE = 'BLE write timeout after';
|
|
|
383
383
|
const isWedgedWriteError = (error) => (error === null || error === void 0 ? void 0 : error.errorCode) === hdShared.HardwareErrorCode.BleWriteCharacteristicError &&
|
|
384
384
|
typeof (error === null || error === void 0 ? void 0 : error.message) === 'string' &&
|
|
385
385
|
error.message.startsWith(WEDGED_WRITE_MESSAGE);
|
|
386
|
-
const createWedgedWriteError = () => hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, `${WEDGED_WRITE_MESSAGE} ${BLE_WRITE_PACKET_TIMEOUT_MS}ms`);
|
|
387
386
|
const shouldRethrowProtocolProbeError = (error) => {
|
|
388
387
|
const code = error === null || error === void 0 ? void 0 : error.errorCode;
|
|
389
388
|
return (isNativeBleDisconnectError(error) ||
|
|
@@ -401,8 +400,6 @@ const ANDROID_NOTIFY_READY_DELAY_MS = 300;
|
|
|
401
400
|
const DEFAULT_PROTOCOL_V2_BLE_TUNING = {
|
|
402
401
|
iosPacketLength: IOS_PROTOCOL_V2_PACKET_LENGTH,
|
|
403
402
|
androidPacketLength: ANDROID_PROTOCOL_V2_PACKET_LENGTH,
|
|
404
|
-
nativeFrameWrite: true,
|
|
405
|
-
androidHighConnectionPriority: 'auto',
|
|
406
403
|
};
|
|
407
404
|
let protocolV2BleTuning = Object.assign({}, DEFAULT_PROTOCOL_V2_BLE_TUNING);
|
|
408
405
|
const normalizePositiveInteger = (value, fallback) => {
|
|
@@ -415,13 +412,6 @@ function configureProtocolV2BleTuning(tuning = {}) {
|
|
|
415
412
|
protocolV2BleTuning = {
|
|
416
413
|
iosPacketLength: normalizePositiveInteger(tuning.iosPacketLength, protocolV2BleTuning.iosPacketLength),
|
|
417
414
|
androidPacketLength: normalizePositiveInteger(tuning.androidPacketLength, protocolV2BleTuning.androidPacketLength),
|
|
418
|
-
nativeFrameWrite: typeof tuning.nativeFrameWrite === 'boolean'
|
|
419
|
-
? tuning.nativeFrameWrite
|
|
420
|
-
: protocolV2BleTuning.nativeFrameWrite,
|
|
421
|
-
androidHighConnectionPriority: typeof tuning.androidHighConnectionPriority === 'boolean' ||
|
|
422
|
-
tuning.androidHighConnectionPriority === 'auto'
|
|
423
|
-
? tuning.androidHighConnectionPriority
|
|
424
|
-
: protocolV2BleTuning.androidHighConnectionPriority,
|
|
425
415
|
};
|
|
426
416
|
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] BLE tuning configured', protocolV2BleTuning);
|
|
427
417
|
}
|
|
@@ -432,91 +422,6 @@ function resetProtocolV2BleTuning() {
|
|
|
432
422
|
function getProtocolV2BleTuning() {
|
|
433
423
|
return Object.assign({}, protocolV2BleTuning);
|
|
434
424
|
}
|
|
435
|
-
const getProtocolV2NativeFrameWriter = (manager) => {
|
|
436
|
-
var _a;
|
|
437
|
-
const candidate = manager;
|
|
438
|
-
if (!candidate || typeof candidate.writeCharacteristicWithoutResponseFrame !== 'function') {
|
|
439
|
-
return undefined;
|
|
440
|
-
}
|
|
441
|
-
try {
|
|
442
|
-
return ((_a = candidate.isWriteCharacteristicWithoutResponseFrameSupported) === null || _a === void 0 ? void 0 : _a.call(candidate)) === true
|
|
443
|
-
? candidate
|
|
444
|
-
: undefined;
|
|
445
|
-
}
|
|
446
|
-
catch (_b) {
|
|
447
|
-
return undefined;
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
const getNativeBleErrorReason = (error) => {
|
|
451
|
-
const { reason, message } = (error !== null && error !== void 0 ? error : {});
|
|
452
|
-
if (typeof reason === 'string' && reason)
|
|
453
|
-
return reason;
|
|
454
|
-
return typeof message === 'string' && message ? message : undefined;
|
|
455
|
-
};
|
|
456
|
-
const nowMs = () => typeof performance !== 'undefined' && typeof performance.now === 'function'
|
|
457
|
-
? performance.now()
|
|
458
|
-
: Date.now();
|
|
459
|
-
const roundMs = (ms) => Math.round(ms * 10) / 10;
|
|
460
|
-
const FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS = [1, 2, 3, 5, 8];
|
|
461
|
-
const createDurationStats = () => {
|
|
462
|
-
let total = 0;
|
|
463
|
-
let count = 0;
|
|
464
|
-
let max = 0;
|
|
465
|
-
return {
|
|
466
|
-
add(ms) {
|
|
467
|
-
total += ms;
|
|
468
|
-
count += 1;
|
|
469
|
-
max = Math.max(max, ms);
|
|
470
|
-
},
|
|
471
|
-
summarize: () => ({
|
|
472
|
-
total: roundMs(total),
|
|
473
|
-
avg: count ? roundMs(total / count) : 0,
|
|
474
|
-
max: roundMs(max),
|
|
475
|
-
}),
|
|
476
|
-
};
|
|
477
|
-
};
|
|
478
|
-
const createProtocolV2FileWritePerf = () => {
|
|
479
|
-
const startedAt = nowMs();
|
|
480
|
-
let nativeFrames = 0;
|
|
481
|
-
let frames = 0;
|
|
482
|
-
let packets = 0;
|
|
483
|
-
let frameBytes = 0;
|
|
484
|
-
const write = createDurationStats();
|
|
485
|
-
const readWait = createDurationStats();
|
|
486
|
-
const packet = createDurationStats();
|
|
487
|
-
const packetHistogram = Array.from({ length: FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS.length + 1 }, () => 0);
|
|
488
|
-
return {
|
|
489
|
-
startFrame(mode) {
|
|
490
|
-
if (mode === 'native-frame')
|
|
491
|
-
nativeFrames += 1;
|
|
492
|
-
},
|
|
493
|
-
recordFrame(bytes, framePackets, elapsedMs) {
|
|
494
|
-
frames += 1;
|
|
495
|
-
packets += framePackets;
|
|
496
|
-
frameBytes += bytes;
|
|
497
|
-
write.add(elapsedMs);
|
|
498
|
-
},
|
|
499
|
-
recordPacket(elapsedMs) {
|
|
500
|
-
packet.add(elapsedMs);
|
|
501
|
-
const bucket = FILE_WRITE_PACKET_HISTOGRAM_BOUNDS_MS.findIndex(bound => elapsedMs < bound);
|
|
502
|
-
packetHistogram[bucket < 0 ? packetHistogram.length - 1 : bucket] += 1;
|
|
503
|
-
},
|
|
504
|
-
recordReadWait(elapsedMs) {
|
|
505
|
-
readWait.add(elapsedMs);
|
|
506
|
-
},
|
|
507
|
-
summarize(ok) {
|
|
508
|
-
const mode = nativeFrames > 0 ? 'native-frame' : 'per-packet';
|
|
509
|
-
const packetStats = packet.summarize();
|
|
510
|
-
return Object.assign({ platform: reactNative.Platform.OS, mode,
|
|
511
|
-
ok,
|
|
512
|
-
frames,
|
|
513
|
-
packets,
|
|
514
|
-
frameBytes, elapsedMs: roundMs(nowMs() - startedAt), writeMs: write.summarize(), readWaitMs: readWait.summarize() }, (mode === 'per-packet'
|
|
515
|
-
? { packetMs: { avg: packetStats.avg, max: packetStats.max, hist: [...packetHistogram] } }
|
|
516
|
-
: {}));
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
};
|
|
520
425
|
function getDeviceDisplayName(device) {
|
|
521
426
|
return (device === null || device === void 0 ? void 0 : device.name) || (device === null || device === void 0 ? void 0 : device.localName) || null;
|
|
522
427
|
}
|
|
@@ -544,16 +449,6 @@ function withBleColorCode(device) {
|
|
|
544
449
|
const IOS_REQUEST_MTU = 247;
|
|
545
450
|
const ANDROID_REQUEST_MTU = 517;
|
|
546
451
|
const ANDROID_HIGH_PRIORITY_IDLE_MS = 1000;
|
|
547
|
-
const ANDROID_HIGH_PRIORITY_PERIPHERAL_LATENCY_API_LEVEL = 37;
|
|
548
|
-
const shouldRequestAndroidHighConnectionPriority = () => {
|
|
549
|
-
if (reactNative.Platform.OS !== 'android')
|
|
550
|
-
return false;
|
|
551
|
-
const { androidHighConnectionPriority } = protocolV2BleTuning;
|
|
552
|
-
if (typeof androidHighConnectionPriority === 'boolean')
|
|
553
|
-
return androidHighConnectionPriority;
|
|
554
|
-
const apiLevel = Number(reactNative.Platform.Version);
|
|
555
|
-
return (!Number.isFinite(apiLevel) || apiLevel < ANDROID_HIGH_PRIORITY_PERIPHERAL_LATENCY_API_LEVEL);
|
|
556
|
-
};
|
|
557
452
|
const getRequestedBleMtu = () => reactNative.Platform.OS === 'android' ? ANDROID_REQUEST_MTU : IOS_REQUEST_MTU;
|
|
558
453
|
const BLE_NATIVE_CONNECT_TIMEOUT_MS = 3000;
|
|
559
454
|
const BLE_MTU_REQUEST_TIMEOUT_MS = BLE_NATIVE_CONNECT_TIMEOUT_MS;
|
|
@@ -746,9 +641,6 @@ class ReactNativeBleTransport {
|
|
|
746
641
|
this.protocolV2HighVolumeLogSignatures = new Map();
|
|
747
642
|
this.androidHighPriorityDevices = new Set();
|
|
748
643
|
this.androidPriorityResetTimers = new Map();
|
|
749
|
-
this.protocolV2FrameWrites = new Map();
|
|
750
|
-
this.protocolV2FrameWriteCounter = 0;
|
|
751
|
-
this.protocolV2FileWritePerfs = new Map();
|
|
752
644
|
this.nextMonitorToken = 1;
|
|
753
645
|
this.lifecycleOperations = new Map();
|
|
754
646
|
this.scanCleanups = new Set();
|
|
@@ -1550,16 +1442,13 @@ class ReactNativeBleTransport {
|
|
|
1550
1442
|
}
|
|
1551
1443
|
releaseUnlocked(uuid, onclose = false) {
|
|
1552
1444
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1553
|
-
|
|
1554
|
-
this.cancelProtocolV2FrameWrite(uuid, new Error(reason));
|
|
1555
|
-
yield this.protocolV2Links.invalidateLink(uuid, reason);
|
|
1445
|
+
yield this.protocolV2Links.invalidateLink(uuid, 'React Native BLE transport released');
|
|
1556
1446
|
return this.releaseNative(uuid, onclose);
|
|
1557
1447
|
});
|
|
1558
1448
|
}
|
|
1559
1449
|
releaseNative(uuid, onclose = false) {
|
|
1560
1450
|
var _a, _b, _c, _d, _e;
|
|
1561
1451
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1562
|
-
this.cancelProtocolV2FrameWrite(uuid, new Error('React Native BLE transport released'));
|
|
1563
1452
|
const transport = transportCache[uuid];
|
|
1564
1453
|
const manager = this.blePlxManager;
|
|
1565
1454
|
if (this.runPromise && this.runPromiseDeviceId === uuid) {
|
|
@@ -1886,11 +1775,7 @@ class ReactNativeBleTransport {
|
|
|
1886
1775
|
disconnectUnlocked(session) {
|
|
1887
1776
|
var _a, _b, _c;
|
|
1888
1777
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1889
|
-
this.
|
|
1890
|
-
this.androidHighPriorityDevices.delete(session);
|
|
1891
|
-
const reason = 'React Native BLE transport disconnected';
|
|
1892
|
-
this.cancelProtocolV2FrameWrite(session, new Error(reason));
|
|
1893
|
-
yield this.protocolV2Links.invalidateLink(session, reason);
|
|
1778
|
+
yield this.protocolV2Links.invalidateLink(session, 'React Native BLE transport disconnected');
|
|
1894
1779
|
const transport = transportCache[session];
|
|
1895
1780
|
const manager = this.blePlxManager;
|
|
1896
1781
|
const monitorToken = (_a = transport === null || transport === void 0 ? void 0 : transport.monitorToken) !== null && _a !== void 0 ? _a : this.monitorTokens.get(session);
|
|
@@ -2229,7 +2114,7 @@ class ReactNativeBleTransport {
|
|
|
2229
2114
|
new Promise((_, reject) => {
|
|
2230
2115
|
timer = setTimeout(() => {
|
|
2231
2116
|
timedOut = true;
|
|
2232
|
-
reject(
|
|
2117
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, `BLE write timeout after ${BLE_WRITE_PACKET_TIMEOUT_MS}ms`));
|
|
2233
2118
|
}, BLE_WRITE_PACKET_TIMEOUT_MS);
|
|
2234
2119
|
}),
|
|
2235
2120
|
]);
|
|
@@ -2259,7 +2144,6 @@ class ReactNativeBleTransport {
|
|
|
2259
2144
|
Log === null || Log === void 0 ? void 0 : Log.error('[ReactNativeBleTransport] BLE write timed out, tearing down link:', uuid, {
|
|
2260
2145
|
consecutiveWriteTimeouts: timeouts,
|
|
2261
2146
|
});
|
|
2262
|
-
this.cancelProtocolV2FrameWrite(uuid, createWedgedWriteError());
|
|
2263
2147
|
const wedged = transportCache[uuid];
|
|
2264
2148
|
this.disconnect(uuid).catch(error => {
|
|
2265
2149
|
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] wedged link teardown failed (ignored):', error);
|
|
@@ -2283,7 +2167,6 @@ class ReactNativeBleTransport {
|
|
|
2283
2167
|
const manager = this.blePlxManager;
|
|
2284
2168
|
this.blePlxManager = undefined;
|
|
2285
2169
|
const reason = 'React Native BLE manager reset';
|
|
2286
|
-
this.protocolV2FrameWrites.forEach(active => active.cancel(new Error(reason)));
|
|
2287
2170
|
Object.entries(transportCache).forEach(([uuid, cachedTransport]) => {
|
|
2288
2171
|
var _a, _b, _c, _d;
|
|
2289
2172
|
try {
|
|
@@ -2673,162 +2556,19 @@ class ReactNativeBleTransport {
|
|
|
2673
2556
|
androidPacketLength: tuning.androidPacketLength,
|
|
2674
2557
|
mtu: transport$1.mtuSize,
|
|
2675
2558
|
});
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
:
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
}
|
|
2685
|
-
else {
|
|
2686
|
-
yield transport.writeProtocolV2BleFrame({
|
|
2687
|
-
frame,
|
|
2688
|
-
packetCapacity,
|
|
2689
|
-
assertActive: assertCurrentGeneration,
|
|
2690
|
-
signal: context.signal,
|
|
2691
|
-
abortMessage: `Protocol V2 BLE write aborted for ${context.messageName}`,
|
|
2692
|
-
wait: delay,
|
|
2693
|
-
writePacket: (packet) => __awaiter(this, void 0, void 0, function* () {
|
|
2694
|
-
const packetStartedAt = perf ? nowMs() : 0;
|
|
2695
|
-
yield this.writeProtocolV2Packet(uuid, transport$1, buffer.Buffer.from(packet).toString('base64'), context, assertCurrentGeneration);
|
|
2696
|
-
perf === null || perf === void 0 ? void 0 : perf.recordPacket(nowMs() - packetStartedAt);
|
|
2697
|
-
}),
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
perf === null || perf === void 0 ? void 0 : perf.recordFrame(frame.length, Math.ceil(frame.length / packetCapacity), nowMs() - startedAt);
|
|
2701
|
-
});
|
|
2702
|
-
}
|
|
2703
|
-
resolveProtocolV2NativeFrameWriter(transport, context, nativeFrameWrite) {
|
|
2704
|
-
if (!context.highThroughput || !nativeFrameWrite)
|
|
2705
|
-
return undefined;
|
|
2706
|
-
if (shouldWriteProtocolV2WithResponse({
|
|
2707
|
-
platform: reactNative.Platform.OS,
|
|
2708
|
-
highThroughput: context.highThroughput,
|
|
2709
|
-
requestedWithResponse: context.writeWithResponse,
|
|
2710
|
-
characteristic: transport.writeCharacteristic,
|
|
2711
|
-
})) {
|
|
2712
|
-
return undefined;
|
|
2713
|
-
}
|
|
2714
|
-
if (typeof transport.writeCharacteristic.id !== 'number')
|
|
2715
|
-
return undefined;
|
|
2716
|
-
return getProtocolV2NativeFrameWriter(this.blePlxManager);
|
|
2717
|
-
}
|
|
2718
|
-
writeProtocolV2NativeFrame(uuid, transport, manager, frame, packetCapacity, context, assertCurrentGeneration) {
|
|
2719
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2720
|
-
const abortMessage = `Protocol V2 BLE write aborted for ${context.messageName}`;
|
|
2721
|
-
assertCurrentGeneration();
|
|
2722
|
-
if (context.signal.aborted) {
|
|
2723
|
-
throw new Error(abortMessage);
|
|
2724
|
-
}
|
|
2725
|
-
this.protocolV2FrameWriteCounter += 1;
|
|
2726
|
-
const transactionId = `${uuid}:v2frame:${context.generation}:${this.protocolV2FrameWriteCounter}`;
|
|
2727
|
-
let cancelError;
|
|
2728
|
-
let rejectCancelled = () => undefined;
|
|
2729
|
-
const cancelled = new Promise((_, reject) => {
|
|
2730
|
-
rejectCancelled = reject;
|
|
2559
|
+
yield transport.writeProtocolV2BleFrame({
|
|
2560
|
+
frame,
|
|
2561
|
+
packetCapacity,
|
|
2562
|
+
assertActive: assertCurrentGeneration,
|
|
2563
|
+
signal: context.signal,
|
|
2564
|
+
abortMessage: `Protocol V2 BLE write aborted for ${context.messageName}`,
|
|
2565
|
+
wait: delay,
|
|
2566
|
+
writePacket: packet => this.writeProtocolV2Packet(uuid, transport$1, buffer.Buffer.from(packet).toString('base64'), context, assertCurrentGeneration),
|
|
2731
2567
|
});
|
|
2732
|
-
const active = {
|
|
2733
|
-
generation: context.generation,
|
|
2734
|
-
cancel: error => {
|
|
2735
|
-
if (cancelError)
|
|
2736
|
-
return;
|
|
2737
|
-
cancelError = error;
|
|
2738
|
-
if (this.protocolV2FrameWrites.get(uuid) === active) {
|
|
2739
|
-
this.protocolV2FrameWrites.delete(uuid);
|
|
2740
|
-
}
|
|
2741
|
-
rejectCancelled(error);
|
|
2742
|
-
this.cancelNativeTransaction(manager, transactionId);
|
|
2743
|
-
},
|
|
2744
|
-
};
|
|
2745
|
-
const isCurrentOwner = () => {
|
|
2746
|
-
try {
|
|
2747
|
-
assertCurrentGeneration();
|
|
2748
|
-
return !context.signal.aborted;
|
|
2749
|
-
}
|
|
2750
|
-
catch (_a) {
|
|
2751
|
-
return false;
|
|
2752
|
-
}
|
|
2753
|
-
};
|
|
2754
|
-
const onAbort = () => active.cancel(new Error(abortMessage));
|
|
2755
|
-
let timer;
|
|
2756
|
-
try {
|
|
2757
|
-
const nativeWrite = Promise.resolve(manager.writeCharacteristicWithoutResponseFrame(transport.writeCharacteristic.id, buffer.Buffer.from(frame).toString('base64'), packetCapacity, transactionId));
|
|
2758
|
-
nativeWrite.catch(() => undefined);
|
|
2759
|
-
this.protocolV2FrameWrites.set(uuid, active);
|
|
2760
|
-
context.signal.addEventListener('abort', onAbort);
|
|
2761
|
-
timer = setTimeout(() => {
|
|
2762
|
-
const owner = isCurrentOwner();
|
|
2763
|
-
active.cancel(createWedgedWriteError());
|
|
2764
|
-
if (owner) {
|
|
2765
|
-
this.tearDownWedgedLink(uuid);
|
|
2766
|
-
}
|
|
2767
|
-
else {
|
|
2768
|
-
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] stale BLE frame write timed out, link kept');
|
|
2769
|
-
}
|
|
2770
|
-
}, BLE_WRITE_PACKET_TIMEOUT_MS);
|
|
2771
|
-
yield Promise.race([nativeWrite, cancelled]);
|
|
2772
|
-
}
|
|
2773
|
-
catch (error) {
|
|
2774
|
-
if (cancelError)
|
|
2775
|
-
throw cancelError;
|
|
2776
|
-
if (isNativeBleDisconnectError(error)) {
|
|
2777
|
-
throw toBleDisconnectHardwareError(error);
|
|
2778
|
-
}
|
|
2779
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleWriteCharacteristicError, getNativeBleErrorReason(error));
|
|
2780
|
-
}
|
|
2781
|
-
finally {
|
|
2782
|
-
if (timer)
|
|
2783
|
-
clearTimeout(timer);
|
|
2784
|
-
context.signal.removeEventListener('abort', onAbort);
|
|
2785
|
-
if (this.protocolV2FrameWrites.get(uuid) === active) {
|
|
2786
|
-
this.protocolV2FrameWrites.delete(uuid);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
this.writeTimeoutCounts.delete(uuid);
|
|
2790
|
-
try {
|
|
2791
|
-
assertCurrentGeneration();
|
|
2792
|
-
}
|
|
2793
|
-
catch (error) {
|
|
2794
|
-
active.cancel(error instanceof Error ? error : new Error(String(error)));
|
|
2795
|
-
}
|
|
2796
|
-
if (cancelError)
|
|
2797
|
-
throw cancelError;
|
|
2798
|
-
});
|
|
2799
|
-
}
|
|
2800
|
-
cancelProtocolV2FrameWrite(uuid, error, generation) {
|
|
2801
|
-
const active = this.protocolV2FrameWrites.get(uuid);
|
|
2802
|
-
if (!active || (generation !== undefined && active.generation !== generation))
|
|
2803
|
-
return;
|
|
2804
|
-
active.cancel(error);
|
|
2805
|
-
}
|
|
2806
|
-
cancelNativeTransaction(manager, transactionId) {
|
|
2807
|
-
const logFailure = (error) => Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Protocol V2 frame write cancellation failed', {
|
|
2808
|
-
error: error instanceof Error ? error.message : String(error),
|
|
2809
2568
|
});
|
|
2810
|
-
try {
|
|
2811
|
-
Promise.resolve(manager.cancelTransaction(transactionId)).catch(logFailure);
|
|
2812
|
-
}
|
|
2813
|
-
catch (error) {
|
|
2814
|
-
logFailure(error);
|
|
2815
|
-
}
|
|
2816
|
-
}
|
|
2817
|
-
getProtocolV2FileWritePerf(uuid, context) {
|
|
2818
|
-
return context.messageName === 'FilesystemFileWrite'
|
|
2819
|
-
? this.protocolV2FileWritePerfs.get(uuid)
|
|
2820
|
-
: undefined;
|
|
2821
|
-
}
|
|
2822
|
-
markProtocolV2LogSignature(uuid, signature) {
|
|
2823
|
-
var _a;
|
|
2824
|
-
const signatures = (_a = this.protocolV2HighVolumeLogSignatures.get(uuid)) !== null && _a !== void 0 ? _a : new Set();
|
|
2825
|
-
if (signatures.has(signature))
|
|
2826
|
-
return false;
|
|
2827
|
-
signatures.add(signature);
|
|
2828
|
-
this.protocolV2HighVolumeLogSignatures.set(uuid, signatures);
|
|
2829
|
-
return true;
|
|
2830
2569
|
}
|
|
2831
2570
|
callProtocolV2(uuid, name, data, options) {
|
|
2571
|
+
var _a;
|
|
2832
2572
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2833
2573
|
if (!this._messages || !this._messagesV2) {
|
|
2834
2574
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured);
|
|
@@ -2854,7 +2594,10 @@ class ReactNativeBleTransport {
|
|
|
2854
2594
|
});
|
|
2855
2595
|
const writeMode = writeWithResponse ? 'withResponse' : 'withoutResponse';
|
|
2856
2596
|
const logSignature = `${name}:${writeMode}:${String(currentTransport.mtuSize)}:${packetCapacity}`;
|
|
2857
|
-
|
|
2597
|
+
const loggedSignatures = (_a = this.protocolV2HighVolumeLogSignatures.get(uuid)) !== null && _a !== void 0 ? _a : new Set();
|
|
2598
|
+
if (!loggedSignatures.has(logSignature)) {
|
|
2599
|
+
loggedSignatures.add(logSignature);
|
|
2600
|
+
this.protocolV2HighVolumeLogSignatures.set(uuid, loggedSignatures);
|
|
2858
2601
|
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Protocol V2 high-volume write configured', {
|
|
2859
2602
|
name,
|
|
2860
2603
|
writeMode,
|
|
@@ -2862,33 +2605,12 @@ class ReactNativeBleTransport {
|
|
|
2862
2605
|
packetCapacity,
|
|
2863
2606
|
});
|
|
2864
2607
|
}
|
|
2865
|
-
const frameWriteMode = this.resolveProtocolV2NativeFrameWriter(currentTransport, { highThroughput: true, writeWithResponse: options === null || options === void 0 ? void 0 : options.writeWithResponse }, tuning.nativeFrameWrite)
|
|
2866
|
-
? 'native-frame'
|
|
2867
|
-
: 'per-packet';
|
|
2868
|
-
if (this.markProtocolV2LogSignature(uuid, `frameWriteMode:${frameWriteMode}`)) {
|
|
2869
|
-
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Protocol V2 frame write mode', {
|
|
2870
|
-
platform: reactNative.Platform.OS,
|
|
2871
|
-
mode: frameWriteMode,
|
|
2872
|
-
nativeFrameWrite: tuning.nativeFrameWrite,
|
|
2873
|
-
nativeFrameWriteSupported: !!getProtocolV2NativeFrameWriter(this.blePlxManager),
|
|
2874
|
-
packetCapacity,
|
|
2875
|
-
});
|
|
2876
|
-
}
|
|
2877
2608
|
}
|
|
2878
2609
|
if (highThroughputWrite) {
|
|
2879
2610
|
yield this.enableAndroidHighConnectionPriority(uuid);
|
|
2880
2611
|
}
|
|
2881
|
-
const fileWritePerf = name === 'FilesystemFileWrite' && (options === null || options === void 0 ? void 0 : options.fileWritePipeline)
|
|
2882
|
-
? createProtocolV2FileWritePerf()
|
|
2883
|
-
: undefined;
|
|
2884
|
-
if (fileWritePerf) {
|
|
2885
|
-
this.protocolV2FileWritePerfs.set(uuid, fileWritePerf);
|
|
2886
|
-
}
|
|
2887
|
-
let fileWriteOk = false;
|
|
2888
2612
|
try {
|
|
2889
|
-
|
|
2890
|
-
fileWriteOk = response.type !== 'Failure';
|
|
2891
|
-
return response;
|
|
2613
|
+
return yield this.protocolV2Links.call(uuid, () => this.createProtocolV2Adapter(uuid), name, data, callOptions);
|
|
2892
2614
|
}
|
|
2893
2615
|
catch (e) {
|
|
2894
2616
|
Log === null || Log === void 0 ? void 0 : Log.error('[ReactNativeBleTransport] Protocol V2 call error:', e);
|
|
@@ -2906,12 +2628,6 @@ class ReactNativeBleTransport {
|
|
|
2906
2628
|
if (highThroughputWrite) {
|
|
2907
2629
|
this.scheduleAndroidBalancedConnectionPriority(uuid);
|
|
2908
2630
|
}
|
|
2909
|
-
if (fileWritePerf) {
|
|
2910
|
-
if (this.protocolV2FileWritePerfs.get(uuid) === fileWritePerf) {
|
|
2911
|
-
this.protocolV2FileWritePerfs.delete(uuid);
|
|
2912
|
-
}
|
|
2913
|
-
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] FileWrite perf', fileWritePerf.summarize(fileWriteOk));
|
|
2914
|
-
}
|
|
2915
2631
|
}
|
|
2916
2632
|
});
|
|
2917
2633
|
}
|
|
@@ -2943,15 +2659,6 @@ class ReactNativeBleTransport {
|
|
|
2943
2659
|
this.clearAndroidPriorityResetTimer(uuid);
|
|
2944
2660
|
if (this.androidHighPriorityDevices.has(uuid))
|
|
2945
2661
|
return;
|
|
2946
|
-
if (!shouldRequestAndroidHighConnectionPriority()) {
|
|
2947
|
-
if (this.markProtocolV2LogSignature(uuid, 'androidPriority:peripheral')) {
|
|
2948
|
-
Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] Android BLE connection priority left to peripheral', {
|
|
2949
|
-
apiLevel: reactNative.Platform.Version,
|
|
2950
|
-
setting: protocolV2BleTuning.androidHighConnectionPriority,
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2953
|
-
return;
|
|
2954
|
-
}
|
|
2955
2662
|
const transport = transportCache[uuid];
|
|
2956
2663
|
if (!transport)
|
|
2957
2664
|
return;
|
|
@@ -3021,12 +2728,9 @@ class ReactNativeBleTransport {
|
|
|
3021
2728
|
const currentTransport = this.getCachedTransport(uuid);
|
|
3022
2729
|
yield this.writeProtocolV2Frame(uuid, currentTransport, frame, context, assertCurrentGeneration);
|
|
3023
2730
|
}),
|
|
3024
|
-
readFrame: (
|
|
2731
|
+
readFrame: () => __awaiter(this, void 0, void 0, function* () {
|
|
3025
2732
|
assertCurrentGeneration();
|
|
3026
|
-
const perf = this.getProtocolV2FileWritePerf(uuid, context);
|
|
3027
|
-
const startedAt = perf ? nowMs() : 0;
|
|
3028
2733
|
const rxFrame = yield this.readProtocolV2Frame(uuid);
|
|
3029
|
-
perf === null || perf === void 0 ? void 0 : perf.recordReadWait(nowMs() - startedAt);
|
|
3030
2734
|
if (!(rxFrame instanceof Uint8Array)) {
|
|
3031
2735
|
throw new Error('Protocol V2 response is not Uint8Array');
|
|
3032
2736
|
}
|
|
@@ -3034,7 +2738,6 @@ class ReactNativeBleTransport {
|
|
|
3034
2738
|
}),
|
|
3035
2739
|
reset: (reason) => {
|
|
3036
2740
|
var _a;
|
|
3037
|
-
this.cancelProtocolV2FrameWrite(uuid, new Error(reason), generation);
|
|
3038
2741
|
if (this.monitorTokens.get(uuid) !== generation)
|
|
3039
2742
|
return;
|
|
3040
2743
|
(_a = this.protocolV2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "1.2.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.119",
|
|
4
4
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"lint:fix": "eslint . --fix"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@onekeyfe/hd-core": "1.2.8-alpha.
|
|
24
|
-
"@onekeyfe/hd-shared": "1.2.8-alpha.
|
|
25
|
-
"@onekeyfe/hd-transport": "1.2.8-alpha.
|
|
23
|
+
"@onekeyfe/hd-core": "1.2.8-alpha.119",
|
|
24
|
+
"@onekeyfe/hd-shared": "1.2.8-alpha.119",
|
|
25
|
+
"@onekeyfe/hd-transport": "1.2.8-alpha.119",
|
|
26
26
|
"@onekeyfe/react-native-ble-utils": "0.1.9",
|
|
27
27
|
"react-native-ble-plx": "3.5.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "26953c0d533e9a05980abc8ea43e7bbd45ead861"
|
|
30
30
|
}
|