JacquardManager

public protocol JacquardManager

Discovers and connects to Jacquard tags.

In normal use, you will obtain a singleton instance via sharedJacquardManager.

  • Convenience initializer.

    You should only create one instance of JacquardManagerImplementation.

    Declaration

    Swift

    init(
      publishQueue: DispatchQueue,
      options: [String: String]?,
      config: SDKConfig,
      restorePeripheralsHandler: (([UUID]) -> Void)?
    )
  • Publishes the current state of the CBPeripheralManager.

    This will immediately publish the current state as well as any future changes.

    Declaration

    Swift

    var centralState: AnyPublisher<CBManagerState, Never> { get }
  • Publishes a value whenever the CoreBluetooth scanning state changes.

    Declaration

    Swift

    var isScanning: AnyPublisher<Bool, Never> { get }
  • Default connection timeout is 60 seconds. In future, SDK will allow to set connection timeout using an api. http://b/222397075 Allow SDK User to set connection timeout.

    Declaration

    Swift

    var connectionTimeoutDuration: TimeInterval { get }
  • Start scanning for connectable Jacquard tags.

    Discovered tags will be published to advertisingTags. EnsurecentralState is CBManagerState.poweredOn before calling this method.

    You should call stopScanning() when you no longer need to observe advertising tags.

    Throws

    Throws JacquardManagerScanningError.

    Declaration

    Swift

    func startScanning(options: [String : Any]?) throws

    Parameters

    options

    An optional dictionary specifying options (CBCentralManagerScanOptionAllowDuplicatesKey, CBCentralManagerScanOptionSolicitedServiceUUIDsKey) for the scan.

  • Stops scanning for connectable Jacquard tags.

    Declaration

    Swift

    func stopScanning()
  • Specify vendor id and product id if you are looking for ujt firmware specific to your app.

    Declaration

    Swift

    func setTargetUjtFirmwareVidPid(_ targetUjtFirmwareVidPid: VidPidMid?)

    Parameters

    targetUjtFirmwareVidPid

    an instance of VidPidMid contains Vid/Pid/Mid info.

  • Publishes any found Jacquard tags.

    Tags will be discovered once startScanning() is called. You can pass an instance of AdvertisedTag to .connect(_:).

    Declaration

    Swift

    var advertisingTags: AnyPublisher<AdvertisedTag, Never> { get }
  • Returns any Jacquard tags already connected to the phone.

    You can pass UUID PreConnectedTag.identifier to .connect(_:)

    Declaration

    Swift

    func preConnectedTags() -> [PreConnectedTag]
  • Connects to a connectable tag.

    The publisher returned by this method will always publish the current state (which includes the current ConnectedTag instance in the case of .connected) when any new subscription is made.

    Declaration

    Swift

    func connect(_ tag: ConnectableTag) -> AnyPublisher<TagConnectionState, Error>

    Parameters

    tag

    an instance that conforms to ConnectableTag (which you can obtain either via .advertisedTags or .preConnectedTags().

  • Connect to a known tag by identifier.

    connect(_ tag:) should be used in preference when you have obtained an AdvertisedTag instance from scanning, or have a PreConnectedTag instance from preConnectedTags(). This method is useful when you have persisted a UUID and wish to attempt a connection.

    If a bluetooth with this UUID is not known to Core Bluetooth, the publisher will complete with error TagConnectionError.bluetoothDeviceNotFound.

    The publisher returned by this method will always publish the current state (which includes the current ConnectedTag instance in the case of .connected) when any new subscription is made.

    Declaration

    Swift

    func connect(_ identifier: UUID) -> AnyPublisher<TagConnectionState, Error>

    Parameters

    identifier
  • Provides ConnectedTag if available.

    The publisher returned by this method will have a ConnectedTag instance if the current state of the tag is .connected or nil otherwise.

    Declaration

    Swift

    func getConnectedTag(for identifier: UUID) -> AnyPublisher<ConnectedTag?, Never>

    Parameters

    identifier

    an identifier for the required ConnectedTag.

  • Disconnect to a known tag.

    If this peripheral is not known to Core Bluetooth, the publisher will complete with error TagConnectionError.bluetoothDeviceNotFound.

    Declaration

    Swift

    func disconnect(_ tag: ConnectedTag) -> AnyPublisher<TagConnectionState, Error>

    Parameters

    tag

    a connected tag

  • Disconnect to a known tag by identifier.

    If this peripheral is not known to Core Bluetooth, the publisher will complete with error TagConnectionError.bluetoothDeviceNotFound.

    Declaration

    Swift

    func disconnect(_ identifier: UUID) -> AnyPublisher<TagConnectionState, Error>

    Parameters

    identifier

    the CoreBluetooth identifier of a connected tag