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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// An HKElectrocardiogramVoltageMeasurement contains voltage quantities for all leads at a single instance of measurement.
    ///
    /// Each HKElectrocardiogramVoltageMeasurement object corresponds to the voltage quantities across all leads for a given instance in time.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramvoltagemeasurement?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct HKElectrocardiogramVoltageMeasurement;
);

unsafe impl Send for HKElectrocardiogramVoltageMeasurement {}

unsafe impl Sync for HKElectrocardiogramVoltageMeasurement {}

extern_conformance!(
    unsafe impl NSCopying for HKElectrocardiogramVoltageMeasurement {}
);

unsafe impl CopyingHelper for HKElectrocardiogramVoltageMeasurement {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for HKElectrocardiogramVoltageMeasurement {}
);

impl HKElectrocardiogramVoltageMeasurement {
    extern_methods!(
        /// The time interval between this voltage measurement and the start of the sample.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(timeSinceSampleStart))]
        #[unsafe(method_family = none)]
        pub unsafe fn timeSinceSampleStart(&self) -> NSTimeInterval;

        #[cfg(all(feature = "HKElectrocardiogram", feature = "HKQuantity"))]
        /// Returns an HKQuantity for the specified lead with a unit compatible with [HKUnit voltUnit].
        ///
        /// Parameter `lead`: The HKElectrocardiogramLead for which voltage quantity will be returned.
        #[unsafe(method(quantityForLead:))]
        #[unsafe(method_family = none)]
        pub unsafe fn quantityForLead(
            &self,
            lead: HKElectrocardiogramLead,
        ) -> Option<Retained<HKQuantity>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl HKElectrocardiogramVoltageMeasurement {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramquery?language=objc)
    #[unsafe(super(HKQuery, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HKQuery")]
    pub struct HKElectrocardiogramQuery;
);

#[cfg(feature = "HKQuery")]
unsafe impl Send for HKElectrocardiogramQuery {}

#[cfg(feature = "HKQuery")]
unsafe impl Sync for HKElectrocardiogramQuery {}

#[cfg(feature = "HKQuery")]
extern_conformance!(
    unsafe impl NSObjectProtocol for HKElectrocardiogramQuery {}
);

#[cfg(feature = "HKQuery")]
impl HKElectrocardiogramQuery {
    extern_methods!(
        #[cfg(all(
            feature = "HKElectrocardiogram",
            feature = "HKObject",
            feature = "HKSample",
            feature = "block2"
        ))]
        /// Returns a query that will enumerate over voltages recorded across leads in
        /// an electrocardiogram.
        ///
        ///
        /// Parameter `electrocardiogram`: The sample for which the lead data will be returned.
        ///
        /// Parameter `dataHandler`: The block to invoke with results from the query. It will be called once for each voltage measurement. Call [query stop] to stop enumeration, if desired.
        #[unsafe(method(initWithElectrocardiogram:dataHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithElectrocardiogram_dataHandler(
            this: Allocated<Self>,
            electrocardiogram: &HKElectrocardiogram,
            data_handler: &block2::DynBlock<
                dyn Fn(
                    NonNull<HKElectrocardiogramQuery>,
                    *mut HKElectrocardiogramVoltageMeasurement,
                    Bool,
                    *mut NSError,
                ),
            >,
        ) -> Retained<Self>;
    );
}

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

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