/// /// 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() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #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 #include "NativeAcceptedBeat.hpp" #include 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 liveBpm SWIFT_PRIVATE; std::optional liveIpiMs SWIFT_PRIVATE; double beatSequence SWIFT_PRIVATE; std::vector acceptedBeats SWIFT_PRIVATE; std::optional 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 liveBpm, std::optional liveIpiMs, double beatSequence, std::vector acceptedBeats, std::optional 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 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::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactState"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalLevel"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "thermalState"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waveformValue"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveBpm"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "beatSequence"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats"))), JSIConverter>::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::toJSI(runtime, arg.timestampSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "contactState"), JSIConverter::toJSI(runtime, arg.contactState)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence"), JSIConverter::toJSI(runtime, arg.contactConfidence)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "signalLevel"), JSIConverter::toJSI(runtime, arg.signalLevel)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio"), JSIConverter::toJSI(runtime, arg.saturationRatio)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore"), JSIConverter::toJSI(runtime, arg.motionArtifactScore)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount"), JSIConverter::toJSI(runtime, arg.collectedSampleCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds"), JSIConverter::toJSI(runtime, arg.usableDurationSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount"), JSIConverter::toJSI(runtime, arg.droppedFrameCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "thermalState"), JSIConverter::toJSI(runtime, arg.thermalState)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "waveformValue"), JSIConverter::toJSI(runtime, arg.waveformValue)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveBpm"), JSIConverter>::toJSI(runtime, arg.liveBpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs"), JSIConverter>::toJSI(runtime, arg.liveIpiMs)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "beatSequence"), JSIConverter::toJSI(runtime, arg.beatSequence)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats"), JSIConverter>::toJSI(runtime, arg.acceptedBeats)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "liveWindowQuality"), JSIConverter>::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::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactState")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contactConfidence")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signalLevel")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "saturationRatio")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "motionArtifactScore")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "collectedSampleCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "usableDurationSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "droppedFrameCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "thermalState")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "waveformValue")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveBpm")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveIpiMs")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "beatSequence")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "acceptedBeats")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "liveWindowQuality")))) return false; return true; } }; } // namespace margelo::nitro