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")]
22unsafe impl<TargetValueType: ?Sized> NSObjectProtocol
23    for HMCharacteristicWriteAction<TargetValueType>
24{
25}
26
27#[cfg(feature = "HMAction")]
28impl<TargetValueType: Message> HMCharacteristicWriteAction<TargetValueType> {
29    extern_methods!(
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        #[unsafe(method(new))]
35        #[unsafe(method_family = new)]
36        pub unsafe fn new() -> Retained<Self>;
37
38        #[cfg(feature = "HMCharacteristic")]
39        /// Initializer method that ties the action to a particular characteristic.
40        ///
41        ///
42        /// Parameter `characteristic`: The characteristic bound to the action.
43        ///
44        ///
45        /// Parameter `targetValue`: The target value for the characteristic.
46        ///
47        ///
48        /// Returns: Instance object representing the characteristic write action.
49        #[unsafe(method(initWithCharacteristic:targetValue:))]
50        #[unsafe(method_family = init)]
51        pub unsafe fn initWithCharacteristic_targetValue(
52            this: Allocated<Self>,
53            characteristic: &HMCharacteristic,
54            target_value: &TargetValueType,
55        ) -> Retained<Self>;
56
57        #[cfg(feature = "HMCharacteristic")]
58        /// The characteristic associated with the action.
59        #[unsafe(method(characteristic))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
62
63        /// The target value for the action.
64        #[unsafe(method(targetValue))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn targetValue(&self) -> Retained<TargetValueType>;
67
68        #[cfg(feature = "block2")]
69        /// This method is used to change target value for the characteristic.
70        ///
71        ///
72        /// Parameter `targetValue`: New target value for the characteristic.
73        ///
74        ///
75        /// Parameter `completion`: Block that is invoked once the request is processed.
76        /// The NSError provides more information on the status of the request, error
77        /// will be nil on success.
78        #[unsafe(method(updateTargetValue:completionHandler:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn updateTargetValue_completionHandler(
81            &self,
82            target_value: &TargetValueType,
83            completion: &block2::Block<dyn Fn(*mut NSError)>,
84        );
85    );
86}