feat: implement Haptika PPG and Watch V1
This commit is contained in:
+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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user