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 Nov 13, 2024
1 parent 54fca85 commit 628d2e3
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 @@ -151,6 +151,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 @@ -41,6 +41,10 @@ public class Robot {

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

registerBatteryCharacteristicNotificationCallback()
registerChargingStatusNotificationCallback()
registerNegotiatedMTUNotificationCallback()
Expand Down

0 comments on commit 628d2e3

Please sign in to comment.