diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift
index 0ff498f6..77006174 100644
--- a/MeshtasticClient/Helpers/BLEManager.swift
+++ b/MeshtasticClient/Helpers/BLEManager.swift
@@ -72,7 +72,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
if central.state == .poweredOn {
isSwitchedOn = true
- //startScanning()
+ startScanning()
}
else {
@@ -114,22 +114,22 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
self.timeoutTimerCount += 1
- if timeoutTimerCount == 6 {
+ if timeoutTimerCount == 10 {
- if connectedPeripheral != nil && connectedPeripheral.peripheral.state != CBPeripheralState.connected {
+ if connectedPeripheral != nil {
self.centralManager?.cancelPeripheralConnection(connectedPeripheral.peripheral)
- connectedNode = nil
- connectedPeripheral = nil
- if meshLoggingEnabled { Logger.log("BLE Connecting Timeout Timer disconnected orphaned radio: \(name) in state: \(connectedPeripheral.peripheral.state.rawValue)") }
-
}
- self.lastConnectionError = "Timeout while connecting to \(name)."
- print("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Times and failed: \(name)")
- if meshLoggingEnabled { Logger.log("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Times and failed: \(name)") }
+ connectedNode = nil
+ connectedPeripheral = nil
+
+ self.lastConnectionError = "BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(name)."
+ print("BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(name).")
+ if meshLoggingEnabled { Logger.log("BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(String(name)).") }
- self.timeoutTimer?.invalidate()
self.timeoutTimerCount = 0
+ self.timeoutTimer?.invalidate()
+
}
else {
print("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Time(s): \(name)")
diff --git a/MeshtasticClient/Info.plist b/MeshtasticClient/Info.plist
index 636795eb..21a3f47f 100644
--- a/MeshtasticClient/Info.plist
+++ b/MeshtasticClient/Info.plist
@@ -29,7 +29,7 @@
NSBluetoothAlwaysUsageDescription
We use bluetooth to connect to nearby Meshtastic Devices
NSBluetoothPeripheralUsageDescription
- Bluetooth is used to connect an iPhone to a user's meshtastic device to allow text messaging and location data for the mesh network.
+ Bluetooth is used to connect an iPhone to a user's meshtastic device to allow text messaging and location data for the mesh network.
NSLocationWhenInUseUsageDescription
We use your location to center maps of the mesh
Privacy – Bluetooth Always Usage Description
diff --git a/MeshtasticClient/MeshtasticClient.entitlements b/MeshtasticClient/MeshtasticClient.entitlements
index 139f8289..d0c2e6d1 100644
--- a/MeshtasticClient/MeshtasticClient.entitlements
+++ b/MeshtasticClient/MeshtasticClient.entitlements
@@ -6,11 +6,11 @@
com.apple.security.device.bluetooth
+ com.apple.security.files.user-selected.read-write
+
com.apple.security.network.client
com.apple.security.personal-information.location
- com.apple.security.files.user-selected.read-write
-
diff --git a/MeshtasticClient/MeshtasticClientApp.swift b/MeshtasticClient/MeshtasticClientApp.swift
index 881d8097..a38832b2 100644
--- a/MeshtasticClient/MeshtasticClientApp.swift
+++ b/MeshtasticClient/MeshtasticClientApp.swift
@@ -6,7 +6,7 @@ struct MeshtasticClientApp: App {
@ObservedObject private var bleManager: BLEManager = BLEManager()
@ObservedObject private var userSettings: UserSettings = UserSettings()
//let persistenceController = PersistenceController.shared
- //@Environment(\.scenePhase) var scenePhase
+ @Environment(\.scenePhase) var scenePhase
var body: some Scene {
WindowGroup {
@@ -15,18 +15,18 @@ struct MeshtasticClientApp: App {
.environmentObject(userSettings)
//.environment(\.managedObjectContext, persistenceController.container.viewContext)
}
- //.onChange(of: scenePhase) { (newScenePhase) in
- // switch newScenePhase {
- // case .background:
- // print("Scene is in the background")
- // persistenceController.save()
- // case .inactive:
- // print("Scene is inactive")
- // case .active:
- // print("Scene is active")
- // @unknown default:
- // print("Apple must have changed something")
- // }
- //}
+ .onChange(of: scenePhase) { (newScenePhase) in
+ switch newScenePhase {
+ case .background:
+ print("Scene is in the background")
+ //persistenceController.save()
+ case .inactive:
+ print("Scene is inactive")
+ case .active:
+ print("Scene is active")
+ @unknown default:
+ print("Apple must have changed something")
+ }
+ }
}
}
diff --git a/MeshtasticClient/Model/Data/NodeInfoEntity.swift b/MeshtasticClient/Model/Data/NodeInfoEntity.swift
index 1c9ce351..af2d1e98 100644
--- a/MeshtasticClient/Model/Data/NodeInfoEntity.swift
+++ b/MeshtasticClient/Model/Data/NodeInfoEntity.swift
@@ -1,16 +1,16 @@
import Foundation
import CoreData
-extension NodeInfoEntity {
- @nonobjc public class func createFetchRequest() -> NSFetchRequest {
- return NSFetchRequest(entityName: "NodeInfoEntity")
- }
+//extension NodeInfoEntity {
+// @nonobjc public class func createFetchRequest() -> NSFetchRequest {
+// return NSFetchRequest(entityName: "NodeInfoEntity")
+// }
- @NSManaged public var id: UInt32
- @NSManaged public var num: UInt32
- @NSManaged public var sha: String
- @NSManaged public var url: String
+// @NSManaged public var id: UInt32
+// @NSManaged public var num: UInt32
+// @NSManaged public var sha: String
+// @NSManaged public var url: String
-}
+//}
diff --git a/MeshtasticClient/RELEASENOTES.md b/MeshtasticClient/RELEASENOTES.md
index 88cd628a..3a8842a6 100644
--- a/MeshtasticClient/RELEASENOTES.md
+++ b/MeshtasticClient/RELEASENOTES.md
@@ -2,6 +2,7 @@
* Update NodeList SwipeAction Button to be role: Destructive
* Added com.apple.security.files.user-selected.read-write entitlement to AppSandbox for MacOS for Mesh log download
+* Cleaned up bluetooth connecting timeout errors and logic, run 10 2 second timers now