objc2_home_kit/generated/
HMDurationEvent.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 a duration of time.
12    ///
13    ///
14    /// Note: Characteristics turned on by the trigger will be turned off after the duration
15    /// Supported characteristics are [HMCharacteristicTypePowerState, HMCharacteristicTypeActive]
16    /// The duration event immediately ends if the characteristics are changed or updated during this period
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmdurationevent?language=objc)
19    #[unsafe(super(HMTimeEvent, HMEvent, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
22    pub struct HMDurationEvent;
23);
24
25#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
26unsafe impl Send for HMDurationEvent {}
27
28#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
29unsafe impl Sync for HMDurationEvent {}
30
31#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
32extern_conformance!(
33    unsafe impl NSCopying for HMDurationEvent {}
34);
35
36#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
37unsafe impl CopyingHelper for HMDurationEvent {
38    type Result = Self;
39}
40
41#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
42extern_conformance!(
43    unsafe impl NSMutableCopying for HMDurationEvent {}
44);
45
46#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
47unsafe impl MutableCopyingHelper for HMDurationEvent {
48    type Result = HMMutableDurationEvent;
49}
50
51#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
52extern_conformance!(
53    unsafe impl NSObjectProtocol for HMDurationEvent {}
54);
55
56#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
57impl HMDurationEvent {
58    extern_methods!(
59        #[unsafe(method(init))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62
63        /// Creates a duration time event.
64        ///
65        ///
66        /// Parameter `duration`: The duration of time in seconds.
67        ///
68        ///
69        /// Returns: Instance object representing the duration event.
70        #[unsafe(method(initWithDuration:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithDuration(
73            this: Allocated<Self>,
74            duration: NSTimeInterval,
75        ) -> Retained<Self>;
76
77        /// duration The duration of time in seconds.
78        ///
79        /// This property is not atomic.
80        ///
81        /// # Safety
82        ///
83        /// This might not be thread-safe.
84        #[unsafe(method(duration))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn duration(&self) -> NSTimeInterval;
87    );
88}
89
90/// Methods declared on superclass `HMEvent`.
91#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
92impl HMDurationEvent {
93    extern_methods!(
94        #[deprecated = "HMEvent is abstract"]
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub unsafe fn new() -> Retained<Self>;
98    );
99}
100
101extern_class!(
102    /// This class is used to represent a duration of time.
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutabledurationevent?language=objc)
105    #[unsafe(super(HMDurationEvent, HMTimeEvent, HMEvent, NSObject))]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
108    pub struct HMMutableDurationEvent;
109);
110
111#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
112unsafe impl Send for HMMutableDurationEvent {}
113
114#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
115unsafe impl Sync for HMMutableDurationEvent {}
116
117#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
118extern_conformance!(
119    unsafe impl NSCopying for HMMutableDurationEvent {}
120);
121
122#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
123unsafe impl CopyingHelper for HMMutableDurationEvent {
124    type Result = HMDurationEvent;
125}
126
127#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
128extern_conformance!(
129    unsafe impl NSMutableCopying for HMMutableDurationEvent {}
130);
131
132#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
133unsafe impl MutableCopyingHelper for HMMutableDurationEvent {
134    type Result = Self;
135}
136
137#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
138extern_conformance!(
139    unsafe impl NSObjectProtocol for HMMutableDurationEvent {}
140);
141
142#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
143impl HMMutableDurationEvent {
144    extern_methods!(
145        #[unsafe(method(init))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149        /// duration The duration of time in seconds.
150        ///
151        /// This property is not atomic.
152        ///
153        /// # Safety
154        ///
155        /// This might not be thread-safe.
156        #[unsafe(method(duration))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn duration(&self) -> NSTimeInterval;
159
160        /// Setter for [`duration`][Self::duration].
161        ///
162        /// # Safety
163        ///
164        /// This might not be thread-safe.
165        #[unsafe(method(setDuration:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
168    );
169}
170
171/// Methods declared on superclass `HMDurationEvent`.
172#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
173impl HMMutableDurationEvent {
174    extern_methods!(
175        /// Creates a duration time event.
176        ///
177        ///
178        /// Parameter `duration`: The duration of time in seconds.
179        ///
180        ///
181        /// Returns: Instance object representing the duration event.
182        #[unsafe(method(initWithDuration:))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn initWithDuration(
185            this: Allocated<Self>,
186            duration: NSTimeInterval,
187        ) -> Retained<Self>;
188    );
189}
190
191/// Methods declared on superclass `HMEvent`.
192#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
193impl HMMutableDurationEvent {
194    extern_methods!(
195        #[deprecated = "HMEvent is abstract"]
196        #[unsafe(method(new))]
197        #[unsafe(method_family = new)]
198        pub unsafe fn new() -> Retained<Self>;
199    );
200}