BoseWearableLib

public class BoseWearableLib

Top-level interface to the BoseWearable library. Note that you must call BoseWearable.configure(_:) before using the BoseWearableLib.shared singleton instance. Failing to do so results in a fatal error.

  • Keys for the options dictionary passed to the BoseWearable.configure(_:) function.

    See more

    Declaration

    Swift

    @frozen
    public enum ConfigOption : String
  • The Bluetooth manager handles device discovery and session creation. Client applications can use this object to perform a device search with a custom user interface.

    Declaration

    Swift

    public let bluetoothManager: BluetoothManager
  • Creates a WearableDeviceSession that uses the iOS device’s internal IMU to simulate the sensor data that would be received from a Bose Wearable device. For testing purposes only.

    Declaration

    Swift

    public func createSimulatedWearableDeviceSession() -> WearableDeviceSession
  • Begins the connection workflow for Bose devices. A UIViewController may be modally presented on a newly-created UIWindow to present a list of discovered devices. The user can select a device from this list. The mode value passed allows for already-connected devices to be automatically selected.

    Once a device has been selected (either by the user or via automatic selection described above), depending on the device’s capabilities, other screens might be shown guiding the user to complete the pairing process.

    Callers can 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.

    The result of the operation is passed to the specified completion handler. This will either indicate that the session was successfully created, that the operation failed with an error, or that the operation was cancelled by the user.

    Declaration

    Swift

    @available(iOS 12.0, *)
    @discardableResult
    public func startConnection(mode: ConnectUIMode,
                                sensorIntent: SensorIntent = SensorIntent(sensors: [], samplePeriods: []),
                                gestureIntent: GestureIntent = GestureIntent(gestures: []),
                                completionHandler: @escaping (CancellableResult<WearableDeviceSession>) -> Void) -> AnyConnectionTask

    Parameters

    mode

    The mode of operation. See the documentation for ConnectUIMode for more details.

    sensorIntent

    Declares the sensors and sample periods that will be used with this connection. Defaults to an empty intent object.

    gestureIntent

    Declares the gestures that will be used with this connection. Defaults to an empty intent object.

    completionHandler

    A callback that is invoked with the result of the operation.

  • Begins searching for devices in the specified mode. A UIViewController may be modally presented on a newly-created UIWindow to present a list of discovered devices. The user can select a device from this list. The mode value passed allows for already-connected devices to be automatically selected.

    Once a device has been selected (either by the user or via automatic selection described above), a session is created. The session must be opened before being used.

    The result of the operation is passed to the specified completion handler. This will either indicate that the session was successfully created and opened, that the operation failed with an error, or that the operation was cancelled by the user.

    Declaration

    Swift

    @available(*, deprecated, message: "Use BoseWearable.startConnection(mode:sensorIntent:gestureIntent:completionHander:﹚ instead.")
    public func startDeviceSearch(mode: DeviceSearchMode, completionHandler: @escaping (CancellableResult<WearableDeviceSession>) -> Void)

    Parameters

    mode

    The mode of operation. See the documentation for SearchUI.Mode for more details.

    completionHandler

    A callback that is invoked with the result of the operation.

  • If true, enables logging of device-level events. Default is false.

    Declaration

    Swift

    public static var isDeviceLoggingEnabled: Bool { get set }
  • If true, enabled logging of sensor data. Default is false.

    Declaration

    Swift

    public static var isSensorDataLoggingEnabled: Bool { get set }
  • If true, enables logging of sensor events. Default is false.

    Declaration

    Swift

    public static var isSensorLoggingEnabled: Bool { get set }
  • If true, enables logging of service-level events. Default is false.

    Declaration

    Swift

    public static var isServiceLoggingEnabled: Bool { get set }
  • If true, enables logging of session-level events. Default is false.

    Declaration

    Swift

    public static var isSessionLoggingEnabled: Bool { get set }
  • If true, enables logging of connect UI events. Default is false.

    Declaration

    Swift

    public static var isConnectUILoggingEnabled: Bool { get set }
  • Enables all BoseWearable logging.

    Declaration

    Swift

    public static func enableAllLogging()
  • Disables all BoseWearable logging.

    Declaration

    Swift

    public static func disableAllLogging()
  • Enables commonly useful BoseWearable logging.

    Declaration

    Swift

    public static func enableCommonLogging()
  • Initializes and configures the BoseWearable library with the specified options (if provided, otherwise default values will be used). Note this function can only be called once. Subsequent calls will result in a fatal error.

    Declaration

    Swift

    public static func configure(_ options: [ConfigOption : Any] = [:])
  • The shared singleton BoseWearable instance. Note that the configure(_:) method must be called before referencing this variable. Otherwise, a fatal error will be raised.

    Declaration

    Swift

    public static var shared: BoseWearableLib { get }
  • The release version of the BoseWearable framework. This corresponds to the CFBundleShortVersionString key in the framework’s Info.plist.

    Declaration

    Swift

    public static var releaseVersion: String? { get }
  • The build number of the BoseWearable framework. This corresponds to the CFBundleVersion key in the framework’s Info.plist.

    Declaration

    Swift

    public static var buildNumber: String? { get }
  • The formatted version of the BoseWearable framework, combining the release version and build number.

    Declaration

    Swift

    public static var formattedVersion: String { get }