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 a duration of time.
    ///
    ///
    /// Note: Characteristics turned on by the trigger will be turned off after the duration
    /// Supported characteristics are [HMCharacteristicTypePowerState, HMCharacteristicTypeActive]
    /// The duration event immediately ends if the characteristics are changed or updated during this period
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmdurationevent?language=objc)
    #[unsafe(super(HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMDurationEvent;
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Send for HMDurationEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Sync for HMDurationEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSCopying for HMDurationEvent {}
);

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

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSMutableCopying for HMDurationEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl MutableCopyingHelper for HMDurationEvent {
    type Result = HMMutableDurationEvent;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HMDurationEvent {}
);

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

        /// Creates a duration time event.
        ///
        ///
        /// Parameter `duration`: The duration of time in seconds.
        ///
        ///
        /// Returns: Instance object representing the duration event.
        #[unsafe(method(initWithDuration:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDuration(
            this: Allocated<Self>,
            duration: NSTimeInterval,
        ) -> Retained<Self>;

        /// duration The duration of time in seconds.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMDurationEvent {
    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 a duration of time.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutabledurationevent?language=objc)
    #[unsafe(super(HMDurationEvent, HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMMutableDurationEvent;
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Send for HMMutableDurationEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Sync for HMMutableDurationEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSCopying for HMMutableDurationEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl CopyingHelper for HMMutableDurationEvent {
    type Result = HMDurationEvent;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSMutableCopying for HMMutableDurationEvent {}
);

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

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HMMutableDurationEvent {}
);

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

        /// duration The duration of time in seconds.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;

        /// Setter for [`duration`][Self::duration].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
    );
}

/// Methods declared on superclass `HMDurationEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMMutableDurationEvent {
    extern_methods!(
        /// Creates a duration time event.
        ///
        ///
        /// Parameter `duration`: The duration of time in seconds.
        ///
        ///
        /// Returns: Instance object representing the duration event.
        #[unsafe(method(initWithDuration:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDuration(
            this: Allocated<Self>,
            duration: NSTimeInterval,
        ) -> Retained<Self>;
    );
}

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