objc2-thread-network 0.3.2

Bindings to the ThreadNetwork 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!(
    /// A class that contains credentials for a Thread network.
    ///
    /// A Thread network defines parameters that all connected devices use.
    /// ``THCredentials`` provides these parameters.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/threadnetwork/thcredentials?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct THCredentials;
);

extern_conformance!(
    unsafe impl NSCoding for THCredentials {}
);

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

extern_conformance!(
    unsafe impl NSSecureCoding for THCredentials {}
);

impl THCredentials {
    extern_methods!(
        /// The Thread network name.
        #[unsafe(method(networkName))]
        #[unsafe(method_family = none)]
        pub unsafe fn networkName(&self) -> Option<Retained<NSString>>;

        /// The Thread network extended PAN identifier.
        #[unsafe(method(extendedPANID))]
        #[unsafe(method_family = none)]
        pub unsafe fn extendedPANID(&self) -> Option<Retained<NSData>>;

        /// The identifer of an active Thread network Border Agent.
        ///
        /// This property’s value is the MAC Extended Address, a random identifier that
        /// the active Thread network border router generates.
        #[unsafe(method(borderAgentID))]
        #[unsafe(method_family = none)]
        pub unsafe fn borderAgentID(&self) -> Option<Retained<NSData>>;

        /// The essential operational parameters for the Thread network.
        ///
        /// The framework parses this property, then extracts and sets
        /// ``THCredentials/channel``, ``THCredentials/extendedPANID``,
        /// ``THCredentials/networkKey``, ``THCredentials/networkName``,
        /// ``THCredentials/panID``, and ``THCredentials/PSKC`` when you call
        /// ``THClient/storeCredentialsForBorderAgent:activeOperationalDataSet:completion:``.
        #[unsafe(method(activeOperationalDataSet))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeOperationalDataSet(&self) -> Option<Retained<NSData>>;

        /// The sixteen byte Thread network key.
        #[unsafe(method(networkKey))]
        #[unsafe(method_family = none)]
        pub unsafe fn networkKey(&self) -> Option<Retained<NSData>>;

        /// The sixteen byte Thread network pre-shared key for the Commissioner.
        #[unsafe(method(PSKC))]
        #[unsafe(method_family = none)]
        pub unsafe fn PSKC(&self) -> Option<Retained<NSData>>;

        /// The Thread network radio channel.
        #[unsafe(method(channel))]
        #[unsafe(method_family = none)]
        pub unsafe fn channel(&self) -> u8;

        /// Setter for [`channel`][Self::channel].
        #[unsafe(method(setChannel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChannel(&self, channel: u8);

        /// The two byte Thead network PAN identifier.
        #[unsafe(method(panID))]
        #[unsafe(method_family = none)]
        pub unsafe fn panID(&self) -> Option<Retained<NSData>>;

        /// The date and time that the framework stored the credential in the database.
        #[unsafe(method(creationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;

        /// The date and time that the framework updated the credential in the database.
        #[unsafe(method(lastModificationDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn lastModificationDate(&self) -> Option<Retained<NSDate>>;

        #[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>;
    );
}