objc2_core_haptics/generated/
CHHapticDeviceCapability.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// A protocol for querying mininum, maximum, and default values for a CHHapticEventParameter or CHHapticDynamicParameter.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticparameterattributes?language=objc)
14    pub unsafe trait CHHapticParameterAttributes: NSObjectProtocol {
15        /// The minimum value for the parameter.
16        #[unsafe(method(minValue))]
17        #[unsafe(method_family = none)]
18        unsafe fn minValue(&self) -> c_float;
19
20        /// The maximum value for the parameter.
21        #[unsafe(method(maxValue))]
22        #[unsafe(method_family = none)]
23        unsafe fn maxValue(&self) -> c_float;
24
25        /// The default value for the parameter.
26        #[unsafe(method(defaultValue))]
27        #[unsafe(method_family = none)]
28        unsafe fn defaultValue(&self) -> c_float;
29    }
30);
31
32extern_protocol!(
33    /// A protocol which defines properties describing haptics and audio capabilities for a particular device.
34    /// These properties include limitations and ranges of parameters.
35    ///
36    /// See also [Apple's documentation](https://developer.apple.com/documentation/corehaptics/chhapticdevicecapability?language=objc)
37    pub unsafe trait CHHapticDeviceCapability {
38        /// Returns YES if the hardware supports haptic event playback.
39        #[unsafe(method(supportsHaptics))]
40        #[unsafe(method_family = none)]
41        unsafe fn supportsHaptics(&self) -> bool;
42
43        /// Returns YES if the hardware supports audio event playback.
44        #[unsafe(method(supportsAudio))]
45        #[unsafe(method_family = none)]
46        unsafe fn supportsAudio(&self) -> bool;
47
48        #[cfg(all(feature = "CHHapticEvent", feature = "CHHapticParameter"))]
49        /// Return information about the given CHHapticEventParameter as it applies to the specified event type.
50        ///
51        /// Parameter `inParameter`: A CHHapticEventParameter to be queried.
52        ///
53        /// Parameter `type`: A CHHapticEventType to be queried.
54        ///
55        /// Parameter `outError`: If the operation fails, this will be set to a valid NSError describing the error.
56        ///
57        /// These values may vary across different device types.
58        #[unsafe(method(attributesForEventParameter:eventType:error:_))]
59        #[unsafe(method_family = none)]
60        unsafe fn attributesForEventParameter_eventType_error(
61            &self,
62            in_parameter: &CHHapticEventParameterID,
63            r#type: &CHHapticEventType,
64        ) -> Result<Retained<ProtocolObject<dyn CHHapticParameterAttributes>>, Retained<NSError>>;
65
66        #[cfg(feature = "CHHapticParameter")]
67        /// Return information about the given CHHapticDynamicParameter.
68        ///
69        /// Parameter `inParameter`: A CHHapticDynamicParameter to be queried.
70        ///
71        /// Parameter `outError`: If the operation fails, this will be set to a valid NSError describing the error.
72        ///
73        /// These values may vary across different device types.
74        #[unsafe(method(attributesForDynamicParameter:error:_))]
75        #[unsafe(method_family = none)]
76        unsafe fn attributesForDynamicParameter_error(
77            &self,
78            in_parameter: &CHHapticDynamicParameterID,
79        ) -> Result<Retained<ProtocolObject<dyn CHHapticParameterAttributes>>, Retained<NSError>>;
80    }
81);