diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index 8104211f..8a2e26c8 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ DD47E3CC26F0E51D00029299 /* NodeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CB26F0E51D00029299 /* NodeDetail.swift */; }; DD47E3CE26F103C600029299 /* NodeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeList.swift */; }; DD47E3D026F1073F00029299 /* NodeRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CF26F1073F00029299 /* NodeRow.swift */; }; - DD47E3D226F1210600029299 /* HelperFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D126F1210600029299 /* HelperFunctions.swift */; }; DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; }; DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D826F3093800029299 /* MessageBubble.swift */; }; DD47E3DB26F3901B00029299 /* Channels.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3DA26F3901A00029299 /* Channels.swift */; }; @@ -76,7 +75,6 @@ DD47E3CB26F0E51D00029299 /* NodeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetail.swift; sourceTree = ""; }; DD47E3CD26F103C600029299 /* NodeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeList.swift; sourceTree = ""; }; DD47E3CF26F1073F00029299 /* NodeRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeRow.swift; sourceTree = ""; }; - DD47E3D126F1210600029299 /* HelperFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperFunctions.swift; sourceTree = ""; }; DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = ""; }; DD47E3D826F3093800029299 /* MessageBubble.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageBubble.swift; sourceTree = ""; }; DD47E3DA26F3901A00029299 /* Channels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channels.swift; sourceTree = ""; }; @@ -327,7 +325,6 @@ DDAF8C5226EB1DF10058C060 /* BLEManager.swift */, DDC2E1A626CEB3400042C5E4 /* LocationHelper.swift */, DDAF8C6D26ED19040058C060 /* Extensions.swift */, - DD47E3D126F1210600029299 /* HelperFunctions.swift */, DD913638270DFF4C00D7ACF3 /* LocalNotificationManager.swift */, DD8169F8271F1A6100F4AB02 /* MeshLogger.swift */, ); @@ -503,7 +500,6 @@ DD47E3CC26F0E51D00029299 /* NodeDetail.swift in Sources */, DD836AEF26F85D8D00ABCC23 /* NodeInfoModel.swift in Sources */, DDC2E1A726CEB3400042C5E4 /* LocationHelper.swift in Sources */, - DD47E3D226F1210600029299 /* HelperFunctions.swift in Sources */, DDAF8C5F26ED09B50058C060 /* radioconfig.pb.swift in Sources */, DD913639270DFF4C00D7ACF3 /* LocalNotificationManager.swift in Sources */, DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */, diff --git a/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 965f7499..1cb05e42 100644 --- a/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-protobuf.git", "state": { "branch": null, - "revision": "1f62db409f2c9b0223a3f68567b4a01333aae778", - "version": "1.17.0" + "revision": "7e2c5f3cbbeea68e004915e3a8961e20bd11d824", + "version": "1.18.0" } } ] 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 f9401b31..55e733ce 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 = "489" - endingLineNumber = "489" + startingLineNumber = "500" + endingLineNumber = "500" landmarkName = "peripheral(_:didUpdateValueFor:error:)" landmarkType = "7"> @@ -58,8 +58,8 @@ filePath = "MeshtasticClient/Helpers/BLEManager.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "445" - endingLineNumber = "445" + startingLineNumber = "456" + endingLineNumber = "456" landmarkName = "peripheral(_:didUpdateValueFor:error:)" landmarkType = "7"> @@ -91,8 +91,22 @@ startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "43" - endingLineNumber = "43" - landmarkName = "saveContext()" + endingLineNumber = "43"> + + + + diff --git a/MeshtasticClient/Helpers/BluetoothManager.swift b/MeshtasticClient/Helpers/BluetoothManager.swift new file mode 100644 index 00000000..06964e62 --- /dev/null +++ b/MeshtasticClient/Helpers/BluetoothManager.swift @@ -0,0 +1,27 @@ +// +// BluetoothManager.swift +// MeshtasticClient +// +// Created by Garth Vander Houwen on 12/1/21. +// + +import Combine +import CoreBluetooth + +final class BluetoothManager: NSObject { + + private var centralManager: CBCentralManager! + + var stateSubject: PassthroughSubject = .init() + var peripheralSubject: PassthroughSubject = .init() + + func start() { + centralManager = .init(delegate: self, queue: .main) + } + + func connect(_ peripheral: CBPeripheral) { + centralManager.stopScan() + peripheral.delegate = self + centralManager.connect(peripheral) + } +} diff --git a/MeshtasticClient/Helpers/HelperFunctions.swift b/MeshtasticClient/Helpers/HelperFunctions.swift deleted file mode 100644 index bc929c0f..00000000 --- a/MeshtasticClient/Helpers/HelperFunctions.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// HelperFunctions.swift -// MeshtasticClient -// -// Created by Garth Vander Houwen on 9/14/21. -// - -import Foundation -import SwiftUI