feat: implement Haptika PPG and Watch V1
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
///
|
||||
/// FingerContactState.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `FingerContactState`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias FingerContactState = margelo.nitro.haptika.ppg.FingerContactState
|
||||
|
||||
public extension FingerContactState {
|
||||
/**
|
||||
* Get a FingerContactState for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "absent":
|
||||
self = .absent
|
||||
case "adjusting":
|
||||
self = .adjusting
|
||||
case "valid":
|
||||
self = .valid
|
||||
case "tooMuchPressure":
|
||||
self = .toomuchpressure
|
||||
case "overexposed":
|
||||
self = .overexposed
|
||||
case "unstable":
|
||||
self = .unstable
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this FingerContactState represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .absent:
|
||||
return "absent"
|
||||
case .adjusting:
|
||||
return "adjusting"
|
||||
case .valid:
|
||||
return "valid"
|
||||
case .toomuchpressure:
|
||||
return "tooMuchPressure"
|
||||
case .overexposed:
|
||||
return "overexposed"
|
||||
case .unstable:
|
||||
return "unstable"
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_NativeHealthKitContext.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: NativeHealthKitContext) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_NativeHealthKitContext {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: NativeHealthKitContext) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: NativeHealthKitContext) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: NativeHealthKitContext) -> Void {
|
||||
self.closure(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_NativeHealthKitContext`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_NativeHealthKitContext>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_NativeHealthKitContext {
|
||||
return Unmanaged<Func_void_NativeHealthKitContext>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_bool.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_bool {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: Bool) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: Bool) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: Bool) -> Void {
|
||||
self.closure(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_bool`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
|
||||
return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
Generated
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_std__exception_ptr.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_std__exception_ptr {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ error: Error) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(error: std.exception_ptr) -> Void {
|
||||
self.closure(RuntimeError.from(cppError: error))
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
||||
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_std__optional_NativeHeartbeatSeriesSummary_.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: NativeHeartbeatSeriesSummary?) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_std__optional_NativeHeartbeatSeriesSummary_ {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: NativeHeartbeatSeriesSummary?) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: NativeHeartbeatSeriesSummary?) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: bridge.std__optional_NativeHeartbeatSeriesSummary_) -> Void {
|
||||
self.closure(value.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_std__optional_NativeHeartbeatSeriesSummary_`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_NativeHeartbeatSeriesSummary_>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_NativeHeartbeatSeriesSummary_ {
|
||||
return Unmanaged<Func_void_std__optional_NativeHeartbeatSeriesSummary_>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
///
|
||||
/// HealthMetricType.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `HealthMetricType`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias HealthMetricType = margelo.nitro.haptika.ppg.HealthMetricType
|
||||
|
||||
public extension HealthMetricType {
|
||||
/**
|
||||
* Get a HealthMetricType for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "heartRate":
|
||||
self = .heartrate
|
||||
case "restingHeartRate":
|
||||
self = .restingheartrate
|
||||
case "hrvSdnn":
|
||||
self = .hrvsdnn
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this HealthMetricType represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .heartrate:
|
||||
return "heartRate"
|
||||
case .restingheartrate:
|
||||
return "restingHeartRate"
|
||||
case .hrvsdnn:
|
||||
return "hrvSdnn"
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+64
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaCardiacMirrorSpec``
|
||||
public protocol HybridHaptikaCardiacMirrorSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func isSupported() throws -> Bool
|
||||
func patternInfo() throws -> NativeCardiacMirrorPatternInfo
|
||||
func start(targetBpm: Double) throws -> Void
|
||||
func pulse() throws -> Void
|
||||
func stop() throws -> Void
|
||||
func startWatchSession() throws -> Void
|
||||
func watchReachable() throws -> Bool
|
||||
func latestHeartbeat() throws -> NativeCardiacMirrorHeartbeat?
|
||||
func playRegulationProtocol(kind: String) throws -> Double
|
||||
func stopRegulationProtocol() throws -> Void
|
||||
}
|
||||
|
||||
public extension HybridHaptikaCardiacMirrorSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaCardiacMirror]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaCardiacMirrorSpec``
|
||||
open class HybridHaptikaCardiacMirrorSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaCardiacMirrorSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaCardiacMirrorSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaCardiacMirrorSpec`! Did you accidentally inherit from `HybridHaptikaCardiacMirrorSpec_base` instead of `HybridHaptikaCardiacMirrorSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaCardiacMirrorSpec_cxx(self as! any HybridHaptikaCardiacMirrorSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaCardiacMirror HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaCardiacMirror.
|
||||
* ```swift
|
||||
* class HybridHaptikaCardiacMirror : HybridHaptikaCardiacMirrorSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaCardiacMirrorSpec = HybridHaptikaCardiacMirrorSpec_protocol & HybridHaptikaCardiacMirrorSpec_base
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaCardiacMirrorSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaCardiacMirrorSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaCardiacMirrorSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaCardiacMirrorSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaCardiacMirrorSpec_cxx` that wraps the given `HybridHaptikaCardiacMirrorSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaCardiacMirrorSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaCardiacMirrorSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaCardiacMirrorSpec() -> any HybridHaptikaCardiacMirrorSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaCardiacMirrorSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaCardiacMirrorSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaCardiacMirrorSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaCardiacMirrorSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaCardiacMirrorSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func isSupported() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.isSupported()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func patternInfo() -> bridge.Result_NativeCardiacMirrorPatternInfo_ {
|
||||
do {
|
||||
let __result = try self.__implementation.patternInfo()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_NativeCardiacMirrorPatternInfo_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_NativeCardiacMirrorPatternInfo_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func start(targetBpm: Double) -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.start(targetBpm: targetBpm)
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func pulse() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.pulse()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func stop() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.stop()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func startWatchSession() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.startWatchSession()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func watchReachable() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.watchReachable()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func latestHeartbeat() -> bridge.Result_std__optional_NativeCardiacMirrorHeartbeat__ {
|
||||
do {
|
||||
let __result = try self.__implementation.latestHeartbeat()
|
||||
let __resultCpp = { () -> bridge.std__optional_NativeCardiacMirrorHeartbeat_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_NativeCardiacMirrorHeartbeat_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()
|
||||
return bridge.create_Result_std__optional_NativeCardiacMirrorHeartbeat__(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__optional_NativeCardiacMirrorHeartbeat__(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func playRegulationProtocol(kind: std.string) -> bridge.Result_double_ {
|
||||
do {
|
||||
let __result = try self.__implementation.playRegulationProtocol(kind: String(kind))
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_double_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_double_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func stopRegulationProtocol() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.stopRegulationProtocol()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+58
@@ -0,0 +1,58 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaHealthKitSpec``
|
||||
public protocol HybridHaptikaHealthKitSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func isAvailable() throws -> Bool
|
||||
func requestReadAuthorization() throws -> Promise<Bool>
|
||||
func fetchContext(lookbackDays: Double) throws -> Promise<NativeHealthKitContext>
|
||||
func fetchLatestHeartbeatSeries() throws -> Promise<NativeHeartbeatSeriesSummary?>
|
||||
}
|
||||
|
||||
public extension HybridHaptikaHealthKitSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaHealthKit]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaHealthKitSpec``
|
||||
open class HybridHaptikaHealthKitSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaHealthKitSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaHealthKitSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaHealthKitSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaHealthKitSpec`! Did you accidentally inherit from `HybridHaptikaHealthKitSpec_base` instead of `HybridHaptikaHealthKitSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaHealthKitSpec_cxx(self as! any HybridHaptikaHealthKitSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaHealthKit HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaHealthKit.
|
||||
* ```swift
|
||||
* class HybridHaptikaHealthKit : HybridHaptikaHealthKitSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaHealthKitSpec = HybridHaptikaHealthKitSpec_protocol & HybridHaptikaHealthKitSpec_base
|
||||
Generated
+201
@@ -0,0 +1,201 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaHealthKitSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaHealthKitSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaHealthKitSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaHealthKitSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaHealthKitSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaHealthKitSpec_cxx` that wraps the given `HybridHaptikaHealthKitSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaHealthKitSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaHealthKitSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaHealthKitSpec() -> any HybridHaptikaHealthKitSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaHealthKitSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaHealthKitSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaHealthKitSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaHealthKitSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaHealthKitSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaHealthKitSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaHealthKitSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaHealthKitSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaHealthKitSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func isAvailable() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.isAvailable()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func requestReadAuthorization() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
||||
do {
|
||||
let __result = try self.__implementation.requestReadAuthorization()
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve(__result) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func fetchContext(lookbackDays: Double) -> bridge.Result_std__shared_ptr_Promise_NativeHealthKitContext___ {
|
||||
do {
|
||||
let __result = try self.__implementation.fetchContext(lookbackDays: lookbackDays)
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_NativeHealthKitContext__ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_NativeHealthKitContext__()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_NativeHealthKitContext__(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve(__result) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func fetchLatestHeartbeatSeries() -> bridge.Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____ {
|
||||
do {
|
||||
let __result = try self.__implementation.fetchLatestHeartbeatSeries()
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_NativeHeartbeatSeriesSummary_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_NativeHeartbeatSeriesSummary_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import VisionCamera
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaPPGFrameProcessorSpec``
|
||||
public protocol HybridHaptikaPPGFrameProcessorSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func startMeasurement(configuration: NativePPGConfiguration) throws -> Void
|
||||
func processFrame(frame: (any HybridFrameSpec)) throws -> PPGFrameUpdate?
|
||||
func finishMeasurement() throws -> NativePPGProcessingResult
|
||||
func cancelMeasurement() throws -> Void
|
||||
func getThermalState() throws -> ThermalState
|
||||
}
|
||||
|
||||
public extension HybridHaptikaPPGFrameProcessorSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaPPGFrameProcessor]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaPPGFrameProcessorSpec``
|
||||
open class HybridHaptikaPPGFrameProcessorSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaPPGFrameProcessorSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaPPGFrameProcessorSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaPPGFrameProcessorSpec`! Did you accidentally inherit from `HybridHaptikaPPGFrameProcessorSpec_base` instead of `HybridHaptikaPPGFrameProcessorSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaPPGFrameProcessorSpec_cxx(self as! any HybridHaptikaPPGFrameProcessorSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaPPGFrameProcessor HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaPPGFrameProcessor.
|
||||
* ```swift
|
||||
* class HybridHaptikaPPGFrameProcessor : HybridHaptikaPPGFrameProcessorSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaPPGFrameProcessorSpec = HybridHaptikaPPGFrameProcessorSpec_protocol & HybridHaptikaPPGFrameProcessorSpec_base
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
import VisionCamera
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaPPGFrameProcessorSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaPPGFrameProcessorSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaPPGFrameProcessorSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaPPGFrameProcessorSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaPPGFrameProcessorSpec_cxx` that wraps the given `HybridHaptikaPPGFrameProcessorSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaPPGFrameProcessorSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaPPGFrameProcessorSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaPPGFrameProcessorSpec() -> any HybridHaptikaPPGFrameProcessorSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaPPGFrameProcessorSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaPPGFrameProcessorSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaPPGFrameProcessorSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaPPGFrameProcessorSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func startMeasurement(configuration: NativePPGConfiguration) -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.startMeasurement(configuration: configuration)
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func processFrame(frame: bridge.std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_) -> bridge.Result_std__optional_PPGFrameUpdate__ {
|
||||
do {
|
||||
let __result = try self.__implementation.processFrame(frame: { () -> any HybridFrameSpec in
|
||||
let __unsafePointer = bridge.get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(frame)
|
||||
let __instance = HybridFrameSpec_cxx.fromUnsafe(__unsafePointer)
|
||||
return __instance.getHybridFrameSpec()
|
||||
}())
|
||||
let __resultCpp = { () -> bridge.std__optional_PPGFrameUpdate_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_PPGFrameUpdate_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()
|
||||
return bridge.create_Result_std__optional_PPGFrameUpdate__(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__optional_PPGFrameUpdate__(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func finishMeasurement() -> bridge.Result_NativePPGProcessingResult_ {
|
||||
do {
|
||||
let __result = try self.__implementation.finishMeasurement()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_NativePPGProcessingResult_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_NativePPGProcessingResult_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func cancelMeasurement() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.cancelMeasurement()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func getThermalState() -> bridge.Result_ThermalState_ {
|
||||
do {
|
||||
let __result = try self.__implementation.getThermalState()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_ThermalState_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_ThermalState_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
///
|
||||
/// NativeAcceptedBeat.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 `NativeAcceptedBeat`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeAcceptedBeat = margelo.nitro.haptika.ppg.NativeAcceptedBeat
|
||||
|
||||
public extension NativeAcceptedBeat {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeAcceptedBeat`.
|
||||
*/
|
||||
init(sequence: Double, timestampSeconds: Double, intervalMs: Double, confidence: Double) {
|
||||
self.init(sequence, timestampSeconds, intervalMs, confidence)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sequence: Double {
|
||||
return self.__sequence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var intervalMs: Double {
|
||||
return self.__intervalMs
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var confidence: Double {
|
||||
return self.__confidence
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
///
|
||||
/// NativeBPMEstimate.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 `NativeBPMEstimate`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeBPMEstimate = margelo.nitro.haptika.ppg.NativeBPMEstimate
|
||||
|
||||
public extension NativeBPMEstimate {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeBPMEstimate`.
|
||||
*/
|
||||
init(bpm: Double?, temporalBpm: Double?, frequencyBpm: Double?, methodAgreementBpm: Double?, validPeakCount: Double, rejectedPeakCount: Double, confidence: Double, selectedChannel: String) {
|
||||
self.init({ () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = bpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = temporalBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = frequencyBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = methodAgreementBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), validPeakCount, rejectedPeakCount, confidence, std.string(selectedChannel))
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__bpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__bpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var temporalBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__temporalBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__temporalBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var frequencyBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__frequencyBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__frequencyBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var methodAgreementBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__methodAgreementBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__methodAgreementBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var validPeakCount: Double {
|
||||
return self.__validPeakCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedPeakCount: Double {
|
||||
return self.__rejectedPeakCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var confidence: Double {
|
||||
return self.__confidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var selectedChannel: String {
|
||||
return String(self.__selectedChannel)
|
||||
}
|
||||
}
|
||||
Generated
+34
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// NativeCardiacMirrorHeartbeat.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 `NativeCardiacMirrorHeartbeat`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeCardiacMirrorHeartbeat = margelo.nitro.haptika.ppg.NativeCardiacMirrorHeartbeat
|
||||
|
||||
public extension NativeCardiacMirrorHeartbeat {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeCardiacMirrorHeartbeat`.
|
||||
*/
|
||||
init(timestampSeconds: Double, bpm: Double) {
|
||||
self.init(timestampSeconds, bpm)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: Double {
|
||||
return self.__bpm
|
||||
}
|
||||
}
|
||||
Generated
+39
@@ -0,0 +1,39 @@
|
||||
///
|
||||
/// NativeCardiacMirrorPatternInfo.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 `NativeCardiacMirrorPatternInfo`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeCardiacMirrorPatternInfo = margelo.nitro.haptika.ppg.NativeCardiacMirrorPatternInfo
|
||||
|
||||
public extension NativeCardiacMirrorPatternInfo {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeCardiacMirrorPatternInfo`.
|
||||
*/
|
||||
init(id: String, version: String, latencyBudgetMs: Double) {
|
||||
self.init(std.string(id), std.string(version), latencyBudgetMs)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var id: String {
|
||||
return String(self.__id)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var version: String {
|
||||
return String(self.__version)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latencyBudgetMs: Double {
|
||||
return self.__latencyBudgetMs
|
||||
}
|
||||
}
|
||||
Generated
+77
@@ -0,0 +1,77 @@
|
||||
///
|
||||
/// NativeHealthKitContext.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 `NativeHealthKitContext`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHealthKitContext = margelo.nitro.haptika.ppg.NativeHealthKitContext
|
||||
|
||||
public extension NativeHealthKitContext {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHealthKitContext`.
|
||||
*/
|
||||
init(available: Bool, authorized: Bool, latestRestingHeartRate: NativeHealthMetricSample?, latestHrvSdnn: NativeHealthMetricSample?, recentHeartRateSamples: [NativeHealthMetricSample], contextConfidence: Double, fetchedAt: String) {
|
||||
self.init(available, authorized, { () -> bridge.std__optional_NativeHealthMetricSample_ in
|
||||
if let __unwrappedValue = latestRestingHeartRate {
|
||||
return bridge.create_std__optional_NativeHealthMetricSample_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_NativeHealthMetricSample_ in
|
||||
if let __unwrappedValue = latestHrvSdnn {
|
||||
return bridge.create_std__optional_NativeHealthMetricSample_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__vector_NativeHealthMetricSample_ in
|
||||
var __vector = bridge.create_std__vector_NativeHealthMetricSample_(recentHeartRateSamples.count)
|
||||
for __item in recentHeartRateSamples {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), contextConfidence, std.string(fetchedAt))
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var available: Bool {
|
||||
return self.__available
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var authorized: Bool {
|
||||
return self.__authorized
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latestRestingHeartRate: NativeHealthMetricSample? {
|
||||
return self.__latestRestingHeartRate.value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latestHrvSdnn: NativeHealthMetricSample? {
|
||||
return self.__latestHrvSdnn.value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var recentHeartRateSamples: [NativeHealthMetricSample] {
|
||||
return self.__recentHeartRateSamples.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contextConfidence: Double {
|
||||
return self.__contextConfidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var fetchedAt: String {
|
||||
return String(self.__fetchedAt)
|
||||
}
|
||||
}
|
||||
Generated
+103
@@ -0,0 +1,103 @@
|
||||
///
|
||||
/// NativeHealthMetricSample.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 `NativeHealthMetricSample`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHealthMetricSample = margelo.nitro.haptika.ppg.NativeHealthMetricSample
|
||||
|
||||
public extension NativeHealthMetricSample {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHealthMetricSample`.
|
||||
*/
|
||||
init(type: HealthMetricType, value: Double, unit: String, startDate: String, endDate: String, sourceName: String?, sourceBundleIdentifier: String?, deviceName: String?) {
|
||||
self.init(type, value, std.string(unit), std.string(startDate), std.string(endDate), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceBundleIdentifier {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = deviceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var type: HealthMetricType {
|
||||
return self.__type
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var value: Double {
|
||||
return self.__value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var unit: String {
|
||||
return String(self.__unit)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startDate: String {
|
||||
return String(self.__startDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endDate: String {
|
||||
return String(self.__endDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceBundleIdentifier: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceBundleIdentifier) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceBundleIdentifier)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var deviceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__deviceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__deviceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
Generated
+92
@@ -0,0 +1,92 @@
|
||||
///
|
||||
/// NativeHeartbeatSeriesSummary.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 `NativeHeartbeatSeriesSummary`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHeartbeatSeriesSummary = margelo.nitro.haptika.ppg.NativeHeartbeatSeriesSummary
|
||||
|
||||
public extension NativeHeartbeatSeriesSummary {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHeartbeatSeriesSummary`.
|
||||
*/
|
||||
init(startDate: String, endDate: String, sourceName: String?, sourceBundleIdentifier: String?, heartbeatTimesSinceSeriesStartSeconds: [Double], precededByGapIndexes: [Double]) {
|
||||
self.init(std.string(startDate), std.string(endDate), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceBundleIdentifier {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__vector_double_ in
|
||||
var __vector = bridge.create_std__vector_double_(heartbeatTimesSinceSeriesStartSeconds.count)
|
||||
for __item in heartbeatTimesSinceSeriesStartSeconds {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), { () -> bridge.std__vector_double_ in
|
||||
var __vector = bridge.create_std__vector_double_(precededByGapIndexes.count)
|
||||
for __item in precededByGapIndexes {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startDate: String {
|
||||
return String(self.__startDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endDate: String {
|
||||
return String(self.__endDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceBundleIdentifier: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceBundleIdentifier) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceBundleIdentifier)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var heartbeatTimesSinceSeriesStartSeconds: [Double] {
|
||||
return self.__heartbeatTimesSinceSeriesStartSeconds.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var precededByGapIndexes: [Double] {
|
||||
return self.__precededByGapIndexes.map({ __item in __item })
|
||||
}
|
||||
}
|
||||
Generated
+64
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// NativePPGConfiguration.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 `NativePPGConfiguration`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePPGConfiguration = margelo.nitro.haptika.ppg.NativePPGConfiguration
|
||||
|
||||
public extension NativePPGConfiguration {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePPGConfiguration`.
|
||||
*/
|
||||
init(sessionPurpose: PPGSessionPurpose, targetSampleRate: Double, minimumFrequencyHz: Double, maximumFrequencyHz: Double, stabilizationSeconds: Double, measurementSeconds: Double, emitEveryFrames: Double, minimumContactConfidence: Double) {
|
||||
self.init(sessionPurpose, targetSampleRate, minimumFrequencyHz, maximumFrequencyHz, stabilizationSeconds, measurementSeconds, emitEveryFrames, minimumContactConfidence)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sessionPurpose: PPGSessionPurpose {
|
||||
return self.__sessionPurpose
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var targetSampleRate: Double {
|
||||
return self.__targetSampleRate
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var minimumFrequencyHz: Double {
|
||||
return self.__minimumFrequencyHz
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var maximumFrequencyHz: Double {
|
||||
return self.__maximumFrequencyHz
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var stabilizationSeconds: Double {
|
||||
return self.__stabilizationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var measurementSeconds: Double {
|
||||
return self.__measurementSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var emitEveryFrames: Double {
|
||||
return self.__emitEveryFrames
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var minimumContactConfidence: Double {
|
||||
return self.__minimumContactConfidence
|
||||
}
|
||||
}
|
||||
Generated
+82
@@ -0,0 +1,82 @@
|
||||
///
|
||||
/// NativePPGProcessingResult.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 `NativePPGProcessingResult`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePPGProcessingResult = margelo.nitro.haptika.ppg.NativePPGProcessingResult
|
||||
|
||||
public extension NativePPGProcessingResult {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePPGProcessingResult`.
|
||||
*/
|
||||
init(valid: Bool, invalidReason: String?, bpm: NativeBPMEstimate, prv: NativePRVMetrics, quality: NativeSignalQualityResult, startedAtMonotonicSeconds: Double, endedAtMonotonicSeconds: Double, rawSampleCount: Double, resampledSampleCount: Double) {
|
||||
self.init(valid, { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = invalidReason {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), bpm, prv, quality, startedAtMonotonicSeconds, endedAtMonotonicSeconds, rawSampleCount, resampledSampleCount)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var valid: Bool {
|
||||
return self.__valid
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var invalidReason: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__invalidReason) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__invalidReason)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: NativeBPMEstimate {
|
||||
return self.__bpm
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var prv: NativePRVMetrics {
|
||||
return self.__prv
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var quality: NativeSignalQualityResult {
|
||||
return self.__quality
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startedAtMonotonicSeconds: Double {
|
||||
return self.__startedAtMonotonicSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endedAtMonotonicSeconds: Double {
|
||||
return self.__endedAtMonotonicSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rawSampleCount: Double {
|
||||
return self.__rawSampleCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var resampledSampleCount: Double {
|
||||
return self.__resampledSampleCount
|
||||
}
|
||||
}
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
///
|
||||
/// NativePRVMetrics.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 `NativePRVMetrics`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePRVMetrics = margelo.nitro.haptika.ppg.NativePRVMetrics
|
||||
|
||||
public extension NativePRVMetrics {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePRVMetrics`.
|
||||
*/
|
||||
init(estimatedRmssdMs: Double?, estimatedSdnnMs: Double?, meanIpiMs: Double?, medianIpiMs: Double?, pnn50Percent: Double?, rangeIpiMs: Double?, modeIpiMs: Double?, amo50Percent: Double?, coefficientOfVariation: Double?, validIntervalCount: Double, rejectedIntervalCount: Double, rejectedIntervalRatio: Double, reliable: Bool) {
|
||||
self.init({ () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = estimatedRmssdMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = estimatedSdnnMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = meanIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = medianIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = pnn50Percent {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = rangeIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = modeIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = amo50Percent {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = coefficientOfVariation {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), validIntervalCount, rejectedIntervalCount, rejectedIntervalRatio, reliable)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var estimatedRmssdMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__estimatedRmssdMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__estimatedRmssdMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var estimatedSdnnMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__estimatedSdnnMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__estimatedSdnnMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var meanIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__meanIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__meanIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var medianIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__medianIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__medianIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var pnn50Percent: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__pnn50Percent) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__pnn50Percent)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rangeIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__rangeIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__rangeIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var modeIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__modeIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__modeIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var amo50Percent: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__amo50Percent) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__amo50Percent)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var coefficientOfVariation: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__coefficientOfVariation) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__coefficientOfVariation)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var validIntervalCount: Double {
|
||||
return self.__validIntervalCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalCount: Double {
|
||||
return self.__rejectedIntervalCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalRatio: Double {
|
||||
return self.__rejectedIntervalRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var reliable: Bool {
|
||||
return self.__reliable
|
||||
}
|
||||
}
|
||||
Generated
+103
@@ -0,0 +1,103 @@
|
||||
///
|
||||
/// NativeSignalQualityResult.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 `NativeSignalQualityResult`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeSignalQualityResult = margelo.nitro.haptika.ppg.NativeSignalQualityResult
|
||||
|
||||
public extension NativeSignalQualityResult {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeSignalQualityResult`.
|
||||
*/
|
||||
init(score: Double, level: String, usableDurationSeconds: Double, droppedFrameRatio: Double, saturationRatio: Double, rejectedIntervalRatio: Double, signalToNoiseRatio: Double?, motionArtifactRatio: Double, methodAgreementScore: Double, timestampJitterRatio: Double, longestGapSeconds: Double, issues: [String]) {
|
||||
self.init(score, std.string(level), usableDurationSeconds, droppedFrameRatio, saturationRatio, rejectedIntervalRatio, { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = signalToNoiseRatio {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), motionArtifactRatio, methodAgreementScore, timestampJitterRatio, longestGapSeconds, { () -> bridge.std__vector_std__string_ in
|
||||
var __vector = bridge.create_std__vector_std__string_(issues.count)
|
||||
for __item in issues {
|
||||
__vector.push_back(std.string(__item))
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var score: Double {
|
||||
return self.__score
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var level: String {
|
||||
return String(self.__level)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var usableDurationSeconds: Double {
|
||||
return self.__usableDurationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var droppedFrameRatio: Double {
|
||||
return self.__droppedFrameRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var saturationRatio: Double {
|
||||
return self.__saturationRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalRatio: Double {
|
||||
return self.__rejectedIntervalRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var signalToNoiseRatio: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__signalToNoiseRatio) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__signalToNoiseRatio)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var motionArtifactRatio: Double {
|
||||
return self.__motionArtifactRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var methodAgreementScore: Double {
|
||||
return self.__methodAgreementScore
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampJitterRatio: Double {
|
||||
return self.__timestampJitterRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var longestGapSeconds: Double {
|
||||
return self.__longestGapSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var issues: [String] {
|
||||
return self.__issues.map({ __item in String(__item) })
|
||||
}
|
||||
}
|
||||
+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
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// PPGSessionPurpose.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `PPGSessionPurpose`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias PPGSessionPurpose = margelo.nitro.haptika.ppg.PPGSessionPurpose
|
||||
|
||||
public extension PPGSessionPurpose {
|
||||
/**
|
||||
* Get a PPGSessionPurpose for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "spotMeasurement":
|
||||
self = .spotmeasurement
|
||||
case "coherence":
|
||||
self = .coherence
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this PPGSessionPurpose represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .spotmeasurement:
|
||||
return "spotMeasurement"
|
||||
case .coherence:
|
||||
return "coherence"
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
///
|
||||
/// ThermalState.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `ThermalState`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias ThermalState = margelo.nitro.haptika.ppg.ThermalState
|
||||
|
||||
public extension ThermalState {
|
||||
/**
|
||||
* Get a ThermalState for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "nominal":
|
||||
self = .nominal
|
||||
case "fair":
|
||||
self = .fair
|
||||
case "serious":
|
||||
self = .serious
|
||||
case "critical":
|
||||
self = .critical
|
||||
case "unknown":
|
||||
self = .unknown
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this ThermalState represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .nominal:
|
||||
return "nominal"
|
||||
case .fair:
|
||||
return "fair"
|
||||
case .serious:
|
||||
return "serious"
|
||||
case .critical:
|
||||
return "critical"
|
||||
case .unknown:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user