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 represents an event when a characteristic's value falls within the specified
    /// number range.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcharacteristicthresholdrangeevent?language=objc)
    #[unsafe(super(HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMCharacteristicThresholdRangeEvent;
);

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

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

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

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

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

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

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

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

        #[cfg(all(feature = "HMCharacteristic", feature = "HMNumberRange"))]
        /// Initializes a new characteristic number range event object
        ///
        ///
        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
        /// support notification. An exception will be thrown otherwise.
        ///
        ///
        /// Parameter `thresholdRange`: The range for the characteristic value to trigger the event.
        ///
        ///
        /// Returns: Instance object representing the characteristic event.
        #[unsafe(method(initWithCharacteristic:thresholdRange:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCharacteristic_thresholdRange(
            this: Allocated<Self>,
            characteristic: &HMCharacteristic,
            threshold_range: &HMNumberRange,
        ) -> Retained<Self>;

        #[cfg(feature = "HMCharacteristic")]
        /// The characteristic associated with the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(characteristic))]
        #[unsafe(method_family = none)]
        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;

        #[cfg(feature = "HMNumberRange")]
        /// The range of the characteristic value that triggers the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(thresholdRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn thresholdRange(&self) -> Retained<HMNumberRange>;
    );
}

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

extern_class!(
    /// This class represents an event when a characteristic's value falls within the specified
    /// number range.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablecharacteristicthresholdrangeevent?language=objc)
    #[unsafe(super(HMCharacteristicThresholdRangeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMMutableCharacteristicThresholdRangeEvent;
);

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

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

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

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

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

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

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

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

        #[cfg(feature = "HMCharacteristic")]
        /// The characteristic associated with the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(characteristic))]
        #[unsafe(method_family = none)]
        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;

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

        #[cfg(feature = "HMNumberRange")]
        /// The range of the characteristic value that triggers the event.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(thresholdRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn thresholdRange(&self) -> Retained<HMNumberRange>;

        #[cfg(feature = "HMNumberRange")]
        /// Setter for [`thresholdRange`][Self::thresholdRange].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setThresholdRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setThresholdRange(&self, threshold_range: &HMNumberRange);
    );
}

/// Methods declared on superclass `HMCharacteristicThresholdRangeEvent`.
#[cfg(feature = "HMEvent")]
impl HMMutableCharacteristicThresholdRangeEvent {
    extern_methods!(
        #[cfg(all(feature = "HMCharacteristic", feature = "HMNumberRange"))]
        /// Initializes a new characteristic number range event object
        ///
        ///
        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
        /// support notification. An exception will be thrown otherwise.
        ///
        ///
        /// Parameter `thresholdRange`: The range for the characteristic value to trigger the event.
        ///
        ///
        /// Returns: Instance object representing the characteristic event.
        #[unsafe(method(initWithCharacteristic:thresholdRange:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCharacteristic_thresholdRange(
            this: Allocated<Self>,
            characteristic: &HMCharacteristic,
            threshold_range: &HMNumberRange,
        ) -> Retained<Self>;
    );
}

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