objc2_home_kit/generated/
HMCharacteristicWriteAction.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_class!(
11    /// This class is used to represent an entry in an action set that writes a specific
12    /// value to a characteristic.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcharacteristicwriteaction?language=objc)
15    #[unsafe(super(HMAction, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "HMAction")]
18    pub struct HMCharacteristicWriteAction<TargetValueType: ?Sized = AnyObject>;
19);
20
21#[cfg(feature = "HMAction")]
22extern_conformance!(
23    unsafe impl<TargetValueType: ?Sized> NSObjectProtocol
24        for HMCharacteristicWriteAction<TargetValueType>
25    {
26    }
27);
28
29#[cfg(feature = "HMAction")]
30impl<TargetValueType: Message> HMCharacteristicWriteAction<TargetValueType> {
31    extern_methods!(
32        #[unsafe(method(init))]
33        #[unsafe(method_family = init)]
34        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36        #[unsafe(method(new))]
37        #[unsafe(method_family = new)]
38        pub unsafe fn new() -> Retained<Self>;
39
40        #[cfg(feature = "HMCharacteristic")]
41        /// Initializer method that ties the action to a particular characteristic.
42        ///
43        ///
44        /// Parameter `characteristic`: The characteristic bound to the action.
45        ///
46        ///
47        /// Parameter `targetValue`: The target value for the characteristic.
48        ///
49        ///
50        /// Returns: Instance object representing the characteristic write action.
51        #[unsafe(method(initWithCharacteristic:targetValue:))]
52        #[unsafe(method_family = init)]
53        pub unsafe fn initWithCharacteristic_targetValue(
54            this: Allocated<Self>,
55            characteristic: &HMCharacteristic,
56            target_value: &TargetValueType,
57        ) -> Retained<Self>;
58
59        #[cfg(feature = "HMCharacteristic")]
60        /// The characteristic associated with the action.
61        #[unsafe(method(characteristic))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
64
65        /// The target value for the action.
66        #[unsafe(method(targetValue))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn targetValue(&self) -> Retained<TargetValueType>;
69
70        #[cfg(feature = "block2")]
71        /// This method is used to change target value for the characteristic.
72        ///
73        ///
74        /// Parameter `targetValue`: New target value for the characteristic.
75        ///
76        ///
77        /// Parameter `completion`: Block that is invoked once the request is processed.
78        /// The NSError provides more information on the status of the request, error
79        /// will be nil on success.
80        #[unsafe(method(updateTargetValue:completionHandler:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn updateTargetValue_completionHandler(
83            &self,
84            target_value: &TargetValueType,
85            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
86        );
87    );
88}