objc2_home_kit/generated/
HMCharacteristicEvent.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 represents an event that is evaluated based on the value of a characteristic
12    /// set to a particular value.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcharacteristicevent?language=objc)
15    #[unsafe(super(HMEvent, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "HMEvent")]
18    pub struct HMCharacteristicEvent<TriggerValueType: ?Sized = AnyObject>;
19);
20
21#[cfg(feature = "HMEvent")]
22extern_conformance!(
23    unsafe impl<TriggerValueType: ?Sized> NSCopying for HMCharacteristicEvent<TriggerValueType> {}
24);
25
26#[cfg(feature = "HMEvent")]
27unsafe impl<TriggerValueType: ?Sized + Message> CopyingHelper
28    for HMCharacteristicEvent<TriggerValueType>
29{
30    type Result = Self;
31}
32
33#[cfg(feature = "HMEvent")]
34extern_conformance!(
35    unsafe impl<TriggerValueType: ?Sized> NSMutableCopying for HMCharacteristicEvent<TriggerValueType> {}
36);
37
38#[cfg(feature = "HMEvent")]
39unsafe impl<TriggerValueType: ?Sized + Message> MutableCopyingHelper
40    for HMCharacteristicEvent<TriggerValueType>
41{
42    type Result = HMMutableCharacteristicEvent<TriggerValueType>;
43}
44
45#[cfg(feature = "HMEvent")]
46extern_conformance!(
47    unsafe impl<TriggerValueType: ?Sized> NSObjectProtocol for HMCharacteristicEvent<TriggerValueType> {}
48);
49
50#[cfg(feature = "HMEvent")]
51impl<TriggerValueType: Message> HMCharacteristicEvent<TriggerValueType> {
52    extern_methods!(
53        #[unsafe(method(init))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
56
57        #[cfg(feature = "HMCharacteristic")]
58        /// Initializes a new characteristic event object
59        ///
60        ///
61        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
62        /// support notification. An exception will be thrown otherwise.
63        ///
64        ///
65        /// Parameter `triggerValue`: The value of the characteristic that triggers the event.
66        /// Specifying nil as the trigger value corresponds to any change in the value of the
67        /// characteristic.
68        ///
69        ///
70        /// Returns: Instance object representing the characteristic event.
71        #[unsafe(method(initWithCharacteristic:triggerValue:))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn initWithCharacteristic_triggerValue(
74            this: Allocated<Self>,
75            characteristic: &HMCharacteristic,
76            trigger_value: Option<&TriggerValueType>,
77        ) -> Retained<Self>;
78
79        #[cfg(feature = "HMCharacteristic")]
80        /// The characteristic associated with the event.
81        #[unsafe(method(characteristic))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
84
85        /// The value of the characteristic that triggers the event.
86        /// A value of nil corresponds to any change in the value of the characteristic.
87        #[unsafe(method(triggerValue))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn triggerValue(&self) -> Option<Retained<TriggerValueType>>;
90
91        #[cfg(feature = "block2")]
92        /// This method is used to change trigger value for the characteristic.
93        ///
94        ///
95        /// Parameter `triggerValue`: New trigger value for the characteristic.
96        /// Specifying nil as the trigger value corresponds to any change in the value of the
97        /// characteristic.
98        ///
99        ///
100        /// Parameter `completion`: Block that is invoked once the request is processed.
101        /// The NSError provides more information on the status of the request, error
102        /// will be nil on success.
103        #[deprecated = "No longer supported."]
104        #[unsafe(method(updateTriggerValue:completionHandler:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn updateTriggerValue_completionHandler(
107            &self,
108            trigger_value: Option<&TriggerValueType>,
109            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
110        );
111    );
112}
113
114/// Methods declared on superclass `HMEvent`.
115#[cfg(feature = "HMEvent")]
116impl<TriggerValueType: Message> HMCharacteristicEvent<TriggerValueType> {
117    extern_methods!(
118        #[deprecated = "HMEvent is abstract"]
119        #[unsafe(method(new))]
120        #[unsafe(method_family = new)]
121        pub unsafe fn new() -> Retained<Self>;
122    );
123}
124
125extern_class!(
126    /// This class represents an event that is evaluated based on the value of a characteristic
127    /// set to a particular value.
128    ///
129    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablecharacteristicevent?language=objc)
130    #[unsafe(super(HMCharacteristicEvent, HMEvent, NSObject))]
131    #[derive(Debug, PartialEq, Eq, Hash)]
132    #[cfg(feature = "HMEvent")]
133    pub struct HMMutableCharacteristicEvent<TriggerValueType: ?Sized = AnyObject>;
134);
135
136#[cfg(feature = "HMEvent")]
137extern_conformance!(
138    unsafe impl<TriggerValueType: ?Sized> NSCopying for HMMutableCharacteristicEvent<TriggerValueType> {}
139);
140
141#[cfg(feature = "HMEvent")]
142unsafe impl<TriggerValueType: ?Sized + Message> CopyingHelper
143    for HMMutableCharacteristicEvent<TriggerValueType>
144{
145    type Result = HMCharacteristicEvent<TriggerValueType>;
146}
147
148#[cfg(feature = "HMEvent")]
149extern_conformance!(
150    unsafe impl<TriggerValueType: ?Sized> NSMutableCopying
151        for HMMutableCharacteristicEvent<TriggerValueType>
152    {
153    }
154);
155
156#[cfg(feature = "HMEvent")]
157unsafe impl<TriggerValueType: ?Sized + Message> MutableCopyingHelper
158    for HMMutableCharacteristicEvent<TriggerValueType>
159{
160    type Result = Self;
161}
162
163#[cfg(feature = "HMEvent")]
164extern_conformance!(
165    unsafe impl<TriggerValueType: ?Sized> NSObjectProtocol
166        for HMMutableCharacteristicEvent<TriggerValueType>
167    {
168    }
169);
170
171#[cfg(feature = "HMEvent")]
172impl<TriggerValueType: Message> HMMutableCharacteristicEvent<TriggerValueType> {
173    extern_methods!(
174        #[unsafe(method(init))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
177
178        #[cfg(feature = "HMCharacteristic")]
179        /// The characteristic associated with the event.
180        #[unsafe(method(characteristic))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
183
184        #[cfg(feature = "HMCharacteristic")]
185        /// Setter for [`characteristic`][Self::characteristic].
186        #[unsafe(method(setCharacteristic:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setCharacteristic(&self, characteristic: &HMCharacteristic);
189
190        /// The value of the characteristic that triggers the event.
191        /// A value of nil corresponds to any change in the value of the characteristic.
192        #[unsafe(method(triggerValue))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn triggerValue(&self) -> Option<Retained<TriggerValueType>>;
195
196        /// Setter for [`triggerValue`][Self::triggerValue].
197        #[unsafe(method(setTriggerValue:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setTriggerValue(&self, trigger_value: Option<&TriggerValueType>);
200    );
201}
202
203/// Methods declared on superclass `HMCharacteristicEvent`.
204#[cfg(feature = "HMEvent")]
205impl<TriggerValueType: Message> HMMutableCharacteristicEvent<TriggerValueType> {
206    extern_methods!(
207        #[cfg(feature = "HMCharacteristic")]
208        /// Initializes a new characteristic event object
209        ///
210        ///
211        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
212        /// support notification. An exception will be thrown otherwise.
213        ///
214        ///
215        /// Parameter `triggerValue`: The value of the characteristic that triggers the event.
216        /// Specifying nil as the trigger value corresponds to any change in the value of the
217        /// characteristic.
218        ///
219        ///
220        /// Returns: Instance object representing the characteristic event.
221        #[unsafe(method(initWithCharacteristic:triggerValue:))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn initWithCharacteristic_triggerValue(
224            this: Allocated<Self>,
225            characteristic: &HMCharacteristic,
226            trigger_value: Option<&TriggerValueType>,
227        ) -> Retained<Self>;
228    );
229}
230
231/// Methods declared on superclass `HMEvent`.
232#[cfg(feature = "HMEvent")]
233impl<TriggerValueType: Message> HMMutableCharacteristicEvent<TriggerValueType> {
234    extern_methods!(
235        #[deprecated = "HMEvent is abstract"]
236        #[unsafe(method(new))]
237        #[unsafe(method_family = new)]
238        pub unsafe fn new() -> Retained<Self>;
239    );
240}