1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//! 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 HKHeartbeatSeriesBuilder is used to generate an HKHeartbeatSeriesSample.
///
/// This class is intended for generating an HKHeartbeatSeriesSample which represents a series of
/// heartbeats. If the discard method is called, collected data will be deleted.
/// Calling finishSeriesWithcompletion: will stop and complete the series. If the builder is deleted,
/// or the client goes away before calling the finish method, data will be lost.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkheartbeatseriesbuilder?language=objc)
#[unsafe(super(HKSeriesBuilder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HKSeriesBuilder")]
pub struct HKHeartbeatSeriesBuilder;
);
#[cfg(feature = "HKSeriesBuilder")]
unsafe impl Send for HKHeartbeatSeriesBuilder {}
#[cfg(feature = "HKSeriesBuilder")]
unsafe impl Sync for HKHeartbeatSeriesBuilder {}
#[cfg(feature = "HKSeriesBuilder")]
extern_conformance!(
unsafe impl NSObjectProtocol for HKHeartbeatSeriesBuilder {}
);
#[cfg(feature = "HKSeriesBuilder")]
impl HKHeartbeatSeriesBuilder {
extern_methods!(
/// The maximum number of heartbeats that can be added to an HKHeartbeatSeriesBuilder.
///
/// Any calls to addHeartbeatWithTimeIntervalSinceSeriesStartDate:precededByGap:completion: once
/// maximumCount has been reached will fail and an error will be returned in the completion handler.
#[unsafe(method(maximumCount))]
#[unsafe(method_family = none)]
pub unsafe fn maximumCount() -> NSUInteger;
#[cfg(all(feature = "HKDevice", feature = "HKHealthStore"))]
/// The designated initializer to create an HKHeartbeatSeriesBuilder.
///
/// The HKHealthStore is retained during the life of the object for the saving of the series data and final
/// return of the series sample.
///
///
/// Parameter `healthStore`: Specifies the HKHealthStore object to use for building the series.
///
/// Parameter `device`: The optional device represents the HKDevice from which the data is provided.
///
/// Parameter `startDate`: The start date of the HKHeartbeatSeriesSample that will be generated.
#[unsafe(method(initWithHealthStore:device:startDate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithHealthStore_device_startDate(
this: Allocated<Self>,
health_store: &HKHealthStore,
device: Option<&HKDevice>,
start_date: &NSDate,
) -> Retained<Self>;
#[cfg(feature = "block2")]
/// Associate a heartbeat with the receiver.
///
/// Use this method to asynchronously add a heartbeat to the series.
///
///
/// Parameter `timeIntervalSinceStart`: The elapsed time between the series startDate and the heartbeat occurence. Must be
/// a positive value.
///
/// Parameter `precededByGap`: Whether or not this heartbeat was preceded by a gap in data collection.
///
/// Parameter `completion`: The completion callback handler returns the status of the save. If the completion
/// handler success is NO, then error is non-nil. An error here is considered fatal and
/// the series builder will be complete.
#[unsafe(method(addHeartbeatWithTimeIntervalSinceSeriesStartDate:precededByGap:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn addHeartbeatWithTimeIntervalSinceSeriesStartDate_precededByGap_completion(
&self,
time_interval_since_start: NSTimeInterval,
preceded_by_gap: bool,
completion: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
);
#[cfg(feature = "block2")]
/// Adds new metadata to the builder instance. This method can be called more than once; each time
/// the newly provided metadata will be incorporated in the same manner as
/// -[NSMutableDictionary addEntriesFromDictionary:].
/// This operation is performed asynchronously and the completion will be executed on an arbitrary
/// background queue.
///
///
/// Parameter `metadata`: The metadata to add to the builder.
///
/// Parameter `completion`: Block to be called when the addition of metadata to the builder is complete.
/// If success is YES, the metadata has been added to the builder successfully. If success
/// is NO, error will be non-null and will contain the error encountered during the
/// insertion operation. When an error occurs, the builder's metadata will remain unchanged.
///
/// # Safety
///
/// `metadata` generic should be of the correct type.
#[unsafe(method(addMetadata:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn addMetadata_completion(
&self,
metadata: &NSDictionary<NSString, AnyObject>,
completion: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
);
#[cfg(all(
feature = "HKHeartbeatSeriesSample",
feature = "HKObject",
feature = "HKSample",
feature = "HKSeriesSample",
feature = "block2"
))]
/// Method to stop data collection and return the associated HKHeartbeatSeriesSample.
///
/// Call this method when you have added all heartbeats to this builder. The completion handler will
/// return the saved HKHeartbeatSeriesSample. If no heartbeat was added, then heartbeatSeries will be
/// nil and an error returned. The receiver will be considered invalid afterwards and any further calls
/// to it will result in an error.
///
///
/// Parameter `completion`: The completion callback handler returns the saved HKHeartbeatSeriesSample object. If
/// heartbeatSeries is nil, an error will indicate why the series could not be returned
/// including database inaccessibility during device lock. Subsequent requests for the
/// HKHeartbeatSeriesSample can be made through HKSampleQuery or similar queries. To
/// retrieve the data stored with an HKHeartbeatSeriesSample use HKHeartbeatSeriesQuery.
#[unsafe(method(finishSeriesWithCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn finishSeriesWithCompletion(
&self,
completion: &block2::DynBlock<dyn Fn(*mut HKHeartbeatSeriesSample, *mut NSError)>,
);
);
}
/// Methods declared on superclass `HKSeriesBuilder`.
#[cfg(feature = "HKSeriesBuilder")]
impl HKHeartbeatSeriesBuilder {
extern_methods!(
/// Use only subclass initializer methods.
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "HKSeriesBuilder")]
impl HKHeartbeatSeriesBuilder {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}