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
166
167
168
169
//! 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::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// An HKWorkoutRouteBuilder is used to generate an HKWorkoutRoute.
///
/// This class is intended for generating long-running location data collection such as
/// might be associated with a workout. If the discard method is called, collected data will be deleted.
/// Calling finishRouteWithWorkout:metadata: will stop and complete the route. 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/hkworkoutroutebuilder?language=objc)
#[unsafe(super(HKSeriesBuilder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HKSeriesBuilder")]
pub struct HKWorkoutRouteBuilder;
);
#[cfg(feature = "HKSeriesBuilder")]
unsafe impl Send for HKWorkoutRouteBuilder {}
#[cfg(feature = "HKSeriesBuilder")]
unsafe impl Sync for HKWorkoutRouteBuilder {}
#[cfg(feature = "HKSeriesBuilder")]
extern_conformance!(
unsafe impl NSObjectProtocol for HKWorkoutRouteBuilder {}
);
#[cfg(feature = "HKSeriesBuilder")]
impl HKWorkoutRouteBuilder {
extern_methods!(
#[cfg(all(feature = "HKDevice", feature = "HKHealthStore"))]
/// The designated initializer to create an HKWorkoutRouteBuilder. If you are using an HKWorkoutBuilder , you
/// should not create an HKWorkoutRouteBuilder, instead use -[HKWorkoutBuilder seriesBuilderForType:]
///
/// 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.
#[unsafe(method(initWithHealthStore:device:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithHealthStore_device(
this: Allocated<Self>,
health_store: &HKHealthStore,
device: Option<&HKDevice>,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-core-location"))]
/// Associate CLLocation with the receiver.
///
/// Use this method to asynchronously add one or more CLLocation to the
/// series. Note that CLLocation may be inserted in any order but will be
/// sorted according to date when the series is finalized.
///
///
/// Parameter `routeData`: An array of one or more CLLocation.
///
/// 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.
/// If data was previously saved, then the HKWorkoutRoute may be retrieved by the
/// finishRouteWithMetadata: method.
#[unsafe(method(insertRouteData:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn insertRouteData_completion(
&self,
route_data: &NSArray<CLLocation>,
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 = "HKObject",
feature = "HKSample",
feature = "HKSeriesSample",
feature = "HKWorkout",
feature = "HKWorkoutRoute",
feature = "block2"
))]
/// Method to stop data collection and return the associated HKWorkoutRoute. If you are using this route
/// builder with a workout builder, you should never call this method. The route will be finished when you
/// finish the workout builder.
///
/// Call this method when the route has been completed. The completion handler will return the saved
/// HKWorkoutRoute. If no series data was added, then workoutRoute 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 `workout`: The HKWorkout object to which the route will be associated. Must be saved to HealthKit
///
/// Parameter `metadata`: Optional metadata may be added to associate with the series. Predefined keys are found in
/// HKMetadata.h, or private NSString keys used by the client are allowed. Acceptable metadata value
/// types are NSString, NSDate, NSNumber and HKQuantity
///
/// Parameter `completion`: The completion callback handler returns the saved HKWorkoutRoute object. If workoutRoute is nil, an
/// error will indicate why the series could not be returned including database inaccessibility during
/// device lock. Subsequent requests for the HKWorkoutRoute can be made through HKSampleQuery or similar
/// queries. workoutRoute cannot be associated to another workout.
///
/// # Safety
///
/// `metadata` generic should be of the correct type.
#[unsafe(method(finishRouteWithWorkout:metadata:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn finishRouteWithWorkout_metadata_completion(
&self,
workout: &HKWorkout,
metadata: Option<&NSDictionary<NSString, AnyObject>>,
completion: &block2::DynBlock<dyn Fn(*mut HKWorkoutRoute, *mut NSError)>,
);
);
}
/// Methods declared on superclass `HKSeriesBuilder`.
#[cfg(feature = "HKSeriesBuilder")]
impl HKWorkoutRouteBuilder {
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 HKWorkoutRouteBuilder {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}