Publisher

extension Publisher
extension Publisher where Self.Failure == LittleBluetoothError
extension Publisher where Self.Output == PeripheralDiscovery, Self.Failure == LittleBluetoothError
extension Publisher where Self.Output == PeripheralIdentifier, Self.Failure == LittleBluetoothError
  • Provides a subject that shares a single subscription to the upstream publisher and replays at most bufferSize items emitted by that publisher

    Declaration

    Swift

    public func shareReplay(_ bufferSize: Int) -> AnyPublisher<Output, Failure>

    Parameters

    bufferSize

    limits the number of items that can be replayed

Available where Self.Failure == LittleBluetoothError

RSSI

Read

Write

Available where Self.Failure == LittleBluetoothError

Available where Self.Output == PeripheralDiscovery, Self.Failure == LittleBluetoothError

Available where Self.Output == PeripheralIdentifier, Self.Failure == LittleBluetoothError

Available where Self.Failure == LittleBluetoothError

  • Disconnect the connected Peripheral

    Declaration

    Swift

    @discardableResult
    public func disconnect(for littleBluetooth: LittleBlueTooth) -> AnyPublisher<Peripheral, LittleBluetoothError>

    Return Value

    A publisher with the just disconnected Peripheral or a LittleBluetoothError

  • Specialized timeout function to return a LittleBluetoothError error type. By default it returns .operationTimeout, but you can specify a different error such as .connectionTimeout, .scanTimeout Terminates publishing if the upstream publisher exceeds the specified time interval without producing an element.

    Declaration

    Swift

    public func timeout<S>(_ interval: S.SchedulerTimeType.Stride, scheduler: S, options: S.SchedulerOptions? = nil, error: LittleBluetoothError = .operationTimeout) -> AnyPublisher<Self.Output, LittleBluetoothError> where S : Scheduler

    Parameters

    interval

    The maximum time interval the publisher can go without emitting an element, expressed in the time system of the scheduler.

    scheduler

    The scheduler to deliver events on.

    options

    Scheduler options that customize the delivery of elements.

    error

    An error to be returned if the publisher times out, by default LittleBluetoothError.connectionTimeout

    Return Value

    A publisher that terminates if the specified interval elapses with no events received from the upstream publisher.