/// /// 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() #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 `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 #include #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 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 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 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::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valid"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invalidReason"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prv"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quality"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount"))), JSIConverter::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::toJSI(runtime, arg.valid)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "invalidReason"), JSIConverter>::toJSI(runtime, arg.invalidReason)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "bpm"), JSIConverter::toJSI(runtime, arg.bpm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "prv"), JSIConverter::toJSI(runtime, arg.prv)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "quality"), JSIConverter::toJSI(runtime, arg.quality)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds"), JSIConverter::toJSI(runtime, arg.startedAtMonotonicSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds"), JSIConverter::toJSI(runtime, arg.endedAtMonotonicSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount"), JSIConverter::toJSI(runtime, arg.rawSampleCount)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "resampledSampleCount"), JSIConverter::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::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "valid")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invalidReason")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bpm")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prv")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quality")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startedAtMonotonicSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endedAtMonotonicSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawSampleCount")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resampledSampleCount")))) return false; return true; } }; } // namespace margelo::nitro