/// /// 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() #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 `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 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::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionPurpose"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames"))), JSIConverter::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::toJSI(runtime, arg.sessionPurpose)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate"), JSIConverter::toJSI(runtime, arg.targetSampleRate)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz"), JSIConverter::toJSI(runtime, arg.minimumFrequencyHz)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz"), JSIConverter::toJSI(runtime, arg.maximumFrequencyHz)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds"), JSIConverter::toJSI(runtime, arg.stabilizationSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds"), JSIConverter::toJSI(runtime, arg.measurementSeconds)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames"), JSIConverter::toJSI(runtime, arg.emitEveryFrames)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumContactConfidence"), JSIConverter::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::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionPurpose")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetSampleRate")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFrequencyHz")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFrequencyHz")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stabilizationSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSeconds")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "emitEveryFrames")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumContactConfidence")))) return false; return true; } }; } // namespace margelo::nitro