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::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// This class represents an event that is evaluated based on entry to and/or
    /// exit from a Region
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmlocationevent?language=objc)
    #[unsafe(super(HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMLocationEvent;
);

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

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

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

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

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

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

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

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

        #[cfg(feature = "objc2-core-location")]
        /// Initializes a new location event object
        ///
        ///
        /// Parameter `region`: - Region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
        ///
        ///
        /// Returns: Instance object representing the location event.
        #[unsafe(method(initWithRegion:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRegion(this: Allocated<Self>, region: &CLRegion) -> Retained<Self>;

        #[cfg(feature = "objc2-core-location")]
        /// Region on which events are triggered based on the properties notifyOnEntry and notifyOnExit.
        /// This property will be nil when an application is not authorized for location services.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(region))]
        #[unsafe(method_family = none)]
        pub unsafe fn region(&self) -> Option<Retained<CLRegion>>;

        #[cfg(all(feature = "block2", feature = "objc2-core-location"))]
        /// Updates the region
        ///
        ///
        /// Parameter `region`: - New region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
        ///
        ///
        /// Parameter `completion`: Block that is invoked once the request is processed.
        /// The NSError provides more information on the status of the request, error
        /// will be nil on success.
        #[deprecated = "No longer supported."]
        #[unsafe(method(updateRegion:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateRegion_completionHandler(
            &self,
            region: &CLRegion,
            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
        );
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(feature = "HMEvent")]
impl HMLocationEvent {
    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 that is evaluated based on entry to and/or
    /// exit from a Region
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablelocationevent?language=objc)
    #[unsafe(super(HMLocationEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HMEvent")]
    pub struct HMMutableLocationEvent;
);

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

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

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

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

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

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

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

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

        #[cfg(feature = "objc2-core-location")]
        /// Region on which events are triggered based on the properties notifyOnEntry and notifyOnExit.
        /// This property will be nil when an application is not authorized for location services.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(region))]
        #[unsafe(method_family = none)]
        pub unsafe fn region(&self) -> Option<Retained<CLRegion>>;

        #[cfg(feature = "objc2-core-location")]
        /// Setter for [`region`][Self::region].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRegion(&self, region: Option<&CLRegion>);
    );
}

/// Methods declared on superclass `HMLocationEvent`.
#[cfg(feature = "HMEvent")]
impl HMMutableLocationEvent {
    extern_methods!(
        #[cfg(feature = "objc2-core-location")]
        /// Initializes a new location event object
        ///
        ///
        /// Parameter `region`: - Region with at least one property of notifyOnEntry or notifyOnExit set to TRUE.
        ///
        ///
        /// Returns: Instance object representing the location event.
        #[unsafe(method(initWithRegion:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRegion(this: Allocated<Self>, region: &CLRegion) -> Retained<Self>;
    );
}

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