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

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

#[cfg(feature = "HMAccessoryProfile")]
unsafe impl Send for HMNetworkConfigurationProfile {}

#[cfg(feature = "HMAccessoryProfile")]
unsafe impl Sync for HMNetworkConfigurationProfile {}

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

#[cfg(feature = "HMAccessoryProfile")]
impl HMNetworkConfigurationProfile {
    extern_methods!(
        /// The delegate of the receiver.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn HMNetworkConfigurationProfileDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn HMNetworkConfigurationProfileDelegate>>,
        );

        /// Indicates if the associated accessory's access to the network is restricted.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isNetworkAccessRestricted))]
        #[unsafe(method_family = none)]
        pub unsafe fn isNetworkAccessRestricted(&self) -> bool;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/homekit/hmnetworkconfigurationprofiledelegate?language=objc)
    pub unsafe trait HMNetworkConfigurationProfileDelegate: NSObjectProtocol {
        #[cfg(feature = "HMAccessoryProfile")]
        /// Informs the delegate that the network access mode has updated.
        ///
        ///
        /// Parameter `profile`: Sender of the message.
        #[optional]
        #[unsafe(method(profileDidUpdateNetworkAccessMode:))]
        #[unsafe(method_family = none)]
        unsafe fn profileDidUpdateNetworkAccessMode(&self, profile: &HMNetworkConfigurationProfile);
    }
);