objc2-home-kit 0.3.2

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

use crate::*;

extern_class!(
    /// This class is used to represent the presence of users in a home.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmpresenceevent?language=objc)
    #[unsafe(super(HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMPresenceEvent;
);

#[cfg(feature = "HMEvent")]
unsafe impl Send for HMPresenceEvent {}

#[cfg(feature = "HMEvent")]
unsafe impl Sync for HMPresenceEvent {}

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

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

#[cfg(feature = "HMEvent")]
extern_conformance!(
    unsafe impl NSMutableCopying for HMPresenceEvent {}
);

#[cfg(feature = "HMEvent")]
unsafe impl MutableCopyingHelper for HMPresenceEvent {
    type Result = HMMutablePresenceEvent;
}

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

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

        #[cfg(feature = "HMPresenceEventDefines")]
        /// Creates a presence based event.
        ///
        ///
        /// Parameter `presenceEventType`: The event type desired for the event.
        ///
        ///
        /// Parameter `presenceUserType`: The user type whose presence will trigger the event.
        ///
        ///
        /// Returns: Instance object representing the presence event.
        #[unsafe(method(initWithPresenceEventType:presenceUserType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPresenceEventType_presenceUserType(
            this: Allocated<Self>,
            presence_event_type: HMPresenceEventType,
            presence_user_type: HMPresenceEventUserType,
        ) -> Retained<Self>;

        #[cfg(feature = "HMPresenceEventDefines")]
        /// presenceEventType The event type that will trigger the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(presenceEventType))]
        #[unsafe(method_family = none)]
        pub unsafe fn presenceEventType(&self) -> HMPresenceEventType;

        #[cfg(feature = "HMPresenceEventDefines")]
        /// presenceUserType The user type whose presence will trigger the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(presenceUserType))]
        #[unsafe(method_family = none)]
        pub unsafe fn presenceUserType(&self) -> HMPresenceEventUserType;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(feature = "HMEvent")]
impl HMPresenceEvent {
    extern_methods!(
        #[deprecated = "HMEvent is abstract"]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// This class is used to represent the presence of users in a home.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablepresenceevent?language=objc)
    #[unsafe(super(HMPresenceEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMMutablePresenceEvent;
);

#[cfg(feature = "HMEvent")]
unsafe impl Send for HMMutablePresenceEvent {}

#[cfg(feature = "HMEvent")]
unsafe impl Sync for HMMutablePresenceEvent {}

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

#[cfg(feature = "HMEvent")]
unsafe impl CopyingHelper for HMMutablePresenceEvent {
    type Result = HMPresenceEvent;
}

#[cfg(feature = "HMEvent")]
extern_conformance!(
    unsafe impl NSMutableCopying for HMMutablePresenceEvent {}
);

#[cfg(feature = "HMEvent")]
unsafe impl MutableCopyingHelper for HMMutablePresenceEvent {
    type Result = Self;
}

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

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

        #[cfg(feature = "HMPresenceEventDefines")]
        /// presenceEventType The event type that will trigger the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(presenceEventType))]
        #[unsafe(method_family = none)]
        pub unsafe fn presenceEventType(&self) -> HMPresenceEventType;

        #[cfg(feature = "HMPresenceEventDefines")]
        /// Setter for [`presenceEventType`][Self::presenceEventType].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setPresenceEventType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPresenceEventType(&self, presence_event_type: HMPresenceEventType);

        #[cfg(feature = "HMPresenceEventDefines")]
        /// presenceUserType The user type whose presence will trigger the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(presenceUserType))]
        #[unsafe(method_family = none)]
        pub unsafe fn presenceUserType(&self) -> HMPresenceEventUserType;

        #[cfg(feature = "HMPresenceEventDefines")]
        /// Setter for [`presenceUserType`][Self::presenceUserType].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setPresenceUserType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPresenceUserType(&self, presence_user_type: HMPresenceEventUserType);
    );
}

/// Methods declared on superclass `HMPresenceEvent`.
#[cfg(feature = "HMEvent")]
impl HMMutablePresenceEvent {
    extern_methods!(
        #[cfg(feature = "HMPresenceEventDefines")]
        /// Creates a presence based event.
        ///
        ///
        /// Parameter `presenceEventType`: The event type desired for the event.
        ///
        ///
        /// Parameter `presenceUserType`: The user type whose presence will trigger the event.
        ///
        ///
        /// Returns: Instance object representing the presence event.
        #[unsafe(method(initWithPresenceEventType:presenceUserType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPresenceEventType_presenceUserType(
            this: Allocated<Self>,
            presence_event_type: HMPresenceEventType,
            presence_user_type: HMPresenceEventUserType,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(feature = "HMEvent")]
impl HMMutablePresenceEvent {
    extern_methods!(
        #[deprecated = "HMEvent is abstract"]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}