objc2_health_kit/generated/
HKElectrocardiogram.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// The medically-defined leads supported by HKElectrocardiogram
10///
11/// the ECG app, enables the generation and analysis of an ECG  similar to a Lead I ECG.
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramlead?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct HKElectrocardiogramLead(pub NSInteger);
18impl HKElectrocardiogramLead {
19    #[doc(alias = "HKElectrocardiogramLeadAppleWatchSimilarToLeadI")]
20    pub const AppleWatchSimilarToLeadI: Self = Self(1);
21}
22
23unsafe impl Encode for HKElectrocardiogramLead {
24    const ENCODING: Encoding = NSInteger::ENCODING;
25}
26
27unsafe impl RefEncode for HKElectrocardiogramLead {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// The possible classifications determined for HKElectrocardiograms
32///
33/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramclassification?language=objc)
34// NS_ENUM
35#[repr(transparent)]
36#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
37pub struct HKElectrocardiogramClassification(pub NSInteger);
38impl HKElectrocardiogramClassification {
39    #[doc(alias = "HKElectrocardiogramClassificationNotSet")]
40    pub const NotSet: Self = Self(0);
41    #[doc(alias = "HKElectrocardiogramClassificationSinusRhythm")]
42    pub const SinusRhythm: Self = Self(1);
43    #[doc(alias = "HKElectrocardiogramClassificationAtrialFibrillation")]
44    pub const AtrialFibrillation: Self = Self(2);
45    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveLowHeartRate")]
46    pub const InconclusiveLowHeartRate: Self = Self(3);
47    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveHighHeartRate")]
48    pub const InconclusiveHighHeartRate: Self = Self(4);
49    #[doc(alias = "HKElectrocardiogramClassificationInconclusivePoorReading")]
50    pub const InconclusivePoorReading: Self = Self(5);
51    #[doc(alias = "HKElectrocardiogramClassificationInconclusiveOther")]
52    pub const InconclusiveOther: Self = Self(6);
53    #[doc(alias = "HKElectrocardiogramClassificationUnrecognized")]
54    pub const Unrecognized: Self = Self(100);
55}
56
57unsafe impl Encode for HKElectrocardiogramClassification {
58    const ENCODING: Encoding = NSInteger::ENCODING;
59}
60
61unsafe impl RefEncode for HKElectrocardiogramClassification {
62    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
63}
64
65/// An indication of whether the user experienced symptoms when taking an ECG
66///
67/// HKElectrocardiogramSymptomsStatusNone          The user did not experience any symptoms during the duration of the electrocardiogram reading.
68/// HKElectrocardiogramSymptomsStatusPresent       The user indicated that they experienced symptoms during the duration of the electrocardiogram reading.
69///
70/// If an HKElectrocardiogram indicates that there are symptoms present, you must do a separate sample query to
71/// retrieve those symptoms.
72///
73/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogramsymptomsstatus?language=objc)
74// NS_ENUM
75#[repr(transparent)]
76#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
77pub struct HKElectrocardiogramSymptomsStatus(pub NSInteger);
78impl HKElectrocardiogramSymptomsStatus {
79    #[doc(alias = "HKElectrocardiogramSymptomsStatusNotSet")]
80    pub const NotSet: Self = Self(0);
81    #[doc(alias = "HKElectrocardiogramSymptomsStatusNone")]
82    pub const None: Self = Self(1);
83    #[doc(alias = "HKElectrocardiogramSymptomsStatusPresent")]
84    pub const Present: Self = Self(2);
85}
86
87unsafe impl Encode for HKElectrocardiogramSymptomsStatus {
88    const ENCODING: Encoding = NSInteger::ENCODING;
89}
90
91unsafe impl RefEncode for HKElectrocardiogramSymptomsStatus {
92    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95extern_class!(
96    /// An HKElectrocardiogram is a collection of voltage values as waveforms
97    /// from one or more leads
98    ///
99    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkelectrocardiogram?language=objc)
100    #[unsafe(super(HKSample, HKObject, NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
103    pub struct HKElectrocardiogram;
104);
105
106#[cfg(all(feature = "HKObject", feature = "HKSample"))]
107unsafe impl Send for HKElectrocardiogram {}
108
109#[cfg(all(feature = "HKObject", feature = "HKSample"))]
110unsafe impl Sync for HKElectrocardiogram {}
111
112#[cfg(all(feature = "HKObject", feature = "HKSample"))]
113extern_conformance!(
114    unsafe impl NSCoding for HKElectrocardiogram {}
115);
116
117#[cfg(all(feature = "HKObject", feature = "HKSample"))]
118extern_conformance!(
119    unsafe impl NSObjectProtocol for HKElectrocardiogram {}
120);
121
122#[cfg(all(feature = "HKObject", feature = "HKSample"))]
123extern_conformance!(
124    unsafe impl NSSecureCoding for HKElectrocardiogram {}
125);
126
127#[cfg(all(feature = "HKObject", feature = "HKSample"))]
128impl HKElectrocardiogram {
129    extern_methods!(
130        /// The number of voltage measurements in the electrocardiogram.
131        ///
132        /// This property is not atomic.
133        ///
134        /// # Safety
135        ///
136        /// This might not be thread-safe.
137        #[unsafe(method(numberOfVoltageMeasurements))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn numberOfVoltageMeasurements(&self) -> NSInteger;
140
141        #[cfg(feature = "HKQuantity")]
142        /// The frequency at which the data was sampled. This is reported in [HKUnit hertzUnit].
143        ///
144        /// This property is not atomic.
145        ///
146        /// # Safety
147        ///
148        /// This might not be thread-safe.
149        #[unsafe(method(samplingFrequency))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn samplingFrequency(&self) -> Option<Retained<HKQuantity>>;
152
153        /// The classification of this electrocardiogram sample.
154        ///
155        /// This property is not atomic.
156        ///
157        /// # Safety
158        ///
159        /// This might not be thread-safe.
160        #[unsafe(method(classification))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn classification(&self) -> HKElectrocardiogramClassification;
163
164        #[cfg(feature = "HKQuantity")]
165        /// The average heart rate of the user while the electrocardiogram was recorded.
166        ///
167        /// This property is not atomic.
168        ///
169        /// # Safety
170        ///
171        /// This might not be thread-safe.
172        #[unsafe(method(averageHeartRate))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn averageHeartRate(&self) -> Option<Retained<HKQuantity>>;
175
176        /// Whether the user experienced symptoms during this electrocardiogram.
177        ///
178        /// This property is not atomic.
179        ///
180        /// # Safety
181        ///
182        /// This might not be thread-safe.
183        #[unsafe(method(symptomsStatus))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn symptomsStatus(&self) -> HKElectrocardiogramSymptomsStatus;
186    );
187}
188
189/// Methods declared on superclass `HKObject`.
190#[cfg(all(feature = "HKObject", feature = "HKSample"))]
191impl HKElectrocardiogram {
192    extern_methods!(
193        #[unsafe(method(init))]
194        #[unsafe(method_family = init)]
195        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
196    );
197}
198
199/// Methods declared on superclass `NSObject`.
200#[cfg(all(feature = "HKObject", feature = "HKSample"))]
201impl HKElectrocardiogram {
202    extern_methods!(
203        #[unsafe(method(new))]
204        #[unsafe(method_family = new)]
205        pub unsafe fn new() -> Retained<Self>;
206    );
207}
208
209extern "C" {
210    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathaverageheartrate?language=objc)
211    pub static HKPredicateKeyPathAverageHeartRate: &'static NSString;
212}
213
214extern "C" {
215    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathecgclassification?language=objc)
216    pub static HKPredicateKeyPathECGClassification: &'static NSString;
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathecgsymptomsstatus?language=objc)
221    pub static HKPredicateKeyPathECGSymptomsStatus: &'static NSString;
222}