objc2-health-kit 0.3.2

Bindings to the HealthKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// The medically-defined leads supported by HKElectrocardiogram
///
/// the ECG app, enables the generation and analysis of an ECG  similar to a Lead I ECG.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramlead?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKElectrocardiogramLead(pub NSInteger);
impl HKElectrocardiogramLead {
    #[doc(alias = "HKElectrocardiogramLeadAppleWatchSimilarToLeadI")]
    pub const AppleWatchSimilarToLeadI: Self = Self(1);
}

unsafe impl Encode for HKElectrocardiogramLead {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for HKElectrocardiogramLead {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// The possible classifications determined for HKElectrocardiograms
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramclassification?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKElectrocardiogramClassification(pub NSInteger);
impl HKElectrocardiogramClassification {
    #[doc(alias = "HKElectrocardiogramClassificationNotSet")]
    pub const NotSet: Self = Self(0);
    #[doc(alias = "HKElectrocardiogramClassificationSinusRhythm")]
    pub const SinusRhythm: Self = Self(1);
    #[doc(alias = "HKElectrocardiogramClassificationAtrialFibrillation")]
    pub const AtrialFibrillation: Self = Self(2);
    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveLowHeartRate")]
    pub const InconclusiveLowHeartRate: Self = Self(3);
    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveHighHeartRate")]
    pub const InconclusiveHighHeartRate: Self = Self(4);
    #[doc(alias = "HKElectrocardiogramClassificationInconclusivePoorReading")]
    pub const InconclusivePoorReading: Self = Self(5);
    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveOther")]
    pub const InconclusiveOther: Self = Self(6);
    #[doc(alias = "HKElectrocardiogramClassificationUnrecognized")]
    pub const Unrecognized: Self = Self(100);
}

unsafe impl Encode for HKElectrocardiogramClassification {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for HKElectrocardiogramClassification {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// An indication of whether the user experienced symptoms when taking an ECG
///
/// HKElectrocardiogramSymptomsStatusNone          The user did not experience any symptoms during the duration of the electrocardiogram reading.
/// HKElectrocardiogramSymptomsStatusPresent       The user indicated that they experienced symptoms during the duration of the electrocardiogram reading.
///
/// If an HKElectrocardiogram indicates that there are symptoms present, you must do a separate sample query to
/// retrieve those symptoms.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramsymptomsstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKElectrocardiogramSymptomsStatus(pub NSInteger);
impl HKElectrocardiogramSymptomsStatus {
    #[doc(alias = "HKElectrocardiogramSymptomsStatusNotSet")]
    pub const NotSet: Self = Self(0);
    #[doc(alias = "HKElectrocardiogramSymptomsStatusNone")]
    pub const None: Self = Self(1);
    #[doc(alias = "HKElectrocardiogramSymptomsStatusPresent")]
    pub const Present: Self = Self(2);
}

unsafe impl Encode for HKElectrocardiogramSymptomsStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for HKElectrocardiogramSymptomsStatus {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// An HKElectrocardiogram is a collection of voltage values as waveforms
    /// from one or more leads
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogram?language=objc)
    #[unsafe(super(HKSample, HKObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
    pub struct HKElectrocardiogram;
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
unsafe impl Send for HKElectrocardiogram {}

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
unsafe impl Sync for HKElectrocardiogram {}

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSCoding for HKElectrocardiogram {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HKElectrocardiogram {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSSecureCoding for HKElectrocardiogram {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKElectrocardiogram {
    extern_methods!(
        /// The number of voltage measurements in the electrocardiogram.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(numberOfVoltageMeasurements))]
        #[unsafe(method_family = none)]
        pub unsafe fn numberOfVoltageMeasurements(&self) -> NSInteger;

        #[cfg(feature = "HKQuantity")]
        /// The frequency at which the data was sampled. This is reported in [HKUnit hertzUnit].
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(samplingFrequency))]
        #[unsafe(method_family = none)]
        pub unsafe fn samplingFrequency(&self) -> Option<Retained<HKQuantity>>;

        /// The classification of this electrocardiogram sample.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(classification))]
        #[unsafe(method_family = none)]
        pub unsafe fn classification(&self) -> HKElectrocardiogramClassification;

        #[cfg(feature = "HKQuantity")]
        /// The average heart rate of the user while the electrocardiogram was recorded.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(averageHeartRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn averageHeartRate(&self) -> Option<Retained<HKQuantity>>;

        /// Whether the user experienced symptoms during this electrocardiogram.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(symptomsStatus))]
        #[unsafe(method_family = none)]
        pub unsafe fn symptomsStatus(&self) -> HKElectrocardiogramSymptomsStatus;
    );
}

/// Methods declared on superclass `HKObject`.
#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKElectrocardiogram {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKElectrocardiogram {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathaverageheartrate?language=objc)
    pub static HKPredicateKeyPathAverageHeartRate: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathecgclassification?language=objc)
    pub static HKPredicateKeyPathECGClassification: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathecgsymptomsstatus?language=objc)
    pub static HKPredicateKeyPathECGSymptomsStatus: &'static NSString;
}