objc2-io-bluetooth 0.3.2

Bindings to the IOBluetooth 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::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// APIs for managing a hands free audio gateway
    ///
    /// (c) 2010 by Apple Inc. All rights reserved.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothhandsfreeaudiogateway?language=objc)
    #[unsafe(super(IOBluetoothHandsFree, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "IOBluetoothHandsFree")]
    pub struct IOBluetoothHandsFreeAudioGateway;
);

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

#[cfg(feature = "IOBluetoothHandsFree")]
impl IOBluetoothHandsFreeAudioGateway {
    extern_methods!(
        #[cfg(all(feature = "IOBluetoothDevice", feature = "IOBluetoothObject"))]
        /// Create a new IOBluetoothHandsFreeAudioGateway to act as a hands free gateway
        ///
        /// This will register a listener for incoming connections.
        ///
        /// Parameter `device`: An IOBluetoothDevice
        ///
        /// Parameter `inDelegate`: An object to act as delegate
        ///
        /// Returns: A newly created IOBluetoothHandsFreeAudioGateway object on success, nil on failure
        ///
        /// # Safety
        ///
        /// - `device` might not allow `None`.
        /// - `in_delegate` should be of the correct type.
        /// - `in_delegate` might not allow `None`.
        #[unsafe(method(initWithDevice:delegate:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDevice_delegate(
            this: Allocated<Self>,
            device: Option<&IOBluetoothDevice>,
            in_delegate: Option<&AnyObject>,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "objc2-foundation")]
        /// Create an indicator
        ///
        /// Creates an indicator with min and max values and sets the current value. The current value must be valid.
        ///
        /// Parameter `indicatorName`: See  �Hands free indicator constants," for standard indicator names.
        ///
        /// Parameter `minValue`: Minimum value allowed for the indicator
        ///
        /// Parameter `maxValue`: Maximum value allowed for the indicator
        ///
        /// Parameter `currentValue`: The current indicator value. Must be within the min and max values passed in or the indicator will not be created.
        ///
        /// # Safety
        ///
        /// `indicator_name` might not allow `None`.
        #[unsafe(method(createIndicator:min:max:currentValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn createIndicator_min_max_currentValue(
            &self,
            indicator_name: Option<&NSString>,
            min_value: c_int,
            max_value: c_int,
            current_value: c_int,
        );

        #[cfg(feature = "objc2-foundation")]
        /// Handles AT commands sent from the hands free device
        ///
        /// Implement this in a subclass if you wish to respond to additional AT commands or to change the default response.
        ///
        /// Parameter `atCommand`: The at command from the hands free device
        ///
        /// # Safety
        ///
        /// `at_command` might not allow `None`.
        #[unsafe(method(processATCommand:))]
        #[unsafe(method_family = none)]
        pub unsafe fn processATCommand(&self, at_command: Option<&NSString>);

        /// Sends an OK response
        ///
        /// Use this to respond OK.
        #[unsafe(method(sendOKResponse))]
        #[unsafe(method_family = none)]
        pub unsafe fn sendOKResponse(&self);

        #[cfg(feature = "objc2-foundation")]
        /// Sends a response to the hands free device
        ///
        /// Use this to send a response followed by an OK. Equivalent to [sendResponse:response withOK:YES].
        ///
        /// Parameter `response`: The response to send to the hands free device
        ///
        /// # Safety
        ///
        /// `response` might not allow `None`.
        #[unsafe(method(sendResponse:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sendResponse(&self, response: Option<&NSString>);

        #[cfg(feature = "objc2-foundation")]
        /// Sends a response to the hands free device
        ///
        /// Use this to send a response and optionally followed by an OK.
        ///
        /// Parameter `response`: The response to send to the hands free device
        ///
        /// Parameter `withOK`: If yes, an OK response will also be sent.
        ///
        /// # Safety
        ///
        /// `response` might not allow `None`.
        #[unsafe(method(sendResponse:withOK:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sendResponse_withOK(&self, response: Option<&NSString>, with_ok: bool);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "IOBluetoothHandsFree")]
impl IOBluetoothHandsFreeAudioGateway {
    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>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothhandsfreeaudiogatewaydelegate?language=objc)
    pub unsafe trait IOBluetoothHandsFreeAudioGatewayDelegate {
        #[cfg(all(feature = "IOBluetoothHandsFree", feature = "objc2-foundation"))]
        /// Tells the delegate that the device is sending a hangup.
        ///
        /// Parameter `device`: The IOBluetoothHandsFreeAudioGateway object
        ///
        /// Parameter `redial`: Always 1.
        ///
        /// # Safety
        ///
        /// - `device` might not allow `None`.
        /// - `hangup` might not allow `None`.
        #[optional]
        #[unsafe(method(handsFree:hangup:))]
        #[unsafe(method_family = none)]
        unsafe fn handsFree_hangup(
            &self,
            device: Option<&IOBluetoothHandsFreeAudioGateway>,
            hangup: Option<&NSNumber>,
        );

        #[cfg(all(feature = "IOBluetoothHandsFree", feature = "objc2-foundation"))]
        /// Tells the delegate that the device is trying to redial.
        ///
        /// Parameter `device`: The IOBluetoothHandsFreeAudioGateway object
        ///
        /// Parameter `redial`: Always 1.
        ///
        /// # Safety
        ///
        /// - `device` might not allow `None`.
        /// - `redial` might not allow `None`.
        #[optional]
        #[unsafe(method(handsFree:redial:))]
        #[unsafe(method_family = none)]
        unsafe fn handsFree_redial(
            &self,
            device: Option<&IOBluetoothHandsFreeAudioGateway>,
            redial: Option<&NSNumber>,
        );
    }
);