@magicred-1/react-native-lxmf 0.2.28 → 0.2.29
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.
|
@@ -48,6 +48,8 @@ class BleManager(
|
|
|
48
48
|
private val connecting = mutableSetOf<String>()
|
|
49
49
|
// Timestamp (ms) when each MAC last disconnected — enforces reconnect cooldown
|
|
50
50
|
private val disconnectedAt = mutableMapOf<String, Long>()
|
|
51
|
+
// MACs seen in scan results but not yet GATT-connected (mirrors iOS discoveredUnpairedRNodes)
|
|
52
|
+
private val discoveredUnpaired = mutableSetOf<String>()
|
|
51
53
|
|
|
52
54
|
private var scanner: BluetoothLeScanner? = null
|
|
53
55
|
private var advertiser: BluetoothLeAdvertiser? = null
|
|
@@ -113,10 +115,12 @@ class BleManager(
|
|
|
113
115
|
connections.values.forEach { it.disconnect(); it.close() }
|
|
114
116
|
connections.clear()
|
|
115
117
|
connecting.clear()
|
|
118
|
+
discoveredUnpaired.clear()
|
|
116
119
|
Log.i(TAG, "BleManager stopped")
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
fun connectedPeerCount(): Int = module.nativeBlePeerCount()
|
|
123
|
+
fun unpairedRNodeCount(): Int = discoveredUnpaired.size
|
|
120
124
|
|
|
121
125
|
// ── Advertising (so peers can find us) ───────────────────────────────────
|
|
122
126
|
|
|
@@ -392,6 +396,7 @@ class BleManager(
|
|
|
392
396
|
val lastDisconnect = disconnectedAt[mac] ?: 0L
|
|
393
397
|
if (System.currentTimeMillis() - lastDisconnect < RECONNECT_COOLDOWN_MS) return
|
|
394
398
|
Log.i(TAG, "BLE: found peer $mac, connecting")
|
|
399
|
+
discoveredUnpaired.add(mac)
|
|
395
400
|
connecting.add(mac)
|
|
396
401
|
device.connectGatt(context, false, gattCallback, BluetoothDevice.TRANSPORT_LE)
|
|
397
402
|
}
|
|
@@ -413,6 +418,7 @@ class BleManager(
|
|
|
413
418
|
Log.i(TAG, "BLE GATT connected: $mac")
|
|
414
419
|
connections[mac] = gatt
|
|
415
420
|
connecting.remove(mac)
|
|
421
|
+
discoveredUnpaired.remove(mac)
|
|
416
422
|
gatt.discoverServices()
|
|
417
423
|
}
|
|
418
424
|
BluetoothProfile.STATE_DISCONNECTED -> {
|
|
@@ -421,6 +427,7 @@ class BleManager(
|
|
|
421
427
|
Log.i(TAG, "BLE GATT disconnected: $mac (status=$status)")
|
|
422
428
|
connections.remove(mac)
|
|
423
429
|
connecting.remove(mac)
|
|
430
|
+
discoveredUnpaired.remove(mac)
|
|
424
431
|
disconnectedAt[mac] = System.currentTimeMillis()
|
|
425
432
|
gatt.close()
|
|
426
433
|
// Notify Rust
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>liblxmf_rn.a</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>liblxmf_rn.a</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>liblxmf_rn.a</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>liblxmf_rn.a</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|