Protocols

The following protocols are available globally.

  • A class protocol allowing notification of a characteristic being listened on, and provides an opportunity to restore its listen callback during Bluetooth state restoration.

    Bluetooth state restoration occurs when the background mode capability is turned on, and if the app is backgrounded or even terminated while a Bluetooth operation is still ongoing, iOS may keep the Bluetooth state alive, and attempt to restore it on resuming the app, so that the connection and operation between the app and the Bluetooth accessory is not interrupted and severed.

    See more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    public protocol RSSIObserver: class
  • 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 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: Peripheral) will also be called immediately if a device is already connected.

    Note

    Note Available callbacks:

  • func bluetoothAvailable(_ available: Bool)

  • func connected(to peripheral: Peripheral)

  • func disconnected(from peripheral: Peripheral)

  • See more

    Declaration

    Swift

    public protocol ConnectionObserver: class