feat: implement Haptika PPG and Watch V1

This commit is contained in:
Sacha
2026-07-31 16:19:42 +02:00
parent 6b7d4e0728
commit b9930b7378
249 changed files with 46475 additions and 122 deletions
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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