diff --git a/Sources/iOS-BLE-Library-Mock/Peripheral/Peripheral.swift b/Sources/iOS-BLE-Library-Mock/Peripheral/Peripheral.swift index fa16933..f1329e1 100644 --- a/Sources/iOS-BLE-Library-Mock/Peripheral/Peripheral.swift +++ b/Sources/iOS-BLE-Library-Mock/Peripheral/Peripheral.swift @@ -295,12 +295,12 @@ extension Peripheral { /// - characteristic: The characteristic for which to set the notification state. /// - Returns: A publisher indicating success or an error. public func setNotifyValue(_ isEnabled: Bool, for characteristic: CBCharacteristic) - -> Publishers.BluetoothPublisher + -> AnyPublisher { if characteristic.isNotifying == isEnabled { return Just(isEnabled) .setFailureType(to: Error.self) - .bluetooth {} + .eraseToAnyPublisher() } return peripheralDelegate.notificationStateSubject @@ -314,5 +314,7 @@ extension Peripheral { .bluetooth { self.peripheral.setNotifyValue(isEnabled, for: characteristic) } + .autoconnect() + .eraseToAnyPublisher() } } diff --git a/Sources/iOS-BLE-Library-Mock/Utilities/Publishers/Publishers+Bluetooth.swift b/Sources/iOS-BLE-Library-Mock/Utilities/Publishers/Publishers+Bluetooth.swift index 426e26f..bb41d71 100644 --- a/Sources/iOS-BLE-Library-Mock/Utilities/Publishers/Publishers+Bluetooth.swift +++ b/Sources/iOS-BLE-Library-Mock/Utilities/Publishers/Publishers+Bluetooth.swift @@ -37,7 +37,7 @@ extension Publishers { .store(in: &cancellables) ``` */ - public class BluetoothPublisher: ConnectablePublisher { + class BluetoothPublisher: ConnectablePublisher { private let inner: BaseConnectable diff --git a/Sources/iOS-BLE-Library/Peripheral/Peripheral.swift b/Sources/iOS-BLE-Library/Peripheral/Peripheral.swift index a216c26..eb983c0 100644 --- a/Sources/iOS-BLE-Library/Peripheral/Peripheral.swift +++ b/Sources/iOS-BLE-Library/Peripheral/Peripheral.swift @@ -314,12 +314,12 @@ extension Peripheral { /// - characteristic: The characteristic for which to set the notification state. /// - Returns: A publisher indicating success or an error. public func setNotifyValue(_ isEnabled: Bool, for characteristic: CBCharacteristic) - -> Publishers.BluetoothPublisher + -> AnyPublisher { if characteristic.isNotifying == isEnabled { return Just(isEnabled) .setFailureType(to: Error.self) - .bluetooth {} + .eraseToAnyPublisher() } return peripheralDelegate.notificationStateSubject @@ -333,5 +333,7 @@ extension Peripheral { .bluetooth { self.peripheral.setNotifyValue(isEnabled, for: characteristic) } + .autoconnect() + .eraseToAnyPublisher() } } diff --git a/Sources/iOS-BLE-Library/Utilities/Publishers/Publishers+Bluetooth.swift b/Sources/iOS-BLE-Library/Utilities/Publishers/Publishers+Bluetooth.swift index 426e26f..bb41d71 100644 --- a/Sources/iOS-BLE-Library/Utilities/Publishers/Publishers+Bluetooth.swift +++ b/Sources/iOS-BLE-Library/Utilities/Publishers/Publishers+Bluetooth.swift @@ -37,7 +37,7 @@ extension Publishers { .store(in: &cancellables) ``` */ - public class BluetoothPublisher: ConnectablePublisher { + class BluetoothPublisher: ConnectablePublisher { private let inner: BaseConnectable