SensorDispatchHandler
public protocol SensorDispatchHandler : AnyObject
This protocol defines functions that are called by a SensorDispatch
to notify a client application that sensor data has been received. Note that default implementations of each of these functions are already provided. Thus, you need only implement the functions corresponding to the sensors you are interested in.
-
receivedSensorData(_:)
Default implementationIndicates that aggregated sensor data has been received. This is useful if you need to tie together the various readings received in a single update.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedSensorData(_ data: SensorData)
-
receivedAccelerometer(vector:accuracy:timestamp:)
Default implementationIndicates that an accelerometer reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedAccelerometer(vector: Vector, accuracy: VectorAccuracy, timestamp: SensorTimestamp)
-
receivedGyroscope(vector:accuracy:timestamp:)
Default implementationIndicates that a gyroscope reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedGyroscope(vector: Vector, accuracy: VectorAccuracy, timestamp: SensorTimestamp)
-
receivedRotation(quaternion:accuracy:timestamp:)
Default implementationIndicates that a rotation reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedRotation(quaternion: Quaternion, accuracy: QuaternionAccuracy, timestamp: SensorTimestamp)
-
receivedGameRotation(quaternion:timestamp:)
Default implementationIndicates that a game rotation reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedGameRotation(quaternion: Quaternion, timestamp: SensorTimestamp)
-
receivedOrientation(vector:accuracy:timestamp:)
Default implementationIndicates that an orientation reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedOrientation(vector: Vector, accuracy: VectorAccuracy, timestamp: SensorTimestamp)
-
receivedMagnetometer(vector:accuracy:timestamp:)
Default implementationIndicates that a magnetometer reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedMagnetometer(vector: Vector, accuracy: VectorAccuracy, timestamp: SensorTimestamp)
-
receivedUncalibratedMagnetometer(vector:bias:timestamp:)
Default implementationIndicates that an uncalibrated magnetometer reading has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedUncalibratedMagnetometer(vector: Vector, bias: Vector, timestamp: SensorTimestamp)
-
receivedGesture(type:timestamp:)
Default implementationIndicates that a gesture has been received.
Default Implementation
A default, empty implementation is provided.
Declaration
Swift
func receivedGesture(type: GestureType, timestamp: SensorTimestamp)