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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

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

unsafe impl Send for HMAccessoryOwnershipToken {}

unsafe impl Sync for HMAccessoryOwnershipToken {}

extern_conformance!(
    unsafe impl NSObjectProtocol for HMAccessoryOwnershipToken {}
);

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// Creates a new accessory ownership token to add an accessory to the home.
        ///
        ///
        /// Parameter `data`: Data to be sent to prove ownership of this accessory.
        ///
        ///
        /// This initializer may return nil if the data provided is not a valid ownership token
        /// (e.g. if it's too short or determined to be insufficient for some other reason).
        ///
        ///
        /// Returns: Returns an ownership token object.
        #[unsafe(method(initWithData:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Retained<Self>>;
    );
}

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

unsafe impl Send for HMAccessorySetupPayload {}

unsafe impl Sync for HMAccessorySetupPayload {}

extern_conformance!(
    unsafe impl NSObjectProtocol for HMAccessorySetupPayload {}
);

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// Creates a new accessory setup payload to add an accessory to the home.
        ///
        ///
        /// Parameter `setupPayloadURL`: The HomeKit setup payload for the accessory being added to the home.
        ///
        ///
        /// Returns: Returns an accessory setup payload object if successful or nil on error.
        #[unsafe(method(initWithURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL(
            this: Allocated<Self>,
            setup_payload_url: Option<&NSURL>,
        ) -> Option<Retained<Self>>;

        /// Creates a new accessory setup payload to add an accessory to the home.
        ///
        ///
        /// Parameter `setupPayloadURL`: The HomeKit setup payload URL for the accessory being added to the home.`
        ///
        ///
        /// Parameter `ownershipToken`: The token proving ownership of the accessory being added to the home.
        ///
        ///
        /// Returns: Returns an accessory setup payload object if successful or nil on error.
        #[unsafe(method(initWithURL:ownershipToken:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL_ownershipToken(
            this: Allocated<Self>,
            setup_payload_url: &NSURL,
            ownership_token: Option<&HMAccessoryOwnershipToken>,
        ) -> Option<Retained<Self>>;
    );
}