objc2-core-telephony 0.3.2

Bindings to the CoreTelephony 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 "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctsubscribertokenrefreshed?language=objc)
    #[deprecated]
    pub static CTSubscriberTokenRefreshed: &'static NSString;
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctsubscriberdelegate?language=objc)
    pub unsafe trait CTSubscriberDelegate {
        #[unsafe(method(subscriberTokenRefreshed:))]
        #[unsafe(method_family = none)]
        unsafe fn subscriberTokenRefreshed(&self, subscriber: &CTSubscriber);
    }
);

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

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

impl CTSubscriber {
    extern_methods!(
        #[unsafe(method(carrierToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn carrierToken(&self) -> Option<Retained<NSData>>;

        #[unsafe(method(refreshCarrierToken))]
        #[unsafe(method_family = none)]
        pub unsafe fn refreshCarrierToken(&self) -> bool;

        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        #[unsafe(method(isSIMInserted))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSIMInserted(&self) -> bool;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self)
            -> Option<Retained<ProtocolObject<dyn CTSubscriberDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CTSubscriberDelegate>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl CTSubscriber {
    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>;
    );
}