var signalName : MWNamedSignal
MWDataTable
.Framework
protocol MWStreamable : MWDataConvertible
To start a stream, use the .stream()
operators. They are available on a Publisher
whose output is a Meta
, including:
A .stream()
operator accepts an MWStreamable
instance. You can use presets that autocomplete within the operator, such as magnetometer(freq:)
, or construct them directly, such as init(freq:)
.
Some .stream()
operators produce a timestamped typed output. You can collect these into an array and convert that into a String-only CSV table with aptly labeled columns by using MWData
, such as in the example below.
let cancel = PassthroughSubject<Void,Never>()
let config: MWStreamable = .magnetometer(freq: .hz25)
metawear
.publishIfConnected()
.stream(config)
.prefix(untilOutputFrom: cancel)
.collect()
.map { MWDataTable(streamed: $0, config) }
.eraseToAnyPublisher()
Multiple .stream
pipelines can run independently. You can also merge the output of an arbitrary array of streams using standard operators like Merge
, .prefix(until
, and .collect()
. Our open-source MetaBase 5 app provides an example in ActionVM.swift. It uses user-selected (and persisted) sensor parameters to inform the construction a container of MWStreamable
configurations. Only non-nil configs are streamed. Upon cancellation, outputs merge into a single CSV file. The hyperlinked function is called as part of a loop across an arbitrary number of devices.
Unless you construct your own sensor wrappers, this protocol’s details and default methods are unlikely to be important to you.
var signalName : MWNamedSignal
MWDataTable
.func streamCleanup (board: MWBoard)
func streamConfigure (board: MWBoard)
func streamSignal (board: MWBoard) throws -> MWDataSignal ?
func streamStart (board: MWBoard)
static var chargingStatus : MWChargingStatus
Self
is MWChargingStatus
.static var mechanicalButton : MWMechanicalButton
Self
is MWMechanicalButton
.static var motionActivityClassification : MWMotion.Activity
Self
is MWMotion.Activity
.static var motionAny : MWMotion.AnyMotion
Self
is MWMotion.AnyMotion
.static var motionNone : MWMotion.NoMotion
Self
is MWMotion.NoMotion
.static var motionSignificant : MWMotion.Significant
Self
is MWMotion.Significant
.static var orientation: MWOrientationSensor
Self
is MWOrientationSensor
.static func absoluteAltitude (standby: MWBarometer.StandbyTime , iir: MWBarometer.IIRFilter, oversampling: MWBarometer.Oversampling) -> Self
Self
is MWBarometer.MWAltitude
.static func accelerometer(rate: MWAccelerometer.SampleFrequency , gravity: MWAccelerometer.GravityRange ) -> Self
Self
is MWAccelerometer
.static func ambientLight (rate: MWAmbientLight .MeasurementRate , gain: MWAmbientLight .Gain, integrationTime : MWAmbientLight .IntegrationTime ) -> Self
Self
is MWAmbientLight
.static func gyroscope(rate: MWGyroscope.Frequency?, range: MWGyroscope.GraphRange ?) -> Self
Self
is MWGyroscope
.static func magnetometer(freq: MWMagnetometer.SampleFrequency ?) -> Self
Self
is MWMagnetometer
.static func relativePressure (standby: MWBarometer.StandbyTime , iir: MWBarometer.IIRFilter, oversampling: MWBarometer.Oversampling) -> Self
Self
is MWBarometer.MWPressure
.static func sensorFusionEulerAngles (mode: MWSensorFusion .Mode) -> Self
Self
is MWSensorFusion.EulerAngles
.static func sensorFusionGravity (mode: MWSensorFusion .Mode) -> Self
Self
is MWSensorFusion.Gravity
.static func sensorFusionLinearAcceleration (mode: MWSensorFusion .Mode) -> Self
Self
is MWSensorFusion.LinearAcceleration
.static func sensorFusionQuaternion (mode: MWSensorFusion .Mode) -> Self
Self
is MWSensorFusion.Quaternion
.static func stepCounter (sensitivity: MWAccelerometer.StepCounterSensitivity ?) -> Self
Self
is MWStepCounter
.static func stepDetector (sensitivity: MWAccelerometer.StepCounterSensitivity ?) -> Self
Self
is MWStepDetector
.MWDataConvertible
Swift.Equatable
Swift.Hashable
MWAccelerometer
MWAmbientLight
MWBarometer.MWAltitude
MWBarometer.MWPressure
MWChargingStatus
MWGyroscope
MWMagnetometer
MWMechanicalButton
MWMotion.Activity
MWMotion.AnyMotion
MWMotion.NoMotion
MWMotion.Significant
MWOrientationSensor
MWSensorFusion.EulerAngles
MWSensorFusion.Gravity
MWSensorFusion.LinearAcceleration
MWSensorFusion.Quaternion
MWStepCounter
MWStepDetector
protocol MWCommand
protocol MWCommandWithResponse
protocol MWLoggable
protocol MWPollable
protocol MWReadable
protocol MWReadableMerged
struct MWFrequency