Classes
The following classes are available globally.
-
Top-level interface to the BoseWearable library. Note that you must call
See moreBoseWearable.configure(_:)before using theBoseWearableLib.sharedsingleton instance. Failing to do so results in a fatal error.Declaration
Swift
public class BoseWearableLib
-
Encapsulates the device search and connection functionality. It requires a
See moreConnectUIimplementation that gets called to show and update the user interface throughout the search, connect, and secure pairing process.Declaration
Swift
public class ConnectionTask<ConnectUIImpl> : AnyConnectionTask where ConnectUIImpl : ConnectUI
-
The
See moreDeviceSearchTaskclass encapsulates the device search functionality. It requires aDeviceSearchUserInterfaceobject that gets called to show and update the device picker which allows users to select a discovered device. TheDeviceSearchUserInterfacecalls back into theDeviceSearchTaskvia theDeviceSearchUserInterfaceDelegateprotocol.Declaration
Swift
@available(*, deprecated, message: "DeviceSearchTask has been replaced by ConnectionTask.") public class DeviceSearchTask
-
A
SensorDispatchobject is used to receive sensor readings. ASensorDispatchobject listens for the underlyingWearableDeviceEventnotifications indicating that sensor data has been received. It then unpacks the individual values from the data and dispatches each to its appropriate callback block and to its handler (aSensorDispatchHandlerobject).An app can have arbitrarily many
SensorDispatchobjects. This allows multiple handlers inside an app all to listen to the same sensor. EachSensorDispatchautomatically registers and deregisters for the appropriateWearableDeviceEventnotifications.A
SensorDispatchobject is created with an associatedOperationQueue. Specifying the.mainqueue is suitable for when the app’s user interface should be updated in response to the event. Otherwise, a backgroundOperationQueuecan be provided.When a
WearableDeviceEvent.didReceiveSensorData(SensorData)notification is received, theSensorDispatchobject does the following on theOperationQueueprovided to theSensorDispatchinitializer:- Dispatches the
SensorDataobject tosensorDataCallbackand toSensorDispatchHandler.receivedSensorData(_:). - Each of the values in the
SensorDataobject is dispatched to the appropriate handler:- Accelerometer values are dispatched to
accelerometerCallbackand toSensorDispatchHandler.receivedAccelerometer(vector:accuracy:timestamp:) - Gyroscope values are dispatched to
gyroscopeCallbackand toSensorDispatchHandler.receivedGyroscope(vector:accuracy:timestamp:) - Rotation values are dispatched to
rotationCallbackand toSensorDispatchHandler.receivedRotation(quaternion:accuracy:timestamp:). - Game rotation values are dispatched to
gameRotationCallbackand toSensorDispatchHandler.receivedGameRotation(quaternion:timestamp:). - Orientation values are dispatched to
orientationCallbackand toSensorDispatchHandler.receivedOrientation(vector:accuracy:timestamp:) - Magnetometer values are dispatched to
magnetometerCallbackand toSensorDispatchHandler.receivedMagnetometer(vector:accuracy:timestamp:) - Uncalibrated magnetometer values are dispatched to
uncalibratedMagnetometerCallbackand toSensorDispatchHandler.receivedUncalibratedMagnetometer(vector:bias:timestamp:)
- Accelerometer values are dispatched to
Callbacks are only invoked if they are non-nil. Thus you need only provide callback blocks for sensors you are interested in. Similarly, the
See moreSensorDispatchHandlerprotocol provides default implementation of all of its handler functions. Thus you need only provide implementations for sensors you are interested in. ASensorDispatchHandlerand callback blocks can co-exist. Each callback is invoked before the correspondingSensorDispatchHandlerfunction.Declaration
Swift
public class SensorDispatch - Dispatches the
-
An opaque token used to add and remove listeners backed by
NotificationCenter. AListenerTokenobject retains the token returned byNotificationCenter.addObserver(for:object:queue:)as well as theNotificationCenter. When the object is deallocated, we automatically remove the observer from the retainedNotificationCenterusing the retained token.Declaration
Swift
public class ListenerToken
Classes Reference