DisconnectHandler

public protocol DisconnectHandler : AnyObject

A protocol allowing a single delegate registered to Bluejay to have a final say at the end of a disconnection, as well as evaluate and control the auto-reconnect behaviour.

Attention

Be careful with how you organize app and Bluejay logic inside your connect, explicit disconnect, the disconnect handler callbacks. It may be easy to create redundant or conflicting code. As a rule of thumb, we recommend putting light weight and repeatable logic, such as UI updates, inside your connect and disconnect callbacks. And for more major operations such as restarting any Bluetooth tasks, use the disconnect handler.
  • Notifies the delegate that the peripheral is fully disconnected.

    Declaration

    Swift

    func didDisconnect(from peripheral: PeripheralIdentifier, with error: Error?, willReconnect autoReconnect: Bool) -> AutoReconnectMode

    Parameters

    peripheral

    the peripheral disconnected

    error

    the reason of the disconnection from CoreBluetooth, not Bluejay

    autoReconnect

    whether Bluejay will auto-reconnect if no change is given