objc2-io-bluetooth-ui 0.3.2

Bindings to the IOBluetoothUI framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/iobluetoothdeviceselectorcontrollerref?language=objc)
#[repr(C)]
pub struct IOBluetoothDeviceSelectorControllerRef {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2-core-foundation")]
cf_type!(
    unsafe impl IOBluetoothDeviceSelectorControllerRef {}
);
cf_objc2_type!(
    unsafe impl RefEncode<"OpaqueIOBluetoothObjectRef"> for IOBluetoothDeviceSelectorControllerRef {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/iobluetoothpairingcontrollerref?language=objc)
#[repr(C)]
pub struct IOBluetoothPairingControllerRef {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2-core-foundation")]
cf_type!(
    unsafe impl IOBluetoothPairingControllerRef {}
);
cf_objc2_type!(
    unsafe impl RefEncode<"OpaqueIOBluetoothObjectRef"> for IOBluetoothPairingControllerRef {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/iobluetoothservicebrowsercontrollerref?language=objc)
#[repr(C)]
pub struct IOBluetoothServiceBrowserControllerRef {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2-core-foundation")]
cf_type!(
    unsafe impl IOBluetoothServiceBrowserControllerRef {}
);
cf_objc2_type!(
    unsafe impl RefEncode<"OpaqueIOBluetoothObjectRef"> for IOBluetoothServiceBrowserControllerRef {}
);

/// Option values to customize the behavior of an IOBluetoothServiceBrowserController object.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/iobluetoothservicebrowsercontrolleroptions?language=objc)
pub type IOBluetoothServiceBrowserControllerOptions = u32;

/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/kiobluetoothservicebrowsercontrolleroptionsnone?language=objc)
pub const kIOBluetoothServiceBrowserControllerOptionsNone: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/kiobluetoothservicebrowsercontrolleroptionsautostartinquiry?language=objc)
pub const kIOBluetoothServiceBrowserControllerOptionsAutoStartInquiry: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/kiobluetoothservicebrowsercontrolleroptionsdisconnectwhendone?language=objc)
pub const kIOBluetoothServiceBrowserControllerOptionsDisconnectWhenDone: c_uint = 1 << 1;

/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/kiobluetoothuisuccess?language=objc)
pub const kIOBluetoothUISuccess: c_int = -1000;
/// [Apple's documentation](https://developer.apple.com/documentation/iobluetoothui/kiobluetoothuiusercancelederr?language=objc)
pub const kIOBluetoothUIUserCanceledErr: c_int = -1001;

extern "C-unwind" {
    /// # Safety
    ///
    /// - `cancel_button_title` might not allow `None`.
    /// - `description_text` might not allow `None`.
    #[cfg(feature = "objc2-core-foundation")]
    pub fn IOBluetoothValidateHardwareWithDescription(
        cancel_button_title: Option<&CFString>,
        description_text: Option<&CFString>,
    ) -> IOReturn;
}

#[cfg(feature = "objc2-core-foundation")]
#[inline]
pub unsafe extern "C-unwind" fn IOBluetoothGetPairingController(
) -> Option<CFRetained<IOBluetoothPairingControllerRef>> {
    extern "C-unwind" {
        fn IOBluetoothGetPairingController() -> Option<NonNull<IOBluetoothPairingControllerRef>>;
    }
    let ret = unsafe { IOBluetoothGetPairingController() };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[cfg(feature = "objc2-core-foundation")]
#[inline]
pub unsafe extern "C-unwind" fn IOBluetoothGetDeviceSelectorController(
) -> Option<CFRetained<IOBluetoothDeviceSelectorControllerRef>> {
    extern "C-unwind" {
        fn IOBluetoothGetDeviceSelectorController(
        ) -> Option<NonNull<IOBluetoothDeviceSelectorControllerRef>>;
    }
    let ret = unsafe { IOBluetoothGetDeviceSelectorController() };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}