Files
haptika/packages/react-native-haptika-ppg/nitrogen/generated/shared/c++/PPGFrameUpdate.hpp
T
2026-07-31 16:20:10 +02:00

153 lines
11 KiB
C++
Generated

///
/// 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