feat: implement Haptika PPG and Watch V1
This commit is contained in:
@@ -0,0 +1 @@
|
||||
** linguist-generated=true
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# HaptikaPPG+autolinking.rb
|
||||
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
# https://github.com/mrousavy/nitro
|
||||
# Copyright © Marc Rousavy @ Margelo
|
||||
#
|
||||
|
||||
# This is a Ruby script that adds all files generated by Nitrogen
|
||||
# to the given podspec.
|
||||
#
|
||||
# To use it, add this to your .podspec:
|
||||
# ```ruby
|
||||
# Pod::Spec.new do |spec|
|
||||
# # ...
|
||||
#
|
||||
# # Add all files generated by Nitrogen
|
||||
# load 'nitrogen/generated/ios/HaptikaPPG+autolinking.rb'
|
||||
# add_nitrogen_files(spec)
|
||||
# end
|
||||
# ```
|
||||
|
||||
def add_nitrogen_files(spec)
|
||||
Pod::UI.puts "[NitroModules] 🔥 HaptikaPPG is boosted by nitro!"
|
||||
|
||||
spec.dependency "NitroModules"
|
||||
|
||||
current_source_files = Array(spec.attributes_hash['source_files'])
|
||||
spec.source_files = current_source_files + [
|
||||
# Generated cross-platform specs
|
||||
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
||||
# Generated bridges for the cross-platform specs
|
||||
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
||||
]
|
||||
|
||||
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
||||
spec.public_header_files = current_public_header_files + [
|
||||
# Generated specs
|
||||
"nitrogen/generated/shared/**/*.{h,hpp}",
|
||||
# Swift to C++ bridging helpers
|
||||
"nitrogen/generated/ios/HaptikaPPG-Swift-Cxx-Bridge.hpp"
|
||||
]
|
||||
|
||||
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
||||
spec.private_header_files = current_private_header_files + [
|
||||
# iOS specific specs
|
||||
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
||||
# Views are framework-specific and should be private
|
||||
"nitrogen/generated/shared/**/views/**/*"
|
||||
]
|
||||
|
||||
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
||||
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
||||
# Use C++ 20
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
||||
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
||||
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
||||
# Enables stricter modular headers
|
||||
"DEFINES_MODULE" => "YES",
|
||||
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
||||
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
||||
})
|
||||
end
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
///
|
||||
/// HaptikaPPG-Swift-Cxx-Bridge.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HaptikaPPG-Swift-Cxx-Bridge.hpp"
|
||||
|
||||
// Include C++ implementation defined types
|
||||
#include "HaptikaPPG-Swift-Cxx-Umbrella.hpp"
|
||||
#include "HybridHaptikaCardiacMirrorSpecSwift.hpp"
|
||||
#include "HybridHaptikaHealthKitSpecSwift.hpp"
|
||||
#include "HybridHaptikaPPGFrameProcessorSpecSwift.hpp"
|
||||
#include <NitroModules/NitroDefines.hpp>
|
||||
#include <VisionCamera/VisionCamera-Swift-Cxx-Bridge.hpp>
|
||||
|
||||
namespace margelo::nitro::haptika::ppg::bridge::swift {
|
||||
|
||||
// pragma MARK: std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>
|
||||
std::shared_ptr<margelo::nitro::camera::HybridFrameSpec> create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
||||
// Implemented in VisionCamera
|
||||
return margelo::nitro::camera::bridge::swift::create_std__shared_ptr_HybridFrameSpec_(swiftUnsafePointer);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType) {
|
||||
// Implemented in VisionCamera
|
||||
return margelo::nitro::camera::bridge::swift::get_std__shared_ptr_HybridFrameSpec_(cppType);
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>
|
||||
std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec> create_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
||||
HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx swiftPart = HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::haptika::ppg::HybridHaptikaPPGFrameProcessorSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ cppType) {
|
||||
std::shared_ptr<margelo::nitro::haptika::ppg::HybridHaptikaPPGFrameProcessorSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::haptika::ppg::HybridHaptikaPPGFrameProcessorSpecSwift>(cppType);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
throw std::runtime_error("Class \"HybridHaptikaPPGFrameProcessorSpec\" is not implemented in Swift!");
|
||||
}
|
||||
#endif
|
||||
HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
||||
return swiftPart.toUnsafe();
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(bool /* result */)>
|
||||
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
||||
auto swiftClosure = HaptikaPPG::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
||||
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
||||
swiftClosure.call(result);
|
||||
};
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
||||
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
||||
auto swiftClosure = HaptikaPPG::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
||||
swiftClosure.call(error);
|
||||
};
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const NativeHealthKitContext& /* result */)>
|
||||
Func_void_NativeHealthKitContext create_Func_void_NativeHealthKitContext(void* NON_NULL swiftClosureWrapper) noexcept {
|
||||
auto swiftClosure = HaptikaPPG::Func_void_NativeHealthKitContext::fromUnsafe(swiftClosureWrapper);
|
||||
return [swiftClosure = std::move(swiftClosure)](const NativeHealthKitContext& result) mutable -> void {
|
||||
swiftClosure.call(result);
|
||||
};
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>
|
||||
Func_void_std__optional_NativeHeartbeatSeriesSummary_ create_Func_void_std__optional_NativeHeartbeatSeriesSummary_(void* NON_NULL swiftClosureWrapper) noexcept {
|
||||
auto swiftClosure = HaptikaPPG::Func_void_std__optional_NativeHeartbeatSeriesSummary_::fromUnsafe(swiftClosureWrapper);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::optional<NativeHeartbeatSeriesSummary>& result) mutable -> void {
|
||||
swiftClosure.call(result);
|
||||
};
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaHealthKitSpec>
|
||||
std::shared_ptr<HybridHaptikaHealthKitSpec> create_std__shared_ptr_HybridHaptikaHealthKitSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
||||
HaptikaPPG::HybridHaptikaHealthKitSpec_cxx swiftPart = HaptikaPPG::HybridHaptikaHealthKitSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::haptika::ppg::HybridHaptikaHealthKitSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaHealthKitSpec_(std__shared_ptr_HybridHaptikaHealthKitSpec_ cppType) {
|
||||
std::shared_ptr<margelo::nitro::haptika::ppg::HybridHaptikaHealthKitSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::haptika::ppg::HybridHaptikaHealthKitSpecSwift>(cppType);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
throw std::runtime_error("Class \"HybridHaptikaHealthKitSpec\" is not implemented in Swift!");
|
||||
}
|
||||
#endif
|
||||
HaptikaPPG::HybridHaptikaHealthKitSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
||||
return swiftPart.toUnsafe();
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaCardiacMirrorSpec>
|
||||
std::shared_ptr<HybridHaptikaCardiacMirrorSpec> create_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
||||
HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx swiftPart = HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::haptika::ppg::HybridHaptikaCardiacMirrorSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ cppType) {
|
||||
std::shared_ptr<margelo::nitro::haptika::ppg::HybridHaptikaCardiacMirrorSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::haptika::ppg::HybridHaptikaCardiacMirrorSpecSwift>(cppType);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
throw std::runtime_error("Class \"HybridHaptikaCardiacMirrorSpec\" is not implemented in Swift!");
|
||||
}
|
||||
#endif
|
||||
HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
||||
return swiftPart.toUnsafe();
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg::bridge::swift
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
///
|
||||
/// HaptikaPPG-Swift-Cxx-Bridge.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
// Forward declarations of C++ defined types
|
||||
// Forward declaration of `FingerContactState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class FingerContactState; }
|
||||
// Forward declaration of `HealthMetricType` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class HealthMetricType; }
|
||||
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
||||
// Forward declaration of `HybridHaptikaCardiacMirrorSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaCardiacMirrorSpec; }
|
||||
// Forward declaration of `HybridHaptikaHealthKitSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaHealthKitSpec; }
|
||||
// Forward declaration of `HybridHaptikaPPGFrameProcessorSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaPPGFrameProcessorSpec; }
|
||||
// Forward declaration of `NativeAcceptedBeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeAcceptedBeat; }
|
||||
// Forward declaration of `NativeCardiacMirrorHeartbeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorHeartbeat; }
|
||||
// Forward declaration of `NativeCardiacMirrorPatternInfo` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorPatternInfo; }
|
||||
// Forward declaration of `NativeHealthKitContext` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthKitContext; }
|
||||
// Forward declaration of `NativeHealthMetricSample` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthMetricSample; }
|
||||
// Forward declaration of `NativeHeartbeatSeriesSummary` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHeartbeatSeriesSummary; }
|
||||
// Forward declaration of `NativePPGProcessingResult` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGProcessingResult; }
|
||||
// Forward declaration of `PPGFrameUpdate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct PPGFrameUpdate; }
|
||||
// Forward declaration of `ThermalState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class ThermalState; }
|
||||
|
||||
// Forward declarations of Swift defined types
|
||||
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
||||
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaCardiacMirrorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaCardiacMirrorSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaHealthKitSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaHealthKitSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaPPGFrameProcessorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaPPGFrameProcessorSpec_cxx; }
|
||||
|
||||
// Include C++ defined types
|
||||
#include "FingerContactState.hpp"
|
||||
#include "HealthMetricType.hpp"
|
||||
#include "HybridHaptikaCardiacMirrorSpec.hpp"
|
||||
#include "HybridHaptikaHealthKitSpec.hpp"
|
||||
#include "HybridHaptikaPPGFrameProcessorSpec.hpp"
|
||||
#include "NativeAcceptedBeat.hpp"
|
||||
#include "NativeCardiacMirrorHeartbeat.hpp"
|
||||
#include "NativeCardiacMirrorPatternInfo.hpp"
|
||||
#include "NativeHealthKitContext.hpp"
|
||||
#include "NativeHealthMetricSample.hpp"
|
||||
#include "NativeHeartbeatSeriesSummary.hpp"
|
||||
#include "NativePPGProcessingResult.hpp"
|
||||
#include "PPGFrameUpdate.hpp"
|
||||
#include "ThermalState.hpp"
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include <NitroModules/PromiseHolder.hpp>
|
||||
#include <NitroModules/Result.hpp>
|
||||
#include <VisionCamera/HybridFrameSpec.hpp>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
||||
* as well as helper functions to interact with those C++ types from Swift.
|
||||
*/
|
||||
namespace margelo::nitro::haptika::ppg::bridge::swift {
|
||||
|
||||
// pragma MARK: std::optional<double>
|
||||
/**
|
||||
* Specialized version of `std::optional<double>`.
|
||||
*/
|
||||
using std__optional_double_ = std::optional<double>;
|
||||
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
||||
return std::optional<double>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::vector<NativeAcceptedBeat>
|
||||
/**
|
||||
* Specialized version of `std::vector<NativeAcceptedBeat>`.
|
||||
*/
|
||||
using std__vector_NativeAcceptedBeat_ = std::vector<NativeAcceptedBeat>;
|
||||
inline std::vector<NativeAcceptedBeat> create_std__vector_NativeAcceptedBeat_(size_t size) noexcept {
|
||||
std::vector<NativeAcceptedBeat> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<PPGFrameUpdate>
|
||||
/**
|
||||
* Specialized version of `std::optional<PPGFrameUpdate>`.
|
||||
*/
|
||||
using std__optional_PPGFrameUpdate_ = std::optional<PPGFrameUpdate>;
|
||||
inline std::optional<PPGFrameUpdate> create_std__optional_PPGFrameUpdate_(const PPGFrameUpdate& value) noexcept {
|
||||
return std::optional<PPGFrameUpdate>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_PPGFrameUpdate_(const std::optional<PPGFrameUpdate>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline PPGFrameUpdate get_std__optional_PPGFrameUpdate_(const std::optional<PPGFrameUpdate>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>`.
|
||||
*/
|
||||
using std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>;
|
||||
std::shared_ptr<margelo::nitro::camera::HybridFrameSpec> create_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_ cppType);
|
||||
|
||||
// pragma MARK: std::weak_ptr<margelo::nitro::camera::HybridFrameSpec>
|
||||
using std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ = std::weak_ptr<margelo::nitro::camera::HybridFrameSpec>;
|
||||
inline std__weak_ptr_margelo__nitro__camera__HybridFrameSpec_ weakify_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(const std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>& strong) noexcept { return strong; }
|
||||
|
||||
// pragma MARK: std::optional<std::string>
|
||||
/**
|
||||
* Specialized version of `std::optional<std::string>`.
|
||||
*/
|
||||
using std__optional_std__string_ = std::optional<std::string>;
|
||||
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
||||
return std::optional<std::string>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::vector<std::string>
|
||||
/**
|
||||
* Specialized version of `std::vector<std::string>`.
|
||||
*/
|
||||
using std__vector_std__string_ = std::vector<std::string>;
|
||||
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
||||
std::vector<std::string> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>`.
|
||||
*/
|
||||
using std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ = std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>;
|
||||
std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec> create_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ cppType);
|
||||
|
||||
// pragma MARK: std::weak_ptr<HybridHaptikaPPGFrameProcessorSpec>
|
||||
using std__weak_ptr_HybridHaptikaPPGFrameProcessorSpec_ = std::weak_ptr<HybridHaptikaPPGFrameProcessorSpec>;
|
||||
inline std__weak_ptr_HybridHaptikaPPGFrameProcessorSpec_ weakify_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(const std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>& strong) noexcept { return strong; }
|
||||
|
||||
// pragma MARK: Result<void>
|
||||
using Result_void_ = Result<void>;
|
||||
inline Result_void_ create_Result_void_() noexcept {
|
||||
return Result<void>::withValue();
|
||||
}
|
||||
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
||||
return Result<void>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<std::optional<PPGFrameUpdate>>
|
||||
using Result_std__optional_PPGFrameUpdate__ = Result<std::optional<PPGFrameUpdate>>;
|
||||
inline Result_std__optional_PPGFrameUpdate__ create_Result_std__optional_PPGFrameUpdate__(const std::optional<PPGFrameUpdate>& value) noexcept {
|
||||
return Result<std::optional<PPGFrameUpdate>>::withValue(value);
|
||||
}
|
||||
inline Result_std__optional_PPGFrameUpdate__ create_Result_std__optional_PPGFrameUpdate__(const std::exception_ptr& error) noexcept {
|
||||
return Result<std::optional<PPGFrameUpdate>>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<NativePPGProcessingResult>
|
||||
using Result_NativePPGProcessingResult_ = Result<NativePPGProcessingResult>;
|
||||
inline Result_NativePPGProcessingResult_ create_Result_NativePPGProcessingResult_(const NativePPGProcessingResult& value) noexcept {
|
||||
return Result<NativePPGProcessingResult>::withValue(value);
|
||||
}
|
||||
inline Result_NativePPGProcessingResult_ create_Result_NativePPGProcessingResult_(const std::exception_ptr& error) noexcept {
|
||||
return Result<NativePPGProcessingResult>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<ThermalState>
|
||||
using Result_ThermalState_ = Result<ThermalState>;
|
||||
inline Result_ThermalState_ create_Result_ThermalState_(ThermalState value) noexcept {
|
||||
return Result<ThermalState>::withValue(std::move(value));
|
||||
}
|
||||
inline Result_ThermalState_ create_Result_ThermalState_(const std::exception_ptr& error) noexcept {
|
||||
return Result<ThermalState>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<Promise<bool>>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
||||
*/
|
||||
using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
|
||||
inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
|
||||
return Promise<bool>::create();
|
||||
}
|
||||
inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
|
||||
return PromiseHolder<bool>(std::move(promise));
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(bool /* result */)>
|
||||
/**
|
||||
* Specialized version of `std::function<void(bool)>`.
|
||||
*/
|
||||
using Func_void_bool = std::function<void(bool /* result */)>;
|
||||
/**
|
||||
* Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
|
||||
*/
|
||||
class Func_void_bool_Wrapper final {
|
||||
public:
|
||||
explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
|
||||
inline void call(bool result) const noexcept {
|
||||
_function->operator()(result);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(bool /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
||||
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
||||
return Func_void_bool_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
||||
/**
|
||||
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
||||
*/
|
||||
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
||||
/**
|
||||
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
||||
*/
|
||||
class Func_void_std__exception_ptr_Wrapper final {
|
||||
public:
|
||||
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
||||
inline void call(std::exception_ptr error) const noexcept {
|
||||
_function->operator()(error);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
||||
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
||||
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<NativeHealthMetricSample>
|
||||
/**
|
||||
* Specialized version of `std::optional<NativeHealthMetricSample>`.
|
||||
*/
|
||||
using std__optional_NativeHealthMetricSample_ = std::optional<NativeHealthMetricSample>;
|
||||
inline std::optional<NativeHealthMetricSample> create_std__optional_NativeHealthMetricSample_(const NativeHealthMetricSample& value) noexcept {
|
||||
return std::optional<NativeHealthMetricSample>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_NativeHealthMetricSample_(const std::optional<NativeHealthMetricSample>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline NativeHealthMetricSample get_std__optional_NativeHealthMetricSample_(const std::optional<NativeHealthMetricSample>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::vector<NativeHealthMetricSample>
|
||||
/**
|
||||
* Specialized version of `std::vector<NativeHealthMetricSample>`.
|
||||
*/
|
||||
using std__vector_NativeHealthMetricSample_ = std::vector<NativeHealthMetricSample>;
|
||||
inline std::vector<NativeHealthMetricSample> create_std__vector_NativeHealthMetricSample_(size_t size) noexcept {
|
||||
std::vector<NativeHealthMetricSample> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<Promise<NativeHealthKitContext>>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<Promise<NativeHealthKitContext>>`.
|
||||
*/
|
||||
using std__shared_ptr_Promise_NativeHealthKitContext__ = std::shared_ptr<Promise<NativeHealthKitContext>>;
|
||||
inline std::shared_ptr<Promise<NativeHealthKitContext>> create_std__shared_ptr_Promise_NativeHealthKitContext__() noexcept {
|
||||
return Promise<NativeHealthKitContext>::create();
|
||||
}
|
||||
inline PromiseHolder<NativeHealthKitContext> wrap_std__shared_ptr_Promise_NativeHealthKitContext__(std::shared_ptr<Promise<NativeHealthKitContext>> promise) noexcept {
|
||||
return PromiseHolder<NativeHealthKitContext>(std::move(promise));
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const NativeHealthKitContext& /* result */)>
|
||||
/**
|
||||
* Specialized version of `std::function<void(const NativeHealthKitContext&)>`.
|
||||
*/
|
||||
using Func_void_NativeHealthKitContext = std::function<void(const NativeHealthKitContext& /* result */)>;
|
||||
/**
|
||||
* Wrapper class for a `std::function<void(const NativeHealthKitContext& / * result * /)>`, this can be used from Swift.
|
||||
*/
|
||||
class Func_void_NativeHealthKitContext_Wrapper final {
|
||||
public:
|
||||
explicit Func_void_NativeHealthKitContext_Wrapper(std::function<void(const NativeHealthKitContext& /* result */)>&& func): _function(std::make_unique<std::function<void(const NativeHealthKitContext& /* result */)>>(std::move(func))) {}
|
||||
inline void call(NativeHealthKitContext result) const noexcept {
|
||||
_function->operator()(result);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const NativeHealthKitContext& /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_NativeHealthKitContext create_Func_void_NativeHealthKitContext(void* NON_NULL swiftClosureWrapper) noexcept;
|
||||
inline Func_void_NativeHealthKitContext_Wrapper wrap_Func_void_NativeHealthKitContext(Func_void_NativeHealthKitContext value) noexcept {
|
||||
return Func_void_NativeHealthKitContext_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
// pragma MARK: std::vector<double>
|
||||
/**
|
||||
* Specialized version of `std::vector<double>`.
|
||||
*/
|
||||
using std__vector_double_ = std::vector<double>;
|
||||
inline std::vector<double> create_std__vector_double_(size_t size) noexcept {
|
||||
std::vector<double> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<NativeHeartbeatSeriesSummary>
|
||||
/**
|
||||
* Specialized version of `std::optional<NativeHeartbeatSeriesSummary>`.
|
||||
*/
|
||||
using std__optional_NativeHeartbeatSeriesSummary_ = std::optional<NativeHeartbeatSeriesSummary>;
|
||||
inline std::optional<NativeHeartbeatSeriesSummary> create_std__optional_NativeHeartbeatSeriesSummary_(const NativeHeartbeatSeriesSummary& value) noexcept {
|
||||
return std::optional<NativeHeartbeatSeriesSummary>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_NativeHeartbeatSeriesSummary_(const std::optional<NativeHeartbeatSeriesSummary>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline NativeHeartbeatSeriesSummary get_std__optional_NativeHeartbeatSeriesSummary_(const std::optional<NativeHeartbeatSeriesSummary>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>`.
|
||||
*/
|
||||
using std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___ = std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>;
|
||||
inline std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>> create_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___() noexcept {
|
||||
return Promise<std::optional<NativeHeartbeatSeriesSummary>>::create();
|
||||
}
|
||||
inline PromiseHolder<std::optional<NativeHeartbeatSeriesSummary>> wrap_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___(std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>> promise) noexcept {
|
||||
return PromiseHolder<std::optional<NativeHeartbeatSeriesSummary>>(std::move(promise));
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>
|
||||
/**
|
||||
* Specialized version of `std::function<void(const std::optional<NativeHeartbeatSeriesSummary>&)>`.
|
||||
*/
|
||||
using Func_void_std__optional_NativeHeartbeatSeriesSummary_ = std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>;
|
||||
/**
|
||||
* Wrapper class for a `std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& / * result * /)>`, this can be used from Swift.
|
||||
*/
|
||||
class Func_void_std__optional_NativeHeartbeatSeriesSummary__Wrapper final {
|
||||
public:
|
||||
explicit Func_void_std__optional_NativeHeartbeatSeriesSummary__Wrapper(std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>>(std::move(func))) {}
|
||||
inline void call(std::optional<NativeHeartbeatSeriesSummary> result) const noexcept {
|
||||
_function->operator()(result);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::optional<NativeHeartbeatSeriesSummary>& /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__optional_NativeHeartbeatSeriesSummary_ create_Func_void_std__optional_NativeHeartbeatSeriesSummary_(void* NON_NULL swiftClosureWrapper) noexcept;
|
||||
inline Func_void_std__optional_NativeHeartbeatSeriesSummary__Wrapper wrap_Func_void_std__optional_NativeHeartbeatSeriesSummary_(Func_void_std__optional_NativeHeartbeatSeriesSummary_ value) noexcept {
|
||||
return Func_void_std__optional_NativeHeartbeatSeriesSummary__Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaHealthKitSpec>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<HybridHaptikaHealthKitSpec>`.
|
||||
*/
|
||||
using std__shared_ptr_HybridHaptikaHealthKitSpec_ = std::shared_ptr<HybridHaptikaHealthKitSpec>;
|
||||
std::shared_ptr<HybridHaptikaHealthKitSpec> create_std__shared_ptr_HybridHaptikaHealthKitSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaHealthKitSpec_(std__shared_ptr_HybridHaptikaHealthKitSpec_ cppType);
|
||||
|
||||
// pragma MARK: std::weak_ptr<HybridHaptikaHealthKitSpec>
|
||||
using std__weak_ptr_HybridHaptikaHealthKitSpec_ = std::weak_ptr<HybridHaptikaHealthKitSpec>;
|
||||
inline std__weak_ptr_HybridHaptikaHealthKitSpec_ weakify_std__shared_ptr_HybridHaptikaHealthKitSpec_(const std::shared_ptr<HybridHaptikaHealthKitSpec>& strong) noexcept { return strong; }
|
||||
|
||||
// pragma MARK: Result<bool>
|
||||
using Result_bool_ = Result<bool>;
|
||||
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
||||
return Result<bool>::withValue(std::move(value));
|
||||
}
|
||||
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
||||
return Result<bool>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<std::shared_ptr<Promise<bool>>>
|
||||
using Result_std__shared_ptr_Promise_bool___ = Result<std::shared_ptr<Promise<bool>>>;
|
||||
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::shared_ptr<Promise<bool>>& value) noexcept {
|
||||
return Result<std::shared_ptr<Promise<bool>>>::withValue(value);
|
||||
}
|
||||
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::exception_ptr& error) noexcept {
|
||||
return Result<std::shared_ptr<Promise<bool>>>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<std::shared_ptr<Promise<NativeHealthKitContext>>>
|
||||
using Result_std__shared_ptr_Promise_NativeHealthKitContext___ = Result<std::shared_ptr<Promise<NativeHealthKitContext>>>;
|
||||
inline Result_std__shared_ptr_Promise_NativeHealthKitContext___ create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(const std::shared_ptr<Promise<NativeHealthKitContext>>& value) noexcept {
|
||||
return Result<std::shared_ptr<Promise<NativeHealthKitContext>>>::withValue(value);
|
||||
}
|
||||
inline Result_std__shared_ptr_Promise_NativeHealthKitContext___ create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(const std::exception_ptr& error) noexcept {
|
||||
return Result<std::shared_ptr<Promise<NativeHealthKitContext>>>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>>
|
||||
using Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____ = Result<std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>>;
|
||||
inline Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____ create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(const std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>& value) noexcept {
|
||||
return Result<std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>>::withValue(value);
|
||||
}
|
||||
inline Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____ create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(const std::exception_ptr& error) noexcept {
|
||||
return Result<std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>>>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<NativeCardiacMirrorHeartbeat>
|
||||
/**
|
||||
* Specialized version of `std::optional<NativeCardiacMirrorHeartbeat>`.
|
||||
*/
|
||||
using std__optional_NativeCardiacMirrorHeartbeat_ = std::optional<NativeCardiacMirrorHeartbeat>;
|
||||
inline std::optional<NativeCardiacMirrorHeartbeat> create_std__optional_NativeCardiacMirrorHeartbeat_(const NativeCardiacMirrorHeartbeat& value) noexcept {
|
||||
return std::optional<NativeCardiacMirrorHeartbeat>(value);
|
||||
}
|
||||
inline bool has_value_std__optional_NativeCardiacMirrorHeartbeat_(const std::optional<NativeCardiacMirrorHeartbeat>& optional) noexcept {
|
||||
return optional.has_value();
|
||||
}
|
||||
inline NativeCardiacMirrorHeartbeat get_std__optional_NativeCardiacMirrorHeartbeat_(const std::optional<NativeCardiacMirrorHeartbeat>& optional) noexcept {
|
||||
return optional.value();
|
||||
}
|
||||
|
||||
// pragma MARK: std::shared_ptr<HybridHaptikaCardiacMirrorSpec>
|
||||
/**
|
||||
* Specialized version of `std::shared_ptr<HybridHaptikaCardiacMirrorSpec>`.
|
||||
*/
|
||||
using std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ = std::shared_ptr<HybridHaptikaCardiacMirrorSpec>;
|
||||
std::shared_ptr<HybridHaptikaCardiacMirrorSpec> create_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ cppType);
|
||||
|
||||
// pragma MARK: std::weak_ptr<HybridHaptikaCardiacMirrorSpec>
|
||||
using std__weak_ptr_HybridHaptikaCardiacMirrorSpec_ = std::weak_ptr<HybridHaptikaCardiacMirrorSpec>;
|
||||
inline std__weak_ptr_HybridHaptikaCardiacMirrorSpec_ weakify_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(const std::shared_ptr<HybridHaptikaCardiacMirrorSpec>& strong) noexcept { return strong; }
|
||||
|
||||
// pragma MARK: Result<NativeCardiacMirrorPatternInfo>
|
||||
using Result_NativeCardiacMirrorPatternInfo_ = Result<NativeCardiacMirrorPatternInfo>;
|
||||
inline Result_NativeCardiacMirrorPatternInfo_ create_Result_NativeCardiacMirrorPatternInfo_(const NativeCardiacMirrorPatternInfo& value) noexcept {
|
||||
return Result<NativeCardiacMirrorPatternInfo>::withValue(value);
|
||||
}
|
||||
inline Result_NativeCardiacMirrorPatternInfo_ create_Result_NativeCardiacMirrorPatternInfo_(const std::exception_ptr& error) noexcept {
|
||||
return Result<NativeCardiacMirrorPatternInfo>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<std::optional<NativeCardiacMirrorHeartbeat>>
|
||||
using Result_std__optional_NativeCardiacMirrorHeartbeat__ = Result<std::optional<NativeCardiacMirrorHeartbeat>>;
|
||||
inline Result_std__optional_NativeCardiacMirrorHeartbeat__ create_Result_std__optional_NativeCardiacMirrorHeartbeat__(const std::optional<NativeCardiacMirrorHeartbeat>& value) noexcept {
|
||||
return Result<std::optional<NativeCardiacMirrorHeartbeat>>::withValue(value);
|
||||
}
|
||||
inline Result_std__optional_NativeCardiacMirrorHeartbeat__ create_Result_std__optional_NativeCardiacMirrorHeartbeat__(const std::exception_ptr& error) noexcept {
|
||||
return Result<std::optional<NativeCardiacMirrorHeartbeat>>::withError(error);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<double>
|
||||
using Result_double_ = Result<double>;
|
||||
inline Result_double_ create_Result_double_(double value) noexcept {
|
||||
return Result<double>::withValue(std::move(value));
|
||||
}
|
||||
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
||||
return Result<double>::withError(error);
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg::bridge::swift
|
||||
Generated
+110
@@ -0,0 +1,110 @@
|
||||
///
|
||||
/// HaptikaPPG-Swift-Cxx-Umbrella.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
// Forward declarations of C++ defined types
|
||||
// Forward declaration of `FingerContactState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class FingerContactState; }
|
||||
// Forward declaration of `HealthMetricType` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class HealthMetricType; }
|
||||
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
||||
// Forward declaration of `HybridHaptikaCardiacMirrorSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaCardiacMirrorSpec; }
|
||||
// Forward declaration of `HybridHaptikaHealthKitSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaHealthKitSpec; }
|
||||
// Forward declaration of `HybridHaptikaPPGFrameProcessorSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { class HybridHaptikaPPGFrameProcessorSpec; }
|
||||
// Forward declaration of `NativeAcceptedBeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeAcceptedBeat; }
|
||||
// Forward declaration of `NativeBPMEstimate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeBPMEstimate; }
|
||||
// Forward declaration of `NativeCardiacMirrorHeartbeat` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorHeartbeat; }
|
||||
// Forward declaration of `NativeCardiacMirrorPatternInfo` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeCardiacMirrorPatternInfo; }
|
||||
// Forward declaration of `NativeHealthKitContext` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthKitContext; }
|
||||
// Forward declaration of `NativeHealthMetricSample` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthMetricSample; }
|
||||
// Forward declaration of `NativeHeartbeatSeriesSummary` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHeartbeatSeriesSummary; }
|
||||
// Forward declaration of `NativePPGConfiguration` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGConfiguration; }
|
||||
// Forward declaration of `NativePPGProcessingResult` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGProcessingResult; }
|
||||
// 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; }
|
||||
// Forward declaration of `PPGFrameUpdate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct PPGFrameUpdate; }
|
||||
// Forward declaration of `PPGSessionPurpose` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class PPGSessionPurpose; }
|
||||
// Forward declaration of `ThermalState` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class ThermalState; }
|
||||
|
||||
// Include C++ defined types
|
||||
#include "FingerContactState.hpp"
|
||||
#include "HealthMetricType.hpp"
|
||||
#include "HybridHaptikaCardiacMirrorSpec.hpp"
|
||||
#include "HybridHaptikaHealthKitSpec.hpp"
|
||||
#include "HybridHaptikaPPGFrameProcessorSpec.hpp"
|
||||
#include "NativeAcceptedBeat.hpp"
|
||||
#include "NativeBPMEstimate.hpp"
|
||||
#include "NativeCardiacMirrorHeartbeat.hpp"
|
||||
#include "NativeCardiacMirrorPatternInfo.hpp"
|
||||
#include "NativeHealthKitContext.hpp"
|
||||
#include "NativeHealthMetricSample.hpp"
|
||||
#include "NativeHeartbeatSeriesSummary.hpp"
|
||||
#include "NativePPGConfiguration.hpp"
|
||||
#include "NativePPGProcessingResult.hpp"
|
||||
#include "NativePRVMetrics.hpp"
|
||||
#include "NativeSignalQualityResult.hpp"
|
||||
#include "PPGFrameUpdate.hpp"
|
||||
#include "PPGSessionPurpose.hpp"
|
||||
#include "ThermalState.hpp"
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include <NitroModules/Result.hpp>
|
||||
#include <VisionCamera/HybridFrameSpec.hpp>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// C++ helpers for Swift
|
||||
#include "HaptikaPPG-Swift-Cxx-Bridge.hpp"
|
||||
|
||||
// Common C++ types used in Swift
|
||||
#include <NitroModules/ArrayBufferHolder.hpp>
|
||||
#include <NitroModules/AnyMapUtils.hpp>
|
||||
#include <NitroModules/RuntimeError.hpp>
|
||||
#include <NitroModules/DateToChronoDate.hpp>
|
||||
|
||||
// Forward declarations of Swift defined types
|
||||
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
||||
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaCardiacMirrorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaCardiacMirrorSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaHealthKitSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaHealthKitSpec_cxx; }
|
||||
// Forward declaration of `HybridHaptikaPPGFrameProcessorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaPPGFrameProcessorSpec_cxx; }
|
||||
|
||||
// Include Swift defined types
|
||||
#if __has_include("HaptikaPPG-Swift.h")
|
||||
// This header is generated by Xcode/Swift on every app build.
|
||||
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "HaptikaPPG".
|
||||
#include "HaptikaPPG-Swift.h"
|
||||
// Same as above, but used when building with frameworks (`use_frameworks`)
|
||||
#elif __has_include(<HaptikaPPG/HaptikaPPG-Swift.h>)
|
||||
#include <HaptikaPPG/HaptikaPPG-Swift.h>
|
||||
#else
|
||||
#error HaptikaPPG's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "HaptikaPPG", and try building the app first.
|
||||
#endif
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
///
|
||||
/// HaptikaPPGAutolinking.mm
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <NitroModules/HybridObjectRegistry.hpp>
|
||||
#import "HaptikaPPG-Swift-Cxx-Umbrella.hpp"
|
||||
#import <type_traits>
|
||||
|
||||
#include "HybridHaptikaPPGFrameProcessorSpecSwift.hpp"
|
||||
#include "HybridHaptikaHealthKitSpecSwift.hpp"
|
||||
#include "HybridHaptikaCardiacMirrorSpecSwift.hpp"
|
||||
|
||||
@interface HaptikaPPGAutolinking : NSObject
|
||||
@end
|
||||
|
||||
@implementation HaptikaPPGAutolinking
|
||||
|
||||
+ (void) load {
|
||||
using namespace margelo::nitro;
|
||||
using namespace margelo::nitro::haptika::ppg;
|
||||
|
||||
HybridObjectRegistry::registerHybridObjectConstructor(
|
||||
"HaptikaPPGFrameProcessor",
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec> hybridObject = HaptikaPPG::HaptikaPPGAutolinking::createHaptikaPPGFrameProcessor();
|
||||
return hybridObject;
|
||||
}
|
||||
);
|
||||
HybridObjectRegistry::registerHybridObjectConstructor(
|
||||
"HaptikaHealthKit",
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
std::shared_ptr<HybridHaptikaHealthKitSpec> hybridObject = HaptikaPPG::HaptikaPPGAutolinking::createHaptikaHealthKit();
|
||||
return hybridObject;
|
||||
}
|
||||
);
|
||||
HybridObjectRegistry::registerHybridObjectConstructor(
|
||||
"HaptikaCardiacMirror",
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
std::shared_ptr<HybridHaptikaCardiacMirrorSpec> hybridObject = HaptikaPPG::HaptikaPPGAutolinking::createHaptikaCardiacMirror();
|
||||
return hybridObject;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@end
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
///
|
||||
/// HaptikaPPGAutolinking.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
||||
// See: https://github.com/swiftlang/swift/pull/83616
|
||||
public final class HaptikaPPGAutolinking {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
public static func createHaptikaPPGFrameProcessor() -> bridge.std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ {
|
||||
let hybridObject = HybridHaptikaPPGFrameProcessor()
|
||||
return { () -> bridge.std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ in
|
||||
let __cxxWrapped = hybridObject.getCxxWrapper()
|
||||
return __cxxWrapped.getCxxPart()
|
||||
}()
|
||||
}
|
||||
|
||||
public static func isHaptikaPPGFrameProcessorRecyclable() -> Bool {
|
||||
return HybridHaptikaPPGFrameProcessor.self is any RecyclableView.Type
|
||||
}
|
||||
|
||||
public static func createHaptikaHealthKit() -> bridge.std__shared_ptr_HybridHaptikaHealthKitSpec_ {
|
||||
let hybridObject = HybridHaptikaHealthKit()
|
||||
return { () -> bridge.std__shared_ptr_HybridHaptikaHealthKitSpec_ in
|
||||
let __cxxWrapped = hybridObject.getCxxWrapper()
|
||||
return __cxxWrapped.getCxxPart()
|
||||
}()
|
||||
}
|
||||
|
||||
public static func isHaptikaHealthKitRecyclable() -> Bool {
|
||||
return HybridHaptikaHealthKit.self is any RecyclableView.Type
|
||||
}
|
||||
|
||||
public static func createHaptikaCardiacMirror() -> bridge.std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ {
|
||||
let hybridObject = HybridHaptikaCardiacMirror()
|
||||
return { () -> bridge.std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ in
|
||||
let __cxxWrapped = hybridObject.getCxxWrapper()
|
||||
return __cxxWrapped.getCxxPart()
|
||||
}()
|
||||
}
|
||||
|
||||
public static func isHaptikaCardiacMirrorRecyclable() -> Bool {
|
||||
return HybridHaptikaCardiacMirror.self is any RecyclableView.Type
|
||||
}
|
||||
}
|
||||
packages/react-native-haptika-ppg/nitrogen/generated/ios/c++/HybridHaptikaCardiacMirrorSpecSwift.cpp
Generated
+11
@@ -0,0 +1,11 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpecSwift.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaCardiacMirrorSpecSwift.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
packages/react-native-haptika-ppg/nitrogen/generated/ios/c++/HybridHaptikaCardiacMirrorSpecSwift.hpp
Generated
+150
@@ -0,0 +1,150 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpecSwift.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HybridHaptikaCardiacMirrorSpec.hpp"
|
||||
|
||||
// Forward declaration of `HybridHaptikaCardiacMirrorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaCardiacMirrorSpec_cxx; }
|
||||
|
||||
// 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 <string>
|
||||
#include "NativeCardiacMirrorHeartbeat.hpp"
|
||||
#include <optional>
|
||||
|
||||
#include "HaptikaPPG-Swift-Cxx-Umbrella.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* The C++ part of HybridHaptikaCardiacMirrorSpec_cxx.swift.
|
||||
*
|
||||
* HybridHaptikaCardiacMirrorSpecSwift (C++) accesses HybridHaptikaCardiacMirrorSpec_cxx (Swift), and might
|
||||
* contain some additional bridging code for C++ <> Swift interop.
|
||||
*
|
||||
* Since this obviously introduces an overhead, I hope at some point in
|
||||
* the future, HybridHaptikaCardiacMirrorSpec_cxx can directly inherit from the C++ class HybridHaptikaCardiacMirrorSpec
|
||||
* to simplify the whole structure and memory management.
|
||||
*/
|
||||
class HybridHaptikaCardiacMirrorSpecSwift: public virtual HybridHaptikaCardiacMirrorSpec {
|
||||
public:
|
||||
// Constructor from a Swift instance
|
||||
explicit HybridHaptikaCardiacMirrorSpecSwift(const HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx& swiftPart):
|
||||
HybridObject(HybridHaptikaCardiacMirrorSpec::TAG),
|
||||
_swiftPart(swiftPart) { }
|
||||
|
||||
public:
|
||||
// Get the Swift part
|
||||
inline HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx& getSwiftPart() noexcept {
|
||||
return _swiftPart;
|
||||
}
|
||||
|
||||
public:
|
||||
inline size_t getExternalMemorySize() noexcept override {
|
||||
return _swiftPart.getMemorySize();
|
||||
}
|
||||
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
||||
if (auto otherCast = std::dynamic_pointer_cast<HybridHaptikaCardiacMirrorSpecSwift>(other)) {
|
||||
return _swiftPart.equals(otherCast->_swiftPart);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void dispose() noexcept override {
|
||||
_swiftPart.dispose();
|
||||
}
|
||||
std::string toString() override {
|
||||
return _swiftPart.toString();
|
||||
}
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
inline bool isSupported() override {
|
||||
auto __result = _swiftPart.isSupported();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline NativeCardiacMirrorPatternInfo patternInfo() override {
|
||||
auto __result = _swiftPart.patternInfo();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline void start(double targetBpm) override {
|
||||
auto __result = _swiftPart.start(std::forward<decltype(targetBpm)>(targetBpm));
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline void pulse() override {
|
||||
auto __result = _swiftPart.pulse();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline void stop() override {
|
||||
auto __result = _swiftPart.stop();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline void startWatchSession() override {
|
||||
auto __result = _swiftPart.startWatchSession();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline bool watchReachable() override {
|
||||
auto __result = _swiftPart.watchReachable();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline std::optional<NativeCardiacMirrorHeartbeat> latestHeartbeat() override {
|
||||
auto __result = _swiftPart.latestHeartbeat();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline double playRegulationProtocol(const std::string& kind) override {
|
||||
auto __result = _swiftPart.playRegulationProtocol(kind);
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline void stopRegulationProtocol() override {
|
||||
auto __result = _swiftPart.stopRegulationProtocol();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
HaptikaPPG::HybridHaptikaCardiacMirrorSpec_cxx _swiftPart;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
Generated
+11
@@ -0,0 +1,11 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpecSwift.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaHealthKitSpecSwift.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
Generated
+120
@@ -0,0 +1,120 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpecSwift.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HybridHaptikaHealthKitSpec.hpp"
|
||||
|
||||
// Forward declaration of `HybridHaptikaHealthKitSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaHealthKitSpec_cxx; }
|
||||
|
||||
// Forward declaration of `NativeHealthKitContext` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthKitContext; }
|
||||
// Forward declaration of `NativeHealthMetricSample` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHealthMetricSample; }
|
||||
// Forward declaration of `HealthMetricType` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class HealthMetricType; }
|
||||
// Forward declaration of `NativeHeartbeatSeriesSummary` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativeHeartbeatSeriesSummary; }
|
||||
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include "NativeHealthKitContext.hpp"
|
||||
#include "NativeHealthMetricSample.hpp"
|
||||
#include <optional>
|
||||
#include "HealthMetricType.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "NativeHeartbeatSeriesSummary.hpp"
|
||||
|
||||
#include "HaptikaPPG-Swift-Cxx-Umbrella.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* The C++ part of HybridHaptikaHealthKitSpec_cxx.swift.
|
||||
*
|
||||
* HybridHaptikaHealthKitSpecSwift (C++) accesses HybridHaptikaHealthKitSpec_cxx (Swift), and might
|
||||
* contain some additional bridging code for C++ <> Swift interop.
|
||||
*
|
||||
* Since this obviously introduces an overhead, I hope at some point in
|
||||
* the future, HybridHaptikaHealthKitSpec_cxx can directly inherit from the C++ class HybridHaptikaHealthKitSpec
|
||||
* to simplify the whole structure and memory management.
|
||||
*/
|
||||
class HybridHaptikaHealthKitSpecSwift: public virtual HybridHaptikaHealthKitSpec {
|
||||
public:
|
||||
// Constructor from a Swift instance
|
||||
explicit HybridHaptikaHealthKitSpecSwift(const HaptikaPPG::HybridHaptikaHealthKitSpec_cxx& swiftPart):
|
||||
HybridObject(HybridHaptikaHealthKitSpec::TAG),
|
||||
_swiftPart(swiftPart) { }
|
||||
|
||||
public:
|
||||
// Get the Swift part
|
||||
inline HaptikaPPG::HybridHaptikaHealthKitSpec_cxx& getSwiftPart() noexcept {
|
||||
return _swiftPart;
|
||||
}
|
||||
|
||||
public:
|
||||
inline size_t getExternalMemorySize() noexcept override {
|
||||
return _swiftPart.getMemorySize();
|
||||
}
|
||||
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
||||
if (auto otherCast = std::dynamic_pointer_cast<HybridHaptikaHealthKitSpecSwift>(other)) {
|
||||
return _swiftPart.equals(otherCast->_swiftPart);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void dispose() noexcept override {
|
||||
_swiftPart.dispose();
|
||||
}
|
||||
std::string toString() override {
|
||||
return _swiftPart.toString();
|
||||
}
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
inline bool isAvailable() override {
|
||||
auto __result = _swiftPart.isAvailable();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline std::shared_ptr<Promise<bool>> requestReadAuthorization() override {
|
||||
auto __result = _swiftPart.requestReadAuthorization();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline std::shared_ptr<Promise<NativeHealthKitContext>> fetchContext(double lookbackDays) override {
|
||||
auto __result = _swiftPart.fetchContext(std::forward<decltype(lookbackDays)>(lookbackDays));
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline std::shared_ptr<Promise<std::optional<NativeHeartbeatSeriesSummary>>> fetchLatestHeartbeatSeries() override {
|
||||
auto __result = _swiftPart.fetchLatestHeartbeatSeries();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
|
||||
private:
|
||||
HaptikaPPG::HybridHaptikaHealthKitSpec_cxx _swiftPart;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpecSwift.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "HybridHaptikaPPGFrameProcessorSpecSwift.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpecSwift.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HybridHaptikaPPGFrameProcessorSpec.hpp"
|
||||
|
||||
// Forward declaration of `HybridHaptikaPPGFrameProcessorSpec_cxx` to properly resolve imports.
|
||||
namespace HaptikaPPG { class HybridHaptikaPPGFrameProcessorSpec_cxx; }
|
||||
|
||||
// Forward declaration of `NativePPGConfiguration` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct NativePPGConfiguration; }
|
||||
// Forward declaration of `PPGSessionPurpose` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { enum class PPGSessionPurpose; }
|
||||
// Forward declaration of `PPGFrameUpdate` to properly resolve imports.
|
||||
namespace margelo::nitro::haptika::ppg { struct PPGFrameUpdate; }
|
||||
// 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; }
|
||||
// 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 `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 "NativePPGConfiguration.hpp"
|
||||
#include "PPGSessionPurpose.hpp"
|
||||
#include "PPGFrameUpdate.hpp"
|
||||
#include <optional>
|
||||
#include "FingerContactState.hpp"
|
||||
#include "ThermalState.hpp"
|
||||
#include "NativeAcceptedBeat.hpp"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <VisionCamera/HybridFrameSpec.hpp>
|
||||
#include "NativePPGProcessingResult.hpp"
|
||||
#include <string>
|
||||
#include "NativeBPMEstimate.hpp"
|
||||
#include "NativePRVMetrics.hpp"
|
||||
#include "NativeSignalQualityResult.hpp"
|
||||
|
||||
#include "HaptikaPPG-Swift-Cxx-Umbrella.hpp"
|
||||
|
||||
namespace margelo::nitro::haptika::ppg {
|
||||
|
||||
/**
|
||||
* The C++ part of HybridHaptikaPPGFrameProcessorSpec_cxx.swift.
|
||||
*
|
||||
* HybridHaptikaPPGFrameProcessorSpecSwift (C++) accesses HybridHaptikaPPGFrameProcessorSpec_cxx (Swift), and might
|
||||
* contain some additional bridging code for C++ <> Swift interop.
|
||||
*
|
||||
* Since this obviously introduces an overhead, I hope at some point in
|
||||
* the future, HybridHaptikaPPGFrameProcessorSpec_cxx can directly inherit from the C++ class HybridHaptikaPPGFrameProcessorSpec
|
||||
* to simplify the whole structure and memory management.
|
||||
*/
|
||||
class HybridHaptikaPPGFrameProcessorSpecSwift: public virtual HybridHaptikaPPGFrameProcessorSpec {
|
||||
public:
|
||||
// Constructor from a Swift instance
|
||||
explicit HybridHaptikaPPGFrameProcessorSpecSwift(const HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx& swiftPart):
|
||||
HybridObject(HybridHaptikaPPGFrameProcessorSpec::TAG),
|
||||
_swiftPart(swiftPart) { }
|
||||
|
||||
public:
|
||||
// Get the Swift part
|
||||
inline HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx& getSwiftPart() noexcept {
|
||||
return _swiftPart;
|
||||
}
|
||||
|
||||
public:
|
||||
inline size_t getExternalMemorySize() noexcept override {
|
||||
return _swiftPart.getMemorySize();
|
||||
}
|
||||
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
||||
if (auto otherCast = std::dynamic_pointer_cast<HybridHaptikaPPGFrameProcessorSpecSwift>(other)) {
|
||||
return _swiftPart.equals(otherCast->_swiftPart);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void dispose() noexcept override {
|
||||
_swiftPart.dispose();
|
||||
}
|
||||
std::string toString() override {
|
||||
return _swiftPart.toString();
|
||||
}
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
inline void startMeasurement(const NativePPGConfiguration& configuration) override {
|
||||
auto __result = _swiftPart.startMeasurement(std::forward<decltype(configuration)>(configuration));
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline std::optional<PPGFrameUpdate> processFrame(const std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>& frame) override {
|
||||
auto __result = _swiftPart.processFrame(frame);
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline NativePPGProcessingResult finishMeasurement() override {
|
||||
auto __result = _swiftPart.finishMeasurement();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
inline void cancelMeasurement() override {
|
||||
auto __result = _swiftPart.cancelMeasurement();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
}
|
||||
inline ThermalState getThermalState() override {
|
||||
auto __result = _swiftPart.getThermalState();
|
||||
if (__result.hasError()) [[unlikely]] {
|
||||
std::rethrow_exception(__result.error());
|
||||
}
|
||||
auto __value = std::move(__result.value());
|
||||
return __value;
|
||||
}
|
||||
|
||||
private:
|
||||
HaptikaPPG::HybridHaptikaPPGFrameProcessorSpec_cxx _swiftPart;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::haptika::ppg
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
///
|
||||
/// FingerContactState.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `FingerContactState`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias FingerContactState = margelo.nitro.haptika.ppg.FingerContactState
|
||||
|
||||
public extension FingerContactState {
|
||||
/**
|
||||
* Get a FingerContactState for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "absent":
|
||||
self = .absent
|
||||
case "adjusting":
|
||||
self = .adjusting
|
||||
case "valid":
|
||||
self = .valid
|
||||
case "tooMuchPressure":
|
||||
self = .toomuchpressure
|
||||
case "overexposed":
|
||||
self = .overexposed
|
||||
case "unstable":
|
||||
self = .unstable
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this FingerContactState represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .absent:
|
||||
return "absent"
|
||||
case .adjusting:
|
||||
return "adjusting"
|
||||
case .valid:
|
||||
return "valid"
|
||||
case .toomuchpressure:
|
||||
return "tooMuchPressure"
|
||||
case .overexposed:
|
||||
return "overexposed"
|
||||
case .unstable:
|
||||
return "unstable"
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_NativeHealthKitContext.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: NativeHealthKitContext) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_NativeHealthKitContext {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: NativeHealthKitContext) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: NativeHealthKitContext) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: NativeHealthKitContext) -> Void {
|
||||
self.closure(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_NativeHealthKitContext`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_NativeHealthKitContext>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_NativeHealthKitContext {
|
||||
return Unmanaged<Func_void_NativeHealthKitContext>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_bool.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_bool {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: Bool) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: Bool) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: Bool) -> Void {
|
||||
self.closure(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_bool`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
|
||||
return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
Generated
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_std__exception_ptr.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_std__exception_ptr {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ error: Error) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(error: std.exception_ptr) -> Void {
|
||||
self.closure(RuntimeError.from(cppError: error))
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
||||
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Func_void_std__optional_NativeHeartbeatSeriesSummary_.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Wraps a Swift `(_ value: NativeHeartbeatSeriesSummary?) -> Void` as a class.
|
||||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
||||
*/
|
||||
public final class Func_void_std__optional_NativeHeartbeatSeriesSummary_ {
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
private let closure: (_ value: NativeHeartbeatSeriesSummary?) -> Void
|
||||
|
||||
public init(_ closure: @escaping (_ value: NativeHeartbeatSeriesSummary?) -> Void) {
|
||||
self.closure = closure
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public func call(value: bridge.std__optional_NativeHeartbeatSeriesSummary_) -> Void {
|
||||
self.closure(value.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `Func_void_std__optional_NativeHeartbeatSeriesSummary_`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_NativeHeartbeatSeriesSummary_>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
@inline(__always)
|
||||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_NativeHeartbeatSeriesSummary_ {
|
||||
return Unmanaged<Func_void_std__optional_NativeHeartbeatSeriesSummary_>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
///
|
||||
/// HealthMetricType.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `HealthMetricType`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias HealthMetricType = margelo.nitro.haptika.ppg.HealthMetricType
|
||||
|
||||
public extension HealthMetricType {
|
||||
/**
|
||||
* Get a HealthMetricType for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "heartRate":
|
||||
self = .heartrate
|
||||
case "restingHeartRate":
|
||||
self = .restingheartrate
|
||||
case "hrvSdnn":
|
||||
self = .hrvsdnn
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this HealthMetricType represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .heartrate:
|
||||
return "heartRate"
|
||||
case .restingheartrate:
|
||||
return "restingHeartRate"
|
||||
case .hrvsdnn:
|
||||
return "hrvSdnn"
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+64
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaCardiacMirrorSpec``
|
||||
public protocol HybridHaptikaCardiacMirrorSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func isSupported() throws -> Bool
|
||||
func patternInfo() throws -> NativeCardiacMirrorPatternInfo
|
||||
func start(targetBpm: Double) throws -> Void
|
||||
func pulse() throws -> Void
|
||||
func stop() throws -> Void
|
||||
func startWatchSession() throws -> Void
|
||||
func watchReachable() throws -> Bool
|
||||
func latestHeartbeat() throws -> NativeCardiacMirrorHeartbeat?
|
||||
func playRegulationProtocol(kind: String) throws -> Double
|
||||
func stopRegulationProtocol() throws -> Void
|
||||
}
|
||||
|
||||
public extension HybridHaptikaCardiacMirrorSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaCardiacMirror]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaCardiacMirrorSpec``
|
||||
open class HybridHaptikaCardiacMirrorSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaCardiacMirrorSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaCardiacMirrorSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaCardiacMirrorSpec`! Did you accidentally inherit from `HybridHaptikaCardiacMirrorSpec_base` instead of `HybridHaptikaCardiacMirrorSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaCardiacMirrorSpec_cxx(self as! any HybridHaptikaCardiacMirrorSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaCardiacMirror HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaCardiacMirror.
|
||||
* ```swift
|
||||
* class HybridHaptikaCardiacMirror : HybridHaptikaCardiacMirrorSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaCardiacMirrorSpec = HybridHaptikaCardiacMirrorSpec_protocol & HybridHaptikaCardiacMirrorSpec_base
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
///
|
||||
/// HybridHaptikaCardiacMirrorSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaCardiacMirrorSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaCardiacMirrorSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaCardiacMirrorSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaCardiacMirrorSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaCardiacMirrorSpec_cxx` that wraps the given `HybridHaptikaCardiacMirrorSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaCardiacMirrorSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaCardiacMirrorSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaCardiacMirrorSpec() -> any HybridHaptikaCardiacMirrorSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaCardiacMirrorSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaCardiacMirrorSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaCardiacMirrorSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaCardiacMirrorSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaCardiacMirrorSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaCardiacMirrorSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaCardiacMirrorSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaCardiacMirrorSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func isSupported() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.isSupported()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func patternInfo() -> bridge.Result_NativeCardiacMirrorPatternInfo_ {
|
||||
do {
|
||||
let __result = try self.__implementation.patternInfo()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_NativeCardiacMirrorPatternInfo_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_NativeCardiacMirrorPatternInfo_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func start(targetBpm: Double) -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.start(targetBpm: targetBpm)
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func pulse() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.pulse()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func stop() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.stop()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func startWatchSession() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.startWatchSession()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func watchReachable() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.watchReachable()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func latestHeartbeat() -> bridge.Result_std__optional_NativeCardiacMirrorHeartbeat__ {
|
||||
do {
|
||||
let __result = try self.__implementation.latestHeartbeat()
|
||||
let __resultCpp = { () -> bridge.std__optional_NativeCardiacMirrorHeartbeat_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_NativeCardiacMirrorHeartbeat_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()
|
||||
return bridge.create_Result_std__optional_NativeCardiacMirrorHeartbeat__(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__optional_NativeCardiacMirrorHeartbeat__(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func playRegulationProtocol(kind: std.string) -> bridge.Result_double_ {
|
||||
do {
|
||||
let __result = try self.__implementation.playRegulationProtocol(kind: String(kind))
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_double_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_double_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func stopRegulationProtocol() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.stopRegulationProtocol()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+58
@@ -0,0 +1,58 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaHealthKitSpec``
|
||||
public protocol HybridHaptikaHealthKitSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func isAvailable() throws -> Bool
|
||||
func requestReadAuthorization() throws -> Promise<Bool>
|
||||
func fetchContext(lookbackDays: Double) throws -> Promise<NativeHealthKitContext>
|
||||
func fetchLatestHeartbeatSeries() throws -> Promise<NativeHeartbeatSeriesSummary?>
|
||||
}
|
||||
|
||||
public extension HybridHaptikaHealthKitSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaHealthKit]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaHealthKitSpec``
|
||||
open class HybridHaptikaHealthKitSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaHealthKitSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaHealthKitSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaHealthKitSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaHealthKitSpec`! Did you accidentally inherit from `HybridHaptikaHealthKitSpec_base` instead of `HybridHaptikaHealthKitSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaHealthKitSpec_cxx(self as! any HybridHaptikaHealthKitSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaHealthKit HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaHealthKit.
|
||||
* ```swift
|
||||
* class HybridHaptikaHealthKit : HybridHaptikaHealthKitSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaHealthKitSpec = HybridHaptikaHealthKitSpec_protocol & HybridHaptikaHealthKitSpec_base
|
||||
Generated
+201
@@ -0,0 +1,201 @@
|
||||
///
|
||||
/// HybridHaptikaHealthKitSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaHealthKitSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaHealthKitSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaHealthKitSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaHealthKitSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaHealthKitSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaHealthKitSpec_cxx` that wraps the given `HybridHaptikaHealthKitSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaHealthKitSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaHealthKitSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaHealthKitSpec() -> any HybridHaptikaHealthKitSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaHealthKitSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaHealthKitSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaHealthKitSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaHealthKitSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaHealthKitSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaHealthKitSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaHealthKitSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaHealthKitSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaHealthKitSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func isAvailable() -> bridge.Result_bool_ {
|
||||
do {
|
||||
let __result = try self.__implementation.isAvailable()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_bool_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_bool_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func requestReadAuthorization() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
||||
do {
|
||||
let __result = try self.__implementation.requestReadAuthorization()
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve(__result) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func fetchContext(lookbackDays: Double) -> bridge.Result_std__shared_ptr_Promise_NativeHealthKitContext___ {
|
||||
do {
|
||||
let __result = try self.__implementation.fetchContext(lookbackDays: lookbackDays)
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_NativeHealthKitContext__ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_NativeHealthKitContext__()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_NativeHealthKitContext__(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve(__result) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_NativeHealthKitContext___(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func fetchLatestHeartbeatSeries() -> bridge.Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____ {
|
||||
do {
|
||||
let __result = try self.__implementation.fetchLatestHeartbeatSeries()
|
||||
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___ in
|
||||
let __promise = bridge.create_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___()
|
||||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary___(__promise)
|
||||
__result
|
||||
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__optional_NativeHeartbeatSeriesSummary_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_NativeHeartbeatSeriesSummary_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()) })
|
||||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
||||
return __promise
|
||||
}()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__shared_ptr_Promise_std__optional_NativeHeartbeatSeriesSummary____(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import VisionCamera
|
||||
import NitroModules
|
||||
|
||||
/// See ``HybridHaptikaPPGFrameProcessorSpec``
|
||||
public protocol HybridHaptikaPPGFrameProcessorSpec_protocol: HybridObject {
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
func startMeasurement(configuration: NativePPGConfiguration) throws -> Void
|
||||
func processFrame(frame: (any HybridFrameSpec)) throws -> PPGFrameUpdate?
|
||||
func finishMeasurement() throws -> NativePPGProcessingResult
|
||||
func cancelMeasurement() throws -> Void
|
||||
func getThermalState() throws -> ThermalState
|
||||
}
|
||||
|
||||
public extension HybridHaptikaPPGFrameProcessorSpec_protocol {
|
||||
/// Default implementation of ``HybridObject.toString``
|
||||
func toString() -> String {
|
||||
return "[HybridObject HaptikaPPGFrameProcessor]"
|
||||
}
|
||||
}
|
||||
|
||||
/// See ``HybridHaptikaPPGFrameProcessorSpec``
|
||||
open class HybridHaptikaPPGFrameProcessorSpec_base {
|
||||
private weak var cxxWrapper: HybridHaptikaPPGFrameProcessorSpec_cxx? = nil
|
||||
public init() { }
|
||||
public func getCxxWrapper() -> HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
#if DEBUG
|
||||
guard self is any HybridHaptikaPPGFrameProcessorSpec else {
|
||||
fatalError("`self` is not a `HybridHaptikaPPGFrameProcessorSpec`! Did you accidentally inherit from `HybridHaptikaPPGFrameProcessorSpec_base` instead of `HybridHaptikaPPGFrameProcessorSpec`?")
|
||||
}
|
||||
#endif
|
||||
if let cxxWrapper = self.cxxWrapper {
|
||||
return cxxWrapper
|
||||
} else {
|
||||
let cxxWrapper = HybridHaptikaPPGFrameProcessorSpec_cxx(self as! any HybridHaptikaPPGFrameProcessorSpec)
|
||||
self.cxxWrapper = cxxWrapper
|
||||
return cxxWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A Swift base-protocol representing the HaptikaPPGFrameProcessor HybridObject.
|
||||
* Implement this protocol to create Swift-based instances of HaptikaPPGFrameProcessor.
|
||||
* ```swift
|
||||
* class HybridHaptikaPPGFrameProcessor : HybridHaptikaPPGFrameProcessorSpec {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public typealias HybridHaptikaPPGFrameProcessorSpec = HybridHaptikaPPGFrameProcessorSpec_protocol & HybridHaptikaPPGFrameProcessorSpec_base
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
///
|
||||
/// HybridHaptikaPPGFrameProcessorSpec_cxx.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
import VisionCamera
|
||||
|
||||
/**
|
||||
* A class implementation that bridges HybridHaptikaPPGFrameProcessorSpec over to C++.
|
||||
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
||||
*
|
||||
* Also, some Swift types need to be bridged with special handling:
|
||||
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
||||
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
||||
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
||||
*/
|
||||
open class HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
/**
|
||||
* The Swift <> C++ bridge's namespace (`margelo::nitro::haptika::ppg::bridge::swift`)
|
||||
* from `HaptikaPPG-Swift-Cxx-Bridge.hpp`.
|
||||
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
||||
*/
|
||||
public typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Holds an instance of the `HybridHaptikaPPGFrameProcessorSpec` Swift protocol.
|
||||
*/
|
||||
private var __implementation: any HybridHaptikaPPGFrameProcessorSpec
|
||||
|
||||
/**
|
||||
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
||||
*/
|
||||
private var __cxxPart: bridge.std__weak_ptr_HybridHaptikaPPGFrameProcessorSpec_
|
||||
|
||||
/**
|
||||
* Create a new `HybridHaptikaPPGFrameProcessorSpec_cxx` that wraps the given `HybridHaptikaPPGFrameProcessorSpec`.
|
||||
* All properties and methods bridge to C++ types.
|
||||
*/
|
||||
public init(_ implementation: any HybridHaptikaPPGFrameProcessorSpec) {
|
||||
self.__implementation = implementation
|
||||
self.__cxxPart = .init()
|
||||
/* no base class */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual `HybridHaptikaPPGFrameProcessorSpec` instance this class wraps.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func getHybridHaptikaPPGFrameProcessorSpec() -> any HybridHaptikaPPGFrameProcessorSpec {
|
||||
return __implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts this instance to a retained unsafe raw pointer.
|
||||
* This acquires one additional strong reference on the object!
|
||||
*/
|
||||
public func toUnsafe() -> UnsafeMutableRawPointer {
|
||||
return Unmanaged.passRetained(self).toOpaque()
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts an unsafe pointer to a `HybridHaptikaPPGFrameProcessorSpec_cxx`.
|
||||
* The pointer has to be a retained opaque `Unmanaged<HybridHaptikaPPGFrameProcessorSpec_cxx>`.
|
||||
* This removes one strong reference from the object!
|
||||
*/
|
||||
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHaptikaPPGFrameProcessorSpec_cxx {
|
||||
return Unmanaged<HybridHaptikaPPGFrameProcessorSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (or creates) the C++ part of this Hybrid Object.
|
||||
* The C++ part is a `std::shared_ptr<HybridHaptikaPPGFrameProcessorSpec>`.
|
||||
*/
|
||||
public func getCxxPart() -> bridge.std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_ {
|
||||
let cachedCxxPart = self.__cxxPart.lock()
|
||||
if Bool(fromCxx: cachedCxxPart) {
|
||||
return cachedCxxPart
|
||||
} else {
|
||||
let newCxxPart = bridge.create_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(self.toUnsafe())
|
||||
__cxxPart = bridge.weakify_std__shared_ptr_HybridHaptikaPPGFrameProcessorSpec_(newCxxPart)
|
||||
return newCxxPart
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the memory size of the Swift class (plus size of any other allocations)
|
||||
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
||||
*/
|
||||
@inline(__always)
|
||||
public var memorySize: Int {
|
||||
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this object with the given [other] object for reference equality.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func equals(other: HybridHaptikaPPGFrameProcessorSpec_cxx) -> Bool {
|
||||
return self.__implementation === other.__implementation
|
||||
}
|
||||
|
||||
/**
|
||||
* Call dispose() on the Swift class.
|
||||
* This _may_ be called manually from JS.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func dispose() {
|
||||
self.__implementation.dispose()
|
||||
}
|
||||
|
||||
/**
|
||||
* Call toString() on the Swift class.
|
||||
*/
|
||||
@inline(__always)
|
||||
public func toString() -> String {
|
||||
return self.__implementation.toString()
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
@inline(__always)
|
||||
public final func startMeasurement(configuration: NativePPGConfiguration) -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.startMeasurement(configuration: configuration)
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func processFrame(frame: bridge.std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_) -> bridge.Result_std__optional_PPGFrameUpdate__ {
|
||||
do {
|
||||
let __result = try self.__implementation.processFrame(frame: { () -> any HybridFrameSpec in
|
||||
let __unsafePointer = bridge.get_std__shared_ptr_margelo__nitro__camera__HybridFrameSpec_(frame)
|
||||
let __instance = HybridFrameSpec_cxx.fromUnsafe(__unsafePointer)
|
||||
return __instance.getHybridFrameSpec()
|
||||
}())
|
||||
let __resultCpp = { () -> bridge.std__optional_PPGFrameUpdate_ in
|
||||
if let __unwrappedValue = __result {
|
||||
return bridge.create_std__optional_PPGFrameUpdate_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}()
|
||||
return bridge.create_Result_std__optional_PPGFrameUpdate__(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_std__optional_PPGFrameUpdate__(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func finishMeasurement() -> bridge.Result_NativePPGProcessingResult_ {
|
||||
do {
|
||||
let __result = try self.__implementation.finishMeasurement()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_NativePPGProcessingResult_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_NativePPGProcessingResult_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func cancelMeasurement() -> bridge.Result_void_ {
|
||||
do {
|
||||
try self.__implementation.cancelMeasurement()
|
||||
return bridge.create_Result_void_()
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_void_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public final func getThermalState() -> bridge.Result_ThermalState_ {
|
||||
do {
|
||||
let __result = try self.__implementation.getThermalState()
|
||||
let __resultCpp = __result
|
||||
return bridge.create_Result_ThermalState_(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
return bridge.create_Result_ThermalState_(__exceptionPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
///
|
||||
/// NativeAcceptedBeat.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeAcceptedBeat`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeAcceptedBeat = margelo.nitro.haptika.ppg.NativeAcceptedBeat
|
||||
|
||||
public extension NativeAcceptedBeat {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeAcceptedBeat`.
|
||||
*/
|
||||
init(sequence: Double, timestampSeconds: Double, intervalMs: Double, confidence: Double) {
|
||||
self.init(sequence, timestampSeconds, intervalMs, confidence)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sequence: Double {
|
||||
return self.__sequence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var intervalMs: Double {
|
||||
return self.__intervalMs
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var confidence: Double {
|
||||
return self.__confidence
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
///
|
||||
/// NativeBPMEstimate.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeBPMEstimate`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeBPMEstimate = margelo.nitro.haptika.ppg.NativeBPMEstimate
|
||||
|
||||
public extension NativeBPMEstimate {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeBPMEstimate`.
|
||||
*/
|
||||
init(bpm: Double?, temporalBpm: Double?, frequencyBpm: Double?, methodAgreementBpm: Double?, validPeakCount: Double, rejectedPeakCount: Double, confidence: Double, selectedChannel: String) {
|
||||
self.init({ () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = bpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = temporalBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = frequencyBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = methodAgreementBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), validPeakCount, rejectedPeakCount, confidence, std.string(selectedChannel))
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__bpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__bpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var temporalBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__temporalBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__temporalBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var frequencyBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__frequencyBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__frequencyBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var methodAgreementBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__methodAgreementBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__methodAgreementBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var validPeakCount: Double {
|
||||
return self.__validPeakCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedPeakCount: Double {
|
||||
return self.__rejectedPeakCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var confidence: Double {
|
||||
return self.__confidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var selectedChannel: String {
|
||||
return String(self.__selectedChannel)
|
||||
}
|
||||
}
|
||||
Generated
+34
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// NativeCardiacMirrorHeartbeat.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeCardiacMirrorHeartbeat`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeCardiacMirrorHeartbeat = margelo.nitro.haptika.ppg.NativeCardiacMirrorHeartbeat
|
||||
|
||||
public extension NativeCardiacMirrorHeartbeat {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeCardiacMirrorHeartbeat`.
|
||||
*/
|
||||
init(timestampSeconds: Double, bpm: Double) {
|
||||
self.init(timestampSeconds, bpm)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: Double {
|
||||
return self.__bpm
|
||||
}
|
||||
}
|
||||
Generated
+39
@@ -0,0 +1,39 @@
|
||||
///
|
||||
/// NativeCardiacMirrorPatternInfo.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeCardiacMirrorPatternInfo`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeCardiacMirrorPatternInfo = margelo.nitro.haptika.ppg.NativeCardiacMirrorPatternInfo
|
||||
|
||||
public extension NativeCardiacMirrorPatternInfo {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeCardiacMirrorPatternInfo`.
|
||||
*/
|
||||
init(id: String, version: String, latencyBudgetMs: Double) {
|
||||
self.init(std.string(id), std.string(version), latencyBudgetMs)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var id: String {
|
||||
return String(self.__id)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var version: String {
|
||||
return String(self.__version)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latencyBudgetMs: Double {
|
||||
return self.__latencyBudgetMs
|
||||
}
|
||||
}
|
||||
Generated
+77
@@ -0,0 +1,77 @@
|
||||
///
|
||||
/// NativeHealthKitContext.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeHealthKitContext`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHealthKitContext = margelo.nitro.haptika.ppg.NativeHealthKitContext
|
||||
|
||||
public extension NativeHealthKitContext {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHealthKitContext`.
|
||||
*/
|
||||
init(available: Bool, authorized: Bool, latestRestingHeartRate: NativeHealthMetricSample?, latestHrvSdnn: NativeHealthMetricSample?, recentHeartRateSamples: [NativeHealthMetricSample], contextConfidence: Double, fetchedAt: String) {
|
||||
self.init(available, authorized, { () -> bridge.std__optional_NativeHealthMetricSample_ in
|
||||
if let __unwrappedValue = latestRestingHeartRate {
|
||||
return bridge.create_std__optional_NativeHealthMetricSample_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_NativeHealthMetricSample_ in
|
||||
if let __unwrappedValue = latestHrvSdnn {
|
||||
return bridge.create_std__optional_NativeHealthMetricSample_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__vector_NativeHealthMetricSample_ in
|
||||
var __vector = bridge.create_std__vector_NativeHealthMetricSample_(recentHeartRateSamples.count)
|
||||
for __item in recentHeartRateSamples {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), contextConfidence, std.string(fetchedAt))
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var available: Bool {
|
||||
return self.__available
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var authorized: Bool {
|
||||
return self.__authorized
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latestRestingHeartRate: NativeHealthMetricSample? {
|
||||
return self.__latestRestingHeartRate.value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var latestHrvSdnn: NativeHealthMetricSample? {
|
||||
return self.__latestHrvSdnn.value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var recentHeartRateSamples: [NativeHealthMetricSample] {
|
||||
return self.__recentHeartRateSamples.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contextConfidence: Double {
|
||||
return self.__contextConfidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var fetchedAt: String {
|
||||
return String(self.__fetchedAt)
|
||||
}
|
||||
}
|
||||
Generated
+103
@@ -0,0 +1,103 @@
|
||||
///
|
||||
/// NativeHealthMetricSample.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeHealthMetricSample`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHealthMetricSample = margelo.nitro.haptika.ppg.NativeHealthMetricSample
|
||||
|
||||
public extension NativeHealthMetricSample {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHealthMetricSample`.
|
||||
*/
|
||||
init(type: HealthMetricType, value: Double, unit: String, startDate: String, endDate: String, sourceName: String?, sourceBundleIdentifier: String?, deviceName: String?) {
|
||||
self.init(type, value, std.string(unit), std.string(startDate), std.string(endDate), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceBundleIdentifier {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = deviceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var type: HealthMetricType {
|
||||
return self.__type
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var value: Double {
|
||||
return self.__value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var unit: String {
|
||||
return String(self.__unit)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startDate: String {
|
||||
return String(self.__startDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endDate: String {
|
||||
return String(self.__endDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceBundleIdentifier: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceBundleIdentifier) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceBundleIdentifier)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var deviceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__deviceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__deviceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
Generated
+92
@@ -0,0 +1,92 @@
|
||||
///
|
||||
/// NativeHeartbeatSeriesSummary.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeHeartbeatSeriesSummary`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeHeartbeatSeriesSummary = margelo.nitro.haptika.ppg.NativeHeartbeatSeriesSummary
|
||||
|
||||
public extension NativeHeartbeatSeriesSummary {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeHeartbeatSeriesSummary`.
|
||||
*/
|
||||
init(startDate: String, endDate: String, sourceName: String?, sourceBundleIdentifier: String?, heartbeatTimesSinceSeriesStartSeconds: [Double], precededByGapIndexes: [Double]) {
|
||||
self.init(std.string(startDate), std.string(endDate), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceName {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = sourceBundleIdentifier {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__vector_double_ in
|
||||
var __vector = bridge.create_std__vector_double_(heartbeatTimesSinceSeriesStartSeconds.count)
|
||||
for __item in heartbeatTimesSinceSeriesStartSeconds {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), { () -> bridge.std__vector_double_ in
|
||||
var __vector = bridge.create_std__vector_double_(precededByGapIndexes.count)
|
||||
for __item in precededByGapIndexes {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startDate: String {
|
||||
return String(self.__startDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endDate: String {
|
||||
return String(self.__endDate)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceName: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceName) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceName)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sourceBundleIdentifier: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__sourceBundleIdentifier) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__sourceBundleIdentifier)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var heartbeatTimesSinceSeriesStartSeconds: [Double] {
|
||||
return self.__heartbeatTimesSinceSeriesStartSeconds.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var precededByGapIndexes: [Double] {
|
||||
return self.__precededByGapIndexes.map({ __item in __item })
|
||||
}
|
||||
}
|
||||
Generated
+64
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// NativePPGConfiguration.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativePPGConfiguration`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePPGConfiguration = margelo.nitro.haptika.ppg.NativePPGConfiguration
|
||||
|
||||
public extension NativePPGConfiguration {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePPGConfiguration`.
|
||||
*/
|
||||
init(sessionPurpose: PPGSessionPurpose, targetSampleRate: Double, minimumFrequencyHz: Double, maximumFrequencyHz: Double, stabilizationSeconds: Double, measurementSeconds: Double, emitEveryFrames: Double, minimumContactConfidence: Double) {
|
||||
self.init(sessionPurpose, targetSampleRate, minimumFrequencyHz, maximumFrequencyHz, stabilizationSeconds, measurementSeconds, emitEveryFrames, minimumContactConfidence)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var sessionPurpose: PPGSessionPurpose {
|
||||
return self.__sessionPurpose
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var targetSampleRate: Double {
|
||||
return self.__targetSampleRate
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var minimumFrequencyHz: Double {
|
||||
return self.__minimumFrequencyHz
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var maximumFrequencyHz: Double {
|
||||
return self.__maximumFrequencyHz
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var stabilizationSeconds: Double {
|
||||
return self.__stabilizationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var measurementSeconds: Double {
|
||||
return self.__measurementSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var emitEveryFrames: Double {
|
||||
return self.__emitEveryFrames
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var minimumContactConfidence: Double {
|
||||
return self.__minimumContactConfidence
|
||||
}
|
||||
}
|
||||
Generated
+82
@@ -0,0 +1,82 @@
|
||||
///
|
||||
/// NativePPGProcessingResult.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativePPGProcessingResult`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePPGProcessingResult = margelo.nitro.haptika.ppg.NativePPGProcessingResult
|
||||
|
||||
public extension NativePPGProcessingResult {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePPGProcessingResult`.
|
||||
*/
|
||||
init(valid: Bool, invalidReason: String?, bpm: NativeBPMEstimate, prv: NativePRVMetrics, quality: NativeSignalQualityResult, startedAtMonotonicSeconds: Double, endedAtMonotonicSeconds: Double, rawSampleCount: Double, resampledSampleCount: Double) {
|
||||
self.init(valid, { () -> bridge.std__optional_std__string_ in
|
||||
if let __unwrappedValue = invalidReason {
|
||||
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), bpm, prv, quality, startedAtMonotonicSeconds, endedAtMonotonicSeconds, rawSampleCount, resampledSampleCount)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var valid: Bool {
|
||||
return self.__valid
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var invalidReason: String? {
|
||||
return { () -> String? in
|
||||
if bridge.has_value_std__optional_std__string_(self.__invalidReason) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__invalidReason)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var bpm: NativeBPMEstimate {
|
||||
return self.__bpm
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var prv: NativePRVMetrics {
|
||||
return self.__prv
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var quality: NativeSignalQualityResult {
|
||||
return self.__quality
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var startedAtMonotonicSeconds: Double {
|
||||
return self.__startedAtMonotonicSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var endedAtMonotonicSeconds: Double {
|
||||
return self.__endedAtMonotonicSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rawSampleCount: Double {
|
||||
return self.__rawSampleCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var resampledSampleCount: Double {
|
||||
return self.__resampledSampleCount
|
||||
}
|
||||
}
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
///
|
||||
/// NativePRVMetrics.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativePRVMetrics`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativePRVMetrics = margelo.nitro.haptika.ppg.NativePRVMetrics
|
||||
|
||||
public extension NativePRVMetrics {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativePRVMetrics`.
|
||||
*/
|
||||
init(estimatedRmssdMs: Double?, estimatedSdnnMs: Double?, meanIpiMs: Double?, medianIpiMs: Double?, pnn50Percent: Double?, rangeIpiMs: Double?, modeIpiMs: Double?, amo50Percent: Double?, coefficientOfVariation: Double?, validIntervalCount: Double, rejectedIntervalCount: Double, rejectedIntervalRatio: Double, reliable: Bool) {
|
||||
self.init({ () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = estimatedRmssdMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = estimatedSdnnMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = meanIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = medianIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = pnn50Percent {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = rangeIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = modeIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = amo50Percent {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = coefficientOfVariation {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), validIntervalCount, rejectedIntervalCount, rejectedIntervalRatio, reliable)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var estimatedRmssdMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__estimatedRmssdMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__estimatedRmssdMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var estimatedSdnnMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__estimatedSdnnMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__estimatedSdnnMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var meanIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__meanIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__meanIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var medianIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__medianIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__medianIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var pnn50Percent: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__pnn50Percent) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__pnn50Percent)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rangeIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__rangeIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__rangeIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var modeIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__modeIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__modeIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var amo50Percent: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__amo50Percent) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__amo50Percent)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var coefficientOfVariation: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__coefficientOfVariation) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__coefficientOfVariation)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var validIntervalCount: Double {
|
||||
return self.__validIntervalCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalCount: Double {
|
||||
return self.__rejectedIntervalCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalRatio: Double {
|
||||
return self.__rejectedIntervalRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var reliable: Bool {
|
||||
return self.__reliable
|
||||
}
|
||||
}
|
||||
Generated
+103
@@ -0,0 +1,103 @@
|
||||
///
|
||||
/// NativeSignalQualityResult.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `NativeSignalQualityResult`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias NativeSignalQualityResult = margelo.nitro.haptika.ppg.NativeSignalQualityResult
|
||||
|
||||
public extension NativeSignalQualityResult {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `NativeSignalQualityResult`.
|
||||
*/
|
||||
init(score: Double, level: String, usableDurationSeconds: Double, droppedFrameRatio: Double, saturationRatio: Double, rejectedIntervalRatio: Double, signalToNoiseRatio: Double?, motionArtifactRatio: Double, methodAgreementScore: Double, timestampJitterRatio: Double, longestGapSeconds: Double, issues: [String]) {
|
||||
self.init(score, std.string(level), usableDurationSeconds, droppedFrameRatio, saturationRatio, rejectedIntervalRatio, { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = signalToNoiseRatio {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), motionArtifactRatio, methodAgreementScore, timestampJitterRatio, longestGapSeconds, { () -> bridge.std__vector_std__string_ in
|
||||
var __vector = bridge.create_std__vector_std__string_(issues.count)
|
||||
for __item in issues {
|
||||
__vector.push_back(std.string(__item))
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var score: Double {
|
||||
return self.__score
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var level: String {
|
||||
return String(self.__level)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var usableDurationSeconds: Double {
|
||||
return self.__usableDurationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var droppedFrameRatio: Double {
|
||||
return self.__droppedFrameRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var saturationRatio: Double {
|
||||
return self.__saturationRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var rejectedIntervalRatio: Double {
|
||||
return self.__rejectedIntervalRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var signalToNoiseRatio: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__signalToNoiseRatio) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__signalToNoiseRatio)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var motionArtifactRatio: Double {
|
||||
return self.__motionArtifactRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var methodAgreementScore: Double {
|
||||
return self.__methodAgreementScore
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampJitterRatio: Double {
|
||||
return self.__timestampJitterRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var longestGapSeconds: Double {
|
||||
return self.__longestGapSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var issues: [String] {
|
||||
return self.__issues.map({ __item in String(__item) })
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
///
|
||||
/// PPGFrameUpdate.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
import NitroModules
|
||||
|
||||
/**
|
||||
* Represents an instance of `PPGFrameUpdate`, backed by a C++ struct.
|
||||
*/
|
||||
public typealias PPGFrameUpdate = margelo.nitro.haptika.ppg.PPGFrameUpdate
|
||||
|
||||
public extension PPGFrameUpdate {
|
||||
private typealias bridge = margelo.nitro.haptika.ppg.bridge.swift
|
||||
|
||||
/**
|
||||
* Create a new instance of `PPGFrameUpdate`.
|
||||
*/
|
||||
init(timestampSeconds: Double, contactState: FingerContactState, contactConfidence: Double, signalLevel: Double, saturationRatio: Double, motionArtifactScore: Double, collectedSampleCount: Double, usableDurationSeconds: Double, droppedFrameCount: Double, thermalState: ThermalState, waveformValue: Double, liveBpm: Double?, liveIpiMs: Double?, beatSequence: Double, acceptedBeats: [NativeAcceptedBeat], liveWindowQuality: Double?) {
|
||||
self.init(timestampSeconds, contactState, contactConfidence, signalLevel, saturationRatio, motionArtifactScore, collectedSampleCount, usableDurationSeconds, droppedFrameCount, thermalState, waveformValue, { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveBpm {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveIpiMs {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}(), beatSequence, { () -> bridge.std__vector_NativeAcceptedBeat_ in
|
||||
var __vector = bridge.create_std__vector_NativeAcceptedBeat_(acceptedBeats.count)
|
||||
for __item in acceptedBeats {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}(), { () -> bridge.std__optional_double_ in
|
||||
if let __unwrappedValue = liveWindowQuality {
|
||||
return bridge.create_std__optional_double_(__unwrappedValue)
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
}())
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var timestampSeconds: Double {
|
||||
return self.__timestampSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contactState: FingerContactState {
|
||||
return self.__contactState
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var contactConfidence: Double {
|
||||
return self.__contactConfidence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var signalLevel: Double {
|
||||
return self.__signalLevel
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var saturationRatio: Double {
|
||||
return self.__saturationRatio
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var motionArtifactScore: Double {
|
||||
return self.__motionArtifactScore
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var collectedSampleCount: Double {
|
||||
return self.__collectedSampleCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var usableDurationSeconds: Double {
|
||||
return self.__usableDurationSeconds
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var droppedFrameCount: Double {
|
||||
return self.__droppedFrameCount
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var thermalState: ThermalState {
|
||||
return self.__thermalState
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var waveformValue: Double {
|
||||
return self.__waveformValue
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveBpm: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveBpm) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveBpm)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveIpiMs: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveIpiMs) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveIpiMs)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var beatSequence: Double {
|
||||
return self.__beatSequence
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var acceptedBeats: [NativeAcceptedBeat] {
|
||||
return self.__acceptedBeats.map({ __item in __item })
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
var liveWindowQuality: Double? {
|
||||
return { () -> Double? in
|
||||
if bridge.has_value_std__optional_double_(self.__liveWindowQuality) {
|
||||
let __unwrapped = bridge.get_std__optional_double_(self.__liveWindowQuality)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// PPGSessionPurpose.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `PPGSessionPurpose`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias PPGSessionPurpose = margelo.nitro.haptika.ppg.PPGSessionPurpose
|
||||
|
||||
public extension PPGSessionPurpose {
|
||||
/**
|
||||
* Get a PPGSessionPurpose for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "spotMeasurement":
|
||||
self = .spotmeasurement
|
||||
case "coherence":
|
||||
self = .coherence
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this PPGSessionPurpose represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .spotmeasurement:
|
||||
return "spotMeasurement"
|
||||
case .coherence:
|
||||
return "coherence"
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
///
|
||||
/// ThermalState.swift
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
/**
|
||||
* Represents the JS union `ThermalState`, backed by a C++ enum.
|
||||
*/
|
||||
public typealias ThermalState = margelo.nitro.haptika.ppg.ThermalState
|
||||
|
||||
public extension ThermalState {
|
||||
/**
|
||||
* Get a ThermalState for the given String value, or
|
||||
* return `nil` if the given value was invalid/unknown.
|
||||
*/
|
||||
init?(fromString string: String) {
|
||||
switch string {
|
||||
case "nominal":
|
||||
self = .nominal
|
||||
case "fair":
|
||||
self = .fair
|
||||
case "serious":
|
||||
self = .serious
|
||||
case "critical":
|
||||
self = .critical
|
||||
case "unknown":
|
||||
self = .unknown
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value this ThermalState represents.
|
||||
*/
|
||||
var stringValue: String {
|
||||
switch self {
|
||||
case .nominal:
|
||||
return "nominal"
|
||||
case .fair:
|
||||
return "fair"
|
||||
case .serious:
|
||||
return "serious"
|
||||
case .critical:
|
||||
return "critical"
|
||||
case .unknown:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
+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