Protocols

The following protocols are available globally.

  • Protocols for handling the results of a background restoration.

    Important

    The delegate must be an UIApplicationDelegate in order to properly support background restoration during didFinishLaunchingWithOptions.
    See more

    Declaration

    Swift

    public protocol BackgroundRestorer : UIApplicationDelegate
  • A protocol allowing conforming objects registered to Bluejay to optionally respond to Bluetooth connection events.

    Attention

    Attention On initial subscription to Bluetooth events, bluetoothAvailable(_ available: Bool) will always be called immediately with whatever the current state is, and connected(to peripheral: PeripheralIdentifier) will also be called immediately if a device is already connected.

    Note

    Note Available callbacks:

  • func bluetoothAvailable(_ available: Bool)

  • func connected(to peripheral: PeripheralIdentifier)

  • func disconnected(from peripheral: PeripheralIdentifier)

  • See more

    Declaration

    Swift

    public protocol ConnectionObserver : 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.
    See more

    Declaration

    Swift

    public protocol DisconnectHandler : AnyObject
  • Protocol for handling a listen event that does not have a callback due to background restoration.

    See more

    Declaration

    Swift

    public protocol ListenRestorer : UIApplicationDelegate
  • A protocol allowing conforming objects to monitor log file changes.

    See more

    Declaration

    Swift

    public protocol LogObserver : AnyObject
  • A protocol allowing conforming objects to monitor the RSSI changes of a connected peripheral.

    See more

    Declaration

    Swift

    public protocol RSSIObserver : AnyObject
  • Protocol to indicate that a type can be received from the Bluetooth connection.

    See more

    Declaration

    Swift

    public protocol Receivable
  • Protocol to indicate that a type can be sent via the Bluetooth connection.

    See more

    Declaration

    Swift

    public protocol Sendable
  • A protocol allowing conforming objects to monitor the services changes of a connected peripheral.

    See more

    Declaration

    Swift

    public protocol ServiceObserver : AnyObject