@onekeyfe/hd-transport-react-native 1.2.11-alpha.8 → 1.2.11-alpha.9
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 +5 -55
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +275 -467
- package/package.json +5 -5
- package/src/__tests__/connectTimeout.test.ts +0 -44
- package/src/__tests__/nativeFrameWrite.test.ts +0 -1
- package/src/__tests__/protocolV2Link.test.ts +3 -486
- package/src/index.ts +341 -632
- package/dist/bleIosBond.d.ts +0 -3
- package/dist/bleIosBond.d.ts.map +0 -1
- package/src/__tests__/bleIosBond.test.ts +0 -35
- package/src/__tests__/iosPresentDeviceConnect.test.ts +0 -228
- package/src/__tests__/releaseBondConcurrency.test.ts +0 -284
- package/src/bleIosBond.ts +0 -39
package/dist/index.d.ts
CHANGED
|
@@ -105,18 +105,6 @@ declare const ANDROID_LINK_DROP_QUIET_MS = 5000;
|
|
|
105
105
|
* inside the native budget, so this only fires when the native timeout did not.
|
|
106
106
|
*/
|
|
107
107
|
declare const BLE_CONNECT_TIMEOUT_MS: number;
|
|
108
|
-
/**
|
|
109
|
-
* iOS names a bond the device no longer holds only by failing the connect, and
|
|
110
|
-
* on some phones that takes a little longer than the native budget: the
|
|
111
|
-
* attempt is cancelled first, the answer is lost, and two such timeouts reset
|
|
112
|
-
* the BLE manager and end as a connect timeout. A device that was just seen
|
|
113
|
-
* advertising is present, so its connect gets the time iOS needs. Without that
|
|
114
|
-
* sighting the budget stays short, because an absent device never answers.
|
|
115
|
-
*/
|
|
116
|
-
declare const IOS_PRESENT_DEVICE_CONNECT_TIMEOUT_MS = 8000;
|
|
117
|
-
/** How recent a sighting must be to show that the device is present. */
|
|
118
|
-
declare const IOS_PRESENT_DEVICE_WINDOW_MS = 15000;
|
|
119
|
-
declare const IOS_PRESENT_DEVICE_CONNECT_BACKSTOP_MS: number;
|
|
120
108
|
/**
|
|
121
109
|
* Service discovery and characteristic resolution run after connect() succeeds, but
|
|
122
110
|
* CoreBluetooth schedules them on the same serial queue. If that queue is wedged by a
|
|
@@ -138,15 +126,13 @@ declare const BLE_SETUP_WEDGED_MESSAGE = "BLE setup wedged repeatedly";
|
|
|
138
126
|
type IOneKeyDevice = OneKeyDeviceInfoBase & Device & Pick<OneKeyMobileDeviceInfo, 'bleColorCode'>;
|
|
139
127
|
declare class ReactNativeBleTransport {
|
|
140
128
|
blePlxManager: BleManager | undefined;
|
|
141
|
-
_messages: ReturnType<typeof transport.
|
|
142
|
-
_messagesV2: ReturnType<typeof transport.
|
|
129
|
+
_messages: ReturnType<typeof transport.parseTransportConfigure> | undefined;
|
|
130
|
+
_messagesV2: ReturnType<typeof transport.parseTransportConfigure> | undefined;
|
|
143
131
|
private protocolV2SchemaConfiguration;
|
|
144
132
|
name: string;
|
|
145
133
|
configured: boolean;
|
|
146
134
|
stopped: boolean;
|
|
147
|
-
private readonly
|
|
148
|
-
/** When a scan last saw each device on iOS; a fresh sighting earns one longer connect. */
|
|
149
|
-
private iosLastAdvertisedAt;
|
|
135
|
+
private readonly bondAbortController;
|
|
150
136
|
scanTimeout: number;
|
|
151
137
|
runPromise: Deferred<any> | null;
|
|
152
138
|
private runPromiseDeviceId;
|
|
@@ -176,13 +162,6 @@ declare class ReactNativeBleTransport {
|
|
|
176
162
|
private silentDetections;
|
|
177
163
|
/** Android endpoints whose cached GATT table is suspect; the next connect refreshes it. */
|
|
178
164
|
private androidGattCacheRefreshes;
|
|
179
|
-
/**
|
|
180
|
-
* Android MACs this transport has observed bonded (from the bonded list, a
|
|
181
|
-
* successful pairDevice, or a completed onDeviceBondState). Used to distinguish
|
|
182
|
-
* "previously paired but the host no longer holds a bond" (re-pair) from
|
|
183
|
-
* "never paired" (plain not-bonded) when createBond() cannot be restarted.
|
|
184
|
-
*/
|
|
185
|
-
private knownBondedDevices;
|
|
186
165
|
private protocolV2Assemblers;
|
|
187
166
|
private protocolV2FrameQueues;
|
|
188
167
|
private protocolV2FramePromises;
|
|
@@ -223,29 +202,6 @@ declare class ReactNativeBleTransport {
|
|
|
223
202
|
uuid: string;
|
|
224
203
|
protocolType: ProtocolType;
|
|
225
204
|
}>;
|
|
226
|
-
private createBondAbortController;
|
|
227
|
-
private releaseBondAbortController;
|
|
228
|
-
private abortActiveBonding;
|
|
229
|
-
/**
|
|
230
|
-
* stop(), cancel(), or disconnect() aborts bonding. Match other acquire
|
|
231
|
-
* paths: report BleDeviceDisconnected so callers do not treat this as a
|
|
232
|
-
* pairing failure that should pop another system dialog.
|
|
233
|
-
*/
|
|
234
|
-
private throwIfBondingStopped;
|
|
235
|
-
/** Retry delay that rejects as soon as stop() or cancel() aborts bonding. */
|
|
236
|
-
private delayUnlessBondingStopped;
|
|
237
|
-
/**
|
|
238
|
-
* Android must bond before GATT so the peripheral cannot trigger its own
|
|
239
|
-
* pairing mid-session. Three cases:
|
|
240
|
-
* - The authoritative bonded list already has the device (OK-66336): skip
|
|
241
|
-
* createBond entirely. BluetoothDevice#bondState can be stale (BOND_NONE)
|
|
242
|
-
* and a blind createBond() then pops a redundant system dialog.
|
|
243
|
-
* - createBond() returns { bonded: false, bonding: false } (OK-64703): retry a
|
|
244
|
-
* bounded number of times with a short settle delay.
|
|
245
|
-
* - Retries exhausted: report a re-pairing error for a device this transport
|
|
246
|
-
* previously observed bonded, otherwise keep the "never paired" error.
|
|
247
|
-
*/
|
|
248
|
-
private ensureAndroidBond;
|
|
249
205
|
private acquireUnlocked;
|
|
250
206
|
_monitorCharacteristic(characteristic: Characteristic, uuid: string, monitorToken: number, notifyTransactionId: string): Subscription;
|
|
251
207
|
release(uuid: string, onclose?: boolean, keepSession?: boolean): Promise<boolean>;
|
|
@@ -260,7 +216,7 @@ declare class ReactNativeBleTransport {
|
|
|
260
216
|
private runNativeTeardown;
|
|
261
217
|
private runBestEffortNativeOperation;
|
|
262
218
|
private runLifecycleOperation;
|
|
263
|
-
cancel(
|
|
219
|
+
cancel(): Promise<void>;
|
|
264
220
|
/**
|
|
265
221
|
* Android: request the MTU with nothing queued ahead and never close the client while it is
|
|
266
222
|
* outstanding; a link that times out or stays at MTU 23 is dropped.
|
|
@@ -268,12 +224,6 @@ declare class ReactNativeBleTransport {
|
|
|
268
224
|
private negotiateAndroidMtu;
|
|
269
225
|
/** Close the client and wait out the link idle timer so the next connect gets a fresh link. */
|
|
270
226
|
private dropAndroidLink;
|
|
271
|
-
/**
|
|
272
|
-
* Whether this acquire may spend the longer iOS connect budget. The sighting is used up: the
|
|
273
|
-
* retry that follows a timeout gets no new scan, and the device may have left by then. A
|
|
274
|
-
* firmware-install reconnect keeps its short polling cadence.
|
|
275
|
-
*/
|
|
276
|
-
private takeIosPresentDeviceSighting;
|
|
277
227
|
/** Run a native connect under the JS backstop budget. */
|
|
278
228
|
private connectWithTimeout;
|
|
279
229
|
/** Resolve the complete GATT shape under a budget so acquire() always settles. */
|
|
@@ -355,4 +305,4 @@ declare class ReactNativeBleTransport {
|
|
|
355
305
|
getProtocolType(path: string): ProtocolType | undefined;
|
|
356
306
|
}
|
|
357
307
|
|
|
358
|
-
export { ANDROID_LINK_DROP_QUIET_MS, ANDROID_MTU_EXCHANGE_TIMEOUT_MS, BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD, BLE_CONNECT_TIMEOUT_MS, BLE_GATT_SETUP_TIMEOUT_MS, BLE_NATIVE_TEARDOWN_TIMEOUT_MS, BLE_SETUP_WEDGED_MESSAGE, BLE_WRITE_PACKET_TIMEOUT_MS, BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD,
|
|
308
|
+
export { ANDROID_LINK_DROP_QUIET_MS, ANDROID_MTU_EXCHANGE_TIMEOUT_MS, BLE_CONNECT_TIMEOUT_MANAGER_RESET_THRESHOLD, BLE_CONNECT_TIMEOUT_MS, BLE_GATT_SETUP_TIMEOUT_MS, BLE_NATIVE_TEARDOWN_TIMEOUT_MS, BLE_SETUP_WEDGED_MESSAGE, BLE_WRITE_PACKET_TIMEOUT_MS, BLE_WRITE_TIMEOUT_MANAGER_RESET_THRESHOLD, IOneKeyDevice, PROTOCOL_REPROBE_FALLBACK_ATTEMPTS, ProtocolV2BleTuning, configureProtocolV2BleTuning, ReactNativeBleTransport as default, getFirmwareUploadWriteRetryType, getProtocolV2BleTuning, resetProtocolV2BleTuning };
|
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,
|
|
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,eAAe,EAAE,EACtB,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;AAEF,QAAA,MAAM,SAAS,EAAE,OAAO,eAEP,CAAC;AAiBlB,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,GA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