ConnectionTask
public class ConnectionTask<ConnectUIImpl> : AnyConnectionTask where ConnectUIImpl : ConnectUI
Encapsulates the device search and connection functionality. It requires a ConnectUI
implementation that gets called to show and update the user interface throughout the search, connect, and secure pairing process.
-
init(mode:bluetoothManager:removeTimeout:sensorIntent:gestureIntent:userInterface:completionHandler:)
Creates a new connection task.
Callers must specify sensor and gesture intents that are used to check device compatibility. Once a session is created and the connection is established, the device is queried to ensure that it provides the features specified in the intents. If those features are not provided, the connection fails.
Declaration
Swift
public init(mode: ConnectUIMode, bluetoothManager: BluetoothManager = BoseWearableLib.shared.bluetoothManager, removeTimeout: TimeInterval = 15, sensorIntent: SensorIntent, gestureIntent: GestureIntent, userInterface: ConnectUIImpl, completionHandler: @escaping (CancellableResult<WearableDeviceSession>) -> Void)
Parameters
mode
the mode that determines when the connect UI appears
bluetoothManager
the Bluetooth manager used to perform the device search
removeTimeout
the timeout value passed to
BluetoothManager.startScanning(removeAfter:)
sensorIntent
declares the sensors and sample periods that will be used with this connection
gestureIntent
declares the gestures that will be used with this connection
userInterface
the user interface object used throughout the task
completionHandler
the callback to receive the result of the device search task
-
Starts the task.
Declaration
Swift
@available(iOS 12.0, *) public func start()
-
Declaration
Swift
public func cancel()