objc2_core_motion/generated/
CMHeadphoneMotionManager.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
10/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmheadphonedevicemotionhandler?language=objc)
11#[cfg(all(feature = "CMDeviceMotion", feature = "CMLogItem", feature = "block2"))]
12pub type CMHeadphoneDeviceMotionHandler =
13    *mut block2::DynBlock<dyn Fn(*mut CMDeviceMotion, *mut NSError)>;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmheadphonemotionmanager?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct CMHeadphoneMotionManager;
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for CMHeadphoneMotionManager {}
24);
25
26impl CMHeadphoneMotionManager {
27    extern_methods!(
28        #[cfg(feature = "CMAuthorization")]
29        #[unsafe(method(authorizationStatus))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn authorizationStatus() -> CMAuthorizationStatus;
32
33        #[cfg(feature = "CMHeadphoneMotionManagerDelegate")]
34        #[unsafe(method(delegate))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn delegate(
37            &self,
38        ) -> Option<Retained<ProtocolObject<dyn CMHeadphoneMotionManagerDelegate>>>;
39
40        #[cfg(feature = "CMHeadphoneMotionManagerDelegate")]
41        /// Setter for [`delegate`][Self::delegate].
42        ///
43        /// This is a [weak property][objc2::topics::weak_property].
44        #[unsafe(method(setDelegate:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn setDelegate(
47            &self,
48            delegate: Option<&ProtocolObject<dyn CMHeadphoneMotionManagerDelegate>>,
49        );
50
51        #[unsafe(method(isConnectionStatusActive))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn isConnectionStatusActive(&self) -> bool;
54
55        #[unsafe(method(isDeviceMotionAvailable))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn isDeviceMotionAvailable(&self) -> bool;
58
59        #[unsafe(method(isDeviceMotionActive))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn isDeviceMotionActive(&self) -> bool;
62
63        #[cfg(all(feature = "CMDeviceMotion", feature = "CMLogItem"))]
64        #[unsafe(method(deviceMotion))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn deviceMotion(&self) -> Option<Retained<CMDeviceMotion>>;
67
68        #[unsafe(method(startDeviceMotionUpdates))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn startDeviceMotionUpdates(&self);
71
72        #[cfg(all(feature = "CMDeviceMotion", feature = "CMLogItem", feature = "block2"))]
73        /// # Safety
74        ///
75        /// - `queue` possibly has additional threading requirements.
76        /// - `handler` must be a valid pointer.
77        #[unsafe(method(startDeviceMotionUpdatesToQueue:withHandler:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn startDeviceMotionUpdatesToQueue_withHandler(
80            &self,
81            queue: &NSOperationQueue,
82            handler: CMHeadphoneDeviceMotionHandler,
83        );
84
85        #[unsafe(method(stopDeviceMotionUpdates))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn stopDeviceMotionUpdates(&self);
88
89        #[unsafe(method(startConnectionStatusUpdates))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn startConnectionStatusUpdates(&self);
92
93        #[unsafe(method(stopConnectionStatusUpdates))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn stopConnectionStatusUpdates(&self);
96    );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl CMHeadphoneMotionManager {
101    extern_methods!(
102        #[unsafe(method(init))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
105
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new() -> Retained<Self>;
109    );
110}