objc2-core-haptics 0.3.2

Bindings to the CoreHaptics 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_protocol!(
    /// A protocol for querying mininum, maximum, and default values for a CHHapticEventParameter or CHHapticDynamicParameter.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparameterattributes?language=objc)
    pub unsafe trait CHHapticParameterAttributes: NSObjectProtocol {
        /// The minimum value for the parameter.
        #[unsafe(method(minValue))]
        #[unsafe(method_family = none)]
        unsafe fn minValue(&self) -> c_float;

        /// The maximum value for the parameter.
        #[unsafe(method(maxValue))]
        #[unsafe(method_family = none)]
        unsafe fn maxValue(&self) -> c_float;

        /// The default value for the parameter.
        #[unsafe(method(defaultValue))]
        #[unsafe(method_family = none)]
        unsafe fn defaultValue(&self) -> c_float;
    }
);

extern_protocol!(
    /// A protocol which defines properties describing haptics and audio capabilities for a particular device.
    /// These properties include limitations and ranges of parameters.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdevicecapability?language=objc)
    pub unsafe trait CHHapticDeviceCapability {
        /// Returns YES if the hardware supports haptic event playback.
        #[unsafe(method(supportsHaptics))]
        #[unsafe(method_family = none)]
        unsafe fn supportsHaptics(&self) -> bool;

        /// Returns YES if the hardware supports audio event playback.
        #[unsafe(method(supportsAudio))]
        #[unsafe(method_family = none)]
        unsafe fn supportsAudio(&self) -> bool;

        #[cfg(all(feature = "CHHapticEvent", feature = "CHHapticParameter"))]
        /// Return information about the given CHHapticEventParameter as it applies to the specified event type.
        ///
        /// Parameter `inParameter`: A CHHapticEventParameter to be queried.
        ///
        /// Parameter `type`: A CHHapticEventType to be queried.
        ///
        /// Parameter `outError`: If the operation fails, this will be set to a valid NSError describing the error.
        ///
        /// These values may vary across different device types.
        #[unsafe(method(attributesForEventParameter:eventType:error:_))]
        #[unsafe(method_family = none)]
        unsafe fn attributesForEventParameter_eventType_error(
            &self,
            in_parameter: &CHHapticEventParameterID,
            r#type: &CHHapticEventType,
        ) -> Result<Retained<ProtocolObject<dyn CHHapticParameterAttributes>>, Retained<NSError>>;

        #[cfg(feature = "CHHapticParameter")]
        /// Return information about the given CHHapticDynamicParameter.
        ///
        /// Parameter `inParameter`: A CHHapticDynamicParameter to be queried.
        ///
        /// Parameter `outError`: If the operation fails, this will be set to a valid NSError describing the error.
        ///
        /// These values may vary across different device types.
        #[unsafe(method(attributesForDynamicParameter:error:_))]
        #[unsafe(method_family = none)]
        unsafe fn attributesForDynamicParameter_error(
            &self,
            in_parameter: &CHHapticDynamicParameterID,
        ) -> Result<Retained<ProtocolObject<dyn CHHapticParameterAttributes>>, Retained<NSError>>;
    }
);