feat: implement Haptika PPG and Watch V1
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
///
|
||||
/// FingerContactState.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/NitroHash.hpp>)
|
||||
#include <NitroModules/NitroHash.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* An enum which can be represented as a JavaScript union (FingerContactState).
|
||||
*/
|
||||
enum class FingerContactState {
|
||||
ABSENT SWIFT_NAME(absent) = 0,
|
||||
ADJUSTING SWIFT_NAME(adjusting) = 1,
|
||||
VALID SWIFT_NAME(valid) = 2,
|
||||
TOOMUCHPRESSURE SWIFT_NAME(toomuchpressure) = 3,
|
||||
OVEREXPOSED SWIFT_NAME(overexposed) = 4,
|
||||
UNSTABLE SWIFT_NAME(unstable) = 5,
|
||||
} CLOSED_ENUM;
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ FingerContactState <> JS FingerContactState (union)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::FingerContactState> final {
|
||||
static inline margelo::nitro::haptika::ppg::FingerContactState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("absent"): return margelo::nitro::haptika::ppg::FingerContactState::ABSENT;
|
||||
case hashString("adjusting"): return margelo::nitro::haptika::ppg::FingerContactState::ADJUSTING;
|
||||
case hashString("valid"): return margelo::nitro::haptika::ppg::FingerContactState::VALID;
|
||||
case hashString("tooMuchPressure"): return margelo::nitro::haptika::ppg::FingerContactState::TOOMUCHPRESSURE;
|
||||
case hashString("overexposed"): return margelo::nitro::haptika::ppg::FingerContactState::OVEREXPOSED;
|
||||
case hashString("unstable"): return margelo::nitro::haptika::ppg::FingerContactState::UNSTABLE;
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum FingerContactState - invalid value!");
|
||||
}
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::haptika::ppg::FingerContactState arg) {
|
||||
switch (arg) {
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::ABSENT: return JSIConverter<std::string>::toJSI(runtime, "absent");
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::ADJUSTING: return JSIConverter<std::string>::toJSI(runtime, "adjusting");
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::VALID: return JSIConverter<std::string>::toJSI(runtime, "valid");
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::TOOMUCHPRESSURE: return JSIConverter<std::string>::toJSI(runtime, "tooMuchPressure");
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::OVEREXPOSED: return JSIConverter<std::string>::toJSI(runtime, "overexposed");
|
||||
case margelo::nitro::haptika::ppg::FingerContactState::UNSTABLE: return JSIConverter<std::string>::toJSI(runtime, "unstable");
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert FingerContactState to JS - invalid value: "
|
||||
+ std::to_string(static_cast<int>(arg)) + "!");
|
||||
}
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isString()) {
|
||||
return false;
|
||||
}
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("absent"):
|
||||
case hashString("adjusting"):
|
||||
case hashString("valid"):
|
||||
case hashString("tooMuchPressure"):
|
||||
case hashString("overexposed"):
|
||||
case hashString("unstable"):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
///
|
||||
/// HealthMetricType.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/NitroHash.hpp>)
|
||||
#include <NitroModules/NitroHash.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* An enum which can be represented as a JavaScript union (HealthMetricType).
|
||||
*/
|
||||
enum class HealthMetricType {
|
||||
HEARTRATE SWIFT_NAME(heartrate) = 0,
|
||||
RESTINGHEARTRATE SWIFT_NAME(restingheartrate) = 1,
|
||||
HRVSDNN SWIFT_NAME(hrvsdnn) = 2,
|
||||
} CLOSED_ENUM;
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ HealthMetricType <> JS HealthMetricType (union)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::HealthMetricType> final {
|
||||
static inline margelo::nitro::haptika::ppg::HealthMetricType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("heartRate"): return margelo::nitro::haptika::ppg::HealthMetricType::HEARTRATE;
|
||||
case hashString("restingHeartRate"): return margelo::nitro::haptika::ppg::HealthMetricType::RESTINGHEARTRATE;
|
||||
case hashString("hrvSdnn"): return margelo::nitro::haptika::ppg::HealthMetricType::HRVSDNN;
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum HealthMetricType - invalid value!");
|
||||
}
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::haptika::ppg::HealthMetricType arg) {
|
||||
switch (arg) {
|
||||
case margelo::nitro::haptika::ppg::HealthMetricType::HEARTRATE: return JSIConverter<std::string>::toJSI(runtime, "heartRate");
|
||||
case margelo::nitro::haptika::ppg::HealthMetricType::RESTINGHEARTRATE: return JSIConverter<std::string>::toJSI(runtime, "restingHeartRate");
|
||||
case margelo::nitro::haptika::ppg::HealthMetricType::HRVSDNN: return JSIConverter<std::string>::toJSI(runtime, "hrvSdnn");
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert HealthMetricType to JS - invalid value: "
|
||||
+ std::to_string(static_cast<int>(arg)) + "!");
|
||||
}
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isString()) {
|
||||
return false;
|
||||
}
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("heartRate"):
|
||||
case hashString("restingHeartRate"):
|
||||
case hashString("hrvSdnn"):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+30
@@ -0,0 +1,30 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaCardiacMirrorSpec.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
void HybridHaptikaCardiacMirrorSpec::loadHybridMethods() {
|
||||
// load base methods/properties
|
||||
HybridObject::loadHybridMethods();
|
||||
// load custom methods/properties
|
||||
registerHybrids(this, [](Prototype& prototype) {
|
||||
prototype.registerHybridMethod("isSupported", &HybridHaptikaCardiacMirrorSpec::isSupported);
|
||||
prototype.registerHybridMethod("patternInfo", &HybridHaptikaCardiacMirrorSpec::patternInfo);
|
||||
prototype.registerHybridMethod("start", &HybridHaptikaCardiacMirrorSpec::start);
|
||||
prototype.registerHybridMethod("pulse", &HybridHaptikaCardiacMirrorSpec::pulse);
|
||||
prototype.registerHybridMethod("stop", &HybridHaptikaCardiacMirrorSpec::stop);
|
||||
prototype.registerHybridMethod("startWatchSession", &HybridHaptikaCardiacMirrorSpec::startWatchSession);
|
||||
prototype.registerHybridMethod("watchReachable", &HybridHaptikaCardiacMirrorSpec::watchReachable);
|
||||
prototype.registerHybridMethod("latestHeartbeat", &HybridHaptikaCardiacMirrorSpec::latestHeartbeat);
|
||||
prototype.registerHybridMethod("playRegulationProtocol", &HybridHaptikaCardiacMirrorSpec::playRegulationProtocol);
|
||||
prototype.registerHybridMethod("stopRegulationProtocol", &HybridHaptikaCardiacMirrorSpec::stopRegulationProtocol);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
Generated
+77
@@ -0,0 +1,77 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/HybridObject.hpp>)
|
||||
#include <NitroModules/HybridObject.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativeCardiacMirrorPatternInfo` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorPatternInfo; }
|
||||
// Forward declaration of `NativeCardiacMirrorHeartbeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorHeartbeat; }
|
||||
|
||||
#include "NativeCardiacMirrorPatternInfo.hpp"
|
||||
#include "NativeCardiacMirrorHeartbeat.hpp"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
using namespace margelo::nitro;
|
||||
|
||||
/**
|
||||
* An abstract base class for `HaptikaCardiacMirror`
|
||||
* Inherit this class to create instances of `HybridHaptikaCardiacMirrorSpec` in C++.
|
||||
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
||||
* @example
|
||||
* ```cpp
|
||||
* class HybridHaptikaCardiacMirror: public HybridHaptikaCardiacMirrorSpec {
|
||||
* public:
|
||||
* HybridHaptikaCardiacMirror(...): HybridObject(TAG) { ... }
|
||||
* // ...
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
class HybridHaptikaCardiacMirrorSpec: public virtual HybridObject {
|
||||
public:
|
||||
// Constructor
|
||||
explicit HybridHaptikaCardiacMirrorSpec(): HybridObject(TAG) { }
|
||||
|
||||
// Destructor
|
||||
~HybridHaptikaCardiacMirrorSpec() override = default;
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
virtual bool isSupported() = 0;
|
||||
virtual NativeCardiacMirrorPatternInfo patternInfo() = 0;
|
||||
virtual void start(double targetBpm) = 0;
|
||||
virtual void pulse() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void startWatchSession() = 0;
|
||||
virtual bool watchReachable() = 0;
|
||||
virtual std::optional<NativeCardiacMirrorHeartbeat> latestHeartbeat() = 0;
|
||||
virtual double playRegulationProtocol(const std::string& kind) = 0;
|
||||
virtual void stopRegulationProtocol() = 0;
|
||||
|
||||
protected:
|
||||
// Hybrid Setup
|
||||
void loadHybridMethods() override;
|
||||
|
||||
protected:
|
||||
// Tag for logging
|
||||
static constexpr auto TAG = "HaptikaCardiacMirror";
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
Generated
+24
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaHealthKitSpec.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
void HybridHaptikaHealthKitSpec::loadHybridMethods() {
|
||||
// load base methods/properties
|
||||
HybridObject::loadHybridMethods();
|
||||
// load custom methods/properties
|
||||
registerHybrids(this, [](Prototype& prototype) {
|
||||
prototype.registerHybridMethod("isAvailable", &HybridHaptikaHealthKitSpec::isAvailable);
|
||||
prototype.registerHybridMethod("requestReadAuthorization", &HybridHaptikaHealthKitSpec::requestReadAuthorization);
|
||||
prototype.registerHybridMethod("fetchContext", &HybridHaptikaHealthKitSpec::fetchContext);
|
||||
prototype.registerHybridMethod("fetchLatestHeartbeatSeries", &HybridHaptikaHealthKitSpec::fetchLatestHeartbeatSeries);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
Generated
+71
@@ -0,0 +1,71 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/HybridObject.hpp>)
|
||||
#include <NitroModules/HybridObject.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativeHealthKitContext` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthKitContext; }
|
||||
// Forward declaration of `NativeHeartbeatSeriesSummary` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHeartbeatSeriesSummary; }
|
||||
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include "NativeHealthKitContext.hpp"
|
||||
#include "NativeHeartbeatSeriesSummary.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
using namespace margelo::nitro;
|
||||
|
||||
/**
|
||||
* An abstract base class for `HaptikaHealthKit`
|
||||
* Inherit this class to create instances of `HybridHaptikaHealthKitSpec` in C++.
|
||||
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
||||
* @example
|
||||
* ```cpp
|
||||
* class HybridHaptikaHealthKit: public HybridHaptikaHealthKitSpec {
|
||||
* public:
|
||||
* HybridHaptikaHealthKit(...): HybridObject(TAG) { ... }
|
||||
* // ...
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
class HybridHaptikaHealthKitSpec: public virtual HybridObject {
|
||||
public:
|
||||
// Constructor
|
||||
explicit HybridHaptikaHealthKitSpec(): HybridObject(TAG) { }
|
||||
|
||||
// Destructor
|
||||
~HybridHaptikaHealthKitSpec() override = default;
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
virtual bool isAvailable() = 0;
|
||||
virtual std::shared_ptr<Promise<bool>> requestReadAuthorization() = 0;
|
||||
virtual std::shared_ptr<Promise<NativeHealthKitContext>> fetchContext(double lookbackDays) = 0;
|
||||
virtual std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>> fetchLatestHeartbeatSeries() = 0;
|
||||
|
||||
protected:
|
||||
// Hybrid Setup
|
||||
void loadHybridMethods() override;
|
||||
|
||||
protected:
|
||||
// Tag for logging
|
||||
static constexpr auto TAG = "HaptikaHealthKit";
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaPPGFrameProcessorSpec.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
void HybridHaptikaPPGFrameProcessorSpec::loadHybridMethods() {
|
||||
// load base methods/properties
|
||||
HybridObject::loadHybridMethods();
|
||||
// load custom methods/properties
|
||||
registerHybrids(this, [](Prototype& prototype) {
|
||||
prototype.registerHybridMethod("startMeasurement", &HybridHaptikaPPGFrameProcessorSpec::startMeasurement);
|
||||
prototype.registerHybridMethod("processFrame", &HybridHaptikaPPGFrameProcessorSpec::processFrame);
|
||||
prototype.registerHybridMethod("finishMeasurement", &HybridHaptikaPPGFrameProcessorSpec::finishMeasurement);
|
||||
prototype.registerHybridMethod("cancelMeasurement", &HybridHaptikaPPGFrameProcessorSpec::cancelMeasurement);
|
||||
prototype.registerHybridMethod("getThermalState", &HybridHaptikaPPGFrameProcessorSpec::getThermalState);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/HybridObject.hpp>)
|
||||
#include <NitroModules/HybridObject.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativePPGConfiguration` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGConfiguration; }
|
||||
// Forward declaration of `PPGFrameUpdate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct PPGFrameUpdate; }
|
||||
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
||||
// Forward declaration of `NativePPGProcessingResult` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGProcessingResult; }
|
||||
// Forward declaration of `ThermalState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class ThermalState; }
|
||||
|
||||
#include "NativePPGConfiguration.hpp"
|
||||
#include "PPGFrameUpdate.hpp"
|
||||
#include <optional>
|
||||
#include <memory>
|
||||
#include <VisionCamera/HybridFrameSpec.hpp>
|
||||
#include "NativePPGProcessingResult.hpp"
|
||||
#include "ThermalState.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
using namespace margelo::nitro;
|
||||
|
||||
/**
|
||||
* An abstract base class for `HaptikaPPGFrameProcessor`
|
||||
* Inherit this class to create instances of `HybridHaptikaPPGFrameProcessorSpec` in C++.
|
||||
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
||||
* @example
|
||||
* ```cpp
|
||||
* class HybridHaptikaPPGFrameProcessor: public HybridHaptikaPPGFrameProcessorSpec {
|
||||
* public:
|
||||
* HybridHaptikaPPGFrameProcessor(...): HybridObject(TAG) { ... }
|
||||
* // ...
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
class HybridHaptikaPPGFrameProcessorSpec: public virtual HybridObject {
|
||||
public:
|
||||
// Constructor
|
||||
explicit HybridHaptikaPPGFrameProcessorSpec(): HybridObject(TAG) { }
|
||||
|
||||
// Destructor
|
||||
~HybridHaptikaPPGFrameProcessorSpec() override = default;
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
virtual void startMeasurement(const NativePPGConfiguration& configuration) = 0;
|
||||
virtual std::optional<PPGFrameUpdate> processFrame(const std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>& frame) = 0;
|
||||
virtual NativePPGProcessingResult finishMeasurement() = 0;
|
||||
virtual void cancelMeasurement() = 0;
|
||||
virtual ThermalState getThermalState() = 0;
|
||||
|
||||
protected:
|
||||
// Hybrid Setup
|
||||
void loadHybridMethods() override;
|
||||
|
||||
protected:
|
||||
// Tag for logging
|
||||
static constexpr auto TAG = "HaptikaPPGFrameProcessor";
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
///
|
||||
/// NativeAcceptedBeat.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeAcceptedBeat).
|
||||
*/
|
||||
struct NativeAcceptedBeat final {
|
||||
public:
|
||||
double sequence SWIFT_PRIVATE;
|
||||
double timestampSeconds SWIFT_PRIVATE;
|
||||
double intervalMs SWIFT_PRIVATE;
|
||||
double confidence SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeAcceptedBeat() = default;
|
||||
explicit NativeAcceptedBeat(double sequence, double timestampSeconds, double intervalMs, double confidence): sequence(sequence), timestampSeconds(timestampSeconds), intervalMs(intervalMs), confidence(confidence) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeAcceptedBeat& lhs, const NativeAcceptedBeat& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeAcceptedBeat <> JS NativeAcceptedBeat (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeAcceptedBeat> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeAcceptedBeat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeAcceptedBeat(
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intervalMs"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeAcceptedBeat& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sequence"), JSIConverter<double>::toJSI(runtime, arg.sequence));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"), JSIConverter<double>::toJSI(runtime, arg.timestampSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "intervalMs"), JSIConverter<double>::toJSI(runtime, arg.intervalMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter<double>::toJSI(runtime, arg.confidence));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intervalMs")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
///
|
||||
/// NativeBPMEstimate.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeBPMEstimate).
|
||||
*/
|
||||
struct NativeBPMEstimate final {
|
||||
public:
|
||||
std::optional<double> bpm SWIFT_PRIVATE;
|
||||
std::optional<double> temporalBpm SWIFT_PRIVATE;
|
||||
std::optional<double> frequencyBpm SWIFT_PRIVATE;
|
||||
std::optional<double> methodAgreementBpm SWIFT_PRIVATE;
|
||||
double validPeakCount SWIFT_PRIVATE;
|
||||
double rejectedPeakCount SWIFT_PRIVATE;
|
||||
double confidence SWIFT_PRIVATE;
|
||||
std::string selectedChannel SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeBPMEstimate() = default;
|
||||
explicit NativeBPMEstimate(std::optional<double> bpm, std::optional<double> temporalBpm, std::optional<double> frequencyBpm, std::optional<double> methodAgreementBpm, double validPeakCount, double rejectedPeakCount, double confidence, std::string selectedChannel): bpm(bpm), temporalBpm(temporalBpm), frequencyBpm(frequencyBpm), methodAgreementBpm(methodAgreementBpm), validPeakCount(validPeakCount), rejectedPeakCount(rejectedPeakCount), confidence(confidence), selectedChannel(selectedChannel) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeBPMEstimate& lhs, const NativeBPMEstimate& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeBPMEstimate <> JS NativeBPMEstimate (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeBPMEstimate> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeBPMEstimate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeBPMEstimate(
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeBPMEstimate& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.bpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.temporalBpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.frequencyBpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.methodAgreementBpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount"), JSIConverter<double>::toJSI(runtime, arg.validPeakCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount"), JSIConverter<double>::toJSI(runtime, arg.rejectedPeakCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter<double>::toJSI(runtime, arg.confidence));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel"), JSIConverter<std::string>::toJSI(runtime, arg.selectedChannel));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temporalBpm")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequencyBpm")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementBpm")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validPeakCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedPeakCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedChannel")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+87
@@ -0,0 +1,87 @@
|
||||
///
|
||||
/// NativeCardiacMirrorHeartbeat.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeCardiacMirrorHeartbeat).
|
||||
*/
|
||||
struct NativeCardiacMirrorHeartbeat final {
|
||||
public:
|
||||
double timestampSeconds SWIFT_PRIVATE;
|
||||
double bpm SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeCardiacMirrorHeartbeat() = default;
|
||||
explicit NativeCardiacMirrorHeartbeat(double timestampSeconds, double bpm): timestampSeconds(timestampSeconds), bpm(bpm) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeCardiacMirrorHeartbeat& lhs, const NativeCardiacMirrorHeartbeat& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeCardiacMirrorHeartbeat <> JS NativeCardiacMirrorHeartbeat (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeCardiacMirrorHeartbeat> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeCardiacMirrorHeartbeat fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeCardiacMirrorHeartbeat(
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeCardiacMirrorHeartbeat& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"), JSIConverter<double>::toJSI(runtime, arg.timestampSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bpm"), JSIConverter<double>::toJSI(runtime, arg.bpm));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+91
@@ -0,0 +1,91 @@
|
||||
///
|
||||
/// NativeCardiacMirrorPatternInfo.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeCardiacMirrorPatternInfo).
|
||||
*/
|
||||
struct NativeCardiacMirrorPatternInfo final {
|
||||
public:
|
||||
std::string id SWIFT_PRIVATE;
|
||||
std::string version SWIFT_PRIVATE;
|
||||
double latencyBudgetMs SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeCardiacMirrorPatternInfo() = default;
|
||||
explicit NativeCardiacMirrorPatternInfo(std::string id, std::string version, double latencyBudgetMs): id(id), version(version), latencyBudgetMs(latencyBudgetMs) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeCardiacMirrorPatternInfo& lhs, const NativeCardiacMirrorPatternInfo& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeCardiacMirrorPatternInfo <> JS NativeCardiacMirrorPatternInfo (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeCardiacMirrorPatternInfo> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeCardiacMirrorPatternInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeCardiacMirrorPatternInfo(
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latencyBudgetMs")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeCardiacMirrorPatternInfo& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "version"), JSIConverter<std::string>::toJSI(runtime, arg.version));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latencyBudgetMs"), JSIConverter<double>::toJSI(runtime, arg.latencyBudgetMs));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "version")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latencyBudgetMs")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+111
@@ -0,0 +1,111 @@
|
||||
///
|
||||
/// NativeHealthKitContext.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativeHealthMetricSample` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthMetricSample; }
|
||||
|
||||
#include "NativeHealthMetricSample.hpp"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeHealthKitContext).
|
||||
*/
|
||||
struct NativeHealthKitContext final {
|
||||
public:
|
||||
bool available SWIFT_PRIVATE;
|
||||
bool authorized SWIFT_PRIVATE;
|
||||
std::optional<NativeHealthMetricSample> latestRestingHeartRate SWIFT_PRIVATE;
|
||||
std::optional<NativeHealthMetricSample> latestHrvSdnn SWIFT_PRIVATE;
|
||||
std::vector<NativeHealthMetricSample> recentHeartRateSamples SWIFT_PRIVATE;
|
||||
double contextConfidence SWIFT_PRIVATE;
|
||||
std::string fetchedAt SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeHealthKitContext() = default;
|
||||
explicit NativeHealthKitContext(bool available, bool authorized, std::optional<NativeHealthMetricSample> latestRestingHeartRate, std::optional<NativeHealthMetricSample> latestHrvSdnn, std::vector<NativeHealthMetricSample> recentHeartRateSamples, double contextConfidence, std::string fetchedAt): available(available), authorized(authorized), latestRestingHeartRate(latestRestingHeartRate), latestHrvSdnn(latestHrvSdnn), recentHeartRateSamples(recentHeartRateSamples), contextConfidence(contextConfidence), fetchedAt(fetchedAt) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeHealthKitContext& lhs, const NativeHealthKitContext& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeHealthKitContext <> JS NativeHealthKitContext (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeHealthKitContext> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeHealthKitContext fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeHealthKitContext(
|
||||
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available"))),
|
||||
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authorized"))),
|
||||
JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate"))),
|
||||
JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn"))),
|
||||
JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeHealthKitContext& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "available"), JSIConverter<bool>::toJSI(runtime, arg.available));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "authorized"), JSIConverter<bool>::toJSI(runtime, arg.authorized));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate"), JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::toJSI(runtime, arg.latestRestingHeartRate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn"), JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::toJSI(runtime, arg.latestHrvSdnn));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples"), JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::toJSI(runtime, arg.recentHeartRateSamples));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence"), JSIConverter<double>::toJSI(runtime, arg.contextConfidence));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt"), JSIConverter<std::string>::toJSI(runtime, arg.fetchedAt));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available")))) return false;
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authorized")))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate")))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn")))) return false;
|
||||
if (!JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeHealthMetricSample>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+114
@@ -0,0 +1,114 @@
|
||||
///
|
||||
/// NativeHealthMetricSample.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `HealthMetricType` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class HealthMetricType; }
|
||||
|
||||
#include "HealthMetricType.hpp"
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeHealthMetricSample).
|
||||
*/
|
||||
struct NativeHealthMetricSample final {
|
||||
public:
|
||||
HealthMetricType type SWIFT_PRIVATE;
|
||||
double value SWIFT_PRIVATE;
|
||||
std::string unit SWIFT_PRIVATE;
|
||||
std::string startDate SWIFT_PRIVATE;
|
||||
std::string endDate SWIFT_PRIVATE;
|
||||
std::optional<std::string> sourceName SWIFT_PRIVATE;
|
||||
std::optional<std::string> sourceBundleIdentifier SWIFT_PRIVATE;
|
||||
std::optional<std::string> deviceName SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeHealthMetricSample() = default;
|
||||
explicit NativeHealthMetricSample(HealthMetricType type, double value, std::string unit, std::string startDate, std::string endDate, std::optional<std::string> sourceName, std::optional<std::string> sourceBundleIdentifier, std::optional<std::string> deviceName): type(type), value(value), unit(unit), startDate(startDate), endDate(endDate), sourceName(sourceName), sourceBundleIdentifier(sourceBundleIdentifier), deviceName(deviceName) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeHealthMetricSample& lhs, const NativeHealthMetricSample& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeHealthMetricSample <> JS NativeHealthMetricSample (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeHealthMetricSample> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeHealthMetricSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeHealthMetricSample(
|
||||
JSIConverter<margelo::nitro::haptika::ppg::HealthMetricType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deviceName")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeHealthMetricSample& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::haptika::ppg::HealthMetricType>::toJSI(runtime, arg.type));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<double>::toJSI(runtime, arg.value));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::string>::toJSI(runtime, arg.unit));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::string>::toJSI(runtime, arg.startDate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::string>::toJSI(runtime, arg.endDate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceName));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceBundleIdentifier));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "deviceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.deviceName));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::HealthMetricType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deviceName")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+105
@@ -0,0 +1,105 @@
|
||||
///
|
||||
/// NativeHeartbeatSeriesSummary.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeHeartbeatSeriesSummary).
|
||||
*/
|
||||
struct NativeHeartbeatSeriesSummary final {
|
||||
public:
|
||||
std::string startDate SWIFT_PRIVATE;
|
||||
std::string endDate SWIFT_PRIVATE;
|
||||
std::optional<std::string> sourceName SWIFT_PRIVATE;
|
||||
std::optional<std::string> sourceBundleIdentifier SWIFT_PRIVATE;
|
||||
std::vector<double> heartbeatTimesSinceSeriesStartSeconds SWIFT_PRIVATE;
|
||||
std::vector<double> precededByGapIndexes SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeHeartbeatSeriesSummary() = default;
|
||||
explicit NativeHeartbeatSeriesSummary(std::string startDate, std::string endDate, std::optional<std::string> sourceName, std::optional<std::string> sourceBundleIdentifier, std::vector<double> heartbeatTimesSinceSeriesStartSeconds, std::vector<double> precededByGapIndexes): startDate(startDate), endDate(endDate), sourceName(sourceName), sourceBundleIdentifier(sourceBundleIdentifier), heartbeatTimesSinceSeriesStartSeconds(heartbeatTimesSinceSeriesStartSeconds), precededByGapIndexes(precededByGapIndexes) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeHeartbeatSeriesSummary& lhs, const NativeHeartbeatSeriesSummary& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeHeartbeatSeriesSummary <> JS NativeHeartbeatSeriesSummary (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary(
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"))),
|
||||
JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds"))),
|
||||
JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::string>::toJSI(runtime, arg.startDate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::string>::toJSI(runtime, arg.endDate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceName));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceBundleIdentifier));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.heartbeatTimesSinceSeriesStartSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.precededByGapIndexes));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier")))) return false;
|
||||
if (!JSIConverter<std::vector<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds")))) return false;
|
||||
if (!JSIConverter<std::vector<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+112
@@ -0,0 +1,112 @@
|
||||
///
|
||||
/// NativePPGConfiguration.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `PPGSessionPurpose` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class PPGSessionPurpose; }
|
||||
|
||||
#include "PPGSessionPurpose.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativePPGConfiguration).
|
||||
*/
|
||||
struct NativePPGConfiguration final {
|
||||
public:
|
||||
PPGSessionPurpose sessionPurpose SWIFT_PRIVATE;
|
||||
double targetSampleRate SWIFT_PRIVATE;
|
||||
double minimumFrequencyHz SWIFT_PRIVATE;
|
||||
double maximumFrequencyHz SWIFT_PRIVATE;
|
||||
double stabilizationSeconds SWIFT_PRIVATE;
|
||||
double measurementSeconds SWIFT_PRIVATE;
|
||||
double emitEveryFrames SWIFT_PRIVATE;
|
||||
double minimumContactConfidence SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativePPGConfiguration() = default;
|
||||
explicit NativePPGConfiguration(PPGSessionPurpose sessionPurpose, double targetSampleRate, double minimumFrequencyHz, double maximumFrequencyHz, double stabilizationSeconds, double measurementSeconds, double emitEveryFrames, double minimumContactConfidence): sessionPurpose(sessionPurpose), targetSampleRate(targetSampleRate), minimumFrequencyHz(minimumFrequencyHz), maximumFrequencyHz(maximumFrequencyHz), stabilizationSeconds(stabilizationSeconds), measurementSeconds(measurementSeconds), emitEveryFrames(emitEveryFrames), minimumContactConfidence(minimumContactConfidence) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativePPGConfiguration& lhs, const NativePPGConfiguration& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativePPGConfiguration <> JS NativePPGConfiguration (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativePPGConfiguration> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativePPGConfiguration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativePPGConfiguration(
|
||||
JSIConverter<margelo::nitro::haptika::ppg::PPGSessionPurpose>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionPurpose"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumContactConfidence")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativePPGConfiguration& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sessionPurpose"), JSIConverter<margelo::nitro::haptika::ppg::PPGSessionPurpose>::toJSI(runtime, arg.sessionPurpose));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate"), JSIConverter<double>::toJSI(runtime, arg.targetSampleRate));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz"), JSIConverter<double>::toJSI(runtime, arg.minimumFrequencyHz));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz"), JSIConverter<double>::toJSI(runtime, arg.maximumFrequencyHz));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds"), JSIConverter<double>::toJSI(runtime, arg.stabilizationSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds"), JSIConverter<double>::toJSI(runtime, arg.measurementSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames"), JSIConverter<double>::toJSI(runtime, arg.emitEveryFrames));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumContactConfidence"), JSIConverter<double>::toJSI(runtime, arg.minimumContactConfidence));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::PPGSessionPurpose>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionPurpose")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumContactConfidence")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+124
@@ -0,0 +1,124 @@
|
||||
///
|
||||
/// NativePPGProcessingResult.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativeBPMEstimate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeBPMEstimate; }
|
||||
// Forward declaration of `NativePRVMetrics` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePRVMetrics; }
|
||||
// Forward declaration of `NativeSignalQualityResult` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeSignalQualityResult; }
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include "NativeBPMEstimate.hpp"
|
||||
#include "NativePRVMetrics.hpp"
|
||||
#include "NativeSignalQualityResult.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativePPGProcessingResult).
|
||||
*/
|
||||
struct NativePPGProcessingResult final {
|
||||
public:
|
||||
bool valid SWIFT_PRIVATE;
|
||||
std::optional<std::string> invalidReason SWIFT_PRIVATE;
|
||||
NativeBPMEstimate bpm SWIFT_PRIVATE;
|
||||
NativePRVMetrics prv SWIFT_PRIVATE;
|
||||
NativeSignalQualityResult quality SWIFT_PRIVATE;
|
||||
double startedAtMonotonicSeconds SWIFT_PRIVATE;
|
||||
double endedAtMonotonicSeconds SWIFT_PRIVATE;
|
||||
double rawSampleCount SWIFT_PRIVATE;
|
||||
double resampledSampleCount SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativePPGProcessingResult() = default;
|
||||
explicit NativePPGProcessingResult(bool valid, std::optional<std::string> invalidReason, NativeBPMEstimate bpm, NativePRVMetrics prv, NativeSignalQualityResult quality, double startedAtMonotonicSeconds, double endedAtMonotonicSeconds, double rawSampleCount, double resampledSampleCount): valid(valid), invalidReason(invalidReason), bpm(bpm), prv(prv), quality(quality), startedAtMonotonicSeconds(startedAtMonotonicSeconds), endedAtMonotonicSeconds(endedAtMonotonicSeconds), rawSampleCount(rawSampleCount), resampledSampleCount(resampledSampleCount) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativePPGProcessingResult& lhs, const NativePPGProcessingResult& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativePPGProcessingResult <> JS NativePPGProcessingResult (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativePPGProcessingResult> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativePPGProcessingResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativePPGProcessingResult(
|
||||
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valid"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invalidReason"))),
|
||||
JSIConverter<margelo::nitro::haptika::ppg::NativeBPMEstimate>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm"))),
|
||||
JSIConverter<margelo::nitro::haptika::ppg::NativePRVMetrics>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prv"))),
|
||||
JSIConverter<margelo::nitro::haptika::ppg::NativeSignalQualityResult>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quality"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resampledSampleCount")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativePPGProcessingResult& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "valid"), JSIConverter<bool>::toJSI(runtime, arg.valid));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "invalidReason"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.invalidReason));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bpm"), JSIConverter<margelo::nitro::haptika::ppg::NativeBPMEstimate>::toJSI(runtime, arg.bpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "prv"), JSIConverter<margelo::nitro::haptika::ppg::NativePRVMetrics>::toJSI(runtime, arg.prv));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "quality"), JSIConverter<margelo::nitro::haptika::ppg::NativeSignalQualityResult>::toJSI(runtime, arg.quality));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds"), JSIConverter<double>::toJSI(runtime, arg.startedAtMonotonicSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds"), JSIConverter<double>::toJSI(runtime, arg.endedAtMonotonicSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount"), JSIConverter<double>::toJSI(runtime, arg.rawSampleCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "resampledSampleCount"), JSIConverter<double>::toJSI(runtime, arg.resampledSampleCount));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valid")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invalidReason")))) return false;
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::NativeBPMEstimate>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm")))) return false;
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::NativePRVMetrics>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prv")))) return false;
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::NativeSignalQualityResult>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quality")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resampledSampleCount")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
///
|
||||
/// NativePRVMetrics.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativePRVMetrics).
|
||||
*/
|
||||
struct NativePRVMetrics final {
|
||||
public:
|
||||
std::optional<double> estimatedRmssdMs SWIFT_PRIVATE;
|
||||
std::optional<double> estimatedSdnnMs SWIFT_PRIVATE;
|
||||
std::optional<double> meanIpiMs SWIFT_PRIVATE;
|
||||
std::optional<double> medianIpiMs SWIFT_PRIVATE;
|
||||
std::optional<double> pnn50Percent SWIFT_PRIVATE;
|
||||
std::optional<double> rangeIpiMs SWIFT_PRIVATE;
|
||||
std::optional<double> modeIpiMs SWIFT_PRIVATE;
|
||||
std::optional<double> amo50Percent SWIFT_PRIVATE;
|
||||
std::optional<double> coefficientOfVariation SWIFT_PRIVATE;
|
||||
double validIntervalCount SWIFT_PRIVATE;
|
||||
double rejectedIntervalCount SWIFT_PRIVATE;
|
||||
double rejectedIntervalRatio SWIFT_PRIVATE;
|
||||
bool reliable SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativePRVMetrics() = default;
|
||||
explicit NativePRVMetrics(std::optional<double> estimatedRmssdMs, std::optional<double> estimatedSdnnMs, std::optional<double> meanIpiMs, std::optional<double> medianIpiMs, std::optional<double> pnn50Percent, std::optional<double> rangeIpiMs, std::optional<double> modeIpiMs, std::optional<double> amo50Percent, std::optional<double> coefficientOfVariation, double validIntervalCount, double rejectedIntervalCount, double rejectedIntervalRatio, bool reliable): estimatedRmssdMs(estimatedRmssdMs), estimatedSdnnMs(estimatedSdnnMs), meanIpiMs(meanIpiMs), medianIpiMs(medianIpiMs), pnn50Percent(pnn50Percent), rangeIpiMs(rangeIpiMs), modeIpiMs(modeIpiMs), amo50Percent(amo50Percent), coefficientOfVariation(coefficientOfVariation), validIntervalCount(validIntervalCount), rejectedIntervalCount(rejectedIntervalCount), rejectedIntervalRatio(rejectedIntervalRatio), reliable(reliable) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativePRVMetrics& lhs, const NativePRVMetrics& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativePRVMetrics <> JS NativePRVMetrics (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativePRVMetrics> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativePRVMetrics fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativePRVMetrics(
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"))),
|
||||
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reliable")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativePRVMetrics& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.estimatedRmssdMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.estimatedSdnnMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.meanIpiMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.medianIpiMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.pnn50Percent));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rangeIpiMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.modeIpiMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.amo50Percent));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.coefficientOfVariation));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount"), JSIConverter<double>::toJSI(runtime, arg.validIntervalCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount"), JSIConverter<double>::toJSI(runtime, arg.rejectedIntervalCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"), JSIConverter<double>::toJSI(runtime, arg.rejectedIntervalRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "reliable"), JSIConverter<bool>::toJSI(runtime, arg.reliable));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedRmssdMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "estimatedSdnnMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "meanIpiMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "medianIpiMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pnn50Percent")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeIpiMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modeIpiMs")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amo50Percent")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coefficientOfVariation")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validIntervalCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio")))) return false;
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reliable")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Generated
+129
@@ -0,0 +1,129 @@
|
||||
///
|
||||
/// NativeSignalQualityResult.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (NativeSignalQualityResult).
|
||||
*/
|
||||
struct NativeSignalQualityResult final {
|
||||
public:
|
||||
double score SWIFT_PRIVATE;
|
||||
std::string level SWIFT_PRIVATE;
|
||||
double usableDurationSeconds SWIFT_PRIVATE;
|
||||
double droppedFrameRatio SWIFT_PRIVATE;
|
||||
double saturationRatio SWIFT_PRIVATE;
|
||||
double rejectedIntervalRatio SWIFT_PRIVATE;
|
||||
std::optional<double> signalToNoiseRatio SWIFT_PRIVATE;
|
||||
double motionArtifactRatio SWIFT_PRIVATE;
|
||||
double methodAgreementScore SWIFT_PRIVATE;
|
||||
double timestampJitterRatio SWIFT_PRIVATE;
|
||||
double longestGapSeconds SWIFT_PRIVATE;
|
||||
std::vector<std::string> issues SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
NativeSignalQualityResult() = default;
|
||||
explicit NativeSignalQualityResult(double score, std::string level, double usableDurationSeconds, double droppedFrameRatio, double saturationRatio, double rejectedIntervalRatio, std::optional<double> signalToNoiseRatio, double motionArtifactRatio, double methodAgreementScore, double timestampJitterRatio, double longestGapSeconds, std::vector<std::string> issues): score(score), level(level), usableDurationSeconds(usableDurationSeconds), droppedFrameRatio(droppedFrameRatio), saturationRatio(saturationRatio), rejectedIntervalRatio(rejectedIntervalRatio), signalToNoiseRatio(signalToNoiseRatio), motionArtifactRatio(motionArtifactRatio), methodAgreementScore(methodAgreementScore), timestampJitterRatio(timestampJitterRatio), longestGapSeconds(longestGapSeconds), issues(issues) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const NativeSignalQualityResult& lhs, const NativeSignalQualityResult& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ NativeSignalQualityResult <> JS NativeSignalQualityResult (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::NativeSignalQualityResult> final {
|
||||
static inline margelo::nitro::haptika::ppg::NativeSignalQualityResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::NativeSignalQualityResult(
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "score"))),
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalToNoiseRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementScore"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampJitterRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longestGapSeconds"))),
|
||||
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "issues")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeSignalQualityResult& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "score"), JSIConverter<double>::toJSI(runtime, arg.score));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "level"), JSIConverter<std::string>::toJSI(runtime, arg.level));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"), JSIConverter<double>::toJSI(runtime, arg.usableDurationSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameRatio"), JSIConverter<double>::toJSI(runtime, arg.droppedFrameRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"), JSIConverter<double>::toJSI(runtime, arg.saturationRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio"), JSIConverter<double>::toJSI(runtime, arg.rejectedIntervalRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "signalToNoiseRatio"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.signalToNoiseRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactRatio"), JSIConverter<double>::toJSI(runtime, arg.motionArtifactRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementScore"), JSIConverter<double>::toJSI(runtime, arg.methodAgreementScore));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampJitterRatio"), JSIConverter<double>::toJSI(runtime, arg.timestampJitterRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longestGapSeconds"), JSIConverter<double>::toJSI(runtime, arg.longestGapSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "issues"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.issues));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "score")))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rejectedIntervalRatio")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalToNoiseRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "methodAgreementScore")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampJitterRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longestGapSeconds")))) return false;
|
||||
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "issues")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
///
|
||||
/// PPGFrameUpdate.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
||||
#include <NitroModules/PropNameIDCache.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `FingerContactState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class FingerContactState; }
|
||||
// Forward declaration of `ThermalState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class ThermalState; }
|
||||
// Forward declaration of `NativeAcceptedBeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeAcceptedBeat; }
|
||||
|
||||
#include "FingerContactState.hpp"
|
||||
#include "ThermalState.hpp"
|
||||
#include <optional>
|
||||
#include "NativeAcceptedBeat.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (PPGFrameUpdate).
|
||||
*/
|
||||
struct PPGFrameUpdate final {
|
||||
public:
|
||||
double timestampSeconds SWIFT_PRIVATE;
|
||||
FingerContactState contactState SWIFT_PRIVATE;
|
||||
double contactConfidence SWIFT_PRIVATE;
|
||||
double signalLevel SWIFT_PRIVATE;
|
||||
double saturationRatio SWIFT_PRIVATE;
|
||||
double motionArtifactScore SWIFT_PRIVATE;
|
||||
double collectedSampleCount SWIFT_PRIVATE;
|
||||
double usableDurationSeconds SWIFT_PRIVATE;
|
||||
double droppedFrameCount SWIFT_PRIVATE;
|
||||
ThermalState thermalState SWIFT_PRIVATE;
|
||||
double waveformValue SWIFT_PRIVATE;
|
||||
std::optional<double> liveBpm SWIFT_PRIVATE;
|
||||
std::optional<double> liveIpiMs SWIFT_PRIVATE;
|
||||
double beatSequence SWIFT_PRIVATE;
|
||||
std::vector<NativeAcceptedBeat> acceptedBeats SWIFT_PRIVATE;
|
||||
std::optional<double> liveWindowQuality SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
PPGFrameUpdate() = default;
|
||||
explicit PPGFrameUpdate(double timestampSeconds, FingerContactState contactState, double contactConfidence, double signalLevel, double saturationRatio, double motionArtifactScore, double collectedSampleCount, double usableDurationSeconds, double droppedFrameCount, ThermalState thermalState, double waveformValue, std::optional<double> liveBpm, std::optional<double> liveIpiMs, double beatSequence, std::vector<NativeAcceptedBeat> acceptedBeats, std::optional<double> liveWindowQuality): timestampSeconds(timestampSeconds), contactState(contactState), contactConfidence(contactConfidence), signalLevel(signalLevel), saturationRatio(saturationRatio), motionArtifactScore(motionArtifactScore), collectedSampleCount(collectedSampleCount), usableDurationSeconds(usableDurationSeconds), droppedFrameCount(droppedFrameCount), thermalState(thermalState), waveformValue(waveformValue), liveBpm(liveBpm), liveIpiMs(liveIpiMs), beatSequence(beatSequence), acceptedBeats(acceptedBeats), liveWindowQuality(liveWindowQuality) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const PPGFrameUpdate& lhs, const PPGFrameUpdate& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ PPGFrameUpdate <> JS PPGFrameUpdate (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::PPGFrameUpdate> final {
|
||||
static inline margelo::nitro::haptika::ppg::PPGFrameUpdate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::haptika::ppg::PPGFrameUpdate(
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"))),
|
||||
JSIConverter<margelo::nitro::haptika::ppg::FingerContactState>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactState"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalLevel"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount"))),
|
||||
JSIConverter<margelo::nitro::haptika::ppg::ThermalState>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "thermalState"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waveformValue"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveBpm"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs"))),
|
||||
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "beatSequence"))),
|
||||
JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeAcceptedBeat>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveWindowQuality")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::PPGFrameUpdate& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"), JSIConverter<double>::toJSI(runtime, arg.timestampSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contactState"), JSIConverter<margelo::nitro::haptika::ppg::FingerContactState>::toJSI(runtime, arg.contactState));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence"), JSIConverter<double>::toJSI(runtime, arg.contactConfidence));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "signalLevel"), JSIConverter<double>::toJSI(runtime, arg.signalLevel));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"), JSIConverter<double>::toJSI(runtime, arg.saturationRatio));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore"), JSIConverter<double>::toJSI(runtime, arg.motionArtifactScore));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount"), JSIConverter<double>::toJSI(runtime, arg.collectedSampleCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"), JSIConverter<double>::toJSI(runtime, arg.usableDurationSeconds));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount"), JSIConverter<double>::toJSI(runtime, arg.droppedFrameCount));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "thermalState"), JSIConverter<margelo::nitro::haptika::ppg::ThermalState>::toJSI(runtime, arg.thermalState));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "waveformValue"), JSIConverter<double>::toJSI(runtime, arg.waveformValue));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveBpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.liveBpm));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.liveIpiMs));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "beatSequence"), JSIConverter<double>::toJSI(runtime, arg.beatSequence));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats"), JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeAcceptedBeat>>::toJSI(runtime, arg.acceptedBeats));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveWindowQuality"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.liveWindowQuality));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isObject()) {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds")))) return false;
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::FingerContactState>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactState")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalLevel")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount")))) return false;
|
||||
if (!JSIConverter<margelo::nitro::haptika::ppg::ThermalState>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "thermalState")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waveformValue")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveBpm")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs")))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "beatSequence")))) return false;
|
||||
if (!JSIConverter<std::vector<margelo::nitro::haptika::ppg::NativeAcceptedBeat>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveWindowQuality")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
///
|
||||
/// PPGSessionPurpose.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/NitroHash.hpp>)
|
||||
#include <NitroModules/NitroHash.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* An enum which can be represented as a JavaScript union (PPGSessionPurpose).
|
||||
*/
|
||||
enum class PPGSessionPurpose {
|
||||
SPOTMEASUREMENT SWIFT_NAME(spotmeasurement) = 0,
|
||||
COHERENCE SWIFT_NAME(coherence) = 1,
|
||||
} CLOSED_ENUM;
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ PPGSessionPurpose <> JS PPGSessionPurpose (union)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::PPGSessionPurpose> final {
|
||||
static inline margelo::nitro::haptika::ppg::PPGSessionPurpose fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("spotMeasurement"): return margelo::nitro::haptika::ppg::PPGSessionPurpose::SPOTMEASUREMENT;
|
||||
case hashString("coherence"): return margelo::nitro::haptika::ppg::PPGSessionPurpose::COHERENCE;
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum PPGSessionPurpose - invalid value!");
|
||||
}
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::haptika::ppg::PPGSessionPurpose arg) {
|
||||
switch (arg) {
|
||||
case margelo::nitro::haptika::ppg::PPGSessionPurpose::SPOTMEASUREMENT: return JSIConverter<std::string>::toJSI(runtime, "spotMeasurement");
|
||||
case margelo::nitro::haptika::ppg::PPGSessionPurpose::COHERENCE: return JSIConverter<std::string>::toJSI(runtime, "coherence");
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert PPGSessionPurpose to JS - invalid value: "
|
||||
+ std::to_string(static_cast<int>(arg)) + "!");
|
||||
}
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isString()) {
|
||||
return false;
|
||||
}
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("spotMeasurement"):
|
||||
case hashString("coherence"):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
///
|
||||
/// ThermalState.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/NitroHash.hpp>)
|
||||
#include <NitroModules/NitroHash.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
||||
#include <NitroModules/JSIConverter.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* An enum which can be represented as a JavaScript union (ThermalState).
|
||||
*/
|
||||
enum class ThermalState {
|
||||
NOMINAL SWIFT_NAME(nominal) = 0,
|
||||
FAIR SWIFT_NAME(fair) = 1,
|
||||
SERIOUS SWIFT_NAME(serious) = 2,
|
||||
CRITICAL SWIFT_NAME(critical) = 3,
|
||||
UNKNOWN SWIFT_NAME(unknown) = 4,
|
||||
} CLOSED_ENUM;
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ ThermalState <> JS ThermalState (union)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::haptika::ppg::ThermalState> final {
|
||||
static inline margelo::nitro::haptika::ppg::ThermalState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("nominal"): return margelo::nitro::haptika::ppg::ThermalState::NOMINAL;
|
||||
case hashString("fair"): return margelo::nitro::haptika::ppg::ThermalState::FAIR;
|
||||
case hashString("serious"): return margelo::nitro::haptika::ppg::ThermalState::SERIOUS;
|
||||
case hashString("critical"): return margelo::nitro::haptika::ppg::ThermalState::CRITICAL;
|
||||
case hashString("unknown"): return margelo::nitro::haptika::ppg::ThermalState::UNKNOWN;
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ThermalState - invalid value!");
|
||||
}
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::haptika::ppg::ThermalState arg) {
|
||||
switch (arg) {
|
||||
case margelo::nitro::haptika::ppg::ThermalState::NOMINAL: return JSIConverter<std::string>::toJSI(runtime, "nominal");
|
||||
case margelo::nitro::haptika::ppg::ThermalState::FAIR: return JSIConverter<std::string>::toJSI(runtime, "fair");
|
||||
case margelo::nitro::haptika::ppg::ThermalState::SERIOUS: return JSIConverter<std::string>::toJSI(runtime, "serious");
|
||||
case margelo::nitro::haptika::ppg::ThermalState::CRITICAL: return JSIConverter<std::string>::toJSI(runtime, "critical");
|
||||
case margelo::nitro::haptika::ppg::ThermalState::UNKNOWN: return JSIConverter<std::string>::toJSI(runtime, "unknown");
|
||||
default: [[unlikely]]
|
||||
throw std::invalid_argument("Cannot convert ThermalState to JS - invalid value: "
|
||||
+ std::to_string(static_cast<int>(arg)) + "!");
|
||||
}
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
if (!value.isString()) {
|
||||
return false;
|
||||
}
|
||||
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
||||
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
||||
case hashString("nominal"):
|
||||
case hashString("fair"):
|
||||
case hashString("serious"):
|
||||
case hashString("critical"):
|
||||
case hashString("unknown"):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
Reference in New Issue
Block a user