RVS_BTDriver_InterfaceProtocol

internal protocol RVS_BTDriver_InterfaceProtocol : AnyObject

This is a protocol that describes the basic transport abstraction for our bluetooth device connection. It will be specialized for Classic or BLE.

  • A reference to the main driver instance.

    Declaration

    Swift

    var driver: RVS_BTDriver! { get set }
  • A list of the vendors that are users of this interface.

    Declaration

    Swift

    var vendors: [RVS_BTDriver_VendorProtocol] { get set }
  • interface Default implementation

    Read-only accessor for the interface.

    Default Implementation

    This allows us to skip the base class, so we don’t need to override anything.

    Declaration

    Swift

    var interface: RVS_BTDriver_InterfaceProtocol! { get }

    Return Value

    An instance of the interface for this type of device. Can be nil, if makeInterface(:) has not yet been called.

  • This flag tells the driver to maintain a persistent connection (until explicitly disconneted).

    Otherwise, connections are made and canceled for each transaction.

    Declaration

    Swift

    var persistentConnection: Bool { get set }
  • This flag tells the driver to “remember” devices that it discovers in a scan.

    This means that when a device is “rediscovered,” we don’t get another discovery event.

    If true (default), then we only get one discovery event per device. If false, we keep getting discovery events.

    This can be useful for “rediscovering” devices that we remove from our list (set to false for that).

    Declaration

    Swift

    var rememberAdvertisedDevices: Bool { get set }
  • makeInterface(queue:) Default implementation

    OPTIONAL (but actually required): This is a factory/accessor for the interface SINGLETON.

    Default Implementation

    This allows us to skip the base class, so we don’t need to override anything.

    Declaration

    Swift

    static func makeInterface(queue: DispatchQueue!) -> RVS_BTDriver_InterfaceProtocol!
  • OPTIONAL (but actually required): READ-ONLY. If true, then Bluetooth is available (powered on).

    Declaration

    Swift

    var isBTAvailable: Bool { get }
  • OPTIONAL (but actually required): This is an “on/off” switch for scanning for peripherals.

    If set to true, scanning begins, if false, scanning stops.

    Declaration

    Swift

    var isScanning: Bool { get set }