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        /// This is a [weak property][objc2::topics::weak_property].
42        /// Setter for [`delegate`][Self::delegate].
43        #[unsafe(method(setDelegate:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn setDelegate(
46            &self,
47            delegate: Option<&ProtocolObject<dyn CMHeadphoneMotionManagerDelegate>>,
48        );
49
50        #[unsafe(method(isConnectionStatusActive))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn isConnectionStatusActive(&self) -> bool;
53
54        #[unsafe(method(isDeviceMotionAvailable))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn isDeviceMotionAvailable(&self) -> bool;
57
58        #[unsafe(method(isDeviceMotionActive))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn isDeviceMotionActive(&self) -> bool;
61
62        #[cfg(all(feature = "CMDeviceMotion", feature = "CMLogItem"))]
63        #[unsafe(method(deviceMotion))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn deviceMotion(&self) -> Option<Retained<CMDeviceMotion>>;
66
67        #[unsafe(method(startDeviceMotionUpdates))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn startDeviceMotionUpdates(&self);
70
71        #[cfg(all(feature = "CMDeviceMotion", feature = "CMLogItem", feature = "block2"))]
72        #[unsafe(method(startDeviceMotionUpdatesToQueue:withHandler:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn startDeviceMotionUpdatesToQueue_withHandler(
75            &self,
76            queue: &NSOperationQueue,
77            handler: CMHeadphoneDeviceMotionHandler,
78        );
79
80        #[unsafe(method(stopDeviceMotionUpdates))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn stopDeviceMotionUpdates(&self);
83
84        #[unsafe(method(startConnectionStatusUpdates))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn startConnectionStatusUpdates(&self);
87
88        #[unsafe(method(stopConnectionStatusUpdates))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn stopConnectionStatusUpdates(&self);
91    );
92}
93
94/// Methods declared on superclass `NSObject`.
95impl CMHeadphoneMotionManager {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new() -> Retained<Self>;
104    );
105}