RVS_BTDriver

public class RVS_BTDriver : NSObject
extension RVS_BTDriver: RVS_SequenceProtocol

This is the main driver class. It is the “manager” for all the bluetooth-connected devices, which are accessible as RVS_BTDriver_DeviceProtocol-conformant instances.

The RVS_BTDriver instance can be treated like a Sequence, with an iterator, higher-order functions and subscripting.

Just remember that it aggregates a protocol, not a class/struct, so you see a “mask” over a different class that is known internally.

Internal Ininitailzer

RVS_BTDriver Sequence Support

Public Error Enum

  • The error enum declaration.

    See more

    Declaration

    Swift

    public enum Errors : Error

Public Subscript

  • Simple “String Key” subscript, so we can treat the array as a dictionary.

    Declaration

    Swift

    public subscript(inStringKey: String) -> RVS_BTDriver_DeviceProtocol! { get }

    Parameters

    inStringKey

    A String, containing the unique UUID of the device we are looking for.

    Return Value

    The device, or nil, if not found.

Public Computed Properties

  • A weak reference to the instance delegate.

    Declaration

    Swift

    public var delegate: RVS_BTDriverDelegate! { get set }
  • This is KVO (READ-ONLY)

    Declaration

    Swift

    @objc
    dynamic public var isBTAvailable: Bool { get }

    Return Value

    true, if all of the vendor interfaces have Bluetooth powered on.

  • This is KVO (READ-ONLY)

    Declaration

    Swift

    @objc
    dynamic public var isScanning: Bool { get }

    Return Value

    true, if even one of the vendor interfaces is in active scanning.

Public Instance Methods

  • Tells the vendor interfaces (all of them) to start scanning for services.

    Declaration

    Swift

    public func startScanning()
  • Tells the vendor interfaces to stop scanning.

    Declaration

    Swift

    public func stopScanning()
  • Removes an indicated device from our list.

    Declaration

    Swift

    public func removeDevice(_ inDevice: RVS_BTDriver_DeviceProtocol)

    Parameters

    inDevice

    The device instance to be removed. After this call, it should be considered invalid.

Public Initializer

  • The main initializer.

    Declaration

    Swift

    public convenience init(delegate inDelegate: RVS_BTDriverDelegate, vendors inVendors: [RVS_BTDriver_VendorTypes] = [], queue inQueue: DispatchQueue? = nil, allowDuplicatesInBLEScan inAllowDuplicatesInBLEScan: Bool = false, stayConnected inStayConnected: Bool = false)

    Parameters

    delegate

    The delegate to be used with this instance. It cannot be nil, and is a weak reference.

    vendors

    This is an Array of vendor enums, and is used to determine which vendors will be loaded.

    queue

    This is a desired queue for the CB manager to operate from. It is optional, and default is nil (main queue).

    allowDuplicatesInBLEScan

    This is a flag that specifies that the scanner can be continuously running, and “re-finding” duplicate devices. If true, it could adversely affect battery life. Default is false.

    stayConnected

    This is set to true, if you want all your device connections to be persistent. That is, once connected, they must be explicitly disconencted by the user. Otherwise, each device will be connected only while interacting. This is optional. Default is false.

Public Description

  • This is a simplified, readable description of the instance that should be quite useful.

    Declaration

    Swift

    @objc
    dynamic public override var description: String { get }