objc2_core_motion/generated/
CMPedometer.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    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometerdata?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct CMPedometerData;
15);
16
17extern_conformance!(
18    unsafe impl NSCoding for CMPedometerData {}
19);
20
21extern_conformance!(
22    unsafe impl NSCopying for CMPedometerData {}
23);
24
25unsafe impl CopyingHelper for CMPedometerData {
26    type Result = Self;
27}
28
29extern_conformance!(
30    unsafe impl NSObjectProtocol for CMPedometerData {}
31);
32
33extern_conformance!(
34    unsafe impl NSSecureCoding for CMPedometerData {}
35);
36
37impl CMPedometerData {
38    extern_methods!(
39        #[unsafe(method(startDate))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn startDate(&self) -> Retained<NSDate>;
42
43        #[unsafe(method(endDate))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn endDate(&self) -> Retained<NSDate>;
46
47        #[unsafe(method(numberOfSteps))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn numberOfSteps(&self) -> Retained<NSNumber>;
50
51        #[unsafe(method(distance))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn distance(&self) -> Option<Retained<NSNumber>>;
54
55        #[unsafe(method(floorsAscended))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn floorsAscended(&self) -> Option<Retained<NSNumber>>;
58
59        #[unsafe(method(floorsDescended))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn floorsDescended(&self) -> Option<Retained<NSNumber>>;
62
63        #[unsafe(method(currentPace))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn currentPace(&self) -> Option<Retained<NSNumber>>;
66
67        #[unsafe(method(currentCadence))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn currentCadence(&self) -> Option<Retained<NSNumber>>;
70
71        #[unsafe(method(averageActivePace))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn averageActivePace(&self) -> Option<Retained<NSNumber>>;
74    );
75}
76
77/// Methods declared on superclass `NSObject`.
78impl CMPedometerData {
79    extern_methods!(
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}
89
90/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometereventtype?language=objc)
91// NS_ENUM
92#[repr(transparent)]
93#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
94pub struct CMPedometerEventType(pub NSInteger);
95impl CMPedometerEventType {
96    #[doc(alias = "CMPedometerEventTypePause")]
97    pub const Pause: Self = Self(0);
98    #[doc(alias = "CMPedometerEventTypeResume")]
99    pub const Resume: Self = Self(1);
100}
101
102unsafe impl Encode for CMPedometerEventType {
103    const ENCODING: Encoding = NSInteger::ENCODING;
104}
105
106unsafe impl RefEncode for CMPedometerEventType {
107    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern_class!(
111    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometerevent?language=objc)
112    #[unsafe(super(NSObject))]
113    #[derive(Debug, PartialEq, Eq, Hash)]
114    pub struct CMPedometerEvent;
115);
116
117extern_conformance!(
118    unsafe impl NSCoding for CMPedometerEvent {}
119);
120
121extern_conformance!(
122    unsafe impl NSCopying for CMPedometerEvent {}
123);
124
125unsafe impl CopyingHelper for CMPedometerEvent {
126    type Result = Self;
127}
128
129extern_conformance!(
130    unsafe impl NSObjectProtocol for CMPedometerEvent {}
131);
132
133extern_conformance!(
134    unsafe impl NSSecureCoding for CMPedometerEvent {}
135);
136
137impl CMPedometerEvent {
138    extern_methods!(
139        #[unsafe(method(date))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn date(&self) -> Retained<NSDate>;
142
143        #[unsafe(method(type))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn r#type(&self) -> CMPedometerEventType;
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150impl CMPedometerEvent {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}
161
162/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometerhandler?language=objc)
163#[cfg(feature = "block2")]
164pub type CMPedometerHandler = *mut block2::DynBlock<dyn Fn(*mut CMPedometerData, *mut NSError)>;
165
166/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometereventhandler?language=objc)
167#[cfg(feature = "block2")]
168pub type CMPedometerEventHandler =
169    *mut block2::DynBlock<dyn Fn(*mut CMPedometerEvent, *mut NSError)>;
170
171extern_class!(
172    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmpedometer?language=objc)
173    #[unsafe(super(NSObject))]
174    #[derive(Debug, PartialEq, Eq, Hash)]
175    pub struct CMPedometer;
176);
177
178extern_conformance!(
179    unsafe impl NSObjectProtocol for CMPedometer {}
180);
181
182impl CMPedometer {
183    extern_methods!(
184        #[unsafe(method(isStepCountingAvailable))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn isStepCountingAvailable() -> bool;
187
188        #[unsafe(method(isDistanceAvailable))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn isDistanceAvailable() -> bool;
191
192        #[unsafe(method(isFloorCountingAvailable))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn isFloorCountingAvailable() -> bool;
195
196        #[unsafe(method(isPaceAvailable))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn isPaceAvailable() -> bool;
199
200        #[unsafe(method(isCadenceAvailable))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn isCadenceAvailable() -> bool;
203
204        #[unsafe(method(isPedometerEventTrackingAvailable))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn isPedometerEventTrackingAvailable() -> bool;
207
208        #[cfg(feature = "CMAuthorization")]
209        #[unsafe(method(authorizationStatus))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn authorizationStatus() -> CMAuthorizationStatus;
212
213        #[cfg(feature = "block2")]
214        #[unsafe(method(queryPedometerDataFromDate:toDate:withHandler:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn queryPedometerDataFromDate_toDate_withHandler(
217            &self,
218            start: &NSDate,
219            end: &NSDate,
220            handler: CMPedometerHandler,
221        );
222
223        #[cfg(feature = "block2")]
224        #[unsafe(method(startPedometerUpdatesFromDate:withHandler:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn startPedometerUpdatesFromDate_withHandler(
227            &self,
228            start: &NSDate,
229            handler: CMPedometerHandler,
230        );
231
232        #[unsafe(method(stopPedometerUpdates))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn stopPedometerUpdates(&self);
235
236        #[cfg(feature = "block2")]
237        #[unsafe(method(startPedometerEventUpdatesWithHandler:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn startPedometerEventUpdatesWithHandler(
240            &self,
241            handler: CMPedometerEventHandler,
242        );
243
244        #[unsafe(method(stopPedometerEventUpdates))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn stopPedometerEventUpdates(&self);
247    );
248}
249
250/// Methods declared on superclass `NSObject`.
251impl CMPedometer {
252    extern_methods!(
253        #[unsafe(method(init))]
254        #[unsafe(method_family = init)]
255        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
256
257        #[unsafe(method(new))]
258        #[unsafe(method_family = new)]
259        pub unsafe fn new() -> Retained<Self>;
260    );
261}