Skip to content

Commit

Permalink
Bluetooth Publisher is not public animore
Browse files Browse the repository at this point in the history
  • Loading branch information
NickKibish committed Oct 6, 2023
1 parent 86235e5 commit ad66f34
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Sources/iOS-BLE-Library-Mock/Peripheral/Peripheral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bool, Error>
-> AnyPublisher<Bool, Error>
{
if characteristic.isNotifying == isEnabled {
return Just(isEnabled)
.setFailureType(to: Error.self)
.bluetooth {}
.eraseToAnyPublisher()
}

return peripheralDelegate.notificationStateSubject
Expand All @@ -314,5 +314,7 @@ extension Peripheral {
.bluetooth {
self.peripheral.setNotifyValue(isEnabled, for: characteristic)
}
.autoconnect()
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension Publishers {
.store(in: &cancellables)
```
*/
public class BluetoothPublisher<Output, Failure: Error>: ConnectablePublisher {
class BluetoothPublisher<Output, Failure: Error>: ConnectablePublisher {

private let inner: BaseConnectable<Output, Failure>

Expand Down
6 changes: 4 additions & 2 deletions Sources/iOS-BLE-Library/Peripheral/Peripheral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bool, Error>
-> AnyPublisher<Bool, Error>
{
if characteristic.isNotifying == isEnabled {
return Just(isEnabled)
.setFailureType(to: Error.self)
.bluetooth {}
.eraseToAnyPublisher()
}

return peripheralDelegate.notificationStateSubject
Expand All @@ -333,5 +333,7 @@ extension Peripheral {
.bluetooth {
self.peripheral.setNotifyValue(isEnabled, for: characteristic)
}
.autoconnect()
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension Publishers {
.store(in: &cancellables)
```
*/
public class BluetoothPublisher<Output, Failure: Error>: ConnectablePublisher {
class BluetoothPublisher<Output, Failure: Error>: ConnectablePublisher {

private let inner: BaseConnectable<Output, Failure>

Expand Down

0 comments on commit ad66f34

Please sign in to comment.