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