objc2_home_kit/generated/
HMCharacteristicThresholdRangeEvent.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 when a characteristic's value falls within the specified
12    /// number range.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcharacteristicthresholdrangeevent?language=objc)
15    #[unsafe(super(HMEvent, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "HMEvent")]
18    pub struct HMCharacteristicThresholdRangeEvent;
19);
20
21#[cfg(feature = "HMEvent")]
22unsafe impl Send for HMCharacteristicThresholdRangeEvent {}
23
24#[cfg(feature = "HMEvent")]
25unsafe impl Sync for HMCharacteristicThresholdRangeEvent {}
26
27#[cfg(feature = "HMEvent")]
28extern_conformance!(
29    unsafe impl NSCopying for HMCharacteristicThresholdRangeEvent {}
30);
31
32#[cfg(feature = "HMEvent")]
33unsafe impl CopyingHelper for HMCharacteristicThresholdRangeEvent {
34    type Result = Self;
35}
36
37#[cfg(feature = "HMEvent")]
38extern_conformance!(
39    unsafe impl NSMutableCopying for HMCharacteristicThresholdRangeEvent {}
40);
41
42#[cfg(feature = "HMEvent")]
43unsafe impl MutableCopyingHelper for HMCharacteristicThresholdRangeEvent {
44    type Result = HMMutableCharacteristicThresholdRangeEvent;
45}
46
47#[cfg(feature = "HMEvent")]
48extern_conformance!(
49    unsafe impl NSObjectProtocol for HMCharacteristicThresholdRangeEvent {}
50);
51
52#[cfg(feature = "HMEvent")]
53impl HMCharacteristicThresholdRangeEvent {
54    extern_methods!(
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[cfg(all(feature = "HMCharacteristic", feature = "HMNumberRange"))]
60        /// Initializes a new characteristic number range event object
61        ///
62        ///
63        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
64        /// support notification. An exception will be thrown otherwise.
65        ///
66        ///
67        /// Parameter `thresholdRange`: The range for the characteristic value to trigger the event.
68        ///
69        ///
70        /// Returns: Instance object representing the characteristic event.
71        #[unsafe(method(initWithCharacteristic:thresholdRange:))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn initWithCharacteristic_thresholdRange(
74            this: Allocated<Self>,
75            characteristic: &HMCharacteristic,
76            threshold_range: &HMNumberRange,
77        ) -> Retained<Self>;
78
79        #[cfg(feature = "HMCharacteristic")]
80        /// The characteristic associated with the event.
81        ///
82        /// This property is not atomic.
83        ///
84        /// # Safety
85        ///
86        /// This might not be thread-safe.
87        #[unsafe(method(characteristic))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
90
91        #[cfg(feature = "HMNumberRange")]
92        /// The range of the characteristic value that triggers the event.
93        ///
94        /// This property is not atomic.
95        ///
96        /// # Safety
97        ///
98        /// This might not be thread-safe.
99        #[unsafe(method(thresholdRange))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn thresholdRange(&self) -> Retained<HMNumberRange>;
102    );
103}
104
105/// Methods declared on superclass `HMEvent`.
106#[cfg(feature = "HMEvent")]
107impl HMCharacteristicThresholdRangeEvent {
108    extern_methods!(
109        #[deprecated = "HMEvent is abstract"]
110        #[unsafe(method(new))]
111        #[unsafe(method_family = new)]
112        pub unsafe fn new() -> Retained<Self>;
113    );
114}
115
116extern_class!(
117    /// This class represents an event when a characteristic's value falls within the specified
118    /// number range.
119    ///
120    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablecharacteristicthresholdrangeevent?language=objc)
121    #[unsafe(super(HMCharacteristicThresholdRangeEvent, HMEvent, NSObject))]
122    #[derive(Debug, PartialEq, Eq, Hash)]
123    #[cfg(feature = "HMEvent")]
124    pub struct HMMutableCharacteristicThresholdRangeEvent;
125);
126
127#[cfg(feature = "HMEvent")]
128unsafe impl Send for HMMutableCharacteristicThresholdRangeEvent {}
129
130#[cfg(feature = "HMEvent")]
131unsafe impl Sync for HMMutableCharacteristicThresholdRangeEvent {}
132
133#[cfg(feature = "HMEvent")]
134extern_conformance!(
135    unsafe impl NSCopying for HMMutableCharacteristicThresholdRangeEvent {}
136);
137
138#[cfg(feature = "HMEvent")]
139unsafe impl CopyingHelper for HMMutableCharacteristicThresholdRangeEvent {
140    type Result = HMCharacteristicThresholdRangeEvent;
141}
142
143#[cfg(feature = "HMEvent")]
144extern_conformance!(
145    unsafe impl NSMutableCopying for HMMutableCharacteristicThresholdRangeEvent {}
146);
147
148#[cfg(feature = "HMEvent")]
149unsafe impl MutableCopyingHelper for HMMutableCharacteristicThresholdRangeEvent {
150    type Result = Self;
151}
152
153#[cfg(feature = "HMEvent")]
154extern_conformance!(
155    unsafe impl NSObjectProtocol for HMMutableCharacteristicThresholdRangeEvent {}
156);
157
158#[cfg(feature = "HMEvent")]
159impl HMMutableCharacteristicThresholdRangeEvent {
160    extern_methods!(
161        #[unsafe(method(init))]
162        #[unsafe(method_family = init)]
163        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
164
165        #[cfg(feature = "HMCharacteristic")]
166        /// The characteristic associated with the event.
167        ///
168        /// This property is not atomic.
169        ///
170        /// # Safety
171        ///
172        /// This might not be thread-safe.
173        #[unsafe(method(characteristic))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn characteristic(&self) -> Retained<HMCharacteristic>;
176
177        #[cfg(feature = "HMCharacteristic")]
178        /// Setter for [`characteristic`][Self::characteristic].
179        ///
180        /// # Safety
181        ///
182        /// This might not be thread-safe.
183        #[unsafe(method(setCharacteristic:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setCharacteristic(&self, characteristic: &HMCharacteristic);
186
187        #[cfg(feature = "HMNumberRange")]
188        /// The range of the characteristic value that triggers the event.
189        ///
190        /// This property is not atomic.
191        ///
192        /// # Safety
193        ///
194        /// This might not be thread-safe.
195        #[unsafe(method(thresholdRange))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn thresholdRange(&self) -> Retained<HMNumberRange>;
198
199        #[cfg(feature = "HMNumberRange")]
200        /// Setter for [`thresholdRange`][Self::thresholdRange].
201        ///
202        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
203        ///
204        /// # Safety
205        ///
206        /// This might not be thread-safe.
207        #[unsafe(method(setThresholdRange:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setThresholdRange(&self, threshold_range: &HMNumberRange);
210    );
211}
212
213/// Methods declared on superclass `HMCharacteristicThresholdRangeEvent`.
214#[cfg(feature = "HMEvent")]
215impl HMMutableCharacteristicThresholdRangeEvent {
216    extern_methods!(
217        #[cfg(all(feature = "HMCharacteristic", feature = "HMNumberRange"))]
218        /// Initializes a new characteristic number range event object
219        ///
220        ///
221        /// Parameter `characteristic`: The characteristic bound to the event. The characteristic must
222        /// support notification. An exception will be thrown otherwise.
223        ///
224        ///
225        /// Parameter `thresholdRange`: The range for the characteristic value to trigger the event.
226        ///
227        ///
228        /// Returns: Instance object representing the characteristic event.
229        #[unsafe(method(initWithCharacteristic:thresholdRange:))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn initWithCharacteristic_thresholdRange(
232            this: Allocated<Self>,
233            characteristic: &HMCharacteristic,
234            threshold_range: &HMNumberRange,
235        ) -> Retained<Self>;
236    );
237}
238
239/// Methods declared on superclass `HMEvent`.
240#[cfg(feature = "HMEvent")]
241impl HMMutableCharacteristicThresholdRangeEvent {
242    extern_methods!(
243        #[deprecated = "HMEvent is abstract"]
244        #[unsafe(method(new))]
245        #[unsafe(method_family = new)]
246        pub unsafe fn new() -> Retained<Self>;
247    );
248}