Skip to content

Commit

Permalink
⚗️ (BLEKit): Try and fix double connection
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Aug 26, 2024
1 parent b56f3fa commit bf3c3bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Modules/BLEKit/Sources/BLEManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public class BLEManager {
private func subscribeToDidDisconnect() {
self.centralManager.didDisconnectPeripheral
.sink { _ in
self.connectedRobotPeripheral = nil
self.didDisconnect.send()
}
.store(in: &self.cancellables)
Expand Down
4 changes: 4 additions & 0 deletions Modules/RobotKit/Sources/Robot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public class Robot {

public var connectedPeripheral: RobotPeripheral? {
didSet {
guard self.connectedPeripheral != nil else {
return
}

registerBatteryCharacteristicNotificationCallback()
registerChargingStatusNotificationCallback()
registerNegotiatedMTUNotificationCallback()
Expand Down

0 comments on commit bf3c3bc

Please sign in to comment.