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
modethe mode that determines when the connect UI appears
bluetoothManagerthe Bluetooth manager used to perform the device search
removeTimeoutthe timeout value passed to
BluetoothManager.startScanning(removeAfter:)sensorIntentdeclares the sensors and sample periods that will be used with this connection
gestureIntentdeclares the gestures that will be used with this connection
userInterfacethe user interface object used throughout the task
completionHandlerthe 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()
ConnectionTask Class Reference