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