objc2_core_motion/generated/CMMovementDisorderManager.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// A CMDyskineticSymptomResult object describes the presence and prevalence of dyskinetic symptoms (specifically, choreiform movements) during a one minute result period when subjects wear the Apple Watch on their most affected arm.
12 /// percentUnlikely + percentLikely = 1.0
13 /// Please note dyskinetic symptom measurements are designed for subjects with known presence of chorea in the arm and should not be displayed to users who do not report episodes of dyskinetic symptoms.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmdyskineticsymptomresult?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct CMDyskineticSymptomResult;
19);
20
21extern_conformance!(
22 unsafe impl NSCoding for CMDyskineticSymptomResult {}
23);
24
25extern_conformance!(
26 unsafe impl NSCopying for CMDyskineticSymptomResult {}
27);
28
29unsafe impl CopyingHelper for CMDyskineticSymptomResult {
30 type Result = Self;
31}
32
33extern_conformance!(
34 unsafe impl NSObjectProtocol for CMDyskineticSymptomResult {}
35);
36
37extern_conformance!(
38 unsafe impl NSSecureCoding for CMDyskineticSymptomResult {}
39);
40
41impl CMDyskineticSymptomResult {
42 extern_methods!(
43 /// The date and time representing the start of the result.
44 #[unsafe(method(startDate))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn startDate(&self) -> Retained<NSDate>;
47
48 /// The date and time representing the end of the result.
49 #[unsafe(method(endDate))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn endDate(&self) -> Retained<NSDate>;
52
53 /// The percentage of time dyskinetic symptoms were unlikely for the result.
54 #[unsafe(method(percentUnlikely))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn percentUnlikely(&self) -> c_float;
57
58 /// The percentage of time dyskinetic symptoms were likely for the result.
59 #[unsafe(method(percentLikely))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn percentLikely(&self) -> c_float;
62 );
63}
64
65/// Methods declared on superclass `NSObject`.
66impl CMDyskineticSymptomResult {
67 extern_methods!(
68 #[unsafe(method(init))]
69 #[unsafe(method_family = init)]
70 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72 #[unsafe(method(new))]
73 #[unsafe(method_family = new)]
74 pub unsafe fn new() -> Retained<Self>;
75 );
76}
77
78extern_class!(
79 /// A CMTremorResult object describes the presence and prevalence of tremor symptoms (specifically, resting tremor) during a one minute result period when subjects wear the Apple Watch on their most affected arm.
80 /// percentUnknown + percentNoTremor + percentTremorSlight + percentTremorMild + percentTremorModerate + percentTremorStrong = 1.0
81 ///
82 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmtremorresult?language=objc)
83 #[unsafe(super(NSObject))]
84 #[derive(Debug, PartialEq, Eq, Hash)]
85 pub struct CMTremorResult;
86);
87
88extern_conformance!(
89 unsafe impl NSCoding for CMTremorResult {}
90);
91
92extern_conformance!(
93 unsafe impl NSCopying for CMTremorResult {}
94);
95
96unsafe impl CopyingHelper for CMTremorResult {
97 type Result = Self;
98}
99
100extern_conformance!(
101 unsafe impl NSObjectProtocol for CMTremorResult {}
102);
103
104extern_conformance!(
105 unsafe impl NSSecureCoding for CMTremorResult {}
106);
107
108impl CMTremorResult {
109 extern_methods!(
110 /// The date and time representing the start of the result.
111 #[unsafe(method(startDate))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn startDate(&self) -> Retained<NSDate>;
114
115 /// The date and time representing the end of the result.
116 #[unsafe(method(endDate))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn endDate(&self) -> Retained<NSDate>;
119
120 /// The percentage of time tremor was unknown for the result.
121 /// Unknown periods include times when:
122 /// 1. the subject is moving and therefore a resting tremor cannot be assessed, and
123 /// 2. the signal strength is too low to measure tremor confidently.
124 #[unsafe(method(percentUnknown))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn percentUnknown(&self) -> c_float;
127
128 /// The percentage of time no tremor was detected for the result.
129 #[unsafe(method(percentNone))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn percentNone(&self) -> c_float;
132
133 /// The percentage of time tremor was likely and displacement amplitude was slight for the result.
134 #[unsafe(method(percentSlight))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn percentSlight(&self) -> c_float;
137
138 /// The percentage of time tremor was likely and displacement amplitude was mild for the result.
139 #[unsafe(method(percentMild))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn percentMild(&self) -> c_float;
142
143 /// The percentage of time tremor was likely and displacement amplitude was moderate for the result.
144 #[unsafe(method(percentModerate))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn percentModerate(&self) -> c_float;
147
148 /// The percentage of time tremor was likely and displacement amplitude was strong for the result.
149 #[unsafe(method(percentStrong))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn percentStrong(&self) -> c_float;
152 );
153}
154
155/// Methods declared on superclass `NSObject`.
156impl CMTremorResult {
157 extern_methods!(
158 #[unsafe(method(init))]
159 #[unsafe(method_family = init)]
160 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
161
162 #[unsafe(method(new))]
163 #[unsafe(method_family = new)]
164 pub unsafe fn new() -> Retained<Self>;
165 );
166}
167
168/// Completion handler for CMDyskineticSymptomResult values.
169///
170/// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmdyskineticsymptomresulthandler?language=objc)
171#[cfg(feature = "block2")]
172pub type CMDyskineticSymptomResultHandler =
173 *mut block2::DynBlock<dyn Fn(NonNull<NSArray<CMDyskineticSymptomResult>>, *mut NSError)>;
174
175/// Completion handler for CMTremorResult values.
176///
177/// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmtremorresulthandler?language=objc)
178#[cfg(feature = "block2")]
179pub type CMTremorResultHandler =
180 *mut block2::DynBlock<dyn Fn(NonNull<NSArray<CMTremorResult>>, *mut NSError)>;
181
182extern_class!(
183 /// A CMMovementDisorderManager object with methods for persistence and query of movement disorder results.
184 ///
185 /// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmmovementdisordermanager?language=objc)
186 #[unsafe(super(NSObject))]
187 #[derive(Debug, PartialEq, Eq, Hash)]
188 pub struct CMMovementDisorderManager;
189);
190
191extern_conformance!(
192 unsafe impl NSObjectProtocol for CMMovementDisorderManager {}
193);
194
195impl CMMovementDisorderManager {
196 extern_methods!(
197 /// Whether movement disorder results are available on this platform.
198 ///
199 /// Returns: Returns the availability of movement disorder results on this platform.
200 #[unsafe(method(isAvailable))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn isAvailable() -> bool;
203
204 /// What version of movement disorder software is available on this platform.
205 ///
206 /// Returns: Returns the version number of the movement disorder software available on this platform, nil if not.
207 /// Format follows Major.Minor.Fix format (e.g. 1.0.0)
208 #[unsafe(method(version))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn version() -> Option<Retained<NSString>>;
211
212 #[cfg(feature = "CMAuthorization")]
213 /// Authorization status of movement disorder results for this user.
214 ///
215 /// Returns: Returns the authorization status of movement disorder results for this user.
216 #[unsafe(method(authorizationStatus))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn authorizationStatus() -> CMAuthorizationStatus;
219
220 /// Enables the calculation and persistence of result values for the specified duration in seconds.
221 ///
222 /// Parameter `duration`: The duration in seconds to enable the calculation and persistence of result values.
223 ///
224 /// Warning: Please note that the maximum duration allowed is seven (7) days.
225 #[unsafe(method(monitorKinesiasForDuration:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn monitorKinesiasForDuration(&self, duration: NSTimeInterval);
228
229 #[cfg(feature = "block2")]
230 /// Queries the system for result values for the specified date range.
231 ///
232 /// Parameter `fromDate`: The begin date for the query range.
233 ///
234 /// Parameter `toDate`: The end date for the query range.
235 ///
236 /// Parameter `handler`: The completion handler for accessing and processing result values.
237 ///
238 /// Warning: Please note that movement disorder results are available for a maximum of seven (7) days.
239 ///
240 /// # Safety
241 ///
242 /// `handler` must be a valid pointer.
243 #[unsafe(method(queryDyskineticSymptomFromDate:toDate:withHandler:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn queryDyskineticSymptomFromDate_toDate_withHandler(
246 &self,
247 from_date: &NSDate,
248 to_date: &NSDate,
249 handler: CMDyskineticSymptomResultHandler,
250 );
251
252 #[cfg(feature = "block2")]
253 /// Queries the system for result values for the specified date range.
254 ///
255 /// Parameter `fromDate`: The begin date for the query range.
256 ///
257 /// Parameter `toDate`: The end date for the query range.
258 ///
259 /// Parameter `handler`: The completion handler for accessing and processing result values.
260 ///
261 /// Warning: Please note that movement disorder results are available for a maximum of seven (7) days.
262 ///
263 /// # Safety
264 ///
265 /// `handler` must be a valid pointer.
266 #[unsafe(method(queryTremorFromDate:toDate:withHandler:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn queryTremorFromDate_toDate_withHandler(
269 &self,
270 from_date: &NSDate,
271 to_date: &NSDate,
272 handler: CMTremorResultHandler,
273 );
274
275 /// The last time that data has been processed; queries for periods before this point will return their final results. Data after this point may become available later if monitoring is continuing.
276 ///
277 /// Warning: Returns nil if no data has been processed or monitoring was not enabled.
278 #[unsafe(method(lastProcessedDate))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn lastProcessedDate(&self) -> Option<Retained<NSDate>>;
281
282 /// The expiration date for the most recent monitoring period.
283 ///
284 /// Warning: Returns nil if no previous monitoring period is available.
285 #[unsafe(method(monitorKinesiasExpirationDate))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn monitorKinesiasExpirationDate(&self) -> Option<Retained<NSDate>>;
288 );
289}
290
291/// Methods declared on superclass `NSObject`.
292impl CMMovementDisorderManager {
293 extern_methods!(
294 #[unsafe(method(init))]
295 #[unsafe(method_family = init)]
296 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
297
298 #[unsafe(method(new))]
299 #[unsafe(method_family = new)]
300 pub unsafe fn new() -> Retained<Self>;
301 );
302}