You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactored BLE connection process to eliminate a lot of cruft. Left the dead code as comments just in case, or roll back to the previous commit if it's really bad. Changed build number to 5
Copy file name to clipboardExpand all lines: Infini-iOS/BLE/BLEManager.swift
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
64
64
@PublishedvarblePermissions:Bool!
65
65
66
66
// Selecting and connecting variables
67
-
@Publishedvarperipherals=[Peripheral]() // used to print human-readable device names to UI in selection process
67
+
@Publishedvarperipherals=[Peripheral]()
68
+
@PublishedvarnewPeripherals:[CBPeripheral]=[] // used to print human-readable device names to UI in selection process
68
69
@PublishedvardeviceToConnect:Int! // When the user selects a device from the UI, that peripheral's ID goes in this var, which is passed to the peripheralDictionary
69
70
@PublishedvarperipheralDictionary:[Int:CBPeripheral]=[:] // this is the dictionary that relates human-readable peripheral names to the CBPeripheral class that CoreBluetooth actually interacts with
70
71
@PublishedvarinfiniTime:CBPeripheral! // variable to save the CBPeripheral that you're connecting to
@@ -99,6 +100,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
99
100
isScanning =true
100
101
peripherals =[Peripheral]()
101
102
peripheralDictionary =[:]
103
+
newPeripherals =[]
102
104
}
103
105
104
106
func stopScanning(){
@@ -138,18 +140,22 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
0 commit comments