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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmmotionactivityconfidence?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CMMotionActivityConfidence(pub NSInteger);
impl CMMotionActivityConfidence {
    #[doc(alias = "CMMotionActivityConfidenceLow")]
    pub const Low: Self = Self(0);
    #[doc(alias = "CMMotionActivityConfidenceMedium")]
    pub const Medium: Self = Self(1);
    #[doc(alias = "CMMotionActivityConfidenceHigh")]
    pub const High: Self = Self(2);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmmotionactivity?language=objc)
    #[unsafe(super(CMLogItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CMLogItem")]
    pub struct CMMotionActivity;
);

#[cfg(feature = "CMLogItem")]
extern_conformance!(
    unsafe impl NSCoding for CMMotionActivity {}
);

#[cfg(feature = "CMLogItem")]
extern_conformance!(
    unsafe impl NSCopying for CMMotionActivity {}
);

#[cfg(feature = "CMLogItem")]
unsafe impl CopyingHelper for CMMotionActivity {
    type Result = Self;
}

#[cfg(feature = "CMLogItem")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CMMotionActivity {}
);

#[cfg(feature = "CMLogItem")]
extern_conformance!(
    unsafe impl NSSecureCoding for CMMotionActivity {}
);

#[cfg(feature = "CMLogItem")]
impl CMMotionActivity {
    extern_methods!(
        #[unsafe(method(confidence))]
        #[unsafe(method_family = none)]
        pub unsafe fn confidence(&self) -> CMMotionActivityConfidence;

        #[unsafe(method(startDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn startDate(&self) -> Retained<NSDate>;

        #[unsafe(method(unknown))]
        #[unsafe(method_family = none)]
        pub unsafe fn unknown(&self) -> bool;

        #[unsafe(method(stationary))]
        #[unsafe(method_family = none)]
        pub unsafe fn stationary(&self) -> bool;

        #[unsafe(method(walking))]
        #[unsafe(method_family = none)]
        pub unsafe fn walking(&self) -> bool;

        #[unsafe(method(running))]
        #[unsafe(method_family = none)]
        pub unsafe fn running(&self) -> bool;

        #[unsafe(method(automotive))]
        #[unsafe(method_family = none)]
        pub unsafe fn automotive(&self) -> bool;

        #[unsafe(method(cycling))]
        #[unsafe(method_family = none)]
        pub unsafe fn cycling(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CMLogItem")]
impl CMMotionActivity {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}