feat: implement Haptika PPG and Watch V1
This commit is contained in:
+149
@@ -0,0 +1,149 @@
|
||||
///
|
||||
/// PPGFrameUpdate.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `PPGFrameUpdate`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias PPGFrameUpdate = margelo.nitro.haptika.ppg.PPGFrameUpdate
|
||||
|
||||
public extension PPGFrameUpdate {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `PPGFrameUpdate`.
|
||||
*/
|
||||
init(timestampSeconds: Double, contactState: FingerContactState, contactConfidence: Double, signalLevel: Double, saturationRatio: Double, motionArtifactScore: Double, collectedSampleCount: Double, usableDurationSeconds: Double, droppedFrameCount: Double, thermalState: ThermalState, waveformValue: Double, liveBpm: Double?, liveIpiMs: Double?, beatSequence: Double, acceptedBeats: [NativeAcceptedBeat], liveWindowQuality: Double?) {
|
||||
self.init(timestampSeconds, contactState, contactConfidence, signalLevel, saturationRatio, motionArtifactScore, collectedSampleCount, usableDurationSeconds, droppedFrameCount, thermalState, waveformValue, { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), beatSequence, { () -> bridge.std__vector_NativeAcceptedBeat_ in
|
||||
var __vector = bridge.create_std__vector_NativeAcceptedBeat_(acceptedBeats.count)
|
||||
for __item in acceptedBeats {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveWindowQuality {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contactState: FingerContactState {
|
||||
return self.__contactState
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contactConfidence: Double {
|
||||
return self.__contactConfidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var signalLevel: Double {
|
||||
return self.__signalLevel
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var saturationRatio: Double {
|
||||
return self.__saturationRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var motionArtifactScore: Double {
|
||||
return self.__motionArtifactScore
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var collectedSampleCount: Double {
|
||||
return self.__collectedSampleCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var usableDurationSeconds: Double {
|
||||
return self.__usableDurationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var droppedFrameCount: Double {
|
||||
return self.__droppedFrameCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var thermalState: ThermalState {
|
||||
return self.__thermalState
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var waveformValue: Double {
|
||||
return self.__waveformValue
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var beatSequence: Double {
|
||||
return self.__beatSequence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var acceptedBeats: [NativeAcceptedBeat] {
|
||||
return self.__acceptedBeats.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveWindowQuality: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveWindowQuality) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveWindowQuality)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user