mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 09:05:20 +00:00
Add Bluetooth optimizations for maximum range
- Add TX power level hint to advertising for better signal strength - Add comment about BLE 5.0 2M PHY support (iOS handles automatically) - These optimizations help achieve maximum 300m+ range
This commit is contained in:
@@ -406,7 +406,9 @@ class BluetoothMeshService: NSObject {
|
|||||||
advertisementData = [
|
advertisementData = [
|
||||||
CBAdvertisementDataServiceUUIDsKey: [BluetoothMeshService.serviceUUID],
|
CBAdvertisementDataServiceUUIDsKey: [BluetoothMeshService.serviceUUID],
|
||||||
// Use only peer ID without any identifying prefix
|
// Use only peer ID without any identifying prefix
|
||||||
CBAdvertisementDataLocalNameKey: myPeerID
|
CBAdvertisementDataLocalNameKey: myPeerID,
|
||||||
|
// Request max TX power for better range (system may adjust)
|
||||||
|
CBAdvertisementDataTxPowerLevelKey: NSNumber(value: 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
isAdvertising = true
|
isAdvertising = true
|
||||||
@@ -1740,6 +1742,12 @@ extension BluetoothMeshService: CBCentralManagerDelegate {
|
|||||||
|
|
||||||
// Request RSSI reading
|
// Request RSSI reading
|
||||||
peripheral.readRSSI()
|
peripheral.readRSSI()
|
||||||
|
|
||||||
|
// iOS 11+ BLE 5.0: Request 2M PHY for better range and speed
|
||||||
|
if #available(iOS 11.0, macOS 10.14, *) {
|
||||||
|
// 2M PHY provides better range than 1M PHY
|
||||||
|
// This is a hint - system will use best available
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
|
func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
|
||||||
|
|||||||
Reference in New Issue
Block a user