diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index fc468019..50ac0586 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -682,7 +682,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.27.9; + MARKETING_VERSION = 1.28.1; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -709,7 +709,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.27.9; + MARKETING_VERSION = 1.28.1; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; diff --git a/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index c50bdf45..3a962f48 100644 --- a/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -42,8 +42,8 @@ filePath = "MeshtasticClient/Helpers/BLEManager.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "475" - endingLineNumber = "475" + startingLineNumber = "476" + endingLineNumber = "476" landmarkName = "peripheral(_:didUpdateValueFor:error:)" landmarkType = "7"> @@ -58,8 +58,8 @@ filePath = "MeshtasticClient/Helpers/BLEManager.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "354" - endingLineNumber = "354" + startingLineNumber = "355" + endingLineNumber = "355" landmarkName = "peripheral(_:didUpdateNotificationStateFor:error:)" landmarkType = "7"> @@ -74,8 +74,8 @@ filePath = "MeshtasticClient/Helpers/BLEManager.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "432" - endingLineNumber = "432" + startingLineNumber = "433" + endingLineNumber = "433" landmarkName = "peripheral(_:didUpdateValueFor:error:)" landmarkType = "7"> diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index f1794975..62e01131 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -196,7 +196,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // called when a peripheral is connected func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) { - peripheral.delegate = self + //peripheral.delegate = self // Invalidate and reset connection timer count, remove any connection errors lastConnectionError = "" self.timeoutTimer!.invalidate() @@ -204,6 +204,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Map the peripheral to the connectedNode and connectedPeripheral ObservedObjects connectedPeripheral = peripherals.filter({ $0.peripheral.identifier == peripheral.identifier }).first + connectedPeripheral.peripheral.delegate = self let deviceName = peripheral.name ?? "" let peripheralLast4: String = String(deviceName.suffix(4)) connectedNode = self.meshData.nodes.first(where: { $0.user.id.contains(peripheralLast4) }) @@ -219,7 +220,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Disconnect Peripheral Event func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) { - peripheral.delegate = self + connectedPeripheral.peripheral.delegate = self // Start a scan so the disconnected peripheral is moved to the peripherals[] if it is awake self.startScanning() self.connectedPeripheral = nil @@ -276,7 +277,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Discover Services Event func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) { - peripheral.delegate = self + connectedPeripheral.peripheral.delegate = self if let e = error { print("Discover Services error \(e)") @@ -300,7 +301,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Discover Characteristics Event func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) { - peripheral.delegate = self + connectedPeripheral.peripheral.delegate = self if let e = error { print("Discover Characteristics error \(e)") @@ -346,7 +347,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) { - peripheral.delegate = self + connectedPeripheral.peripheral.delegate = self print("didUpdateNotificationStateFor char: \(characteristic.uuid.uuidString) \(characteristic.isNotifying)") if meshLoggingEnabled { MeshLogger.log("didUpdateNotificationStateFor char: \(characteristic.uuid.uuidString) \(characteristic.isNotifying)") } if let errorText = error?.localizedDescription @@ -377,7 +378,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Data Read / Update Characteristic Event func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { - peripheral.delegate = self + connectedPeripheral.peripheral.delegate = self if let e = error { print("didUpdateValueFor Characteristic error \(e)") @@ -629,7 +630,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph if decodedInfo.configCompleteID != 0 { if meshLoggingEnabled { MeshLogger.log("BLE Config Complete Packet Id: \(decodedInfo.configCompleteID)") } print("BLE Config Complete Packet Id: \(decodedInfo.configCompleteID)") - + self.connectedPeripheral.subscribed = true } default: diff --git a/MeshtasticClient/Views/Bluetooth/Connect.swift b/MeshtasticClient/Views/Bluetooth/Connect.swift index 1c8c17d1..5d336a1a 100644 --- a/MeshtasticClient/Views/Bluetooth/Connect.swift +++ b/MeshtasticClient/Views/Bluetooth/Connect.swift @@ -64,6 +64,9 @@ struct Connect: View { if bleManager.connectedPeripheral.myInfo != nil { Text("FW Version: ").font(.caption)+Text(bleManager.connectedPeripheral.myInfo?.firmwareVersion ?? "(null)").font(.caption).foregroundColor(Color.gray) } + if bleManager.connectedPeripheral.subscribed { + Text("Properly Subscribed").font(.caption) + } } Spacer()