objc2-core-motion 0.3.2

Bindings to the CoreMotion framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// Fall Detection Event Resolution
///
/// See also: CMFallDetectionEvent
///
///
/// This enumeration defines the different states in which a Fall Detection event can be resolved
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmfalldetectioneventuserresolution?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CMFallDetectionEventUserResolution(pub NSInteger);
impl CMFallDetectionEventUserResolution {
    /// the user confirmed the fall alert
    #[doc(alias = "CMFallDetectionEventUserResolutionConfirmed")]
    pub const Confirmed: Self = Self(0);
    /// the user dismissed the fall alert either immediately or after a sequence of haptics and chimes
    #[doc(alias = "CMFallDetectionEventUserResolutionDismissed")]
    pub const Dismissed: Self = Self(1);
    /// the user rejected the fall alert, indicating that they didn't fall
    #[doc(alias = "CMFallDetectionEventUserResolutionRejected")]
    pub const Rejected: Self = Self(2);
    /// the user did not respond to the fall alert and no recovery motion was detected
    #[doc(alias = "CMFallDetectionEventUserResolutionUnresponsive")]
    pub const Unresponsive: Self = Self(3);
}

unsafe impl Encode for CMFallDetectionEventUserResolution {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CMFallDetectionEventUserResolution {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// Fall Detection Event
    ///
    /// See also: CMFallDetectionEventResolution
    ///
    /// This object represents a Fall Detection event and how it was resolved
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmfalldetectionevent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CMFallDetectionEvent;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CMFallDetectionEvent {}
);

impl CMFallDetectionEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// date
        ///
        /// The time a fall was detected
        #[unsafe(method(date))]
        #[unsafe(method_family = none)]
        pub unsafe fn date(&self) -> Retained<NSDate>;

        /// resolution
        ///
        /// enum value representing how the Fall Detection event was resolved
        ///
        /// See also: CMFallDetectionEventResolution
        #[unsafe(method(resolution))]
        #[unsafe(method_family = none)]
        pub unsafe fn resolution(&self) -> CMFallDetectionEventUserResolution;
    );
}

/// Methods declared on superclass `NSObject`.
impl CMFallDetectionEvent {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}